pex-renderer icon indicating copy to clipboard operation
pex-renderer copied to clipboard

GLTF root not included in list of entities

Open vorg opened this issue 6 years ago • 2 comments

Synthetic root we create for the loaded scene is not included in the list of scene.entities. That causes problems when trying to find certain components like Animations

const scene = renderer.loadScene(url)
scene.entities.filter((e) => e.getComponent('Animation')) // -> length 0
root.getComponent('Animation') // -> Animation

Adding root to entities array would solve that issue but in a way it modifies the gltf file which might be unexpected.

vorg avatar Oct 07 '19 18:10 vorg

It seems that one of the reasons to have root in the first place is that animations don't belong to any particular node and are considered part of the scene. In our case root entity takes role of the scene.

vorg avatar Oct 07 '19 18:10 vorg

IBL lights will be also defined at the scene level https://github.com/KhronosGroup/glTF/tree/821b2bd58bfc400e575d37fce77bf5cf47dec531/extensions/2.0/Vendor/EXT_lights_image_based#adding-light-instances-to-scenes

The question if scene.root should be part of scene.entities (ideally scene.entities[0]) remains. @dmnsgn ?

vorg avatar Oct 07 '19 18:10 vorg