GraphicalObject Class Reference

Describes an object of a scene. More...

#include <GraphicalObject.h>

Inheritance diagram for GraphicalObject:

DLODObject GroupObject TerminalObject List of all members.

Public Member Functions

 GraphicalObject (RawObject *raw_object)
 ~GraphicalObject ()
virtual void Draw (int time, Camera *camera, Camera *monitor, bool show_bounding_volume, int culling_mode, bool level_of_detail)
void CalculateRelativePositions ()
void ApplyTransformation (const Position &position, bool rotation)
void UndoTransformation (const Position &position, bool rotation)
virtual void PrintToConsole ()
void UpdateBoundingRadius (bool recurse)
void UpdateBoundingBox (bool recurse)

Public Attributes

PositionPathposition
double bounding_radius
BoundingBox bounding_box

Protected Types

typedef GraphicalObject::ChildListElem ChildList

Protected Member Functions

int CullObject (Camera *camera, Camera *monitor, int culling_mode, bool show_volume)
virtual void ComputeBoundingRadius ()
virtual void ComputeBoundingBox ()

Protected Attributes

ChildListfirst_child
RawObjectraw_object

Private Member Functions

 GraphicalObject ()
void UpdateBoxCorners ()
int SphereCulling (Camera *camera, Camera *monitor)
int SphereCulling2 (Camera *camera)
int BoxCulling (Camera *camera, Camera *monitor)
int BoxCulling2 (Camera *camera)
void DrawBoundingSphere (int culling_result)
void DrawBoundingBox (int culling_result)

Private Attributes

BoxCorners box_corners
int last_outside

Classes

struct  ChildListElem

Detailed Description

Describes an object of a scene.

This is the basis of all the objects which are rendered within a scene. A graphical object is very similar to a node in a scene graph, with the difference that it does not provide any information about color, texture and other attributes that describe the appearance of an object. It does, however, provide a position (that may vary over time) which determines the local coordinate system spawned by this object.

A graphical object may contain any number of child objects, be associated with a RawObject (which is responsible for the appearance), provides some functionality to apply/unapply its local coordinate system to the current OpenGL matrix and to allow view frustum culling against a camera.

Definition at line 34 of file GraphicalObject.h.


Member Typedef Documentation

typedef struct GraphicalObject::ChildListElem GraphicalObject::ChildList [protected]
 

Structure holding all the children of this graphical object.


Constructor & Destructor Documentation

GraphicalObject::GraphicalObject RawObject raw_object  ) 
 

Constructor: Brings the graphical object into a consistent state and associates an object with it.

Parameters:
raw_object The object with which the graphcial object shall be associated.

Definition at line 5 of file GraphicalObject.cpp.

GraphicalObject::~GraphicalObject  ) 
 

Destructor.

Definition at line 40 of file GraphicalObject.cpp.

GraphicalObject::GraphicalObject  )  [private]
 

Hide the default constructor.


Member Function Documentation

void GraphicalObject::ApplyTransformation const Position position,
bool  rotation
 

Appies the transformation described by an arbitrary position to the current matrix in OpenGL.

Parameters:
position Position which shall be applied to the current matrix in OpenGL.
rotation Flag indicating wheather it is necessary to apply rotation or not.

Definition at line 45 of file GraphicalObject.cpp.

int GraphicalObject::BoxCulling Camera camera,
Camera monitor
[private]
 

Performs a view frustum culling test with the bounding box of this object (uses global coordinates to cull), applied during monitoring mode.

Parameters:
camera The camera capturing the scene.
monitor The camera monitoring the scene.

Definition at line 441 of file GraphicalObject.cpp.

int GraphicalObject::BoxCulling2 Camera camera  )  [private]
 

Performs a view frustum culling test with the bounding box of this object (uses coordinate system right before the projection takes place), applied when not in monitoring mode.

Parameters:
camera The camera capturing the scene.

Definition at line 535 of file GraphicalObject.cpp.

void GraphicalObject::CalculateRelativePositions  ) 
 

A utility routine that levels out the difference between the own position and the positions of all the children of this object. The new position is set to the average of all child positions and the child positions are updated in such a way that no change can be noticed. Note that this routine will create the expected result only if the children of this object are not interleaved with themselves or other objects (which means that the whole structure below this object has to be a tree).

Definition at line 303 of file GraphicalObject.cpp.

virtual void GraphicalObject::ComputeBoundingBox  )  [protected, virtual]
 

Routine to compute the bounding box of the graphical object. Has to be implemented by the descendants of this class.

Reimplemented in DLODObject, GroupObject, and TerminalObject.

virtual void GraphicalObject::ComputeBoundingRadius  )  [protected, virtual]
 

Routine to compute the bounding sphere of the graphical object. Has to be implemented by the descendants of this class.

Reimplemented in DLODObject, GroupObject, and TerminalObject.

int GraphicalObject::CullObject Camera camera,
Camera monitor,
int  culling_mode,
bool  show_volume
[protected]
 

Returns the result of the view frustum culling test depending on culling mode. Furthermore, this routine may visualize the bounding volume.

Parameters:
camera Camera which shall be used for the view frustum culling test.
monitor Camera which is used to monitor the scene during monitoring mode.
culling_mode Mode of the view frustum culling (C_NONE, C_BOUNDING_BOX, C_SPHERE or C_MIXED).
show_volume Flag indicating whether the bounding volume shall be visualized or not.

Definition at line 236 of file GraphicalObject.cpp.

virtual void GraphicalObject::Draw int  time,
Camera camera,
Camera monitor,
bool  show_bounding_volume,
int  culling_mode,
bool  level_of_detail
[virtual]
 

The way a graphical object is being drawn has to be implemented by the different types of objects that inherit from this class.

Parameters:
time Time at which the object shall be drawn.
camera Camera which captures the object.
monitor Camera which monitors the whole scene, is equal to NULL if we are not in monitoring mode.
show_bounding_volume States if the bounding volume used for the view frustum culling shall be drawn.
culling_mode Determines the mode used for the view frustum culling (C_NONE, C_BOUNDING_BOX, C_SPHERE or C_MIXED).
level_of_detail States wheather level of detail is enabled or not.

Reimplemented in DLODObject, GroupObject, and TerminalObject.

void GraphicalObject::DrawBoundingBox int  culling_result  )  [private]
 

Draws the bounding box around the graphical object.

Parameters:
culling_result The result of the view frustum culling test determines the color used for drawing the bounding box.

Definition at line 224 of file GraphicalObject.cpp.

void GraphicalObject::DrawBoundingSphere int  culling_result  )  [private]
 

Draws the bounding sphere around the graphcical object.

Parameters:
culling_result The result of the view frustum culling test determines the color used for drawing the sphere.

Definition at line 212 of file GraphicalObject.cpp.

virtual void GraphicalObject::PrintToConsole  )  [virtual]
 

Prints information about the object to the console. Has to be implemented by all descendants.

Reimplemented in DLODObject, GroupObject, and TerminalObject.

int GraphicalObject::SphereCulling Camera camera,
Camera monitor
[private]
 

Performs a view frustum culling test with a sphere (uses global coordinates to cull), applied during monitoring mode.

Parameters:
camera The camera capturing the scene.
monitor The camera monitoring the scene.

Definition at line 352 of file GraphicalObject.cpp.

int GraphicalObject::SphereCulling2 Camera camera  )  [private]
 

Performs a view frustum culling test with a sphere (uses coordinate system right before the projection takes place), applied when not in monitoring mode.

Parameters:
camera The camera capturing the scene.

Definition at line 411 of file GraphicalObject.cpp.

void GraphicalObject::UndoTransformation const Position position,
bool  rotation
 

Undoes the transformation described by an arbitrary position on the current matrix in OpenGL.

Parameters:
position Position which shall be undone.
rotation Flag indicating wheather it is necessary to undo the rotation or not.

Definition at line 58 of file GraphicalObject.cpp.

void GraphicalObject::UpdateBoundingBox bool  recurse  ) 
 

routine that updates the bounding box of this graphical object according to the RawObject associated with this graphical object and the position as well as the movement of the children. The object itself and all its children will always be inside the newly calculated bounding box at every point in time. If the local coordinate systems of the children contain dynamic rotation, a conservative guess about the size of the new bounding box is being made. If the local coordinate systems of the chidren contain rotation that stays constant over time, the exact bounding box is being calculated.

Parameters:
recurse States wheather this routine shall be applied to its children recursifely or not.

Definition at line 117 of file GraphicalObject.cpp.

void GraphicalObject::UpdateBoundingRadius bool  recurse  ) 
 

Routine that updates the bounding radius of this graphical object according to the RawObject associated with this graphical object and the position as well as the movement of the children. The object itself and all its children will always be inside the sphere defined by the newly created bounding radius at every point in time.

Definition at line 70 of file GraphicalObject.cpp.

void GraphicalObject::UpdateBoxCorners  )  [private]
 

Calculates the corners of the bounding box.

Definition at line 293 of file GraphicalObject.cpp.


Member Data Documentation

BoundingBox GraphicalObject::bounding_box
 

The bounding box around this graphical object. Used for the view frustum culling.

Definition at line 135 of file GraphicalObject.h.

double GraphicalObject::bounding_radius
 

The radius of the bounding sphere around this graphical object. Used for the view frustum culling.

Definition at line 132 of file GraphicalObject.h.

BoxCorners GraphicalObject::box_corners [private]
 

Corners of the bounding box. Only valid after 'UpdateBoxCorners ()' has been called.

Definition at line 183 of file GraphicalObject.h.

ChildList* GraphicalObject::first_child [protected]
 

Pointer to the first child of this graphical object.

Definition at line 115 of file GraphicalObject.h.

int GraphicalObject::last_outside [private]
 

Index of the plane where the object was rejected as being outside at the last time.

Definition at line 186 of file GraphicalObject.h.

PositionPath* GraphicalObject::position
 

The path of this object over time.

Definition at line 71 of file GraphicalObject.h.

RawObject* GraphicalObject::raw_object [protected]
 

The RawObject that is associated to this graphical object

Definition at line 118 of file GraphicalObject.h.


Generated on Sun Jul 2 13:20:40 2006 for Demo by  doxygen 1.4.6-NO