eng::World Class Reference

World class defines a demand-loaded volumetric hiearchy of Objects. More...

#include <eng_world.hh>

Inheritance diagram for eng::World:

mod_sim::SimWorld

List of all members.

Public Member Functions

virtual
FN_MAIN_THREAD void 
Make (void)=0
virtual FN_REENTRANT bool IfMade (void)=0
 ultimately determined by derived World
FN_REENTRANT eAttached Attach (SharedPtr< Object > object)
FN_REENTRANT eAttached Detach (SharedPtr< Object > object)
FN_REENTRANT WorldVertex CorrectPosition (const WorldVertex &pos)
FN_MAIN_THREAD void Draw (void)
FN_REENTRANT void EyePositionChanged (void)
FN_REENTRANT uint GetObjectCnt (void)
FN_REENTRANT const
BoxVolume
GetBoxVolume (void)
FN_REENTRANT fp GetLatWidth (void)
FN_REENTRANT fp GetLonWidth (void)
FN_REENTRANT fp GetAltWidth (void)
FN_REENTRANT WorldVertex GetCenter (void)
FN_REENTRANT fp GetLocusEdge (uint dim)
FN_LOCKED uint GetLocusObjectCnt (void)
FN_REENTRANT fp GetQuadrantEdge (void)
FN_REENTRANT uint GetQuadrantDim (uint dim)
void Check (void)

Protected Types

enum  eSim { eSim_FLIGHT, eSim_SPACE }
enum  eOutsidePolicy { eOutsidePolicy_CLAMP, eOutsidePolicy_WRAP }
typedef uint Qidx
 flat index to World::mQuadrants[]

Protected Member Functions

 World (void)
virtual ~World ()
void Make (const eSim sim, const Int3 &quadrantDim, const fp quadrantEdge, const Int3 &locusDim)
virtual FN_LOCKED void Populate (SafePtr< World::Quadrant > quadrant)=0
FN_LOCKED SafePtr
< World::Quadrant
GetQuadrant (const Int3 &triplet)
FN_REENTRANT SafePtr
< World::Quadrant
GetQuadrant (const WorldVertex &pos)
FN_REENTRANT Qidx GetQuadrantIdx (const Int3 &triplet)
FN_REENTRANT Qidx GetQuadrantIdx (const WorldVertex &pos)
FN_REENTRANT Int3 GetQuadrantTriplet (const WorldVertex &pos)
FN_REENTRANT Int3 WrapQuadrantTriplet (const Int3 &triplet)
FN_MAIN_THREAD void DeleteQuadrant (SafePtr< World::Quadrant > quadrant)
FN_REENTRANT WorldVertex CorrectPositionClamp (const WorldVertex &pos)
FN_REENTRANT WorldVertex CorrectPositionWrap (const WorldVertex &pos)

Protected Attributes

SlowLock mLock
eSim mSim
 flight sim or space sim
eOutsidePolicy mOutsidePolicy
 what to do if a vertex/position is outside World
BoxVolume mBoxVolume
 proof that space is finite
fp mQuadrantEdge
 size of edge in world space
Int3 mQuadrantDim
 dimension of World in terms of Quadrants
Int3 mLocusDim
 dimension of Locus in terms of 3D Quadrants
vector< QuadrantSeedmQuadrants
 box subdivisions of the World
Locus mLocus
 set of Quadrants around the viewpoint/eye
fp mMargin
 margin (world coord) at edge of World

Friends

class Locus
class Quadrant
void ThreadQuadrantPopulate (long quadrant)

Classes

class  Locus
 The Locus is a subset of Quadrants that are populated. More...
class  Quadrant
 A Quadrant is a subdivision of the World. More...
struct  QuadrantSeed


Detailed Description

World class defines a demand-loaded volumetric hiearchy of Objects.

World conceals its organization (Quadrant is kept hidden). This World base class contains and manages Objects, but defers populating the World to a module. Origin is at (0,0,0).


Member Typedef Documentation

typedef uint eng::World::Qidx [protected]

flat index to World::mQuadrants[]


Member Enumeration Documentation

enum eng::World::eSim [protected]

Enumerator:
eSim_FLIGHT 
eSim_SPACE 

enum eng::World::eOutsidePolicy [protected]

Enumerator:
eOutsidePolicy_CLAMP 
eOutsidePolicy_WRAP 


Constructor & Destructor Documentation

eng::World::World ( void   )  [inline, protected]

virtual eng::World::~World (  )  [inline, protected, virtual]


Member Function Documentation

virtual FN_MAIN_THREAD void eng::World::Make ( void   )  [pure virtual]

Implemented in mod_sim::SimWorld.

virtual FN_REENTRANT bool eng::World::IfMade ( void   )  [pure virtual]

ultimately determined by derived World

Implemented in mod_sim::SimWorld.

FN_REENTRANT eAttached eng::World::Attach ( SharedPtr< Object object  ) 

FN_REENTRANT eAttached eng::World::Detach ( SharedPtr< Object object  ) 

FN_REENTRANT WorldVertex eng::World::CorrectPosition ( const WorldVertex &  pos  ) 

void eng::World::Draw ( void   ) 

Facade to Locus::Draw(). See Engine::Draw().

void eng::World::EyePositionChanged ( void   ) 

Eye notifies World when Eye's position changes. Update Locus if Eye moved over another Quadrant.

uint eng::World::GetObjectCnt ( void   ) 

Returns:
Total count of Objects in World.

FN_REENTRANT const BoxVolume& eng::World::GetBoxVolume ( void   )  [inline]

FN_REENTRANT fp eng::World::GetLatWidth ( void   )  [inline]

FN_REENTRANT fp eng::World::GetLonWidth ( void   )  [inline]

FN_REENTRANT fp eng::World::GetAltWidth ( void   )  [inline]

WorldVertex eng::World::GetCenter ( void   ) 

Returns:
Center of World.

Reimplemented in mod_sim::SimWorld.

fp eng::World::GetLocusEdge ( uint  dim  ) 

Returns:
The size (world coord) of an edge of the Locus.

uint eng::World::GetLocusObjectCnt ( void   ) 

Returns:
Total count of Objects in Locus.

FN_REENTRANT fp eng::World::GetQuadrantEdge ( void   )  [inline]

FN_REENTRANT uint eng::World::GetQuadrantDim ( uint  dim  )  [inline]

void eng::World::Check ( void   ) 

Check that World is initialized.

void eng::World::Make ( const eSim  sim,
const Int3 quadrantDim,
const fp  quadrantEdge,
const Int3 locusDim 
) [protected]

Make the simulated world as a set of Quadrants. Quadrants are composed with axis-aligned BSP trees.

Parameters:
sim Type of simulation (flight sim).
quadrantDim Dimensions of the World in terms of 3D Quadrants.
quadrantEdge Width of any edge of a Quadrant (each edge is the same width).
locusDim Dimensions of the Locus in terms of 3D Quadrants. Should be smaller than quadrantDim.

virtual FN_LOCKED void eng::World::Populate ( SafePtr< World::Quadrant quadrant  )  [protected, pure virtual]

SafePtr< World::Quadrant > eng::World::GetQuadrant ( const Int3 triplet_  )  [protected]

Returns:
Quadrant by its 3D index.

FN_REENTRANT SafePtr<World::Quadrant> eng::World::GetQuadrant ( const WorldVertex &  pos  )  [protected]

World::Qidx eng::World::GetQuadrantIdx ( const Int3 triplet_  )  [protected]

Returns:
Convert [x,y,z] to a flat index in mQuadrants[]. Can tolerate a negative or out-of-range triplet.

FN_REENTRANT Qidx eng::World::GetQuadrantIdx ( const WorldVertex &  pos  )  [protected]

FN_REENTRANT Int3 eng::World::GetQuadrantTriplet ( const WorldVertex &  pos  )  [protected]

Int3 eng::World::WrapQuadrantTriplet ( const Int3 triplet  )  [protected]

If necessary, wrap a Quadrant's triplet [x,y,z] to stay inside the world.

FN_MAIN_THREAD void eng::World::DeleteQuadrant ( SafePtr< World::Quadrant quadrant  )  [protected]

FN_REENTRANT WorldVertex eng::World::CorrectPositionClamp ( const WorldVertex &  pos  )  [protected]

FN_REENTRANT WorldVertex eng::World::CorrectPositionWrap ( const WorldVertex &  pos  )  [protected]


Friends And Related Function Documentation

friend class Locus [friend]

Reimplemented in mod_sim::SimWorld.

friend class Quadrant [friend]

Reimplemented in mod_sim::SimWorld.

void ThreadQuadrantPopulate ( long  quadrant  )  [friend]


Member Data Documentation

SlowLock eng::World::mLock [protected]

eSim eng::World::mSim [protected]

flight sim or space sim

eOutsidePolicy eng::World::mOutsidePolicy [protected]

what to do if a vertex/position is outside World

BoxVolume eng::World::mBoxVolume [protected]

proof that space is finite

fp eng::World::mQuadrantEdge [protected]

size of edge in world space

Int3 eng::World::mQuadrantDim [protected]

dimension of World in terms of Quadrants

Int3 eng::World::mLocusDim [protected]

dimension of Locus in terms of 3D Quadrants

vector<QuadrantSeed> eng::World::mQuadrants [protected]

box subdivisions of the World

Locus eng::World::mLocus [protected]

set of Quadrants around the viewpoint/eye

fp eng::World::mMargin [protected]

margin (world coord) at edge of World


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:25 2007