marqso
marqso

Reputation: 61

Extrude Buffer Geometry in Three.js?

I recently went back through a scene, replacing all the creations of new THREE.SphereGeometry() with buffer geometries: new THREE.SphereBufferGeometry() (cylinder, circle, box, etc.) down the line for all my geometries.

Hit a snag creating new THREE.ExtrudeBufferGeometry()

Is there a buffered version of THREE.ExtrudeGeometry? And how do I create it?

Upvotes: 2

Views: 2156

Answers (1)

marqso
marqso

Reputation: 61

I believe I have my answer: You create the extrude geometry first, then create a buffer geometry from it.

This example assumes you have already extruded a geometry called "extrugeom":

var buffgeom = new THREE.BufferGeometry();
buffgeom.fromGeometry(extrugeom);
var mat = new THREE.MeshBasicMaterial({ color: 0x0000ff });
var mes = new THREE.Mesh(buffgeom, mat);

Upvotes: 2

Related Questions