Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages

TeObject Class Reference

#include <TeObject.h>

Inheritance diagram for TeObject:

TeEngineExplorer List of all members.

Detailed Description

Class meant to be a parent to all engine objects.

TeObject itself is suitable for simple AI-controlled or static (it has empty handleEvent() method and provides static HUD [=Heads-Up Display]) objects. This class defines interface for derived classes. They are meant to be used as a representation of differently behaving objects that can move over our landscape and engine has to have access to them.

Creating variety of classes that share the interface is comfort way how to let engine take care of all kinds of objects and also to let objects define completely different behaviour, controls, HUDs, etc. in other hand.

For ensuring the functionality of the engine it is important to correctly define timeTick() and handleEvent() methods in each derived class. In case we want our object to provide HUD, functions called createHUD() and updateHUD() should do that work. The functions should do the things as follows:


Public Types

enum  MODEL_SET { RENDER = 0x01, COLLISION = 0x02, ALL = 0x03 }

Public Member Functions

 TeObject ()
virtual ~TeObject ()
SoSeparator * getSceneGraph ()
SoTranslation * getTranslation ()
SoNode * getModel ()
SoNode * getCollisionModel ()
void setModel (SoNode *model, MODEL_SET which=ALL)
SbBool setModel (const char *filename, MODEL_SET which=ALL)
virtual void handleEvent (const SoEvent *event)

Public Attributes

SbVec3f position
SbVec3f speed

Protected Member Functions

void createHiddenScene ()
void releaseHiddenScene ()
virtual void createHUD ()
virtual void updateHUD ()
virtual void updateCamera ()
virtual void timeTick (const SbTime delta)

Protected Attributes

TeEngineengine
SbBool initialized
SbVec2f patchPosUnder
TePatch::Direction posInsidePatch
SoSeparator * root
SoTranslation * translation
SoRotation * rotation
SbVec3f camDistance
SoNode * model
SoNode * collisionModel

Friends

class TeEngine


Member Enumeration Documentation

enum TeObject::MODEL_SET
 

Enumeration of model types.

Enumeration values:
RENDER  Model for rendering.
COLLISION  Model for collision detection.
ALL  Both purposes.


Constructor & Destructor Documentation

TeObject::TeObject  ) 
 

Default constructor.

Sets TeObject::initialized to FALSE, and zeroes TeObject::position and TeObject::speed.

TeObject::~TeObject  )  [virtual]
 

Destructor.

Releases internal scene and removes self from engine's object list.


Member Function Documentation

void TeObject::createHiddenScene  )  [protected]
 

Creates internal hidden scene that represents the object.

See also:
releaseHiddenScene()

void TeObject::createHUD  )  [protected, virtual]
 

Creates HUD scene graph in engine's HUDRoot.

Reimplemented in TeEngineExplorer.

SoNode * TeObject::getCollisionModel  ) 
 

Private attribute accessor.

Returns:
Model for collision detection.
See also:
collisionModel

SoNode * TeObject::getModel  ) 
 

Private attribute accessor.

Returns:
Model for object rendering.
See also:
model

SoSeparator * TeObject::getSceneGraph  ) 
 

Private attribute accessor.

Returns:
Scene for object model rendering.
See also:
root

SoTranslation * TeObject::getTranslation  ) 
 

Private attribute accessor.

Returns:
Translation node of the internal scene.
See also:
translation

void TeObject::handleEvent const SoEvent *  event  )  [virtual]
 

Handles the user interaction.

This method is almost empty in this base class. It only provides chance to quit the application.

Parameters:
event Event invoked by user interaction.

Reimplemented in TeEngineExplorer.

void TeObject::releaseHiddenScene  )  [protected]
 

Destroys internal hidden scene that represents the object.

See also:
createHiddenScene()

SbBool TeObject::setModel const char *  filename,
MODEL_SET  which = ALL
 

Sets selected model attribude.

Parameters:
filename Name of file that contains the model scene.
which Model selector.
Returns:
TRUE if the file exists and the model was loaded.

void TeObject::setModel SoNode *  model,
MODEL_SET  which = ALL
 

Sets selected model attribude.

Parameters:
model Pointer to the node that contains the model scene.
which Model selector.

void TeObject::timeTick const SbTime  delta  )  [protected, virtual]
 

Time tick function.

It moves the object according to the speed vector and the time elapsed since last call, updates scene camera and calls updateHUD() method.

Parameters:
delta Time elapsed since last call.

void TeObject::updateCamera  )  [protected, virtual]
 

Updates camera position.

The camera is positioned at the object's coordinates.

void TeObject::updateHUD  )  [protected, virtual]
 

Updates the HUD scene graph.

This method is empty in this base class, because HUD is static.

Reimplemented in TeEngineExplorer.


Member Data Documentation

SbVec3f TeObject::camDistance [protected]
 

Positon of the camera relatively to the object's position.

SoNode* TeObject::collisionModel [protected]
 

Internal scene that represents object model for collision detection.

See also:
getModel(), setModel()

TeEngine* TeObject::engine [protected]
 

Connection to the engine class.

Connection is established by the engine when adding the object into it.

See also:
TeEngine::addObject()

SbBool TeObject::initialized [protected]
 

Set to TRUE when touched by the engine for the first time.

SoNode* TeObject::model [protected]
 

Internal scene that represents object model for rendering.

See also:
getModel(), setModel()

SbVec2f TeObject::patchPosUnder [protected]
 

Coordinates of the patch right under the object.

TePatch::Direction TeObject::posInsidePatch [protected]
 

Position relative to the patch borders.

SbVec3f TeObject::position
 

Current object position in 3D space.

SoSeparator* TeObject::root [protected]
 

Root of the internal scene.

See also:
getSceneGraph()

SoRotation* TeObject::rotation [protected]
 

Rotation of the render-model.

SbVec3f TeObject::speed
 

Current object speed vector.

SoTranslation* TeObject::translation [protected]
 

Translation of the render-model.


Generated on Sun May 8 16:45:06 2005 for TerrainEngine by Doxygen 1.4.1