SceneObject

Description

abstract class Tinman.Engine.Scenes.SceneObject

Derived from

Disposable abstract
ISceneObject

Extended by

SceneEntityBase abstract
SceneEntityView abstract

Abstract base class for ISceneObject implementations.

By convention, scene objects serialize property values to JSON via the IJsonizable interface only for properties that are annotated with JsonProperty.

Subclasses shall signal their dirty state by calling the DirtyState method, optionally overriding the DirtyStateCheck method to implement custom dirty state checks. All dirty state processing should be performed in the subsequent call to DoUpdateState.

The default implementations of ISceneObject.QueryDistance and ISceneObject.QueryRay produce no query results. Overriding methods may use the following helpers:

The default implementation of ISceneObject.CallbackMask returns SceneObjectCallback.All.

Protected / Constructors

Scene​Object


protected constructor SceneObject → (1)

callbackMask in : SceneObjectCallback

The value for ISceneObject.CallbackMask.

Creates a new instance of SceneObject.

Protected / Methods

Assert​Attached


protected abstract method AssertAttached → (1)

source in : string

The error source tag.

Asserts that this entity is attached to a scene.

Dirty​Frame


protected method DirtyFrame → ()

This method may be called to indicate that the dirty state of this scene object requires that a new frame is rendered.

After calling this method, the next call to IUpdateableFrameTime.UpdateFrameTime will return true, which will trigger rendering of a new frame. This method is called automatically after DoUpdateState, so usually it is not necessary to call it explicitly.

Dirty​State


protected method DirtyState → ()

Marks the state of this scene object as dirty, so that ISceneObject.NeedsUpdateState will return true.

Calling this method will trigger a subsequent call to DoUpdateState, followed by a call to DirtyFrame. To skip dirty state processing and just trigger rendering of a new frame, call the DirtyFrame method instead of DirtyState.

Dirty​State​Check


[EmptyBody]
protected virtual method DirtyStateCheck → ()

Subclasses may override this method in order to perform custom dirty state checks, and to call DirtyState as result.

Dirty​State​If​Outdated


protected method DirtyStateIfOutdated → (2)

version in : int32

The version to check for.

versioned in : IVersioned

The versioned object. If null, the current version is assumed to be 0.

returns → int32

The current version of versioned in.

Calls DirtyState if the current version of versioned in is not equal to version in.

Do​Update​State


[EmptyBody]
protected virtual method DoUpdateState → ()

Updates the state of this scene object, in order to reflect all recent changes.

This method will be called from within ISceneObject.UpdateState only when ISceneObject.NeedsUpdateState is true. The ISceneObject.NeedsUpdateState flag is reset to false before this method is called. The DirtyFrame method is called after calling this method.

Mesh​Attach


protected method MeshAttach → (1)

meshBound in : IMeshBound

[not-null]
The object to bind to the terrain mesh. If IMeshBound.MeshBind throws an TinmanException, this method will call IMeshBound.MeshUnbind in turn and return silently.

Attaches the given IMeshBound object to the underlying terrain mesh, by calling IMeshBound.MeshBind on it.

This scene object must be attached to a scene.

Mesh​Detach


protected method MeshDetach → (1)

meshBound in : IMeshBound

[not-null]
The object to unbind from the terrain mesh.

Detaches the given IMeshBound object from the underlying terrain mesh, by calling IMeshBound.MeshUnbind on it.

This scene object must be attached to a scene.

Query​Filter


[Pure]
protected method QueryFilter → (1)

mask in : int64

The spatial query filter mask.

returns → bool

true to include this scene object in the spatial query,
false to ignore it.

Checks if this scene object shall be included in a spatial query.

This method is intended to be used in implementations of ISceneObject.QueryDistance. It should not be used in other implementations of ISceneQueryProvider, where the ISceneQueryResultBuilder.ResultCheck1 method should be used instead.

Query​Model​Result


protected method QueryModelResult → (3)

model in : TerrainModel

[not-null]
The terrain model.

ray in : Ray

The ray.

builder in : ISceneQueryResultBuilder

[not-null]
The query result builder.

returns → bool

true if a query result has been output to builder in,
false if there is no query result.

Performs a ray intersection query for the given terrain model.

If the ray hits the given model in, a ModelResult is generated, using ISceneObject.QuerySceneObjectResult as IParentObjectContainer.ParentObject.

Query​Screen​Label​Result

2 overloads


protected method QueryScreenLabelResult1 → (4)

sceneView in : ISceneView

[not-null]
The scene view.

screenLabel in : int32

The screen label ordinal, as returned by ScreenLabelPlacement.Add.

point in : Vec2I

The point, in screen-space (see ISceneView.Bounds).

builder in : ISceneQueryResultBuilder

[not-null]
The query result builder.

returns → bool

true if a query result has been output to builder in,
false if there is no query result.

Performs an intersection query for the given screen label.

If the point hits the given screenLabel in, a ScreenLabelResult is generated, using ISceneObject.QuerySceneObjectResult as IParentObjectContainer.ParentObject.


protected method QueryScreenLabelResult2 → (6)

sceneView in : ISceneView

[not-null]
The scene view.

bounds in : Box2I

The screen label bounds, see ScreenLabelPlacementEntry.Bounds.

depth in : float32

The screen label depth, see ScreenLabelPlacementEntry.Depth.

label in : IScreenLabel

[not-null]
The screen label, see ScreenLabelPlacementEntry.Label.

point in : Vec2I

The point, in screen-space (see ISceneView.Bounds).

builder in : ISceneQueryResultBuilder

[not-null]
The query result builder.

returns → bool

true if a query result has been output to builder in,
false if there is no query result.

Performs an intersection query for the given screen label.

If the point hits the given screen label, a ScreenLabelResult is generated, using ISceneObject.QuerySceneObjectResult as IParentObjectContainer.ParentObject.

Protected / Attributes

Mesh


protected abstract attribute Mesh → (get)

value : IMesh

The terrain mesh or null iff not attached to a scene.

Returns the terrain mesh of this scene object.