Click or drag to resize
DigitalRuneSceneNodeShape Property
Gets (or sets) the bounding shape of this scene node.

Namespace: DigitalRune.Graphics.SceneGraph
Assembly: DigitalRune.Graphics (in DigitalRune.Graphics.dll) Version: 1.2.0.0 (1.2.1.14562)
Syntax
public Shape Shape { get; protected set; }

Property Value

Type: Shape
The bounding shape. The bounding shape contains only the current node - it does not include the bounds of the children!

Implements

IGeometricObjectShape
Exceptions
ExceptionCondition
ArgumentNullExceptionvalue is .
Remarks

This property can be used as a bounding shape for frustum culling and similar operations. A suitable bounding shape must be set manually. The default value is Empty.

Changing this property raises the ShapeChanged event.

Important: The SceneNode implements the interface IGeometricObject. An IGeometricObject instance registers event handlers for the Changed event of the contained Shape. Therefore, a Shape will have an indirect reference to the IGeometricObject. This is no problem if the geometric object exclusively owns the shape. However, this could lead to problems ("life extension bugs" a.k.a. "memory leaks") when multiple geometric objects share the same shape: One geometric object is no longer used, but it cannot be collected by the garbage collector because the shape still holds a reference to the object.

Therefore, when Shapes are shared between multiple IGeometricObjects: Always set the shape to Empty or Infinite when the IGeometricObject is no longer used. Those are special immutable shapes that never raises any Changed events. Setting the shape to Empty or Infinite ensures that the internal event handlers are unregistered and the objects can be garbage-collected properly.

See Also