NL3D::CTileFarBank::CTileFar Class Reference

#include <tile_far_bank.h>


Public Member Functions

 CTileFar ()
 Default constructor.

void erasePixels (TFarType type)
 Erase a pixel array type.

const NLMISC::CRGBAgetPixels (TFarType type, TFarOrder order) const
 Return the pointer on the pixels data. Call this method only if isFill () returns true.

uint getSize (TFarType type, TFarOrder order) const
 Return the pixel array size. Should be 0 for empty, 64 for a 128x128 tile and 256 for a 256x256 tile.

bool isFill (TFarType type) const
 Return true if pixel value are presents, else return false.

void serial (class NLMISC::IStream &f) throw (NLMISC::EStream)
 Serial this tile.

void setPixels (TFarType type, TFarOrder order, NLMISC::CRGBA *pixels, uint size)
 Set the pixel array of a far Tile.


Private Attributes

std::vector< NLMISC::CRGBA_Pixels [typeCount][orderCount]
 RGBA Pixels vector.


Static Private Attributes

const sint _Version = 0x0
 The version of this class.


Friends

class CTileFarBank


Constructor & Destructor Documentation

NL3D::CTileFarBank::CTileFar::CTileFar  )  [inline]
 

Default constructor.

Definition at line 72 of file tile_far_bank.h.

00073                 {
00074                 }


Member Function Documentation

void NL3D::CTileFarBank::CTileFar::erasePixels TFarType  type  )  [inline]
 

Erase a pixel array type.

Definition at line 98 of file tile_far_bank.h.

References _Pixels, NLMISC::contReset(), and type.

00099                 {
00100                         NLMISC::contReset (_Pixels[type][order0]);
00101                         NLMISC::contReset (_Pixels[type][order1]);
00102                         NLMISC::contReset (_Pixels[type][order2]);
00103                 }

const NLMISC::CRGBA* NL3D::CTileFarBank::CTileFar::getPixels TFarType  type,
TFarOrder  order
const [inline]
 

Return the pointer on the pixels data. Call this method only if isFill () returns true.

Definition at line 77 of file tile_far_bank.h.

References _Pixels, and type.

Referenced by NL3D::CPatchDLMContext::computeTextureFar(), and NL3D::CTextureFar::rebuildPatch().

00078                 {
00079                         return &_Pixels[type][order][0];
00080                 }

uint NL3D::CTileFarBank::CTileFar::getSize TFarType  type,
TFarOrder  order
const [inline]
 

Return the pixel array size. Should be 0 for empty, 64 for a 128x128 tile and 256 for a 256x256 tile.

Definition at line 89 of file tile_far_bank.h.

References _Pixels, type, and uint.

00090                 {
00091                         return _Pixels[type][order].size();
00092                 }

bool NL3D::CTileFarBank::CTileFar::isFill TFarType  type  )  const [inline]
 

Return true if pixel value are presents, else return false.

Definition at line 83 of file tile_far_bank.h.

References _Pixels, and type.

Referenced by NL3D::CPatchDLMContext::computeTextureFar(), and NL3D::CTextureFar::rebuildPatch().

00084                 {
00085                         return _Pixels[type][0].begin()!=_Pixels[type][0].end();
00086                 }

void NL3D::CTileFarBank::CTileFar::serial class NLMISC::IStream f  )  throw (NLMISC::EStream)
 

Serial this tile.

Definition at line 47 of file tile_far_bank.cpp.

References size.

00048 {
00049         // Serial version
00050         (void)f.serialVersion(_Version);
00051 
00052         // Serial pixels
00053         f.serialCont (_Pixels[diffuse][order0]);
00054         f.serialCont (_Pixels[diffuse][order1]);
00055         f.serialCont (_Pixels[diffuse][order2]);
00056         f.serialCont (_Pixels[additive][order0]);
00057         f.serialCont (_Pixels[additive][order1]);
00058         f.serialCont (_Pixels[additive][order2]);
00059 
00060 #ifdef NEL_FORCE_WHITE_FAR_TEXTURE
00061         int size = _Pixels[diffuse][order0].size ();
00062         _Pixels[diffuse][order0].resize (0);
00063         _Pixels[diffuse][order0].resize (size, CRGBA::White);
00064         size = _Pixels[diffuse][order1].size ();
00065         _Pixels[diffuse][order1].resize (0);
00066         _Pixels[diffuse][order1].resize (size, CRGBA::White);
00067         size = _Pixels[diffuse][order2].size ();
00068         _Pixels[diffuse][order2].resize (0);
00069         _Pixels[diffuse][order2].resize (size, CRGBA::White);
00070 #endif // NEL_FORCE_WHITE_FAR_TEXTURE
00071 }

void NL3D::CTileFarBank::CTileFar::setPixels TFarType  type,
TFarOrder  order,
NLMISC::CRGBA pixels,
uint  size
 

Set the pixel array of a far Tile.

Definition at line 73 of file tile_far_bank.cpp.

References _Pixels, NLMISC::CRGBA::A, alpha, size, type, and uint.

00074 {
00075         // Mode alpha ?
00076         if (type==alpha)
00077         {
00078                 _Pixels[diffuse][order].resize (size);
00079                 _Pixels[additive][order].resize (size);
00080 
00081                 // Copy only the alpha channel
00082                 for (uint p=0; p<size; p++)
00083                 {
00084                         _Pixels[diffuse][order][p].A=pixels[p].A;
00085                         _Pixels[additive][order][p].A=pixels[p].A;
00086                 }
00087         }
00088         else
00089         {
00090                 // Resize this array
00091                 _Pixels[type][order].resize (size);
00092 
00093                 // Copy all the channels
00094                 memcpy (&_Pixels[type][order][0], pixels, size*sizeof(NLMISC::CRGBA));
00095         }
00096 }


Friends And Related Function Documentation

friend class CTileFarBank [friend]
 

Definition at line 69 of file tile_far_bank.h.


Field Documentation

std::vector<NLMISC::CRGBA> NL3D::CTileFarBank::CTileFar::_Pixels[typeCount][orderCount] [private]
 

RGBA Pixels vector.

Definition at line 110 of file tile_far_bank.h.

Referenced by erasePixels(), getPixels(), getSize(), isFill(), and setPixels().

const sint NL3D::CTileFarBank::CTileFar::_Version = 0x0 [static, private]
 

The version of this class.

Definition at line 45 of file tile_far_bank.cpp.


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