Skip to content

glTF scene support#4

Open
godiagonal wants to merge 166 commits intoold/masterfrom
feature/gltf-scene-support
Open

glTF scene support#4
godiagonal wants to merge 166 commits intoold/masterfrom
feature/gltf-scene-support

Conversation

@godiagonal
Copy link

@godiagonal godiagonal commented Jul 21, 2020

Features

  • Support for scenes
    • Adds props pc.ContainerResource.scenes, pc.ContainerResource.scene and pc.ContainerResource.nodes.
    • Scenes and nodes are exported as pc.Entity hierarchies.
    • The scenes and scene props of the glTF are used to create the exported scenes.
    • Can be processed using asset option callbacks preprocess, process and postprocess.
  • Models are created per glTF mesh instead of just one per glTF.
    • pc.ModelComponent is automatically added to all nodes referencing a mesh.
    • Adds pc.ContainerResource.models, a list of pc.Model assets per glTF mesh. Useful if using glTF extensions that
      reference meshes.
    • Removes pc.ContainerResource.scenes.model.
  • Support for cameras
    • pc.CameraComponent is automatically added to all nodes referencing a camera.
    • Adds pc.ContainerResource.cameras, a list of all pc.CameraComponent instances. Does not match index of the glTF cameras array.
    • Can be processed using asset option callbacks preprocess, process and postprocess.
  • Support for KHR_lights_punctual
    • pc.LightComponent is automatically added to all nodes with extension KHR_lights_punctual.
    • Adds pc.ContainerResource.lights, a list of all pc.LightComponent instances. Does not match index of the glTF lights array.
    • Can be processed using asset option callbacks preprocess, process and postprocess.
  • Animations grouped by node
    • Adds pc.ContainerResource.animationIndicesByNode, a mapping of animation indices to nodes. This can be used to add an animation component of choice (pc.AnimComponent or pc.AnimationComponent) to nodes that should be animated. The animations must be assigned to the referenced nodes to work, since the animation tracks use relative paths to target child nodes.
  • Updates JSDoc for pc.ContainerResource.

Rationale

Exporting scenes rather than a model better correspond to the glTF 2.0 spec which treats glTF as a scene format. It makes it possible to populate the scene with models, cameras, lights etc in the parser.

Other changes

For the new GLB parser implementation to work I also had to make the following changes.

  • Updated pc.Model.clone() so that references to external bones (nodes outside the internal model graph) of skin instances are kept in the cloned model.

Test instructions

Launch this project using a custom build of the engine from this branch. Use this launch url.

The project showcases a glTF asset containing a single scene with animations, cameras and lights being loaded by this version of the GLB parser.

Elliott Thompson added 30 commits April 20, 2020 18:29
Samuel Johansson added 7 commits July 24, 2020 15:10
@godiagonal godiagonal changed the title WIP: glTF scene support glTF scene support Aug 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants