|
|
|
|
Documentation |
|
Main Page Namespace List Class Hierarchy Alphabetical List Compound List File List Namespace Members Compound Members File Members Related Pages Search
NL3D::CTextureDLM Class ReferenceThis texture is used by landscape to perform Dynamic LightMap (DLM).
More...
#include <texture_dlm.h>
Inheritance diagram for NL3D::CTextureDLM:
List of all members.
Public Methods |
| CTextureDLM (uint width, uint height) |
| Constructor. More...
|
void | doGenerate () |
| Since texture is always in memory... More...
|
| CTextureDLM () |
| TextureDLM are system. Do not need to serialize them... More...
|
virtual void | serial (NLMISC::IStream &f) throw (NLMISC::EStream) |
| serial ITexture basic infos (clamp ...). More...
|
| NLMISC_DECLARE_CLASS (CTextureDLM) |
|
bool | canCreateLightMap (uint w, uint h) |
| return true if can create a texture of this size. More...
|
bool | createLightMap (uint w, uint h, uint &x, uint &y) |
| create a space for a lightmap. More...
|
void | copyRect (uint x, uint y, uint w, uint h, CRGBA *textMap) |
| refill the texture with raw data. More...
|
void | fillRect (uint x, uint y, uint w, uint h, uint8 value) |
| same as copyRect(), but fill a RGBA(value, value, value, value). More...
|
void | modulateAndfillRect565 (uint x, uint y, uint w, uint h, CRGBA *textMap, uint16 *modColor) |
| same as copyRect(), but modulate textMap with an array of 565 color, before copying. More...
|
void | modulateAndfillRect8888 (uint x, uint y, uint w, uint h, CRGBA *textMap, CRGBA *modColor) |
| same as copyRect(), but modulate textMap with an array of CRGBA color, before copying. More...
|
void | modulateConstantAndfillRect (uint x, uint y, uint w, uint h, CRGBA *textMap, CRGBA modColor) |
| same as copyRect(), but modulate textMap with a cte color, before copying. More...
|
void | releaseLightMap (uint x, uint y) |
| Set a lightmap as free for use. It is an error to free a not allocated lightmap. (nlassert!!). More...
|
Private Methods |
uint | getTypeForSize (uint width, uint height) |
| get the lightmap type id according to lightmap size. More...
|
void | linkFreeBlock (uint lMapType, CBlock *block) |
| FreeBlock list mgt. More...
|
void | unlinkFreeBlock (uint lMapType, CBlock *block) |
Private Attributes |
uint | _WBlock |
| Number of block per line. More...
|
std::vector< CBlock > | _Blocks |
| The list of blocks. More...
|
std::vector< uint > | _EmptyBlocks |
| The list of available Blocks, ie Blocks with FreeSpace==0. More...
|
CBlock * | _FreeBlocks [NL_DLM_LIGHTMAP_TYPE_SIZE] |
| For each type of lightmaps (2x2, 2x3 etc...), list of blocks which are not full. More...
|
Detailed Description
This texture is used by landscape to perform Dynamic LightMap (DLM).
Actually a CTextureDLM handle many block of lightmap in one single big texture. If NL_DLM_TILE_RES, then Block can be of size of 2,3,5 or 9 * 2,3,5 or 9 (eg 2x9, or 5x5 texture). else Block can be of size of 3,5,9 or 17 * 3,5,9 or 17 (eg 3x17, or 9x9 texture).
Implementation note (NL_DLM_TILE_RES not defined): To make this possible easily, blocks of 10x10 are created and placed in the texture. Hence a 9x9 texture lies in a single block, 3 textures of 3x9 lies in a block etc... In worst case, lost space is 19% (1 - 9*9 / 10*10).
If NL_DLM_TILE_RES is defined, then, same reasoning, with blocks of 18x18. In worst case, space lost is 70%: (1 - 15*15 / 18*18). But others cases are pretty good (90% to 100%)
NB: TextureDLM ensure that point (MaxX,MaxY) of this texture is black. UseFull for patch who want default black color
-
Author:
-
Lionel Berenguier , Nevrax France
-
Date:
-
2002
Definition at line 77 of file texture_dlm.h.
Constructor & Destructor Documentation
NL3D::CTextureDLM::CTextureDLM |
( |
uint |
width, |
|
|
uint |
height |
|
) |
|
|
|
Constructor.
Definition at line 42 of file texture_dlm.cpp.
References _Blocks, _EmptyBlocks, _FreeBlocks, _WBlock, height, NL_DLM_BLOCK_SIZE, NL_DLM_LIGHTMAP_TYPE_SIZE, nlassert, NL3D::ITexture::setFilterMode, NL3D::ITexture::setReleasable, NL3D::ITexture::setUploadFormat, and width. |
NL3D::CTextureDLM::CTextureDLM |
( |
|
) |
[inline] |
|
|
TextureDLM are system. Do not need to serialize them...
Definition at line 92 of file texture_dlm.h.
References nlstop. |
Member Function Documentation
bool NL3D::CTextureDLM::canCreateLightMap |
( |
uint |
w, |
|
|
uint |
h |
|
) |
|
|
void NL3D::CTextureDLM::copyRect |
( |
uint |
x, |
|
|
uint |
y, |
|
|
uint |
w, |
|
|
uint |
h, |
|
|
CRGBA * |
textMap |
|
) |
|
|
|
refill the texture with raw data.
NB: no check is made on x,y,w,h lightmap validity. CRGBA are transformed to texture format (16 bits or better) The texture is invalidate (on this part only...) -
Parameters:
-
map |
is the raw array of RGBA colors to fills. must be of w*h size |
Definition at line 241 of file texture_dlm.cpp.
References NLMISC::CBitmap::getPixels, NLMISC::CBitmap::getWidth, src, w, x, and y. |
|
create a space for a lightmap.
NB: texture space is not filled with black. return false if cannot, else return true, and return in x/y the position in the texture.
Definition at line 164 of file texture_dlm.cpp.
References _Blocks, _EmptyBlocks, _FreeBlocks, canCreateLightMap, getTypeForSize, linkFreeBlock, NL_DLM_BLOCK_SIZE, nlassert, unlinkFreeBlock, w, x, and y. |
void NL3D::CTextureDLM::doGenerate |
( |
|
) |
[inline, virtual] |
|
uint NL3D::CTextureDLM::getTypeForSize |
( |
uint |
width, |
|
|
uint |
height |
|
) |
[private] |
|
void NL3D::CTextureDLM::linkFreeBlock |
( |
uint |
lMapType, |
|
|
CBlock * |
block |
|
) |
[private] |
|
void NL3D::CTextureDLM::modulateAndfillRect565 |
( |
uint |
x, |
|
|
uint |
y, |
|
|
uint |
w, |
|
|
uint |
h, |
|
|
CRGBA * |
textMap, |
|
|
uint16 * |
modColor |
|
) |
|
|
void NL3D::CTextureDLM::modulateAndfillRect8888 |
( |
uint |
x, |
|
|
uint |
y, |
|
|
uint |
w, |
|
|
uint |
h, |
|
|
CRGBA * |
textMap, |
|
|
CRGBA * |
modColor |
|
) |
|
|
void NL3D::CTextureDLM::modulateConstantAndfillRect |
( |
uint |
x, |
|
|
uint |
y, |
|
|
uint |
w, |
|
|
uint |
h, |
|
|
CRGBA * |
textMap, |
|
|
CRGBA |
modColor |
|
) |
|
|
NL3D::CTextureDLM::NLMISC_DECLARE_CLASS |
( |
CTextureDLM |
|
) |
|
|
void NL3D::CTextureDLM::releaseLightMap |
( |
uint |
x, |
|
|
uint |
y |
|
) |
|
|
void NL3D::CTextureDLM::unlinkFreeBlock |
( |
uint |
lMapType, |
|
|
CBlock * |
block |
|
) |
[private] |
|
Member Data Documentation
std::vector<CBlock> NL3D::CTextureDLM::_Blocks [private]
|
|
std::vector<uint> NL3D::CTextureDLM::_EmptyBlocks [private]
|
|
CBlock* NL3D::CTextureDLM::_FreeBlocks[NL_DLM_LIGHTMAP_TYPE_SIZE] [private]
|
|
uint NL3D::CTextureDLM::_WBlock [private]
|
|
The documentation for this class was generated from the following files:
|
|