NLPACS::CRetrievableSurface Class Reference

#include <retrievable_surface.h>


Detailed Description

A retrievable surface (inside a local surface retriever). It is composed of the Ids of the chains composing the border of the surface.
Author:
Benjamin Legros

Nevrax France

Date:
2001

Definition at line 68 of file retrievable_surface.h.

Public Types

enum  {
  IsFloorBit = 24, IsSlantBit = 25, IsCeilingBit = 26, IsUnderWaterBit = 27,
  ClusterHintBit = 28, NormalQuantasStartBit = 0, NormalQuantasStopBit = 3, NormalQuantasBitMask = 0x0000000f,
  CharacterQuantasStartBit = 8, CharacterQuantasStopBit = 11, CharacterQuantasBitMask = 0x00000f00, MaterialQuantasStartBit = 16,
  MaterialQuantasStopBit = 23, MaterialQuantasBitMask = 0x00ff0000
}

Public Member Functions

bool clusterHint () const
 CRetrievableSurface ()
const NLMISC::CVectorgetCenter () const
CSurfaceLink getChain (uint n) const
 Gets nth link form this surface to its neighbor.

const std::vector< CSurfaceLink > & getChains () const
 Gets links from this surface to its neighbors through chains...

uint8 getCharacter () const
uint32 getFlags () const
uint8 getLevel () const
const TLoopgetLoop (uint n) const
 Get nth loop.

const std::vector< TLoop > & getLoops () const
 Get loops.

uint8 getMaterial () const
float getMeanHeight () const
uint8 getNormalQuanta () const
uint8 getOrientationQuanta () const
const CSurfaceQuadTreegetQuadTree () const
sint8 getQuantHeight () const
sint32 getTopology (uint model) const
float getWaterHeight () const
bool isCeiling () const
bool isFloor () const
void serial (NLMISC::IStream &f)
 Serialises the CRetrievableSurface.

void translate (const NLMISC::CVector &translation)
 Translates the surface by the translation vector.


Protected Attributes

NLMISC::CVector _Center
 The center of the surface.

std::vector< CSurfaceLink_Chains
 The links to the neighbor surfaces.

uint32 _Flags
 Various flags.

std::vector< TLoop_Loops
 The loops of chains.

CSurfaceQuadTree _Quad
 A Height QuadTree that allows to easily find the height out for a given 2D point. -- deprecated.

sint32 _Topologies [NumMaxCreatureModels]
 The topologies associated with the surface, for each type of model.

float _WaterHeight
Surface features.
uint8 _Character
bool _IsCeiling
bool _IsFloor
uint8 _Level
uint8 _Material
uint8 _NormalQuanta
uint8 _OrientationQuanta
sint8 _QuantHeight

Friends

class CLocalRetriever


Member Enumeration Documentation

anonymous enum
 

Enumeration values:
IsFloorBit 
IsSlantBit 
IsCeilingBit 
IsUnderWaterBit 
ClusterHintBit 
NormalQuantasStartBit 
NormalQuantasStopBit 
NormalQuantasBitMask 
CharacterQuantasStartBit 
CharacterQuantasStopBit 
CharacterQuantasBitMask 
MaterialQuantasStartBit 
MaterialQuantasStopBit 
MaterialQuantasBitMask 

Definition at line 93 of file retrievable_surface.h.

00094         {
00095                 IsFloorBit = 24,
00096                 IsSlantBit = 25,
00097                 IsCeilingBit = 26,
00098                 IsUnderWaterBit = 27,
00099                 ClusterHintBit = 28,
00100                 NormalQuantasStartBit = 0,
00101                 NormalQuantasStopBit = 3,
00102                 NormalQuantasBitMask = 0x0000000f,
00103                 CharacterQuantasStartBit = 8,
00104                 CharacterQuantasStopBit = 11,
00105                 CharacterQuantasBitMask = 0x00000f00,
00106                 MaterialQuantasStartBit = 16,
00107                 MaterialQuantasStopBit = 23,
00108                 MaterialQuantasBitMask = 0x00ff0000
00109         };


Constructor & Destructor Documentation

NLPACS::CRetrievableSurface::CRetrievableSurface  )  [inline]
 

Definition at line 152 of file retrievable_surface.h.

References _QuantHeight, _WaterHeight, NLPACS::NumMaxCreatureModels, and uint.

00153         {
00154                 uint    i;
00155                 for (i=0; i<NumMaxCreatureModels; ++i)
00156                         _Topologies[i] = -1;
00157 
00158                 _WaterHeight = 0.0f;
00159                 _QuantHeight = 0;
00160         }


Member Function Documentation

bool NLPACS::CRetrievableSurface::clusterHint  )  const [inline]
 

Definition at line 169 of file retrievable_surface.h.

References ClusterHintBit.

00169 { return (_Flags & ClusterHintBit) != 0; }

const NLMISC::CVector& NLPACS::CRetrievableSurface::getCenter  )  const [inline]
 

Definition at line 186 of file retrievable_surface.h.

00186 { return _Center; }

CSurfaceLink NLPACS::CRetrievableSurface::getChain uint  n  )  const [inline]
 

Gets nth link form this surface to its neighbor.

Definition at line 180 of file retrievable_surface.h.

References uint.

Referenced by NLPACS::CLocalRetriever::insurePosition().

00180 { return _Chains[n]; }

const std::vector<CSurfaceLink>& NLPACS::CRetrievableSurface::getChains  )  const [inline]
 

Gets links from this surface to its neighbors through chains...

Definition at line 178 of file retrievable_surface.h.

Referenced by NLPACS::CGlobalRetriever::findAStarPath(), and NLPACS::CLocalRetriever::insurePosition().

00178 { return _Chains; }

uint8 NLPACS::CRetrievableSurface::getCharacter  )  const [inline]
 

Definition at line 165 of file retrievable_surface.h.

References _Character, and uint8.

00165 { return _Character; }

uint32 NLPACS::CRetrievableSurface::getFlags  )  const [inline]
 

Definition at line 172 of file retrievable_surface.h.

References uint32.

Referenced by NLPACS::CGlobalRetriever::findAStarPath(), NLPACS::CGlobalRetriever::getBorders(), and NLPACS::CGlobalRetriever::isWaterPosition().

00172 { return _Flags; }

uint8 NLPACS::CRetrievableSurface::getLevel  )  const [inline]
 

Definition at line 166 of file retrievable_surface.h.

References _Level, and uint8.

00166 { return _Level; }

const TLoop& NLPACS::CRetrievableSurface::getLoop uint  n  )  const [inline]
 

Get nth loop.

Definition at line 182 of file retrievable_surface.h.

References _Loops, and uint.

00182 { return _Loops[n]; }

const std::vector<TLoop>& NLPACS::CRetrievableSurface::getLoops  )  const [inline]
 

Get loops.

Definition at line 184 of file retrievable_surface.h.

References _Loops.

00184 { return _Loops; }

uint8 NLPACS::CRetrievableSurface::getMaterial  )  const [inline]
 

Definition at line 164 of file retrievable_surface.h.

References uint8.

Referenced by NLPACS::CGlobalRetriever::getMaterial().

00164 { return _Material; }

float NLPACS::CRetrievableSurface::getMeanHeight  )  const [inline]
 

Definition at line 175 of file retrievable_surface.h.

References _QuantHeight.

00175 { return _QuantHeight*2.0f + 1.0f; }

uint8 NLPACS::CRetrievableSurface::getNormalQuanta  )  const [inline]
 

Definition at line 162 of file retrievable_surface.h.

References _NormalQuanta, and uint8.

00162 { return _NormalQuanta; }

uint8 NLPACS::CRetrievableSurface::getOrientationQuanta  )  const [inline]
 

Definition at line 163 of file retrievable_surface.h.

References _OrientationQuanta, and uint8.

00163 { return _OrientationQuanta; }

const CSurfaceQuadTree& NLPACS::CRetrievableSurface::getQuadTree  )  const [inline]
 

Definition at line 170 of file retrievable_surface.h.

00170 { return _Quad; }

sint8 NLPACS::CRetrievableSurface::getQuantHeight  )  const [inline]
 

Definition at line 174 of file retrievable_surface.h.

References _QuantHeight, and sint8.

Referenced by NLPACS::CRetrieverInstance::retrievePosition().

00174 { return _QuantHeight; }

sint32 NLPACS::CRetrievableSurface::getTopology uint  model  )  const [inline]
 

Definition at line 171 of file retrievable_surface.h.

References sint32, and uint.

00171 { return _Topologies[model]; }

float NLPACS::CRetrievableSurface::getWaterHeight  )  const [inline]
 

Definition at line 173 of file retrievable_surface.h.

References _WaterHeight.

Referenced by NLPACS::CGlobalRetriever::isWaterPosition().

00173 { return _WaterHeight; }

bool NLPACS::CRetrievableSurface::isCeiling  )  const [inline]
 

Definition at line 168 of file retrievable_surface.h.

References _IsCeiling.

Referenced by NLPACS::CGlobalRetriever::testCollisionWithCollisionChains(), NLPACS::CGlobalRetriever::testMovementWithCollisionChains(), and NLPACS::CGlobalRetriever::verticalChain().

00168 { return _IsCeiling; }

bool NLPACS::CRetrievableSurface::isFloor  )  const [inline]
 

Definition at line 167 of file retrievable_surface.h.

References _IsFloor.

Referenced by NLPACS::CGlobalRetriever::testCollisionWithCollisionChains(), NLPACS::CGlobalRetriever::testMovementWithCollisionChains(), and NLPACS::CGlobalRetriever::verticalChain().

00167 { return _IsFloor; }

void NLPACS::CRetrievableSurface::serial NLMISC::IStream f  ) 
 

Serialises the CRetrievableSurface.

Definition at line 51 of file retrievable_surface.cpp.

References _Character, _IsCeiling, _IsFloor, _Level, _Loops, _NormalQuanta, _OrientationQuanta, _QuantHeight, _WaterHeight, NLPACS::NumMaxCreatureModels, NLMISC::IStream::serial(), NLMISC::IStream::serialCont(), NLMISC::IStream::serialVersion(), sint, and uint.

00052 {
00053         /*
00054         Version 0:
00055                 - base version.
00056         Version 1:
00057                 - absolute water height and flag
00058         Version 2:
00059                 - no more topologies in stream (obsolete)
00060                 - no more height quad
00061                 - quantized height (_QuantHeight)
00062         */
00063         sint    ver= f.serialVersion(2);
00064 
00065         if (ver < 2)
00066                 throw EOlderStream();
00067 
00068         uint    i;
00069         f.serial(_NormalQuanta);
00070         f.serial(_OrientationQuanta);
00071         f.serial(_Material);
00072         f.serial(_Character);
00073         f.serial(_Level);
00074         f.serialCont(_Chains);
00075         f.serialCont(_Loops);
00076         if (ver <= 1)
00077         {
00078                 f.serial(_Quad);
00079                 for (i=0; i<NumMaxCreatureModels; ++i)
00080                         f.serial(_Topologies[i]);
00081         }
00082         f.serial(_Center);
00083         f.serial(_IsFloor, _IsCeiling);
00084         f.serial(_Flags);
00085 
00086         if (ver >= 1)
00087         {
00088                 f.serial(_WaterHeight);
00089         }
00090 
00091         if (ver >= 2)
00092         {
00093                 f.serial(_QuantHeight);
00094         }
00095 }

void NLPACS::CRetrievableSurface::translate const NLMISC::CVector translation  )  [inline]
 

Translates the surface by the translation vector.

Definition at line 189 of file retrievable_surface.h.

References NLPACS::CSurfaceQuadTree::translate().

00190         {
00191                 _Center += translation;
00192                 _Quad.translate(translation);
00193         }


Friends And Related Function Documentation

friend class CLocalRetriever [friend]
 

Definition at line 118 of file retrievable_surface.h.


Field Documentation

NLMISC::CVector NLPACS::CRetrievableSurface::_Center [protected]
 

The center of the surface.

Definition at line 149 of file retrievable_surface.h.

Referenced by NLPACS::CLocalRetriever::addSurface().

std::vector<CSurfaceLink> NLPACS::CRetrievableSurface::_Chains [protected]
 

The links to the neighbor surfaces.

Definition at line 137 of file retrievable_surface.h.

Referenced by NLPACS::CLocalRetriever::addChain(), NLPACS::CLocalRetriever::build3dSurfacePolygons(), NLPACS::CLocalRetriever::computeLoopsAndTips(), NLPACS::CLocalRetriever::computeTopologies(), NLPACS::CLocalRetriever::distanceToBorder(), NLPACS::CLocalRetriever::dumpSurface(), NLPACS::CLocalRetriever::findPath(), NLPACS::CLocalRetriever::getNextChain(), NLPACS::CLocalRetriever::getPreviousChain(), and NLPACS::CLocalRetriever::updateChainIds().

uint8 NLPACS::CRetrievableSurface::_Character [protected]
 

Definition at line 125 of file retrievable_surface.h.

Referenced by NLPACS::CLocalRetriever::addSurface(), NLPACS::CLocalRetriever::computeTopologies(), getCharacter(), and serial().

uint32 NLPACS::CRetrievableSurface::_Flags [protected]
 

Various flags.

Definition at line 133 of file retrievable_surface.h.

Referenced by NLPACS::CLocalRetriever::addSurface().

bool NLPACS::CRetrievableSurface::_IsCeiling [protected]
 

Definition at line 129 of file retrievable_surface.h.

Referenced by NLPACS::CLocalRetriever::addSurface(), isCeiling(), and serial().

bool NLPACS::CRetrievableSurface::_IsFloor [protected]
 

Definition at line 128 of file retrievable_surface.h.

Referenced by NLPACS::CLocalRetriever::addSurface(), isFloor(), and serial().

uint8 NLPACS::CRetrievableSurface::_Level [protected]
 

Definition at line 126 of file retrievable_surface.h.

Referenced by NLPACS::CLocalRetriever::addSurface(), getLevel(), and serial().

std::vector<TLoop> NLPACS::CRetrievableSurface::_Loops [protected]
 

The loops of chains.

Definition at line 140 of file retrievable_surface.h.

Referenced by NLPACS::CLocalRetriever::build3dSurfacePolygons(), NLPACS::CLocalRetriever::buildSurfacePolygons(), NLPACS::CLocalRetriever::computeLoopsAndTips(), NLPACS::CLocalRetriever::dumpSurface(), NLPACS::CLocalRetriever::findPath(), getLoop(), getLoops(), NLPACS::CLocalRetriever::getNextChain(), NLPACS::CLocalRetriever::getPreviousChain(), and serial().

uint8 NLPACS::CRetrievableSurface::_Material [protected]
 

Definition at line 124 of file retrievable_surface.h.

Referenced by NLPACS::CLocalRetriever::addSurface().

uint8 NLPACS::CRetrievableSurface::_NormalQuanta [protected]
 

Definition at line 122 of file retrievable_surface.h.

Referenced by NLPACS::CLocalRetriever::addSurface(), getNormalQuanta(), and serial().

uint8 NLPACS::CRetrievableSurface::_OrientationQuanta [protected]
 

Definition at line 123 of file retrievable_surface.h.

Referenced by NLPACS::CLocalRetriever::addSurface(), getOrientationQuanta(), and serial().

CSurfaceQuadTree NLPACS::CRetrievableSurface::_Quad [protected]
 

A Height QuadTree that allows to easily find the height out for a given 2D point. -- deprecated.

Definition at line 143 of file retrievable_surface.h.

Referenced by NLPACS::CLocalRetriever::addSurface().

sint8 NLPACS::CRetrievableSurface::_QuantHeight [protected]
 

Definition at line 127 of file retrievable_surface.h.

Referenced by NLPACS::CLocalRetriever::addSurface(), CRetrievableSurface(), getMeanHeight(), getQuantHeight(), and serial().

sint32 NLPACS::CRetrievableSurface::_Topologies[NumMaxCreatureModels] [protected]
 

The topologies associated with the surface, for each type of model.

Definition at line 146 of file retrievable_surface.h.

Referenced by NLPACS::CLocalRetriever::computeTopologies().

float NLPACS::CRetrievableSurface::_WaterHeight [protected]
 

Definition at line 134 of file retrievable_surface.h.

Referenced by NLPACS::CLocalRetriever::addSurface(), CRetrievableSurface(), getWaterHeight(), and serial().


The documentation for this class was generated from the following files:
Generated on Tue Mar 16 14:22:52 2004 for NeL by doxygen 1.3.6