-
-
Notifications
You must be signed in to change notification settings - Fork 36.1k
Closed as duplicate of#15714
Description
Description of the problem
Currently, there are geometries in THREE JS src that are not de-serializable.
EdgesGeometryParametricGeometryTextGeometryInstancedBufferGeometryWireframeGeometry
There are 2 main reasons for this issue.
ObjectLoaderdoesn't handle these types. Every geometry has atypeproperty which is the name of the geometry.ObjectLoaderuses this to determine how to de-serialize the JSON.- Geometries are serialized differently if they contain a
parametersproperty.
Based on @Mugen87's comment, it sounds like increasing the complexity of ObjectLoader is undesirable. However, these geometries are currently serialized in a way where they can't be de-serialized.
My suggestion would be one of the following:
- Make these geometries serialize as normal
BufferGeometryand send a warning saying such.
EdgesBufferGeometry.prototype.toJSON = function () {
console.warn("EdgesBufferGeometry is not serializable. It will be serialized as BufferGeometry.");
var parameters = this.parameters;
this.parameters = undefined;
var data = BufferGeometry.prototype.toJSON.call( this );
this.parameters = parameters;
return data;
};- Make these geometries not serializable and send a error saying such.
Example
EdgesBufferGeometry.prototype.toJSON = function () {
console.error("EdgesBufferGeometry is not serializable. Convert this geometry to BufferGeometry and call .toJSON() on that");
};- Make
ObjectLoaderhandle these geometries
Related #16026, #16087, #14357
Three.js version
- Dev
- r104
- ...
Browser
- All of them
- Chrome
- Firefox
- Internet Explorer
OS
- All of them
- Windows
- macOS
- Linux
- Android
- iOS