DXGfxLib.SceneObject Class Reference

Inherits DXGfxLib::SceneNode, DXGfxLib::IDrawable, DXGfxLib::IAmScriptable, DXGfxLib::SceneNode, DXGfxLib::IDrawable, and DXGfxLib::IAmScriptable.

Inherited by DXGfxLib.MeshObject, DXGfxLib.MeshObject, DXGfxLib.RawObject, DXGfxLib.RawObject, DXGfxLib.Water2, and DXGfxLib.Water2.

Collaboration diagram for DXGfxLib.SceneObject:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 SceneObject ()
 Default constructor. Build a default bounding box, a very smal and tiny one centered on the origin of the local coordinate system. Thus by default without any further operation this scene object might be added to the list of objects to be rendered if the position of the scene object is in the viewing frustrum.
override void Initialize ()
override void Dispose ()
 Most SceneObjects don't need to Dispose any ressource. In fact most of the time DX ressources are only attached to them, the scene object itself does not have the responsability to load or dispose them, we leave that responsability to the code which has loaded the ressource and attached it to a scene object. The only exception to this are terrain tiles, these are scene objects very specific and create there own vertex, index buffer from the information provided on the terrain creation. They need to dispose this (along with the textures loaded and everything).
virtual void LoadFromFile (Device d3ddevice, string fileName)
 For loading a scene from the XML file this method is pretty useful as we just get the filename from the file, create an instance of the desired type and instruct that instance to populate its internal state from the specified file.
override void Update (Frustrum frustrum, double appTime, float elapsedTime)
 The update method does pretty much what it does for a scene node except that here we also use the local bbox to calculate the bounding box.
override void AttachForRendering (Frustrum frustrum, List< IDrawable > objectsToBeRendered)
 When a scene is updated it will first call the Update method on the node hierarchy and then it will call the AttachForRendering method on the node hierarchy. This will give an opportunity to each scene object (or any instance of a derived class) to decide whether it needs to be rendered this frame or not.
BBox CalculateLocalBBox (Mesh meshToUse)
 This will calculate a local bounding box based on associated geometry.
override void DetachAll ()
 Use this method when you want to cut the association between a SceneObject and anything that might have been associated to it.
virtual void SetEffectsValues (Device d3ddevice, Effect eff, int pass)
 Classes that want to draw on screen might need to set some values for the effect used to draw them. That is the purpose of this method. Technically this could be done in Draw but I prefered to have to separated methods.
virtual void Draw (Device device)
 In its draw method the scene will call the Draw method on all scene object (or derived class instances) that have registered to be rendered in the AttachForRendering method.
virtual bool Intersect (Vector3 rayPos, Vector3 rayDir, out IntersectInformation closestHit)
 This method can be used to decide whether a ray intersect with the scene object or not. RayPos and RayDir have to be given in world space coordinates. They will be transform to local coordinates to perform the testing by the the method itself. This method return IntersectInformation on the closest hit to the RayPos.
override bool Intersect (Vector3 rayOri, Vector3 rayDir, ref List< SceneObject > collidingSceneObjects)
 This method is somehow similar to the previous one except that instead of returning the closest hit information it does return a list of colliding objects.
override bool Intersect (Vector3 rayOri, Vector3 rayDir, ref List< SceneObject > collidingSceneObjects, System.Type desiredType)
 This method is somehow similar to the previous one except that you can specify here the desired type of the scene objects you will get back in the list of objects colliding with the ray.
virtual int CompareTo (Object obj)
 Each scene object has an associated effect. We want SceneObject to implement the CompareTo method, thus when they will be added to the sorted list of objects to be rendered, objects are going to be ordered based on the effect filename they use.
virtual int CompareTo (SceneObject sceneObj)
 Each scene object has an associated effect. We want SceneObject to implement the CompareTo method, thus when they will be added to the sorted list of objects to be rendered, objects are going to be ordered based on the effect filename they use.
virtual int CompareTo (IDrawable sceneObj)
 Each scene object has an associated effect. We want SceneObject to implement the CompareTo method, thus when they will be added to the sorted list of objects to be rendered, objects are going to be ordered based on the effect filename they use.
override void OnMove ()
 We want to override this because we want to perform collision detection at some point. Doing this in the OnMove method is interesting this means that we will go trhough this method for all move of the scene object, then we have the opportunity to do what we want 'need' based on the checkForCollision and doNotInterpenatre booleans.
void SetScript (Script script)
 THis method will use the Script instance passed as parameter and will set as the Script associated with this scene node.
Script GetScript ()
 This method will return the Script instance associated with the scene node.
void SetTimeLine (TimeLine timeLine)
 Same as SetScript but for timelines.
TimeLine GetTimeLine ()
 Will return the instance of the TimeLine class associated with this scene node.
virtual void Evaluate (double appTime, float elapsedTime)
 The evaluate method will ask the script and the timeline to evaluate themselves. This is a form of update but the work is different from what is performed in the update method. The update method will update geometric information (bounding boxes....). The evaluate method will 'update' the node as far as the logic (script and timeline) associated with it is concerned. This method is marked virtual because you could create classes deriving from SceneNode that will implement their own logic through different means than the script and the timeline. Then in these derive classes you will have the opportunity to update the node logic and values through this method.
void Reset ()
 Scripts and timeline have reset methods. They will be called when the simulation is reseted (stoped and restarted from the beginning).
void AddEvent (Event evt)
 This method will add events to the list of events of our scene node.
void RemoveEvent (Event evt)
 This method is the pendant of the RemoveEvent.
virtual string[] ListFileRessources ()
 This method should be overriden in classes deriving from this one. It could possible be used to list all the files you need to move in you decide to change location of the main file associated with this scene object.
virtual void Clicked (double appTime, float elapsedTime)
 This method will be called on the Scene object if canBeClicked is true and if someone click on this object!
virtual void Collision (double appTime, float elapsedTime, SceneObject collidingObject)
 This method will be called if another scene object collides with this one and checkForCollision is true. TODO: Add code to avoid sceneobject to interpenatre !
Event[] popEventsByName (string name)
 Return an Array with all fired events currently associated with the scriptable object and removes the association with the object.
Event[] popEventsByType (string type)
 Return an Array with all fired events currently associated with the scriptable object and removes the association with the object.
Event[] peekEventsByName (string name)
 Like popEventsByName except that the events will remain associated with the object until some other code removes that association. It is a bit like the events remain 'fired' for further consumtion.
Event[] peekEventsByType (string type)
 Like popEventsByType except that the events will remain associated with the object until some other code removes that association. It is a bit like the events remain 'fired' for further consumtion.
 SceneObject ()
 Default constructor. Build a default bounding box, a very smal and tiny one centered on the origin of the local coordinate system. Thus by default without any further operation this scene object might be added to the list of objects to be rendered if the position of the scene object is in the viewing frustrum.
override void Initialize ()
override void Dispose ()
 Most SceneObjects don't need to Dispose any ressource. In fact most of the time DX ressources are only attached to them, the scene object itself does not have the responsability to load or dispose them, we leave that responsability to the code which has loaded the ressource and attached it to a scene object. The only exception to this are terrain tiles, these are scene objects very specific and create there own vertex, index buffer from the information provided on the terrain creation. They need to dispose this (along with the textures loaded and everything).
virtual void LoadFromFile (Device d3ddevice, string fileName)
 For loading a scene from the XML file this method is pretty useful as we just get the filename from the file, create an instance of the desired type and instruct that instance to populate its internal state from the specified file.
override void Update (Frustrum frustrum, double appTime, float elapsedTime)
 The update method does pretty much what it does for a scene node except that here we also use the local bbox to calculate the bounding box.
override void AttachForRendering (Frustrum frustrum, List< IDrawable > objectsToBeRendered)
 When a scene is updated it will first call the Update method on the node hierarchy and then it will call the AttachForRendering method on the node hierarchy. This will give an opportunity to each scene object (or any instance of a derived class) to decide whether it needs to be rendered this frame or not.
BBox CalculateLocalBBox (Mesh meshToUse)
 This will calculate a local bounding box based on associated geometry.
override void DetachAll ()
 Use this method when you want to cut the association between a SceneObject and anything that might have been associated to it.
virtual void SetEffectsValues (Device d3ddevice, Effect eff, int pass)
 Classes that want to draw on screen might need to set some values for the effect used to draw them. That is the purpose of this method. Technically this could be done in Draw but I prefered to have to separated methods.
virtual void Draw (Device device)
 In its draw method the scene will call the Draw method on all scene object (or derived class instances) that have registered to be rendered in the AttachForRendering method.
virtual bool Intersect (Vector3 rayPos, Vector3 rayDir, out IntersectInformation closestHit)
 This method can be used to decide whether a ray intersect with the scene object or not. RayPos and RayDir have to be given in world space coordinates. They will be transform to local coordinates to perform the testing by the the method itself. This method return IntersectInformation on the closest hit to the RayPos.
override bool Intersect (Vector3 rayOri, Vector3 rayDir, ref List< SceneObject > collidingSceneObjects)
 This method is somehow similar to the previous one except that instead of returning the closest hit information it does return a list of colliding objects.
override bool Intersect (Vector3 rayOri, Vector3 rayDir, ref List< SceneObject > collidingSceneObjects, System.Type desiredType)
 This method is somehow similar to the previous one except that you can specify here the desired type of the scene objects you will get back in the list of objects colliding with the ray.
virtual int CompareTo (Object obj)
 Each scene object has an associated effect. We want SceneObject to implement the CompareTo method, thus when they will be added to the sorted list of objects to be rendered, objects are going to be ordered based on the effect filename they use.
virtual int CompareTo (SceneObject sceneObj)
 Each scene object has an associated effect. We want SceneObject to implement the CompareTo method, thus when they will be added to the sorted list of objects to be rendered, objects are going to be ordered based on the effect filename they use.
virtual int CompareTo (IDrawable sceneObj)
 Each scene object has an associated effect. We want SceneObject to implement the CompareTo method, thus when they will be added to the sorted list of objects to be rendered, objects are going to be ordered based on the effect filename they use.
override void OnMove ()
 We want to override this because we want to perform collision detection at some point. Doing this in the OnMove method is interesting this means that we will go trhough this method for all move of the scene object, then we have the opportunity to do what we want 'need' based on the checkForCollision and doNotInterpenatre booleans.
void SetScript (Script script)
 THis method will use the Script instance passed as parameter and will set as the Script associated with this scene node.
Script GetScript ()
 This method will return the Script instance associated with the scene node.
void SetTimeLine (TimeLine timeLine)
 Same as SetScript but for timelines.
TimeLine GetTimeLine ()
 Will return the instance of the TimeLine class associated with this scene node.
virtual void Evaluate (double appTime, float elapsedTime)
 The evaluate method will ask the script and the timeline to evaluate themselves. This is a form of update but the work is different from what is performed in the update method. The update method will update geometric information (bounding boxes....). The evaluate method will 'update' the node as far as the logic (script and timeline) associated with it is concerned. This method is marked virtual because you could create classes deriving from SceneNode that will implement their own logic through different means than the script and the timeline. Then in these derive classes you will have the opportunity to update the node logic and values through this method.
void Reset ()
 Scripts and timeline have reset methods. They will be called when the simulation is reseted (stoped and restarted from the beginning).
void AddEvent (Event evt)
 This method will add events to the list of events of our scene node.
void RemoveEvent (Event evt)
 This method is the pendant of the RemoveEvent.
virtual string[] ListFileRessources ()
 This method should be overriden in classes deriving from this one. It could possible be used to list all the files you need to move in you decide to change location of the main file associated with this scene object.
virtual void Clicked (double appTime, float elapsedTime)
 This method will be called on the Scene object if canBeClicked is true and if someone click on this object!
virtual void Collision (double appTime, float elapsedTime, SceneObject collidingObject)
 This method will be called if another scene object collides with this one and checkForCollision is true. TODO: Add code to avoid sceneobject to interpenatre !
Event[] popEventsByName (string name)
 Return an Array with all fired events currently associated with the scriptable object and removes the association with the object.
Event[] popEventsByType (string type)
 Return an Array with all fired events currently associated with the scriptable object and removes the association with the object.
Event[] peekEventsByName (string name)
 Like popEventsByName except that the events will remain associated with the object until some other code removes that association. It is a bit like the events remain 'fired' for further consumtion.
Event[] peekEventsByType (string type)
 Like popEventsByType except that the events will remain associated with the object until some other code removes that association. It is a bit like the events remain 'fired' for further consumtion.

Public Attributes

string fileName
 Each scene object now keep tracks of the fileName from which it has been built. This is important mostly when the library is used in conjunction with the editor. It does ease a lot of things.
BBox localBoundingBox = null
 A scene Object is a scene node with geometric information associated to it. Scene object should be able to know what is bounding box is in its local coordinate system. That information is going to be used in the update phase to calculate the bounding box in world coordinate system and then to determine whether or not this scene object need to be rendered or not.

Protected Attributes

DrawableBBox drawBox
 In case we want to draw the bouding box this will be useful.
bool drawBoundingBox = false
 Should be set to true is we want to draw the bounding box!
bool canBeClicked = false
 This boolean indicates if the scene object want to be notified when the user click on it!
bool checkForCollision = false
 This boolean indicates if this scene object should be taken into account when checking for collisions between scene objects or if it is some sort of ghost that doesn't even want to know that somehting is going through it:).
bool solid = false
 This boolean indicates if the base scene object code should automatically take care of not having this scene object interpenatre another one. If true this clearly indicates that this is a solid object. In both situations as soon as checkForCollision is true, the object will be notified of the collision! If checkForCollision is false there is no use setting this to true as the collision situation won't even be detected.
EffectGroup associatedEffectGroup = null
 Each SceneObject will have an associated effect group containing the effectst that will be used to render it in various situation.
bool hide = false
 A boolean which allow use to specific if the SceneObject should be displayed or not.
Matrix lastValidWorldMat = Matrix.Identity
 We need to always have a valid position, so we keep the last known valid position here.
TimeLine timeline = null
 Each scene node also has a timeline attached to it. This is where we keep a ref to the instance of the Timeline class associated with this node.

Properties

bool HasBeenClicked [get, set]
 Accessor for cliked bolean. It is useful to access it through an accessor so if in the future we want to trigger some custom action from here it will be possible.
bool DrawBoundingBox [get, set]
 Accessors to state whether you want to display bounding box or not!
bool CanBeClicked [get, set]
 This boolean indicates if the scene object want to be notified when the user click on it!
bool CheckForCollision [get, set]
 This boolean indicates if this scene object should be taken into account when checking for collisions between scene objects or if it is some sort of ghost that doesn't even want to know that somehting is going through it:).
bool Solid [get, set]
 This boolean indicates if the base scene object code should automatically take care of not having this scene object interpenatre another one. If true this clearly indicates that this is a solid object. In both situations as soon as checkForCollision is true, the object will be notified of the collision! If checkForCollision is false there is no use setting this to true as the collision situation won't even be detected.
string Name [get]
 We need a name to be able to identity the script and quite a lot of things.
EffectGroup AssociatedEffectGroup [get, set]
 Associated effect group accessor.
bool Hide [get, set]
 Accessor for hide boolean. When true the scene object won't be rendered.


Detailed Description

Definition at line 31 of file SceneObject.cs.


Constructor & Destructor Documentation

DXGfxLib.SceneObject.SceneObject (  ) 

Default constructor. Build a default bounding box, a very smal and tiny one centered on the origin of the local coordinate system. Thus by default without any further operation this scene object might be added to the list of objects to be rendered if the position of the scene object is in the viewing frustrum.

Definition at line 189 of file SceneObject.cs.

Here is the call graph for this function:

DXGfxLib.SceneObject.SceneObject (  ) 

Default constructor. Build a default bounding box, a very smal and tiny one centered on the origin of the local coordinate system. Thus by default without any further operation this scene object might be added to the list of objects to be rendered if the position of the scene object is in the viewing frustrum.

Definition at line 189 of file SceneObject.cs.

Here is the call graph for this function:


Member Function Documentation

void DXGfxLib.SceneObject.AddEvent ( Event  evt  ) 

This method will add events to the list of events of our scene node.

Parameters:
evt 

Implements DXGfxLib.IAmScriptable.

Definition at line 593 of file SceneObject.cs.

void DXGfxLib.SceneObject.AddEvent ( Event  evt  ) 

This method will add events to the list of events of our scene node.

Parameters:
evt 

Implements DXGfxLib.IAmScriptable.

Definition at line 593 of file SceneObject.cs.

Here is the caller graph for this function:

override void DXGfxLib.SceneObject.AttachForRendering ( Frustrum  frustrum,
List< IDrawable objectsToBeRendered 
) [virtual]

When a scene is updated it will first call the Update method on the node hierarchy and then it will call the AttachForRendering method on the node hierarchy. This will give an opportunity to each scene object (or any instance of a derived class) to decide whether it needs to be rendered this frame or not.

Parameters:
frustrum 
objectsToBeRendered 

Reimplemented from DXGfxLib.SceneNode.

Reimplemented in DXGfxLib.SkyBox, DXGfxLib.TerrainTile, DXGfxLib.SkyBox, and DXGfxLib.TerrainTile.

Definition at line 257 of file SceneObject.cs.

Here is the call graph for this function:

override void DXGfxLib.SceneObject.AttachForRendering ( Frustrum  frustrum,
List< IDrawable objectsToBeRendered 
) [virtual]

When a scene is updated it will first call the Update method on the node hierarchy and then it will call the AttachForRendering method on the node hierarchy. This will give an opportunity to each scene object (or any instance of a derived class) to decide whether it needs to be rendered this frame or not.

Parameters:
frustrum 
objectsToBeRendered 

Reimplemented from DXGfxLib.SceneNode.

Reimplemented in DXGfxLib.SkyBox, DXGfxLib.TerrainTile, DXGfxLib.SkyBox, and DXGfxLib.TerrainTile.

Definition at line 257 of file SceneObject.cs.

Here is the call graph for this function:

BBox DXGfxLib.SceneObject.CalculateLocalBBox ( Mesh  meshToUse  ) 

This will calculate a local bounding box based on associated geometry.

Parameters:
meshToUse 
Returns:

Definition at line 280 of file SceneObject.cs.

BBox DXGfxLib.SceneObject.CalculateLocalBBox ( Mesh  meshToUse  ) 

This will calculate a local bounding box based on associated geometry.

Parameters:
meshToUse 
Returns:

Definition at line 280 of file SceneObject.cs.

Here is the caller graph for this function:

virtual void DXGfxLib.SceneObject.Clicked ( double  appTime,
float  elapsedTime 
) [virtual]

This method will be called on the Scene object if canBeClicked is true and if someone click on this object!

Parameters:
appTime 
elapsedTime 

Definition at line 629 of file SceneObject.cs.

Here is the call graph for this function:

virtual void DXGfxLib.SceneObject.Clicked ( double  appTime,
float  elapsedTime 
) [virtual]

This method will be called on the Scene object if canBeClicked is true and if someone click on this object!

Parameters:
appTime 
elapsedTime 

Definition at line 629 of file SceneObject.cs.

Here is the call graph for this function:

virtual void DXGfxLib.SceneObject.Collision ( double  appTime,
float  elapsedTime,
SceneObject  collidingObject 
) [virtual]

This method will be called if another scene object collides with this one and checkForCollision is true. TODO: Add code to avoid sceneobject to interpenatre !

Parameters:
appTime 
elapsedTime 
collidingObject 

Reimplemented in DXGfxLib.Trigger, and DXGfxLib.Trigger.

Definition at line 644 of file SceneObject.cs.

Here is the call graph for this function:

virtual void DXGfxLib.SceneObject.Collision ( double  appTime,
float  elapsedTime,
SceneObject  collidingObject 
) [virtual]

This method will be called if another scene object collides with this one and checkForCollision is true. TODO: Add code to avoid sceneobject to interpenatre !

Parameters:
appTime 
elapsedTime 
collidingObject 

Reimplemented in DXGfxLib.Trigger, and DXGfxLib.Trigger.

Definition at line 644 of file SceneObject.cs.

Here is the call graph for this function:

Here is the caller graph for this function:

virtual int DXGfxLib.SceneObject.CompareTo ( IDrawable  sceneObj  )  [virtual]

Each scene object has an associated effect. We want SceneObject to implement the CompareTo method, thus when they will be added to the sorted list of objects to be rendered, objects are going to be ordered based on the effect filename they use.

Parameters:
sceneObj 
Returns:

Definition at line 398 of file SceneObject.cs.

Here is the call graph for this function:

virtual int DXGfxLib.SceneObject.CompareTo ( SceneObject  sceneObj  )  [virtual]

Each scene object has an associated effect. We want SceneObject to implement the CompareTo method, thus when they will be added to the sorted list of objects to be rendered, objects are going to be ordered based on the effect filename they use.

Parameters:
sceneObj 
Returns:

Definition at line 386 of file SceneObject.cs.

Here is the call graph for this function:

virtual int DXGfxLib.SceneObject.CompareTo ( Object  obj  )  [virtual]

Each scene object has an associated effect. We want SceneObject to implement the CompareTo method, thus when they will be added to the sorted list of objects to be rendered, objects are going to be ordered based on the effect filename they use.

Parameters:
obj 
Returns:

Reimplemented in DXGfxLib.Billboard, and DXGfxLib.Billboard.

Definition at line 367 of file SceneObject.cs.

Here is the call graph for this function:

virtual int DXGfxLib.SceneObject.CompareTo ( IDrawable  sceneObj  )  [virtual]

Each scene object has an associated effect. We want SceneObject to implement the CompareTo method, thus when they will be added to the sorted list of objects to be rendered, objects are going to be ordered based on the effect filename they use.

Parameters:
sceneObj 
Returns:

Definition at line 398 of file SceneObject.cs.

Here is the call graph for this function:

virtual int DXGfxLib.SceneObject.CompareTo ( SceneObject  sceneObj  )  [virtual]

Each scene object has an associated effect. We want SceneObject to implement the CompareTo method, thus when they will be added to the sorted list of objects to be rendered, objects are going to be ordered based on the effect filename they use.

Parameters:
sceneObj 
Returns:

Definition at line 386 of file SceneObject.cs.

Here is the call graph for this function:

virtual int DXGfxLib.SceneObject.CompareTo ( Object  obj  )  [virtual]

Each scene object has an associated effect. We want SceneObject to implement the CompareTo method, thus when they will be added to the sorted list of objects to be rendered, objects are going to be ordered based on the effect filename they use.

Parameters:
obj 
Returns:

Reimplemented in DXGfxLib.Billboard, and DXGfxLib.Billboard.

Definition at line 367 of file SceneObject.cs.

Here is the call graph for this function:

override void DXGfxLib.SceneObject.DetachAll (  )  [virtual]

Use this method when you want to cut the association between a SceneObject and anything that might have been associated to it.

Reimplemented from DXGfxLib.SceneNode.

Definition at line 289 of file SceneObject.cs.

override void DXGfxLib.SceneObject.DetachAll (  )  [virtual]

Use this method when you want to cut the association between a SceneObject and anything that might have been associated to it.

Reimplemented from DXGfxLib.SceneNode.

Definition at line 289 of file SceneObject.cs.

override void DXGfxLib.SceneObject.Dispose (  )  [virtual]

Most SceneObjects don't need to Dispose any ressource. In fact most of the time DX ressources are only attached to them, the scene object itself does not have the responsability to load or dispose them, we leave that responsability to the code which has loaded the ressource and attached it to a scene object. The only exception to this are terrain tiles, these are scene objects very specific and create there own vertex, index buffer from the information provided on the terrain creation. They need to dispose this (along with the textures loaded and everything).

Reimplemented from DXGfxLib.SceneNode.

Reimplemented in DXGfxLib.SkyBox, DXGfxLib.TerrainTile, DXGfxLib.TexturedPlane, DXGfxLib.SkyBox, DXGfxLib.TerrainTile, and DXGfxLib.TexturedPlane.

Definition at line 213 of file SceneObject.cs.

override void DXGfxLib.SceneObject.Dispose (  )  [virtual]

Most SceneObjects don't need to Dispose any ressource. In fact most of the time DX ressources are only attached to them, the scene object itself does not have the responsability to load or dispose them, we leave that responsability to the code which has loaded the ressource and attached it to a scene object. The only exception to this are terrain tiles, these are scene objects very specific and create there own vertex, index buffer from the information provided on the terrain creation. They need to dispose this (along with the textures loaded and everything).

Reimplemented from DXGfxLib.SceneNode.

Reimplemented in DXGfxLib.SkyBox, DXGfxLib.TerrainTile, DXGfxLib.TexturedPlane, DXGfxLib.SkyBox, DXGfxLib.TerrainTile, and DXGfxLib.TexturedPlane.

Definition at line 213 of file SceneObject.cs.

virtual void DXGfxLib.SceneObject.Draw ( Device  device  )  [virtual]

virtual void DXGfxLib.SceneObject.Draw ( Device  device  )  [virtual]

In its draw method the scene will call the Draw method on all scene object (or derived class instances) that have registered to be rendered in the AttachForRendering method.

Parameters:
device 

Reimplemented in DXGfxLib.ArticulatedModel, DXGfxLib.Billboard, DXGfxLib.Cursor, DXGfxLib.FrameworkMeshObject, DXGfxLib.MeshObject, DXGfxLib.MeshObjectWithLOD, DXGfxLib.ObjectFromMeshRessource, DXGfxLib.ObjectFromObj, DXGfxLib.SkyBox, DXGfxLib.TerrainTile, DXGfxLib.TexturedPlane, DXGfxLib.Water, DXGfxLib.ArticulatedModel, DXGfxLib.Billboard, DXGfxLib.Cursor, DXGfxLib.FrameworkMeshObject, DXGfxLib.MeshObject, DXGfxLib.MeshObjectWithLOD, DXGfxLib.ObjectFromMeshRessource, DXGfxLib.ObjectFromObj, DXGfxLib.SkyBox, DXGfxLib.TerrainTile, DXGfxLib.TexturedPlane, and DXGfxLib.Water.

Definition at line 303 of file SceneObject.cs.

Here is the call graph for this function:

Here is the caller graph for this function:

virtual void DXGfxLib.SceneObject.Evaluate ( double  appTime,
float  elapsedTime 
) [virtual]

The evaluate method will ask the script and the timeline to evaluate themselves. This is a form of update but the work is different from what is performed in the update method. The update method will update geometric information (bounding boxes....). The evaluate method will 'update' the node as far as the logic (script and timeline) associated with it is concerned. This method is marked virtual because you could create classes deriving from SceneNode that will implement their own logic through different means than the script and the timeline. Then in these derive classes you will have the opportunity to update the node logic and values through this method.

Parameters:
appTime 
elapsedTime 

Implements DXGfxLib.IAmScriptable.

Definition at line 534 of file SceneObject.cs.

Here is the call graph for this function:

virtual void DXGfxLib.SceneObject.Evaluate ( double  appTime,
float  elapsedTime 
) [virtual]

The evaluate method will ask the script and the timeline to evaluate themselves. This is a form of update but the work is different from what is performed in the update method. The update method will update geometric information (bounding boxes....). The evaluate method will 'update' the node as far as the logic (script and timeline) associated with it is concerned. This method is marked virtual because you could create classes deriving from SceneNode that will implement their own logic through different means than the script and the timeline. Then in these derive classes you will have the opportunity to update the node logic and values through this method.

Parameters:
appTime 
elapsedTime 

Implements DXGfxLib.IAmScriptable.

Definition at line 534 of file SceneObject.cs.

Here is the call graph for this function:

Here is the caller graph for this function:

Script DXGfxLib.SceneObject.GetScript (  ) 

This method will return the Script instance associated with the scene node.

Returns:

Implements DXGfxLib.IAmScriptable.

Definition at line 491 of file SceneObject.cs.

Here is the call graph for this function:

Script DXGfxLib.SceneObject.GetScript (  ) 

This method will return the Script instance associated with the scene node.

Returns:

Implements DXGfxLib.IAmScriptable.

Definition at line 491 of file SceneObject.cs.

Here is the call graph for this function:

TimeLine DXGfxLib.SceneObject.GetTimeLine (  ) 

Will return the instance of the TimeLine class associated with this scene node.

Returns:

Implements DXGfxLib.IAmScriptable.

Definition at line 515 of file SceneObject.cs.

Here is the call graph for this function:

TimeLine DXGfxLib.SceneObject.GetTimeLine (  ) 

Will return the instance of the TimeLine class associated with this scene node.

Returns:

Implements DXGfxLib.IAmScriptable.

Definition at line 515 of file SceneObject.cs.

Here is the call graph for this function:

override void DXGfxLib.SceneObject.Initialize (  )  [virtual]

override void DXGfxLib.SceneObject.Initialize (  )  [virtual]

Reimplemented from DXGfxLib.SceneNode.

Reimplemented in DXGfxLib.MeshObject, DXGfxLib.SkyDome, DXGfxLib.Water2, DXGfxLib.MeshObject, DXGfxLib.SkyDome, and DXGfxLib.Water2.

Definition at line 194 of file SceneObject.cs.

Here is the caller graph for this function:

override bool DXGfxLib.SceneObject.Intersect ( Vector3  rayOri,
Vector3  rayDir,
ref List< SceneObject collidingSceneObjects,
System.Type  desiredType 
) [virtual]

This method is somehow similar to the previous one except that you can specify here the desired type of the scene objects you will get back in the list of objects colliding with the ray.

Parameters:
rayOri 
rayDir 
collidingSceneObjects 
desiredType 
Returns:

Reimplemented from DXGfxLib.SceneNode.

Reimplemented in DXGfxLib.MeshObject, and DXGfxLib.MeshObject.

Definition at line 355 of file SceneObject.cs.

override bool DXGfxLib.SceneObject.Intersect ( Vector3  rayOri,
Vector3  rayDir,
ref List< SceneObject collidingSceneObjects 
) [virtual]

This method is somehow similar to the previous one except that instead of returning the closest hit information it does return a list of colliding objects.

Parameters:
rayOri 
rayDir 
collidingSceneObjects 
Returns:

Reimplemented from DXGfxLib.SceneNode.

Reimplemented in DXGfxLib.MeshObject, and DXGfxLib.MeshObject.

Definition at line 341 of file SceneObject.cs.

virtual bool DXGfxLib.SceneObject.Intersect ( Vector3  rayPos,
Vector3  rayDir,
out IntersectInformation  closestHit 
) [virtual]

This method can be used to decide whether a ray intersect with the scene object or not. RayPos and RayDir have to be given in world space coordinates. They will be transform to local coordinates to perform the testing by the the method itself. This method return IntersectInformation on the closest hit to the RayPos.

Parameters:
rayPos 
rayDir 
closestHit 
Returns:

Reimplemented in DXGfxLib.MeshObject, DXGfxLib.TerrainTile, DXGfxLib.MeshObject, and DXGfxLib.TerrainTile.

Definition at line 327 of file SceneObject.cs.

override bool DXGfxLib.SceneObject.Intersect ( Vector3  rayOri,
Vector3  rayDir,
ref List< SceneObject collidingSceneObjects,
System.Type  desiredType 
) [virtual]

This method is somehow similar to the previous one except that you can specify here the desired type of the scene objects you will get back in the list of objects colliding with the ray.

Parameters:
rayOri 
rayDir 
collidingSceneObjects 
desiredType 
Returns:

Reimplemented from DXGfxLib.SceneNode.

Reimplemented in DXGfxLib.MeshObject, and DXGfxLib.MeshObject.

Definition at line 355 of file SceneObject.cs.

override bool DXGfxLib.SceneObject.Intersect ( Vector3  rayOri,
Vector3  rayDir,
ref List< SceneObject collidingSceneObjects 
) [virtual]

This method is somehow similar to the previous one except that instead of returning the closest hit information it does return a list of colliding objects.

Parameters:
rayOri 
rayDir 
collidingSceneObjects 
Returns:

Reimplemented from DXGfxLib.SceneNode.

Reimplemented in DXGfxLib.MeshObject, and DXGfxLib.MeshObject.

Definition at line 341 of file SceneObject.cs.

virtual bool DXGfxLib.SceneObject.Intersect ( Vector3  rayPos,
Vector3  rayDir,
out IntersectInformation  closestHit 
) [virtual]

This method can be used to decide whether a ray intersect with the scene object or not. RayPos and RayDir have to be given in world space coordinates. They will be transform to local coordinates to perform the testing by the the method itself. This method return IntersectInformation on the closest hit to the RayPos.

Parameters:
rayPos 
rayDir 
closestHit 
Returns:

Reimplemented in DXGfxLib.MeshObject, DXGfxLib.TerrainTile, DXGfxLib.MeshObject, and DXGfxLib.TerrainTile.

Definition at line 327 of file SceneObject.cs.

Here is the caller graph for this function:

virtual string [] DXGfxLib.SceneObject.ListFileRessources (  )  [virtual]

This method should be overriden in classes deriving from this one. It could possible be used to list all the files you need to move in you decide to change location of the main file associated with this scene object.

Returns:

Definition at line 613 of file SceneObject.cs.

virtual string [] DXGfxLib.SceneObject.ListFileRessources (  )  [virtual]

This method should be overriden in classes deriving from this one. It could possible be used to list all the files you need to move in you decide to change location of the main file associated with this scene object.

Returns:

Definition at line 613 of file SceneObject.cs.

virtual void DXGfxLib.SceneObject.LoadFromFile ( Device  d3ddevice,
string  fileName 
) [virtual]

For loading a scene from the XML file this method is pretty useful as we just get the filename from the file, create an instance of the desired type and instruct that instance to populate its internal state from the specified file.

Parameters:
d3ddevice 
fileName 

Reimplemented in DXGfxLib.ArticulatedModel, DXGfxLib.Cursor, DXGfxLib.MeshObject, DXGfxLib.SkyBox, DXGfxLib.SkyDome, DXGfxLib.Water, DXGfxLib.Water2, DXGfxLib.ArticulatedModel, DXGfxLib.Cursor, DXGfxLib.MeshObject, DXGfxLib.SkyBox, DXGfxLib.SkyDome, DXGfxLib.Water, and DXGfxLib.Water2.

Definition at line 224 of file SceneObject.cs.

virtual void DXGfxLib.SceneObject.LoadFromFile ( Device  d3ddevice,
string  fileName 
) [virtual]

For loading a scene from the XML file this method is pretty useful as we just get the filename from the file, create an instance of the desired type and instruct that instance to populate its internal state from the specified file.

Parameters:
d3ddevice 
fileName 

Reimplemented in DXGfxLib.ArticulatedModel, DXGfxLib.Cursor, DXGfxLib.MeshObject, DXGfxLib.SkyBox, DXGfxLib.SkyDome, DXGfxLib.Water, DXGfxLib.Water2, DXGfxLib.ArticulatedModel, DXGfxLib.Cursor, DXGfxLib.MeshObject, DXGfxLib.SkyBox, DXGfxLib.SkyDome, DXGfxLib.Water, and DXGfxLib.Water2.

Definition at line 224 of file SceneObject.cs.

Here is the caller graph for this function:

override void DXGfxLib.SceneObject.OnMove (  )  [virtual]

We want to override this because we want to perform collision detection at some point. Doing this in the OnMove method is interesting this means that we will go trhough this method for all move of the scene object, then we have the opportunity to do what we want 'need' based on the checkForCollision and doNotInterpenatre booleans.

If a collision is detected and that this object is marked as doNotInterpenatre, then the we will revert it's position to its last known valid position.

Reimplemented from DXGfxLib.SceneNode.

Definition at line 417 of file SceneObject.cs.

Here is the call graph for this function:

override void DXGfxLib.SceneObject.OnMove (  )  [virtual]

We want to override this because we want to perform collision detection at some point. Doing this in the OnMove method is interesting this means that we will go trhough this method for all move of the scene object, then we have the opportunity to do what we want 'need' based on the checkForCollision and doNotInterpenatre booleans.

If a collision is detected and that this object is marked as doNotInterpenatre, then the we will revert it's position to its last known valid position.

Reimplemented from DXGfxLib.SceneNode.

Definition at line 417 of file SceneObject.cs.

Here is the call graph for this function:

Event [] DXGfxLib.SceneObject.peekEventsByName ( string  name  ) 

Like popEventsByName except that the events will remain associated with the object until some other code removes that association. It is a bit like the events remain 'fired' for further consumtion.

Just as a reminder this is the life of events: Events are added to the scriptable object timeline. At the appropriate time they are fired, I mean associated with the object (aka added to a specific event collection). Then they remain associated with the object until some code removes them from there!

Parameters:
name 
Returns:

Implements DXGfxLib.IAmScriptable.

Definition at line 717 of file SceneObject.cs.

Event [] DXGfxLib.SceneObject.peekEventsByName ( string  name  ) 

Like popEventsByName except that the events will remain associated with the object until some other code removes that association. It is a bit like the events remain 'fired' for further consumtion.

Just as a reminder this is the life of events: Events are added to the scriptable object timeline. At the appropriate time they are fired, I mean associated with the object (aka added to a specific event collection). Then they remain associated with the object until some code removes them from there!

Parameters:
name 
Returns:

Implements DXGfxLib.IAmScriptable.

Definition at line 717 of file SceneObject.cs.

Event [] DXGfxLib.SceneObject.peekEventsByType ( string  type  ) 

Like popEventsByType except that the events will remain associated with the object until some other code removes that association. It is a bit like the events remain 'fired' for further consumtion.

Just as a reminder this is the life of events: Events are added to the scriptable object timeline. At the appropriate time they are fired, I mean associated with the object (aka added to a specific event collection). Then they remain associated with the object until some code removes them from there!

Parameters:
name 
Returns:

Implements DXGfxLib.IAmScriptable.

Definition at line 743 of file SceneObject.cs.

Event [] DXGfxLib.SceneObject.peekEventsByType ( string  type  ) 

Like popEventsByType except that the events will remain associated with the object until some other code removes that association. It is a bit like the events remain 'fired' for further consumtion.

Just as a reminder this is the life of events: Events are added to the scriptable object timeline. At the appropriate time they are fired, I mean associated with the object (aka added to a specific event collection). Then they remain associated with the object until some code removes them from there!

Parameters:
name 
Returns:

Implements DXGfxLib.IAmScriptable.

Definition at line 743 of file SceneObject.cs.

Event [] DXGfxLib.SceneObject.popEventsByName ( string  name  ) 

Return an Array with all fired events currently associated with the scriptable object and removes the association with the object.

Just as a reminder this is the life of events: Events are added to the scriptable object timeline. At the appropriate time they are fired, I mean associated with the object (aka added to a specific event collection). Then they remain associated with the object until some code removes them from there!

Parameters:
name 
Returns:

Implements DXGfxLib.IAmScriptable.

Definition at line 663 of file SceneObject.cs.

Event [] DXGfxLib.SceneObject.popEventsByName ( string  name  ) 

Return an Array with all fired events currently associated with the scriptable object and removes the association with the object.

Just as a reminder this is the life of events: Events are added to the scriptable object timeline. At the appropriate time they are fired, I mean associated with the object (aka added to a specific event collection). Then they remain associated with the object until some code removes them from there!

Parameters:
name 
Returns:

Implements DXGfxLib.IAmScriptable.

Definition at line 663 of file SceneObject.cs.

Event [] DXGfxLib.SceneObject.popEventsByType ( string  type  ) 

Return an Array with all fired events currently associated with the scriptable object and removes the association with the object.

Just as a reminder this is the life of events: Events are added to the scriptable object timeline. At the appropriate time they are fired, I mean associated with the object (aka added to a specific event collection). Then they remain associated with the object until some code removes them from there!

Parameters:
type 
Returns:

Implements DXGfxLib.IAmScriptable.

Definition at line 690 of file SceneObject.cs.

Event [] DXGfxLib.SceneObject.popEventsByType ( string  type  ) 

Return an Array with all fired events currently associated with the scriptable object and removes the association with the object.

Just as a reminder this is the life of events: Events are added to the scriptable object timeline. At the appropriate time they are fired, I mean associated with the object (aka added to a specific event collection). Then they remain associated with the object until some code removes them from there!

Parameters:
type 
Returns:

Implements DXGfxLib.IAmScriptable.

Definition at line 690 of file SceneObject.cs.

void DXGfxLib.SceneObject.RemoveEvent ( Event  evt  ) 

This method is the pendant of the RemoveEvent.

Parameters:
evt 

Implements DXGfxLib.IAmScriptable.

Definition at line 602 of file SceneObject.cs.

void DXGfxLib.SceneObject.RemoveEvent ( Event  evt  ) 

This method is the pendant of the RemoveEvent.

Parameters:
evt 

Implements DXGfxLib.IAmScriptable.

Definition at line 602 of file SceneObject.cs.

void DXGfxLib.SceneObject.Reset (  ) 

Scripts and timeline have reset methods. They will be called when the simulation is reseted (stoped and restarted from the beginning).

Implements DXGfxLib.IAmScriptable.

Definition at line 569 of file SceneObject.cs.

Here is the call graph for this function:

void DXGfxLib.SceneObject.Reset (  ) 

Scripts and timeline have reset methods. They will be called when the simulation is reseted (stoped and restarted from the beginning).

Implements DXGfxLib.IAmScriptable.

Definition at line 569 of file SceneObject.cs.

Here is the call graph for this function:

virtual void DXGfxLib.SceneObject.SetEffectsValues ( Device  d3ddevice,
Effect  eff,
int  pass 
) [virtual]

Classes that want to draw on screen might need to set some values for the effect used to draw them. That is the purpose of this method. Technically this could be done in Draw but I prefered to have to separated methods.

Parameters:
d3ddevice 
eff 
pass 

Implements DXGfxLib.IDrawable.

Reimplemented in DXGfxLib.TerrainTile, and DXGfxLib.TerrainTile.

Definition at line 294 of file SceneObject.cs.

virtual void DXGfxLib.SceneObject.SetEffectsValues ( Device  d3ddevice,
Effect  eff,
int  pass 
) [virtual]

Classes that want to draw on screen might need to set some values for the effect used to draw them. That is the purpose of this method. Technically this could be done in Draw but I prefered to have to separated methods.

Parameters:
d3ddevice 
eff 
pass 

Implements DXGfxLib.IDrawable.

Reimplemented in DXGfxLib.TerrainTile, and DXGfxLib.TerrainTile.

Definition at line 294 of file SceneObject.cs.

void DXGfxLib.SceneObject.SetScript ( Script  script  ) 

THis method will use the Script instance passed as parameter and will set as the Script associated with this scene node.

Parameters:
script 

Implements DXGfxLib.IAmScriptable.

Definition at line 480 of file SceneObject.cs.

Here is the call graph for this function:

void DXGfxLib.SceneObject.SetScript ( Script  script  ) 

THis method will use the Script instance passed as parameter and will set as the Script associated with this scene node.

Parameters:
script 

Implements DXGfxLib.IAmScriptable.

Definition at line 480 of file SceneObject.cs.

Here is the call graph for this function:

Here is the caller graph for this function:

void DXGfxLib.SceneObject.SetTimeLine ( TimeLine  timeLine  ) 

Same as SetScript but for timelines.

Parameters:
timeLine 

Implements DXGfxLib.IAmScriptable.

Definition at line 504 of file SceneObject.cs.

Here is the call graph for this function:

void DXGfxLib.SceneObject.SetTimeLine ( TimeLine  timeLine  ) 

Same as SetScript but for timelines.

Parameters:
timeLine 

Implements DXGfxLib.IAmScriptable.

Definition at line 504 of file SceneObject.cs.

Here is the call graph for this function:

Here is the caller graph for this function:

override void DXGfxLib.SceneObject.Update ( Frustrum  frustrum,
double  appTime,
float  elapsedTime 
) [virtual]

The update method does pretty much what it does for a scene node except that here we also use the local bbox to calculate the bounding box.

Parameters:
frustrum 
appTime 
elapsedTime 

Reimplemented from DXGfxLib.SceneNode.

Reimplemented in DXGfxLib.ArticulatedModel, DXGfxLib.Billboard, DXGfxLib.SkyBox, DXGfxLib.SkyDome, DXGfxLib.Water, DXGfxLib.Water2, DXGfxLib.ArticulatedModel, DXGfxLib.Billboard, DXGfxLib.SkyBox, DXGfxLib.SkyDome, DXGfxLib.Water, and DXGfxLib.Water2.

Definition at line 235 of file SceneObject.cs.

Here is the call graph for this function:

override void DXGfxLib.SceneObject.Update ( Frustrum  frustrum,
double  appTime,
float  elapsedTime 
) [virtual]

The update method does pretty much what it does for a scene node except that here we also use the local bbox to calculate the bounding box.

Parameters:
frustrum 
appTime 
elapsedTime 

Reimplemented from DXGfxLib.SceneNode.

Reimplemented in DXGfxLib.ArticulatedModel, DXGfxLib.Billboard, DXGfxLib.SkyBox, DXGfxLib.SkyDome, DXGfxLib.Water, DXGfxLib.Water2, DXGfxLib.ArticulatedModel, DXGfxLib.Billboard, DXGfxLib.SkyBox, DXGfxLib.SkyDome, DXGfxLib.Water, and DXGfxLib.Water2.

Definition at line 235 of file SceneObject.cs.

Here is the call graph for this function:


Member Data Documentation

Each SceneObject will have an associated effect group containing the effectst that will be used to render it in various situation.

Definition at line 149 of file SceneObject.cs.

bool DXGfxLib.SceneObject::canBeClicked = false [protected]

This boolean indicates if the scene object want to be notified when the user click on it!

Definition at line 84 of file SceneObject.cs.

bool DXGfxLib.SceneObject::checkForCollision = false [protected]

This boolean indicates if this scene object should be taken into account when checking for collisions between scene objects or if it is some sort of ghost that doesn't even want to know that somehting is going through it:).

Definition at line 100 of file SceneObject.cs.

bool DXGfxLib.SceneObject::drawBoundingBox = false [protected]

Should be set to true is we want to draw the bounding box!

Definition at line 70 of file SceneObject.cs.

In case we want to draw the bouding box this will be useful.

Definition at line 65 of file SceneObject.cs.

Each scene object now keep tracks of the fileName from which it has been built. This is important mostly when the library is used in conjunction with the editor. It does ease a lot of things.

Definition at line 137 of file SceneObject.cs.

bool DXGfxLib.SceneObject::hide = false [protected]

A boolean which allow use to specific if the SceneObject should be displayed or not.

Definition at line 164 of file SceneObject.cs.

Matrix DXGfxLib.SceneObject::lastValidWorldMat = Matrix.Identity [protected]

We need to always have a valid position, so we keep the last known valid position here.

Definition at line 406 of file SceneObject.cs.

A scene Object is a scene node with geometric information associated to it. Scene object should be able to know what is bounding box is in its local coordinate system. That information is going to be used in the update phase to calculate the bounding box in world coordinate system and then to determine whether or not this scene object need to be rendered or not.

Definition at line 182 of file SceneObject.cs.

bool DXGfxLib.SceneObject::solid = false [protected]

This boolean indicates if the base scene object code should automatically take care of not having this scene object interpenatre another one. If true this clearly indicates that this is a solid object. In both situations as soon as checkForCollision is true, the object will be notified of the collision! If checkForCollision is false there is no use setting this to true as the collision situation won't even be detected.

Definition at line 119 of file SceneObject.cs.

Each scene node also has a timeline attached to it. This is where we keep a ref to the instance of the Timeline class associated with this node.

Definition at line 474 of file SceneObject.cs.


Property Documentation

EffectGroup DXGfxLib.SceneObject::AssociatedEffectGroup [get, set]

Associated effect group accessor.

Implements DXGfxLib.IDrawable.

Definition at line 156 of file SceneObject.cs.

bool DXGfxLib.SceneObject::CanBeClicked [get, set]

This boolean indicates if the scene object want to be notified when the user click on it!

Definition at line 90 of file SceneObject.cs.

bool DXGfxLib.SceneObject::CheckForCollision [get, set]

This boolean indicates if this scene object should be taken into account when checking for collisions between scene objects or if it is some sort of ghost that doesn't even want to know that somehting is going through it:).

Definition at line 108 of file SceneObject.cs.

bool DXGfxLib.SceneObject::DrawBoundingBox [get, set]

Accessors to state whether you want to display bounding box or not!

Definition at line 76 of file SceneObject.cs.

bool DXGfxLib.SceneObject::HasBeenClicked [get, set]

Accessor for cliked bolean. It is useful to access it through an accessor so if in the future we want to trigger some custom action from here it will be possible.

Definition at line 44 of file SceneObject.cs.

bool DXGfxLib.SceneObject::Hide [get, set]

Accessor for hide boolean. When true the scene object won't be rendered.

Implements DXGfxLib.IDrawable.

Definition at line 170 of file SceneObject.cs.

string DXGfxLib.SceneObject::Name [get]

We need a name to be able to identity the script and quite a lot of things.

Implements DXGfxLib.IAmScriptable.

Definition at line 141 of file SceneObject.cs.

bool DXGfxLib.SceneObject::Solid [get, set]

This boolean indicates if the base scene object code should automatically take care of not having this scene object interpenatre another one. If true this clearly indicates that this is a solid object. In both situations as soon as checkForCollision is true, the object will be notified of the collision! If checkForCollision is false there is no use setting this to true as the collision situation won't even be detected.

Definition at line 128 of file SceneObject.cs.


The documentation for this class was generated from the following files:

Generated on Thu Jan 8 20:49:34 2009 for DXGfx by  doxygen 1.5.8