Hey, im still struggling to migrate from Geometry to BufferGeometry (r125), although i mostly used BufferGeometry already. I feel like the documentation for migrating this “breaking change” is missing more complex use cases.
Im currently messing around with positioning single vertex points and making custom shapes from points with applying textures.
For example, Im using BoxGeometry and change position of vertices of the cuboid.
Before r125, when changing a vertex, all faces connected to that vertex would be changed accordingly (indexed geometry):
this.geometry = new THREE.BoxGeometry(1, 1, 1)
this.geometry.vertices[5].x = IIP.x
this.geometry.vertices[5].y = IIP.y
this.geometry.vertices[5].z = IIP.z
this.geometry.verticesNeedUpdate = true
this.mesh.updateMatrixWorld()
Now Im trying:
this.geometry = new THREE.BoxGeometry(1, 1, 1)
let position = this.geometry.attributes.position
position.setXYZ(5, IIP.x, IIP.y, IIP.z)
position.needsUpdate = true
this.mesh.updateMatrixWorld()
Unfortunately BufferGeometry has no indexed geometry as I found out. Internet forums are suggesting using BufferGeometryUtils.mergeVertices(geometry)
to get a indexed geometry, but it does not have any effect on my geo…?
See this demo
Any help appreciated!