Click or drag to resize
DigitalRuneModelNode Class
Represents a 3D model composed of multiple SceneNodes.
Inheritance Hierarchy

Namespace: DigitalRune.Graphics.SceneGraph
Assembly: DigitalRune.Graphics (in DigitalRune.Graphics.dll) Version: 1.2.0.0 (1.2.1.14562)
Syntax
public class ModelNode : SceneNode

The ModelNode type exposes the following members.

Constructors
  NameDescription
Public methodModelNode
Initializes a new instance of the ModelNode class
Top
Methods
  NameDescription
Public methodClone
Creates a new SceneNode that is a clone of the current instance (incl. all children).
Protected methodCloneCore
Makes the instance a clone (deep copy) of the specified SceneNode.
(Overrides SceneNodeCloneCore(SceneNode).)
Protected methodCreateInstanceCore
When implemented in a derived class, creates a new instance of the SceneNode derived class.
(Overrides SceneNodeCreateInstanceCore.)
Public methodDispose(Boolean)
Releases all resources used by the scene node and all descendant nodes.
(Inherited from SceneNode.)
Protected methodDispose(Boolean, Boolean)
Releases the unmanaged resources used by an instance of the SceneNode class and optionally releases the managed resources.
(Inherited from SceneNode.)
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodInvalidate
Invalidates this scene node and all children.
(Inherited from SceneNode.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Protected methodOnParentChanged
Called when Parent was changed.
(Inherited from SceneNode.)
Protected methodOnPoseChanged
Raises the PoseChanged event.
(Inherited from SceneNode.)
Protected methodOnSceneChanged
Raises the SceneChanged event.
(Inherited from SceneNode.)
Protected methodOnShapeChanged
Raises the ShapeChanged event.
(Inherited from SceneNode.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
Extension Methods
  NameDescription
Public Extension MethodClearLastPose
Clears the LastPoseWorld property of the current scene node (and its descendants).
(Defined by SceneHelper.)
Public Extension MethodClearLastScale
Clears the LastScaleWorld property of the current scene node (and its descendants).
(Defined by SceneHelper.)
Public Extension MethodContains
Determines whether whether a scene node contains another scene node in its subtree.
(Defined by SceneHelper.)
Public Extension MethodGetAncestors
Gets the ancestors of the given scene node.
(Defined by SceneHelper.)
Public Extension MethodGetChildren
Gets the children of the given scene node.
(Defined by SceneHelper.)
Public Extension MethodGetDescendantsOverloaded.
Gets the descendants of the given scene node using a depth-first search.
(Defined by SceneHelper.)
Public Extension MethodGetDescendants(Boolean)Overloaded.
Gets the descendants of the given scene node using a depth-first or a breadth-first search.
(Defined by SceneHelper.)
Public Extension MethodGetLeaves
Gets the leaves of the scene node.
(Defined by SceneHelper.)
Public Extension MethodGetRoot
Gets the root node.
(Defined by SceneHelper.)
Public Extension MethodGetSceneNode
Gets a scene node by name from the subtree of the specified scene node.
(Defined by SceneHelper.)
Public Extension MethodGetSelfAndAncestors
Gets the scene node and its ancestors scene.
(Defined by SceneHelper.)
Public Extension MethodGetSubtreeOverloaded.
Gets the subtree (the given scene node and all of its descendants) using a depth-first search.
(Defined by SceneHelper.)
Public Extension MethodGetSubtree(Boolean)Overloaded.
Gets the subtree (the given scene node and all of its descendants) using a depth-first or a breadth-first search.
(Defined by SceneHelper.)
Public Extension MethodGetSubtreeAabb
Gets the AABB of the current subtree.
(Defined by SceneHelper.)
Public Extension MethodLookAt(Vector3F, Vector3F)Overloaded.
Rotates the scene node so that it faces a certain direction (in world space).
(Defined by SceneHelper.)
Public Extension MethodLookAt(Vector3F, Vector3F, Vector3F)Overloaded.
Moves and rotates the scene node so that it faces a certain direction (in world space).
(Defined by SceneHelper.)
Public Extension MethodSetInstanceAlpha
Sets the opacity (alpha) of a scene node - see remarks.
(Defined by SceneHelper.)
Public Extension MethodSetLastPose
Sets LastPoseWorld to the current PoseWorld.
(Defined by SceneHelper.)
Public Extension MethodSetLastScale
Sets LastScaleWorld to the current ScaleWorld.
(Defined by SceneHelper.)
Public Extension MethodSupportsInstanceAlpha
Determines whether the opacity of the scene node can be changed using SetInstanceAlpha(SceneNode, Single).
(Defined by SceneHelper.)
Top
Properties
  NameDescription
Public propertyAabb
Gets the axis-aligned bounding box (AABB) in world space.
(Inherited from SceneNode.)
Public propertyActualIsEnabled
Gets a value indicating whether this scene node is actually enabled. (The method checks the current scene node and its ancestors.)
(Inherited from SceneNode.)
Public propertyCastsShadows
Gets or sets a value indicating whether this scene node blocks the light and casts shadows.
(Inherited from SceneNode.)
Public propertyChildren
Gets or sets the children of this scene node.
(Inherited from SceneNode.)
Public propertyIsDisposed
Gets a value indicating whether this scene node has been disposed of.
(Inherited from SceneNode.)
Public propertyIsEnabled
Gets or sets a value indicating whether this scene node is enabled. (May override children - see remarks.)
(Inherited from SceneNode.)
Public propertyIsRenderable
Gets or sets a value indicating whether this scene node can be rendered with a SceneNodeRenderer.
(Inherited from SceneNode.)
Public propertyIsShadowCasterCulled
Gets or sets a value indicating whether the occlusion culling determined that this scene node does not need to be rendered into the shadow map of the directional light.
(Inherited from SceneNode.)
Public propertyIsStatic
Gets or sets a value indicating whether this scene node is static (immobile).
(Inherited from SceneNode.)
Public propertyLastFrame
Gets or sets the number of the last frame in which the scene node was rendered.
(Inherited from SceneNode.)
Public propertyLastPoseWorld
Gets or sets the PoseWorld of the last frame.
(Inherited from SceneNode.)
Public propertyLastScaleWorld
Gets or sets the ScaleWorld of the last frame.
(Inherited from SceneNode.)
Public propertyMaxDistance
Gets or sets the maximum distance up to which the scene node is rendered. (Needs to be normalized - see remarks.)
(Inherited from SceneNode.)
Public propertyName
Gets or sets the name of this scene node.
(Inherited from SceneNode.)
Public propertyParent
Gets the parent scene node.
(Inherited from SceneNode.)
Public propertyPoseLocal
Gets or sets the pose (position and orientation) relative to the parent scene node.
(Inherited from SceneNode.)
Public propertyPoseWorld
Gets or sets the pose (position and orientation) in world space.
(Inherited from SceneNode.)
Public propertyProxy
Gets or sets the proxy node.
(Inherited from SceneNode.)
Public propertyRenderData
Gets or sets the cached renderer data.
(Inherited from SceneNode.)
Public propertyScaleLocal
Gets or sets the scale relative to the parent scene node.
(Inherited from SceneNode.)
Public propertyScaleWorld
Gets the total effective scale (which incorporates the scale factors of parent scene nodes).
(Inherited from SceneNode.)
Public propertySceneData
Gets or sets scene data.
(Inherited from SceneNode.)
Public propertyShape
Gets (or sets) the bounding shape of this scene node.
(Inherited from SceneNode.)
Public propertySortTag
Gets or sets the sort tag.
(Inherited from SceneNode.)
Public propertyUserData
Gets or sets user-defined data.
(Inherited from SceneNode.)
Public propertyUserFlags
Gets or sets a 16-bit value which can be used to store user-defined information or flags.
(Inherited from SceneNode.)
Top
Events
  NameDescription
Public eventSceneChanged
Occurs when the local subtree changed.
(Inherited from SceneNode.)
Public eventShapeChanged
Occurs when the Shape or ScaleWorld was changed.
(Inherited from SceneNode.)
Top
Explicit Interface Implementations
  NameDescription
Explicit interface implementationPrivate methodIDisposableDispose
Releases all resources used by the scene node and all descendant nodes.
(Inherited from SceneNode.)
Explicit interface implementationPrivate methodIGeometricObjectClone
Creates a new IGeometricObject that is a clone (deep copy) of the current instance.
(Inherited from SceneNode.)
Explicit interface implementationPrivate propertyIGeometricObjectPose
Gets the pose (position and orientation) in world space.
(Inherited from SceneNode.)
Explicit interface implementationPrivate eventIGeometricObjectPoseChanged
Occurs when the pose was changed.
(Inherited from SceneNode.)
Explicit interface implementationPrivate propertyIGeometricObjectScale
Gets the total effective scale (which incorporates the scale factors of parent scene nodes).
(Inherited from SceneNode.)
Top
Remarks

A ModelNode represents a 3D model. The complexity of a model can vary from a simple MeshNode to a complex hierarchical tree of MeshNodes, LightNodes, and other types of SceneNodes. The ModelNode basically represents a "mini scene" stored under a single scene node. - ModelNode is the root node of this scene.

Loading and Cloning a Model:
A model can be loaded from an asset that has been preprocessed by the XNA content pipeline. For example:

C#
ModelNode myModel = Content.Load<ModelNode>("dude");
Repeated calls of Content.Load<ModelNode>("dude") will return the same object instance. (The model asset needs to be preprocessed by using the DRModelProcessor which is listed as "Model - DigitalRune Graphics" in the Visual Studio Properties window.)

The model node can be inserted in a IScene for rendering. The model node cannot be inserted multiple times into a scene. Also, it cannot be inserted into multiple scenes.

To render a model multiple times in a scene the model needs to be cloned by calling Clone:

C#
// Clone the entire model.
ModelNode clonedModel = myModel.Clone();

Clone duplicates the ModelNode and its descendant nodes. The data objects referenced by the scene nodes, such as Mesh or Light, are not duplicated. The original model and the cloned model will references the same data objects. Only the instance information which is responsible for positioning the objects in the scene will be duplicated.)

Adding a Model to a scene:
To render a model, it needs to be added to a scene. ModelNode is derived from SceneNode, hence it can be attached to any node of a scene. For example, the following code inserts a model node under the root node of a scene.

C#
// Insert model into scene.
myScene.Children.Add(myModel);

See Also