#include <TeObject.h>
Inheritance diagram for TeObject:
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 | |
TeEngine * | engine |
SbBool | initialized |
SbVec2f | patchPosUnder |
TePatch::Direction | posInsidePatch |
SoSeparator * | root |
SoTranslation * | translation |
SoRotation * | rotation |
SbVec3f | camDistance |
SoNode * | model |
SoNode * | collisionModel |
Friends | |
class | TeEngine |
|
Enumeration of model types.
|
|
Default constructor. Sets TeObject::initialized to FALSE, and zeroes TeObject::position and TeObject::speed. |
|
Destructor. Releases internal scene and removes self from engine's object list. |
|
Creates internal hidden scene that represents the object.
|
|
Creates HUD scene graph in engine's HUDRoot.
Reimplemented in TeEngineExplorer. |
|
Private attribute accessor.
|
|
Private attribute accessor.
|
|
Private attribute accessor.
|
|
Private attribute accessor.
|
|
Handles the user interaction. This method is almost empty in this base class. It only provides chance to quit the application.
Reimplemented in TeEngineExplorer. |
|
Destroys internal hidden scene that represents the object.
|
|
Sets selected model attribude.
|
|
Sets selected model attribude.
|
|
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.
|
|
Updates camera position. The camera is positioned at the object's coordinates. |
|
Updates the HUD scene graph. This method is empty in this base class, because HUD is static. Reimplemented in TeEngineExplorer. |
|
Positon of the camera relatively to the object's position.
|
|
Internal scene that represents object model for collision detection.
|
|
Connection to the engine class. Connection is established by the engine when adding the object into it.
|
|
Set to TRUE when touched by the engine for the first time.
|
|
Internal scene that represents object model for rendering.
|
|
Coordinates of the patch right under the object.
|
|
Position relative to the patch borders.
|
|
Current object position in 3D space.
|
|
Root of the internal scene.
|
|
Rotation of the render-model.
|
|
Current object speed vector.
|
|
Translation of the render-model.
|