SceneObject
Description
- 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.
Subclasses should call ChildBindings whenever their scene binding state changes (for example, attach to / detach from a scene, upon disposal). Then, the following helper may be used by them, in order to manage their aggregated child objects:
To manage aggregated IMeshBound child objects at a lower level, these methods can be used:
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 / Methods
ChildBinding
2 overloads
Updates the scene binding state of child in.
If ISceneObject.Scene returns null
when this method is called, it will return silently. Otherwise, its default implementation will call the following methods:
-
MeshAttach and MeshDetach, if child in is a IMeshBound object.
-
TerrainMesh.DecalAdd and TerrainMesh.DecalRemove, if child in is a TerrainDecal object.
-
TerrainMesh.ModelAdd and TerrainMesh.ModelRemove, if child in is a TerrainModel object.
Subclasses may override this method in order to provide additional binding logic.
Updates the scene binding state of the previous in object (detach) and current in (attach), by delegating to ChildBinding1 accordingly.
This method is intended to be called from the setters of properties of subclasses, which are used to set aggregated objects (for example, a ITerrainTransform object). Doing so will update the scene binding state of both the old and the new object, in a null-safe way.
ChildBindingAll
2 overloads
This helper method iterates over children in and calls ChildBinding1 for each element.
This helper method iterates over children in and calls ChildBinding1 for each element.
ChildBindings
This method is called when a scene object is attached to / detached from a scene or a scene view.
Implementing methods should call ChildBinding1 (passing attach in), in order to update the scene binding state of the objects they aggregate. When this method is called, ISceneObject.Scene always returns a non-null value.
If the implementing class has aggregated child objects which may be configured via properties, those should make use of ChildBinding2.
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.
- See also
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.
DirtyStateCheck
Called by ISceneObject.UpdateState when ISceneObject.NeedsUpdateState is false
.
Subclasses may override this method in order to perform custom dirty state checks, and to call DirtyState as result.
- See also
DirtyStateIfOutdated
Calls DirtyState if the current version of versioned in is not equal to version in.
- See also
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.
MeshAttach
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.
- See also
MeshDetach
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.
- See also
QueryFilter
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.
QueryModelResult
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.
QueryScreenLabelResult
2 overloads
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.
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.