NL3D::CPatch Class Reference

A landscape patch. More...

#include <patch.h>

List of all members.

Classes

struct  CBindInfo

Public Member Functions

 CPatch ()
 Constructor.
 ~CPatch ()
 dtor
void compile (CZone *z, uint patchId, uint8 orderS, uint8 orderT, CTessVertex *baseVertices[4], float errorSize=0)
 compile a valid patch.
void release ()
 Un-compile a patch. Tesselation is deleted. if patch is not compiled, no - op.
CLandscapegetLandscape () const
 Get the landscape in which is placed this patch.
CZonegetZone () const
uint8 getOrderS () const
uint8 getOrderT () const
uint8 getOrderForEdge (sint8 edge) const
float getErrorSize () const
sint getFar0 () const
sint getFar1 () const
uint16 getPatchId () const
void getBindNeighbor (uint edge, CBindInfo &neighborEdge) const
 return neighborhood information.
CAABBox buildBBox () const
 Build the bbox of the patch, according to ctrl points, and displacement map max value.
CVector computeVertex (float s, float t) const
 Compute a vertex.
CVector computeContinousVertex (float s, float t) const
 Same as computeVertex, but special accurate version for CVisualCollisionEntity.
void unbind ()
 unbind the patch from All neighbors.
void bind (CBindInfo Edges[4], bool rebind)
 bind the patch to 4 neighbors, given in this patch edge order (0,1,2,3).
void forceMergeAtTileLevel ()
 For changing TileMaxSubdivision. force tesselation to be under tile.
void averageTesselationVertices ()
 This is especially for Pacs.
void refineAll ()
 Refine this patch. Even if clipped. Refine all nodes.
void resetRenderFar ()
void deleteTileUvs ()
void recreateTileUvs ()
void refreshTesselationGeometry ()
void serial (NLMISC::IStream &f)
void unpack (CBezierPatch &p) const
bool isRenderClipped () const
const CTessVertexgetCornerVertex (uint corner)
uint getTileMaterialRefCount () const
 Get number of TileMaterial created in this Patch.
CBezierPatchunpackIntoCache () const
Render



void preRender (const NLMISC::CBSphere &patchSphere)
 preRender this patch. Build Max faces / pass etc...
void updateTextureFarOnly (const NLMISC::CBSphere &patchSphere)
void renderFar0 ()
 Render this patch, if not clipped. Call PatchCurrentDriver->renderSimpleTriangles().
void renderFar1 ()
void computeSoftwareGeomorphAndAlpha ()
void updateClipPatchVB (bool renderClipped)
CPatchgetNextFar0ToRdr () const
CPatchgetNextFar1ToRdr () const
Smooth flags methods



void setSmoothFlag (uint edge, bool flag)
 Set the smooth flag for the n-th edge.
bool getSmoothFlag (uint edge) const
 Get the smooth flag for the n-th edge.
Subdivision / ForCollision.



void addTrianglesInBBox (CPatchIdent paId, const CAABBox &bbox, std::vector< CTrianglePatch > &triangles, uint8 tileTessLevel) const
 Add triangles to triangles array which intersect the bbox.
void fillPatchQuadBlock (CPatchQuadBlock &quadBlock) const
 Fill a CPatchQuadBlock, from its required PatchId.
void addPatchBlocksInBBox (CPatchIdent paId, const CAABBox &bbox, std::vector< CPatchBlockIdent > &paBlockIds) const
 Add CPatchBlockIdent to CPatchBlockIdent array which intersect the bbox.
CVector getTesselatedPos (CUV uv) const
 From the current tesselation of this patch, and a UV in this patch, return tesselated position.
void appendTessellationLeaves (std::vector< const CTessFace * > &leaves) const
 From the current tesselation of this patch, append to the list of leaves faces.
Lightmap get interface.



uint8 getLumel (const CUV &uv) const
 Get the lumel under the position.
void appendTileLightInfluences (const CUV &uv, std::vector< CPointLightInfluence > &pointLightList) const
 Append lights under the position to pointLightList.
void computeCurrentTLILightmapDiv2 (NLMISC::CRGBA *array) const
 For CTextureFar, compute current TLI Lightmap at tile level.
Tiles get interface.



CTileElementgetTileElement (const CUV &uv)
 Get the lumel under the position.
VB Allocator mgt.



void deleteVBAndFaceVector ()
void allocateVBAndFaceVector ()
void fillVB ()
void fillVBIfVisible ()
void deleteVBAndFaceVectorFar1Only ()
void allocateVBAndFaceVectorFar1Only ()
void fillVBFar0Only ()
void fillVBFar1Only ()
void fillVBFarsDLMUvOnly ()
void fillFar0DLMUvOnlyVertexListVB (CTessList< CTessFarVertex > &vertList)
void fillFar1DLMUvOnlyVertexListVB (CTessList< CTessFarVertex > &vertList)
void debugAllocationMarkIndices (uint marker)
void recreateTessBlockFaceVector (CTessBlock &block)
MicroVegetation



void deleteAllVegetableIgs ()
 Delete any vegetable Ig still existing in this patch.
void recreateAllVegetableIgs ()
 Recreate any vegetable block (as possible) in this patch. (useful for edition).
TileLightInfluences



void resetTileLightInfluences ()
 make a valid empty array of TileLightInfluences (ie resized to good size, but with empty light influences

Public Attributes

CVector3s Vertices [4]
 The patch coordinates (see CBezierPatch).
CVector3s Tangents [8]
CVector3s Interiors [4]
std::vector< uint8CompressedLumels
std::vector< CTileElementTiles
std::vector< CTileColorTileColors
std::vector< CTileLightInfluenceTileLightInfluences

Private Member Functions

void computeDefaultErrorSize ()
void makeRoots ()
CTessFacegetRootFaceForEdge (sint edge) const
CTessVertexgetRootVertexForEdge (sint edge) const
void changeEdgeNeighbor (sint edge, CTessFace *to)
void computeNewFar (const NLMISC::CBSphere &patchSphere, sint &newFar0, sint &newFar1)
void fillFar0VertexVB (CTessFarVertex *pVert)
void fillFar1VertexVB (CTessFarVertex *pVert)
void fillTileVertexVB (CTessNearVertex *pVert)
void fillFar0VertexListVB (CTessList< CTessFarVertex > &vertList)
void fillFar1VertexListVB (CTessList< CTessFarVertex > &vertList)
void fillTileVertexListVB (CTessList< CTessNearVertex > &vertList)
void updateFar0VBAlloc (CTessList< CTessFarVertex > &vertList, bool alloc)
void updateFar1VBAlloc (CTessList< CTessFarVertex > &vertList, bool alloc)
void updateTileVBAlloc (CTessList< CTessNearVertex > &vertList, bool alloc)
void updateVBAlloc (bool alloc)
void debugAllocationMarkIndicesFarList (CTessList< CTessFarVertex > &vertList, uint marker)
void debugAllocationMarkIndicesNearList (CTessList< CTessNearVertex > &vertList, uint marker)
void createFaceVectorFar1 ()
void deleteFaceVectorFar1 ()
void createFaceVectorFar0OrTile ()
void deleteFaceVectorFar0OrTile ()
void checkCreateVertexVBFar (CTessFarVertex *pVert)
void checkCreateVertexVBNear (CTessNearVertex *pVert)
void checkFillVertexVBFar (CTessFarVertex *pVert)
void checkFillVertexVBNear (CTessNearVertex *pVert)
void checkDeleteVertexVBFar (CTessFarVertex *pVert)
void checkDeleteVertexVBNear (CTessNearVertex *pVert)
void computeGeomorphVertexList (CTessList< CTessFarVertex > &vertList)
void computeGeomorphFar0VertexListVB (CTessList< CTessFarVertex > &vertList)
void computeGeomorphAlphaFar1VertexListVB (CTessList< CTessFarVertex > &vertList)
void computeGeomorphTileVertexListVB (CTessList< CTessNearVertex > &vertList)
void computeTbTm (uint &numtb, uint &numtm, uint ts, uint tt)
Texture mgt.



CPatchRdrPassgetTileRenderPass (sint tileId, sint pass)
void getTileUvInfo (sint tileId, sint pass, bool alpha, uint8 &orient, CVector &uvScaleBias, bool &is256x256, uint8 &uvOff)
void getTileLightMap (uint ts, uint tt, CPatchRdrPass *&rdrpass)
void getTileLightMapUvInfo (uint ts, uint tt, CVector &uvScaleBias)
void releaseTileLightMap (uint ts, uint tt)
void computeNearBlockLightmap (uint ts, uint tt, NLMISC::CRGBA *lightText)
void computeTileLightmapPixelAroundCorner (const NLMISC::CVector2f &stIn, NLMISC::CRGBA *dest, bool lookAround)
void computeTileLightmap (uint ts, uint tt, NLMISC::CRGBA *dest, uint stride)
void computeTileLightmapEdge (uint ts, uint tt, uint edge, NLMISC::CRGBA *dest, uint stride, bool inverse)
void computeTileLightmapPixel (uint ts, uint tt, uint s, uint t, NLMISC::CRGBA *dest)
void computeTileLightmapAutomatic (uint ts, uint tt, NLMISC::CRGBA *dest, uint stride)
void computeTileLightmapEdgeAutomatic (uint ts, uint tt, uint edge, NLMISC::CRGBA *dest, uint stride, bool inverse)
void computeTileLightmapPixelAutomatic (uint ts, uint tt, uint s, uint t, NLMISC::CRGBA *dest)
void computeTileLightmapPrecomputed (uint ts, uint tt, NLMISC::CRGBA *dest, uint stride)
void computeTileLightmapEdgePrecomputed (uint ts, uint tt, uint edge, NLMISC::CRGBA *dest, uint stride, bool inverse)
void computeTileLightmapPixelPrecomputed (uint ts, uint tt, uint s, uint t, NLMISC::CRGBA *dest)
void modulateTileLightmapWithTileColors (uint ts, uint tt, NLMISC::CRGBA *dest, uint stride)
void modulateTileLightmapEdgeWithTileColors (uint ts, uint tt, uint edge, NLMISC::CRGBA *dest, uint stride, bool inverse)
void modulateTileLightmapPixelWithTileColors (uint ts, uint tt, uint s, uint t, NLMISC::CRGBA *dest)
void getTileTileColors (uint ts, uint tt, NLMISC::CRGBA corners[4])
CRGBA getCurrentTLIColor (uint x, uint y) const
void getCurrentTileTLIColors (uint ts, uint tt, NLMISC::CRGBA corners[4])
void addTileLightmapWithTLI (uint ts, uint tt, NLMISC::CRGBA *dest, uint stride)
void addTileLightmapEdgeWithTLI (uint ts, uint tt, uint edge, NLMISC::CRGBA *dest, uint stride, bool inverse)
void addTileLightmapPixelWithTLI (uint ts, uint tt, uint s, uint t, NLMISC::CRGBA *dest)
Subdivision private.



void buildBBoxFromBezierPatch (const CBezierPatch &p, CAABBox &ret) const
 build a bbox from the convex hull of a bezier patch, enlarged with noise.
void addTrianglesInBBoxRecurs (CPatchIdent paId, const CAABBox &bbox, std::vector< CTrianglePatch > &triangles, uint8 tessLevel, const CBezierPatch &pa, uint8 s0, uint8 s1, uint8 t0, uint8 t1) const
 recurse subdivide of the bezierPatch.
void addTileTrianglesInBBox (CPatchIdent paId, const CAABBox &bbox, std::vector< CTrianglePatch > &triangles, uint8 tessLevel, uint8 s0, uint8 t0) const
 called by addTrianglesInBBoxRecurs().
void addPatchBlocksInBBoxRecurs (CPatchIdent paId, const CAABBox &bbox, std::vector< CPatchBlockIdent > &paBlockIds, const CBezierPatch &pa, uint8 s0, uint8 s1, uint8 t0, uint8 t1) const
 recurse method of addPatchBlocksInBBox.
CVector computeVertexButCorner (float s, float t, bool &onCorner) const
 Used by computeContinousVertex().

Private Attributes

CZoneZone
uint16 PatchId
uint8 OrderS
uint8 OrderT
bool ExcludeFromRefineAll
sint TessBlockLimitLevel
sint TileLimitLevel
sint SquareLimitLevel
float ErrorSize
CTessFaceSon0
CTessFaceSon1
CTessVertexBaseVertices [4]
CTessFarVertex BaseFarVertices [4]
float Far0UScale
float Far0VScale
float Far0UBias
float Far0VBias
float Far1UScale
float Far1VScale
float Far1UBias
float Far1VBias
uint8 Flags
 Flags NL_PATCH_FAR0_ROTATED and NL_PATCH_FAR1_ROTATED NL_PATCH_FAR0_ROTATED for Far0, NL_PATCH_FAR1_ROTATED for Far1 If the flag is set, the far texture of the patch is rotated of 1 (to the left of course).
float TransitionSqrMin
float OOTransitionSqrDelta
sint Far0
sint Far1
CPatchRdrPass_PatchRdrPassFar0
CPatch_NextRdrFar0
CPatchRdrPass_PatchRdrPassFar1
CPatch_NextRdrFar1
Vegetables.



std::vector
< CVegetableClipBlock * > 
VegetableClipBlocks
 list of vegetable clipBlocks, created/destroyed at same time as TessBlocks.

Static Private Attributes

static uint32 _Version = 7
 Stream version of the class.
static CBezierPatch CachePatch
static const CPatchLastPatch = NULL

Friends

class CTessFace
class CZone
class CLandscapeVegetableBlock
class CPatchRdrPass

RenderList mgt.



enum  TFarVertType { FVMasterBlock = 0, FVTessBlock, FVTessBlockEdge }
void resetMasterBlock ()
void clearTessBlocks ()
void addRefTessBlocks ()
void decRefTessBlocks ()
uint getNumTessBlock (CTessFace *face)
void getNumTessBlock (CParamCoord pc, TFarVertType &type, uint &numtb)
void dirtTessBlockFaceVector (CTessBlock &block)
void appendFaceToRenderList (CTessFace *face)
void removeFaceFromRenderList (CTessFace *face)
void appendFaceToTileRenderList (CTessFace *face)
void removeFaceFromTileRenderList (CTessFace *face)
void extendTessBlockWithEndPos (CTessFace *face)
void appendTileMaterialToRenderList (CTileMaterial *tm)
void removeTileMaterialFromRenderList (CTileMaterial *tm)
void appendFarVertexToRenderList (CTessFarVertex *fv)
void removeFarVertexFromRenderList (CTessFarVertex *fv)
void appendNearVertexToRenderList (CTileMaterial *tileMat, CTessNearVertex *nv)
void removeNearVertexFromRenderList (CTileMaterial *tileMat, CTessNearVertex *nv)



uint8 NoiseRotation
 Noise Data.
uint8 _CornerSmoothFlag
 Put here for packing with NoiseRotation.
CZone_BindZoneNeighbor [4]
 Realtime Bind information.
void setCornerSmoothFlag (uint corner, bool smooth)
 setup Smooth flags for Noise on corner: used for Noise geometry and for lighting.
bool getCornerSmoothFlag (uint corner) const
CTessFacelinkTessFaceWithEdge (const NLMISC::CVector2f &uv0, const NLMISC::CVector2f &uv1, CTessFace *linkTo)
 Used by bind().
float computeDisplaceRawInteger (sint ts, sint tt, sint ms, sint mt) const
 Noise Geometry.
void computeDisplaceRawCoordinates (float sTile, float tTile, float s, float t, sint &ts, sint &tt, sint &ms, sint &mt) const
float computeDisplaceRaw (float sTile, float tTile, float s, float t) const
 compute the displacement for s,t ([0;OrderS], [0;OrderT]) (sTile, tTile) choose what NoiseMap to use, and (s,t) choose the coordinate in the patch to compute this NoiseMap.
float computeDisplaceRawOnNeighbor (float sTile, float tTile, float s, float t) const
 useful only for computeDisplaceCornerSmooth().
float computeDisplaceInteriorSmooth (float s, float t) const
 compute the smoothed displacement for s,t ([0;OrderS], [0;OrderT]).
float computeDisplaceEdgeSmooth (float s, float t, sint8 smoothBorderX, sint8 smoothBorderY) const
 compute the smoothed displacement for s,t ([0;OrderS], [0;OrderT]).
float computeDisplaceCornerSmooth (float s, float t, sint8 smoothBorderX, sint8 smoothBorderY) const
 compute the smoothed displacement for s,t ([0;OrderS], [0;OrderT]).
CVector computeNormalEdgeSmooth (float s, float t, sint8 smoothBorderX, sint8 smoothBorderY) const
 compute the smoothed normal for s,t ([0;OrderS], [0;OrderT]).
CVector computeNormalCornerSmooth (float s, float t, sint8 smoothBorderX, sint8 smoothBorderY) const
 compute the smoothed normal for s,t ([0;OrderS], [0;OrderT]).
CVector computeNormalOnNeighbor (float s, float t, uint edgeExclude) const
 same reasoning as in computeDisplaceRawOnNeighbor().
void computeNoise (float s, float t, CVector &displace) const
 compute the Final displacement for s,t ([0;1], [0;1]).
void createVegetableBlock (uint numTb, uint ts, uint tt)
 Micro-Vegetation.
void releaseVegetableBlock (uint numTb)
 release the vegetableBlock in the corresponding TessBlock. TessBlocks must exist
void generateTileVegetable (CVegetableInstanceGroup *vegetIg, uint distType, uint ts, uint tt, CLandscapeVegetableBlockCreateContext &vbCreateCtx)
void getTileLumelmapPrecomputed (uint ts, uint tt, uint8 *dest, uint stride)
void getTileLumelmapPixelPrecomputed (uint ts, uint tt, uint s, uint t, uint8 &dest) const
 same as computeTileLightmapPixelPrecomputed, but brut result, not modified by colorTable.

Block renders.



CTessBlock MasterBlock
sint NumRenderableFaces
NLMISC::CObjectVector< CTessBlockTessBlocks
sint TessBlockRefCount

UpdateLighting Management



CPatch_ULNearPrec
CPatch_ULNearNext
void linkBeforeNearUL (CPatch *patchNext)
 For lighting update, insert this before patchNext (CiruclarList). textNext must be !NULL.
void unlinkNearUL ()
 For lighting update, unlink (CiruclarList).
CPatchgetNextNearUL () const
 For lighting update, get Next (CiruclarList). If ==this, then list is empty.
uint getNumNearTessBlocks () const
 get the number of Near TessBlocks. Actually OrderS/2*OrderT/2.
uint updateTessBlockLighting (uint numTb)
 recompute the near lightmap of tessBlock "numTb".

Dynamic Lighting Management



CPatchDLMContext_DLMContext
 The Dynamic LightMap context.
sint _DLMContextRefCount
 The reference count for DLMContext.
void beginDLMLighting ()
 begin Dynamic light Process.
void processDLMLight (CPatchDLMPointLight &pl)
 Process a Dynamic light, creating the DLMContext if necessary.
void endDLMLighting ()
 end Dynamic light Process, deleting the DLMContext if necessary.
void addRefDLMContext ()
 Add a ref count to the DLMContext, creating it if necessary.
void decRefDLMContext (uint count=1)
 Dec a ref count to the DLMContext, deleting it if refCount== 0.

Lumels methods



void unpackShadowMap (uint8 *pShadow)
 Unpack the lumels of the patches.
void packShadowMap (const uint8 *pLumel)
 Pack the lumels of the patches.
void resetCompressedLumels ()
 Rebuild the packed lumels without shadow.
void setupColorsFromTileFlags (const NLMISC::CRGBA colors[4])
 Debug purpose only : setup the colors of this patch so that it shows which tiles have vegetable disabled, or are above, below water.
void copyTileFlagsFromPatch (const CPatch *src)
 Set this patch flags from an other one.
uint32 countNumTriFar0 () const
uint32 countNumTriFar1 () const
void packLumelBlock (uint8 *dest, const uint8 *source, uint8 alpha0, uint8 alpha1)
 Pack a 4x4 lumel block.
uint evalLumelBlock (const uint8 *original, const uint8 *unCompressed, uint width, uint height)
 Eval an uncompressed 4x4 block against the original.
void unpackLumelBlock (uint8 *dest, const uint8 *src)
 Unpack a 4x4 lumel block.

Detailed Description

A landscape patch.

QuadPatch layout (same notations as 3ds Max SDK).

A---> ad ---- da <---D | | | | v v ab ia id dc

| | | |

ba ib ic cd ^ ^ | | | | B---> bc ---- cb <---C

NB: Patch 1x1 or 1xX are illegal: lot of problem: rectangular geomoprh, Son0 and Son1 must be setup as tile at beginning ...

NB: Edges number are:

Author:
Lionel Berenguier
Nevrax France
Date:
2000

Definition at line 296 of file patch.h.


Member Enumeration Documentation

Enumerator:
FVMasterBlock 
FVTessBlock 
FVTessBlockEdge 

Definition at line 926 of file patch.h.


Constructor & Destructor Documentation

NL3D::CPatch::CPatch (  ) 
NL3D::CPatch::~CPatch (  ) 

dtor

Definition at line 107 of file patch.cpp.

References release().


Member Function Documentation

void NL3D::CPatch::addPatchBlocksInBBox ( CPatchIdent  paId,
const CAABBox bbox,
std::vector< CPatchBlockIdent > &  paBlockIds 
) const

Add CPatchBlockIdent to CPatchBlockIdent array which intersect the bbox.

NB: this method use a convex hull subdivion to search in O(logn) what part of the patch to insert.

Parameters:
patchId the id of this patch, used to fill PatchBlockIdent.
bbox the bbox to test against.
paBlockIds array to be filled (no clear performed, elements added).

Definition at line 502 of file patch.cpp.

References addPatchBlocksInBBoxRecurs(), OrderS, OrderT, and unpackIntoCache().

Referenced by NL3D::CLandscape::addPatchBlocksInBBox().

void NL3D::CPatch::addPatchBlocksInBBoxRecurs ( CPatchIdent  paId,
const CAABBox bbox,
std::vector< CPatchBlockIdent > &  paBlockIds,
const CBezierPatch pa,
uint8  s0,
uint8  s1,
uint8  t0,
uint8  t1 
) const [private]
void NL3D::CPatch::addRefDLMContext (  )  [private]

Add a ref count to the DLMContext, creating it if necessary.

Definition at line 1947 of file patch_lightmap.cpp.

References _DLMContext, _DLMContextRefCount, fillVBFarsDLMUvOnly(), NL3D::CPatchDLMContext::generate(), getLandscape(), isRenderClipped(), nlassert, and Zone.

Referenced by appendTileMaterialToRenderList(), and processDLMLight().

void NL3D::CPatch::addRefTessBlocks (  )  [private]
void NL3D::CPatch::addTileLightmapEdgeWithTLI ( uint  ts,
uint  tt,
uint  edge,
NLMISC::CRGBA dest,
uint  stride,
bool  inverse 
) [private]
void NL3D::CPatch::addTileLightmapPixelWithTLI ( uint  ts,
uint  tt,
uint  s,
uint  t,
NLMISC::CRGBA dest 
) [private]
void NL3D::CPatch::addTileLightmapWithTLI ( uint  ts,
uint  tt,
NLMISC::CRGBA dest,
uint  stride 
) [private]
void NL3D::CPatch::addTileTrianglesInBBox ( CPatchIdent  paId,
const CAABBox bbox,
std::vector< CTrianglePatch > &  triangles,
uint8  tessLevel,
uint8  s0,
uint8  t0 
) const [private]

called by addTrianglesInBBoxRecurs().

effective fill the array of triangles from 1 tile at tile coordinates s0,t0. depending of tessLevel (0,1,2), 2, 8 or 32 triangles are added. (2*2m, 1*1*m or 0.5*0.5m). NB: only triangles of quad included in the bbox are added.

Definition at line 333 of file patch.cpp.

References computeVertex(), NLMISC::CAABBox::extend(), NLMISC::CAABBox::intersect(), nlassert, OrderS, OrderT, NL3D::CTrianglePatch::PatchId, NLMISC::CAABBox::setCenter(), NLMISC::CUV::U, NLMISC::CTriangleUV::Uv0, NLMISC::CTriangleUV::Uv1, NLMISC::CTriangleUV::Uv2, NLMISC::CUV::V, NLMISC::CTriangle::V0, NLMISC::CTriangle::V1, and NLMISC::CTriangle::V2.

Referenced by addTrianglesInBBoxRecurs().

void NL3D::CPatch::addTrianglesInBBox ( CPatchIdent  paId,
const CAABBox bbox,
std::vector< CTrianglePatch > &  triangles,
uint8  tileTessLevel 
) const

Add triangles to triangles array which intersect the bbox.

NB: this method use a convex hull subdivion to search in O(logn) what part of the patch to insert.

Parameters:
patchId the id of this patch, used to fill triangles.
bbox the bbox to test against.
triangles array to be filled (no clear performed, elements added).
tileTessLevel 0,1 or 2 size of the triangles (2*2m, 1*1m or 0.5*0.5m). Level of subdivision of a tile.

Definition at line 268 of file patch.cpp.

References addTrianglesInBBoxRecurs(), OrderS, OrderT, and unpackIntoCache().

Referenced by NL3D::CLandscape::addTrianglesInBBox().

void NL3D::CPatch::addTrianglesInBBoxRecurs ( CPatchIdent  paId,
const CAABBox bbox,
std::vector< CTrianglePatch > &  triangles,
uint8  tessLevel,
const CBezierPatch pa,
uint8  s0,
uint8  s1,
uint8  t0,
uint8  t1 
) const [private]

recurse subdivide of the bezierPatch.

3 1st parameters are the parameter of addTrianglesInBBox().
pa is the bezier patch for this subdivision of this patch.
s0, s1, t0, t1 represent the part of the bezier patch subdivided. At start, s0=0, s1=OrderS, t0=0, t1=OrderT.

Definition at line 278 of file patch.cpp.

References addTileTrianglesInBBox(), buildBBoxFromBezierPatch(), NLMISC::CAABBox::intersect(), nlassert, NL3D::CBezierPatch::subdivideS(), and NL3D::CBezierPatch::subdivideT().

Referenced by addTrianglesInBBox().

void NL3D::CPatch::allocateVBAndFaceVector (  ) 
void NL3D::CPatch::allocateVBAndFaceVectorFar1Only (  ) 
void NL3D::CPatch::appendFaceToRenderList ( CTessFace face  )  [private]
void NL3D::CPatch::appendFaceToTileRenderList ( CTessFace face  )  [private]
void NL3D::CPatch::appendFarVertexToRenderList ( CTessFarVertex fv  )  [private]
void NL3D::CPatch::appendNearVertexToRenderList ( CTileMaterial tileMat,
CTessNearVertex nv 
) [private]
void NL3D::CPatch::appendTessellationLeaves ( std::vector< const CTessFace * > &  leaves  )  const

From the current tesselation of this patch, append to the list of leaves faces.

Definition at line 2198 of file patch.cpp.

References NL3D::CTessFace::appendTessellationLeaves(), nlassert, Son0, and Son1.

Referenced by NL3D::CLandscape::getTessellationLeaves().

void NL3D::CPatch::appendTileLightInfluences ( const CUV uv,
std::vector< CPointLightInfluence > &  pointLightList 
) const
void NL3D::CPatch::appendTileMaterialToRenderList ( CTileMaterial tm  )  [private]
void NL3D::CPatch::averageTesselationVertices (  ) 
void NL3D::CPatch::beginDLMLighting (  ) 

begin Dynamic light Process.

reset texture To Black (if needed) Called by CLandscape. _DLMContext must exist

Definition at line 2002 of file patch_lightmap.cpp.

References _DLMContext, NL3D::CPatchDLMContext::clearLighting(), NL3D::CPatchDLMContext::CurPointLightCount, isRenderClipped(), nlassert, and NL3D::CPatchDLMContext::OldPointLightCount.

Referenced by NL3D::CLandscape::computeDynamicLighting().

void NL3D::CPatch::bind ( CBindInfo  Edges[4],
bool  rebind 
)
CAABBox NL3D::CPatch::buildBBox (  )  const

Build the bbox of the patch, according to ctrl points, and displacement map max value.

Definition at line 255 of file patch.cpp.

References buildBBoxFromBezierPatch(), and unpackIntoCache().

Referenced by NL3D::CLandscape::addZone(), and NL3D::CZone::compile().

void NL3D::CPatch::buildBBoxFromBezierPatch ( const CBezierPatch p,
CAABBox ret 
) const [private]
void NL3D::CPatch::changeEdgeNeighbor ( sint  edge,
CTessFace to 
) [private]

Definition at line 1810 of file patch.cpp.

References NL3D::CTessFace::FLeft, NL3D::CTessFace::FRight, nlassert, OrderS, OrderT, Son0, and Son1.

Referenced by bind().

void NL3D::CPatch::checkCreateVertexVBFar ( CTessFarVertex pVert  )  [private]
void NL3D::CPatch::checkCreateVertexVBNear ( CTessNearVertex pVert  )  [private]
void NL3D::CPatch::checkDeleteVertexVBFar ( CTessFarVertex pVert  )  [private]
void NL3D::CPatch::checkDeleteVertexVBNear ( CTessNearVertex pVert  )  [private]
void NL3D::CPatch::checkFillVertexVBFar ( CTessFarVertex pVert  )  [private]
void NL3D::CPatch::checkFillVertexVBNear ( CTessNearVertex pVert  )  [private]
void NL3D::CPatch::clearTessBlocks (  )  [private]
void NL3D::CPatch::compile ( CZone z,
uint  patchId,
uint8  orderS,
uint8  orderT,
CTessVertex baseVertices[4],
float  errorSize = 0 
)

compile a valid patch.

(init) Call this method before any other. Zone and Control points must be valid before calling compile().
This is an ERROR to call compile() two times.

Parameters:
z zone where the patch must be binded.
orderS the Tile order in S direction: 2,4,8,16.
orderT the Tile order in T direction: 2,4,8,16.
errorSize if 0, setup() compute himself the errormetric of the patch. May be setup to surface of patch, modulated by tangents and displacement map.

Definition at line 1288 of file patch.cpp.

References _ULNearNext, _ULNearPrec, BaseVertices, computeDefaultErrorSize(), ErrorSize, NLMISC::getPowerOf2(), NL3D::CTessBlock::init(), makeRoots(), MasterBlock, min, nlassert, OrderS, OrderT, PatchId, SquareLimitLevel, TessBlockLimitLevel, TileLimitLevel, and Zone.

Referenced by NL3D::CZone::compile().

CVector NL3D::CPatch::computeContinousVertex ( float  s,
float  t 
) const

Same as computeVertex, but special accurate version for CVisualCollisionEntity.

If on a corner of the patch (0,0), (0,1) ...., take directly the BaseVertices[] result if on a border of a patch (ie s==0, s==1, t==0 or t==1), also compute the vertex of the neighbor patch (if any), and then average the result. This ensure that tesselation generated is perfectly continous, even across patchs of same or different zones. This feature is very important for CVisualCollisionEntity::snapToGround()

Definition at line 1368 of file patch.cpp.

References BaseVertices, NL3D::CPatchUVLocator::build(), computeVertex(), computeVertexButCorner(), NL3D::CTessVertex::EndPos, getBindNeighbor(), getOrderS(), getOrderT(), NL3D::CPatchUVLocator::locateUV(), nlassert, nlstop, NLMISC::CVector::Null, NL3D::CPatchUVLocator::selectPatch(), NLMISC::CVector2f::x, NLMISC::CVector2f::y, NL3D::CPatch::CBindInfo::Zone, and Zone.

Referenced by fillPatchQuadBlock().

void NL3D::CPatch::computeCurrentTLILightmapDiv2 ( NLMISC::CRGBA array  )  const

For CTextureFar, compute current TLI Lightmap at tile level.

array should be allocated of at least sqr(NL_MAX_TILES_BY_PATCH_EDGE+1).

Definition at line 1802 of file patch_lightmap.cpp.

References NLMISC::CRGBA::B, NLMISC::CRGBA::G, getCurrentTLIColor(), OrderS, OrderT, and NLMISC::CRGBA::R.

Referenced by NL3D::CTextureFar::rebuildPatch().

void NL3D::CPatch::computeDefaultErrorSize (  )  [private]

Definition at line 204 of file patch.cpp.

References ErrorSize, unpackIntoCache(), and NL3D::CBezierPatch::Vertices.

Referenced by compile().

float NL3D::CPatch::computeDisplaceCornerSmooth ( float  s,
float  t,
sint8  smoothBorderX,
sint8  smoothBorderY 
) const [private]
float NL3D::CPatch::computeDisplaceEdgeSmooth ( float  s,
float  t,
sint8  smoothBorderX,
sint8  smoothBorderY 
) const [private]
float NL3D::CPatch::computeDisplaceInteriorSmooth ( float  s,
float  t 
) const [private]

compute the smoothed displacement for s,t ([0;OrderS], [0;OrderT]).

Definition at line 256 of file patch_noise.cpp.

References NL3D::computeDisplaceBilinear(), computeDisplaceRawCoordinates(), and computeDisplaceRawInteger().

Referenced by computeDisplaceCornerSmooth(), computeDisplaceEdgeSmooth(), and computeNoise().

float NL3D::CPatch::computeDisplaceRaw ( float  sTile,
float  tTile,
float  s,
float  t 
) const [private]

compute the displacement for s,t ([0;OrderS], [0;OrderT]) (sTile, tTile) choose what NoiseMap to use, and (s,t) choose the coordinate in the patch to compute this NoiseMap.

Any rotation of the NoiseMap is included in this method. NB: s,t does not have to be clamped to ([0;OrderS], [0;OrderT]).

Definition at line 217 of file patch_noise.cpp.

References computeDisplaceRawCoordinates(), and computeDisplaceRawInteger().

Referenced by computeDisplaceCornerSmooth(), computeDisplaceEdgeSmooth(), and computeDisplaceRawOnNeighbor().

void NL3D::CPatch::computeDisplaceRawCoordinates ( float  sTile,
float  tTile,
float  s,
float  t,
sint ts,
sint tt,
sint ms,
sint mt 
) const [private]
float NL3D::CPatch::computeDisplaceRawInteger ( sint  ts,
sint  tt,
sint  ms,
sint  mt 
) const [private]
float NL3D::CPatch::computeDisplaceRawOnNeighbor ( float  sTile,
float  tTile,
float  s,
float  t 
) const [private]
void NL3D::CPatch::computeGeomorphAlphaFar1VertexListVB ( CTessList< CTessFarVertex > &  vertList  )  [private]
void NL3D::CPatch::computeGeomorphFar0VertexListVB ( CTessList< CTessFarVertex > &  vertList  )  [private]
void NL3D::CPatch::computeGeomorphTileVertexListVB ( CTessList< CTessNearVertex > &  vertList  )  [private]
void NL3D::CPatch::computeGeomorphVertexList ( CTessList< CTessFarVertex > &  vertList  )  [private]
void NL3D::CPatch::computeNearBlockLightmap ( uint  ts,
uint  tt,
NLMISC::CRGBA lightText 
) [private]
void NL3D::CPatch::computeNewFar ( const NLMISC::CBSphere patchSphere,
sint newFar0,
sint newFar1 
) [private]
void NL3D::CPatch::computeNoise ( float  s,
float  t,
CVector displace 
) const [private]

compute the Final displacement for s,t ([0;1], [0;1]).

This is the top call. displace.norm() should be <= NL3D_NOISE_MAX.

Definition at line 872 of file patch_noise.cpp.

References computeDisplaceCornerSmooth(), computeDisplaceEdgeSmooth(), computeDisplaceInteriorSmooth(), computeNormalCornerSmooth(), computeNormalEdgeSmooth(), NL3D::CBezierPatch::evalNormal(), OrderS, OrderT, and unpackIntoCache().

Referenced by computeVertex().

CVector NL3D::CPatch::computeNormalCornerSmooth ( float  s,
float  t,
sint8  smoothBorderX,
sint8  smoothBorderY 
) const [private]
CVector NL3D::CPatch::computeNormalEdgeSmooth ( float  s,
float  t,
sint8  smoothBorderX,
sint8  smoothBorderY 
) const [private]
CVector NL3D::CPatch::computeNormalOnNeighbor ( float  s,
float  t,
uint  edgeExclude 
) const [private]
void NL3D::CPatch::computeSoftwareGeomorphAndAlpha (  ) 
void NL3D::CPatch::computeTbTm ( uint numtb,
uint numtm,
uint  ts,
uint  tt 
) [private]
void NL3D::CPatch::computeTileLightmap ( uint  ts,
uint  tt,
NLMISC::CRGBA dest,
uint  stride 
) [private]
void NL3D::CPatch::computeTileLightmapAutomatic ( uint  ts,
uint  tt,
NLMISC::CRGBA dest,
uint  stride 
) [private]

Definition at line 554 of file patch_lightmap.cpp.

References computeTileLightmapPixelAutomatic(), and NL_LUMEL_BY_TILE.

Referenced by computeTileLightmap().

void NL3D::CPatch::computeTileLightmapEdge ( uint  ts,
uint  tt,
uint  edge,
NLMISC::CRGBA dest,
uint  stride,
bool  inverse 
) [private]
void NL3D::CPatch::computeTileLightmapEdgeAutomatic ( uint  ts,
uint  tt,
uint  edge,
NLMISC::CRGBA dest,
uint  stride,
bool  inverse 
) [private]

Definition at line 568 of file patch_lightmap.cpp.

References computeTileLightmapPixelAutomatic(), and NL_LUMEL_BY_TILE.

Referenced by computeTileLightmapEdge().

void NL3D::CPatch::computeTileLightmapEdgePrecomputed ( uint  ts,
uint  tt,
uint  edge,
NLMISC::CRGBA dest,
uint  stride,
bool  inverse 
) [private]
void NL3D::CPatch::computeTileLightmapPixel ( uint  ts,
uint  tt,
uint  s,
uint  t,
NLMISC::CRGBA dest 
) [private]
void NL3D::CPatch::computeTileLightmapPixelAroundCorner ( const NLMISC::CVector2f stIn,
NLMISC::CRGBA dest,
bool  lookAround 
) [private]
void NL3D::CPatch::computeTileLightmapPixelAutomatic ( uint  ts,
uint  tt,
uint  s,
uint  t,
NLMISC::CRGBA dest 
) [private]
void NL3D::CPatch::computeTileLightmapPixelPrecomputed ( uint  ts,
uint  tt,
uint  s,
uint  t,
NLMISC::CRGBA dest 
) [private]
void NL3D::CPatch::computeTileLightmapPrecomputed ( uint  ts,
uint  tt,
NLMISC::CRGBA dest,
uint  stride 
) [private]
CVector NL3D::CPatch::computeVertex ( float  s,
float  t 
) const
CVector NL3D::CPatch::computeVertexButCorner ( float  s,
float  t,
bool onCorner 
) const [private]
void NL3D::CPatch::copyTileFlagsFromPatch ( const CPatch src  ) 

Set this patch flags from an other one.

The patchs must match

Definition at line 2267 of file patch.cpp.

References nlassert, OrderS, OrderT, and Tiles.

Referenced by NL3D::CZone::copyTilesFlags().

uint32 NL3D::CPatch::countNumTriFar0 (  )  const
uint32 NL3D::CPatch::countNumTriFar1 (  )  const
void NL3D::CPatch::createFaceVectorFar0OrTile (  )  [private]
void NL3D::CPatch::createFaceVectorFar1 (  )  [private]
void NL3D::CPatch::createVegetableBlock ( uint  numTb,
uint  ts,
uint  tt 
) [private]
void NL3D::CPatch::debugAllocationMarkIndices ( uint  marker  ) 
void NL3D::CPatch::debugAllocationMarkIndicesFarList ( CTessList< CTessFarVertex > &  vertList,
uint  marker 
) [private]
void NL3D::CPatch::debugAllocationMarkIndicesNearList ( CTessList< CTessNearVertex > &  vertList,
uint  marker 
) [private]
void NL3D::CPatch::decRefDLMContext ( uint  count = 1  )  [private]

Dec a ref count to the DLMContext, deleting it if refCount== 0.

Definition at line 1974 of file patch_lightmap.cpp.

References _DLMContext, _DLMContextRefCount, fillVBFarsDLMUvOnly(), isRenderClipped(), nlassert, and Zone.

Referenced by endDLMLighting(), and removeTileMaterialFromRenderList().

void NL3D::CPatch::decRefTessBlocks (  )  [private]
void NL3D::CPatch::deleteAllVegetableIgs (  ) 
void NL3D::CPatch::deleteFaceVectorFar0OrTile (  )  [private]
void NL3D::CPatch::deleteFaceVectorFar1 (  )  [private]
void NL3D::CPatch::deleteTileUvs (  ) 

Definition at line 2164 of file patch.cpp.

References NL3D::CTessFace::deleteTileUvs(), Son0, and Son1.

void NL3D::CPatch::deleteVBAndFaceVector (  ) 
void NL3D::CPatch::deleteVBAndFaceVectorFar1Only (  ) 
void NL3D::CPatch::dirtTessBlockFaceVector ( CTessBlock block  )  [private]
void NL3D::CPatch::endDLMLighting (  ) 

end Dynamic light Process, deleting the DLMContext if necessary.

NB: _DLMContext->compileLighting() is not called, since done during render phase. Called by CLandscape. _DLMContext must exist

Definition at line 2032 of file patch_lightmap.cpp.

References _DLMContext, decRefDLMContext(), nlassert, and NL3D::CPatchDLMContext::OldPointLightCount.

Referenced by NL3D::CLandscape::computeDynamicLighting().

uint NL3D::CPatch::evalLumelBlock ( const uint8 original,
const uint8 unCompressed,
uint  width,
uint  height 
) [private]

Eval an uncompressed 4x4 block against the original.

See also:
packShadowMap(), unpackShadowMap()

Definition at line 242 of file patch_lightmap.cpp.

Referenced by packShadowMap().

void NL3D::CPatch::extendTessBlockWithEndPos ( CTessFace face  )  [private]
void NL3D::CPatch::fillFar0DLMUvOnlyVertexListVB ( CTessList< CTessFarVertex > &  vertList  ) 
void NL3D::CPatch::fillFar0VertexListVB ( CTessList< CTessFarVertex > &  vertList  )  [private]
void NL3D::CPatch::fillFar0VertexVB ( CTessFarVertex pVert  )  [inline, private]
void NL3D::CPatch::fillFar1DLMUvOnlyVertexListVB ( CTessList< CTessFarVertex > &  vertList  ) 
void NL3D::CPatch::fillFar1VertexListVB ( CTessList< CTessFarVertex > &  vertList  )  [private]
void NL3D::CPatch::fillFar1VertexVB ( CTessFarVertex pVert  )  [inline, private]
void NL3D::CPatch::fillPatchQuadBlock ( CPatchQuadBlock quadBlock  )  const
void NL3D::CPatch::fillTileVertexListVB ( CTessList< CTessNearVertex > &  vertList  )  [private]

Definition at line 1255 of file patch_render.cpp.

References NL3D::CTessList< T >::begin(), fillTileVertexVB(), and NL3D::CTessNodeList::Next.

Referenced by fillVB(), and preRender().

void NL3D::CPatch::fillTileVertexVB ( CTessNearVertex pVert  )  [inline, private]
void NL3D::CPatch::fillVB (  ) 
void NL3D::CPatch::fillVBFar0Only (  ) 
void NL3D::CPatch::fillVBFar1Only (  ) 
void NL3D::CPatch::fillVBFarsDLMUvOnly (  ) 
void NL3D::CPatch::fillVBIfVisible (  ) 

Definition at line 1318 of file patch_render.cpp.

References fillVB(), and isRenderClipped().

Referenced by NL3D::CLandscape::render().

void NL3D::CPatch::forceMergeAtTileLevel (  ) 

For changing TileMaxSubdivision. force tesselation to be under tile.

Definition at line 2044 of file patch.cpp.

References NL3D::CTessFace::forceMergeAtTileLevel(), nlassert, Son0, and Son1.

Referenced by NL3D::CZone::forceMergeAtTileLevel().

void NL3D::CPatch::generateTileVegetable ( CVegetableInstanceGroup vegetIg,
uint  distType,
uint  ts,
uint  tt,
CLandscapeVegetableBlockCreateContext vbCreateCtx 
) [private]

Definition at line 48 of file patch_vegetable.cpp.

References _DLMContext, NL3D::CLandscape::_VegetableManager, NLMISC::CRGBAF::A, appendTileLightInfluences(), NLMISC::CRGBAF::B, NLMISC::clamp(), NL3D::CPointLight::computeLinearAttenuation(), NLMISC::contReset(), NL3D::CPatchDLMContext::DLMUBias, NL3D::CPatchDLMContext::DLMUScale, NL3D::CPatchDLMContext::DLMVBias, NL3D::CPatchDLMContext::DLMVScale, NL3D::CLandscapeVegetableBlockCreateContext::eval(), NL3D::CBezierPatch::eval(), NL3D::CBezierPatch::evalNormal(), NLMISC::CRGBAF::G, NL3D::CVegetable::generateGroupBiLinear(), NL3D::CVegetable::generateInstance(), getLandscape(), NL3D::CPointLight::getPosition(), getTileLumelmapPrecomputed(), NL3D::CLandscape::getTileVegetableDesc(), NL3D::CTileVegetableDesc::getVegetableList(), NL3D::CTileVegetableDesc::getVegetableSeed(), NLMISC::CVector::I, NLMISC::CVector::J, NL3D::CVegetableLightEx::MaxNumLight, NL3D::CPatchDLMContext::MaxU8, NL3D::CPatchDLMContext::MaxV8, min, NL3D::CPatchDLMContext::MinU8, NL3D::CPatchDLMContext::MinV8, NL3D_PATCH_TILE_AREA, NL3D_VEGETABLE_BLOCK_ELTDIST, NL_LUMEL_BY_TILE, NL_LUMEL_BY_TILE_SHIFT, NL_TILE_ELM_LAYER_EMPTY, nlassert, NLMISC::CVector::normalize(), NLMISC::CMatrix::normalize(), NL3D::CVegetableLightEx::NumLights, NLMISC::OptFastFloor(), OrderS, OrderT, NLMISC::CRGBAF::R, NL3D::CVegetable::reserveIgAddInstances(), NL3D::CVegetableManager::reserveIgCompile(), NLMISC::CMatrix::setPos(), NLMISC::CMatrix::setRot(), Tiles, NL3D::CVegetableUV8::U, NLMISC::CUV::U, unpackIntoCache(), NL3D::CVegetableUV8::V, NLMISC::CUV::V, NL3D::CTileElement::VegetableDisabled, NL3D::CVegetableInstanceGroup::VegetableLightEx, NLMISC::CVector::x, NLMISC::CVector::y, NLMISC::CMatrix::ZXY, and NLMISC::CMatrix::ZYX.

Referenced by NL3D::CLandscapeVegetableBlock::createVegetableIGForDistType().

void NL3D::CPatch::getBindNeighbor ( uint  edge,
CBindInfo neighborEdge 
) const
bool NL3D::CPatch::getCornerSmoothFlag ( uint  corner  )  const
const CTessVertex* NL3D::CPatch::getCornerVertex ( uint  corner  )  [inline]

Definition at line 652 of file patch.h.

References BaseVertices.

Referenced by NL3D::CZoneCornerSmoother::computeAllCornerSmoothFlags().

void NL3D::CPatch::getCurrentTileTLIColors ( uint  ts,
uint  tt,
NLMISC::CRGBA  corners[4] 
) [private]
CRGBA NL3D::CPatch::getCurrentTLIColor ( uint  x,
uint  y 
) const [private]
float NL3D::CPatch::getErrorSize (  )  const [inline]

Definition at line 384 of file patch.h.

References ErrorSize.

sint NL3D::CPatch::getFar0 (  )  const [inline]

Definition at line 385 of file patch.h.

References Far0.

Referenced by NL3D::CLandscape::render().

sint NL3D::CPatch::getFar1 (  )  const [inline]

Definition at line 386 of file patch.h.

References Far1.

Referenced by NL3D::CLandscape::render().

CLandscape * NL3D::CPatch::getLandscape (  )  const
uint8 NL3D::CPatch::getLumel ( const CUV uv  )  const
CPatch* NL3D::CPatch::getNextFar0ToRdr (  )  const [inline]

Definition at line 454 of file patch.h.

References _NextRdrFar0.

Referenced by NL3D::countNumWantedIndexFar0(), and NL3D::CLandscape::render().

CPatch* NL3D::CPatch::getNextFar1ToRdr (  )  const [inline]

Definition at line 456 of file patch.h.

References _NextRdrFar1.

Referenced by NL3D::countNumWantedIndexFar1(), and NL3D::CLandscape::render().

CPatch* NL3D::CPatch::getNextNearUL (  )  const [inline]

For lighting update, get Next (CiruclarList). If ==this, then list is empty.

Definition at line 743 of file patch.h.

References _ULNearNext.

Referenced by NL3D::CLandscape::unlinkPatchFromNearUL(), and NL3D::CLandscape::updateLightingTextureNear().

uint NL3D::CPatch::getNumNearTessBlocks (  )  const [inline]

get the number of Near TessBlocks. Actually OrderS/2*OrderT/2.

Definition at line 746 of file patch.h.

References NLMISC::CObjectVector< T, EnableObjectBehavior >::size(), and TessBlocks.

Referenced by NL3D::CLandscape::updateLightingTextureNear().

void NL3D::CPatch::getNumTessBlock ( CParamCoord  pc,
TFarVertType type,
uint numtb 
) [private]
uint NL3D::CPatch::getNumTessBlock ( CTessFace face  )  [private]
uint8 NL3D::CPatch::getOrderForEdge ( sint8  edge  )  const

Definition at line 2218 of file patch.cpp.

References OrderS, and OrderT.

Referenced by NL3D::CPatchUVLocator::build().

uint8 NL3D::CPatch::getOrderS (  )  const [inline]
uint8 NL3D::CPatch::getOrderT (  )  const [inline]
uint16 NL3D::CPatch::getPatchId (  )  const [inline]
CTessFace * NL3D::CPatch::getRootFaceForEdge ( sint  edge  )  const [private]

Definition at line 1756 of file patch.cpp.

References nlassert, OrderS, OrderT, Son0, and Son1.

Referenced by bind().

CTessVertex * NL3D::CPatch::getRootVertexForEdge ( sint  edge  )  const [private]

Definition at line 1778 of file patch.cpp.

References nlassert, OrderS, OrderT, Son0, Son1, NL3D::CTessFace::VBase, NL3D::CTessFace::VLeft, and NL3D::CTessFace::VRight.

Referenced by bind().

bool NL3D::CPatch::getSmoothFlag ( uint  edge  )  const [inline]

Get the smooth flag for the n-th edge.

Return true if this edge must by smoothed, false else.

Definition at line 572 of file patch.h.

References Flags, and NL_PATCH_SMOOTH_FLAG_SHIFT.

Referenced by NL3D::CZoneCornerSmoother::buildPatchBindInfo(), computeNearBlockLightmap(), computeNormalEdgeSmooth(), and NL3D::CZoneLighter::getNormal().

CVector NL3D::CPatch::getTesselatedPos ( CUV  uv  )  const

From the current tesselation of this patch, and a UV in this patch, return tesselated position.

Definition at line 577 of file patch.cpp.

References NLMISC::clamp(), NL3D::CTessFace::getTesselatedPos(), NLMISC::CVector::Null, Son0, Son1, NLMISC::CUV::U, and NLMISC::CUV::V.

Referenced by NL3D::CLandscape::getTesselatedPos().

CTileElement * NL3D::CPatch::getTileElement ( const CUV uv  ) 

Get the lumel under the position.

Definition at line 2287 of file patch.cpp.

References NLMISC::clamp(), NLMISC::OptFastFloor(), OrderS, OrderT, Tiles, NLMISC::CUV::U, and NLMISC::CUV::V.

Referenced by NL3D::CLandscape::getTileElement().

void NL3D::CPatch::getTileLightMap ( uint  ts,
uint  tt,
CPatchRdrPass *&  rdrpass 
) [private]
void NL3D::CPatch::getTileLightMapUvInfo ( uint  ts,
uint  tt,
CVector uvScaleBias 
) [private]
void NL3D::CPatch::getTileLumelmapPixelPrecomputed ( uint  ts,
uint  tt,
uint  s,
uint  t,
uint8 dest 
) const [private]

same as computeTileLightmapPixelPrecomputed, but brut result, not modified by colorTable.

Actually used for Lightmap get interface.

Definition at line 667 of file patch_lightmap.cpp.

References CompressedLumels, NL3D::getUnpackLumelBlock(), NL_BLOCK_LUMEL_COMPRESSED_SIZE, and OrderS.

Referenced by getLumel().

void NL3D::CPatch::getTileLumelmapPrecomputed ( uint  ts,
uint  tt,
uint8 dest,
uint  stride 
) [private]
uint NL3D::CPatch::getTileMaterialRefCount (  )  const [inline]

Get number of TileMaterial created in this Patch.

Definition at line 781 of file patch.h.

References MasterBlock, and NL3D::CTessBlock::TileMaterialRefCount.

Referenced by NL3D::CLandscape::render().

CPatchRdrPass * NL3D::CPatch::getTileRenderPass ( sint  tileId,
sint  pass 
) [private]
void NL3D::CPatch::getTileTileColors ( uint  ts,
uint  tt,
NLMISC::CRGBA  corners[4] 
) [private]
void NL3D::CPatch::getTileUvInfo ( sint  tileId,
sint  pass,
bool  alpha,
uint8 orient,
CVector uvScaleBias,
bool is256x256,
uint8 uvOff 
) [private]
CZone* NL3D::CPatch::getZone (  )  const [inline]
bool NL3D::CPatch::isRenderClipped (  )  const
void NL3D::CPatch::linkBeforeNearUL ( CPatch patchNext  ) 

For lighting update, insert this before patchNext (CiruclarList). textNext must be !NULL.

Definition at line 1877 of file patch_lightmap.cpp.

References _ULNearNext, _ULNearPrec, and nlassert.

Referenced by NL3D::CLandscape::linkPatchToNearUL().

CTessFace * NL3D::CPatch::linkTessFaceWithEdge ( const NLMISC::CVector2f uv0,
const NLMISC::CVector2f uv1,
CTessFace linkTo 
) [private]

Used by bind().

Search in the tesselation the first face which own the edge uv0-uv1. link it with linkTo, and return it. NULL if not found (obviously because not so tesselated)

Definition at line 1839 of file patch.cpp.

References NL3D::CTessFace::linkTessFaceWithEdge(), nlassert, Son0, and Son1.

Referenced by bind().

void NL3D::CPatch::makeRoots (  )  [private]
void NL3D::CPatch::modulateTileLightmapEdgeWithTileColors ( uint  ts,
uint  tt,
uint  edge,
NLMISC::CRGBA dest,
uint  stride,
bool  inverse 
) [private]
void NL3D::CPatch::modulateTileLightmapPixelWithTileColors ( uint  ts,
uint  tt,
uint  s,
uint  t,
NLMISC::CRGBA dest 
) [private]
void NL3D::CPatch::modulateTileLightmapWithTileColors ( uint  ts,
uint  tt,
NLMISC::CRGBA dest,
uint  stride 
) [private]
void NL3D::CPatch::packLumelBlock ( uint8 dest,
const uint8 source,
uint8  alpha0,
uint8  alpha1 
) [private]
void NL3D::CPatch::packShadowMap ( const uint8 pLumel  ) 

Pack the lumels of the patches.

Lumels are classes that describe the lighting environnement at a given texel of the lightmap. It is used to compute the shadow map of the patch, compress it and uncompress it. This method compress the lumels passed in parameter and stored them in its Lumels member.

Parameters:
pShadow is a pointer on the destination lumel buffer. Size must be (OrderS*4+1)*(OrderS*4+1).
See also:
unpackShadowMap(), resetCompressedLumels()

Definition at line 1264 of file patch_lightmap.cpp.

References CompressedLumels, evalLumelBlock(), NL_BLOCK_LUMEL_COMPRESSED_SIZE, NL_LUMEL_BY_TILE, nlassert, OrderS, OrderT, packLumelBlock(), and unpackLumelBlock().

Referenced by NL3D::CZone::build().

void NL3D::CPatch::preRender ( const NLMISC::CBSphere patchSphere  ) 
void NL3D::CPatch::processDLMLight ( CPatchDLMPointLight pl  ) 

Process a Dynamic light, creating the DLMContext if necessary.

Increment RefCount. Called by CLandscape.

Definition at line 2018 of file patch_lightmap.cpp.

References _DLMContext, NL3D::CPatchDLMContext::addPointLightInfluence(), addRefDLMContext(), NL3D::CPatchDLMContext::CurPointLightCount, and isRenderClipped().

void NL3D::CPatch::recreateAllVegetableIgs (  ) 
void NL3D::CPatch::recreateTessBlockFaceVector ( CTessBlock block  ) 
void NL3D::CPatch::recreateTileUvs (  ) 
void NL3D::CPatch::refineAll (  ) 

Refine this patch. Even if clipped. Refine all nodes.

Definition at line 1498 of file patch.cpp.

References nlassert, NL3D::CTessFace::refineAll(), Son0, and Son1.

Referenced by NL3D::CZone::refineAll().

void NL3D::CPatch::refreshTesselationGeometry (  ) 
void NL3D::CPatch::release ( void   ) 
void NL3D::CPatch::releaseTileLightMap ( uint  ts,
uint  tt 
) [private]
void NL3D::CPatch::releaseVegetableBlock ( uint  numTb  )  [private]

release the vegetableBlock in the corresponding TessBlock. TessBlocks must exist

Definition at line 338 of file patch_vegetable.cpp.

References getLandscape(), and TessBlocks.

Referenced by deleteAllVegetableIgs(), and removeTileMaterialFromRenderList().

void NL3D::CPatch::removeFaceFromRenderList ( CTessFace face  )  [private]
void NL3D::CPatch::removeFaceFromTileRenderList ( CTessFace face  )  [private]
void NL3D::CPatch::removeFarVertexFromRenderList ( CTessFarVertex fv  )  [private]
void NL3D::CPatch::removeNearVertexFromRenderList ( CTileMaterial tileMat,
CTessNearVertex nv 
) [private]
void NL3D::CPatch::removeTileMaterialFromRenderList ( CTileMaterial tm  )  [private]
void NL3D::CPatch::renderFar0 (  ) 
void NL3D::CPatch::renderFar1 (  ) 
void NL3D::CPatch::resetCompressedLumels (  ) 

Rebuild the packed lumels without shadow.

Only the interpolated color will be used.

See also:
packShadowMap(), unpackShadowMap()

Definition at line 1381 of file patch_lightmap.cpp.

References CompressedLumels, NL_LUMEL_BY_TILE, nlassert, OrderS, and OrderT.

Referenced by NL3D::CZone::build().

void NL3D::CPatch::resetMasterBlock (  )  [private]
void NL3D::CPatch::resetRenderFar (  ) 
void NL3D::CPatch::resetTileLightInfluences (  ) 

make a valid empty array of TileLightInfluences (ie resized to good size, but with empty light influences

Definition at line 1526 of file patch_lightmap.cpp.

References OrderS, OrderT, and TileLightInfluences.

Referenced by NL3D::CZone::build(), NL3D::CLandscape::removeAllPointLights(), and serial().

void NL3D::CPatch::serial ( NLMISC::IStream f  ) 
void NL3D::CPatch::setCornerSmoothFlag ( uint  corner,
bool  smooth 
)

setup Smooth flags for Noise on corner: used for Noise geometry and for lighting.

NB: convention: corner0==A, corner1==B ...

Definition at line 949 of file patch_noise.cpp.

References _CornerSmoothFlag, and nlassert.

Referenced by NL3D::CZone::build(), and NL3D::CZoneCornerSmoother::computeAllCornerSmoothFlags().

void NL3D::CPatch::setSmoothFlag ( uint  edge,
bool  flag 
) [inline]

Set the smooth flag for the n-th edge.

flag is false if this edge must by smoothed, true else.

Definition at line 560 of file patch.h.

References Flags, and NL_PATCH_SMOOTH_FLAG_SHIFT.

void NL3D::CPatch::setupColorsFromTileFlags ( const NLMISC::CRGBA  colors[4]  ) 

Debug purpose only : setup the colors of this patch so that it shows which tiles have vegetable disabled, or are above, below water.

debug coloring

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 2253 of file patch.cpp.

References min, OrderS, OrderT, TileColors, and Tiles.

void NL3D::CPatch::unbind (  ) 

unbind the patch from All neighbors.

neighbors patchs links are modified too. The tesselation is forcemerged.

Definition at line 1729 of file patch.cpp.

References _BindZoneNeighbor, NL3D::CTessFace::FLeft, NL3D::CTessFace::forceMerge(), NL3D::CTessFace::FRight, NL3D::CTessFace::isLeaf(), nlassert, Son0, Son1, and NL3D::CTessFace::unbind().

Referenced by NL3D::CZone::bindPatch(), and NL3D::CZone::unbindPatch().

void NL3D::CPatch::unlinkNearUL (  ) 

For lighting update, unlink (CiruclarList).

Definition at line 1894 of file patch_lightmap.cpp.

References _ULNearNext, and _ULNearPrec.

Referenced by NL3D::CLandscape::unlinkPatchFromNearUL().

void NL3D::CPatch::unpack ( CBezierPatch p  )  const
CBezierPatch * NL3D::CPatch::unpackIntoCache (  )  const
void NL3D::CPatch::unpackLumelBlock ( uint8 dest,
const uint8 src 
) [private]

Unpack a 4x4 lumel block.

See also:
packShadowMap(), unpackShadowMap()

Definition at line 68 of file patch_lightmap.cpp.

References NLMISC::n.

Referenced by computeTileLightmapPrecomputed(), getTileLumelmapPrecomputed(), packShadowMap(), and unpackShadowMap().

void NL3D::CPatch::unpackShadowMap ( uint8 pShadow  ) 

Unpack the lumels of the patches.

Lumels are classes that describe the lighting environnement at a given texel of the lightmap. It is used to compute the shadow map of the patch, compress it and uncompress it. This method uncompress the lumels stored in its Lumels member.

Parameters:
pShadow is a pointer on the destination lumel buffer. Size must be ((OrderS*4/ratio)+1)*((OrderT*4/ratio)+1).
ratio is the one over the ratio of the texture destination. Must be 1 or 2.
See also:
packShadowMap(), resetCompressedLumels()

Definition at line 168 of file patch_lightmap.cpp.

References CompressedLumels, NL_BLOCK_LUMEL_COMPRESSED_SIZE, NL_LUMEL_BY_TILE, nlassert, OrderS, OrderT, and unpackLumelBlock().

Referenced by NL3D::CTextureFar::rebuildPatch(), and NL3D::CZone::retrieve().

void NL3D::CPatch::updateClipPatchVB ( bool  renderClipped  ) 
void NL3D::CPatch::updateFar0VBAlloc ( CTessList< CTessFarVertex > &  vertList,
bool  alloc 
) [private]
void NL3D::CPatch::updateFar1VBAlloc ( CTessList< CTessFarVertex > &  vertList,
bool  alloc 
) [private]
uint NL3D::CPatch::updateTessBlockLighting ( uint  numTb  ) 

recompute the near lightmap of tessBlock "numTb".

return the number of pixels updated by computing of this tessBlock. Actually 0 if the tessBlock lightmap is not computed, or 100 (NL_TILE_LIGHTMAP_SIZE*NL_TILE_LIGHTMAP_SIZE) pixels.

Definition at line 1906 of file patch_lightmap.cpp.

References computeNearBlockLightmap(), NL3D::CZone::Landscape, NL3D::CTessBlock::LightMapId, NL3D::CTessBlock::LightMapRefCount, NL_TILE_LIGHTMAP_SIZE, nlassert, OrderS, NL3D::CLandscape::refillTileLightMap(), NLMISC::CObjectVector< T, EnableObjectBehavior >::size(), TessBlocks, and Zone.

Referenced by NL3D::CLandscape::updateLightingTextureNear().

void NL3D::CPatch::updateTextureFarOnly ( const NLMISC::CBSphere patchSphere  ) 

Definition at line 224 of file patch_render.cpp.

References computeNewFar(), Far0, and Far1.

void NL3D::CPatch::updateTileVBAlloc ( CTessList< CTessNearVertex > &  vertList,
bool  alloc 
) [private]
void NL3D::CPatch::updateVBAlloc ( bool  alloc  )  [private]

Friends And Related Function Documentation

friend class CLandscapeVegetableBlock [friend]

Definition at line 789 of file patch.h.

friend class CPatchRdrPass [friend]

Definition at line 790 of file patch.h.

friend class CTessFace [friend]

Definition at line 787 of file patch.h.

friend class CZone [friend]

Definition at line 788 of file patch.h.


Member Data Documentation

Realtime Bind information.

The 4 neighbors zone of this patch (setuped at bind() time). NB: NULL if zone not loaded, or if no patch near us.

Definition at line 1105 of file patch.h.

Referenced by bind(), CPatch(), getBindNeighbor(), and unbind().

Put here for packing with NoiseRotation.

Definition at line 351 of file patch.h.

Referenced by CPatch(), getCornerSmoothFlag(), serial(), and setCornerSmoothFlag().

The Dynamic LightMap context.

created only when compiled, AND (when in Near OR (when in Far AND touched by pointLight)) else NULL.

Definition at line 1209 of file patch.h.

Referenced by addRefDLMContext(), beginDLMLighting(), CPatch(), decRefDLMContext(), endDLMLighting(), fillFar0DLMUvOnlyVertexListVB(), fillFar0VertexVB(), fillFar1DLMUvOnlyVertexListVB(), fillFar1VertexVB(), generateTileVegetable(), NL3D::CTessFace::initTileUvDLM(), processDLMLight(), and release().

The reference count for DLMContext.

Each TileMaterial created add a reference. Each pointLight wich touch the patch too.

Definition at line 1214 of file patch.h.

Referenced by addRefDLMContext(), CPatch(), decRefDLMContext(), and release().

Definition at line 865 of file patch.h.

Referenced by NL3D::CPatchRdrPass::appendRdrPatchFar0(), CPatch(), and getNextFar0ToRdr().

Definition at line 867 of file patch.h.

Referenced by NL3D::CPatchRdrPass::appendRdrPatchFar1(), CPatch(), and getNextFar1ToRdr().

Definition at line 864 of file patch.h.

Referenced by computeNewFar(), CPatch(), preRender(), renderFar0(), and resetRenderFar().

Definition at line 866 of file patch.h.

Referenced by computeNewFar(), CPatch(), preRender(), renderFar1(), and resetRenderFar().

Definition at line 1198 of file patch.h.

Referenced by compile(), CPatch(), getNextNearUL(), linkBeforeNearUL(), release(), and unlinkNearUL().

Definition at line 1197 of file patch.h.

Referenced by compile(), CPatch(), linkBeforeNearUL(), release(), and unlinkNearUL().

uint32 NL3D::CPatch::_Version = 7 [static, private]

Stream version of the class.

Definition at line 895 of file patch.h.

Referenced by serial().

Definition at line 815 of file patch.h.

Referenced by makeRoots().

Definition at line 1228 of file patch.h.

Referenced by unpackIntoCache().

Definition at line 809 of file patch.h.

Referenced by compile(), computeDefaultErrorSize(), getErrorSize(), and makeRoots().

Definition at line 800 of file patch.h.

Referenced by CPatch(), and NL3D::CZone::refineAll().

Definition at line 820 of file patch.h.

Referenced by computeNewFar(), and fillFar0VertexVB().

Definition at line 820 of file patch.h.

Referenced by computeNewFar(), and fillFar0VertexVB().

Definition at line 820 of file patch.h.

Referenced by computeNewFar(), and fillFar0VertexVB().

Definition at line 820 of file patch.h.

Referenced by computeNewFar(), and fillFar0VertexVB().

Definition at line 821 of file patch.h.

Referenced by computeNewFar(), and fillFar1VertexVB().

Definition at line 821 of file patch.h.

Referenced by computeNewFar(), and fillFar1VertexVB().

Definition at line 821 of file patch.h.

Referenced by computeNewFar(), and fillFar1VertexVB().

Definition at line 821 of file patch.h.

Referenced by computeNewFar(), and fillFar1VertexVB().

Flags NL_PATCH_FAR0_ROTATED and NL_PATCH_FAR1_ROTATED NL_PATCH_FAR0_ROTATED for Far0, NL_PATCH_FAR1_ROTATED for Far1 If the flag is set, the far texture of the patch is rotated of 1 (to the left of course).

Flags NL_PATCH_SMOOTH_FLAG_MASK 4 flag for smooth edge. Same as CPatchInfo::CBindInfo shifted by (<<NL_PATCH_SMOOTH_FLAG_SHIFT). See CPatchInfo::CBindInfo::Flags for details.

Definition at line 833 of file patch.h.

Referenced by NL3D::CZone::build(), computeNewFar(), fillFar0VertexVB(), fillFar1VertexVB(), getSmoothFlag(), NL3D::CZone::retrieve(), serial(), and setSmoothFlag().

const CPatch * NL3D::CPatch::LastPatch = NULL [static, private]

Definition at line 1230 of file patch.h.

Referenced by unpackIntoCache().

Noise Data.

The orientation of the NoiseMap. 0,1,2,3. This represent a CCW rotation of the NoiseMap.

Definition at line 341 of file patch.h.

Referenced by NL3D::CZone::build(), computeDisplaceRawCoordinates(), CPatch(), NL3D::CZone::retrieve(), and serial().

Definition at line 838 of file patch.h.

Referenced by computeGeomorphAlphaFar1VertexListVB(), computeNewFar(), and fillFar1VertexVB().

Definition at line 795 of file patch.h.

Referenced by compile(), getBindNeighbor(), getPatchId(), isRenderClipped(), and release().

Definition at line 807 of file patch.h.

Referenced by compile(), and NL3D::CTessFace::isRectangular().

Definition at line 881 of file patch.h.

Referenced by addRefTessBlocks(), clearTessBlocks(), CPatch(), and decRefTessBlocks().

Definition at line 837 of file patch.h.

Referenced by computeGeomorphAlphaFar1VertexListVB(), computeNewFar(), and fillFar1VertexVB().

list of vegetable clipBlocks, created/destroyed at same time as TessBlocks.

Definition at line 888 of file patch.h.

Referenced by addRefTessBlocks(), clearTessBlocks(), and createVegetableBlock().

The patch coordinates (see CBezierPatch).

Definition at line 321 of file patch.h.

Referenced by NL3D::CZone::applyHeightField(), NL3D::CZone::build(), NL3D::CZone::retrieve(), serial(), and unpack().


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

Generated on Thu Jan 7 08:30:07 2010 for NeL by  doxygen 1.6.1