-
-
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
InstancedMesh: Honor instanceColor in toJSON() and ObjectLoader. #21486
Conversation
I was not sure about this one yet. |
Since three.js/src/objects/InstancedMesh.js Line 102 in 8323ee0
Maybe we always assume RGBA when vertex color alpha is supported? We could change the signature of |
I guess what I meant is that we should do this to be safe: if ( instanceColor !== undefined ) object.instanceColor = new BufferAttribute( new Float32Array( instanceColor.array ), instanceColor.itemSize ); |
Hmm... Maybe we could introduce a if ( instanceColor !== undefined ) object.instanceColor = BufferAttribute.fromJSON( instanceColor ); I guess such change would then apply to maaany other classes 😬 |
Related #11266. It's definitely worth to investigate this idea. I just wonder if |
Description
I was having troubles transferring InstancedMesh data due to the Object3D.toJSON and ObjectLoader.parseObject functions not accounting for the instanceColor attribute.
I've added instanceColor to the InstancedMesh cases in the respective functions.
Since instanceColor is optional, I've mimicked the behavior in InstanceMesh.copy() to check if it's null.