The upcoming release
r125 will contain a major, potentially breaking change. The class
THREE.Geometry will be no longer part of the core but moved to
jsm/deprecated/Geometry.js. It will only be available as an ES6 module and not as a global script.
What does that mean for me?
If you are loading your assets with one of the official loaders like
GLTFLoader or procedurally generate geometry data with
THREE.BufferGeometry, this change won’t affect you. If you are using
THREE.Geometry, please note the following changes:
THREE.Geometryis no longer renderable and can’t be used to create 3D objects (meshes, lines, points) anymore.
- All geometry related library features like raycasting, helpers or exporters do not support
- All geometry generators (like
It’s actually best if you directly work with
THREE.BufferGeometry. If your project budget is tight and you can’t afford to refactor your code from scratch, you have the possibility to convert your instances of
THREE.BufferGeometry with two new methods:
Geometry.toBufferGeometry()is the default method for converting a mesh geometry to
THREE.BufferGeometry. It is used like so:
const bufferGeometry = geometry.toBufferGeometry();
- All faceless geometries (lines and points) have to use the static method
Geometry.createBufferGeometryFromObject(). You have to pass in the 3D object so it’s possible for the code to detect the type of render primitive (points, lines, meshes):
const bufferGeometry = Geometry.createBufferGeometryFromObject( points );
THREE.Geometry and focusing on
THREE.BufferGeometry as our main geometry class was decided years ago and we are happy to finally remove it with
r125. This will allow us to reduce the complexity of various engine components and make the maintenance and development process more easy. Besides, by forcing users into
THREE.BufferGeometry they automatically work with the more efficient and future-proof geometry representation.
In the future there might be a point where we rename
THREE.Geometry (but keep
THREE.BufferGeometry as an alias). It’s also possible that more concrete geometry classes will be introduced (
PointsGeometry) that make it easier for the engine to detect the actual type of geometry.