ThermionViewer class abstract
A (high-level) interface for a 3D scene.
Use this to add/remove assets, lights and cameras.
Multiple instances can be created; each will correspond broadly to a single Filament Scene/View.
If you know yhat you are doing, you can use a lower level interface by using the methods directly via FilamentApp.instance;
- Implementers
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
-
initialized
→ Future<
bool> -
no setter
- msPerFrame → double
-
no setter
- rendering → bool
-
If
true
, this Viewer should render itselfno setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- view → View
-
no setter
Methods
-
addDirectLight(
DirectLight light) → Future< ThermionEntity> -
Adds a direct light to the scene.
See LightManager.h for details
Note that
sunAngularRadius
is in degrees, whereasspotLightConeInner
andspotLightConeOuter
are in radians -
addToScene(
covariant ThermionAsset asset) → Future -
Adds the asset to the scene. All renderable entities attached to
the asset will be visible. -
clearBackgroundImage(
{bool destroy = false}) → Future - Removes the background image.
-
createCamera(
) → Future< Camera> -
createGeometry(
Geometry geometry, {List< MaterialInstance> ? materialInstances, bool keepData = false, bool addToScene = true}) → Future<ThermionAsset> -
destroyAsset(
ThermionAsset asset) → Future -
Destroys
asset
and all underlying resources (including instances, but excluding any manually created material instances). -
destroyAssets(
) → 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.
-
destroyCamera(
covariant Camera camera) → Future -
destroyLights(
) → Future - Remove all direct lights from the scene.
-
dispose(
) → Future - Destroys/disposes the viewer (including the entire scene). You cannot use the viewer after calling this method.
-
getActiveCamera(
) → Future< Camera> -
getBackgroundImage(
) → Future< TexturedQuad> -
getCameraCount(
) → int -
getGizmo(
GizmoType type) → Future< GizmoAsset> - Returns a gizmo for translating/rotating objects. Only one gizmo can be visible at any given time for this viewer.
-
getRenderableBoundingBox(
ThermionEntity entity) → Future< Aabb3> - Gets the 3D axis aligned bounding box for the given entity.
-
getViewportBoundingBox(
ThermionEntity entity) → Future< Aabb2> - Gets the 2D bounding box (in viewport coordinates) for the given entity.
-
hideBoundingBox(
ThermionAsset asset, {bool destroy = false}) → Future -
Removes the bounding box for
asset
from the scene. -
loadGltf(
String uri, {bool addToScene = true, int initialInstances = 1, bool keepData = false, String? resourceUri, bool loadAsync = false}) → Future< ThermionAsset> - Load the glTF asset at the given path (.glb or .gltf)
-
loadGltfFromBuffer(
Uint8List data, {String? resourceUri, int initialInstances = 1, bool keepData = false, int priority = 4, int layer = 0, bool loadResourcesAsync = false, bool addToScene = true}) → Future< ThermionAsset> - Loads a gltf asset from the specified buffer (which contains the contents of a .glb file).
-
loadIbl(
String lightingPath, {double intensity = 30000, bool destroyExisting = true}) → Future - Creates an indirect light by loading the reflections/irradiance from the KTX file. Only one indirect light can be active at any given time; if an indirect light has already been loaded, it will be replaced.
-
loadIblFromTexture(
Texture texture, {Texture? reflectionsTexture, double intensity = 30000, bool destroyExisting = true}) → Future -
loadSkybox(
String skyboxPath) → Future -
Load a skybox from
skyboxPath
(which must be a .ktx file) -
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.
-
removeFromScene(
covariant ThermionAsset asset) → Future - Removes the asset from the scene. None of the renderable entities attached to the asset will be visible, but the asset itself remains valid.
-
removeIbl(
{bool destroy = true}) → Future -
Removes the image-based light from the scene.
If
destroy
is true, the indirect light and all associated resources (irradiance/reflection textures) will be destroyed. -
removeLight(
ThermionEntity light) → Future - Remove a light from the scene.
-
removeSkybox(
) → Future - Removes the skybox from the scene and destroys all associated resources.
-
render(
) → Future - Render a single frame immediately into all registered swapchains.
-
rotateIbl(
Matrix3 rotation) → Future - Rotates the IBL & skybox.
-
setActiveCamera(
covariant Camera camera) → 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 be .png, .jpg, or .ktx file). This will be rendered at the maximum depth (i.e. behind all other objects including the skybox). IffillHeight
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 IffillHeight
is true, the image will be stretched/compressed to fit the height of the viewport. -
setBackgroundImageFromTexture(
Texture texture) → Future -
Set the background image from
texture
. -
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
andy
. Ifclamp
is true, the image cannot be positioned outside the bounds of the viewport. -
setBloom(
bool enabled, double strength) → Future - Enable/disable bloom.
-
setFrameRate(
int framerate) → Future - Sets the framerate for continuous rendering when setRendering is enabled.
-
setGridOverlayVisibility(
bool visible) → Future -
setLayerVisibility(
VisibilityLayers layer, bool visible) → Future -
setLightDirection(
ThermionEntity lightEntity, Vector3 direction) → Future -
Sets the world space direction for
lightEntity
to the given vector. -
setLightPosition(
ThermionEntity lightEntity, double x, double y, double z) → Future -
Set the world space position for
lightEntity
to the given coordinates. -
setPostProcessing(
bool enabled) → Future - Enable/disable postprocessing effects (anti-aliasing, tone mapping, bloom). Disabled by default.
-
setPriority(
ThermionEntity entityId, int priority) → Future - Sets the draw priority for the given entity. See RenderableManager.h for more details.
-
setRendering(
bool render) → Future - Set to true to continuously render the scene at the framerate specified by setFrameRate (60 fps by default).
-
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).
-
setViewFrustumCulling(
bool enabled) → Future - Enables/disables frustum culling.
-
setViewport(
int width, int height) → Future - Sets the viewport sizes and updates all cameras to use the new aspect ratio.
-
showBoundingBox(
ThermionAsset asset) → Future -
Render the bounding box for
asset
with an unlit material. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited