Class SceneNode
- Namespace
- HelixToolkit.SharpDX.Model.Scene
- Assembly
- HelixToolkit.SharpDX.dll
public abstract class SceneNode : DisposeObject, IDisposable, IComparable<SceneNode>, IAnimationNode
- Inheritance
-
SceneNode
- Implements
- Derived
- Inherited Members
- Extension Methods
Constructors
SceneNode()
Initializes a new instance of the SceneNode class.
public SceneNode()
SceneNode(string)
Initializes a new instance of the SceneNode class.
public SceneNode(string name)
Parameters
namestringThe name.
Fields
MaxBound
The maximum bound
public static readonly BoundingBox MaxBound
Field Value
MaxBoundSphere
The maximum bound sphere
public static readonly BoundingSphere MaxBoundSphere
Field Value
NeedMatrixUpdate
Gets or sets a value indicating whether [need matrix update].
protected bool NeedMatrixUpdate
Field Value
- bool
trueif [need matrix update]; otherwise,false.
OnSetRenderTechnique
A delegate function to change render technique.
There are two ways to set render technique, one is use this OnSetRenderTechnique delegate. The other one is to override the OnCreateRenderTechnique(IEffectsManager) function.
If OnSetRenderTechnique is set, then OnSetRenderTechnique instead of OnCreateRenderTechnique(IEffectsManager) function will be called.
public SceneNode.SetRenderTechniqueFunc? OnSetRenderTechnique
Field Value
Properties
AffectsGlobalVariable
Set this to true if this node updates global variable.
Currently only used by screenspaced node and topmost node
public bool AffectsGlobalVariable { get; protected set; }
Property Value
AlwaysHittable
Gets or sets a value indicating whether [always hittable] even it is not rendered.
public bool AlwaysHittable { get; set; }
Property Value
- bool
trueif [always hittable]; otherwise,false.
Bounds
public virtual BoundingBox Bounds { get; }
Property Value
- BoundingBox
The bounds.
BoundsSphere
public virtual BoundingSphere BoundsSphere { get; }
Property Value
- BoundingSphere
The bounds sphere.
BoundsSphereWithTransform
public virtual BoundingSphere BoundsSphereWithTransform { get; }
Property Value
- BoundingSphere
The bounds sphere with transform.
BoundsWithTransform
public virtual BoundingBox BoundsWithTransform { get; }
Property Value
- BoundingBox
The bounds with transform.
EffectTechnique
Gets the effects technique.
public IRenderTechnique? EffectTechnique { get; }
Property Value
- IRenderTechnique
The effects technique.
EffectsManager
Gets the effects manager.
public IEffectsManager? EffectsManager { get; }
Property Value
- IEffectsManager
The effects manager.
GUID
public Guid GUID { get; }
Property Value
HasAnyPostEffect
Gets a value indicating whether this instance has any post effect.
public bool HasAnyPostEffect { get; }
Property Value
- bool
trueif this instance has any post effect; otherwise,false.
HasBound
Gets or sets a value indicating whether this instance has bound.
public bool HasBound { get; protected set; }
Property Value
- bool
trueif this instance has bound; otherwise,false.
IsAnimationNode
Gets or sets a value indicating whether this node is animation node.
public bool IsAnimationNode { get; set; }
Property Value
- bool
trueif this instance is animation node; otherwise,false.
IsAnimationNodeRoot
Gets a value indicating whether this node is animation node root.
public bool IsAnimationNodeRoot { get; }
Property Value
- bool
trueif this node is animation node root; otherwise,false.
IsAttached
If this has been attached onto renderhost.
public bool IsAttached { get; }
Property Value
IsHitTestVisible
Gets or sets a value indicating whether this instance is hit test visible.
public bool IsHitTestVisible { get; set; }
Property Value
- bool
trueif this instance is hit test visible; otherwise,false.
IsInFrustum
Gets or sets a value indicating whether this instance is in frustum in current frame.
public bool IsInFrustum { get; }
Property Value
- bool
trueif this instance is in frustum; otherwise,false.
IsRenderable
Gets or sets a value indicating whether this instance is renderable.
public bool IsRenderable { get; }
Property Value
- bool
trueif this instance is renderable; otherwise,false.
Items
Gets the readonly child items from outside UI component access.
public ReadOnlyObservableFastList<SceneNode> Items { get; }
Property Value
- ReadOnlyObservableFastList<SceneNode>
The children.
ItemsCount
Gets the items count.
public int ItemsCount { get; }
Property Value
- int
The items count.
ModelMatrix
Gets or sets the model matrix.
public Matrix4x4 ModelMatrix { get; set; }
Property Value
- Matrix4x4
The model matrix.
Name
Gets or sets the name.
public string Name { get; set; }
Property Value
- string
The name.
OriginalBounds
public virtual BoundingBox OriginalBounds { get; }
Property Value
- BoundingBox
The original bounds.
OriginalBoundsSphere
public virtual BoundingSphere OriginalBoundsSphere { get; }
Property Value
- BoundingSphere
The original bounds sphere.
Parent
Gets or sets the parent.
public SceneNode? Parent { get; }
Property Value
- SceneNode
The parent.
PostEffectNames
Gets the post effect names.
public IEnumerable<string> PostEffectNames { get; }
Property Value
- IEnumerable<string>
The post effect names.
RenderCore
public RenderCore RenderCore { get; }
Property Value
RenderOrder
Gets or sets the render order. Manually specify the render order
public ushort RenderOrder { get; set; }
Property Value
- ushort
The render order.
RenderOrderKey
Gets or sets the order key.
public OrderKey RenderOrderKey { get; }
Property Value
- OrderKey
The render order key.
RenderType
Gets or sets the type of the render.
public RenderType RenderType { get; set; }
Property Value
- RenderType
The type of the render.
Tag
Gets or sets the tag. This can be used to attach an external view model or property class object
public object? Tag { get; set; }
Property Value
- object
The tag.
TotalModelMatrix
Gets the total model matrix.
public Matrix4x4 TotalModelMatrix { get; }
Property Value
- Matrix4x4
The total model matrix.
Visible
Gets or sets a value indicating whether this SceneNode is visible.
public bool Visible { get; set; }
Property Value
- bool
trueif visible; otherwise,false.
WrapperSource
Gets or sets the wrapper source used for such as hit test model, etc. The wrapper must set this so the ModelHit is the wrapper.
public object? WrapperSource { get; set; }
Property Value
- object
The hit test source.
Methods
AddPostEffect(IEffectAttributes)
Adds the post effect.
public void AddPostEffect(IEffectAttributes effect)
Parameters
effectIEffectAttributesThe effect.
AssignDefaultValuesToCore(RenderCore)
Assigns the default values to core.
protected virtual void AssignDefaultValuesToCore(RenderCore core)
Parameters
coreRenderCoreThe core.
Attach(IEffectsManager?)
Attaches the element to the specified effectsManager and initialize all necessary graphics resources.
To overide Attach, please override OnAttach(IEffectsManager) function.
To set different render technique instead of using technique from host, override OnCreateRenderTechnique(IEffectsManager)
Attach Flow: OnCreateRenderTechnique(IEffectsManager) -> Set RenderHost -> Get Effect -> OnAttach(IEffectsManager) -> InvalidateSceneGraph()
public void Attach(IEffectsManager? effectsManager)
Parameters
effectsManagerIEffectsManagerThe effectsManager.
CanHitTest(HitTestContext?)
Determines whether this instance [can hit test] the specified context.
protected virtual bool CanHitTest(HitTestContext? context)
Parameters
contextHitTestContextThe context.
Returns
- bool
trueif this instance [can hit test] the specified context; otherwise,false.
CanRender(RenderContext)
protected virtual bool CanRender(RenderContext context)
Parameters
contextRenderContext
Returns
ClearPostEffect()
Clears the post effect.
public void ClearPostEffect()
CompareTo(SceneNode?)
Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.
public int CompareTo(SceneNode? other)
Parameters
otherSceneNodeAn object to compare with this instance.
Returns
- int
A value that indicates the relative order of the objects being compared. The return value has these meanings:
Value Meaning Less than zero This instance precedes otherin the sort order.Zero This instance occurs in the same position in the sort order as other.Greater than zero This instance follows otherin the sort order.
ComputeTransformMatrix()
public void ComputeTransformMatrix()
Detach()
Detaches the element from the effectsManager and release all graphics resources. Override OnDetach()
public void Detach()
HasPostEffect(string)
Determines whether [has post effect] [the specified effect name].
public bool HasPostEffect(string effectName)
Parameters
effectNamestringName of the effect.
Returns
- bool
trueif [has post effect] [the specified effect name]; otherwise,false.
HitTest(HitTestContext?, ref List<HitTestResult>)
Hits the test.
public virtual bool HitTest(HitTestContext? context, ref List<HitTestResult> hits)
Parameters
contextHitTestContextThe context.
hitsList<HitTestResult>The hits.
Returns
Invalidate(InvalidateTypes)
Invalidate by type
protected void Invalidate(InvalidateTypes type)
Parameters
typeInvalidateTypes
InvalidatePerFrameRenderables()
Invalidates the per frame renderables.
protected void InvalidatePerFrameRenderables()
InvalidateRender()
Tries to invalidate the current render, causes re-render
public void InvalidateRender()
InvalidateRenderEvent(object?, EventArgs)
protected void InvalidateRenderEvent(object? sender, EventArgs arg)
Parameters
InvalidateSceneGraph()
Invalidates the scene graph. Use this if scene graph has been changed.
protected void InvalidateSceneGraph()
OnAttach(IEffectsManager)
To override Attach routine, please override this.
protected virtual bool OnAttach(IEffectsManager effectsManager)
Parameters
effectsManagerIEffectsManager
Returns
- bool
Return true if attached
OnAttached()
Called when [attached] and IsAttached = true.
protected virtual void OnAttached()
OnCreateRenderCore()
Called when [create render core].
protected virtual RenderCore OnCreateRenderCore()
Returns
OnCreateRenderTechnique(IEffectsManager)
Override this function to set render technique during Attach Host.
If OnSetRenderTechnique is set, then OnSetRenderTechnique instead of OnCreateRenderTechnique(IEffectsManager) function will be called.
protected virtual IRenderTechnique? OnCreateRenderTechnique(IEffectsManager effectsManager)
Parameters
effectsManagerIEffectsManager
Returns
- IRenderTechnique
Return RenderTechnique
OnDetach()
Used to override Detach
protected virtual void OnDetach()
OnDispose(bool)
Disposes of object resources.
protected override void OnDispose(bool disposeManagedResources)
Parameters
disposeManagedResourcesboolIf true, managed resources should be disposed of in addition to unmanaged resources.
OnHitTest(HitTestContext?, Matrix4x4, ref List<HitTestResult>)
Called when [hit test].
protected abstract bool OnHitTest(HitTestContext? context, Matrix4x4 totalModelMatrix, ref List<HitTestResult> hits)
Parameters
contextHitTestContextThe context.
totalModelMatrixMatrix4x4The total model matrix.
hitsList<HitTestResult>The hits.
Returns
OnTransformChanged(ref Matrix4x4)
Transforms the changed.
protected virtual void OnTransformChanged(ref Matrix4x4 totalTransform)
Parameters
totalTransformMatrix4x4The total transform.
OnUpdateRenderOrderKey()
protected virtual OrderKey OnUpdateRenderOrderKey()
Returns
RaiseMouseDownEvent(IViewport3DX, Vector2, HitTestResult, object?)
public void RaiseMouseDownEvent(IViewport3DX viewport, Vector2 pos, HitTestResult hit, object? originalInputEventArgs = null)
Parameters
viewportIViewport3DXposVector2hitHitTestResultoriginalInputEventArgsobject
RaiseMouseMoveEvent(IViewport3DX, Vector2, HitTestResult, object?)
public void RaiseMouseMoveEvent(IViewport3DX viewport, Vector2 pos, HitTestResult hit, object? originalInputEventArgs = null)
Parameters
viewportIViewport3DXposVector2hitHitTestResultoriginalInputEventArgsobject
RaiseMouseUpEvent(IViewport3DX, Vector2, HitTestResult, object?)
public void RaiseMouseUpEvent(IViewport3DX viewport, Vector2 pos, HitTestResult hit, object? originalInputEventArgs = null)
Parameters
viewportIViewport3DXposVector2hitHitTestResultoriginalInputEventArgsobject
RaiseOnBoundChanged(BoundChangeArgs<BoundingBox>)
Raises the on bound changed.
protected void RaiseOnBoundChanged(BoundChangeArgs<BoundingBox> args)
Parameters
argsBoundChangeArgs<BoundingBox>The arguments.
RaiseOnBoundSphereChanged(BoundChangeArgs<BoundingSphere>)
Raises the on bound sphere changed.
protected void RaiseOnBoundSphereChanged(BoundChangeArgs<BoundingSphere> args)
Parameters
argsBoundChangeArgs<BoundingSphere>The arguments.
RaiseOnTransformBoundChanged(BoundChangeArgs<BoundingBox>)
Raises the on transform bound changed.
protected void RaiseOnTransformBoundChanged(BoundChangeArgs<BoundingBox> args)
Parameters
argsBoundChangeArgs<BoundingBox>The arguments.
RaiseOnTransformBoundSphereChanged(BoundChangeArgs<BoundingSphere>)
Raises the on transform bound sphere changed.
protected void RaiseOnTransformBoundSphereChanged(BoundChangeArgs<BoundingSphere> args)
Parameters
argsBoundChangeArgs<BoundingSphere>The arguments.
RemovePostEffect(string)
Removes the post effect.
public void RemovePostEffect(string effectName)
Parameters
effectNamestringName of the effect.
RemoveSelf()
Removes self from scene graph.
public bool RemoveSelf()
Returns
Render(RenderContext, DeviceContextProxy)
Renders the specified context.
public void Render(RenderContext context, DeviceContextProxy deviceContext)
Parameters
contextRenderContextThe context.
deviceContextDeviceContextProxyThe device context.
RenderCustom(RenderContext, DeviceContextProxy)
Renders the custom.
public void RenderCustom(RenderContext context, DeviceContextProxy deviceContext)
Parameters
contextRenderContextThe context.
deviceContextDeviceContextProxyThe device context.
RenderDepth(RenderContext, DeviceContextProxy, ShaderPass?)
Renders the custom.
public void RenderDepth(RenderContext context, DeviceContextProxy deviceContext, ShaderPass? pass)
Parameters
contextRenderContextThe context.
deviceContextDeviceContextProxyThe device context.
passShaderPass
RenderShadow(RenderContext, DeviceContextProxy)
Renders the shadow.
public void RenderShadow(RenderContext context, DeviceContextProxy deviceContext)
Parameters
contextRenderContextThe context.
deviceContextDeviceContextProxyThe device context.
SetAffectsRender<T>(ref T, T)
protected bool SetAffectsRender<T>(ref T backingField, T value)
Parameters
backingFieldTvalueT
Returns
Type Parameters
T
SetAffectsSceneGraph<T>(ref T, T)
Sets the affects scene graph.
protected bool SetAffectsSceneGraph<T>(ref T backingField, T value)
Parameters
backingFieldTThe backing field.
valueTThe value.
Returns
Type Parameters
T
TestViewFrustum(ref BoundingFrustum)
View frustum test.
public virtual bool TestViewFrustum(ref BoundingFrustum viewFrustum)
Parameters
viewFrustumBoundingFrustumThe frustum.
Returns
TryGetPostEffect(string, out IEffectAttributes?)
Tries the get post effect.
public bool TryGetPostEffect(string effectName, out IEffectAttributes? effect)
Parameters
effectNamestringName of the effect.
effectIEffectAttributesThe effect.
Returns
Update(RenderContext)
Updates the element total transforms, determine renderability, etc. by the specified time span.
public virtual void Update(RenderContext context)
Parameters
contextRenderContextThe time since last update.
UpdateNotRender(RenderContext)
public virtual void UpdateNotRender(RenderContext context)
Parameters
contextRenderContext
UpdateRenderOrderKey()
Updates the render order key.
public void UpdateRenderOrderKey()
Events
Attached
Occurs when [attached].
public event EventHandler? Attached
Event Type
BoundChanged
Occurs when [on bound changed].
public event EventHandler<BoundChangeArgs<BoundingBox>>? BoundChanged
Event Type
BoundSphereChanged
Occurs when [on bound sphere changed].
public event EventHandler<BoundChangeArgs<BoundingSphere>>? BoundSphereChanged
Event Type
Detached
Occurs when [detached].
public event EventHandler? Detached
Event Type
Invalidated
Occurs when invalidation has happened. This is a bubble up event.
public event EventHandler<InvalidateTypes>? Invalidated
Event Type
MouseDown
Occurs when [mouse down].
public event EventHandler<SceneNodeMouseDownArgs>? MouseDown
Event Type
MouseMove
Occurs when [mouse move].
public event EventHandler<SceneNodeMouseMoveArgs>? MouseMove
Event Type
MouseUp
Occurs when [mouse up].
public event EventHandler<SceneNodeMouseUpArgs>? MouseUp
Event Type
NameChanged
public event EventHandler<StringArgs>? NameChanged
Event Type
TransformBoundChanged
Occurs when [on transform bound changed].
public event EventHandler<BoundChangeArgs<BoundingBox>>? TransformBoundChanged
Event Type
TransformBoundSphereChanged
Occurs when [on transform bound sphere changed].
public event EventHandler<BoundChangeArgs<BoundingSphere>>? TransformBoundSphereChanged
Event Type
TransformChanged
Occurs when [on transform changed].
public event EventHandler<TransformArgs>? TransformChanged
Event Type
VisibleChanged
Occurs when [visible changed].
public event EventHandler<BoolArgs>? VisibleChanged