NL3D::CTextureFar Class Reference

#include <texture_far.h>

Inheritance diagram for NL3D::CTextureFar:

NL3D::ITexture NLMISC::CBitmap NLMISC::CRefCount NLMISC::IStreamable NLMISC::IClassable

Detailed Description

A CTextureFar is a set of texture used to map a whole patch when it is in far Mode. (ie not in tile mode). A CTextureFar handle several patch 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 - Lionel Berenguier

Nevrax France

Date:
2000

Definition at line 85 of file texture_far.h.

Public Types

enum  TMagFilter { Nearest = 0, Linear, MagFilterCount }
enum  TMinFilter {
  NearestMipMapOff = 0, NearestMipMapNearest, NearestMipMapLinear, LinearMipMapOff,
  LinearMipMapNearest, LinearMipMapLinear, MinFilterCount
}
enum  TType {
  RGBA = 0, Luminance, Alpha, AlphaLuminance,
  DXTC1, DXTC1Alpha, DXTC3, DXTC5,
  DsDt, ModeCount, DonTKnow = 0xffffffff
}
enum  TUploadFormat {
  Auto = 0, RGBA8888, RGBA4444, RGBA5551,
  RGB888, RGB565, DXTC1, DXTC1Alpha,
  DXTC3, DXTC5, Luminance, Alpha,
  AlphaLuminance, DsDt, UploadFormatCount
}
enum  TWrapMode { Repeat = 0, Clamp, WrapModeCount }

Public Member Functions

void allocatePatch (CPatch *pPatch, uint farIndex, float &farUScale, float &farVScale, float &farUBias, float &farVBias, bool &bRot)
virtual bool allowDegradation () const
 Does this texture allow the driver to degrade.

void blend (CBitmap &Bm0, CBitmap &Bm1, uint16 factor, bool inputBitmapIsMutable=false)
bool blit (const CBitmap *src, sint32 x, sint32 y)
void buildMipMaps ()
virtual ITexturebuildNonSelectableVersion (uint index)
void clearTouched (void)
bool convertToType (TType type)
 CTextureFar ()
 Constructor.

virtual void doGenerate (bool async=false)
bool endPatchULTouch () const
void flipH ()
void flipV ()
void generate (bool async=false)
virtual std::string getClassName ()=0
CRGBAF getColor (float x, float y) const
virtual uint32 getHeight (uint32 numMipMap=0) const
uint32 getMipMapCount () const
CTextureFargetNextUL () const
 For lighting update, get Next (CiruclarList). If ==this, then list is empty.

CRGBA getPixelColor (sint x, sint y, uint32 numMipMap=0) const
TType getPixelFormat () const
const sintgetRefCount () const
bool getReleasable () const
virtual std::string getShareName () const
uint32 getSize (uint32 numMipMap=0) const
virtual uint32 getWidth (uint32 numMipMap=0) const
bool isAllInvalidated () const
virtual bool isBumpMap () const
bool isGrayscaleAsAlpha () const
virtual bool isSelectable () const
 Test wether this texture is selectable.

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

uint8 load (NLMISC::IStream &f, uint mipMapSkip=0)
void loadGrayscaleAsAlpha (bool loadAsAlpha)
void makeDummy ()
virtual void release ()
void releaseDriverSetup ()
 Release the Driver info for this texture (if any). Call it with care.

void releaseMipMaps ()
void removePatch (CPatch *pPatch, uint farIndex)
void resample (sint32 nNewWidth, sint32 nNewHeight)
void reset (TType type=RGBA)
void resize (sint32 nNewWidth, sint32 nNewHeight, TType newType=DonTKnow, bool resetTo0=true)
void resizeMipMap (uint32 numMipMap, sint32 nNewWidth, sint32 nNewHeight, bool resetTo0=true)
void rot90CCW ()
void rot90CW ()
void rotateCCW ()
virtual void selectTexture (uint index)
void setMipMapCount (uint32 mmc)
void setReleasable (bool r)
bool setupedIntoDriver () const
void startPatchULTouch ()
virtual bool supportSharing () const
void touch ()
bool touched (void)
uint touchPatchULAndNext ()
void touchRect (const NLMISC::CRect &rect)
sint tryAllocatePatch (CPatch *pPatch, uint farIndex)
void unlinkUL ()
 For lighting update, unlink (CiruclarList).

void validateGenerateFlag ()
bool writeJPG (NLMISC::IStream &f, uint8 quality=80)
bool writeTGA (NLMISC::IStream &f, uint32 d, bool upsideDown=false)
virtual ~CTextureFar ()

Static Public Member Functions

void loadSize (const std::string &path, uint32 &retWidth, uint32 &retHeight)
void loadSize (NLMISC::IStream &f, uint32 &width, uint32 &height)

Data Fields

CTileFarBank_Bank
 A pointer on the far bank.

std::list< NLMISC::CRect_ListInvalidRect
sint crefs
CPtrInfo * pinfo
enum NLMISC::CBitmap::TType PixelFormat
NLMISC::CRefPtr< CTextureDrvShareTextureDrvShare

Static Public Attributes

const uint32 bitPerPixels [ModeCount]
const uint32 DXTC1HEADER = NL_MAKEFOURCC('D','X', 'T', '1')
const uint32 DXTC3HEADER = NL_MAKEFOURCC('D','X', 'T', '3')
const uint32 DXTC5HEADER = NL_MAKEFOURCC('D','X', 'T', '5')
CPtrInfo NullPtrInfo

Protected Attributes

CObjectVector< uint8_Data [MAX_MIPMAP]
uint32 _Height
bool _LoadGrayscaleAsAlpha
uint8 _MipMapCount
bool _Touched
uint32 _Width

Private Types

typedef std::map< CPatchIdent,
CVector2s
TPatchToPosMap
typedef std::map< CVector2s,
CPatchIdent
TPosToPatchMap

Private Member Functions

uint getFreeListId (uint width, uint height)
bool getUpperSize (uint &width, uint &height)
 NLMISC_DECLARE_CLASS (CTextureFar)
void rebuildPatch (const CVector2s texturePos, const CPatchIdent &pid)
void recursSplitNext (uint width, uint height)
virtual void serial (NLMISC::IStream &f) throw (NLMISC::EStream)
 From IStreamable.


Private Attributes

std::list< CVector2s_FreeSpaces [(4+NL_NUM_PIXELS_ON_FAR_TILE_EDGE_SHIFT)*4]
TPatchToPosMap::iterator _ItULPatch
TPatchToPosMap _PatchToPosMap
TPosToPatchMap _PosToPatchMap
CTextureFar_ULNext
CTextureFar_ULPrec
 UpdateLighting. CiruclarList.


Static Private Attributes

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

Friends

struct CPtrInfo


Member Typedef Documentation

typedef std::map<CPatchIdent, CVector2s> NL3D::CTextureFar::TPatchToPosMap [private]
 

Map of Patchs stored in this texture Far. Should be == to _WidthPatches*_HeightPatches

Definition at line 176 of file texture_far.h.

typedef std::map<CVector2s, CPatchIdent> NL3D::CTextureFar::TPosToPatchMap [private]
 

Definition at line 177 of file texture_far.h.


Member Enumeration Documentation

enum NL3D::ITexture::TMagFilter [inherited]
 

Magnification mode. Same behavior as OpenGL.

Enumeration values:
Nearest 
Linear 
MagFilterCount 

Definition at line 148 of file texture.h.

Referenced by NL3D::ITexture::getMagFilter().

00149         {
00150                 Nearest=0,
00151                 Linear,
00152 
00153                 MagFilterCount
00154         };

enum NL3D::ITexture::TMinFilter [inherited]
 

Minifying mode. Same behavior as OpenGL. If the bitmap has no mipmap, and mipmap is required, then mipmaps are computed.

Enumeration values:
NearestMipMapOff 
NearestMipMapNearest 
NearestMipMapLinear 
LinearMipMapOff 
LinearMipMapNearest 
LinearMipMapLinear 
MinFilterCount 

Definition at line 159 of file texture.h.

Referenced by NL3D::ITexture::getMinFilter().

enum NLMISC::CBitmap::TType [inherited]
 

Enumeration values:
RGBA 
Luminance 
Alpha 
AlphaLuminance 
DXTC1 
DXTC1Alpha 
DXTC3 
DXTC5 
DsDt 
ModeCount 
DonTKnow 

Definition at line 234 of file bitmap.h.

00235         { 
00236                 RGBA=0,
00237                 Luminance,
00238                 Alpha,
00239                 AlphaLuminance,
00240                 DXTC1,
00241                 DXTC1Alpha,
00242                 DXTC3,
00243                 DXTC5,
00244                 DsDt,
00245                 ModeCount,
00246                 DonTKnow=0xffffffff
00247         } PixelFormat;

enum NL3D::ITexture::TUploadFormat [inherited]
 

Enumeration values:
Auto 
RGBA8888 
RGBA4444 
RGBA5551 
RGB888 
RGB565 
DXTC1 
DXTC1Alpha 
DXTC3 
DXTC5 
Luminance 
Alpha 
AlphaLuminance 
DsDt 
UploadFormatCount 

Definition at line 125 of file texture.h.

Referenced by NL3D::ITexture::getUploadFormat().

00126         {
00127                 Auto= 0,
00128                 RGBA8888,
00129                 RGBA4444,
00130                 RGBA5551,
00131                 RGB888,
00132                 RGB565,
00133                 DXTC1,
00134                 DXTC1Alpha,
00135                 DXTC3,
00136                 DXTC5,
00137                 Luminance,
00138                 Alpha,
00139                 AlphaLuminance,
00140                 DsDt,
00141                 UploadFormatCount
00142         };

enum NL3D::ITexture::TWrapMode [inherited]
 

Enumeration values:
Repeat 
Clamp 
WrapModeCount 

Definition at line 117 of file texture.h.

00118         {
00119                 Repeat= 0,
00120                 Clamp,
00121 
00122                 WrapModeCount
00123         };


Constructor & Destructor Documentation

NL3D::CTextureFar::CTextureFar  ) 
 

Constructor.

Definition at line 48 of file texture_far.cpp.

References _FreeSpaces, _ItULPatch, _PatchToPosMap, _ULNext, _ULPrec, getFreeListId(), NL_MAX_FAR_PATCH_EDGE, NL_MAX_TILES_BY_PATCH_EDGE, NL_NUM_FAR_BIGGEST_PATCH_PER_EDGE, nlctassert, NL3D::ITexture::setFilterMode(), NL3D::ITexture::setReleasable(), NL3D::ITexture::setUploadFormat(), NL3D::ITexture::setWrapS(), NL3D::ITexture::setWrapT(), uint, NL3D::CTextureFar::CVector2s::x, and NL3D::CTextureFar::CVector2s::y.

00049 {
00050         /* NB: define Values work only if NL_MAX_TILES_BY_PATCH_EDGE is 16.
00051                 Else must change NL_MAX_FAR_EDGE and NL_NUM_RECTANGLE_RATIO
00052         */
00053         nlctassert(NL_MAX_TILES_BY_PATCH_EDGE==16);
00054 
00055         // This texture is releasable. It doesn't stays in standard memory after been uploaded into video memory.
00056         setReleasable (true);
00057 
00058         // Init upload format 16 bits
00059         setUploadFormat(RGB565);
00060 
00061         // Set filter mode. No mipmap!
00062         setFilterMode (Linear, LinearMipMapOff);
00063 
00064         // Wrap
00065         setWrapS (Clamp);
00066         setWrapT (Clamp);
00067 
00068         // init update Lighting
00069         _ULPrec= this;
00070         _ULNext= this;
00071 
00072         // Start With All Patch of Max Far (64x64) Frees!
00073         uint    freeListId= getFreeListId(NL_MAX_FAR_PATCH_EDGE, NL_MAX_FAR_PATCH_EDGE);
00074         for(uint i=0;i<NL_NUM_FAR_BIGGEST_PATCH_PER_EDGE;i++)
00075         {
00076                 for(uint j=0;j<NL_NUM_FAR_BIGGEST_PATCH_PER_EDGE;j++)
00077                 {
00078                         CVector2s       pos;
00079                         pos.x= i*NL_MAX_FAR_PATCH_EDGE;
00080                         pos.y= j*NL_MAX_FAR_PATCH_EDGE;
00081 
00082                         // add this place to the free list.
00083                         _FreeSpaces[freeListId].push_back(pos);
00084                 }
00085         }
00086 
00087         // reset
00088         _ItULPatch= _PatchToPosMap.end();
00089 }

NL3D::CTextureFar::~CTextureFar  )  [virtual]
 

Definition at line 92 of file texture_far.cpp.

References _ULNext, _ULPrec, and nlassert.

00093 {
00094         // verify the textureFar is correctly unlinked from any ciruclar list.
00095         nlassert(_ULPrec==this && _ULNext==this);
00096 }


Member Function Documentation

void NL3D::CTextureFar::allocatePatch CPatch pPatch,
uint  farIndex,
float &  farUScale,
float &  farVScale,
float &  farUBias,
float &  farVBias,
bool &  bRot
 

Allocate a patch in the CTextureFar, according to its size. nlstop if fails. Must call before tryAllocate()

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

Definition at line 276 of file texture_far.cpp.

References _FreeSpaces, _PatchToPosMap, _PosToPatchMap, NL3D::CTextureFar::CPatchIdent::FarIndex, getFreeListId(), NL3D::CPatch::getOrderS(), NL3D::CPatch::getOrderT(), height, NL_FAR_TEXTURE_EDGE_SIZE, NL_NUM_PIXELS_ON_FAR_TILE_EDGE, nlassert, NL3D::CTextureFar::CPatchIdent::Patch, recursSplitNext(), uint, and width.

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

00277 {
00278         // get the size of the subtexture to allocate
00279         uint width=(pPatch->getOrderS ()*NL_NUM_PIXELS_ON_FAR_TILE_EDGE)>>(farIndex-1);
00280         uint height=(pPatch->getOrderT ()*NL_NUM_PIXELS_ON_FAR_TILE_EDGE)>>(farIndex-1);
00281 
00282         // make width the biggest
00283         if(width<height)
00284                 swap(width, height);
00285 
00286         // get where to find a subtexture
00287         uint    freeListId= getFreeListId(width, height);
00288 
00289         // if free list is empty, must split bigger patch...
00290         if(_FreeSpaces[freeListId].empty())
00291         {
00292                 // try to get a bigger subtexture and split it.
00293                 recursSplitNext(width, height);
00294         }
00295 
00296         // now the list should have som free space.
00297         nlassert( !_FreeSpaces[freeListId].empty() );
00298         CVector2s       pos= _FreeSpaces[freeListId].front();
00299 
00300         // Allocate. Add this entry to the maps
00301         CPatchIdent     pid;
00302         pid.Patch= pPatch;
00303         pid.FarIndex= farIndex;
00304         // verify not already here.
00305         nlassert( _PatchToPosMap.find(pid) == _PatchToPosMap.end() );
00306         _PatchToPosMap[pid]= pos;
00307         _PosToPatchMap[pos]= pid;
00308         
00309         // remove from free list.
00310         _FreeSpaces[freeListId].pop_front();
00311 
00312         // Invalidate the rectangle
00313         CRect rect (pos.x, pos.y, width, height);
00314         ITexture::touchRect (rect);
00315 
00316         // ** Return some values
00317 
00318         // Rotation flag
00319         bRot = ( pPatch->getOrderS() < pPatch->getOrderT() );
00320 
00321         // Scale is the same for all
00322         farUScale=(float)(width-1)/(float)NL_FAR_TEXTURE_EDGE_SIZE;
00323         farVScale=(float)(height-1)/(float)NL_FAR_TEXTURE_EDGE_SIZE;
00324 
00325         // UBias is the same for all
00326         farUBias=((float)pos.x+0.5f)/(float)NL_FAR_TEXTURE_EDGE_SIZE;
00327 
00328         // UBias is the same for all
00329         farVBias=((float)pos.y+0.5f)/(float)NL_FAR_TEXTURE_EDGE_SIZE;
00330 }

virtual bool NL3D::ITexture::allowDegradation  )  const [inline, virtual, inherited]
 

Does this texture allow the driver to degrade.

Reimplemented in NL3D::CTextureFile, and NL3D::CTextureMem.

Definition at line 352 of file texture.h.

Referenced by NL3D::CDriverGL::getGlTextureFormat(), NL3D::CDriverGL::setupTextureEx(), and NL3D::CDriverGL::uploadTexture().

00352 { return false; }

void NLMISC::CBitmap::blend CBitmap Bm0,
CBitmap Bm1,
uint16  factor,
bool  inputBitmapIsMutable = false
[inherited]
 

Set this bitmap as the result of the blend bewteen 2 bitmap REQUIRE : - Bm0 and Bm1 should have the same size.

  • Both bitmap should be convertible to RGBA pixel format. The result is a RGBA bitmap. NB: this just works with the first mipmaps
    Parameters:
    factor The blend factor. 0 means the result is equal to Bm0, 256 means the result is equal to Bm1
    inputBitmapIsMutable when true, bitmap can be converted in place when needed (no copy done)

Definition at line 2817 of file bitmap.cpp.

References NLMISC::CBitmap::_Data, NLMISC::CBitmap::_Height, NLMISC::CBitmap::_Width, NLMISC::CBitmap::convertToRGBA(), nlassert, NLMISC::CBitmap::PixelFormat, NLMISC::CBitmap::resize(), NLMISC::CBitmap::RGBA, uint, uint16, uint64, and uint8.

02818 {
02819         nlassert(factor <= 256);
02820 
02821         nlassert(Bm0._Width != 0 && Bm0._Height != 0
02822                          && Bm1._Width != 0 && Bm1._Height != 0);
02823 
02824         nlassert(Bm0._Width  == Bm1._Width);    // the bitmap should have the same size
02825         nlassert(Bm0._Height == Bm1._Height);
02826 
02827         const CBitmap *nBm0, *nBm1; // pointer to the bitmap that is used for blending, or to a copy is a conversion wa required
02828 
02829         CBitmap cp0, cp1; // these bitmap are copies of Bm1 and Bm0 if a conversion was needed
02830 
02831         if (Bm0.PixelFormat != RGBA)
02832         {
02833                 if (inputBitmapIsMutable)
02834                 {
02835                         Bm0.convertToRGBA();
02836                         nBm0 = &Bm0;
02837                 }
02838                 else
02839                 {               
02840                         cp0 = Bm0;
02841                         cp0.convertToRGBA();
02842                         nBm0 = &cp0;
02843                 }
02844         }
02845         else
02846         {
02847                 nBm0 = &Bm0;
02848         }
02849 
02850 
02851         if (Bm1.PixelFormat != RGBA)
02852         {
02853                 if (inputBitmapIsMutable)
02854                 {
02855                         Bm1.convertToRGBA();
02856                         nBm1 = &Bm1;
02857                 }
02858                 else
02859                 {
02860                         cp1 = Bm1;
02861                         cp1.convertToRGBA();
02862                         nBm1 = &cp1;
02863                 }
02864         }
02865         else
02866         {
02867                 nBm1 = &Bm1;
02868         }
02869 
02870         this->resize(Bm0._Width, Bm0._Height, RGBA);
02871 
02872         uint numPix = _Width * _Height; // 4 component per pixels
02873 
02874 
02875         const uint8 *src0               = &(nBm0->_Data[0][0]);
02876         const uint8 *src1               = &(nBm1->_Data[0][0]);
02877         uint8 *dest                             = &(this->_Data[0][0]);
02878         
02879 
02880         #ifdef NL_OS_WINDOWS                    
02881         if (CSystemInfo::hasMMX())              
02882         {
02883                 // On a P4 2GHz, with a 256x256 texture, I got the following results :
02884                 // without mmx : 5.2 ms
02885         // with mmx    : 1.7 ms
02886                 // I'm sure this can be further optimized..
02887 
02888                 uint numPixLeft = numPix & 1; // process 2 pixels at once, so special case for odd number
02889                 numPix = numPix & ~1;
02890                 // do fast blend with mmx
02891                 uint64 blendFactor0;
02892                 uint64 blendFactor1;
02893                 uint16 *bf0 = (uint16 *) &blendFactor0;
02894                 uint16 *bf1 = (uint16 *) &blendFactor1;
02895                 bf0[0] = bf0[1] = bf0[2] = bf0[3] = factor;
02896                 bf1[0] = bf1[1] = bf1[2] = bf1[3] = 256 - factor;
02897                 __asm
02898                 {                       
02899                         mov esi, src0
02900                         mov eax, src1
02901                         mov edi, dest
02902                         mov ebx, -8
02903                         mov ecx, numPix
02904                         shr ecx, 1 // process pixels 2 by 2
02905                         movq mm1, blendFactor0
02906                         movq mm0, blendFactor1 
02907                                 
02908                 myLoop:
02909                         pxor mm6, mm6
02910                         lea  ebx, [ebx + 8] // points next location
02911                         pxor mm7, mm7                   
02912                         movq mm2, [esi + ebx]
02913                         movq mm3, [eax + ebx]                   
02914                         // do blend 
02915                         punpckhbw mm7, mm2  // mm7 contains src0 color 0 in high bytes
02916                         punpckhbw mm6, mm3  // mm6 contains src1 color 0 in high bytes
02917                         psrl      mm7, 1
02918                         pxor mm4, mm4       // mm4 = 0                  
02919                         psrl      mm6, 1
02920                         pmulhw mm7, mm0     // src0 = src0 * blendFactor
02921                         pxor mm5, mm5       // mm5 = 0
02922                         pmulhw mm6, mm1     // src1 = src1 * (1 - blendfactor)
02923                         punpcklbw mm4, mm2  // mm4 contains src0 color 1 in high bytes
02924                         paddusw mm6, mm7    // mm6 = src0[0] blended with src1[0]
02925                         psrl      mm4, 1
02926                         punpcklbw mm5, mm3  // mm4 contains src1 color 1 in high bytes
02927                         psll      mm6, 1
02928                         psrl      mm5, 1
02929                         pmulhw    mm4, mm0     // src0 = src0 * blendFactor
02930                         pmulhw    mm5, mm1     // src1 = src1 * (1 - blendfactor)
02931                         paddusw   mm4, mm5    // mm6 = src0[1] blended with src1[1]
02932                         psll      mm4, 1
02933                         // pack result
02934                         packuswb  mm4, mm6
02935                         dec               ecx
02936                         movq      [edi + ebx], mm4  // store result
02937                         jne myLoop
02938                         emms
02939                 }
02940                 if (numPixLeft)
02941                 {
02942                         // case of odd number of pixels
02943                         src0 += 4 * numPix;
02944                         src1 += 4 * numPix;
02945                         dest += 4 * numPix;
02946                         uint blendFact    = (uint) factor;
02947                         uint invblendFact = 256 - blendFact;                    
02948                         *dest = (uint8) (((blendFact * *src1)           + (invblendFact * *src0)) >> 8);
02949                         *(dest + 1) = (uint8) (((blendFact * *(src1 + 1)) + (invblendFact * *(src0 + 1))) >> 8);
02950                         *(dest + 2) = (uint8) (((blendFact * *(src1 + 2)) + (invblendFact * *(src0 + 2))) >> 8);
02951                         *(dest + 3)  = (uint8) (((blendFact * *(src1 + 3)) + (invblendFact * *(src0 + 3))) >> 8);
02952                 }
02953         }       
02954         else    
02955         #endif //#ifdef NL_OS_WINDOWS   
02956         {       
02957                 uint8 *endPix                   = dest + (numPix << 2);
02958                 // no mmx version
02959                 uint blendFact    = (uint) factor;
02960                 uint invblendFact = 256 - blendFact;
02961                 do
02962                 {
02964                         *dest = (uint8) (((blendFact * *src1)           + (invblendFact * *src0)) >> 8);
02965                         *(dest + 1) = (uint8) (((blendFact * *(src1 + 1)) + (invblendFact * *(src0 + 1))) >> 8);
02966                         *(dest + 2) = (uint8) (((blendFact * *(src1 + 2)) + (invblendFact * *(src0 + 2))) >> 8);
02967                         *(dest + 3)  = (uint8) (((blendFact * *(src1 + 3)) + (invblendFact * *(src0 + 3))) >> 8);
02968 
02969                         src0 = src0 + 4;
02970                         src1 = src1 + 4;
02971                         dest = dest + 4;        
02972                 }
02973                 while (dest != endPix);
02974         }
02975 }

bool NLMISC::CBitmap::blit const CBitmap src,
sint32  x,
sint32  y
[inherited]
 

Perform a simple blit from the source to this bitmap at the (x, y) pos The dimension of the original bitmap are preserved For now, this texture and the source must have the same format With DXTC format, the dest coordinates must be a multiple of 4 mipmap are not rebuild when present

Returns:
true if the params were corrects and if the blit occures. In debug build there's an assertion

Definition at line 2332 of file bitmap.cpp.

References NLMISC::CBitmap::bitPerPixels, NLMISC::CBitmap::DonTKnow, height, nlassert, NLMISC::CBitmap::PixelFormat, sint, sint32, src, uint, uint8, width, x, and y.

Referenced by NL3D::CTextureGrouped::doGenerate(), and NL3D::CCoarseMeshBuild::expand().

02333 {
02334         
02335         nlassert(this->PixelFormat == src->PixelFormat);
02336         if (this->PixelFormat != src->PixelFormat)
02337         {
02338                 return false;
02339         }
02340 
02341 
02342         // check for dxtc use
02343 
02344         const bool useDXTC   =  PixelFormat == DXTC1 || PixelFormat == DXTC1Alpha || PixelFormat == DXTC3 || PixelFormat ==     DXTC5;
02345 
02346         // number of bits for a 4x4 pix block
02347         const uint dxtcNumBits  =  PixelFormat == DXTC1 || PixelFormat == DXTC1Alpha ? 64 : 128;
02348         
02349 
02350         if (useDXTC)
02351         {
02352                 // blit pos must be multiple of 4
02353 
02354                 nlassert(! (x & 3 || y & 3) );
02355                 if (x & 3 || y & 3) return false;
02356 
02357         }
02358 
02359         nlassert(PixelFormat != DonTKnow);
02360 
02361         // the width to copy
02362         sint width = src->_Width;
02363         // the height to copy
02364         sint height = src->_Height;
02365 
02366         uint destStartX, destStartY;
02367         uint srcStartX, srcStartY;
02368 
02369 
02370         // clip against left
02371         if (x < 0)
02372         {
02373                 width += x;
02374                 if (width <= 0) return true;
02375                 destStartX = 0;
02376                 srcStartX = -x;
02377         }
02378         else
02379         {
02380                 destStartX = x;
02381                 srcStartX = 0;
02382         }
02383 
02384         // clip against top
02385         if (y < 0)
02386         {
02387                 height += y;
02388                 if (height <= 0) return true;
02389                 srcStartY = -y;
02390                 destStartY = 0;
02391         }
02392         else
02393         {
02394                 destStartY = y;
02395                 srcStartY = 0;
02396         }
02397 
02398         // clip against right
02399         if ((destStartX + width - 1) >= _Width)
02400         {
02401                 width = _Width - destStartX;
02402                 if (width <= 0) return true;
02403         }
02404 
02405         // clip against bottom
02406         if ((destStartY + height - 1) >= _Height)
02407         {
02408                 height = _Height - destStartY;
02409                 if (width <= 0) return true;
02410         }
02411 
02412 
02413         // divide all distance by 4 when using DXTC
02414         if (useDXTC)
02415         {
02416                 destStartX >>= 2;
02417                 destStartY >>= 2;
02418                 srcStartX >>= 2;
02419                 srcStartY >>= 2;
02420                 width >>= 2;
02421                 height >>= 2;
02422         }
02423         
02424 
02425         // bytes per pixs is for either one pixel or 16 (a 4x4 block in DXTC)
02426         const uint bytePerPixs = ( useDXTC ? dxtcNumBits : bitPerPixels[PixelFormat] ) >> 3 /* divide by 8 to get the number of bytes */;
02427 
02428 
02429         const uint destRealWidth = useDXTC ? (_Width >> 2) : _Width;
02430         const uint srcRealWidth = useDXTC ? (src->_Width >> 2) : src->_Width;
02431         
02432 
02433         // size to go to the next line in the destination
02434         const uint destStride = destRealWidth * bytePerPixs;
02435 
02436         // size to go to the next line in the source
02437         const uint srcStride = srcRealWidth * bytePerPixs;
02438         
02439         // length in bytes of a line to copy
02440         const uint lineLength = width * bytePerPixs;
02441 
02442 
02443         uint8  *destPos = &(_Data[0][0]) + destStride * destStartY + bytePerPixs * destStartX;
02444         const uint8 *srcPos = &(src->_Data[0][0]) + srcStride * srcStartY + bytePerPixs * srcStartX;
02445 
02446         // copy each hline
02447         for (sint k = 0; k < height; ++k)
02448         {
02449                 ::memcpy(destPos, srcPos, lineLength);
02450                 destPos += destStride;
02451                 srcPos += srcStride;
02452         }
02453 
02454         
02455         return true;
02456 }

void NLMISC::CBitmap::buildMipMaps  )  [inherited]
 

Build the mipmaps of the bitmap if they don't exist. Work only in RGBA mode...

See also:
releaseMipMaps().

Definition at line 1422 of file bitmap.cpp.

References NLMISC::CBitmap::_MipMapCount, NLMISC::CRGBA::A, NLMISC::CRGBA::B, NLMISC::CRGBA::G, NLMISC::isPowerOf2(), NLMISC::CBitmap::PixelFormat, NLMISC::CRGBA::R, NLMISC::CObjectVector< uint8 >::resize(), NLMISC::CBitmap::RGBA, sint, uint32, and w.

Referenced by NL3D::CHLSColorTexture::addMask(), NL3D::CTextureMem::doGenerate(), NLMISC::CBitmap::flipH(), NLMISC::CBitmap::flipV(), NLMISC::CBitmap::resample(), NLMISC::CBitmap::rot90CCW(), NLMISC::CBitmap::rot90CW(), and NL3D::CDriverGL::setupTextureEx().

01423 {
01424         uint32 i,j;
01425 
01426         if(PixelFormat!=RGBA) return;
01427         if(_MipMapCount!=1) return;
01428         if(!NLMISC::isPowerOf2(_Width)) return;
01429         if(!NLMISC::isPowerOf2(_Height)) return;
01430         
01431         uint32 w = _Width;
01432         uint32 h = _Height;
01433 
01434         while(w>1 || h>1)
01435         {
01436                 uint32 precw = w;
01437                 uint32 prech = h;
01438                 w = (w+1)/2;
01439                 h = (h+1)/2;
01440                 uint32  mulw= precw/w;
01441                 uint32  mulh= prech/h;
01442 
01443                 _Data[_MipMapCount].resize(w*h*4);
01444                 
01445         
01446                 NLMISC::CRGBA *pRgba = (NLMISC::CRGBA*)&_Data[_MipMapCount][0];
01447                 NLMISC::CRGBA *pRgbaPrev = (NLMISC::CRGBA*)&_Data[_MipMapCount-1][0];
01448                 for(i=0; i<h; i++)
01449                 {
01450                         sint    i0= mulh*i;
01451                         sint    i1= mulh*i+1;
01452                         if(mulh==1)
01453                                 i1=i0;
01454                         i0*=precw;
01455                         i1*=precw;
01456                         for(j=0; j<w; j++)
01457                         {
01458                                 sint    j0= mulw*j;
01459                                 sint    j1= mulw*j+1;
01460                                 if(mulh==1)
01461                                         j1=j0;
01462                                 CRGBA   &c0= pRgbaPrev[i0+j0];
01463                                 CRGBA   &c1= pRgbaPrev[i0+j1];
01464                                 CRGBA   &c2= pRgbaPrev[i1+j0];
01465                                 CRGBA   &c3= pRgbaPrev[i1+j1];
01466                                 pRgba[i*w + j].R = (c0.R +
01467                                                                         c1.R +
01468                                                                         c2.R +
01469                                                                         c3.R + 2 ) /4;
01470                                 pRgba[i*w + j].G = (c0.G +
01471                                                                         c1.G +
01472                                                                         c2.G +
01473                                                                         c3.G + 2 ) /4;
01474                                 pRgba[i*w + j].B = (c0.B +
01475                                                                         c1.B +
01476                                                                         c2.B +
01477                                                                         c3.B + 2 ) /4;
01478                                 pRgba[i*w + j].A = (c0.A +
01479                                                                         c1.A +
01480                                                                         c2.A +
01481                                                                         c3.A + 2 ) /4;
01482                         }
01483                 }
01484 
01485                 _MipMapCount++;
01486         }
01487 }

virtual ITexture* NL3D::ITexture::buildNonSelectableVersion uint  index  )  [inline, virtual, inherited]
 

If this texture is selectable, build a non selectable version of this texture that is setupped with the given slot. NB : If this texture is selectable, you are ensured that the return pointer is not 'this'

Reimplemented in NL3D::CTextureCube, and NL3D::CTextureMultiFile.

Definition at line 368 of file texture.h.

References index, and uint.

Referenced by NL3D::CMeshBaseInstance::selectTextureSet().

00368 { return this; }

void NL3D::ITexture::clearTouched void   )  [inline, inherited]
 

Definition at line 448 of file texture.h.

References NL3D::ITexture::_ListInvalidRect.

Referenced by NL3D::CDriverGL::setupTextureEx().

00449         { 
00450                 _Touched=false; 
00451                 _ListInvalidRect.clear();
00452         }

bool NLMISC::CBitmap::convertToType TType  type  )  [inherited]
 

Convert bitmap to another type conversion to rgba always work. No-op if already rgba.

Parameters:
type new type for the bitmap
Returns:
true if conversion succeeded, false else

Definition at line 926 of file bitmap.cpp.

References NLMISC::CBitmap::convertToAlpha(), NLMISC::CBitmap::convertToAlphaLuminance(), NLMISC::CBitmap::convertToDXTC5(), NLMISC::CBitmap::convertToLuminance(), NLMISC::CBitmap::convertToRGBA(), NLMISC::CBitmap::PixelFormat, NLMISC::CBitmap::RGBA, and type.

Referenced by NL3D::CHLSColorTexture::addMask(), NL3D::CLodCharacterTmpBitmap::build(), NL3D::CCoarseMeshBuild::buildBitmap(), NL3D::CTextureFile::buildBitmapFromFile(), NL3D::CHeightMap::buildFromBitmap(), NL3D::CAsyncTextureManager::CTextureEntry::createCoarseBitmap(), NL3D::CZoneLighter::getTexture(), NL3D::CTileBank::getTileNoiseMap(), and NL3D::CDriverGL::setupTextureEx().

00927 {
00928         if(PixelFormat==type) return true;
00929 
00930         switch(type)
00931         {
00932                 case RGBA :
00933                         return convertToRGBA();
00934                         break;
00935 
00936                 case DXTC5 :
00937                         return convertToDXTC5();                
00938                         break;
00939 
00940                 case Luminance :
00941                         return convertToLuminance();
00942                         break;
00943 
00944                 case Alpha :
00945                         return convertToAlpha();
00946                         break;
00947 
00948                 case AlphaLuminance :
00949                         return convertToAlphaLuminance();
00950                         break;
00951 
00952                 default:
00953                         break;
00954         }
00955         
00956         return false;
00957 }

void NL3D::CTextureFar::doGenerate bool  async = false  )  [virtual]
 

Generate the texture. See ITexture::doGenerate().

See also:
ITexture::doGenerate()

Implements NL3D::ITexture.

Definition at line 420 of file texture_far.cpp.

References _PosToPatchMap, NL_FAR_TEXTURE_EDGE_SIZE, rebuildPatch(), and uint16.

00421 {
00422         // Resize. But don't need to fill with 0!!
00423         CBitmap::resize (NL_FAR_TEXTURE_EDGE_SIZE, NL_FAR_TEXTURE_EDGE_SIZE, RGBA, false);
00424 
00425         // Rectangle invalidate ?
00426         if (_ListInvalidRect.begin()!=_ListInvalidRect.end())
00427         {
00428                 // Yes, rebuild only those rectangles.
00429 
00430                 // For each rectangle to compute
00431                 std::list<NLMISC::CRect>::iterator ite=_ListInvalidRect.begin();
00432                 while (ite!=_ListInvalidRect.end())
00433                 {
00434                         // Get the PatchIdent.
00435                         CVector2s       pos((uint16)ite->left(), (uint16)ite->top());
00436                         TPosToPatchMap::iterator        itPosToPid= _PosToPatchMap.find( pos );
00437                         // If the patch is still here...
00438                         if( itPosToPid!=_PosToPatchMap.end() )
00439                         {
00440                                 // ReBuild the rectangle.
00441                                 rebuildPatch (pos, itPosToPid->second);
00442                         }
00443 
00444                         // Next rectangle
00445                         ite++;
00446                 }
00447         }
00448         else
00449         {
00450                 // Parse all existing Patchs.
00451                 TPosToPatchMap::iterator        itPosToPid= _PosToPatchMap.begin();
00452                 while( itPosToPid!= _PosToPatchMap.end() )
00453                 {
00454                         // ReBuild the rectangle.
00455                         rebuildPatch (itPosToPid->first, itPosToPid->second);
00456 
00457                         itPosToPid++;
00458                 }
00459         }
00460 }

bool NL3D::CTextureFar::endPatchULTouch  )  const
 

Definition at line 411 of file texture_far.cpp.

References _ItULPatch, and _PatchToPosMap.

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

00412 {
00413         return _ItULPatch == _PatchToPosMap.end();
00414 }

void NLMISC::CBitmap::flipH  )  [inherited]
 

Horizontal flip (all the columns are flipped)

Definition at line 2682 of file bitmap.cpp.

References NLMISC::CBitmap::_MipMapCount, NLMISC::CBitmap::buildMipMaps(), NLMISC::CBitmap::getHeight(), NLMISC::CBitmap::getWidth(), NLMISC::CBitmap::PixelFormat, NLMISC::CBitmap::releaseMipMaps(), NLMISC::CBitmap::RGBA, and sint32.

02683 {
02684         if (PixelFormat != RGBA)
02685                 return;
02686 
02687         sint32 nWidth = getWidth(0);
02688         sint32 nHeight = getHeight(0);
02689         sint32 i, j;
02690         NLMISC::CRGBA *pBitmap = (NLMISC::CRGBA*)&_Data[0][0];
02691         bool needRebuild = false;
02692         CRGBA temp;
02693 
02694         if(_MipMapCount>1)
02695                 needRebuild = true;
02696         releaseMipMaps();
02697 
02698         for( i = 0; i < nHeight; ++i )
02699                 for( j = 0; j < nWidth/2; ++j )
02700                 {
02701                         temp = pBitmap[i*nWidth+j];
02702                         pBitmap[i*nWidth+j] = pBitmap[i*nWidth+nWidth-j-1];
02703                         pBitmap[i*nWidth+nWidth-j-1] = temp;
02704                 }
02705 
02706         // Rebuilding mipmaps
02707         if(needRebuild)
02708         {
02709                 buildMipMaps();
02710         }
02711 }

void NLMISC::CBitmap::flipV  )  [inherited]
 

Vertical flip (all the rows are flipped)

Definition at line 2714 of file bitmap.cpp.

References NLMISC::CBitmap::_MipMapCount, NLMISC::CBitmap::buildMipMaps(), NLMISC::CBitmap::getHeight(), NLMISC::CBitmap::getWidth(), NLMISC::CBitmap::PixelFormat, NLMISC::CBitmap::releaseMipMaps(), NLMISC::CBitmap::RGBA, and sint32.

02715 {
02716         if (PixelFormat != RGBA)
02717                 return;
02718 
02719         sint32 nWidth = getWidth(0);
02720         sint32 nHeight = getHeight(0);
02721         sint32 i, j;
02722         NLMISC::CRGBA *pBitmap = (NLMISC::CRGBA*)&_Data[0][0];
02723         bool needRebuild = false;
02724         CRGBA temp;
02725 
02726         if(_MipMapCount>1)
02727                 needRebuild = true;
02728         releaseMipMaps();
02729 
02730         for( j = 0; j < nHeight/2; ++j )
02731                 for( i = 0; i < nWidth; ++i )
02732                 {
02733                         temp = pBitmap[j*nWidth+i];
02734                         pBitmap[j*nWidth+i] = pBitmap[(nHeight-j-1)*nWidth+i];
02735                         pBitmap[(nHeight-j-1)*nWidth+i] = temp;
02736                 }
02737 
02738         // Rebuilding mipmaps
02739         if(needRebuild)
02740         {
02741                 buildMipMaps();
02742         }
02743 }

void NL3D::ITexture::generate bool  async = false  )  [inline, inherited]
 

Generate the texture pixels.

This method is called by the driver when it needs to generate pixels of the texture. If the texture is used for the first time or if it is touched, the driver will call this method. For exemple, a texture file will load the bitmap in this method.

If the invalidate rect list is empty, generate() rebuild all the texture. If the invalidate rect list is not empty, generate() rebuilds only the invalidate rectangles in the list.

Don't clear the touch flag or the invalid rectangle list until updating the texture in generate(). It's the generate()'s caller jobs.

After generation, if the texture is releasable, the driver will release the texture by calling release().

NB: a flag is maintained to see if the generated bitmap is coherent with texture description (see touch*()). So if you do {generate(); generate();}, you only get 1 real bitmap generation...

If, after the doGenerate, the bitmap format is compressed (DXTC) and no mipmaps have been generated, the mipmap are disabled beacause the user probably don't want the driver to unpacks the texture, generates the mipmaps and repacks the dxtc texture (that takes a lot of CPU time).

Parameters:
async tells the texture if the call is made asynchronously or not.
See also:
isAllInvalidated(), touch(), touched(), touchRect(), clearTouched(), _ListInvalidRect

getReleasable(), setReleasable()

Definition at line 309 of file texture.h.

References NL3D::ITexture::_GoodGenerate, and NL3D::ITexture::doGenerate().

Referenced by NL3D::CShadowMapManager::allocateTexture(), NL3D::CCoarseMeshBuild::buildBitmap(), NL3D::CTextureCube::doGenerate(), NL3D::CZoneLighter::getTexture(), NL3D::GetTextureSize(), NL3D::CTileBank::getTileNoiseMap(), NL3D::CZoneLighter::lightWater(), NL3D::CAsyncFileManager3D::CTextureLoad::run(), NL3D::CAsyncFileManager3D::CMeshLoad::run(), NL3D::CPSMultiTexturedParticle::setupMaterial(), and NL3D::CDriverGL::setupTextureEx().

00310         {
00311                 if(!_GoodGenerate)
00312                 {
00313                         doGenerate(async);
00314                         _GoodGenerate=true;
00315                 }
00316         }

virtual std::string NLMISC::IClassable::getClassName  )  [pure virtual, inherited]
 

Implemented in NLAIAGENT::CNumericIndex, NLAIC::IPointerGestion, NLAIC::CIdentType, and CAutomataDesc.

Referenced by NLMISC::CClassRegistry::checkObject(), and NL3D::GetTextureSize().

CRGBAF NLMISC::CBitmap::getColor float  x,
float  y
const [inherited]
 

Get the color in the bitmap given a pixel size The mipmaps must be built. If not just return the bilinear at the given point. The input x and y must be clamped between 0 and 1

Definition at line 2470 of file bitmap.cpp.

References NLMISC::CRGBAF::A, NLMISC::CRGBAF::B, NLMISC::CRGBAF::G, NLMISC::CBitmap::getColorInterp(), NLMISC::CBitmap::getHeight(), NLMISC::CBitmap::getPixelColor(), NLMISC::CBitmap::getPixels(), NLMISC::CBitmap::getWidth(), nlassert, NLMISC::CBitmap::PixelFormat, NLMISC::CRGBAF::R, NLMISC::CBitmap::RGBA, sint32, uint32, x, and y.

02471 {
02472         if (x < 0.0f) x = 0.0f;
02473         if (x > 1.0f) x = 1.0f;
02474         if (y < 0.0f) y = 0.0f;
02475         if (y > 1.0f) y = 1.0f;
02476 
02477         sint32 nWidth = getWidth(0);
02478         sint32 nHeight = getHeight(0);
02479 
02480         if (nWidth == 0 || nHeight == 0) return CRGBAF(0, 0, 0, 0);
02481 
02482         const CObjectVector<uint8> &rBitmap = getPixels(0);
02483         sint32 nX[4], nY[4];
02484 
02485         x *= nWidth-1;
02486         y *= nHeight-1;
02487 
02488         // Integer part of (x,y)
02489         //nX[0] = ((sint32)floor(x-0.5f));
02490         //nY[0] = ((sint32)floor(y-0.5f));
02491         nX[0] = ((sint32)floor(x));
02492         nY[0] = ((sint32)floor(y));
02493 
02494         nX[1] = (nX[0] < (nWidth-1) ? nX[0]+1 : nX[0]);
02495         nY[1] = nY[0];
02496 
02497         nX[2] = nX[0];
02498         nY[2] = (nY[0] < (nHeight-1) ? nY[0]+1 : nY[0]);
02499 
02500         nX[3] = nX[1];
02501         nY[3] = nY[2];
02502 
02503         uint32 i;
02504 
02505         for (i = 0; i < 4; ++i)
02506         {
02507                 nlassert (nX[i] >= 0);
02508                 nlassert (nY[i] >= 0 );
02509                 nlassert (nX[i] < nWidth);
02510                 nlassert (nY[i] < nHeight);
02511         }
02512 
02513         // Decimal part of (x,y)
02514         x = x - (float)nX[0]; 
02515         y = y - (float)nY[0];
02516 
02517         switch (this->PixelFormat)
02518         {
02519                 case RGBA:
02520                 case DXTC1:
02521                 case DXTC1Alpha:
02522                 case DXTC3:
02523                 case DXTC5:
02524                 {                                                                       
02525                         CRGBAF finalVal;
02526                         CRGBA val[4];
02527 
02528                         if (this->PixelFormat == RGBA)
02529                         {
02530                                 for (i = 0; i < 4; ++i)
02531                                 {
02532                                         val[i] = CRGBA (rBitmap[(nX[i]+nY[i]*nWidth)*4+0],
02533                                                                         rBitmap[(nX[i]+nY[i]*nWidth)*4+1],
02534                                                                         rBitmap[(nX[i]+nY[i]*nWidth)*4+2],
02535                                                                         rBitmap[(nX[i]+nY[i]*nWidth)*4+3]);
02536                                 }
02537                         }
02538                         else
02539                         {
02540                                 // slower version : get from DXT
02541                                 for (i = 0; i < 4; ++i)
02542                                 {
02543                                         val[i] = getPixelColor(nX[i], nY[i]);
02544                                 }
02545                         }
02546 
02547                         finalVal.R = getColorInterp (x, y, val[0].R, val[1].R, val[2].R, val[3].R);
02548                         finalVal.G = getColorInterp (x, y, val[0].G, val[1].G, val[2].G, val[3].G);
02549                         finalVal.B = getColorInterp (x, y, val[0].B, val[1].B, val[2].B, val[3].B);
02550                         finalVal.A = getColorInterp (x, y, val[0].A, val[1].A, val[2].A, val[3].A);
02551                         finalVal /= 255.f;
02552 
02553                         return finalVal;                        
02554                 }
02555                 break;
02556                 case Alpha:
02557                 case Luminance:
02558                 {
02559                         
02560                         float finalVal;
02561                         float val[4];
02562 
02563                         for (i = 0; i < 4; ++i)
02564                                 val[i] = rBitmap[(nX[i]+nY[i]*nWidth)];
02565 
02566                         finalVal = getColorInterp (x, y, val[0], val[1], val[2], val[3]);
02567                         finalVal /= 255.f;
02568 
02569                         if (this->PixelFormat == Alpha)
02570                                 return CRGBAF (1.f, 1.f, 1.f, finalVal);
02571                         else // Luminance
02572                                 return CRGBAF (finalVal, finalVal, finalVal, 1.f);
02573                 }
02574                 break;
02575                 default: break;
02576         }
02577 
02578         return CRGBAF (0.0f, 0.0f, 0.0f, 0.0f);
02579 }

uint NL3D::CTextureFar::getFreeListId uint  width,
uint  height
[private]
 

Definition at line 128 of file texture_far.cpp.

References NLMISC::getPowerOf2(), height, NLMISC::isPowerOf2(), NL_MAX_FAR_PATCH_EDGE, NL_NUM_FAR_PATCH_EDGE_LEVEL, NL_NUM_FAR_RECTANGLE_RATIO, nlassert, uint, and width.

Referenced by allocatePatch(), CTextureFar(), recursSplitNext(), removePatch(), and tryAllocatePatch().

00129 {
00130         nlassert(width>=height);
00131         nlassert(isPowerOf2(width));
00132         nlassert(isPowerOf2(height));
00133         nlassert(width<=NL_MAX_FAR_PATCH_EDGE);
00134 
00135         // compute the level index
00136         uint    sizeIndex= getPowerOf2(NL_MAX_FAR_PATCH_EDGE / width);
00137         nlassert(sizeIndex < NL_NUM_FAR_PATCH_EDGE_LEVEL);
00138 
00139         // Compute the aspect ratio index.
00140         uint    aspectRatioIndex= getPowerOf2(width/height);
00141         nlassert(aspectRatioIndex < NL_NUM_FAR_RECTANGLE_RATIO );
00142 
00143         return sizeIndex*NL_NUM_FAR_RECTANGLE_RATIO + aspectRatioIndex;
00144 }

uint32 NLMISC::CBitmap::getHeight uint32  numMipMap = 0  )  const [virtual, inherited]
 

Return the image height, or a mipmap height.

Parameters:
mipMap mipmap level
Returns:
image height (0 if mipmap not found)

Definition at line 1388 of file bitmap.cpp.

References uint32, and w.

Referenced by NL3D::CHLSColorTexture::addMask(), NL3D::CLodCharacterTmpBitmap::build(), NL3D::CCoarseMeshBuild::buildBitmap(), NL3D::CTextureFile::buildBitmapFromFile(), NL3D::CFontManager::computeString(), NL3D::CFastHLSModifier::convertDDSBitmap(), draw2dLine(), NL3D::CCoarseMeshBuild::expand(), NL3D::CDriverGL::fillBuffer(), NLMISC::CBitmap::flipH(), NLMISC::CBitmap::flipV(), NL3D::CPatchDLMContext::generate(), NLMISC::CBitmap::getColor(), NLMISC::CBitmap::getDXTC1Texel(), NLMISC::CBitmap::getDXTC3Texel(), NLMISC::CBitmap::getDXTC5Texel(), NLMISC::CBitmap::getRGBAPixel(), NLMISC::CBitmap::getSize(), NL3D::GetTextureSize(), NL3D::CTileBank::getTileNoiseMap(), NL3D::CZoneLighter::lightWater(), NL3D::CShapeBank::processWSUploadTexture(), RenderTriangle(), NLMISC::CBitmap::rot90CCW(), NLMISC::CBitmap::rot90CW(), NL3D::CHLSColorTexture::setBitmap(), NL3D::CDriverGL::setupTextureEx(), NL3D::CDriverGL::uploadTexture(), and NL3D::CAsyncTextureManager::uploadTexturePart().

01389 {
01390         if(mipMap==0) return _Height;
01391         
01392         uint32 w = _Width;
01393         uint32 h = _Height;
01394         uint32 m = 0;
01395 
01396         do
01397         {
01398                 m++;
01399                 w = (w+1)/2;
01400                 h = (h+1)/2;
01401                 if(m==mipMap) return h;
01402         }
01403         while(w!=1 || h!=1);
01404 
01405         return 0;
01406 }

TMagFilter NL3D::ITexture::getMagFilter  )  const [inline, inherited]
 

Definition at line 214 of file texture.h.

References NL3D::ITexture::_MagFilter, and NL3D::ITexture::TMagFilter.

Referenced by NL3D::CDriverGL::activateTexture(), and NL3D::CDriverGL::setupTextureEx().

00214 {return _MagFilter;}

TMinFilter NL3D::ITexture::getMinFilter  )  const [inline, inherited]
 

Definition at line 215 of file texture.h.

References NL3D::ITexture::_MinFilter, and NL3D::ITexture::TMinFilter.

Referenced by NL3D::CDriverGL::activateTexture(), and NL3D::CDriverGL::setupTextureEx().

00215 {return _MinFilter;}

uint32 NLMISC::CBitmap::getMipMapCount  )  const [inline, inherited]
 

Return the number of mipmaps. Level0 is a mipmap...

Returns:
number of mipmaps. 0 if no image at all. 1 if no mipmaping (for the base level).

Definition at line 369 of file bitmap.h.

References NLMISC::CBitmap::_MipMapCount, and uint32.

Referenced by NL3D::CHLSColorTexture::addMask(), NL3D::CShapeBank::processWSUploadTexture(), NL3D::CHLSColorTexture::setBitmap(), NL3D::CDriverGL::setupTextureEx(), NL3D::CDriverGL::uploadTexture(), NL3D::CAsyncTextureManager::uploadTexturePart(), and NL3D::CAsyncTextureManager::validDXTCMipMap().

00370         {
00371                 return _MipMapCount; 
00372         }

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

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

Definition at line 139 of file texture_far.h.

References _ULNext.

Referenced by NL3D::CLandscape::clearFarRenderPass(), and NL3D::CLandscape::updateLightingTextureFar().

00139 {return _ULNext;}

CRGBA NLMISC::CBitmap::getPixelColor sint  x,
sint  y,
uint32  numMipMap = 0
const [inherited]
 

Get the pixel at the given coorrdinate. Works in RGBA and DXTC modes. Outside of the bitmap it returns Black (or if mipmap is not found)

Definition at line 3134 of file bitmap.cpp.

References NLMISC::CBitmap::getDXTC1Texel(), NLMISC::CBitmap::getDXTC3Texel(), NLMISC::CBitmap::getDXTC5Texel(), NLMISC::CBitmap::getRGBAPixel(), nlstop, NLMISC::CBitmap::PixelFormat, NLMISC::CBitmap::RGBA, sint, uint32, x, and y.

Referenced by NLMISC::CBitmap::getColor().

03135 {
03136         
03137         switch (PixelFormat)
03138         {
03139                 case RGBA:      
03140                         return getRGBAPixel(x, y, numMipMap);           
03141                 case DXTC1:
03142                 case DXTC1Alpha: 
03143                         return getDXTC1Texel(x, y, numMipMap);
03144                 case DXTC3:
03145                         return getDXTC3Texel(x, y, numMipMap);
03146                 case DXTC5:
03147                         return getDXTC5Texel(x, y, numMipMap);
03148                 default:
03149                         nlstop;
03150                 break;
03151         }
03152         return CRGBA::Black;
03153 }

TType NLMISC::CBitmap::getPixelFormat  )  const [inline, inherited]
 

Return the format of pixels stored at the present time in the object buffer.

Returns:
Pixel format (rgba luminance alpha alphaLuminance dxtc1 dxtc1Alpha dxtc3 dxtc5)

Definition at line 335 of file bitmap.h.

References NLMISC::CBitmap::PixelFormat.

Referenced by NL3D::CFastHLSModifier::convertDDSBitmap(), NL3D::CFastHLSModifier::convertRGBABitmap(), NL3D::CTextureGrouped::doGenerate(), NL3D::CDriverGL::fillBuffer(), NL3D::getGlSrcTextureFormat(), NL3D::CDriverGL::getGlTextureFormat(), NL3D::CShapeBank::processWSUploadTexture(), rebuildPatch(), NL3D::CHLSColorTexture::setBitmap(), NL3D::CDriverGL::setupTextureEx(), NL3D::CAsyncTextureManager::update(), NL3D::CDriverGL::uploadTexture(), NL3D::CAsyncTextureManager::uploadTexturePart(), and NL3D::CAsyncTextureManager::validDXTCMipMap().

00336         {
00337                 return PixelFormat; 
00338         }

const CObjectVector<uint8>& NLMISC::CBitmap::getPixels uint32  numMipMap = 0  )  const [inline, inherited]
 

Definition at line 313 of file bitmap.h.

References uint32.

00314         {
00315                 //nlassert (numMipMap<=_MipMapCount);
00316                 return _Data[numMipMap]; 
00317         }

CObjectVector<uint8>& NLMISC::CBitmap::getPixels uint32  numMipMap = 0  )  [inline, inherited]
 

Return the pixels buffer of the image, or of one of its mipmap. Return a reference of an array in pixel format get with getPixelFormat().

Returns:
CObjectVector<uint8>& RGBA pixels

Definition at line 308 of file bitmap.h.

References uint32.

Referenced by NL3D::CHLSColorTexture::addMask(), NL3D::CLodCharacterTmpBitmap::build(), NL3D::CTextureFile::buildBitmapFromFile(), NL3D::CHLSColorTexture::buildColorVersion(), NL3D::CFastHLSModifier::convertDDSBitmapDXTC1Or1A(), NL3D::CFastHLSModifier::convertDDSBitmapDXTC3Or5(), NL3D::CFastHLSModifier::convertRGBABitmap(), NL3D::CTextureDLM::copyRect(), NL3D::CTextureFont::CTextureFont(), NL3D::CTextureMem::doGenerate(), NL3D::CTextureEmboss::doGenerate(), NL3D::CTextureBump::doGenerate(), draw2dLine(), NL3D::CTextureFont::dumpTextureFont(), NL3D::CCoarseMeshBuild::expand(), NL3D::CDriverGL::fillBuffer(), NL3D::CTextureDLM::fillRect(), NL3D::CDriverGL::getBufferPart(), NLMISC::CBitmap::getColor(), NLMISC::CBitmap::getDXTC1Texel(), NLMISC::CBitmap::getDXTC3Texel(), NLMISC::CBitmap::getDXTC5Texel(), NLMISC::CBitmap::getRGBAPixel(), NL3D::CTileBank::getTileNoiseMap(), NL3D::CZoneLighter::lightWater(), NL3D::CTextureDLM::modulateAndfillRect565(), NL3D::CTextureDLM::modulateAndfillRect8888(), NL3D::CTextureDLM::modulateConstantAndfillRect(), rebuildPatch(), RenderTriangle(), NL3D::CHLSColorTexture::setBitmap(), NL3D::CDriverGL::setupTextureEx(), and NL3D::CDriverGL::uploadTexture().

00309         { 
00310                 //nlassert (numMipMap<=_MipMapCount);
00311                 return _Data[numMipMap];
00312         }

const sint& NLMISC::CRefCount::getRefCount  )  const [inline, inherited]
 

Definition at line 70 of file smart_ptr.h.

References NLMISC::CRefCount::crefs, and sint.

00071         {
00072                 return  crefs;
00073         }

bool NL3D::ITexture::getReleasable  )  const [inline, inherited]
 

Return whether texture can be released. If it returns true, the driver will release the texture after generate it and upload it into the videomemory by calling release(). If it returns false, the driver won't release the texture.

Returns:
true if texture can be released, false else
See also:
setReleasable(), generate()

Definition at line 267 of file texture.h.

References NL3D::ITexture::_Releasable.

Referenced by NL3D::CTextureBump::getNormalizationFactor(), NL3D::GetTextureSize(), NL3D::CShapeBank::processWSUploadTexture(), NL3D::CDriverGL::setupTextureEx(), and NL3D::CAsyncTextureManager::uploadTexturePart().

00267 { return _Releasable; }

virtual std::string NL3D::ITexture::getShareName  )  const [inline, virtual, inherited]
 

Return the Unique ident/name of the texture, used for Driver sharing caps. Deriver should add a prefix for their texture type. eg "file::pipoland", "noise::4-4-2" etc....

Reimplemented in NL3D::CTextureBlend, NL3D::CTextureBump, NL3D::CTextureCube, NL3D::CTextureEmboss, NL3D::CTextureFile, NL3D::CTextureGrouped, NL3D::CTextureMem, and NL3D::CTextureMultiFile.

Definition at line 338 of file texture.h.

Referenced by NL3D::CCoarseMeshBuild::buildBitmap(), NL3D::CZoneLighter::getTexture(), NL3D::IDriver::getTextureShareName(), NL3D::CCoarseMeshBuild::remapCoordinates(), and NL3D::CAsyncFileManager3D::CMeshLoad::run().

00338 {return std::string();}

uint32 NLMISC::CBitmap::getSize uint32  numMipMap = 0  )  const [inherited]
 

Return the size (in pixels) of the image: <=> getHeight()*getWidth().

Parameters:
mipMap mipmap level
Returns:
image size (0 if mipmap not found)

Definition at line 1412 of file bitmap.cpp.

References NLMISC::CBitmap::getHeight(), NLMISC::CBitmap::getWidth(), and uint32.

Referenced by NL3D::CShapeBank::processWSUploadTexture(), NL3D::CDriverGL::setupTextureEx(), NL3D::CAsyncTextureManager::update(), and NL3D::CAsyncTextureManager::uploadTexturePart().

01413 {
01414         return getHeight(numMipMap)*getWidth(numMipMap);
01415 }

TUploadFormat NL3D::ITexture::getUploadFormat  )  const [inline, inherited]
 

Definition at line 212 of file texture.h.

References NL3D::ITexture::_UploadFormat, and NL3D::ITexture::TUploadFormat.

Referenced by NL3D::CTextureBump::doGenerate(), NL3D::CDriverGL::getGlTextureFormat(), and NL3D::IDriver::getTextureShareName().

00212 {return _UploadFormat;}

bool NL3D::CTextureFar::getUpperSize uint width,
uint height
[private]
 

Definition at line 148 of file texture_far.cpp.

References height, NLMISC::isPowerOf2(), NL_MAX_FAR_PATCH_EDGE, nlassert, uint, and width.

Referenced by recursSplitNext(), and tryAllocatePatch().

00149 {
00150         nlassert(width>=height);
00151         nlassert(isPowerOf2(width));
00152         nlassert(isPowerOf2(height));
00153 
00154         // if height is smaller than widht, then reduce the ratio
00155         if(width>height)
00156         {
00157                 height*= 2;
00158                 return true;
00159         }
00160         else
00161         {
00162                 // else raise up to the next square level, if possible
00163                 if(width<NL_MAX_FAR_PATCH_EDGE)
00164                 {
00165                         width*= 2;
00166                         height*= 2;
00167                         return true;
00168                 }
00169                 else
00170                         return false;
00171         }
00172 }

uint32 NLMISC::CBitmap::getWidth uint32  numMipMap = 0  )  const [virtual, inherited]
 

Return the image width, or a mipmap width.

Parameters:
mipMap mipmap level
Returns:
image width (0 if mipmap not found)

Definition at line 1363 of file bitmap.cpp.

References uint32, and w.

Referenced by NL3D::CHLSColorTexture::addMask(), NL3D::CShadowMapManager::allocateTexture(), NL3D::CLodCharacterTmpBitmap::build(), NL3D::CCoarseMeshBuild::buildBitmap(), NL3D::CTextureFile::buildBitmapFromFile(), NL3D::CFontManager::computeString(), NL3D::CFastHLSModifier::convertDDSBitmap(), NL3D::CTextureDLM::copyRect(), draw2dLine(), NL3D::CCoarseMeshBuild::expand(), NL3D::CDriverGL::fillBuffer(), NL3D::CTextureDLM::fillRect(), NLMISC::CBitmap::flipH(), NLMISC::CBitmap::flipV(), NL3D::CPatchDLMContext::generate(), NLMISC::CBitmap::getColor(), NLMISC::CBitmap::getDXTC1Texel(), NLMISC::CBitmap::getDXTC3Texel(), NLMISC::CBitmap::getDXTC5Texel(), NLMISC::CBitmap::getRGBAPixel(), NLMISC::CBitmap::getSize(), NL3D::GetTextureSize(), NL3D::CTileBank::getTileNoiseMap(), NL3D::CZoneLighter::lightWater(), NL3D::CTextureDLM::modulateAndfillRect565(), NL3D::CTextureDLM::modulateAndfillRect8888(), NL3D::CTextureDLM::modulateConstantAndfillRect(), NL3D::CShapeBank::processWSUploadTexture(), RenderTriangle(), NLMISC::CBitmap::rot90CCW(), NLMISC::CBitmap::rot90CW(), NL3D::CHLSColorTexture::setBitmap(), NL3D::CDriverGL::setupTextureEx(), NL3D::CDriverGL::uploadTexture(), and NL3D::CAsyncTextureManager::uploadTexturePart().

01364 {
01365         if(mipMap==0) return _Width;
01366         
01367         uint32 w = _Width;
01368         uint32 h = _Height;
01369         uint32 m = 0;
01370         
01371         do
01372         {
01373                 m++;
01374                 w = (w+1)/2;
01375                 h = (h+1)/2;
01376                 if(m==mipMap) return w;
01377         }
01378         while(w!=1 || h!=1);
01379 
01380         return 0;
01381 }

TWrapMode NL3D::ITexture::getWrapS  )  const [inline, inherited]
 

Definition at line 204 of file texture.h.

References NL3D::ITexture::_WrapS.

Referenced by NL3D::CDriverGL::activateTexture(), NL3D::CZoneLighter::getTexture(), and NL3D::CDriverGL::setupTextureEx().

00204 {return _WrapS;}

TWrapMode NL3D::ITexture::getWrapT  )  const [inline, inherited]
 

Definition at line 205 of file texture.h.

References NL3D::ITexture::_WrapT.

Referenced by NL3D::CDriverGL::activateTexture(), NL3D::CZoneLighter::getTexture(), and NL3D::CDriverGL::setupTextureEx().

00205 {return _WrapT;}

bool NL3D::ITexture::isAllInvalidated  )  const [inline, inherited]
 

Return true if ALL the texture is invalidate, else return false.

Definition at line 428 of file texture.h.

References NL3D::ITexture::_ListInvalidRect.

Referenced by NL3D::CDriverGL::setupTextureEx(), and NL3D::ITexture::touchRect().

00429         {
00430                 return  _Touched&&(_ListInvalidRect.begin()==_ListInvalidRect.end());
00431         }

virtual bool NL3D::ITexture::isBumpMap  )  const [inline, virtual, inherited]
 

Reimplemented in NL3D::CTextureBump.

Definition at line 380 of file texture.h.

Referenced by NL3D::CDriverGL::setupWaterPassARB(), NL3D::CDriverGL::setupWaterPassNV20(), and NL3D::CDriverGL::setupWaterPassR200().

00380 { return false; }

bool NLMISC::CBitmap::isGrayscaleAsAlpha  )  const [inline, inherited]
 

Tell if the bitmap loads grayscale bitmap as alpha or luminance format.

Returns:
true if the bitmap loads grayscale bitmaps as alpha, false if it loads grayscale bitmaps as luminance.

Definition at line 483 of file bitmap.h.

References NLMISC::CBitmap::_LoadGrayscaleAsAlpha.

00484         {
00485                 return _LoadGrayscaleAsAlpha;
00486         }

virtual bool NL3D::ITexture::isSelectable  )  const [inline, virtual, inherited]
 

Test wether this texture is selectable.

Reimplemented in NL3D::CTextureCube, and NL3D::CTextureMultiFile.

Definition at line 363 of file texture.h.

Referenced by NL3D::CMeshBaseInstance::selectTextureSet().

00363 { return false; }

virtual bool NL3D::ITexture::isTextureCube  )  const [inline, virtual, inherited]
 

Does this texture is a cube texture.

Reimplemented in NL3D::CTextureCube.

Definition at line 376 of file texture.h.

Referenced by NL3D::CDriverGL::activateTexture(), NL3D::convTexAddr(), NL3D::CDriverGL::copyFrameBufferToTexture(), NL3D::CShapeBank::processWSUploadTexture(), NL3D::CDriverGL::setTextureEnvFunction(), NL3D::CDriverGL::setupTextureEx(), NL3D::CDriverGL::uploadTexture(), and NL3D::CDriverGL::uploadTextureCube().

00376 { return false; }       

void NL3D::CTextureFar::linkBeforeUL CTextureFar textNext  ) 
 

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

Definition at line 100 of file texture_far.cpp.

References _ULNext, _ULPrec, and nlassert.

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

00101 {
00102         nlassert(textNext);
00103 
00104         // first, unlink others from me. NB: works even if _ULPrec==_ULNext==this.
00105         _ULNext->_ULPrec= _ULPrec;
00106         _ULPrec->_ULNext= _ULNext;
00107         // link to igNext.
00108         _ULNext= textNext;
00109         _ULPrec= textNext->_ULPrec;
00110         // link others to me.
00111         _ULNext->_ULPrec= this;
00112         _ULPrec->_ULNext= this;
00113 }

uint8 NLMISC::CBitmap::load NLMISC::IStream f,
uint  mipMapSkip = 0
[inherited]
 

Read a bitmap(TGA or DDS) from an IStream. Bitmap supported are DDS (DXTC1, DXTC1 with Alpha, DXTC3, DXTC5, and uncompressed TGA (24 and 32 bits).

Parameters:
IStream The stream must be in reading mode.
mipMapSkip if the file is a DDS with mipMap. N=mipMapSkip mipmaps are skipped.
Returns:
image depth (24 or 32), or 0 if load failed
Exceptions:
ESeekFailed : seek has failed

Definition at line 109 of file bitmap.cpp.

References NLMISC::IStream::begin, NLMISC::DDS, depth, height, NLMISC::IStream::isReading(), nlassert, NLMISC::CBitmap::readDDS(), NLMISC::CBitmap::readTGA(), NLMISC::IStream::seek(), NLMISC::IStream::serial(), uint, uint16, uint32, uint8, and width.

Referenced by NL3D::CTextureFile::buildBitmapFromFile(), and NL3D::CTextureMem::doGenerate().

00110 {
00111         nlassert(f.isReading()); 
00112         
00113         // testing if DDS
00114         uint32 fileType = 0;;
00115         f.serial(fileType);
00116         if(fileType == DDS)
00117         {
00118 #ifdef NEL_ALL_BITMAP_WHITE
00119                 uint8 result = readDDS(f, mipMapSkip);
00120                 MakeWhite (*this);
00121                 return result;
00122 #else // NEL_ALL_BITMAP_WHITE
00123                 return readDDS(f, mipMapSkip);
00124 #endif // NEL_ALL_BITMAP_WHITE
00125         }
00126         // assuming it's TGA
00127         else 
00128         {
00129                 NLMISC::IStream::TSeekOrigin origin= f.begin;
00130                 if(!f.seek (0, origin))
00131                 {
00132                         throw ESeekFailed();
00133                 }
00134 
00135                 // Reading header, 
00136                 // To make sure that the bitmap is TGA, we check imageType and imageDepth.
00137                 uint8   lengthID;
00138                 uint8   cMapType;
00139                 uint8   imageType;
00140                 uint16  tgaOrigin;
00141                 uint16  length;
00142                 uint8   depth;
00143                 uint16  xOrg;
00144                 uint16  yOrg;
00145                 uint16  width;
00146                 uint16  height;
00147                 uint8   imageDepth;
00148                 uint8   desc;
00149                 
00150                 f.serial(lengthID);
00151                 f.serial(cMapType);
00152                 f.serial(imageType);
00153                 if(imageType!=2 && imageType!=3 && imageType!=10 && imageType!=11) return 0;
00154                 f.serial(tgaOrigin);
00155                 f.serial(length);
00156                 f.serial(depth);
00157                 f.serial(xOrg);
00158                 f.serial(yOrg);
00159                 f.serial(width);
00160                 f.serial(height);
00161                 f.serial(imageDepth);
00162                 if(imageDepth!=8 && imageDepth!=16 && imageDepth!=24 && imageDepth!=32) return 0;
00163                 f.serial(desc);
00164 
00165                 if(!f.seek (0, origin))
00166                 {
00167                         throw ESeekFailed();
00168                 }
00169 #ifdef NEL_ALL_BITMAP_WHITE
00170                 uint8 result = readTGA(f);
00171                 MakeWhite (*this);
00172                 return result;
00173 #else // NEL_ALL_BITMAP_WHITE
00174                 return readTGA(f);
00175 #endif // NEL_ALL_BITMAP_WHITE
00176                 
00177         }       
00178 }

void NLMISC::CBitmap::loadGrayscaleAsAlpha bool  loadAsAlpha  )  [inline, inherited]
 

Tell the bitmap to load grayscale bitmap as alpha or luminance format.

Parameters:
loadAsAlpha is true to load grayscale bitmaps as alpha. false to load grayscale bitmaps as luminance. default value is true.

Definition at line 472 of file bitmap.h.

References NLMISC::CBitmap::_LoadGrayscaleAsAlpha.

Referenced by NL3D::CTextureFile::buildBitmapFromFile(), and NL3D::CTileBank::getTileNoiseMap().

00473         {
00474                 _LoadGrayscaleAsAlpha=loadAsAlpha;
00475         }

void NLMISC::CBitmap::loadSize const std::string &  path,
uint32 retWidth,
uint32 retHeight
[static, inherited]
 

same than other loadSize(), but with a pathName.

See also:
loadSize()

Definition at line 2671 of file bitmap.cpp.

References NLMISC::CBitmap::loadSize(), NLMISC::CIFile::open(), and uint32.

02672 {
02673         retWidth= 0;
02674         retHeight= 0;
02675 
02676         CIFile          f(path);
02677         if(f.open(path))
02678                 loadSize(f, retWidth, retHeight);
02679 }

void NLMISC::CBitmap::loadSize NLMISC::IStream f,
uint32 width,
uint32 height
[static, inherited]
 

Determinate the bitmap size from a bitmap(TGA or DDS) from an IStream. load just header of the file. Bitmap supported are DDS (DXTC1, DXTC1 with Alpha, DXTC3, DXTC5, and uncompressed TGA (24 and 32 bits). NB: at the end, f is seeked to begin.

Parameters:
IStream The stream must be in reading mode.
width the width of the image. 0 if fails.
height the height of the image. 0 if fails.
Exceptions:
ESeekFailed : seek has failed

Definition at line 2582 of file bitmap.cpp.

References NLMISC::DDS, DDSD_LINEARSIZE, depth, height, NLMISC::IStream::isReading(), nlassert, NLMISC::IStream::seek(), NLMISC::IStream::serial(), size, uint, uint16, uint32, uint8, and width.

Referenced by NLMISC::CBitmap::loadSize().

02583 {
02584         retWidth= 0;
02585         retHeight= 0;
02586 
02587 
02588         nlassert(f.isReading()); 
02589         
02590         // testing if DDS
02591         uint32 fileType = 0;
02592         f.serial(fileType);
02593         if(fileType == DDS)
02594         {
02595                 // read entire DDS header.
02596                 uint32 size = 0;
02597                 f.serial(size); // size in Bytes of header(without "DDS")
02598                 uint32 * _DDSSurfaceDesc = new uint32[size]; 
02599                 std::auto_ptr<uint32> _DDSSurfaceDescAuto(_DDSSurfaceDesc);
02600                 _DDSSurfaceDesc[0]= size;
02601 
02602                 for(uint i= 0; i<size/4 - 1; i++)
02603                 {
02604                         f.serial(_DDSSurfaceDesc[i+1]);
02605                 }
02606                 
02607                 // flags determines which members of the header structure contain valid data
02608                 uint32 flags = _DDSSurfaceDesc[1];
02609 
02610                 //verify if file have linearsize set
02611                 if(!(flags & DDSD_LINEARSIZE)) 
02612                 {
02613                         throw EDDSBadHeader();
02614                 }
02615                 
02616                 //-------------- extracting and testing useful info
02617                 retHeight  = _DDSSurfaceDesc[2];
02618                 retWidth = _DDSSurfaceDesc[3];
02619         }
02620         // assuming it's TGA
02621         else 
02622         {
02623                 if(!f.seek (0, NLMISC::IStream::begin))
02624                 {
02625                         throw ESeekFailed();
02626                 }
02627 
02628                 // Reading header, 
02629                 // To make sure that the bitmap is TGA, we check imageType and imageDepth.
02630                 uint8   lengthID;
02631                 uint8   cMapType;
02632                 uint8   imageType;
02633                 uint16  tgaOrigin;
02634                 uint16  length;
02635                 uint8   depth;
02636                 uint16  xOrg;
02637                 uint16  yOrg;
02638                 uint16  width;
02639                 uint16  height;
02640                 uint8   imageDepth;
02641                 uint8   desc;
02642                 
02643                 f.serial(lengthID);
02644                 f.serial(cMapType);
02645                 f.serial(imageType);
02646                 if(imageType!=2 && imageType!=3 && imageType!=10 && imageType!=11) return;
02647                 f.serial(tgaOrigin);
02648                 f.serial(length);
02649                 f.serial(depth);
02650                 f.serial(xOrg);
02651                 f.serial(yOrg);
02652                 f.serial(width);
02653                 f.serial(height);
02654                 f.serial(imageDepth);
02655                 if(imageDepth!=8 && imageDepth!=24 && imageDepth!=32) return;
02656                 f.serial(desc);
02657 
02658                 // Ok, we have width and height.
02659                 retWidth= width;
02660                 retHeight= height;
02661         }
02662 
02663         // reset stream.
02664         if(!f.seek (0, NLMISC::IStream::begin))
02665         {
02666                 throw ESeekFailed();
02667         }
02668 }

void NLMISC::CBitmap::makeDummy  )  [inherited]
 

Make a dummy "?" texture. Usefull for file not found. Mode is rgba.

Definition at line 184 of file bitmap.cpp.

References NLMISC::CBitmap::_MipMapCount, NLMISC::CObjectVector< uint8 >::getPtr(), NLMISC::CBitmap::PixelFormat, NLMISC::CObjectVector< uint8 >::resize(), NLMISC::CBitmap::RGBA, NLMISC::CRGBA::set(), sint, and uint8.

Referenced by NL3D::CTextureFile::buildBitmapFromFile(), NL3D::CreateDummyMesh(), NL3D::CTextureMultiFile::doGenerate(), NL3D::CTextureMem::doGenerate(), NL3D::CTextureGrouped::doGenerate(), NL3D::CTextureEmboss::doGenerate(), NL3D::CTextureBump::doGenerate(), and NL3D::CTextureBlend::doGenerate().

00185 {
00186         static  const uint8     bitmap[1024]= {  
00187                 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
00188                 0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,
00189                 0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,
00190                 0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,
00191                 0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,
00192                 0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,
00193                 0,0,0,0,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0,0,0,0,0,
00194                 0,0,0,0,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0,0,0,0,0,
00195                 0,0,0,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,0,0,0,0,
00196                 0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,
00197                 0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,
00198                 0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,
00199                 0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,
00200                 0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,
00201                 0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,
00202                 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
00203                 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
00204                 0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,
00205                 0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,
00206                 0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,
00207                 0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,
00208                 0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,
00209                 0,0,0,0,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0,0,0,0,0,
00210                 0,0,0,0,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0,0,0,0,0,
00211                 0,0,0,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,0,0,0,0,
00212                 0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,
00213                 0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,
00214                 0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,
00215                 0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,
00216                 0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,
00217                 0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,
00218                 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
00219         }; 
00220 
00221         PixelFormat = RGBA;
00222         _MipMapCount = 1;
00223         _Width= 32;
00224         _Height= 32;
00225         _Data[0].resize(_Width*_Height*sizeof(NLMISC::CRGBA));
00226         NLMISC::CRGBA   *pix= (NLMISC::CRGBA*)(_Data[0].getPtr());
00227 
00228         for(sint i=0;i<(sint)(_Width*_Height);i++)
00229         {
00230                 if(bitmap[i])
00231                         pix[i].set(255,255,255,255);
00232                 else
00233                         pix[i].set(0x80,0x80,0x80,0x40);
00234         }
00235 
00236 }

bool NL3D::ITexture::mipMapOff  )  const [inline, inherited]
 

Definition at line 216 of file texture.h.

References NL3D::ITexture::_MinFilter, NL3D::ITexture::LinearMipMapOff, and NL3D::ITexture::NearestMipMapOff.

Referenced by NL3D::ITexture::mipMapOn(), and NL3D::ITexture::setFilterMode().

00216 {return _MinFilter==NearestMipMapOff || _MinFilter==LinearMipMapOff;}

bool NL3D::ITexture::mipMapOn  )  const [inline, inherited]
 

Definition at line 217 of file texture.h.

References NL3D::ITexture::mipMapOff().

Referenced by NL3D::IDriver::getTextureShareName(), NL3D::CShapeBank::processWSUploadTexture(), NL3D::CDriverGL::setupTextureEx(), and NL3D::CDriverGL::uploadTexture().

00217 {return !mipMapOff();}

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

void NL3D::CTextureFar::rebuildPatch const CVector2s  texturePos,
const CPatchIdent pid
[private]
 

Rebuild the patch passed in parameter

Definition at line 465 of file texture_far.cpp.

References _Bank, _LightmapExpanded, _LumelExpanded, _TileTLIColors, NL3D_CComputeTileFar::AsmMMX, NL3D_CExpandLightmap::ColorTile, NL3D::CPatch::computeCurrentTLILightmapDiv2(), NL3D_CComputeTileFar::DstDeltaX, NL3D_CComputeTileFar::DstDeltaY, NL3D_CComputeTileFar::DstPixels, NL3D_CExpandLightmap::DstPixels, NL3D::CTextureFar::CPatchIdent::FarIndex, NL3D::CZone::getLandscape(), NL3D::CPatch::getOrderS(), NL3D::CPatch::getOrderT(), NLMISC::CBitmap::getPixelFormat(), NL3D::CTileFarBank::CTileFar::getPixels(), NLMISC::CBitmap::getPixels(), NL3D::CLandscape::getStaticLight(), NL3D::CTileFarBank::getTile(), NL3D::CTileElement::getTile256Info(), NL3D::CTileElement::getTileOrient(), NL3D::CPatch::getZone(), NLMISC::CSystemInfo::hasMMX(), NL3D_CExpandLightmap::Height, NL3D::CTileFarBank::CTileFar::isFill(), NL3D_CExpandLightmap::LumelTile, NL3D_CExpandLightmap::MulFactor, NL3D_drawFarTileInFarTexture(), NL3D_drawFarTileInFarTextureAdditive(), NL3D_drawFarTileInFarTextureAdditiveAlpha(), NL3D_drawFarTileInFarTextureAlpha(), NL3D_expandLightmap(), NL_NUM_PIXELS_ON_FAR_TILE_EDGE, NL_TILE_ELM_LAYER_EMPTY, nlassert, nlwarning, NL3D::CTextureFar::CPatchIdent::Patch, s, sint, 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::CTileElement::Tile, NL3D::CPatch::TileColors, NL3D::CPatch::Tiles, NL3D_CExpandLightmap::TLIColor, uint, uint8, NL3D::CPatch::unpackShadowMap(), NL3D_CExpandLightmap::Width, NL3D::CTextureFar::CVector2s::x, x, NL3D::CTextureFar::CVector2s::y, and y.

Referenced by doGenerate().

00466 {
00467         uint x= texturePos.x;
00468         uint y= texturePos.y;
00469 
00470         // Patch pointer
00471         CPatch* patch= pid.Patch;
00472 
00473         // Check it exists
00474         nlassert (patch);
00475 
00476         // get the order
00477         uint nS=patch->getOrderS();
00478         uint nT=patch->getOrderT();
00479 
00480         // get the size of the texture to compute
00481         uint subTextWidth=(nS*NL_NUM_PIXELS_ON_FAR_TILE_EDGE)>>(pid.FarIndex-1);
00482         uint subTextHeight=(nT*NL_NUM_PIXELS_ON_FAR_TILE_EDGE)>>(pid.FarIndex-1);
00483 
00484         // Check it is a 16 bits texture
00485         nlassert (getPixelFormat()==RGBA);
00486 
00487         // Check pixels exist
00488         nlassert (getPixels().size()!=0);
00489 
00490         // Base offset of the first pixel of the patch's texture
00491         uint    nBaseOffset;
00492 
00493         // Delta to add to the destination offset when walk for a pixel to the right in the source tile
00494         sint dstDeltaX;
00495 
00496         // Delta to add to the destination offset when walk for a pixel to the bottom in the source tile
00497         sint dstDeltaY;
00498 
00499         // larger than higher  (regular)
00500         if (nS>=nT)
00501         {
00502                 // Regular offset, top left
00503                 nBaseOffset= x + y*_Width;
00504 
00505                 // Regular deltaX, to the right
00506                 dstDeltaX=1;
00507 
00508                 // Regular deltaY, to the bottom
00509                 dstDeltaY=_Width;
00510         }
00511         // higher than larger (goofy), the patch is stored with a rotation of 1 (to the left of course)
00512         else
00513         {
00514                 // Goofy offset, bottom left
00515                 nBaseOffset= x + y*_Width;
00516                 nBaseOffset+=(subTextWidth-1)*_Width;
00517 
00518                 // Goofy deltaX, to the top
00519                 dstDeltaX=-(sint)_Width;
00520 
00521                 // Goofy deltaY, to the right
00522                 dstDeltaY=1;
00523         }
00524                 
00525         // Compute the order of the patch
00526         CTileFarBank::TFarOrder orderX=CTileFarBank::order0;
00527         uint tileSize=0;
00528         switch (pid.FarIndex)
00529         {
00530         case 3:
00531                 // Ratio 1:4
00532                 orderX=CTileFarBank::order2;
00533                 tileSize=NL_NUM_PIXELS_ON_FAR_TILE_EDGE>>2;
00534                 break;
00535         case 2:
00536                 // Ratio 1:2
00537                 orderX=CTileFarBank::order1;
00538                 tileSize=NL_NUM_PIXELS_ON_FAR_TILE_EDGE>>1;
00539                 break;
00540         case 1:
00541                 // Ratio 1:1
00542                 orderX=CTileFarBank::order0;
00543                 tileSize=NL_NUM_PIXELS_ON_FAR_TILE_EDGE;
00544                 break;
00545         default:
00546                 // no!: must be one of the previous values
00547                 nlassert (0);
00548         }
00549 
00550         // Must have a far tile bank pointer set in the CFarTexture
00551         nlassert (_Bank);
00552 
00553         // For all the tiles in the textures
00554         sint nTileInPatch=0;
00555 
00556         // ** Fill the struct for the tile fill method for each layers
00557         NL3D_CComputeTileFar TileFar;
00558         TileFar.AsmMMX= false;
00559 #ifdef NL_OS_WINDOWS
00560         TileFar.AsmMMX= NLMISC::CSystemInfo::hasMMX();
00561 #endif
00562 
00563         // Destination pointer
00564 
00565         // Destination delta
00566         TileFar.DstDeltaX=dstDeltaX;
00567         TileFar.DstDeltaY=dstDeltaY;
00568 
00569         // ** Build expand lightmap..
00570         NL3D_CExpandLightmap lightMap;
00571         
00572         // Fill the structure
00573         lightMap.MulFactor=tileSize;
00574         lightMap.ColorTile=&patch->TileColors[0];
00575         lightMap.Width=nS+1;
00576         lightMap.Height=nT+1;
00577         lightMap.StaticLightColor=patch->getZone()->getLandscape()->getStaticLight();
00578         lightMap.DstPixels=_LightmapExpanded;
00579         // Compute current TLI colors.
00580         patch->computeCurrentTLILightmapDiv2(_TileTLIColors);
00581         lightMap.TLIColor= _TileTLIColors;
00582 
00583         // Expand the shadowmap
00584         patch->unpackShadowMap (_LumelExpanded);
00585         lightMap.LumelTile=_LumelExpanded;
00586 
00587         // Expand the patch lightmap now
00588         NL3D_expandLightmap (&lightMap);
00589 
00590         // DeltaY for lightmap
00591         TileFar.SrcLightingDeltaY=nS*tileSize;
00592 
00593         // Base Dst pointer on the tile line
00594         uint nBaseDstTileLine=nBaseOffset;
00595         for (uint t=0; t<nT; t++)
00596         {
00597                 // Base Dst pointer on the tile
00598                 uint nBaseDstTilePixels=nBaseDstTileLine;
00599 
00600                 // For each tile of the line
00601                 for (uint s=0; s<nS; s++)
00602                 {
00603                         // Base pointer of the destination texture
00604                         TileFar.DstPixels=(CRGBA*)&(getPixels()[0])+nBaseDstTilePixels;
00605 
00606                         // Lightmap pointer
00607                         TileFar.SrcLightingPixels=_LightmapExpanded+(s*tileSize)+(t*nS*tileSize*tileSize);
00608 
00609                         // For each layer of the tile
00610                         for (sint l=0; l<3; l++)
00611                         {
00612                                 // Use of additive in this layer ?
00613                                 bool bAdditive=false;
00614 
00615                                 // Size of the edge far tile
00616                                 TileFar.Size=tileSize;
00617 
00618                                 // Get a tile element reference for this tile.
00619                                 const CTileElement &tileElm=patch->Tiles[nTileInPatch];
00620 
00621                                 // Check for 256 tiles...
00622                                 bool    is256x256;
00623                                 uint8   uvOff;
00624                                 tileElm.getTile256Info(is256x256, uvOff);
00625 
00626                                 // Get the tile number
00627                                 sint tile=tileElm.Tile[l];
00628 
00629                                 // Is the last layer ?
00630                                 bool lastLayer = ( (l == 2) || (tileElm.Tile[l+1] == NL_TILE_ELM_LAYER_EMPTY) );
00631 
00632                                 // Is an non-empty layer ?
00633                                 if (tile!=NL_TILE_ELM_LAYER_EMPTY)
00634                                 {
00635                                         // Get the read only pointer on the far tile
00636                                         const CTileFarBank::CTileFar*   pTile=_Bank->getTile (tile);
00637 
00638                                         // This pointer must not be null, else the farBank is not valid!
00639                                         if (pTile==NULL)
00640                                                 nlwarning ("FarBank is not valid!");
00641 
00642                                         // If the tile exist
00643                                         if (pTile)
00644                                         {
00645                                                 // Tile exist ?
00646                                                 if (pTile->isFill (CTileFarBank::diffuse))
00647                                                 {
00648                                                         // Get rotation of the tile in this layer
00649                                                         sint nRot=tileElm.getTileOrient(l);
00650 
00651                                                         // Source pointer
00652                                                         const CRGBA*    pSrcDiffusePixels=pTile->getPixels (CTileFarBank::diffuse, orderX);
00653                                                         const CRGBA*    pSrcAdditivePixels=NULL;
00654 
00655                                                         // Additive ?
00656                                                         if (pTile->isFill (CTileFarBank::additive))
00657                                                         {
00658                                                                 // Use it
00659                                                                 bAdditive=true;
00660 
00661                                                                 // Get additive pointer
00662                                                                 pSrcAdditivePixels=pTile->getPixels (CTileFarBank::additive, orderX);
00663                                                         }
00664 
00665                                                         // Source size
00666                                                         sint sourceSize;
00667 
00668                                                         // Source offset (for 256)
00669                                                         uint sourceOffset=0;
00670 
00671                                                         // 256 ?
00672                                                         if (is256x256)
00673                                                         {
00674                                                                 // On the left ?
00675                                                                 if (uvOff&0x02)
00676                                                                         sourceOffset+=tileSize;
00677 
00678                                                                 // On the bottom ?
00679                                                                 if ((uvOff==1)||(uvOff==2))
00680                                                                         sourceOffset+=2*tileSize*tileSize;
00681 
00682                                                                 // Yes, 256
00683                                                                 sourceSize=tileSize<<1;
00684                                                         }
00685                                                         else
00686                                                         {
00687                                                                 // No, 128
00688                                                                 sourceSize=tileSize;
00689                                                         }
00690 
00691                                                         // Compute offset and deltas
00692                                                         switch (nRot)
00693                                                         {
00694                                                         case 0:
00695                                                                 // Source pointers
00696                                                                 TileFar.SrcDiffusePixels=pSrcDiffusePixels+sourceOffset;
00697                                                                 TileFar.SrcAdditivePixels=pSrcAdditivePixels+sourceOffset;
00698 
00699                                                                 // Source delta
00700                                                                 TileFar.SrcDeltaX=1;
00701                                                                 TileFar.SrcDeltaY=sourceSize;
00702                                                                 break;
00703                                                         case 1:
00704                                                                 {
00705                                                                         // Source pointers
00706                                                                         uint newOffset=sourceOffset+(tileSize-1);
00707                                                                         TileFar.SrcDiffusePixels=pSrcDiffusePixels+newOffset;
00708                                                                         TileFar.SrcAdditivePixels=pSrcAdditivePixels+newOffset;
00709 
00710                                                                         // Source delta
00711                                                                         TileFar.SrcDeltaX=sourceSize;
00712                                                                         TileFar.SrcDeltaY=-1;
00713                                                                 }
00714                                                                 break;
00715                                                         case 2:
00716                                                                 {
00717                                                                         // Destination pointer
00718                                                                         uint newOffset=sourceOffset+(tileSize-1)*sourceSize+tileSize-1;
00719                                                                         TileFar.SrcDiffusePixels=pSrcDiffusePixels+newOffset;
00720                                                                         TileFar.SrcAdditivePixels=pSrcAdditivePixels+newOffset;
00721 
00722                                                                         // Source delta
00723                                                                         TileFar.SrcDeltaX=-1;
00724                                                                         TileFar.SrcDeltaY=-sourceSize;
00725                                                                 }
00726                                                                 break;
00727                                                         case 3:
00728                                                                 {
00729                                                                         // Destination pointer
00730                                                                         uint newOffset=sourceOffset+(tileSize-1)*sourceSize;
00731                                                                         TileFar.SrcDiffusePixels=pSrcDiffusePixels+newOffset;
00732                                                                         TileFar.SrcAdditivePixels=pSrcAdditivePixels+newOffset;
00733 
00734                                                                         // Source delta
00735                                                                         TileFar.SrcDeltaX=-sourceSize;
00736                                                                         TileFar.SrcDeltaY=1;
00737                                                                 }
00738                                                                 break;
00739                                                         }
00740 
00741                                                         // *** Draw the layer
00742 
00743                                                         // Alpha layer ?
00744                                                         if (l>0)
00745                                                         {
00746                                                                 // Additive layer ?
00747                                                                 if (bAdditive && lastLayer)
00748                                                                         NL3D_drawFarTileInFarTextureAdditiveAlpha (&TileFar);
00749                                                                 else    // No additive layer
00750                                                                         NL3D_drawFarTileInFarTextureAlpha (&TileFar);
00751                                                         }
00752                                                         else    // no alpha
00753                                                         {
00754                                                                 // Additive layer ?
00755                                                                 if (bAdditive && lastLayer)
00756                                                                         NL3D_drawFarTileInFarTextureAdditive (&TileFar);
00757                                                                 else    // No additive layer
00758                                                                         NL3D_drawFarTileInFarTexture (&TileFar);
00759                                                         }
00760                                                 }
00761                                         }
00762                                 }
00763                                 else
00764                                         // Stop, no more layer
00765                                         break;
00766                         }
00767                                                 
00768                         // Next tile
00769                         nTileInPatch++;
00770                         
00771                         // Next tile on the line
00772                         nBaseDstTilePixels+=dstDeltaX*tileSize;
00773                 }
00774 
00775                 // Next line of tiles
00776                 nBaseDstTileLine+=dstDeltaY*tileSize;
00777         }
00778 
00779 }

void NL3D::CTextureFar::recursSplitNext uint  width,
uint  height
[private]
 

Definition at line 212 of file texture_far.cpp.

References _FreeSpaces, getFreeListId(), getUpperSize(), nlassert, nlverify, uint, NL3D::CTextureFar::CVector2s::x, and NL3D::CTextureFar::CVector2s::y.

Referenced by allocatePatch().

00213 {
00214         // get the upper subTexture
00215         uint    wup= wson, hup= hson;
00216         nlverify( getUpperSize(wup, hup) );
00217 
00218         // get the list id.
00219         uint    fatherListId= getFreeListId(wup, hup);
00220 
00221         // if must split bigger patch...
00222         if(_FreeSpaces[fatherListId].empty())
00223         {
00224                 // recurs, try to get a bigger subtexture and split it.
00225                 recursSplitNext(wup, hup);
00226         }
00227 
00228         // OK, now we should have a free entry.
00229         nlassert( !_FreeSpaces[fatherListId].empty() );
00230 
00231         // remove from free list, because it is split now!
00232         CVector2s       fatherPos= _FreeSpaces[fatherListId].front();
00233         _FreeSpaces[fatherListId].pop_front();
00234 
00235         // Create New free rectangles for sons
00236         uint    sonListId= getFreeListId(wson, hson);
00237         CVector2s       sonPos;
00238 
00239         // if my son is a rectangle son
00240         if(wson>hson)
00241         {
00242                 // Then Add 2 free Spaces!
00243                 sonPos.x= fatherPos.x;
00244                 // 1st.
00245                 sonPos.y= fatherPos.y;
00246                 _FreeSpaces[sonListId].push_back(sonPos);
00247                 // 2nd.
00248                 sonPos.y= fatherPos.y+hson;
00249                 _FreeSpaces[sonListId].push_back(sonPos);
00250         }
00251         else
00252         {
00253                 // Then Add 4 free Spaces!
00254                 // 1st.
00255                 sonPos.x= fatherPos.x;
00256                 sonPos.y= fatherPos.y;
00257                 _FreeSpaces[sonListId].push_back(sonPos);
00258                 // 2nd.
00259                 sonPos.x= fatherPos.x+wson;
00260                 sonPos.y= fatherPos.y;
00261                 _FreeSpaces[sonListId].push_back(sonPos);
00262                 // 3rd.
00263                 sonPos.x= fatherPos.x;
00264                 sonPos.y= fatherPos.y+hson;
00265                 _FreeSpaces[sonListId].push_back(sonPos);
00266                 // 4th.
00267                 sonPos.x= fatherPos.x+wson;
00268                 sonPos.y= fatherPos.y+hson;
00269                 _FreeSpaces[sonListId].push_back(sonPos);
00270         }
00271 
00272 }

virtual void NL3D::ITexture::release void   )  [inline, virtual, inherited]
 

Release the texure (free memory)

Reimplemented in NL3D::CTextureBlend, NL3D::CTextureBump, NL3D::CTextureCube, NL3D::CTextureEmboss, and NL3D::CTextureGrouped.

Definition at line 327 of file texture.h.

References NL3D::ITexture::_GoodGenerate, and NLMISC::CBitmap::reset().

Referenced by NL3D::CZoneLighter::getTexture(), NL3D::GetTextureSize(), NL3D::CShapeBank::processWSUploadTexture(), NL3D::CDriverGL::setupTextureEx(), and NL3D::CAsyncTextureManager::update().

00327 { reset(); _GoodGenerate= false; }

void NL3D::ITexture::releaseDriverSetup  )  [inherited]
 

Release the Driver info for this texture (if any). Call it with care.

Definition at line 64 of file texture.cpp.

References NLMISC::CRefPtr< CTextureDrvShare >::kill(), and NL3D::ITexture::TextureDrvShare.

Referenced by NL3D::CMeshBaseInstance::isAsyncTextureReady(), and NL3D::ITexture::~ITexture().

00065 {
00066         // Must kill the drv mirror of this texture.
00067         TextureDrvShare.kill();
00068 }

void NLMISC::CBitmap::releaseMipMaps  )  [inherited]
 

Release the mipmaps of the bitmap if they exist. Work for any mode.

See also:
buildMipMaps().

Definition at line 1493 of file bitmap.cpp.

References NLMISC::CBitmap::_MipMapCount, NLMISC::contReset(), NLMISC::MAX_MIPMAP, and sint.

Referenced by NL3D::CAsyncTextureManager::CTextureEntry::createCoarseBitmap(), NL3D::CTextureEmboss::doGenerate(), NL3D::CTextureBump::doGenerate(), NLMISC::CBitmap::flipH(), NLMISC::CBitmap::flipV(), NLMISC::CBitmap::resample(), NLMISC::CBitmap::resize(), NLMISC::CBitmap::rot90CCW(), NLMISC::CBitmap::rot90CW(), and NL3D::CDriverGL::setupTextureEx().

01494 {
01495         if(_MipMapCount<=1) return;
01496 
01497         _MipMapCount=1;
01498         for(sint i=1;i<MAX_MIPMAP;i++)
01499         {
01500                 NLMISC::contReset(_Data[i]); 
01501         }
01502 }

void NL3D::CTextureFar::removePatch CPatch pPatch,
uint  farIndex
 

Remove a patch in the CTexture Far.

Definition at line 335 of file texture_far.cpp.

References _FreeSpaces, _ItULPatch, _PatchToPosMap, _PosToPatchMap, NL3D::CTextureFar::CPatchIdent::FarIndex, getFreeListId(), NL3D::CPatch::getOrderS(), NL3D::CPatch::getOrderT(), height, NL_NUM_PIXELS_ON_FAR_TILE_EDGE, nlassert, NL3D::CTextureFar::CPatchIdent::Patch, uint, and width.

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

00336 {
00337         // must be found
00338         CPatchIdent     pid;
00339         pid.Patch= pPatch;
00340         pid.FarIndex= farIndex;
00341         TPatchToPosMap::iterator        it= _PatchToPosMap.find(pid);
00342         nlassert( it != _PatchToPosMap.end() );
00343 
00344         // get the pos where this patch texture is stored
00345         CVector2s       pos= it->second;
00346 
00347         // If I erase the patch wihch must next UL, then update UL
00348         if( it == _ItULPatch )
00349                 _ItULPatch++;
00350 
00351         // erase from the 1st map
00352         _PatchToPosMap.erase(it);
00353 
00354         // erase from the second map
00355         _PosToPatchMap.erase(pos);
00356 
00357         // Append to the free list.
00358         uint width=(pPatch->getOrderS ()*NL_NUM_PIXELS_ON_FAR_TILE_EDGE)>>(farIndex-1);
00359         uint height=(pPatch->getOrderT ()*NL_NUM_PIXELS_ON_FAR_TILE_EDGE)>>(farIndex-1);
00360         if(width<height)
00361                 swap(width, height);
00362         uint    freeListId= getFreeListId(width, height);
00363         _FreeSpaces[freeListId].push_back(pos);
00364 }

void NLMISC::CBitmap::resample sint32  nNewWidth,
sint32  nNewHeight
[inherited]
 

Resample the bitmap. If mipmaps exist they are deleted, then rebuilt after resampling.

Parameters:
nNewWidth width after resample
nNewHeight height after resample

Definition at line 1508 of file bitmap.cpp.

References NLMISC::CBitmap::_MipMapCount, NLMISC::CBitmap::buildMipMaps(), NLMISC::contReset(), nlassert, NLMISC::CBitmap::PixelFormat, NLMISC::CBitmap::releaseMipMaps(), NLMISC::CBitmap::resamplePicture32(), NLMISC::CObjectVector< T, EnableObjectBehavior >::resize(), NLMISC::CBitmap::RGBA, and sint32.

Referenced by NL3D::CCoarseMeshBuild::buildBitmap(), and NL3D::CDriverGL::setupTextureEx().

01509 {
01510         nlassert(PixelFormat == RGBA);
01511         bool needRebuild = false;
01512 
01513         // Deleting mipmaps
01514         if(_MipMapCount>1)
01515                 needRebuild = true;
01516         releaseMipMaps();
01517 
01518         if(nNewWidth==0 || nNewHeight==0)
01519         {
01520                 _Width = _Height = 0;
01521                 return;
01522         }
01523         
01524         CObjectVector<uint8> pDestui;
01525         pDestui.resize(nNewWidth*nNewHeight*4);
01526         NLMISC::CRGBA *pDestRgba = (NLMISC::CRGBA*)&pDestui[0];
01527 
01528         resamplePicture32 ((NLMISC::CRGBA*)&_Data[0][0], pDestRgba, _Width, _Height, nNewWidth, nNewHeight);
01529         NLMISC::contReset(_Data[0]); // free memory
01530         _Data[0] =  pDestui;
01531         _Width= nNewWidth;
01532         _Height= nNewHeight;
01533 
01534         // Rebuilding mipmaps
01535         if(needRebuild)
01536         {
01537                 buildMipMaps();
01538         }
01539 }

void NLMISC::CBitmap::reset TType  type = RGBA  )  [inherited]
 

Reset the buffer. Mipmaps are deleted and bitmap is not valid anymore.

Parameters:
type is the new type used for this texture

Definition at line 1599 of file bitmap.cpp.

References NLMISC::CBitmap::_MipMapCount, NLMISC::contReset(), NLMISC::CBitmap::PixelFormat, NLMISC::CObjectVector< uint8 >::resize(), type, and uint.

Referenced by NL3D::CHLSColorTexture::buildColorVersion(), NL3D::CDriverGL::getBufferPart(), and NL3D::ITexture::release().

01600 {
01601         for(uint i=0; i<_MipMapCount; i++)
01602         {
01603                 NLMISC::contReset(_Data[i]);
01604                 _Data[i].resize(0);
01605         }
01606         _Width = _Height = 0;
01607         _MipMapCount= 1;
01608         
01609         // Change pixel format
01610         PixelFormat=type;
01611 }

void NLMISC::CBitmap::resize sint32  nNewWidth,
sint32  nNewHeight,
TType  newType = DonTKnow,
bool  resetTo0 = true
[inherited]
 

Resize the bitmap. If mipmaps exist they are deleted and not rebuilt. This is not a crop. Pixels are lost after resize.

Parameters:
nNewWidth width after resize
nNewHeight height after resize
newType is the new type of the bitmap. If don_t_know, keep the same pixel format that before.
resetTo0 by default the vector are filled by 0. set false to gain performances.

Definition at line 1545 of file bitmap.cpp.

References NLMISC::CBitmap::DonTKnow, NLMISC::CBitmap::PixelFormat, NLMISC::CBitmap::releaseMipMaps(), NLMISC::CBitmap::resizeMipMap(), and sint32.

Referenced by NLMISC::CBitmap::blend(), NL3D::CHLSColorTexture::buildColorVersion(), NL3D::CTextureFont::CTextureFont(), NL3D::CTextureMem::doGenerate(), NL3D::CTextureGrouped::doGenerate(), NL3D::CTextureCross::doGenerate(), NL3D::CTextureFont::dumpTextureFont(), NL3D::CCoarseMeshBuild::expand(), and NL3D::CDriverGL::getBufferPart().

01546 {
01547         // Deleting mipmaps
01548         releaseMipMaps();
01549 
01550         // Change type of bitmap ?
01551         if (newType!=DonTKnow)
01552                 PixelFormat=newType;
01553 
01554         _Width = nNewWidth;
01555         _Height = nNewHeight;
01556 
01557         // resize the level 0 only.
01558         resizeMipMap(0, nNewWidth, nNewHeight, resetTo0);
01559 }

void NLMISC::CBitmap::resizeMipMap uint32  numMipMap,
sint32  nNewWidth,
sint32  nNewHeight,
bool  resetTo0 = true
[inherited]
 

ADVANCED USE Resize a single mipmap level. resize() should have been called before. This is not a crop. Pixels are lost after resize. No validity check is made. It is the user responsabitility fo setup correct mipmap size.

Parameters:
numMipMap id of the mipmap
nNewWidth width after resize
nNewHeight height after resize
resetTo0 by default the vector are filled by 0. set false to gain performances.

Definition at line 1565 of file bitmap.cpp.

References NLMISC::CBitmap::bitPerPixels, NLMISC::contReset(), NLMISC::CObjectVector< uint8 >::fill(), NLMISC::MAX_MIPMAP, nlassert, NLMISC::CBitmap::PixelFormat, NLMISC::CObjectVector< uint8 >::resize(), sint32, and uint32.

Referenced by NL3D::CHLSColorTexture::buildColorVersion(), and NLMISC::CBitmap::resize().

01566 {
01567         nlassert(numMipMap<MAX_MIPMAP);
01568 
01569         // free memory
01570         NLMISC::contReset(_Data[numMipMap]);
01571 
01572         // DXTC compressed??
01573         //bool  isDXTC= PixelFormat==DXTC1 || PixelFormat==DXTC1Alpha || PixelFormat==DXTC3 || PixelFormat==DXTC5;
01574         // if yes, must round up width and height to 4, for allocation
01575         nNewWidth= 4*((nNewWidth+3)/4);
01576         nNewHeight= 4*((nNewHeight+3)/4);
01577 
01578         // resize the buffer
01579         _Data[numMipMap].resize (((uint32)(nNewWidth*nNewHeight)*bitPerPixels[PixelFormat])/8);
01580 
01581         // Fill 0?
01582         if( resetTo0 )
01583                 _Data[numMipMap].fill(0);
01584 }

void NLMISC::CBitmap::rot90CCW  )  [inherited]
 

Rotation of the bitmap of 90 degree in counter clockwise

Definition at line 2781 of file bitmap.cpp.

References NLMISC::CBitmap::_MipMapCount, NLMISC::CBitmap::buildMipMaps(), NLMISC::contReset(), NLMISC::CBitmap::getHeight(), NLMISC::CBitmap::getWidth(), NLMISC::CBitmap::PixelFormat, NLMISC::CBitmap::releaseMipMaps(), NLMISC::CObjectVector< T, EnableObjectBehavior >::resize(), NLMISC::CBitmap::RGBA, sint32, and uint32.

02782 {
02783         if (PixelFormat != RGBA)
02784                 return;
02785         sint32 nWidth = getWidth(0);
02786         sint32 nHeight = getHeight(0);
02787         sint32 i, j;
02788         NLMISC::CRGBA *pSrcRgba = (NLMISC::CRGBA*)&_Data[0][0];
02789         bool needRebuild = false;
02790 
02791         if(_MipMapCount>1)
02792                 needRebuild = true;
02793         releaseMipMaps();
02794 
02795         CObjectVector<uint8> pDestui;
02796         pDestui.resize(nWidth*nHeight*4);
02797         NLMISC::CRGBA *pDestRgba = (NLMISC::CRGBA*)&pDestui[0];
02798 
02799         for( j = 0; j < nHeight; ++j )
02800         for( i = 0; i < nWidth;  ++i )
02801                 pDestRgba[j+i*nHeight] = pSrcRgba[nWidth-1-i+j*nWidth];
02802 
02803         uint32 nTemp = _Width;
02804         _Width = _Height;
02805         _Height = nTemp;
02806 
02807         NLMISC::contReset(_Data[0]); // free memory
02808         _Data[0] =  pDestui;
02809         // Rebuilding mipmaps
02810         if(needRebuild)
02811         {
02812                 buildMipMaps();
02813         }
02814 }

void NLMISC::CBitmap::rot90CW  )  [inherited]
 

Rotation of the bitmap of 90 degree in clockwise

Definition at line 2746 of file bitmap.cpp.

References NLMISC::CBitmap::_MipMapCount, NLMISC::CBitmap::buildMipMaps(), NLMISC::contReset(), NLMISC::CBitmap::getHeight(), NLMISC::CBitmap::getWidth(), NLMISC::CBitmap::PixelFormat, NLMISC::CBitmap::releaseMipMaps(), NLMISC::CObjectVector< T, EnableObjectBehavior >::resize(), NLMISC::CBitmap::RGBA, sint32, and uint32.

02747 {
02748         if (PixelFormat != RGBA)
02749                 return;
02750         sint32 nWidth = getWidth(0);
02751         sint32 nHeight = getHeight(0);
02752         sint32 i, j;
02753         NLMISC::CRGBA *pSrcRgba = (NLMISC::CRGBA*)&_Data[0][0];
02754         bool needRebuild = false;
02755 
02756         if(_MipMapCount>1)
02757                 needRebuild = true;
02758         releaseMipMaps();
02759 
02760         CObjectVector<uint8> pDestui;
02761         pDestui.resize(nWidth*nHeight*4);
02762         NLMISC::CRGBA *pDestRgba = (NLMISC::CRGBA*)&pDestui[0];
02763 
02764         for( j = 0; j < nHeight; ++j )
02765         for( i = 0; i < nWidth;  ++i )
02766                 pDestRgba[j+i*nHeight] = pSrcRgba[i+(nHeight-1-j)*nWidth];
02767 
02768         uint32 nTemp = _Width;
02769         _Width = _Height;
02770         _Height = nTemp;
02771 
02772         NLMISC::contReset(_Data[0]); // free memory
02773         _Data[0] =  pDestui;
02774         // Rebuilding mipmaps
02775         if(needRebuild)
02776         {
02777                 buildMipMaps();
02778         }
02779 }

void NLMISC::CBitmap::rotateCCW  )  [inherited]
 

Rotate a bitmap in CCW mode.

See also:
releaseMipMaps().

Definition at line 2306 of file bitmap.cpp.

References NLMISC::CBitmap::PixelFormat, NLMISC::CBitmap::RGBA, NLMISC::rotateCCW(), uint16, and uint32.

02307 {
02308         // Copy the array
02309         CObjectVector<uint8> copy=_Data[0];
02310 
02311         switch (PixelFormat)
02312         {
02313         case RGBA:
02314                 NLMISC::rotateCCW ((uint32*)&(_Data[0][0]), (uint32*)&(copy[0]), _Width, _Height);
02315                 break;
02316         case Luminance:
02317         case Alpha:
02318                 NLMISC::rotateCCW (&_Data[0][0], &copy[0], _Width, _Height);
02319                 break;
02320         case AlphaLuminance:
02321                 NLMISC::rotateCCW ((uint16*)&(_Data[0][0]), (uint16*)&(copy[0]), _Width, _Height);;
02322                 break;
02323         default: break;
02324         }
02325 
02326         uint32 tmp=_Width;
02327         _Width=_Height;
02328         _Height=tmp;
02329         _Data[0]=copy;
02330 }

virtual void NL3D::ITexture::selectTexture uint  index  )  [inline, virtual, inherited]
 

Select a texture among several other (if this texture is a set of texture such as CTextureMultiFile) The default does nothing

Reimplemented in NL3D::CTextureCube, and NL3D::CTextureMultiFile.

Definition at line 360 of file texture.h.

References index, and uint.

Referenced by NL3D::CCoarseMeshBuild::buildBitmap(), NL3D::CCoarseMeshBuild::remapCoordinates(), and NL3D::CAsyncFileManager3D::CMeshLoad::run().

00360 {}

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

From IStreamable.

Reimplemented from NL3D::ITexture.

Definition at line 197 of file texture_far.h.

00197 {};

void NL3D::ITexture::setFilterMode TMagFilter  magf,
TMinFilter  minf
[virtual, inherited]
 

Reimplemented in NL3D::CTextureBump.

Definition at line 100 of file texture.cpp.

References NL3D::ITexture::_MagFilter, NL3D::ITexture::_MinFilter, NL3D::ITexture::mipMapOff(), and NL3D::ITexture::touch().

Referenced by NL3D::CShadowMapManager::allocateTexture(), NL3D::CTextureDLM::CTextureDLM(), CTextureFar(), NL3D::CTextureFont::CTextureFont(), NL3D::CTextureGrouped::CTextureGrouped(), NL3D::CTextureNear::CTextureNear(), and NL3D::CVegetableManager::loadTexture().

00101 {
00102         _MagFilter= magf;
00103         // If the MipMap mode has siwtched Off/On, then must recompute...
00104         bool    precOff= mipMapOff();
00105         _MinFilter= minf;
00106         bool    nowOff= mipMapOff();
00107 
00108         if(precOff!=nowOff)
00109         {
00110                 // Must recompute mipmaps!!
00111                 touch();
00112         }
00113 }

void NLMISC::CBitmap::setMipMapCount uint32  mmc  )  [inherited]
 

ADVANCED USE To use in conjunction with resizeMipMap. Setup the correct total number of mipmap No validity check is made. It is the user responsabitility fo setup correct mipmap count.

Definition at line 1590 of file bitmap.cpp.

References NLMISC::CBitmap::_MipMapCount, uint32, and uint8.

Referenced by NL3D::CHLSColorTexture::buildColorVersion().

01591 {
01592         _MipMapCount= uint8(mmc);
01593 }

void NL3D::ITexture::setReleasable bool  r  )  [inline, inherited]
 

Set if texture can be released If it is true, the driver will release the texture after generating it and upload it into the videomemory by calling release(). If it is false, the driver won't release the texture.

See also:
getReleasable(), generate()
Parameters:
true if texture can be released, false else

Definition at line 278 of file texture.h.

References NL3D::ITexture::_Releasable, and r.

Referenced by NL3D::CShadowMapManager::allocateTexture(), NL3D::CTextureDLM::CTextureDLM(), CTextureFar(), NL3D::CTextureFont::CTextureFont(), NL3D::CTextureNear::CTextureNear(), NL3D::CShapeBank::processWSUploadTexture(), NL3D::CWaterPoolManager::releaseBlendTextures(), NL3D::CWaterPoolManager::setBlendFactor(), and NL3D::CAsyncTextureManager::uploadTexturePart().

00278 { _Releasable = r; }

bool NL3D::ITexture::setupedIntoDriver  )  const [inline, inherited]
 

Tells if the texture has been setuped by the driver.

Definition at line 343 of file texture.h.

References NL3D::ITexture::TextureDrvShare.

00344         {
00345                 return TextureDrvShare!=NULL;
00346         }

void NL3D::ITexture::setUploadFormat TUploadFormat  pf  )  [inherited]
 

Replace the uploaded format of the texture. If "Auto", the driver use CBitmap::getPixelFormat() to find the best associated pixelFormat. When no alpha is wanted (RGB, Luminance....), texture default output is 1.0. For "Alpha" mode, RGB output is (0,0,0).

Definition at line 88 of file texture.cpp.

References NL3D::ITexture::_UploadFormat, and NL3D::ITexture::touch().

Referenced by NL3D::CTextureDLM::CTextureDLM(), CTextureFar(), NL3D::CTextureFont::CTextureFont(), NL3D::CTextureNear::CTextureNear(), NL3D::CDriverGL::getSpecularCubeMap(), and NL3D::CDriverGL::setupWaterPassARB().

00089 {
00090         if(pf!=_UploadFormat)
00091         {
00092                 _UploadFormat= pf;
00093                 // All the texture may be reloaded...
00094                 touch();
00095         }
00096 }

void NL3D::ITexture::setWrapS TWrapMode  mode  )  [inline, inherited]
 

By default, parameters are:

  • WrapS==Repeat
  • WrapT==Repeat
  • UploadFormat== Auto
  • MagFilter== Linear.
  • MinFilter= LinearMipMapLinear.

NB: if multiple ITexture acces the same data via the sharing system (such as a CTextureFile), then:

  • WrapS/WrapT is LOCAL for each ITexture (ie each ITexture will have his own Wrap mode) => no duplication is made.
  • UploadFormat may duplicate the texture in video memory. There is one texture per different UploadFormat.
  • MinFilter may duplicate the texture in video memory in the same way, wether the texture has mipmap or not.

Definition at line 202 of file texture.h.

References NL3D::ITexture::_WrapS.

Referenced by NL3D::CShadowMapManager::allocateTexture(), CTextureFar(), NL3D::CTextureFont::CTextureFont(), NL3D::CVegetableManager::loadTexture(), and NL3D::CSegRemanenceShape::setupMaterial().

00202 {_WrapS= mode;}

void NL3D::ITexture::setWrapT TWrapMode  mode  )  [inline, inherited]
 

Definition at line 203 of file texture.h.

References NL3D::ITexture::_WrapT.

Referenced by NL3D::CShadowMapManager::allocateTexture(), CTextureFar(), NL3D::CTextureFont::CTextureFont(), and NL3D::CVegetableManager::loadTexture().

00203 {_WrapT= mode;}

void NL3D::CTextureFar::startPatchULTouch  ) 
 

Definition at line 404 of file texture_far.cpp.

References _ItULPatch, and _PatchToPosMap.

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

00405 {
00406         _ItULPatch= _PatchToPosMap.begin();
00407 }

virtual bool NL3D::ITexture::supportSharing  )  const [inline, virtual, inherited]
 

Does this texture support sharing system.

Reimplemented in NL3D::CTextureBlend, NL3D::CTextureBump, NL3D::CTextureCube, NL3D::CTextureEmboss, NL3D::CTextureFile, NL3D::CTextureGrouped, NL3D::CTextureMem, and NL3D::CTextureMultiFile.

Definition at line 332 of file texture.h.

Referenced by NL3D::CCoarseMeshBuild::buildBitmap(), NL3D::CZoneLighter::getTexture(), NL3D::CCoarseMeshBuild::remapCoordinates(), NL3D::CAsyncFileManager3D::CMeshLoad::run(), NL3D::CDriverGL::setupTextureEx(), and NL3D::ITexture::touchRect().

00332 {return false;}

void NL3D::ITexture::touch  )  [inline, inherited]
 

This method invalidates all the texture surface. When the driver calls generate, the texture will rebuild all the texture and the driver will update it.

See also:
isAllInvalidated(), generate(), touchRect(), touched(), _ListInvalidRect

Definition at line 227 of file texture.h.

References NL3D::ITexture::_GoodGenerate, and NL3D::ITexture::_ListInvalidRect.

Referenced by NL3D::CTextureFile::CTextureFile(), NL3D::ITexture::operator=(), NL3D::CTextureMultiFile::selectTexture(), NL3D::CTextureCube::selectTexture(), NL3D::CTextureEmboss::setAmbient(), NL3D::CTextureBlend::setBlendFactor(), NL3D::CTextureBlend::setBlendTexture(), NL3D::CTextureEmboss::setDiffuse(), NL3D::CTextureMultiFile::setFileName(), NL3D::CTextureFile::setFileName(), NL3D::ITexture::setFilterMode(), NL3D::CTextureEmboss::setHeightMap(), NL3D::CTextureBump::setHeightMap(), NL3D::CTextureEmboss::setLightDir(), NL3D::CTextureEmboss::setSlopeFactor(), NL3D::CTextureGrouped::setTextures(), and NL3D::ITexture::setUploadFormat().

00228         { 
00229                 _ListInvalidRect.clear (); 
00230                 _Touched=true; 
00231                 _GoodGenerate= false;
00232         }

bool NL3D::ITexture::touched void   )  [inline, inherited]
 

This method return the touched flag. If it is true, the driver will call generate to rebuild the texture.

See also:
isAllInvalidated(), generate(), touch(), touchRect(), _ListInvalidRect

Definition at line 438 of file texture.h.

Referenced by NL3D::CDriverGL::setupTextureEx().

00439         {
00440                 return _Touched;
00441         }

uint NL3D::CTextureFar::touchPatchULAndNext  ) 
 

Touch a patch (call touchRect()) and iterate to next .

Returns:
number of pixels touched. 0 if end() (empty).

Definition at line 368 of file texture_far.cpp.

References _ItULPatch, _PatchToPosMap, NL3D::CPatch::getOrderS(), NL3D::CPatch::getOrderT(), height, NL_NUM_PIXELS_ON_FAR_TILE_EDGE, uint, width, x, and y.

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

00369 {
00370         // if there is still a patch here
00371         if( _ItULPatch!=_PatchToPosMap.end() )
00372         {
00373                 // Position of the invalide rectangle
00374                 int x = _ItULPatch->second.x;
00375                 int y = _ItULPatch->second.y;
00376                 uint    farIndex= _ItULPatch->first.FarIndex;
00377                 CPatch  *pPatch= _ItULPatch->first.Patch;
00378 
00379                 // recompute the correct size.
00380                 uint width=(pPatch->getOrderS ()*NL_NUM_PIXELS_ON_FAR_TILE_EDGE)>>(farIndex-1);
00381                 uint height=(pPatch->getOrderT ()*NL_NUM_PIXELS_ON_FAR_TILE_EDGE)>>(farIndex-1);
00382                 if(width<height)
00383                         swap(width, height);
00384 
00385                 // Invalidate the associated rectangle
00386                 CRect rect (x, y, width, height);
00387                 ITexture::touchRect (rect);
00388 
00389                 // Go next.
00390                 _ItULPatch++;
00391 
00392                 // return number of pixels touched
00393                 return width * height;
00394         }
00395         else
00396         {
00397                 // no touch
00398                 return 0;
00399         }
00400 }

void NL3D::ITexture::touchRect const NLMISC::CRect rect  )  [inline, inherited]
 

This method invalidates a rectangle of the texture surface. When the driver calls generate, the texture could rebuild only this part of texture and the driver will update only those rectangles.

This method is incompatible with textures which support sharing (see class description).

See also:
isAllInvalidated(), generate(), touch(), touched(), _ListInvalidRect

Definition at line 242 of file texture.h.

References NL3D::ITexture::_GoodGenerate, NL3D::ITexture::_ListInvalidRect, NL3D::ITexture::isAllInvalidated(), nlassert, and NL3D::ITexture::supportSharing().

Referenced by NL3D::CTextureFont::getLetterInfo().

00243         { 
00244                 // The texture must not support sharing....
00245                 nlassert(!supportSharing());
00246                 // Don't invalidate the rectangle if the full texture is already invalidated.
00247                 if (!isAllInvalidated ())
00248                 {
00249                         // Add the region to invalidate list
00250                         _ListInvalidRect.push_back (rect); 
00251                         // Touch flag
00252                         _Touched=true; 
00253                 }
00254 
00255                 _GoodGenerate= false;
00256         }

sint NL3D::CTextureFar::tryAllocatePatch CPatch pPatch,
uint  farIndex
 

Try to allocate a patch. return -1 if error (not enough space) return 0 if OK, and success to allocate a place without splitting any square else return the size of the max space to split (eg if must a split a 32x32 to allocate a 16x8)

Definition at line 176 of file texture_far.cpp.

References _FreeSpaces, getFreeListId(), NL3D::CPatch::getOrderS(), NL3D::CPatch::getOrderT(), getUpperSize(), height, NL_NUM_PIXELS_ON_FAR_TILE_EDGE, sint, uint, and width.

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

00177 {
00178         // get the size of the subtexture to allocate
00179         uint width=(pPatch->getOrderS ()*NL_NUM_PIXELS_ON_FAR_TILE_EDGE)>>(farIndex-1);
00180         uint height=(pPatch->getOrderT ()*NL_NUM_PIXELS_ON_FAR_TILE_EDGE)>>(farIndex-1);
00181 
00182         // make width the biggest
00183         if(width<height)
00184                 swap(width, height);
00185 
00186         // get where to find a subtexture
00187         uint    freeListId= getFreeListId(width, height);
00188 
00189         // if some place, ok!
00190         if(!_FreeSpaces[freeListId].empty())
00191                 return 0;
00192         else
00193         {
00194                 // try to get the next size
00195                 while( getUpperSize(width, height) )
00196                 {
00197                         freeListId= getFreeListId(width, height);
00198                         // if some subtexture free
00199                         if(!_FreeSpaces[freeListId].empty())
00200                         {
00201                                 // Ok! return the size of this texture we must split
00202                                 return width*height;
00203                         }
00204                 }
00205 
00206                 // fail => no more space => -1
00207                 return -1;
00208         }
00209 }

void NL3D::CTextureFar::unlinkUL  ) 
 

For lighting update, unlink (CiruclarList).

Definition at line 116 of file texture_far.cpp.

References _ULNext, and _ULPrec.

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

00117 {
00118         // first, unlink others from me. NB: works even if _ULPrec==_ULNext==this.
00119         _ULNext->_ULPrec= _ULPrec;
00120         _ULPrec->_ULNext= _ULNext;
00121         // reset
00122         _ULPrec= this;
00123         _ULNext= this;
00124 }

void NL3D::ITexture::validateGenerateFlag  )  [inline, inherited]
 

Advanced. erase the _GoodGenerate=true. Special if you want to setup directly the bitmap without using generate(). USE IT WITH CARE!! (used by the CAsyncTextureManager)

Definition at line 322 of file texture.h.

References NL3D::ITexture::_GoodGenerate.

00322 {_GoodGenerate=true;}

bool NLMISC::CBitmap::writeJPG NLMISC::IStream f,
uint8  quality = 80
[inline, inherited]
 

Write a JPG from the object pixels buffer. If the current pixel format is not rgba then the method does nothing If the pixel format is Alpha then we save in 8 bpp

Parameters:
f IStream (must be a reading stream)
quality 0=very bad quality 100=best quality
Returns:
true if succeed, false else

Definition at line 620 of file bitmap.h.

References nlwarning, and uint8.

00621 {
00622         nlwarning ("You must put #define USE_JPEG before all include in the file where you call writeJPG() if you want jpeg support");
00623         return false;
00624 }

bool NLMISC::CBitmap::writeTGA NLMISC::IStream f,
uint32  d,
bool  upsideDown = false
[inherited]
 

Write a TGA (24 or 32 bits) from the object pixels buffer. If the current pixel format is not rgba then the method does nothing If the pixel format is Alpha then we save in 8 bpp

Parameters:
f IStream (must be a reading stream)
d depth : 8 or 16 or 24 or 32
upsideDown if true, the bitmap will be saved with the upside down
Returns:
true if succeed, false else

Definition at line 2139 of file bitmap.cpp.

References depth, height, NLMISC::IStream::isReading(), NLMISC::CBitmap::PixelFormat, r, NLMISC::CBitmap::RGBA, NLMISC::IStream::serial(), sint32, uint16, uint32, uint8, width, x, and y.

Referenced by NL3D::CTextureFont::dumpTextureFont(), NL3D::CZoneLighter::lightWater(), and NL3D::CNELU::screenshot().

02140 {
02141         if(f.isReading()) return false;
02142         if(d!=24 && d!=32 && d!=16 && d!=8) return false;
02143         if ((PixelFormat != RGBA)&&(PixelFormat != Alpha)&&(PixelFormat != Luminance)) return false;
02144         if ((PixelFormat == Alpha) && (d != 8)) return false;
02145         if ((PixelFormat == Luminance) && (d != 8)) return false;
02146 
02147         sint32  i,j,x,y;
02148         uint8   * scanline;
02149         uint8   r,g,b,a;
02150 
02151         uint8   lengthID = 0;
02152         uint8   cMapType = 0;
02153         uint8   imageType = 2;
02154         uint16  origin = 0;
02155         uint16  length = 0;
02156         uint8   depth = 0;
02157         uint16  xOrg = 0;
02158         uint16  yOrg = 0;
02159         uint16  width = (uint16)_Width;
02160         uint16  height = (uint16)_Height;
02161         uint8   imageDepth = (uint8)d;
02162         uint8   desc = 0;
02163         if (upsideDown)
02164                 desc |= 1<<5;
02165 
02166         if ((PixelFormat == Alpha) || (PixelFormat == Luminance))
02167                 imageType = 3; // Uncompressed grayscale
02168 
02169         f.serial(lengthID);
02170         f.serial(cMapType);
02171         f.serial(imageType);
02172         f.serial(origin);
02173         f.serial(length);
02174         f.serial(depth);
02175         f.serial(xOrg);
02176         f.serial(yOrg);
02177         f.serial(width);
02178         f.serial(height);
02179         f.serial(imageDepth);
02180         f.serial(desc);
02181 
02182         if ((PixelFormat == Alpha)||(PixelFormat == Luminance))
02183                 scanline = new uint8[width];
02184         else
02185                 scanline = new uint8[width*4];
02186         if(!scanline)
02187         {
02188                 throw EAllocationFailure();
02189         }
02190 
02191         for(y=0; y<(sint32)height; y++)
02192         {
02193                 
02194                 uint32 k=0;
02195                 if (PixelFormat == Alpha)
02196                 {
02197                         for(i=0; i<width; ++i) // Alpha
02198                         {
02199                                 scanline[k++] = _Data[0][(height-y-1)*width + i];
02200                         }
02201                 }
02202                 else if (PixelFormat == Luminance)
02203                 {
02204                         for(i=0; i<width; ++i) // Luminance
02205                         {
02206                                 scanline[k++] = _Data[0][(height-y-1)*width + i];
02207                         }
02208                 }
02209                 else
02210                 {
02211                         for(i=0; i<width*4; i+=4) // 4:RGBA
02212                         {
02213                                 if(d==16)
02214                                 {
02215                                         for(j=0; j<(sint32)4; j++)
02216                                         {
02217                                                 scanline[k++] = _Data[0][(height-y-1)*width*4 + i + j];
02218                                         }
02219                                 }
02220                                 else
02221                                 {
02222                                         for(j=0; j<(sint32)d/8; j++)
02223                                         {
02224                                                 scanline[k++] = _Data[0][(height-y-1)*width*4 + i + j];
02225                                         }
02226                                 }
02227                         }
02228                 }
02229                 
02230                 if(d==16)
02231                 {
02232                         for(x=0; x<(sint32)width; x++)
02233                         {
02234                                 r = scanline[x*4+0];
02235                                 g = scanline[x*4+1];
02236                                 b = scanline[x*4+2];
02237                                 int rr = r >>3;
02238                                 int gg = g >>3;
02239                                 int bb = b >>3;
02240                                 uint16 c16 = (rr<<10) | (gg<<5) | bb;
02241                                 scanline[x*2+0] = c16&0xff;
02242                                 scanline[x*2+1] = c16>>8;
02243                         }
02244                 }
02245                 if(d==24)
02246                 {
02247                         for(x=0; x<(sint32)width; x++)
02248                         {
02249                                 r = scanline[x*3+0];
02250                                 g = scanline[x*3+1];
02251                                 b = scanline[x*3+2];
02252                                 scanline[x*3+0] = b;
02253                                 scanline[x*3+1] = g;
02254                                 scanline[x*3+2] = r;
02255                         }
02256                 }
02257                 if(d==32)
02258                 {
02259                         for(x=0; x<(sint32)width; x++)
02260                         {
02261                                 r = scanline[x*4+0];
02262                                 g = scanline[x*4+1];
02263                                 b = scanline[x*4+2];
02264                                 a= scanline[x*4+3];
02265                                 scanline[x*4+0] = b;
02266                                 scanline[x*4+1] = g;
02267                                 scanline[x*4+2] = r;                            
02268                                 scanline[x*4+3] = a;
02269                         }
02270                 }
02271                 
02272                 int finaleSize=width*d/8;
02273                 for(i=0; i<finaleSize; i++)
02274                 {
02275                         f.serial(scanline[i]);
02276                 }               
02277         }
02278         delete scanline;
02279         return true;
02280 }


Friends And Related Function Documentation

friend struct CPtrInfo [friend, inherited]
 

Definition at line 67 of file smart_ptr.h.


Field Documentation

CTileFarBank* NL3D::CTextureFar::_Bank
 

A pointer on the far bank.

Definition at line 143 of file texture_far.h.

Referenced by rebuildPatch().

CObjectVector<uint8> NLMISC::CBitmap::_Data[MAX_MIPMAP] [protected, inherited]
 

Reimplemented in NL3D::CTextureMem.

Definition at line 90 of file bitmap.h.

Referenced by NLMISC::CBitmap::blend().

std::list<CVector2s> NL3D::CTextureFar::_FreeSpaces[ (4+NL_NUM_PIXELS_ON_FAR_TILE_EDGE_SHIFT) * 4 ] [private]
 

Lists of empty Space. One for each possible size (64x64, 64x8 etc, but not 64x4 since not possible...)

Definition at line 183 of file texture_far.h.

Referenced by allocatePatch(), CTextureFar(), recursSplitNext(), removePatch(), and tryAllocatePatch().

uint32 NLMISC::CBitmap::_Height [protected, inherited]
 

Definition at line 96 of file bitmap.h.

Referenced by NLMISC::CBitmap::blend().

TPatchToPosMap::iterator NL3D::CTextureFar::_ItULPatch [private]
 

Definition at line 210 of file texture_far.h.

Referenced by CTextureFar(), endPatchULTouch(), removePatch(), startPatchULTouch(), and touchPatchULAndNext().

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

Definition at line 43 of file texture_far.cpp.

Referenced by rebuildPatch().

std::list<NLMISC::CRect> NL3D::ITexture::_ListInvalidRect [inherited]
 

List of invalided rectangle. If the list is empty, generate() will rebuild all the texture.

See also:
isAllInvalidated(), generate(), touch(), touchRect(), touched()

Definition at line 422 of file texture.h.

Referenced by NL3D::ITexture::clearTouched(), NL3D::ITexture::isAllInvalidated(), NL3D::CDriverGL::setupTextureEx(), NL3D::ITexture::touch(), and NL3D::ITexture::touchRect().

bool NLMISC::CBitmap::_LoadGrayscaleAsAlpha [protected, inherited]
 

Definition at line 94 of file bitmap.h.

Referenced by NLMISC::CBitmap::CBitmap(), NLMISC::CBitmap::isGrayscaleAsAlpha(), NLMISC::CBitmap::loadGrayscaleAsAlpha(), and NLMISC::CBitmap::readTGA().

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

Definition at line 44 of file texture_far.cpp.

Referenced by rebuildPatch().

uint8 NLMISC::CBitmap::_MipMapCount [protected, inherited]
 

Definition at line 93 of file bitmap.h.

Referenced by NLMISC::CBitmap::alphaLuminanceToAlpha(), NLMISC::CBitmap::alphaLuminanceToLuminance(), NLMISC::CBitmap::alphaLuminanceToRGBA(), NLMISC::CBitmap::alphaToAlphaLuminance(), NLMISC::CBitmap::alphaToRGBA(), NLMISC::CBitmap::buildMipMaps(), NLMISC::CBitmap::CBitmap(), NLMISC::CBitmap::decompressDXT1(), NLMISC::CBitmap::decompressDXT3(), NLMISC::CBitmap::decompressDXT5(), NLMISC::CBitmap::flipH(), NLMISC::CBitmap::flipV(), NLMISC::CBitmap::getMipMapCount(), NLMISC::CBitmap::luminanceToAlpha(), NLMISC::CBitmap::luminanceToAlphaLuminance(), NLMISC::CBitmap::luminanceToRGBA(), NLMISC::CBitmap::makeDummy(), NLMISC::CBitmap::readDDS(), NLMISC::CBitmap::readTGA(), NLMISC::CBitmap::releaseMipMaps(), NLMISC::CBitmap::resample(), NLMISC::CBitmap::reset(), NLMISC::CBitmap::rgbaToAlpha(), NLMISC::CBitmap::rgbaToAlphaLuminance(), NLMISC::CBitmap::rgbaToLuminance(), NLMISC::CBitmap::rot90CCW(), NLMISC::CBitmap::rot90CW(), and NLMISC::CBitmap::setMipMapCount().

TPatchToPosMap NL3D::CTextureFar::_PatchToPosMap [private]
 

Definition at line 178 of file texture_far.h.

Referenced by allocatePatch(), CTextureFar(), endPatchULTouch(), removePatch(), startPatchULTouch(), and touchPatchULAndNext().

TPosToPatchMap NL3D::CTextureFar::_PosToPatchMap [private]
 

Definition at line 179 of file texture_far.h.

Referenced by allocatePatch(), doGenerate(), and removePatch().

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

Definition at line 45 of file texture_far.cpp.

Referenced by rebuildPatch().

bool NL3D::ITexture::_Touched [protected, inherited]
 

Definition at line 387 of file texture.h.

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

Definition at line 208 of file texture_far.h.

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

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

UpdateLighting. CiruclarList.

Definition at line 207 of file texture_far.h.

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

uint32 NLMISC::CBitmap::_Width [protected, inherited]
 

Definition at line 95 of file bitmap.h.

Referenced by NLMISC::CBitmap::blend().

const uint32 NLMISC::CBitmap::bitPerPixels [static, inherited]
 

Initial value:

{
        32,             
        8,              
        8,              
        16,             
        4,              
        4,              
        8,              
        8,              
        16              
}

Definition at line 70 of file bitmap.cpp.

Referenced by NLMISC::CBitmap::blit(), and NLMISC::CBitmap::resizeMipMap().

sint NLMISC::CRefCount::crefs [mutable, inherited]
 

Definition at line 79 of file smart_ptr.h.

Referenced by NLMISC::CRefCount::CRefCount(), NLMISC::CRefCount::getRefCount(), and NLMISC::CRefCount::~CRefCount().

const uint32 NLMISC::CBitmap::DXTC1HEADER = NL_MAKEFOURCC('D','X', 'T', '1') [static, inherited]
 

Definition at line 83 of file bitmap.cpp.

Referenced by NLMISC::CBitmap::readDDS().

const uint32 NLMISC::CBitmap::DXTC3HEADER = NL_MAKEFOURCC('D','X', 'T', '3') [static, inherited]
 

Definition at line 84 of file bitmap.cpp.

Referenced by NLMISC::CBitmap::readDDS().

const uint32 NLMISC::CBitmap::DXTC5HEADER = NL_MAKEFOURCC('D','X', 'T', '5') [static, inherited]
 

Definition at line 85 of file bitmap.cpp.

Referenced by NLMISC::CBitmap::readDDS().

CRefCount::CPtrInfo NLMISC::CRefCount::NullPtrInfo [static, inherited]
 

Referenced by NLMISC::CRefCount::CRefCount().

CPtrInfo* NLMISC::CRefCount::pinfo [mutable, inherited]
 

Definition at line 80 of file smart_ptr.h.

Referenced by NLMISC::CRefCount::CRefCount(), and NLMISC::CRefCount::~CRefCount().

enum NLMISC::CBitmap::TType NLMISC::CBitmap::PixelFormat [inherited]
 

Referenced by NLMISC::CBitmap::alphaLuminanceToAlpha(), NLMISC::CBitmap::alphaLuminanceToLuminance(), NLMISC::CBitmap::alphaLuminanceToRGBA(), NLMISC::CBitmap::alphaToAlphaLuminance(), NLMISC::CBitmap::alphaToLuminance(), NLMISC::CBitmap::alphaToRGBA(), NLMISC::CBitmap::blend(), NLMISC::CBitmap::blit(), NL3D::CTextureFile::buildBitmapFromFile(), NLMISC::CBitmap::buildMipMaps(), NLMISC::CBitmap::CBitmap(), NLMISC::CBitmap::convertToAlpha(), NLMISC::CBitmap::convertToAlphaLuminance(), NLMISC::CBitmap::convertToLuminance(), NLMISC::CBitmap::convertToRGBA(), NLMISC::CBitmap::convertToType(), NLMISC::CBitmap::decompressDXT1(), NLMISC::CBitmap::decompressDXT3(), NLMISC::CBitmap::decompressDXT5(), NLMISC::CBitmap::flipH(), NLMISC::CBitmap::flipV(), NLMISC::CBitmap::getColor(), NLMISC::CBitmap::getPixelColor(), NLMISC::CBitmap::getPixelFormat(), NLMISC::CBitmap::luminanceToAlpha(), NLMISC::CBitmap::luminanceToAlphaLuminance(), NLMISC::CBitmap::luminanceToRGBA(), NLMISC::CBitmap::makeDummy(), NLMISC::CBitmap::readDDS(), NLMISC::CBitmap::readTGA(), NLMISC::CBitmap::resample(), NLMISC::CBitmap::reset(), NLMISC::CBitmap::resize(), NLMISC::CBitmap::resizeMipMap(), NLMISC::CBitmap::rgbaToAlpha(), NLMISC::CBitmap::rgbaToAlphaLuminance(), NLMISC::CBitmap::rgbaToLuminance(), NLMISC::CBitmap::rot90CCW(), NLMISC::CBitmap::rot90CW(), NLMISC::CBitmap::rotateCCW(), NL3D::sameDXTCFormat(), and NLMISC::CBitmap::writeTGA().

NLMISC::CRefPtr<CTextureDrvShare> NL3D::ITexture::TextureDrvShare [inherited]
 

Definition at line 416 of file texture.h.

Referenced by NL3D::CDriverGL::copyFrameBufferToTexture(), NL3D::getTextureGl(), NL3D::CDriverGL::getTextureHandle(), NL3D::ITexture::releaseDriverSetup(), NL3D::ITexture::setupedIntoDriver(), NL3D::CDriverGL::setupTextureEx(), NL3D::CDriverGL::uploadTexture(), and NL3D::CDriverGL::uploadTextureCube().


The documentation for this class was generated from the following files:
Generated on Tue Mar 16 07:56:55 2004 for NeL by doxygen 1.3.6