API Reference

Class List

ContainerResource

Container for a list of animations, textures, materials, renders and a model.

Summary

Properties

animations

Array of assets of animations in the GLB container.

materials

Array of assets of materials in the GLB container.

renders

Array of assets of renders in the GLB container.

textures

Array of assets of textures in the GLB container.

Methods

instantiateModelEntity

Instantiates an entity with a model component.

instantiateRenderEntity

Instantiates an entity with a render component.

Details

Constructor

ContainerResource(data)

Parameters

dataobject

The loaded GLB data.

Properties

Asset[]animations

Array of assets of animations in the GLB container.

Asset[]materials

Array of assets of materials in the GLB container.

Asset[]renders

Array of assets of renders in the GLB container.

Asset[]textures

Array of assets of textures in the GLB container.

Methods

instantiateModelEntity([options])

Instantiates an entity with a model component.

// load a glb file and instantiate an entity with a model component based on it
app.assets.loadFromUrl("statue.glb", "container", function (err, asset) {
    var entity = asset.resource.instantiateModelEntity({
        castShadows: true
    });
    app.root.addChild(entity);
});

Parameters

optionsobject

The initialization data for the model component type ModelComponent.

Returns

Entity

A single entity with a model component. Model component internally contains a hierarchy based on GraphNode.

instantiateRenderEntity([options])

Instantiates an entity with a render component.

// load a glb file and instantiate an entity with a model component based on it
app.assets.loadFromUrl("statue.glb", "container", function (err, asset) {
    var entity = asset.resource.instantiateRenderEntity({
        castShadows: true
    });
    app.root.addChild(entity);
});

Parameters

optionsobject

The initialization data for the render component type RenderComponent.

Returns

Entity

A hierarachy of entities with render components on entities containing renderable geometry.