InterfaceAn array of the animation assets. Each resource is an AnimTrack. Animations are only loaded when the application installs featureAnim, and the array is empty otherwise.
An array of the gsplat assets, created for meshes using the KHR_gaussian_splatting glTF extension.
An array of the Material and/or StandardMaterial assets.
An array of the render assets. Each holds the meshes of one glTF mesh.
An array of the Texture assets.
Applies a material variant to an entity hierarchy.
The entity root to which material variants will be applied.
Optionalname: string
The name of the variant, as queried from getMaterialVariants, if null the variant will be reset to the default.
// load a glb file and instantiate an entity with a render component based on it
app.assets.loadFromUrl("statue.glb", "container", (err, asset) => {
const entity = asset.resource.instantiateRenderEntity({
castShadows: true
});
app.root.addChild(entity);
const materialVariants = asset.resource.getMaterialVariants();
asset.resource.applyMaterialVariant(entity, materialVariants[0]);
});
Applies a material variant to a set of mesh instances. Compared to the applyMaterialVariant, this method allows for setting the variant on a specific set of mesh instances instead of the whole entity.
An array of mesh instances.
Optionalname: string
The name of the variant, as queried by getMaterialVariants. If null, the variant will be reset to the default.
// load a glb file and instantiate an entity with a render component based on it
app.assets.loadFromUrl("statue.glb", "container", (err, asset) => {
const entity = asset.resource.instantiateRenderEntity({
castShadows: true
});
app.root.addChild(entity);
const materialVariants = asset.resource.getMaterialVariants();
const renders = entity.findComponents("render");
for (let i = 0; i < renders.length; i++) {
const renderComponent = renders[i];
asset.resource.applyMaterialVariantInstances(renderComponent.meshInstances, materialVariants[0]);
}
});
Queries the list of available material variants.
An array of variant names.
Instantiates an entity with a model component.
Optionaloptions: any
The initialization data for the model component type ModelComponent.
A single entity with a model component. Model component internally contains a hierarchy based on GraphNode.
Instantiates an entity with a render component.
Optionaloptions: any
The initialization data for the render component type RenderComponent.
A hierarchy of entities with render components on entities containing renderable geometry.
// load a glb file and instantiate an entity with a render component based on it
app.assets.loadFromUrl("statue.glb", "container", (err, asset) => {
const entity = asset.resource.instantiateRenderEntity({
castShadows: true
});
app.root.addChild(entity);
// find all render components containing mesh instances, and change blend mode on their materials
const renders = entity.findComponents("render");
renders.forEach((render) => {
render.meshInstances.forEach((meshInstance) => {
meshInstance.material.blendType = BLEND_MULTIPLICATIVE;
meshInstance.material.update();
});
});
});
Container for a list of animations, textures, materials, renders, gsplats and a model.