NL3D::CTile Class Reference

#include <tile_bank.h>


Detailed Description

Tiles
Author:
Cyril Corvazier

Nevrax France

Date:
2000

Definition at line 57 of file tile_bank.h.

Public Types

enum  TBitmap { diffuse = 0, additive, alpha, bitmapCount }

Public Member Functions

 CTile ()
uint getGroupFlags () const
const std::string & getRelativeFileName (TBitmap bitmapType) const
uint8 getRotAlpha ()
 Get the additional orientation (CCW) for alpha texture.

bool isFree () const
void serial (class NLMISC::IStream &f) throw (NLMISC::EStream)
void setFileName (TBitmap bitmapType, const std::string &name)
void setGroupFlags (uint group)
void setRotAlpha (uint8 rot)
 Set the additional orientation (CCW) for alpha texture.


Private Member Functions

void clearTile (CTile::TBitmap type)
void free ()

Private Attributes

std::string _BitmapName [bitmapCount]
uint32 _Flags

Static Private Attributes

const sint _Version = 4

Friends

class CTileBank
class CTileSet


Member Enumeration Documentation

enum NL3D::CTile::TBitmap
 

Enumeration values:
diffuse 
additive 
alpha 
bitmapCount 

Definition at line 74 of file tile_bank.h.


Constructor & Destructor Documentation

NL3D::CTile::CTile  )  [inline]
 

Definition at line 76 of file tile_bank.h.

References NL3D_CTILE_FREE_FLAG.

00077         {
00078                 _Flags=NL3D_CTILE_FREE_FLAG;
00079         }


Member Function Documentation

void NL3D::CTile::clearTile CTile::TBitmap  type  )  [private]
 

Definition at line 810 of file tile_bank.cpp.

References _BitmapName, and type.

Referenced by NL3D::CTileSet::clearTile128(), NL3D::CTileSet::clearTile256(), and NL3D::CTileSet::clearTransition().

00811 {
00812         _BitmapName[type]="";
00813 }

void NL3D::CTile::free  )  [inline, private]
 

Definition at line 146 of file tile_bank.h.

References NL3D_CTILE_FREE_FLAG, and nlassert.

00147         {
00148                 nlassert ((_Flags&=NL3D_CTILE_FREE_FLAG)==0);
00149                 _Flags|=NL3D_CTILE_FREE_FLAG;
00150         }

uint NL3D::CTile::getGroupFlags  )  const [inline]
 

Get the group flags for this tile.

If the tile is in the I-ne gourp, the flag 1<<I is set. There are 12 groups.

Definition at line 122 of file tile_bank.h.

References NL3D_CTILE_GROUP_MASK, NL3D_CTILE_GROUP_RSHIFT, and uint.

00123         {
00124                 return ((_Flags&NL3D_CTILE_GROUP_MASK)>>NL3D_CTILE_GROUP_RSHIFT);
00125         }

const std::string& NL3D::CTile::getRelativeFileName TBitmap  bitmapType  )  const [inline]
 

Definition at line 80 of file tile_bank.h.

References _BitmapName.

Referenced by NL3D::CTileSet::deleteBordersIfLast(), and NL3D::CLandscape::loadTile().

00081         { 
00082                 return _BitmapName[bitmapType]; 
00083         }

uint8 NL3D::CTile::getRotAlpha  )  [inline]
 

Get the additional orientation (CCW) for alpha texture.

Definition at line 99 of file tile_bank.h.

References NL3D_CTILE_ROT_MASK, NL3D_CTILE_ROT_RSHIFT, and uint8.

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

00100         {
00101                 return (uint8)((_Flags&NL3D_CTILE_ROT_MASK)>>NL3D_CTILE_ROT_RSHIFT);
00102         }

bool NL3D::CTile::isFree  )  const [inline]
 

Definition at line 84 of file tile_bank.h.

References NL3D_CTILE_FREE_FLAG.

00085         {
00086                 return (_Flags&NL3D_CTILE_FREE_FLAG)!=0;
00087         }

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

Definition at line 757 of file tile_bank.cpp.

References alpha, NL3D_CTILE_FREE_FLAG, NL3D_CTILE_FREE_FLAG_V2, NL3D_CTILE_FREE_FLAG_V3, NL3D_CTILE_GROUP_MASK_V2, NL3D_CTILE_GROUP_MASK_V3, NL3D_CTILE_ROT_MASK, and sint.

00758 {
00759         sint streamver = f.serialVersion(_Version);
00760 
00761         // Tmp value
00762         bool tmp;
00763         string tmpStr;
00764 
00765         switch (streamver)
00766         {
00767         case 4:
00768         case 3:
00769         case 2:
00770                 f.serial (_Flags);
00771 
00772                 // Version 2, flags are not the same
00773                 if (streamver==2)
00774                         _Flags=(_Flags&NL3D_CTILE_ROT_MASK)|(_Flags&NL3D_CTILE_GROUP_MASK_V2)|(((_Flags&NL3D_CTILE_FREE_FLAG_V2)!=0)?NL3D_CTILE_FREE_FLAG:0);
00775                 if (streamver==3)
00776                         _Flags=(_Flags&NL3D_CTILE_ROT_MASK)|(_Flags&NL3D_CTILE_GROUP_MASK_V3)|(((_Flags&NL3D_CTILE_FREE_FLAG_V3)!=0)?NL3D_CTILE_FREE_FLAG:0);
00777 
00778                 f.serial (_BitmapName[diffuse]);
00779                 f.serial (_BitmapName[additive]);
00780                 f.serial (_BitmapName[alpha]);
00781                 break;
00782         case 1:
00783                 // Don't need invert many more
00784                 f.serial (tmp);
00785         case 0:
00786                 // Initialize flags
00787                 _Flags=0;
00788                 
00789                 // Initialize alpha name
00790                 _BitmapName[alpha]="";
00791                 
00792                 // Read free flag
00793                 f.serial (tmp);
00794 
00795                 // If free, set the flag
00796                 if (tmp)
00797                         _Flags|=NL3D_CTILE_FREE_FLAG;
00798 
00799                 // Read diffuse bitmap and additive
00800                 f.serial (_BitmapName[diffuse]);
00801                 f.serial (_BitmapName[additive]);
00802 
00803                 // Don't need bump name
00804                 f.serial (tmpStr);
00805 
00806                 break;
00807         }
00808 }

void NL3D::CTile::setFileName TBitmap  bitmapType,
const std::string &  name
[inline]
 

Definition at line 89 of file tile_bank.h.

References _BitmapName, and NL3D_CTILE_FREE_FLAG.

Referenced by NL3D::CTileSet::setTile128(), NL3D::CTileSet::setTile256(), NL3D::CTileSet::setTileTransition(), and NL3D::CTileSet::setTileTransitionAlpha().

00090         { 
00091                 // not free
00092                 _Flags&=~NL3D_CTILE_FREE_FLAG;
00093 
00094                 // set filename
00095                 _BitmapName[bitmapType]=name;
00096         }

void NL3D::CTile::setGroupFlags uint  group  )  [inline]
 

Set the group flags for this tile.

If the tile is in the I-ne gourp, the flag 1<<I is set. There are 12 groups.

Definition at line 132 of file tile_bank.h.

References NL3D_CTILE_GROUP_MASK, NL3D_CTILE_GROUP_RSHIFT, NL3D_CTILE_NUM_GROUP, nlassert, uint, and uint32.

00133         {
00134                 // Checks
00135                 nlassert (group<NL3D_CTILE_NUM_GROUP);
00136 
00137                 // Clear flags
00138                 _Flags&=~NL3D_CTILE_GROUP_MASK;
00139 
00140                 // Set flags
00141                 _Flags|=(((uint32)group)<<NL3D_CTILE_GROUP_RSHIFT);
00142         }

void NL3D::CTile::setRotAlpha uint8  rot  )  [inline]
 

Set the additional orientation (CCW) for alpha texture.

Definition at line 105 of file tile_bank.h.

References NL3D_CTILE_ROT_MASK, NL3D_CTILE_ROT_RSHIFT, nlassert, uint32, and uint8.

Referenced by NL3D::CTileSet::setTile128(), NL3D::CTileSet::setTile256(), and NL3D::CTileSet::setTileTransitionAlpha().

00106         {
00107                 // Checks
00108                 nlassert (rot<4);
00109 
00110                 // Clear flags
00111                 _Flags&=~NL3D_CTILE_ROT_MASK;
00112 
00113                 // Set flags
00114                 _Flags|=(((uint32)rot)<<NL3D_CTILE_ROT_RSHIFT);
00115         }


Friends And Related Function Documentation

friend class CTileBank [friend]
 

Definition at line 73 of file tile_bank.h.

friend class CTileSet [friend]
 

Definition at line 72 of file tile_bank.h.


Field Documentation

std::string NL3D::CTile::_BitmapName[bitmapCount] [private]
 

Definition at line 154 of file tile_bank.h.

Referenced by clearTile(), getRelativeFileName(), and setFileName().

uint32 NL3D::CTile::_Flags [private]
 

Definition at line 153 of file tile_bank.h.

const sint NL3D::CTile::_Version = 4 [static, private]
 

Definition at line 755 of file tile_bank.cpp.


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