-
-
Notifications
You must be signed in to change notification settings - Fork 36k
BatchedMesh: Fix toJSON, ObjectLoader integration #30965
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
📦 Bundle sizeFull ESM build, minified and gzipped.
🌳 Bundle size after tree-shakingMinimal build including a renderer, camera, empty scene, and dependencies.
|
No that I am aware of but I that sounds like a good idea. Normally, math objects are serialized/deserialized with
The unit tests already do this partly. Example for three.js/test/unit/src/core/Object3D.tests.js Line 1253 in b730a20
This is done for historical reasons. The project started with this approach and it has been never refactored so far. Related #11266. |
* BatchedMesh: fix copy function * BatchedMesh: Update toJSON function * BatchedMesh.toJSON: small cleanup * ObjectLoader: Fix BatchedMesh support * BatchedMesh.copy: Remove redundant field * Object3D, ObjectLoader: adjust serialized definitions * ObjectLoader: Copy over necessary info
* BatchedMesh: fix copy function * BatchedMesh: Update toJSON function * BatchedMesh.toJSON: small cleanup * ObjectLoader: Fix BatchedMesh support * BatchedMesh.copy: Remove redundant field * Object3D, ObjectLoader: adjust serialized definitions * ObjectLoader: Copy over necessary info
Fix #30960
Fix #30961
Description
It seems BatchedMesh's toJSON and ObjectLoader integration had become out of date with some of the past changes. I tested by adding the following lines to the
webgl_mesh_batch
example to ensure the BatchedMesh could be cloned and serialized without error and render:A couple questions (cc @Mugen87):
toJSON
andfromJSON
functions to the Box3 or Sphere classes to make some of this kind of serialization more clean?Object3D.toJSON
handles serialization for all objects types rather than each child class implementing its own toJSON method?