Tesla Graphics Engine Documentation (January 2012)
Spatial Class
TeslaTesla.SceneSpatial
The scene graph is a tree hierarchy that contains: 1. Transformations 2. Bounding Volumes 3. Lights Spatial is the root class that every object in the scene graph inherits from. A spatial is simply an entity that exists somewhere in the world, whether it's logical or a renderable model. Spatial's that are nodes can have children, those that are Mesh's represent a renderable 3D model and are "leaves" on the scene graph. In the scene local vs world properties correspond to the frame - local values are local to the Spatial, where as world properties are absolute (and often are influenced by parents or children of the Spatial). These properties are updated when Update() is called. Spatial is smart enough to only recompute these values if they have been changed, reducing redundant computations. During drawing operations, the scene graph automatically performs a culling check with the renderer's current camera. This is done in the OnDraw() method.
Declaration Syntax
C#
public abstract class Spatial : ISavable, 
	IHintable
Members
All Members Constructors Methods Properties



Icon Member Description
Spatial()()()()
Do not use directly, for ISavable

Spatial(String)
Creates a new spatial with the specified name.

AcceptVisitor(IVisitor, Boolean)
Accept a visitor and let it perform an action on this Spatial.

AddController(ISpatialController)
Add a controller to this Spatial's collection.

AddLight(Light)
Adds a light to the Spatial's light collection.

ClearDirty(DirtyMark)
Clears the specified dirty mark from this Spatial.

CollectLights(LightCollection)
Collects all the lights from this Spatial up to the root, copying all lights at each node.

Controllers
Gets the read-only controller collection attached to this Spatial.

Draw(IRenderer)
Spatial's draw method. Used by subclasses: if a Node, it calls OnDraw on each child, if a mesh then it would render itself or be assigned to the render queue.

Equals(Object)
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Finalize()()()()
Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection.
(Inherited from Object.)
GetControllerAt(Int32)
Gets the controller at the specified index in this Spatial's collection. If the index is out of range, null will be returned.

GetHashCode()()()()
Serves as a hash function for a particular type.
(Inherited from Object.)
GetLightAt(Int32)
Gets the light from the Spatial's light collection if it exists.

GetType()()()()
Gets the Type of the current instance.
(Inherited from Object.)
IsDirty(DirtyMark)
Checks if this Spatial is marked with the specified dirty mark.

LastFrustumIntersect
Gets or sets the last frustum intersection result, which is used in the cull check in OnDraw(). Set this if you render a subtree and do not want it to be influenced by the parent.

Lights
Gets the local light collection relative to this Spatial. This collection is not read-only, but it is safe to modify its content as it will update the spatial it is attached to automatically.

MarkDirty(DirtyMark)
Marks the spatial dirty, but does not propagate the mark up/down the tree.

MemberwiseClone()()()()
Creates a shallow copy of the current Object.
(Inherited from Object.)
Name
Get or set this Spatial's name.

OnDraw(IRenderer)
Checks if the Spatial should be culled, if the Spatial is visible then Draw() will be called.

Parent
Gets this Spatial's parent.

ParentHintable
Gets the IHintable parent fro this Spatial, for inheritable scene hints to use.

PropagateBoundToRoot()()()()
Update this Spatial's parent world bounding and propagates the call to the root, ensuring all ancestors' world boundings properly contain their children's.

PropagateDirtyDown(DirtyMark)
Marks this spatial with the dirty flag and then propagates it down the scene graph. This is meant to be overridden by subclasses that have children.

PropagateDirtyUp(DirtyMark)
Marks this spatial with the dirty flag and then propagates it up the scene graph.

Read(ISavableReader)
Deserializes the object and populates it from the input.

RemoveAllControllers()()()()
Remove all controllers from this Spatial's collection.

RemoveAllLights()()()()
Removes all lights from the Spatial's light collection.

RemoveController(ISpatialController)
Removes a controller from this Spatial's collection.

RemoveControllerAt(Int32)
Removes a controller from the specified index in this Spatial's collection. If the index is out of range, then false will be returned.

RemoveFromParent()()()()
Removes this spatial from its parent, if it exists.

RemoveLight(Light)
Removes the specified light from the Spatial light collection, if it exists.

RemoveLightAt(Int32)
Removes a light by index from the Spatial's light collection.

Rotation
Get or set this Spatial's local rotation.

Scale
Get or set this Spatial's local scale.

SceneHints
Gets this Spatial's scene hints, a collection of enumerations that describe how the spatial should be processed.

SetMaterial(Material)
Convienence method to propagate a material down the scene graph.

SetModelBound(BoundingVolume)
Convienence method to propagate a model bounding volume down the scene graph.

SetRenderState(RenderState)
Convienence method to propagate a render state down the scene graph.

SetRotation(Matrix)
Convience method to set local rotation from a matrix.

SetScale(Single)
Convience method to set local uniform scale.

SetTranslation(Single, Single, Single)
Convience method to set local translation.

SortLights()()()()
Sorts world lights.

ToString()()()()
Returns a String that represents the current Object.
(Inherited from Object.)
Transform
Get or set this Spatial's local transform.

Translation
Get or set this Spatial's local translation.

Update(GameTime)
Update the Spatial. Updating it will update the transformation, lighting, and bounding properties if they are dirty. Update order: 1. Controllers 2. World Transform 3. World lighting 4. Children (if Node) 5. World Bounding 6. Propagate Bound (if initiator)

Update(GameTime, Boolean)
Update the Spatial. Updating it will update the transformation, lighting, and bounding properties if they are dirty. This is mainly used internally, as initiating will propagate the scene world bounding to the root node, after its children and their children are updated (if a Node). Update order: 1. Controllers 2. World Transform 3. World lighting 4. Children (if Node) 5. World Bounding 6. Propagate Bound (if initiator)

UpdateControllers(GameTime)
Updates the controllers attached to this node.

UpdateWorldBound(Boolean)
Updates the world bounding of this spatial. If a node, it is a bounding volume that contains all of the volumes of its children (and their children). The volume type is dictated by the first valid child world bounding. If it's a mesh, it is the transformed model bound.

UpdateWorldLights(Boolean)
Updates world lights.

UpdateWorldTransform(Boolean)
Updates the world transform of this spatial, clearing the dirty mark if present.

WorldBounding
Gets or sets the world bounding for this Spatial. This may be null.

WorldMatrix
Get the world matrix for this Spatial. This is equivalent to spatial.WorldTransforms.GetMatrix()

WorldRotation
Get this Spatial's world rotation.

WorldScale
Gets this Spatial's world scale.

WorldTransform
Gets this Spatial's world transform.

WorldTranslation
Get this Spatial's world translation.

Write(ISavableWriter)
Serializes the object and writes it to the output.

Inheritance Hierarchy
Object
Spatial
  Mesh
  Node

Assembly: Tesla (Module: Tesla) Version: 0.5.0.0 (0.5.0.0)