|
|
|
|
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 ReferenceA landscape zone.
More...
#include <zone.h>
List of all members.
Public Methods |
| CZone () |
| Constructor. More...
|
| ~CZone () |
| Destructor. More...
|
void | build (const CZoneInfo &zoneInfo, uint32 numVertices=0) |
| Build a zone. More...
|
void | build (uint16 zoneId, const std::vector< CPatchInfo > &patchs, const std::vector< CBorderVertex > &borderVertices, uint32 numVertices=0) |
| Build a zone. More...
|
void | build (const CZone &zone) |
| Build a copy of a zone. More...
|
void | retrieve (CZoneInfo &zoneInfo) |
| Retrieve zone patchinfo. 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...
|
void | refreshTesselationGeometry (sint numPatch) |
| refresh the geometry (re-compute vertices). 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...
|
CLandscape * | getLandscape () 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 | preRender () |
| PreRender a zone (if needed). More...
|
void | resetRenderFarAndDeleteVBFV () |
void | forceMergeAtTileLevel () |
| For changing TileMaxSubdivision. force tesselation to be under tile. More...
|
void | refineAll () |
| force Refine a zone. More...
|
void | excludePatchFromRefineAll (uint patch, bool exclude) |
| This is especially for Pacs. exlude a patch to be refineAll()ed. More...
|
void | averageTesselationVertices () |
| This is especially for Pacs. More...
|
const CVector & | getPatchBias () const |
float | getPatchScale () const |
bool | compiled () const |
uint16 | getZoneId () const |
sint | getNumPatchs () const |
const CAABBoxExt & | getZoneBB () const |
const CPatch * | getPatch (sint patch) const |
| Get a read only patch pointer. More...
|
const CPatchConnect * | getPatchConnect (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...
|
void | setupColorsFromTileFlags (const NLMISC::CRGBA colors[4]) |
| Debug purpose only : setup the colors of the patch of this zone so that it shows which tiles have vegetable disabled, or are above, below water. More...
|
void | copyTilesFlags (sint destPatchId, const CPatch *srcPatch) |
| Copy the tiles flags from a src patch to a patch of this zone. More...
|
Private Types |
typedef NLMISC::CSmartPtr<
CTessBaseVertex > | PBaseVertex |
typedef std::vector< PBaseVertex > | TBaseVerticesVec |
enum | TClipResult { ClipIn = 0,
ClipOut = 1,
ClipSide = 2
} |
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 |
CPatch * | getPatch (sint patch) |
bool | patchOnBorder (const CPatchConnect &pc) const |
void | computeBBScaleBias (const CAABBox &bb) |
void | buildBindInfo (uint patchId, uint edge, CZone *neighborZone, CPatch::CBindInfo &paBind) |
Static Private Methods |
CPatch * | getZonePatch (TZoneMap &loadedZones, sint zoneId, sint patch) |
void | unbindPatch (CPatch &pa) |
void | bindPatch (TZoneMap &loadedZones, CPatch &pa, CPatchConnect &pc, bool rebind) |
Private Attributes |
CLandscape * | Landscape |
uint16 | ZoneId |
bool | Compiled |
CAABBoxExt | ZoneBB |
CVector | PatchBias |
float | PatchScale |
sint32 | NumVertices |
TBaseVerticesVec | BaseVertices |
std::vector< CBorderVertex > | BorderVertices |
std::vector< CPatch > | Patchs |
std::vector< CPatchConnect > | PatchConnects |
CPointLightNamedArray | _PointLightArray |
| List of PointLights that may influences Patchs and objects walking on them. More...
|
sint | ClipResult |
Friends |
class | CLandscape |
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:
-
Lionel Berenguier , Nevrax France
-
Date:
-
2000
Definition at line 296 of file src/3d/zone.h.
Member Typedef Documentation
typedef std::vector<PBaseVertex> NL3D::CZone::TBaseVerticesVec [private]
|
|
Member Enumeration Documentation
enum NL3D::CZone::TClipResult [private]
|
|
Constructor & Destructor Documentation
Member Function Documentation
void NL3D::CZone::applyHeightField |
( |
const CLandscape & |
landScape |
) |
|
|
void NL3D::CZone::averageTesselationVertices |
( |
|
) |
|
|
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 359 of file 3d/zone.cpp.
References _PointLightArray, BorderVertices, Compiled, nlassert, NumVertices, PatchBias, PatchConnects, Patchs, PatchScale, ZoneBB, and ZoneId. |
|
Build a zone.
Deprecated. Should use build(CZoneInfo &) instead. see this method
Definition at line 111 of file 3d/zone.cpp.
References build. |
void NL3D::CZone::build |
( |
const CZoneInfo & |
zoneInfo, |
|
|
uint32 |
numVertices = 0 |
|
) |
|
|
|
Build a zone.
This method do:
- compress the patchs coordinates.
- build the patchs of the zone, but doesn't compile() them.
- compress Lumels.
- sort PointLights by name, and hence remap TileLightInfluences coordinates.
NB: cannot build on a compiled zone. must release the zone before....-
Parameters:
-
numVertices |
maximize the numgber of vertices used by this zone with this value. |
Definition at line 121 of file 3d/zone.cpp.
References _PointLightArray, BorderVertices, Compiled, computeBBScaleBias, CPatch, NLAISCRIPT::l, NL_LUMEL_BY_TILE, NL_PATCH_SMOOTH_FLAG_MASK, NL_PATCH_SMOOTH_FLAG_SHIFT, nlassert, NumVertices, PatchBias, PatchConnects, Patchs, PatchScale, and ZoneId.
Referenced by build. |
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 1191 of file 3d/zone.cpp.
References getNumPatchs, Landscape, nlassert, and Patchs. |
void NL3D::CZone::clip |
( |
const std::vector< CPlane > & |
pyramid |
) |
|
|
|
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 476 of file 3d/zone.cpp.
References BaseVertices, bindPatch, BorderVertices, Compiled, CPatch, CZone, NL3D::ItZoneMap, Landscape, nlassert, NumVertices, PatchConnects, Patchs, NL3D::TZoneMap, and ZoneId. |
bool NL3D::CZone::compiled |
( |
|
) |
const [inline] |
|
void NL3D::CZone::computeBBScaleBias |
( |
const CAABBox & |
bb |
) |
[private] |
|
void NL3D::CZone::copyTilesFlags |
( |
sint |
destPatchId, |
|
|
const CPatch * |
srcPatch |
|
) |
|
|
|
Copy the tiles flags from a src patch to a patch of this zone.
the patch must match of course...
Definition at line 1392 of file 3d/zone.cpp.
References CPatch, and getPatch. |
void NL3D::CZone::debugBinds |
( |
FILE * |
f = stdout |
) |
|
|
void NL3D::CZone::excludePatchFromRefineAll |
( |
uint |
patch, |
|
|
bool |
exclude |
|
) |
|
|
void NL3D::CZone::forceMergeAtTileLevel |
( |
|
) |
|
|
|
For changing TileMaxSubdivision. force tesselation to be under tile.
Definition at line 1171 of file 3d/zone.cpp.
References CPatch, and Patchs. |
PBaseVertex NL3D::CZone::getBaseVertex |
( |
sint |
vert |
) |
const [inline, private] |
|
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 452 of file src/3d/zone.h.
References CLandscape, and Landscape. |
sint NL3D::CZone::getNumPatchs |
( |
|
) |
const [inline] |
|
CPatch* NL3D::CZone::getPatch |
( |
sint |
patch |
) |
[inline, private] |
|
const CPatch* NL3D::CZone::getPatch |
( |
sint |
patch |
) |
const [inline] |
|
const CVector& NL3D::CZone::getPatchBias |
( |
|
) |
const [inline] |
|
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 1259 of file 3d/zone.cpp.
References getNumPatchs, nlassert, and Patchs. |
|
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 498 of file src/3d/zone.h.
References nlassert, PatchConnects, and Patchs. |
float NL3D::CZone::getPatchScale |
( |
|
) |
const [inline] |
|
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 1248 of file 3d/zone.cpp.
References getNumPatchs, nlassert, and Patchs. |
const CAABBoxExt& NL3D::CZone::getZoneBB |
( |
|
) |
const [inline] |
|
uint16 NL3D::CZone::getZoneId |
( |
|
) |
const [inline] |
|
bool NL3D::CZone::patchOnBorder |
( |
const CPatchConnect & |
pc |
) |
const [private] |
|
void NL3D::CZone::preRender |
( |
|
) |
|
|
void NL3D::CZone::rebindBorder |
( |
TZoneMap & |
loadedZones |
) |
[private] |
|
void NL3D::CZone::refineAll |
( |
|
) |
|
|
void NL3D::CZone::refreshTesselationGeometry |
( |
sint |
numPatch |
) |
|
|
|
refresh the geometry (re-compute vertices).
Usefull for Tile Noise edition. Do it after calling changePatchTextureAndColor(). NB: a refreshTesselationGeometry() should be done on All patchs, and all direct neighbors of this patch (including patchs on corners). WARNING: specially coded for Tile edition. Result is not perfect:
- only EndPos of tesselation is modified. because Tile edition always subdivide at max.
- Pos=EndPos. because TileEdition always subdivide at max, and don't refine...
- TessBlocks BSphere may be too big. Clip is worse (too big), but doesn't matter.
-
Parameters:
-
numPatch |
the index of patch in this zone. assert if bad id. |
Definition at line 1234 of file 3d/zone.cpp.
References Compiled, getNumPatchs, Landscape, nlassert, and Patchs. |
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 567 of file 3d/zone.cpp.
References BaseVertices, BorderVertices, ClipOut, ClipResult, Compiled, CPatch, CZone, NL3D::ItZoneMap, Landscape, nlassert, NumVertices, Patchs, NL3D::TZoneMap, unbindPatch, and ZoneId. |
void NL3D::CZone::resetRenderFarAndDeleteVBFV |
( |
|
) |
|
|
|
Retrieve zone patchinfo.
Deprecated. Should use retrieve(CZoneInfo &) instead. see this method.
Definition at line 272 of file 3d/zone.cpp.
References retrieve. |
void NL3D::CZone::retrieve |
( |
CZoneInfo & |
zoneInfo |
) |
|
|
|
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(). Same remark for TileLightInfluences, due to light sorting.
Definition at line 283 of file 3d/zone.cpp.
References _PointLightArray, BorderVertices, CPatch, getZoneId, NL_PATCH_SMOOTH_FLAG_MASK, NL_PATCH_SMOOTH_FLAG_SHIFT, PatchBias, PatchConnects, Patchs, and PatchScale.
Referenced by retrieve. |
|
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 419 of file 3d/zone.cpp.
References _PointLightArray, BorderVertices, NumVertices, PatchBias, PatchConnects, Patchs, PatchScale, NLMISC::IStream::serial, NLMISC::IStream::serialCheck, NLMISC::IStream::serialCont, NLMISC::IStream::serialVersion, NLMISC::IStream::xmlPop, NLMISC::IStream::xmlPush, NLMISC::IStream::xmlSerial, ZoneBB, and ZoneId. |
void NL3D::CZone::setupColorsFromTileFlags |
( |
const NLMISC::CRGBA |
colors[4] |
) |
|
|
|
Debug purpose only : setup the colors of the patch of this zone so that it shows which tiles have vegetable disabled, or are above, below water.
User provides a table with 4 colors for each state : color 0 = above water color 1 = underwater color 2 = intersect water color 3 = vegetable disabled
Definition at line 1382 of file 3d/zone.cpp.
References Patchs. |
void NL3D::CZone::unbindPatch |
( |
CPatch & |
pa |
) |
[static, private] |
|
Friends And Related Function Documentation
friend class CLandscape [friend]
|
|
friend class CPatch [friend]
|
|
|
Definition at line 570 of file src/3d/zone.h.
Referenced by applyHeightField, averageTesselationVertices, build, clip, compile, copyTilesFlags, forceMergeAtTileLevel, getPatch, preRender, rebindBorder, refineAll, release, resetRenderFarAndDeleteVBFV, and retrieve. |
friend class CTessFace [friend]
|
|
Member Data Documentation
sint NL3D::CZone::ClipResult [private]
|
|
bool NL3D::CZone::Compiled [private]
|
|
|
Definition at line 544 of file src/3d/zone.h.
Referenced by averageTesselationVertices, build, clip, compile, compiled, CZone, excludePatchFromRefineAll, preRender, refineAll, refreshTesselationGeometry, release, and ~CZone. |
sint32 NL3D::CZone::NumVertices [private]
|
|
CVector NL3D::CZone::PatchBias [private]
|
|
std::vector<CPatch> NL3D::CZone::Patchs [private]
|
|
|
Definition at line 558 of file src/3d/zone.h.
Referenced by applyHeightField, averageTesselationVertices, build, buildBindInfo, changePatchTextureAndColor, clip, compile, excludePatchFromRefineAll, forceMergeAtTileLevel, getNumPatchs, getPatch, getPatchColor, getPatchConnect, getPatchTexture, preRender, rebindBorder, refineAll, refreshTesselationGeometry, release, resetRenderFarAndDeleteVBFV, retrieve, serial, and setupColorsFromTileFlags. |
float NL3D::CZone::PatchScale [private]
|
|
CAABBoxExt NL3D::CZone::ZoneBB [private]
|
|
uint16 NL3D::CZone::ZoneId [private]
|
|
The documentation for this class was generated from the following files:
|
|