ThermionViewer class abstract

Implementers

Constructors

ThermionViewer()

Properties

gizmo AbstractGizmo?
no setter
hashCode int
The hash code for this object.
no setterinherited
initialized Future<bool>
no setter
pickResult Stream<FilamentPickResult>
The result(s) of calling pick (see below). This may be a broadcast stream, so you should ensure you have subscribed to this stream before calling pick. If pick is called without an active subscription to this stream, the results will be silently discarded.
no setter
rendering bool
Whether the controller is currently rendering at framerate.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scene Scene
The Scene holds all loaded entities/lights.
no setter

Methods

addAnimationComponent(ThermionEntity entity) 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(ThermionEntity entity, 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.
addCollisionComponent(ThermionEntity entity, {void callback(int entityId1, int entityId2)?, bool affectsTransform = false}) Future
Makes entity collidable. This allows you to call testCollisions with any other entity ("entity B") to see if entity has collided with entity B. The callback will be invoked if so. Alternatively, if affectsTransform is true and this entity collides with another entity, any queued position updates to the latter entity will be ignored.
addLight(LightType type, double colour, double intensity, double posX, double posY, double posZ, double dirX, double dirY, double dirZ, {double falloffRadius = 1.0, double spotLightConeInner = pi / 8, double spotLightConeOuter = pi / 4, double sunAngularRadius = 0.545, double sunHaloSize = 10.0, double sunHaloFallof = 80.0, bool castShadows = true}) Future<ThermionEntity>
Add a light to the scene. See LightManager.h for details Note that sunAngularRadius is in degrees, whereas spotLightConeInner and spotLightConeOuter are in radians
clearBackgroundImage() Future
Removes the background image.
clearEntities() Future
Removes/destroys all renderable entities from the scene (including cameras). All ThermionEntity handles will no longer be valid after this method is called; ensure you immediately discard all references to all entities once this method is complete.
clearLights() Future
Remove all lights (excluding IBL) from the scene.
createGeometry(List<double> vertices, List<int> indices, {String? materialPath, PrimitiveType primitiveType = PrimitiveType.TRIANGLES}) Future
Creates a (renderable) entity with the specified geometry and adds to the scene.
createInstance(ThermionEntity entity) Future<ThermionEntity>
Create a new instance of entity.
dispose() Future
Destroys/disposes the viewer (including the entire scene). You cannot use the viewer after calling this method.
getAnimationDuration(ThermionEntity entity, int animationIndex) Future<double>
Returns the length (in seconds) of the animation at the given index.
getAnimationNames(ThermionEntity entity) Future<List<String>>
Gets the names of all glTF animations embedded in the specified entity.
getBone(ThermionEntity parent, 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(ThermionEntity entity, {int skinIndex = 0}) Future<List<String>>
Gets the names of all bones for the armature at skinIndex under the specified entity.
getCameraCullingFar() Future<double>
Get the distance (in world units) to the far culling plane for the active camera.
getCameraCullingNear() Future<double>
Get the distance (in world units) to the near culling plane for the active camera.
getCameraCullingProjectionMatrix() Future<Matrix4>
Get the camera's culling projection matrix. See Camera.h for more details.
getCameraFrustum() Future<Frustum>
Get the camera's culling frustum in world space. Returns a (vector_math) Frustum instance where plane0-plane6 define the left, right, bottom, top, far and near planes respectively. See Camera.h and (filament) Frustum.h for more details.
getCameraModelMatrix() Future<Matrix4>
Get the camera's model matrix.
getCameraPosition() Future<Vector3>
Get the camera position in world space.
getCameraProjectionMatrix() Future<Matrix4>
Get the camera's projection matrix. See Camera.h for more details.
getCameraRotation() Future<Matrix3>
Get the camera rotation matrix.
getCameraViewMatrix() Future<Matrix4>
Get the camera's view matrix. See Camera.h for more details.
getChildEntities(ThermionEntity parent, bool renderableOnly) Future<List<ThermionEntity>>
Returns all child entities under parent.
getChildEntity(ThermionEntity parent, String childName) Future<ThermionEntity>
Finds the child entity named childName associated with the given parent. Usually, parent will be the return value from loadGlb/loadGltf and childName will be the name of a node/mesh.
getChildEntityNames(ThermionEntity entity, {bool renderableOnly = true}) Future<List<String>>
List the name of all child entities under the given entity.
getInstanceCount(ThermionEntity entity) Future<int>
Returns the number of instances of the asset associated with entity.
getInstances(ThermionEntity entity) Future<List<ThermionEntity>>
Returns all instances of entity.
getInverseBindMatrix(ThermionEntity parent, 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.
getMainCamera() Future<ThermionEntity>
Returns the entity associated with the main camera.
getMorphTargetNames(ThermionEntity entity, ThermionEntity childEntity) Future<List<String>>
Gets the names of all morph targets for the child renderable childEntity under entity.
getNameForEntity(ThermionEntity entity) String?
Retrieves the name assigned to the given ThermionEntity (usually corresponds to the glTF mesh name).
getParent(ThermionEntity child) Future<ThermionEntity?>
Gets the parent transform of child.
getWorldTransform(ThermionEntity entity) Future<Matrix4>
Gets the world transform for entity.
hide(ThermionEntity entity, String? meshName) Future
If meshName is provided, hide the node meshName under entity, otherwise hide the root node for entity. The entity still exists in memory, but is no longer being rendered into the scene. Call reveal to re-commence rendering.
loadGlb(String path, {int numInstances = 1}) Future<ThermionEntity>
Load the .glb asset at the given path and insert into the scene.
loadGltf(String path, String relativeResourcePath, {bool force = false}) Future<ThermionEntity>
Load the .gltf asset at the given path and insert into the scene. relativeResourcePath is the folder path where the glTF resources are stored; this is usually the parent directory of the .gltf file itself.
loadIbl(String lightingPath, {double intensity = 30000}) Future
Loads an image-based light from the specified path at the given intensity. Only one IBL can be active at any given time; if an IBL has already been loaded, it will be replaced.
loadSkybox(String skyboxPath) Future
Load a skybox from skyboxPath (which must be a .ktx file)
moveCameraToAsset(ThermionEntity entity) Future
Repositions the camera to the last vertex of the bounding box of entity, looking at the penultimate vertex.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onDispose(Future callback()) → void
Register a callback to be invoked when this viewer is disposed.
panEnd() Future
Called by FilamentGestureDetector. You probably don't want to call this yourself.
panStart(double x, double y) Future
Called by FilamentGestureDetector. You probably don't want to call this yourself.
panUpdate(double x, double y) Future
Called by FilamentGestureDetector. You probably don't want to call this yourself.
pick(int x, int y) → void
Used to select the entity in the scene at the given viewport coordinates. Called by FilamentGestureDetector on a mouse/finger down event. You probably don't want to call this yourself. This is asynchronous and will require 2-3 frames to complete - subscribe to the pickResult stream to receive the results of this method. x and y must be in local logical coordinates (i.e. where 0,0 is at top-left of the ThermionWidget).
playAnimation(ThermionEntity entity, int index, {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.
playAnimationByName(ThermionEntity entity, 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.
queuePositionUpdate(ThermionEntity entity, double x, double y, double z, {bool relative = false}) Future
Queues an update to the worldspace position for entity to {x,y,z}. The actual update will occur on the next frame, and will be subject to collision detection.
queueRotationUpdate(ThermionEntity entity, double rads, double x, double y, double z, {bool relative = false}) Future
Queues an update to the worldspace rotation for entity. The actual update will occur on the next frame, and will be subject to collision detection.
queueRotationUpdateQuat(ThermionEntity entity, Quaternion quat, {bool relative = false}) Future
Same as queueRotationUpdate.
removeAnimationComponent(ThermionEntity entity) Future
Removes an animation component from entity.
removeCollisionComponent(ThermionEntity entity) Future
Removes the collision component from entity, meaning this will no longer be tested when testCollisions or queuePositionUpdate is called with another entity.
removeEntity(ThermionEntity entity) Future
Removes/destroys the specified entity from the scene. entity will no longer be a valid handle after this method is called; ensure you immediately discard all references once this method is complete.
removeIbl() Future
Removes the image-based light from the scene.
removeLight(ThermionEntity light) Future
removeSkybox() Future
Removes the skybox from the scene.
render() Future
Render a single frame.
resetBones(ThermionEntity entity) Future
Resets all bones in the given entity to their rest pose. This should be done before every call to addBoneAnimation.
reveal(ThermionEntity entity, String? meshName) Future
Reveal the node meshName under entity. Only applicable if hide had previously been called; this is a no-op otherwise.
rotateEnd() Future
Called by FilamentGestureDetector. You probably don't want to call this yourself.
rotateIbl(Matrix3 rotation) Future
Rotates the IBL & skybox.
rotateStart(double x, double y) Future
Called by FilamentGestureDetector. You probably don't want to call this yourself.
rotateUpdate(double x, double y) Future
Called by FilamentGestureDetector. You probably don't want to call this yourself.
setAnimationFrame(ThermionEntity entity, int index, int animationFrame) Future
setAntiAliasing(bool msaa, bool fxaa, bool taa) Future
Set antialiasing options.
setBackgroundColor(double r, double g, double b, double alpha) Future
Sets the color for the background plane (positioned at the maximum depth, i.e. behind all other objects including the skybox).
setBackgroundImage(String path, {bool fillHeight = false}) Future
Set the background image to path (which should have a file extension .png, .jpg, or .ktx). This will be rendered at the maximum depth (i.e. behind all other objects including the skybox). If fillHeight is false, the image will be rendered at its original size. Note this may cause issues with pixel density so be sure to specify the correct resolution If fillHeight is true, the image will be stretched/compressed to fit the height of the viewport.
setBackgroundImagePosition(double x, double y, {bool clamp = false}) Future
Moves the background image to the relative offset from the origin (bottom-left) specified by x and y. If clamp is true, the image cannot be positioned outside the bounds of the viewport.
setBloom(double bloom) Future
Sets the strength of the bloom.
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.
setCamera(ThermionEntity entity, String? name) Future
Sets the current scene camera to the glTF camera under name in entity.
setCameraCulling(double near, double far) Future
Sets the distance (in world units) to the near/far planes for the active camera. Default values are 0.05/1000.0. See Camera.h for details.
setCameraExposure(double aperture, double shutterSpeed, double sensitivity) Future
Sets the camera exposure.
setCameraFocalLength(double focalLength) Future
Sets the focal length of the camera. Default value is 28.0.
setCameraFocusDistance(double focusDistance) Future
Sets the focus distance for the camera.
setCameraFov(double degrees, double width, double height) Future
Sets the current scene camera to the glTF camera under name in entity.
setCameraManipulatorOptions({ManipulatorMode mode = ManipulatorMode.ORBIT, double orbitSpeedX = 0.01, double orbitSpeedY = 0.01, double zoomSpeed = 0.01}) Future
Sets the options for manipulating the camera via the viewport. ManipulatorMode.FREE_FLIGHT and ManipulatorMode.MAP are currently unsupported and will throw an exception.
setCameraModelMatrix(List<double> matrix) Future
Sets the camera model matrix.
setCameraPosition(double x, double y, double z) Future
Set the camera position in world space. Note this is not persistent - any viewport navigation will reset the camera transform.
setCameraRotation(Quaternion quaternion) Future
Rotate the camera by rads around the given axis. Note this is not persistent - any viewport navigation will reset the camera transform.
setFrameRate(int framerate) Future
Sets the framerate for continuous rendering when setRendering is enabled.
setMainCamera() Future
Sets the current scene camera to the main camera (which is always available and added to every scene by default).
setMaterialColor(ThermionEntity entity, String meshName, int materialIndex, double r, double g, double b, double a) Future
Sets the baseColorFactor property for the material at index materialIndex in entity under node meshName to color.
setMorphAnimationData(ThermionEntity entity, MorphAnimationData animation, {List<String>? targetMeshNames}) Future
Animate the morph targets in entity. See 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.
setParent(ThermionEntity child, ThermionEntity parent) Future
Sets the parent transform of child to parent.
setPosition(ThermionEntity entity, double x, double y, double z) Future
Directly sets the world space position for entity to the given coordinates, skipping all collision detection.
setPostProcessing(bool enabled) Future
Enable/disable postprocessing (disabled by default).
setPriority(ThermionEntity entityId, int priority) Future
Sets the draw priority for the given entity. See RenderableManager.h for more details.
setRecording(bool recording) Future
If recording is set to true, each frame the framebuffer/texture will be written to /tmp/output_*.png. This will impact performance; handle with care.
setRecordingOutputDirectory(String outputDirectory) Future
Sets the output directory where recorded PNGs will be placed.
setRendering(bool render) Future
Set to true to continuously render the scene at the framerate specified by setFrameRate (60 fps by default).
setRotation(ThermionEntity entity, double rads, double x, double y, double z) Future
Directly sets the rotation for entity to rads around the axis {x,y,z}, skipping all collision detection.
setRotationQuat(ThermionEntity entity, Quaternion rotation) Future
Sets the rotation for entity to the specified quaternion.
setScale(ThermionEntity entity, double scale) Future
Directly sets the scale for entity, skipping all collision detection.
setShadowsEnabled(bool enabled) Future
Enable/disable shadows (disabled by default).
setShadowType(ShadowType shadowType) Future
Set shadow type.
setSoftShadowOptions(double penumbraScale, double penumbraRatioScale) Future
Set soft shadow options (ShadowType DPCF and PCSS)
setToneMapping(ToneMapper mapper) Future
Sets the tone mapping (requires postprocessing).
setTransform(ThermionEntity entity, Matrix4 transform) Future
Sets the transform (relative to its parent) for entity.
setViewFrustumCulling(bool enabled) Future
Enables/disables frustum culling. Currently we don't expose a method for manipulating the camera projection/culling matrices so this is your only option to deal with unwanted near/far clipping.
stopAnimation(ThermionEntity entity, int animationIndex) Future
stopAnimationByName(ThermionEntity entity, String name) Future
testCollisions(ThermionEntity entity) Future
Test all collidable entities against this entity to see if any have collided. This method returns void; the relevant callback passed to addCollisionComponent will be fired if a collision is detected.
toString() String
A string representation of this object.
inherited
transformToUnitCube(ThermionEntity entity) Future
Scale entity to fit within the unit cube.
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).
zoomBegin() Future
Called by FilamentGestureDetector. You probably don't want to call this yourself.
zoomEnd() Future
Called by FilamentGestureDetector. You probably don't want to call this yourself.
zoomUpdate(double x, double y, double z) Future
Called by FilamentGestureDetector. You probably don't want to call this yourself.

Operators

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