NL3D::CTileElement Class Reference

#include <tile_element.h>


Detailed Description

An Element for CPatchTexture. Temporary! since CPatchTexture should be compressed... NB: no default ctor => must init all fields.
Author:
Lionel Berenguier

Nevrax France

Date:
2000

Definition at line 64 of file tile_element.h.

Public Types

enum  TVegetableInfo {
  AboveWater = 0, UnderWater, IntersectWater, VegetableDisabled,
  VegetInfoLast
}
 Micro vegetation position. Above water is the default. More...


Public Member Functions

void copyFlagsFromOther (const CTileElement &other)
 Copy this tile flags from an other tile.

void getTile256Info (bool &is256x256, uint8 &uvOff) const
uint8 getTileOrient (sint i) const
uint8 getTileSubNoise () const
TVegetableInfo getVegetableState () const
 Get the micro vegetable state for this tile.

void serial (NLMISC::IStream &f)
void setTile256Info (bool is256x256, uint8 uvOff=0)
void setTileOrient (sint i, uint8 orient)
void setTileSubNoise (uint8 subNoise)
void setVegetableState (TVegetableInfo state)
 Set the micro vegetation state.


Data Fields

uint16 Tile [3]

Private Attributes

uint16 Flags


Member Enumeration Documentation

enum NL3D::CTileElement::TVegetableInfo
 

Micro vegetation position. Above water is the default.

Enumeration values:
AboveWater 
UnderWater 
IntersectWater 
VegetableDisabled 
VegetInfoLast 

Definition at line 125 of file tile_element.h.

Referenced by getVegetableState().


Member Function Documentation

void NL3D::CTileElement::copyFlagsFromOther const CTileElement other  )  [inline]
 

Copy this tile flags from an other tile.

Definition at line 72 of file tile_element.h.

References Flags.

00072 { Flags = other.Flags; }

void NL3D::CTileElement::getTile256Info bool &  is256x256,
uint8 uvOff
const
 

Get the tile 256x256 information.

Definition at line 64 of file tile_element.cpp.

References NL_TILE_ELM_MASK_UVINFO, NL_TILE_ELM_OFFSET_UVINFO, sint, and uint8.

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

00065 {
00066         sint    where= NL_TILE_ELM_OFFSET_UVINFO;
00067         sint    info= ((Flags>>where) & NL_TILE_ELM_MASK_UVINFO);
00068         uvOff= info&3;
00069         is256x256= (info&4)?true:false;
00070 }

uint8 NL3D::CTileElement::getTileOrient sint  i  )  const
 

Get the tile orientation of pass i. orient E [0,3]. The rotation is CCW.

Definition at line 46 of file tile_element.cpp.

References NL_TILE_ELM_MASK_ROTATE, NL_TILE_ELM_OFFSET_ROTATE, NL_TILE_ELM_SIZE_ROTATE, nlassert, sint, and uint8.

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

00047 {
00048         nlassert(i>=0 && i<=2);
00049         sint    where= NL_TILE_ELM_SIZE_ROTATE*i+NL_TILE_ELM_OFFSET_ROTATE;
00050         return uint8 ((Flags>>where) & NL_TILE_ELM_MASK_ROTATE);
00051 }

uint8 NL3D::CTileElement::getTileSubNoise  )  const [inline]
 

Get the tile SubNoise information.

Definition at line 116 of file tile_element.h.

References NL_TILE_ELM_MASK_SUBNOISE, NL_TILE_ELM_OFFSET_SUBNOISE, and uint8.

00117         {
00118                 return  ((Flags>>NL_TILE_ELM_OFFSET_SUBNOISE) & NL_TILE_ELM_MASK_SUBNOISE);
00119         }

TVegetableInfo NL3D::CTileElement::getVegetableState  )  const [inline]
 

Get the micro vegetable state for this tile.

Definition at line 131 of file tile_element.h.

References NL_TILE_ELM_MASK_VEGETABLE, NL_TILE_ELM_OFFSET_VEGETABLE, and TVegetableInfo.

Referenced by NL3D::CZoneLighter::setTileFlagsToDefault().

void NL3D::CTileElement::serial NLMISC::IStream f  ) 
 

Definition at line 82 of file tile_element.cpp.

References NLMISC::IStream::xmlSerial().

00083 {
00084         f.xmlSerial (Flags, "FLAGS");
00085         f.xmlSerial (Tile[0], Tile[1], Tile[2], "TILES_ID");            
00086 }

void NL3D::CTileElement::setTile256Info bool  is256x256,
uint8  uvOff = 0
 

Set the tile 256x256 information of pass 0.

NB: During UV computing, orient is applied first, then tile256x256 uvOffset (only if the tile is 256x256).

Parameters:
is256x256 is this tile a part of a 256x256
uvOff the UV offset of tile 256x256. uvOff E [0,3]. Meanings: --------- | 0 | 3 | |___|___| | | | | 1 | 2 | ---------

Definition at line 54 of file tile_element.cpp.

References NL_TILE_ELM_MASK_UVINFO, NL_TILE_ELM_OFFSET_UVINFO, nlassert, sint, and uint8.

Referenced by NL3D::CPatchInfo::transform().

00055 {
00056         nlassert(uvOff<=3);
00057         sint    where= NL_TILE_ELM_OFFSET_UVINFO;
00058         sint    info= uvOff+(is256x256?4:0);
00059         Flags&= ~(NL_TILE_ELM_MASK_UVINFO<<where);
00060         Flags|= info<<where;
00061 }

void NL3D::CTileElement::setTileOrient sint  i,
uint8  orient
 

Set the tile orientation of pass i, to "orient". orient E [0,3]. The rotation is CCW.

Definition at line 36 of file tile_element.cpp.

References NL_TILE_ELM_MASK_ROTATE, NL_TILE_ELM_OFFSET_ROTATE, NL_TILE_ELM_SIZE_ROTATE, nlassert, sint, and uint8.

Referenced by NL3D::CPatchInfo::transform().

00037 {
00038         nlassert(i>=0 && i<=2);
00039         nlassert(orient<=3);
00040         sint    where= NL_TILE_ELM_SIZE_ROTATE*i+NL_TILE_ELM_OFFSET_ROTATE;
00041         Flags&= ~(NL_TILE_ELM_MASK_ROTATE<<where);
00042         Flags|= orient<<where;
00043 }

void NL3D::CTileElement::setTileSubNoise uint8  subNoise  ) 
 

Set the tile SubNoise. subNoise E [0, 15].

Definition at line 73 of file tile_element.cpp.

References NL_TILE_ELM_MASK_SUBNOISE, NL_TILE_ELM_OFFSET_SUBNOISE, nlassert, sint, and uint8.

00074 {
00075         nlassert(subNoise<=15);
00076         sint    where= NL_TILE_ELM_OFFSET_SUBNOISE;
00077         Flags&= ~(NL_TILE_ELM_MASK_SUBNOISE<<where);
00078         Flags|= subNoise<<where;
00079 }

void NL3D::CTileElement::setVegetableState TVegetableInfo  state  ) 
 

Set the micro vegetation state.

Definition at line 89 of file tile_element.cpp.

References NL_TILE_ELM_MASK_VEGETABLE, NL_TILE_ELM_OFFSET_VEGETABLE, nlassert, uint16, and VegetInfoLast.

Referenced by NL3D::CZoneLighter::computeTileFlagsForPositionTowardWater(), and NL3D::CZoneLighter::setTileFlagsToDefault().

00090 {
00091         nlassert(state < VegetInfoLast);
00092         const uint16 mask = NL_TILE_ELM_MASK_VEGETABLE << NL_TILE_ELM_OFFSET_VEGETABLE;
00093         Flags = (Flags & ~mask) | ((uint16) state << NL_TILE_ELM_OFFSET_VEGETABLE);
00094 }


Field Documentation

uint16 NL3D::CTileElement::Flags [private]
 

Definition at line 67 of file tile_element.h.

Referenced by copyFlagsFromOther().

uint16 NL3D::CTileElement::Tile[3]
 

The three tile ident. NL_TILE_ELM_LAYER_EMPTY means no Tile for this pass. Tile[0] should be !=NL_TILE_ELM_LAYER_EMPTY. Else cross are drawn...

Definition at line 77 of file tile_element.h.

Referenced by NL3D::CPatchDLMContext::computeTextureFar(), NL3D::CVisualCollisionEntity::getSurfaceInfo(), NL3D::CTextureFar::rebuildPatch(), and NL3D::CPatchInfo::transform().


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