eng::Engine Class Reference

Engine interface. More...

#include <eng_class.hh>

List of all members.

Public Types

enum  eDrawMode { eDrawMode_NORMAL, eDrawMode_FAST }

Public Member Functions

 Engine (void)
 ~Engine ()
void Init (int argc, char **argv, const string &programName)
void Start (void)
bool IfReady (void)
void SpawnZombie (SharedPtr< Object > obj)
bool IfDrawing (void)
void SetDrawMode (const eDrawMode drawMode)
eDrawMode GetDrawMode (void)
bool IfDrawModeFast (void)
uint GetFPS (void)
GFX::ePolygonMode GetPolygonMode (void)
void SetPolygonMode (const GFX::ePolygonMode polygonMode)
void SetDrawNormalVectors (bool f, fp scale)
bool IfDrawNormalVectors (void)
void SetView (SharedPtr< View > view)
shptr< ViewGetView (void)
SharedPtr< ViewGetMainView (void)
void AddView (SharedPtr< View > view, int viewNum)
void WindowReshape (WidthHeight< int > wh)
bool IfVisibleWorldBoxVolume (const BoxVolume &worldBoxVolume)
 
Returns:
True if a box volume in world space is visible (freq).

SharedPtr< const Matrix > GetEyeMatrix (void)
void SetEyeMatrix (const Matrix &matrix)
WorldVertex GetEyePosition (void)
void SetEyePosition (const WorldVertex &pos)
void EnableCollisionDetection (bool f)
bool IfCollisionDetection (void)
void LoadTextureFromFile (const string &filename, const string &pathname)
void SetTextureDirs (const vector< string > &textureDirs)
SharedPtr< Texture > GetTexture (const string &textureName)
SharedPtr< TextureGetTexture (const char *textureName)
TargaFilterFuncType GetTextureFilterFunc (void)
void SetTextureFilterFunc (TargaFilterFuncType filterFunc)
void PrintException (const Exception &exception, const string &functionName)
string GetCurrentObjectName (void)
void SetCurrentObjectName (const string &name)

Public Attributes

Events mEvents
DrawStats mDrawStats
UserLod mUserLod
EngineStats mStats
CLASS_VAR SlowLock mLock
 guards Engine integrity

Private Types

typedef multimap
< int, shptr< View > > 
Views
typedef map< string,
SharedPtr< Texture > > 
TextureMap
typedef vector
< shptr< Object > > 
Zombies
 a list would allocate too much

Private Member Functions

void InitPreCmdarg (void)
void InitCmdarg (int argc, char **argv)
void InitPostCmdarg (void)
void SelfCheck (void)
CLASS_METHOD void AtExit (void)
void KillZombies (void)
void Draw (void)
void InitTextures (void)
void InitTexturesTgaFiles (const string &dirName)
void ReadTextureConf (const string &dirName)

Private Attributes

bool mReady
bool mDrawing
 if busy rendering
eDrawMode mDrawMode
 speed vs. quality/memory
bool mDrawNormalVectors
Views mViews
SharedPtr< ViewmCurrentView
bool mCollisionDetection
 true if collision-detection enabled
TextureMap mTextureMap
vector< string > mTextureDirs
 events broadcast to assign this
TargaFilterFuncType mTextureFilterFunc
string mCurrentObjectName
 Object being drawn.
Zombies mZombies

Friends

class ListenerTick
class ListenerDisplay
ostream & operator<< (ostream &strm, const EngineStats &o)

Classes

struct  DrawStats
struct  ListenerDisplay
struct  ListenerTick
struct  ListenerWindow
class  TextureConfReader


Detailed Description

Engine interface.

Initializing and starting libraries are separate actions.

Pay attention to the order of declaring members.


Member Typedef Documentation

typedef multimap<int,shptr<View> > eng::Engine::Views [private]

typedef map<string,SharedPtr<Texture> > eng::Engine::TextureMap [private]

typedef vector< shptr<Object> > eng::Engine::Zombies [private]

a list would allocate too much


Member Enumeration Documentation

enum eng::Engine::eDrawMode

Enumerator:
eDrawMode_NORMAL 
eDrawMode_FAST 


Constructor & Destructor Documentation

eng::Engine::Engine ( void   ) 

Engine initialization.

eng::Engine::~Engine (  ) 


Member Function Documentation

void eng::Engine::Init ( int  argc,
char **  argv,
const string &  programName 
)

void eng::Engine::Start ( void   ) 

Start the engine. Doesn't enter the gfxsys loop.

bool eng::Engine::IfReady ( void   )  [inline]

void eng::Engine::SpawnZombie ( SharedPtr< Object obj  ) 

void eng::Engine::InitPreCmdarg ( void   )  [private]

Initialization (before cmd-line args).

void eng::Engine::InitCmdarg ( int  argc,
char **  argv 
) [private]

Process command-line args.

void eng::Engine::InitPostCmdarg ( void   )  [private]

Initialization (after cmd-line args).

void eng::Engine::SelfCheck ( void   )  [private]

Self-check, verify assumptions.

void eng::Engine::AtExit ( void   )  [private]

AtExit() is registered by libc atexit(). The reason is to ensure that Engine::Exit() is called during exit which is necessary to properly cleanup and exit. On some platforms (Mac), if the program is stopped by the OS GUI, glutMainLoop() will directly call exit() instead of breaking the GLUT event loop.

void eng::Engine::KillZombies ( void   )  [private]

Delete zombie Objects by detaching them out of a Quadrant/BSP. SharedPtr will delete Objects that are no longer referenced.

void eng::Engine::Draw ( void   )  [private]

Top-level method to draw all views. Cascade: 1. Event (timer-tick or GFX display/repaint) 2. Engine::Draw() 3. World::Draw() 4. Locus::Draw() 5. BSP::Draw() 6. Object::Draw() 7. VisitorDraw()

bool eng::Engine::IfDrawing ( void   )  [inline]

void eng::Engine::SetDrawMode ( const eDrawMode  drawMode  )  [inline]

eDrawMode eng::Engine::GetDrawMode ( void   )  [inline]

bool eng::Engine::IfDrawModeFast ( void   )  [inline]

uint eng::Engine::GetFPS ( void   ) 

GFX::ePolygonMode eng::Engine::GetPolygonMode ( void   ) 

void eng::Engine::SetPolygonMode ( const GFX::ePolygonMode  polygonMode  ) 

void eng::Engine::SetDrawNormalVectors ( bool  f,
fp  scale 
)

For debugging, draw normal vectors themselves (similar to Blender).

bool eng::Engine::IfDrawNormalVectors ( void   )  [inline]

void eng::Engine::SetView ( SharedPtr< View view  ) 

shptr<View> eng::Engine::GetView ( void   )  [inline]

SharedPtr<View> eng::Engine::GetMainView ( void   )  [inline]

void eng::Engine::AddView ( SharedPtr< View view,
int  viewNum 
)

void eng::Engine::WindowReshape ( WidthHeight< int >  wh  ) 

bool eng::Engine::IfVisibleWorldBoxVolume ( const BoxVolume worldBoxVolume  )  [inline]

Returns:
True if a box volume in world space is visible (freq).

SharedPtr<const Matrix> eng::Engine::GetEyeMatrix ( void   )  [inline]

void eng::Engine::SetEyeMatrix ( const Matrix &  matrix  )  [inline]

WorldVertex eng::Engine::GetEyePosition ( void   )  [inline]

void eng::Engine::SetEyePosition ( const WorldVertex &  pos  )  [inline]

void eng::Engine::EnableCollisionDetection ( bool  f  )  [inline]

bool eng::Engine::IfCollisionDetection ( void   )  [inline]

void eng::Engine::LoadTextureFromFile ( const string &  filename,
const string &  pathname 
)

Construct a Texture object from a file. Clients of Engine can call this but texture configuration (texture.conf) won't apply.

void eng::Engine::InitTextures ( void   )  [private]

Initialize texture objects (even if disabled by cmd-line).

void eng::Engine::InitTexturesTgaFiles ( const string &  dirName  )  [private]

void eng::Engine::SetTextureDirs ( const vector< string > &  textureDirs  )  [inline]

SharedPtr<Texture> eng::Engine::GetTexture ( const string &  textureName  )  [inline]

SharedPtr< Texture > eng::Engine::GetTexture ( const char *  textureName  ) 

Get Texture objects mapped by texture's name (its filename minus suffix).

TargaFilterFuncType eng::Engine::GetTextureFilterFunc ( void   )  [inline]

void eng::Engine::SetTextureFilterFunc ( TargaFilterFuncType  filterFunc  )  [inline]

void eng::Engine::ReadTextureConf ( const string &  dirName  )  [private]

Read texture configuration file texture.conf.

Its format consists of these lines:

# comment def_min_filter nearest|... def_mag_filter linear|... def_wrap repeat|... def_func modulate|... textureName { setting1 ... } textureName // settings block omitted, default parameters implied

void eng::Engine::PrintException ( const Exception exception,
const string &  functionName 
)

Print exception info.

string eng::Engine::GetCurrentObjectName ( void   )  [inline]

void eng::Engine::SetCurrentObjectName ( const string &  name  )  [inline]


Friends And Related Function Documentation

friend class ListenerTick [friend]

friend class ListenerDisplay [friend]

ostream& operator<< ( ostream &  strm,
const EngineStats o 
) [friend]

operator<<(EngineStats)


Member Data Documentation

bool eng::Engine::mReady [private]

Events eng::Engine::mEvents

bool eng::Engine::mDrawing [private]

if busy rendering

eDrawMode eng::Engine::mDrawMode [private]

speed vs. quality/memory

bool eng::Engine::mDrawNormalVectors [private]

Views eng::Engine::mViews [private]

SharedPtr<View> eng::Engine::mCurrentView [private]

DrawStats eng::Engine::mDrawStats

bool eng::Engine::mCollisionDetection [private]

true if collision-detection enabled

TextureMap eng::Engine::mTextureMap [private]

vector<string> eng::Engine::mTextureDirs [private]

events broadcast to assign this

TargaFilterFuncType eng::Engine::mTextureFilterFunc [private]

UserLod eng::Engine::mUserLod

string eng::Engine::mCurrentObjectName [private]

Object being drawn.

EngineStats eng::Engine::mStats

SlowLock eng::Engine::mLock

guards Engine integrity

Zombies eng::Engine::mZombies [private]


The documentation for this class was generated from the following files: Palomino 3D Engine documents generated by doxygen 1.5.3 on Fri Nov 23 11:26:21 2007