NL3D::CLodCharacterTmpBitmap Class Reference

#include <lod_character_manager.h>


Detailed Description

This bitmap is builded in the Instance texturing build process of CLodCharacterManager

Definition at line 66 of file lod_character_manager.h.

Public Member Functions

void build (CRGBA col)
void build (const NLMISC::CBitmap &bmp)
 CLodCharacterTmpBitmap ()
CRGBA getPixel (uint8 U, uint8 V)
void reset ()

Private Attributes

NLMISC::CObjectVector< CRGBA_Bitmap
uint _UShift
uint _VShift
uint _WidthPower


Constructor & Destructor Documentation

NL3D::CLodCharacterTmpBitmap::CLodCharacterTmpBitmap  ) 
 

Definition at line 792 of file lod_character_manager.cpp.

References reset().

00793 {
00794         reset();
00795 }


Member Function Documentation

void NL3D::CLodCharacterTmpBitmap::build CRGBA  col  ) 
 

Definition at line 835 of file lod_character_manager.cpp.

References _Bitmap, and reset().

00836 {
00837         // setup a 1*1 bitmap and set it with col
00838         reset();
00839         _Bitmap[0]= col;
00840 }

void NL3D::CLodCharacterTmpBitmap::build const NLMISC::CBitmap bmp  ) 
 

build from a bitmap (NB: converted internally). Should be not so big (eg:64*64). Width and height must be <=256

Definition at line 809 of file lod_character_manager.cpp.

References _Bitmap, _UShift, _VShift, _WidthPower, NLMISC::CBitmap::convertToType(), NLMISC::CBitmap::getHeight(), NLMISC::CBitmap::getPixels(), NLMISC::getPowerOf2(), NLMISC::CObjectVector< CRGBA >::getPtr(), NLMISC::CBitmap::getWidth(), height, nlassert, NLMISC::CObjectVector< CRGBA >::resize(), sint, src, uint, and width.

Referenced by NL3D::CSkeletonModel::computeLodTexture().

00810 {
00811         uint    width= bmpIn.getWidth();
00812         uint    height= bmpIn.getHeight();
00813         nlassert(width>0 && width<=256);
00814         nlassert(height>0 && height<=256);
00815 
00816         // resize bitmap.
00817         _Bitmap.resize(width*height);
00818         _WidthPower= getPowerOf2(width);
00819         // compute shift
00820         _UShift= 8-getPowerOf2(width);
00821         _VShift= 8-getPowerOf2(height);
00822 
00823         // convert the bitmap.
00824         CBitmap         bmp= bmpIn;
00825         bmp.convertToType(CBitmap::RGBA);
00826         CRGBA   *src= (CRGBA*)&bmp.getPixels()[0];
00827         CRGBA   *dst= _Bitmap.getPtr();
00828         for(sint nPix= width*height;nPix>0;nPix--, src++, dst++)
00829         {
00830                 *dst= *src;
00831         }
00832 }

CRGBA NL3D::CLodCharacterTmpBitmap::getPixel uint8  U,
uint8  V
[inline]
 

Definition at line 81 of file lod_character_manager.h.

References _Bitmap, _UShift, _VShift, _WidthPower, and uint8.

Referenced by NL3D::CLodCharacterManager::addTextureCompute().

00082         {
00083                 U>>= _UShift;
00084                 V>>= _VShift;
00085                 return _Bitmap[(V<<_WidthPower) + U];
00086         }

void NL3D::CLodCharacterTmpBitmap::reset  ) 
 

Definition at line 798 of file lod_character_manager.cpp.

References _Bitmap, _UShift, _VShift, _WidthPower, and NLMISC::CObjectVector< CRGBA >::resize().

Referenced by build(), CLodCharacterTmpBitmap(), and NL3D::CLodCharacterManager::endTextureCompute().

00799 {
00800         // setup a 1*1 bitmap
00801         _Bitmap.resize(1);
00802         _Bitmap[0]= CRGBA::Black;
00803         _WidthPower=0;
00804         _UShift= 8;
00805         _VShift= 8;
00806 }


Field Documentation

NLMISC::CObjectVector<CRGBA> NL3D::CLodCharacterTmpBitmap::_Bitmap [private]
 

Definition at line 91 of file lod_character_manager.h.

Referenced by build(), getPixel(), and reset().

uint NL3D::CLodCharacterTmpBitmap::_UShift [private]
 

Definition at line 95 of file lod_character_manager.h.

Referenced by build(), getPixel(), and reset().

uint NL3D::CLodCharacterTmpBitmap::_VShift [private]
 

Definition at line 95 of file lod_character_manager.h.

Referenced by build(), getPixel(), and reset().

uint NL3D::CLodCharacterTmpBitmap::_WidthPower [private]
 

Definition at line 93 of file lod_character_manager.h.

Referenced by build(), getPixel(), and reset().


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