# 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::CTextureFar Class Reference

A CTextureFar is a set of NL_NUM_FAR_PATCHES_BY_TEXTURE texture used to map a whole patch when it is in far Mode. More...

#include <texture_far.h>

Inheritance diagram for NL3D::CTextureFar:

NL3D::ITexture NLMISC::CBitmap NLMISC::CRefCount NLMISC::IStreamable NLMISC::IClassable List of all members.

Public Methods

 CTextureFar ()
 Constructor. More...

virtual ~CTextureFar ()
void setSizeOfFarPatch (sint width, sint height)
 Set the size of the patch stored in this texture far. More...

bool addPatch (CPatch *pPatch, float &far1UScale, float &far1VScale, float &far1UBias, float &far1VBias, bool &bRot)
 Add a patch in the CTexture Patch. More...

bool removePatch (CPatch *pPatch)
 Remove a patch in the CTexture Patch. More...

virtual void doGenerate ()
 Generate the texture. More...

uint touchPatch (uint patchId)
 Touch a patch by its id in texture (call touchRect()). More...

void linkBeforeUL (CTextureFar *textNext)
 For lighting update, insert this before textNext (CiruclarList). textNext must be !NULL. More...

void unlinkUL ()
 For lighting update, unlink (CiruclarList). More...

CTextureFar * getNextUL () const
 For lighting update, get Next (CiruclarList). If ==this, then list is empty. More...


Public Attributes

std::vector< CPatchIdent_Patches
 Vector of patches which texture far is stored in this CTextureFar Should be == to _WidthPatches*_HeightPatches. More...

uint32 _PatchCount
CTileFarBank_Bank
 A pointer on the far bank. More...


Private Methods

void rebuildRectangle (uint x, uint y)
 Rebuild the rectangle passed in parameter. More...

virtual void serial (NLMISC::IStream &f) throw (NLMISC::EStream)
 From IStreamable. More...

 NLMISC_DECLARE_CLASS (CTextureFar)

Private Attributes

uint32 _OriginalWidth
 The original size. More...

uint32 _OriginalHeight
CTextureFar * _ULPrec
 UpdateLighting. CiruclarList. More...

CTextureFar * _ULNext

Static Private Attributes

NLMISC::CRGBA _LightmapExpanded []
uint8 _LumelExpanded []
NLMISC::CRGBA _TileTLIColors []

Detailed Description

A CTextureFar is a set of NL_NUM_FAR_PATCHES_BY_TEXTURE texture used to map a whole patch when it is in far Mode.

(ie not in tile mode). A CTextureFar handle several patch texture.\

Before adding patch to the texture, you must call setSizeOfFarPatch, to intialize the texture.

TODO: keeping the far texture level1 alive when the tile pass in level0 (tile mode), don't erase it. TODO: add an hysteresis to avoid swap of far texture on boundaries of levels TODO: set the upload format in rgba565

Author:
Cyril Corvazier , Nevrax France
Date:
2000

Definition at line 67 of file texture_far.h.


Constructor & Destructor Documentation

NL3D::CTextureFar::CTextureFar  
 

Constructor.

Definition at line 46 of file texture_far.cpp.

References _ULNext, _ULPrec, and NL3D::ITexture::setReleasable.

Referenced by getNextUL.

NL3D::CTextureFar::~CTextureFar   [virtual]
 

Definition at line 55 of file texture_far.cpp.

References _ULNext, _ULPrec, and nlassert.


Member Function Documentation

bool NL3D::CTextureFar::addPatch CPatch   pPatch,
float &    far1UScale,
float &    far1VScale,
float &    far1UBias,
float &    far1VBias,
bool &    bRot
 

Add a patch in the CTexture Patch.

Must not be full! Return true if the texture is full after adding this patch else false.

Parameters:
pPatch  is the pointer to the patch to add in the landscape
far1UVScale  will receive the scale to use to compute the UV coordinates
far1UBias  will receive the U Bias to use to compute the UV coordinates
far1VBias  will receive the V Bias to use to compute the UV coordinates
bRot  will receive true if the texture is rotated of 90° to the left or false. You should take care of this value to compute UV coordinates.

Definition at line 120 of file texture_far.cpp.

References _OriginalHeight, _OriginalWidth, _PatchCount, _Patches, NL_NUM_FAR_PATCHES_BY_EDGE_MASK, NL_NUM_FAR_PATCHES_BY_EDGE_SHIFT, NL_NUM_FAR_PATCHES_BY_TEXTURE, nlassert, x, and y.

void NL3D::CTextureFar::doGenerate   [virtual]
 

Generate the texture.

See ITexture::doGenerate().

See also:
ITexture::doGenerate()

Implements NL3D::ITexture.

Definition at line 225 of file texture_far.cpp.

References NLMISC::CBitmap::_Height, NL3D::ITexture::_ListInvalidRect, _OriginalHeight, _OriginalWidth, _Patches, NLMISC::CBitmap::_Width, NL_NUM_FAR_PATCHES_BY_EDGE, NL_NUM_FAR_PATCHES_BY_EDGE_SHIFT, nlassert, rebuildRectangle, NLMISC::CBitmap::RGBA, x, and y.

CTextureFar* NL3D::CTextureFar::getNextUL   const [inline]
 

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

Definition at line 140 of file texture_far.h.

References _ULNext, and CTextureFar.

void NL3D::CTextureFar::linkBeforeUL CTextureFar *    textNext
 

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

Definition at line 62 of file texture_far.cpp.

References _ULNext, _ULPrec, and nlassert.

NL3D::CTextureFar::NLMISC_DECLARE_CLASS CTextureFar    [private]
 

void NL3D::CTextureFar::rebuildRectangle uint    x,
uint    y
[private]
 

Rebuild the rectangle passed in parameter.

Definition at line 272 of file texture_far.cpp.

References _Bank, NLMISC::CBitmap::_Height, _LightmapExpanded, _LumelExpanded, _Patches, _TileTLIColors, NLMISC::CBitmap::_Width, NL3D_CComputeTileFar::AsmMMX, NL3D_CExpandLightmap::ColorTile, NL3D_CComputeTileFar::DstDeltaX, NL3D_CComputeTileFar::DstDeltaY, NL3D_CComputeTileFar::DstPixels, NL3D_CExpandLightmap::DstPixels, NLMISC::CBitmap::getPixelFormat, NLMISC::CBitmap::getPixels, NLMISC::CSystemInfo::hasMMX, NL3D_CExpandLightmap::Height, NLAISCRIPT::l, NL3D_CExpandLightmap::LumelTile, min, NL3D_CExpandLightmap::MulFactor, NL3D_drawFarTileInFarTexture, NL3D_drawFarTileInFarTextureAdditive, NL3D_drawFarTileInFarTextureAdditiveAlpha, NL3D_drawFarTileInFarTextureAlpha, NL3D_expandLightmap, NL_NUM_FAR_PATCHES_BY_EDGE, NL_NUM_FAR_PATCHES_BY_EDGE_SHIFT, NL_NUM_PIXELS_ON_FAR_TILE_EDGE, NL_TILE_ELM_LAYER_EMPTY, nlassert, nlwarning, NLMISC::CBitmap::RGBA, s, NL3D_CComputeTileFar::Size, size, NL3D_CComputeTileFar::SrcAdditivePixels, NL3D_CComputeTileFar::SrcDeltaX, NL3D_CComputeTileFar::SrcDeltaY, NL3D_CComputeTileFar::SrcDiffusePixels, NL3D_CComputeTileFar::SrcLightingDeltaY, NL3D_CComputeTileFar::SrcLightingPixels, NL3D_CExpandLightmap::StaticLightColor, t, NL3D_CExpandLightmap::TLIColor, NL3D_CExpandLightmap::Width, x, and y.

Referenced by doGenerate.

bool NL3D::CTextureFar::removePatch CPatch   pPatch
 

Remove a patch in the CTexture Patch.

Definition at line 170 of file texture_far.cpp.

References _PatchCount, _Patches, NL_NUM_FAR_PATCHES_BY_TEXTURE, and nlassert.

virtual void NL3D::CTextureFar::serial NLMISC::IStream   f throw (NLMISC::EStream) [inline, private, virtual]
 

From IStreamable.

Reimplemented from NL3D::ITexture.

Definition at line 168 of file texture_far.h.

void NL3D::CTextureFar::setSizeOfFarPatch sint    width,
sint    height
 

Set the size of the patch stored in this texture far.

Note that width must be larger than height. For patch with a bigger height than width, invert width and height value. So, in this texture far, you can store patches with a size of width*height but also patches with a size of height*width.

Parameters:
width  is the width of the texture far stored in this texture. Can be 64, 32, 16, 8, 4 or 2
height  is the height of the texture far stored in this texture. Can be 64, 32, 16, 8, 4 or 2

Definition at line 88 of file texture_far.cpp.

References _OriginalHeight, _OriginalWidth, _PatchCount, _Patches, NL3D::ITexture::Clamp, NLMISC::contReset, height, NL3D::ITexture::Linear, NL3D::ITexture::LinearMipMapOff, NL_NUM_FAR_PATCHES_BY_EDGE, NL_NUM_FAR_PATCHES_BY_TEXTURE, NL3D::ITexture::RGB565, NL3D::ITexture::setFilterMode, NL3D::ITexture::setUploadFormat, NL3D::ITexture::setWrapS, NL3D::ITexture::setWrapT, and width.

uint NL3D::CTextureFar::touchPatch uint    patchId
 

Touch a patch by its id in texture (call touchRect()).

Parameters:
patchId  a value beetween 0 and NL_NUM_FAR_PATCHES_BY_TEXTURE-1, which gives the id of the patch in the texture
Returns:
number of pixels touched. 0 if Patch==NULL (empty).

Definition at line 198 of file texture_far.cpp.

References _OriginalHeight, _OriginalWidth, _Patches, NL_NUM_FAR_PATCHES_BY_EDGE_MASK, NL_NUM_FAR_PATCHES_BY_EDGE_SHIFT, NL_NUM_FAR_PATCHES_BY_TEXTURE, nlassert, x, and y.

void NL3D::CTextureFar::unlinkUL  
 

For lighting update, unlink (CiruclarList).

Definition at line 77 of file texture_far.cpp.

References _ULNext, and _ULPrec.


Member Data Documentation

CTileFarBank* NL3D::CTextureFar::_Bank
 

A pointer on the far bank.

Definition at line 155 of file texture_far.h.

Referenced by rebuildRectangle.

CRGBA NL3D::CTextureFar::_LightmapExpanded [static, private]
 

Definition at line 42 of file texture_far.cpp.

Referenced by rebuildRectangle.

uint8 NL3D::CTextureFar::_LumelExpanded [static, private]
 

Definition at line 43 of file texture_far.cpp.

Referenced by rebuildRectangle.

uint32 NL3D::CTextureFar::_OriginalHeight [private]
 

Definition at line 160 of file texture_far.h.

Referenced by addPatch, doGenerate, setSizeOfFarPatch, and touchPatch.

uint32 NL3D::CTextureFar::_OriginalWidth [private]
 

The original size.

Definition at line 159 of file texture_far.h.

Referenced by addPatch, doGenerate, setSizeOfFarPatch, and touchPatch.

uint32 NL3D::CTextureFar::_PatchCount
 

Definition at line 152 of file texture_far.h.

Referenced by addPatch, removePatch, and setSizeOfFarPatch.

std::vector<CPatchIdent> NL3D::CTextureFar::_Patches
 

Vector of patches which texture far is stored in this CTextureFar Should be == to _WidthPatches*_HeightPatches.

Definition at line 149 of file texture_far.h.

Referenced by addPatch, doGenerate, rebuildRectangle, removePatch, setSizeOfFarPatch, and touchPatch.

CRGBA NL3D::CTextureFar::_TileTLIColors [static, private]
 

Definition at line 44 of file texture_far.cpp.

Referenced by rebuildRectangle.

CTextureFar* NL3D::CTextureFar::_ULNext [private]
 

Definition at line 179 of file texture_far.h.

Referenced by CTextureFar, getNextUL, linkBeforeUL, unlinkUL, and ~CTextureFar.

CTextureFar* NL3D::CTextureFar::_ULPrec [private]
 

UpdateLighting. CiruclarList.

Definition at line 178 of file texture_far.h.

Referenced by CTextureFar, linkBeforeUL, unlinkUL, and ~CTextureFar.


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