Informing Three.js about updates
If you've worked a bit longer with Three.js, you'll probably have noticed that sometimes, it seems that changes you make to a certain geometry doesn't always result in a change onscreen. This is because for performance reasons, Three.js caches some objects (such as the vertices and faces of a geometry) and doesn't automatically detect updates. For these kinds of changes, you'll have to explicitly inform Three.js that something has changed. In this recipe, we'll show you what properties of a geometry are cached and require explicit notification to Three.js to be updated. These properties are:
geometry.vertices
geometry.faces
geometry.morphTargets
geometry.faceVertexUvs
geometry.faces[i].normal
andgeometry.vertices[i].normal
geometry.faces[i].color
andgeometry.vertices[i].color
geometry.vertices[i].tangent
geometry.lineDistances
Getting ready
An example is available that allows you to change two properties that require an explicit update...