-
-
Notifications
You must be signed in to change notification settings - Fork 35.5k
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
BatchedMesh: Add "toJSON" and "copy" support #27131
Changes from 4 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -719,6 +719,26 @@ class Object3D extends EventDispatcher { | |
|
||
} | ||
|
||
if ( this.isBatchedMesh ) { | ||
|
||
object.type = 'BatchedMesh'; | ||
object._drawRanges = this._drawRanges; | ||
object._reservedRanges = this._reservedRanges; | ||
|
||
object._visible = this._visible; | ||
object._active = this._active; | ||
|
||
object._maxGeometryCount = this._maxGeometryCount; | ||
object._maxVertexCount = this._maxVertexCount; | ||
object._maxIndexCount = this._maxIndexCount; | ||
|
||
object._geometryInitialized = this._geometryInitialized; | ||
object._geometryCount = this._geometryCount; | ||
|
||
object._matricesTexture = this._matricesTexture.toJSON(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we avoid serializing the internal texture? Ideally, it is just recreated in Besides, can we avoid the underscore syntax in the JSON object? Also, at some point this logic should be moved to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This texture is how the matrices are canonically stored. I can generate a list of serialized matrices from the texture instead, though, if that's acceptable.
Yup! I'll fix it.
I thought so, too, but this looked like how all the other classes like InstancedMesh were working. Though it's unclear to me why this is needed. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I forgot after #27130 there is only the texture that holds the matrices. In this case, I'm fine with serializing directly the texture.
We can try to find a different solution in the future. Just wanted to note it in this PR. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. BTW: |
||
|
||
} | ||
|
||
// | ||
|
||
function serialize( library, element ) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we have
copy
returnthis
to make it consistent with parent classesObject3D
andMesh
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#27161