NL3D::CTileLightInfluence Class Reference

#include <tile_light_influence.h>


Detailed Description

For landscape. A descriptor of light which influence a corner of a TessBlock: 2 lights Ids (points to PointLight in zone), with 2 diffuseLightFactor.
Author:
Lionel Berenguier

Nevrax France

Date:
2001

Definition at line 45 of file tile_light_influence.h.

Public Types

enum  { NumLightPerCorner = 2 }
 We support only 2 light per corner. Should never be changed. More...


Public Member Functions

 CTileLightInfluence ()
 Constructor.

uint8 getDiffuseLightFactor (uint i) const
 see setDiffuseLightFactor(). return uint8 E [0, 255]

void serial (NLMISC::IStream &f)
void setDiffuseLightFactor (uint i, uint8 factor)
 i: 0 or 1. factor E [0..255] is the factor of influence (gouraud) of the ith light. NB: stored on 4 bits.


Data Fields

uint8 Light [NumLightPerCorner]

Private Attributes

uint8 PackedLightFactor
 Packed.


Member Enumeration Documentation

anonymous enum
 

We support only 2 light per corner. Should never be changed.

Enumeration values:
NumLightPerCorner 

Definition at line 50 of file tile_light_influence.h.

00050 {NumLightPerCorner= 2};


Constructor & Destructor Documentation

NL3D::CTileLightInfluence::CTileLightInfluence  )  [inline]
 

Constructor.

Definition at line 54 of file tile_light_influence.h.

00054 {}


Member Function Documentation

uint8 NL3D::CTileLightInfluence::getDiffuseLightFactor uint  i  )  const
 

see setDiffuseLightFactor(). return uint8 E [0, 255]

Definition at line 53 of file tile_light_influence.cpp.

References nlassert, PackedLightFactor, uint, and uint8.

00054 {
00055         nlassert(CTileLightInfluence::NumLightPerCorner == 2);
00056         nlassert(i == 0 || i == 1);
00057 
00058         // Choose what factor
00059         uint8   ret= PackedLightFactor >> (4*i);
00060         ret&= 0x0F;
00061 
00062         // expand to 0..255
00063         return ret + (ret<<4);
00064 }

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

Definition at line 67 of file tile_light_influence.cpp.

References nlassert, PackedLightFactor, and NLMISC::IStream::serial().

00068 {
00069         nlassert(CTileLightInfluence::NumLightPerCorner == 2);
00070         // No version for smaller size on disk !!
00071 
00072         f.serial(Light[0], Light[1], PackedLightFactor);
00073 }

void NL3D::CTileLightInfluence::setDiffuseLightFactor uint  i,
uint8  factor
 

i: 0 or 1. factor E [0..255] is the factor of influence (gouraud) of the ith light. NB: stored on 4 bits.

Definition at line 36 of file tile_light_influence.cpp.

References nlassert, PackedLightFactor, uint, and uint8.

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

00037 {
00038         nlassert(CTileLightInfluence::NumLightPerCorner == 2);
00039         nlassert(i == 0 || i == 1);
00040 
00041         // Divide by 16.
00042         factor>>=4;
00043 
00044         // set to the ith light.
00045         uint8   mask= 0x0F << (4*i);
00046         // clear.
00047         PackedLightFactor&= ~mask;
00048         // set.
00049         PackedLightFactor|= factor << (4*i);
00050 }


Field Documentation

uint8 NL3D::CTileLightInfluence::Light[NumLightPerCorner]
 

List of lights. Id==0xFF => no light. if Light[i]==0xFF, then Light[j] with j>i is supposed disalbed too.

Definition at line 60 of file tile_light_influence.h.

Referenced by NL3D::CPatch::appendTileLightInfluences(), NL3D::CZone::build(), and NL3D::CZoneLighter::processZonePointLightRT().

uint8 NL3D::CTileLightInfluence::PackedLightFactor [private]
 

Packed.

Definition at line 74 of file tile_light_influence.h.

Referenced by getDiffuseLightFactor(), serial(), and setDiffuseLightFactor().


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