DLODObject Class Reference

An object with different levels of detail. More...

#include <DLODObject.h>

Inheritance diagram for DLODObject:

GraphicalObject List of all members.

Public Member Functions

 DLODObject (RawObject *best_level)
 ~DLODObject ()
void Draw (int time, Camera *camera, Camera *monitor, bool show_bounding_volume, int culling_mode, bool level_of_detail)
void PrintToConsole ()
void AddLevel (RawObject *next_level, float distance)
DLODObjectGetClone ()

Protected Member Functions

void ComputeBoundingRadius ()
void ComputeBoundingBox ()

Private Member Functions

 DLODObject ()

Private Attributes

int num_levels
RawObjectraw_obj [MAX_LEVEL]
float distances [MAX_LEVEL+1]

Static Private Attributes

static const int MAX_LEVEL = 8

Detailed Description

An object with different levels of detail.

This class implements a discrete level of detail object. Several objects that represent different levels of detail may be added to this object along with a distance threshold. Whenever the object is drawn, the appropriate level of detail is chosen by evaluating the distance of the object from the camera.

Definition at line 21 of file DLODObject.h.


Constructor & Destructor Documentation

DLODObject::DLODObject RawObject best_level  ) 
 

Constructor: Brings this object into a consistent state.

Parameters:
best_level The default object with most detail.

Definition at line 3 of file DLODObject.cpp.

DLODObject::~DLODObject  ) 
 

Destructor.

Definition at line 9 of file DLODObject.cpp.

DLODObject::DLODObject  )  [private]
 

Hide the default constructor.


Member Function Documentation

void DLODObject::AddLevel RawObject next_level,
float  distance
 

Adds a new level of detail to this object. The newly added object will be displayed as soon as its distance from the camera is bigger than a certain threshold.

Parameters:
next_level Next level of detail for the object (should be of smaller complexity).
distance The newly added object will be displayed as soon as it is farther away from the camera as this threshold.

Definition at line 82 of file DLODObject.cpp.

void DLODObject::ComputeBoundingBox  )  [protected, virtual]
 

Implementation of the bounding box computation. The bounding box is defined as the bounding box of the object which has been used with the constructor.

Reimplemented from GraphicalObject.

Definition at line 108 of file DLODObject.cpp.

void DLODObject::ComputeBoundingRadius  )  [protected, virtual]
 

Implementation of the bounding sphere computation. The bounding radius is defined as the bounding radius of the object which has been used with the constructor.

Reimplemented from GraphicalObject.

Definition at line 103 of file DLODObject.cpp.

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

Implementation of the draw routine. Chooses the appropriate object to draw depending on the distance between the camera and the origin of this object.

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 from GraphicalObject.

Definition at line 14 of file DLODObject.cpp.

DLODObject * DLODObject::GetClone  ) 
 

Returns a new discrete level of detail object that consists of the exact same objects and distance thresholds.

Returns:
A clone of this object.

Definition at line 93 of file DLODObject.cpp.

void DLODObject::PrintToConsole  )  [virtual]
 

Prints information about the object to the console.

Reimplemented from GraphicalObject.

Definition at line 113 of file DLODObject.cpp.


Member Data Documentation

float DLODObject::distances[MAX_LEVEL+1] [private]
 

Array containing all the distances used to determine the level at which the object shall be drawn.

Definition at line 102 of file DLODObject.h.

const int DLODObject::MAX_LEVEL = 8 [static, private]
 

Maximum number of levels.

Definition at line 93 of file DLODObject.h.

int DLODObject::num_levels [private]
 

The number of different levels that this object has.

Definition at line 96 of file DLODObject.h.

RawObject* DLODObject::raw_obj[MAX_LEVEL] [private]
 

Array containing all the objects of the different levels.

Definition at line 99 of file DLODObject.h.


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