# 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

Inheritance graph
[legend]
Collaboration diagram for NL3D::CTextureFar:

Collaboration graph
[legend]
List of all members.

Public Methods

 CTextureFar ()
 Constructor. More...

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...


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

Static Private Attributes

NLMISC::CRGBA _LightmapExpanded []
CTileLumel _LumelExpanded []

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(s):
Cyril Corvazier , Nevrax France
Date:
2000

Definition at line 68 of file texture_far.h.


Constructor & Destructor Documentation

NL3D::CTextureFar::CTextureFar ( ) [inline]
 

Constructor.

Definition at line 90 of file texture_far.h.


Member Function Documentation

NL3D::CTextureFar::NLMISC_DECLARE_CLASS ( CTextureFar ) [private]
 

bool NL3D::CTextureFar::addPatch ( CPatch * pPatch,
float & farUScale,
float & farVScale,
float & farUBias,
float & farVBias,
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 74 of file texture_far.cpp.

void NL3D::CTextureFar::doGenerate ( ) [virtual]
 

Generate the texture.

See ITexture::doGenerate().

See also:
ITexture::doGenerate()

Reimplemented from NL3D::ITexture.

Definition at line 153 of file texture_far.cpp.

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

Rebuild the rectangle passed in parameter.

Definition at line 199 of file texture_far.cpp.

bool NL3D::CTextureFar::removePatch ( CPatch * pPatch )
 

Remove a patch in the CTexture Patch.

Definition at line 124 of file texture_far.cpp.

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

From IStreamable.

Reimplemented from NLMISC::IStreamable.

Definition at line 155 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 42 of file texture_far.cpp.


Member Data Documentation

CTileFarBank * NL3D::CTextureFar::_Bank
 

A pointer on the far bank.

Definition at line 142 of file texture_far.h.

CRGBA NL3D::CTextureFar::_LightmapExpanded[NL_NUM_PIXELS_ON_FAR_TILE_EDGE *NL_MAX_TILES_BY_PATCH_EDGE *NL_NUM_PIXELS_ON_FAR_TILE_EDGE *NL_MAX_TILES_BY_PATCH_EDGE] [static, private]
 

Definition at line 39 of file texture_far.cpp.

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

Definition at line 40 of file texture_far.cpp.

uint32 NL3D::CTextureFar::_OriginalHeight [private]
 

Definition at line 147 of file texture_far.h.

uint32 NL3D::CTextureFar::_OriginalWidth [private]
 

The original size.

Definition at line 146 of file texture_far.h.

uint32 NL3D::CTextureFar::_PatchCount
 

Definition at line 139 of file texture_far.h.

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 136 of file texture_far.h.


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