trois
trois copied to clipboard
Object3D lifecycle
A lot of components extends Object3D (Group, Light, Mesh, InstancedMesh...), we have to find a nice way to handle life cycle (#25, #26).
Events could be :
-
created: https://github.com/troisjs/trois/commit/f90cb8d6f8e69ee9f2c69fd12b24a335e44fc3c7 -
ready(added to parent) : https://github.com/troisjs/trois/commit/5134ff91e6fa0f7cea185a416f0b88d7a40a2152 -
beforeRemove?
Do we have to handle something like onSetGeometry, onSetMaterial ?
Thanks @SaFrMo for the help
And something useful we have to handle : not remove the object when needed, example : https://troisjs.github.io/little-planet/ Objects are removed after tween is complete.
About InstancedMesh and #25 :
<InstancedMesh :count="count" @created="initIMesh">
<SphereGeometry :radius="5" />
<BasicMaterial />
</InstancedMesh>
methods: {
initIMesh(imesh) {
// no need to set needsUpdate (object has not been rendered yet)
},
},