ThermionAsset class abstract

A high-level interface for a renderable object (i.e. not a camera or light).

Filament represents most "objects" with an integer handle (in C++, filament::Entity).

In practice, working with filament::Entity at a higher level is difficult because certain objects don't map exactly to entities (e.g. glTF assets, which are represented by a hierarchy of entities) and creating instances directly from entities is not possible.

Implementers

Constructors

ThermionAsset.new()

Properties

entity ThermionEntity
The top-most entity in the hierarchy. If this is a glTF asset
no setter
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

addAnimationComponent() Future
An entity will only be animatable after an animation component is attached. Any calls to playAnimation/setBoneAnimation/setMorphAnimation will have no visual effect until addAnimationComponent has been called on the instance.
addBoneAnimation(BoneAnimationData animation, {int skinIndex = 0, double fadeInInSecs = 0.0, double fadeOutInSecs = 0.0, double maxDelta = 1.0}) Future
Enqueues and plays the animation for the specified bone(s). By default, frame data is interpreted as being in parent bone space; a 45 degree around Y means the bone will rotate 45 degrees around the Y axis of the parent bone in its current orientation. (i.e NOT the parent bone's rest position!). Currently, only Space.ParentBone and Space.Model are supported; if you want to transform to another space, you will need to do so manually.
clearMorphAnimationData(ThermionEntity entity) Future
Clear all current morph animations for entity.
containsChild(ThermionEntity entity) Future<bool>
createInstance({List<MaterialInstance>? materialInstances = null}) Future<ThermionAsset>
Create a new instance of entity. Instances are not automatically added to the scene; you must call Scene.add.
getBone(int boneIndex, {int skinIndex = 0}) Future<ThermionEntity>
Gets the entity representing the bone at boneIndex/skinIndex. The returned entity is only intended for use with getWorldTransform.
getBoneNames({int skinIndex = 0}) Future<List<String>>
Gets the names of all bones for the skin at skinIndex.
getBoundingBox() Future<Aabb3>
The dimensions of the bounding box for this asset. This is independent of the boundingBoxAsset (which is used to visualize the bounding box in the scene); you do not need to call createBoundingBoxAsset before this method.
getChildEntities() Future<List<ThermionEntity>>
getChildEntity(String childName) Future<ThermionEntity?>
getChildEntityNames() Future<List<String?>>
getGltfAnimationDuration(int animationIndex) Future<double>
Returns the length (in seconds) of the animation at the given index.
getGltfAnimationNames() Future<List<String>>
Gets the names of all glTF animations embedded in the specified entity.
getHandle<T>() → T
getInstance(int index) Future<ThermionAsset>
getInstanceCount() Future<int>
Returns the number of instances associated with this asset.
getInstances() Future<List<ThermionAsset>>
Returns all instances of associated with this asset.
getInverseBindMatrix(int boneIndex, {int skinIndex = 0}) Future<Matrix4>
Gets the inverse bind (pose) matrix for the bone. Note that parent must be the ThermionEntity returned by loadGlb/loadGltf, not any other method (getChildEntity etc). This is because all joint information is internally stored with the parent entity.
getLocalTransform({ThermionEntity? entity}) Future<Matrix4>
Gets the local (relative to parent) transform for entity.
getMaterialInstanceAt({ThermionEntity? entity, int index = 0}) Future<MaterialInstance>
getMaterialInstancesAsMap() Future<Map<ThermionEntity, List<MaterialInstance>>>
Returns a map of all renderable entities attached to this asset, and a list of material instances for each primitive for the respective entity.
getMorphTargetNames({ThermionEntity? entity}) Future<List<String>>
Gets the names of all morph targets for entity (which must be a renderable entity)
getPrimitiveCount({ThermionEntity? entity}) Future<int>
Returns the number of primitives in entity (which is assumed to have a Renderable component attached).
getWorldTransform({ThermionEntity? entity}) Future<Matrix4>
Gets the world transform for entity.
isCastShadowsEnabled({ThermionEntity? entity}) Future<bool>
isReceiveShadowsEnabled({ThermionEntity? entity}) Future<bool>
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
playGltfAnimation(int index, {bool loop = false, bool reverse = false, bool replaceActive = true, double crossfade = 0.0, double startOffset = 0.0}) Future
Schedules the glTF animation at index in asset to start playing on the next frame.
playGltfAnimationByName(String name, {bool loop = false, bool reverse = false, bool replaceActive = true, double crossfade = 0.0}) Future
Schedules the glTF animation at index in entity to start playing on the next frame.
removeAnimationComponent() Future
Removes an animation component from entity.
resetBones() Future
Resets all bones in the given entity to their rest pose. This should be done before every call to addBoneAnimation.
setBoneTransform(ThermionEntity entity, int boneIndex, Matrix4 transform, {int skinIndex = 0}) Future
Directly set the bone matrix for the bone at the given index. Don't call this manually unless you know what you're doing.
setCastShadows(bool castShadows) Future
setGltfAnimationFrame(int index, int animationFrame) Future
setMaterialInstanceAt(covariant MaterialInstance instance, {int? entity = null, int primitiveIndex = 0}) Future
Sets the material instance for the primitive at primitiveIndex in entity.
setMaterialInstanceForAll(covariant MaterialInstance instance) Future
Sets the material instance for all primitives in all entities to instance.
setMaterialInstancesFromMap(Map<ThermionEntity, List<MaterialInstance>> materialInstances) Future
For each entity in the given map, set the material instance for the respective primitive.
setMorphAnimationData(MorphAnimationData animation, {List<String>? targetMeshNames}) Future
Construct animation(s) for every entity under asset. If targetMeshNames is provided, only entities with matching names will be animated. MorphTargetAnimation for an explanation as to how to construct the animation frame data. This method will check the morph target names specified in animation against the morph target names that actually exist exist under meshName in entity, throwing an exception if any cannot be found. It is permissible for animation to omit any targets that do exist under meshName; these simply won't be animated.
setMorphTargetWeights(ThermionEntity entity, List<double> weights) Future
Set the weights for all morph targets in entity to weights. Note that weights must contain values for ALL morph targets, but no exception will be thrown if you don't do so (you'll just get incorrect results). If you only want to set one value, set all others to zero (check getMorphTargetNames if you need the get a list of all morph targets). IMPORTANT - this accepts the actual ThermionEntity with the relevant morph targets (unlike getMorphTargetNames, which uses the parent entity and the child mesh name). Use getChildEntityByName if you are setting the weights for a child mesh.
setReceiveShadows(bool castShadows) Future
setTransform(Matrix4 transform, {ThermionEntity? entity}) Future
Sets the transform (relative to its parent) for entity.
setVisibilityLayer(ThermionEntity entity, VisibilityLayers layer) Future
All renderable entities are assigned a layer mask.
stopGltfAnimation(int animationIndex) Future
stopGltfAnimationByName(String name) Future
toString() String
A string representation of this object.
inherited
transformToUnitCube() Future
updateBoneMatrices(ThermionEntity entity) Future
Updates the bone matrices for entity (which must be the ThermionEntity returned by loadGlb/loadGltf). Under the hood, this just calls updateBoneMatrices on the Animator instance of the relevant FilamentInstance (which uses the local bone transform and the inverse bind matrix to set the bone matrix).

Operators

operator ==(Object other) bool
The equality operator.
inherited