# Home    # nevrax.com   
Nevrax
Nevrax.org
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#License
Docs
 
Documentation  
Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Search  

NL3D::CZone Class Reference

A landscape zone. More...

#include <zone.h>

Collaboration diagram for NL3D::CZone:

Collaboration graph
[legend]
List of all members.

Public Methods

 CZone ()
 Constructor. More...

 ~CZone ()
 Destructor. More...

void build (uint16 zoneId, const std::vector<CPatchInfo> &patchs, const std::vector<CBorderVertex> &borderVertices)
 Build a zone. More...

void build (const CZone &zone)
 Build a copy of a zone. More...

void retrieve (std::vector<CPatchInfo> &patchs, std::vector<CBorderVertex> &borderVertices)
 Retrieve zone patchinfo. More...

void debugBinds (FILE *f= stdout)
 Debug a zone, print binds in display. More...

void compile (CLandscape *landscape, TZoneMap &loadedZones)
 Compile a zone. More...

void release (TZoneMap &loadedZones)
 Release a zone. More...

void serial (NLMISC::IStream &f)
 Load/save a zone. More...

void changePatchTextureAndColor (sint numPatch, const std::vector<CTileElement> *tiles, const std::vector<CTileColor> *colors)
 Update and refresh a patch texture. More...

const std::vector<CTileElement>& getPatchTexture (sint numPatch) const
 Get a patch texture. More...

const std::vector<CTileColor>& getPatchColor (sint numPatch) const
 Get a patch colors Return the color array. More...

CLandscapegetLandscape () const
 Get the landscape in which is placed this zone. More...

void clip (const std::vector<CPlane> &pyramid)
 Clip a zone. To know if must be rendered etc... A zone is IN if in BACK of at least one plane of the pyramid. More...

void refine ()
 Refine a zone (if needed). More...

void preRender (const std::vector<CPlane> &pyramid)
 PreRender a zone (if needed). More...

void renderFar0 ()
 Render pass (if needed). More...

void renderFar1 ()
void renderTile (sint pass)
void resetRenderFar ()
void forceMergeAtTileLevel ()
 For changing TileMaxSubdivision. force tesselation to be under tile. More...

void refineAll ()
 force Refine a zone. More...

const CVector& getPatchBias () const
float getPatchScale () const
bool compiled () const
uint16 getZoneId () const
sint getNumPatchs () const
const CAABBoxExt& getZoneBB () const
const CPatchgetPatch (sint patch) const
 Get a read only patch pointer. More...

const CPatchConnectgetPatchConnect (sint patch) const
 Get a read only patch connect pointer. More...

void applyHeightField (const CLandscape &landScape)
 apply a landscape heightfield on a zone (modification of Z control points values). More...


Private Types

typedef NLMISC::CSmartPtr<
CTessBaseVertex
PBaseVertex
typedef std::vector<PBaseVertexTBaseVerticesVec

Private Methods

void rebindBorder (TZoneMap &loadedZones)
 Force border patchs (those who don't bind to current zone) to re bind() them, using new neighborood. More...

PBaseVertex getBaseVertex (sint vert) const
CPatchgetPatch (sint patch)
bool patchOnBorder (const CPatchConnect &pc) const
void computeBBScaleBias (const CAABBox &bb)

Private Attributes

CLandscapeLandscape
uint16 ZoneId
bool Compiled
CAABBoxExt ZoneBB
CVector PatchBias
float PatchScale
sint32 NumVertices
TBaseVerticesVec BaseVertices
std::vector<CBorderVertexBorderVertices
std::vector<CPatchPatchs
std::vector<CPatchConnectPatchConnects
bool ComputeTileErrorMetric
std::vector<CPlane> CurrentPyramid
sint ClipResult

Static Private Methods

CPatchgetZonePatch (TZoneMap &loadedZones, sint zoneId, sint patch)
void unbindAndMakeBindInfo (TZoneMap &loadedZones, CPatch &pa, CPatchConnect &pc, CPatch::CBindInfo edges[4])
void unbindPatch (TZoneMap &loadedZones, CPatch &pa, CPatchConnect &pc)
void bindPatch (TZoneMap &loadedZones, CPatch &pa, CPatchConnect &pc)

Friends

class  CTessFace
class  CPatch

Detailed Description

A landscape zone.

There is 2 ways for building a zone:

  • use build(). (then you can use serial to save the zone, don't need to compile() the zone).
  • use serial() for loading this zone.
Before a zone may be rendered, it must be compile()-ed, to compile and bind patch, to make vertices etc...

NB: you must call release() before deleting a compiled zone. (else assert in destruction).

Author(s):
Lionel Berenguier , Nevrax France
Date:
2000

Definition at line 216 of file 3d/zone.h.


Member Typedef Documentation

typedef NLMISC::CSmartPtr<CTessBaseVertex> NL3D::CZone::PBaseVertex [private]
 

Definition at line 416 of file 3d/zone.h.

typedef std::vector<PBaseVertex> NL3D::CZone::TBaseVerticesVec [private]
 

Definition at line 417 of file 3d/zone.h.


Constructor & Destructor Documentation

NL3D::CZone::CZone ( )
 

Constructor.

Definition at line 48 of file 3d/zone.cpp.

NL3D::CZone::~CZone ( )
 

Destructor.

Definition at line 56 of file 3d/zone.cpp.


Member Function Documentation

void NL3D::CZone::applyHeightField ( const CLandscape & landScape )
 

apply a landscape heightfield on a zone (modification of Z control points values).

NB: this is done in Landscape addZone(), before compile().

Parameters:
landScape   the landscape which gives Z delta values, for a x,y point.

Definition at line 1034 of file 3d/zone.cpp.

void NL3D::CZone::bindPatch ( TZoneMap & loadedZones,
CPatch & pa,
CPatchConnect & pc ) [static, private]
 

Definition at line 600 of file 3d/zone.cpp.

void NL3D::CZone::build ( const CZone & zone )
 

Build a copy of a zone.

This method do a copy of zone (should be builded but maybe not compiled).

NB: cannot build on a compiled zone. must release the zone before....

Definition at line 216 of file 3d/zone.cpp.

void NL3D::CZone::build ( uint16 zoneId,
const std::vector< CPatchInfo >& patchs,
const std::vector< CBorderVertex >& borderVertices )
 

Build a zone.

This method do:

  • compress the patchs coordinates.
  • build the patchs of the zone, but doesn't compile() them.
NB: cannot build on a compiled zone. must release the zone before....
Parameters:
zoneId   the Unique ID of this zone.
patchs   the PatchInfo of this zone.
borderVertices   vertices connectivity for this zone. NB: borderVertices must contains the connectivity across zones. It is VERY IMPORTANT to setup zone corner connectivity too. A "corner borderVertex" may appear 3 times here. One for each other zone of the corner.

Definition at line 77 of file 3d/zone.cpp.

Referenced by RPatchMesh::exportZone().

void NL3D::CZone::changePatchTextureAndColor ( sint numPatch,
const std::vector< CTileElement >* tiles,
const std::vector< CTileColor >* colors )
 

Update and refresh a patch texture.

Usefull for Tile edition. Even if patch is in tile mode, it is refreshed...

Parameters:
numPatch   the index of patch in this zone which will receive his new texture. assert if bad id.
tiles   the patch texture. assert if not of good size (OrderS*OrderT). Can be NULL if you don't want to change the patch texture.
colors   the patch texture. assert if not of good size ((OrderS+1)*(OrderT+1)). Can be NULL if you don't want to change the patch colors.

Definition at line 951 of file 3d/zone.cpp.

void NL3D::CZone::clip ( const std::vector< CPlane >& pyramid )
 

Clip a zone. To know if must be rendered etc... A zone is IN if in BACK of at least one plane of the pyramid.

Definition at line 651 of file 3d/zone.cpp.

void NL3D::CZone::compile ( CLandscape * landscape,
TZoneMap & loadedZones )
 

Compile a zone.

Make it usable for clip()/refine()/render(). This method do:

  • attach this to loadedZones.
  • create/link the base vertices (internal..), according to present neigbor zones.
  • compile() the patchs.
  • bind() the patchs.
  • rebindBorder() on neighbor zones.
A zone must keep a pointer on a landscape, for texture management. NB: assert if already compiled. assert if zone already exist in loadedZones.

Definition at line 330 of file 3d/zone.cpp.

bool NL3D::CZone::compiled ( ) const [inline]
 

Definition at line 374 of file 3d/zone.h.

void NL3D::CZone::computeBBScaleBias ( const CAABBox & bb ) [private]
 

Definition at line 64 of file 3d/zone.cpp.

void NL3D::CZone::debugBinds ( FILE * f = stdout )
 

Debug a zone, print binds in display.

Definition at line 1002 of file 3d/zone.cpp.

void NL3D::CZone::forceMergeAtTileLevel ( )
 

For changing TileMaxSubdivision. force tesselation to be under tile.

Definition at line 933 of file 3d/zone.cpp.

PBaseVertex NL3D::CZone::getBaseVertex ( sint vert ) const [inline, private]
 

Definition at line 465 of file 3d/zone.h.

CLandscape * NL3D::CZone::getLandscape ( ) const [inline]
 

Get the landscape in which is placed this zone.

If no landscape, return NULL.

Returns:
the pointer of the landscape of the zone or NULL if the zone hasn't be compiled.

Definition at line 347 of file 3d/zone.h.

sint NL3D::CZone::getNumPatchs ( ) const [inline]
 

Definition at line 376 of file 3d/zone.h.

CPatch * NL3D::CZone::getPatch ( sint patch ) [inline, private]
 

Definition at line 466 of file 3d/zone.h.

const CPatch * NL3D::CZone::getPatch ( sint patch ) const [inline]
 

Get a read only patch pointer.

Parameters:
patch   the index of patch to get.
Returns:
A patch pointer in read only.

Definition at line 386 of file 3d/zone.h.

const CVector & NL3D::CZone::getPatchBias ( ) const [inline]
 

Definition at line 372 of file 3d/zone.h.

const std::vector< CTileColor >& NL3D::CZone::getPatchColor ( sint numPatch ) const
 

Get a patch colors Return the color array.

Parameters:
numPatch   the index of patch in this zone which will get his colors. assert if bad id.
return   The tiles the patch colors. The size should be (OrderS+1)*(OrderT+1).
See also:
getPatch()

Definition at line 991 of file 3d/zone.cpp.

const CPatchConnect * NL3D::CZone::getPatchConnect ( sint patch ) const [inline]
 

Get a read only patch connect pointer.

Parameters:
patch   the index of patch to get.
Returns:
A patch pointer in read only.

Definition at line 394 of file 3d/zone.h.

float NL3D::CZone::getPatchScale ( ) const [inline]
 

Definition at line 373 of file 3d/zone.h.

const std::vector< CTileElement >& NL3D::CZone::getPatchTexture ( sint numPatch ) const
 

Get a patch texture.

Return the tile array.

Parameters:
numPatch   the index of patch in this zone which will get his texture. assert if bad id.
return   The tiles the patch texture. The size should be OrderS*OrderT.
See also:
getPatch()

Definition at line 980 of file 3d/zone.cpp.

const CAABBoxExt & NL3D::CZone::getZoneBB ( ) const [inline]
 

Definition at line 378 of file 3d/zone.h.

uint16 NL3D::CZone::getZoneId ( ) const [inline]
 

Definition at line 375 of file 3d/zone.h.

CPatch * NL3D::CZone::getZonePatch ( TZoneMap & loadedZones,
sint zoneId,
sint patch ) [static, private]
 

Definition at line 523 of file 3d/zone.cpp.

bool NL3D::CZone::patchOnBorder ( const CPatchConnect & pc ) const [private]
 

Definition at line 622 of file 3d/zone.cpp.

void NL3D::CZone::preRender ( const std::vector< CPlane >& pyramid )
 

PreRender a zone (if needed).

Definition at line 864 of file 3d/zone.cpp.

void NL3D::CZone::rebindBorder ( TZoneMap & loadedZones ) [private]
 

Force border patchs (those who don't bind to current zone) to re bind() them, using new neighborood.

no-op if zone is not compiled.

Definition at line 507 of file 3d/zone.cpp.

void NL3D::CZone::refine ( )
 

Refine a zone (if needed).

Definition at line 784 of file 3d/zone.cpp.

void NL3D::CZone::refineAll ( )
 

force Refine a zone.

Definition at line 835 of file 3d/zone.cpp.

void NL3D::CZone::release ( TZoneMap & loadedZones )
 

Release a zone.

This method do:

  • detach this zone to loadedZones.
  • destroy/unlink the base vertices (internal..), according to present neigbor zones.
  • unbind() the patchs.
  • release() the patchs.
  • rebindBorder() on neighbor zones.
NB: no-op if not compiled.

Definition at line 418 of file 3d/zone.cpp.

void NL3D::CZone::renderFar0 ( )
 

Render pass (if needed).

Definition at line 878 of file 3d/zone.cpp.

void NL3D::CZone::renderFar1 ( )
 

Definition at line 892 of file 3d/zone.cpp.

void NL3D::CZone::renderTile ( sint pass )
 

Definition at line 906 of file 3d/zone.cpp.

void NL3D::CZone::resetRenderFar ( )
 

Definition at line 922 of file 3d/zone.cpp.

void NL3D::CZone::retrieve ( std::vector< CPatchInfo >& patchs,
std::vector< CBorderVertex >& borderVertices )
 

Retrieve zone patchinfo.

This method uncompress the patchs coordinates and all info into the patch info/borderVertices. Warning!!! Due to compression, data won't be the same as those given in build().

Parameters:
patchs   the PatchInfo of this zone.
borderVertices   vertices connectivity for this zone.

Definition at line 169 of file 3d/zone.cpp.

void NL3D::CZone::serial ( NLMISC::IStream & f )
 

Load/save a zone.

Save work even if zone is not compiled, but load must be done on a not compiled zone...

Definition at line 271 of file 3d/zone.cpp.

void NL3D::CZone::unbindAndMakeBindInfo ( TZoneMap & loadedZones,
CPatch & pa,
CPatchConnect & pc,
CPatch::CBindInfo edges[4] ) [static, private]
 

Definition at line 536 of file 3d/zone.cpp.

void NL3D::CZone::unbindPatch ( TZoneMap & loadedZones,
CPatch & pa,
CPatchConnect & pc ) [static, private]
 

Definition at line 611 of file 3d/zone.cpp.


Friends And Related Function Documentation

class CPatch [friend]
 

Definition at line 448 of file 3d/zone.h.

class CTessFace [friend]
 

Definition at line 446 of file 3d/zone.h.


Member Data Documentation

TBaseVerticesVec NL3D::CZone::BaseVertices [private]
 

Definition at line 435 of file 3d/zone.h.

std::vector< CBorderVertex > NL3D::CZone::BorderVertices [private]
 

Definition at line 437 of file 3d/zone.h.

sint NL3D::CZone::ClipResult [private]
 

Definition at line 456 of file 3d/zone.h.

bool NL3D::CZone::Compiled [private]
 

Definition at line 427 of file 3d/zone.h.

bool NL3D::CZone::ComputeTileErrorMetric [private]
 

Definition at line 452 of file 3d/zone.h.

std::vector< CPlane > NL3D::CZone::CurrentPyramid [private]
 

Definition at line 455 of file 3d/zone.h.

CLandscape * NL3D::CZone::Landscape [private]
 

Definition at line 423 of file 3d/zone.h.

sint32 NL3D::CZone::NumVertices [private]
 

Definition at line 433 of file 3d/zone.h.

CVector NL3D::CZone::PatchBias [private]
 

Definition at line 429 of file 3d/zone.h.

std::vector< CPatchConnect > NL3D::CZone::PatchConnects [private]
 

Definition at line 442 of file 3d/zone.h.

float NL3D::CZone::PatchScale [private]
 

Definition at line 430 of file 3d/zone.h.

std::vector< CPatch > NL3D::CZone::Patchs [private]
 

Definition at line 441 of file 3d/zone.h.

CAABBoxExt NL3D::CZone::ZoneBB [private]
 

Definition at line 428 of file 3d/zone.h.

uint16 NL3D::CZone::ZoneId [private]
 

Definition at line 426 of file 3d/zone.h.


The documentation for this class was generated from the following files: