#include <ig_surface_light.h>
Nevrax France
Definition at line 48 of file ig_surface_light.h.
Public Types | |
typedef TRetrieverGridMap::iterator | ItRetrieverGridMap |
typedef std::map< uint32, CRetrieverLightGrid > | TRetrieverGridMap |
Public Member Functions | |
void | build (const TRetrieverGridMap &retrieverGridMap, float cellSize, const std::vector< uint > &plRemap) |
CIGSurfaceLight () | |
Constructor. A CIGSurfaceLight MUST be owned by an CInstanceGroup (nlassert(_Owner!=NULL));. | |
void | clear () |
clear. | |
float | getCellSize () const |
float | getOOCellSize () const |
const TRetrieverGridMap & | getRetrieverGridMap () const |
bool | getStaticLightSetup (uint retrieverIdentifier, sint surfaceId, const CVector &localPos, std::vector< CPointLightInfluence > &pointLightList, uint8 &sunContribution, NLMISC::CRGBA &localAmbient) |
void | serial (NLMISC::IStream &f) |
void | setOwner (CInstanceGroup *owner) |
Private Attributes | |
float | _CellSize |
float | _OOCellSize |
CInstanceGroup * | _Owner |
TRetrieverGridMap | _RetrieverGridMap |
Friends | |
class | CSurfaceLightGrid |
|
Definition at line 63 of file ig_surface_light.h. Referenced by build(), and getStaticLightSetup(). |
|
Definition at line 62 of file ig_surface_light.h. Referenced by NL3D::CInstanceGroup::build(), build(), and getRetrieverGridMap(). |
|
Constructor. A CIGSurfaceLight MUST be owned by an CInstanceGroup (nlassert(_Owner!=NULL));.
Definition at line 35 of file ig_surface_light.cpp. References _CellSize, and _OOCellSize.
00036 { 00037 _Owner= NULL; 00038 _CellSize= 1; 00039 _OOCellSize= 1; 00040 } |
|
build. called by CInstanceLighter.
Definition at line 50 of file ig_surface_light.cpp. References _CellSize, _OOCellSize, _RetrieverGridMap, NL3D::CSurfaceLightGrid::Cells, ItRetrieverGridMap, NL3D::CSurfaceLightGrid::CCellCorner::Light, NL3D::CSurfaceLightGrid::CCellCorner::LocalAmbientId, nlassert, NLMISC::CObjectVector< CCellCorner >::size(), TRetrieverGridMap, and uint. Referenced by NL3D::CInstanceGroup::build().
00052 { 00053 _RetrieverGridMap= retrieverGridMap; 00054 nlassert(cellSize>0); 00055 _CellSize= cellSize; 00056 _OOCellSize= 1.f/_CellSize; 00057 00058 // remap indices. 00059 ItRetrieverGridMap it; 00060 for(it= _RetrieverGridMap.begin(); it!=_RetrieverGridMap.end(); it++) 00061 { 00062 // For all grids of this retriever 00063 for(uint iGrid= 0; iGrid<it->second.Grids.size(); iGrid++) 00064 { 00065 CSurfaceLightGrid &grid= it->second.Grids[iGrid]; 00066 00067 // For all cells of this grid. 00068 for(uint iCell= 0; iCell<grid.Cells.size(); iCell++) 00069 { 00070 CSurfaceLightGrid::CCellCorner &cell= grid.Cells[iCell]; 00071 00072 // For all point light id. 00073 for(uint lid= 0; lid<CSurfaceLightGrid::NumLightPerCorner; lid++) 00074 { 00075 if(cell.Light[lid] == 0xFF) 00076 break; 00077 else 00078 cell.Light[lid]= plRemap[cell.Light[lid]]; 00079 } 00080 00081 // remap ambient light 00082 if(cell.LocalAmbientId!=0xFF) 00083 cell.LocalAmbientId= plRemap[cell.LocalAmbientId]; 00084 } 00085 } 00086 } 00087 } |
|
clear.
Definition at line 90 of file ig_surface_light.cpp. References _CellSize, _OOCellSize, and _RetrieverGridMap. Referenced by NL3D::CInstanceGroup::build(), and NL3D::CInstanceGroup::serial().
00091 { 00092 _RetrieverGridMap.clear(); 00093 _CellSize= 1; 00094 _OOCellSize= 1; 00095 } |
|
Definition at line 98 of file ig_surface_light.h. References _CellSize.
00098 {return _CellSize;} |
|
Definition at line 99 of file ig_surface_light.h. References _OOCellSize. Referenced by NL3D::CSurfaceLightGrid::getStaticLightSetup().
00099 {return _OOCellSize;} |
|
Definition at line 102 of file ig_surface_light.h. References _RetrieverGridMap, and TRetrieverGridMap. Referenced by NL3D::CIGSurfaceLightBuild::buildPLDebugMesh().
00102 {return _RetrieverGridMap;} |
|
Get StaticLightSetup Infos from the grid
Definition at line 121 of file ig_surface_light.cpp. References _RetrieverGridMap, NL3D::CIGSurfaceLight::CRetrieverLightGrid::Grids, ItRetrieverGridMap, nlassert, NLMISC::CRGBA::set(), sint, NLMISC::CObjectVector< CSurfaceLightGrid >::size(), uint, and uint8. Referenced by NL3D::CInstanceGroup::getStaticLightSetup().
00123 { 00124 nlassert(_Owner); 00125 00126 // default 00127 sunContribution= 255; 00128 localAmbient.set(0,0,0,0); 00129 00130 ItRetrieverGridMap it; 00131 it= _RetrieverGridMap.find(retrieverIdentifier); 00132 // If bad ident 00133 if(it==_RetrieverGridMap.end()) 00134 return false; 00135 CRetrieverLightGrid &rlg= it->second; 00136 // if bad surfaceId 00137 if(surfaceId<0 || surfaceId>= (sint)rlg.Grids.size()) 00138 return false; 00139 00140 // Else, ok, get it. 00141 rlg.Grids[surfaceId].getStaticLightSetup(localPos, pointLightList, sunContribution, *this, localAmbient); 00142 return true; 00143 } |
|
Definition at line 98 of file ig_surface_light.cpp. References _CellSize, _OOCellSize, _RetrieverGridMap, NLMISC::IStream::serial(), NLMISC::IStream::serialCont(), NLMISC::IStream::serialVersion(), and sint.
00099 { 00100 /* 00101 Version 1: 00102 - The retriever grid map is now a map<uint,CRetrieverLightGrid>. Discard compatibility but. 00103 */ 00104 sint ver= f.serialVersion(1); 00105 00106 f.serial(_CellSize); 00107 f.serial(_OOCellSize); 00108 if(ver<1) 00109 { 00110 std::map<std::string, CRetrieverLightGrid> oldFormatRetrieverGridMap; 00111 f.serialCont(oldFormatRetrieverGridMap); 00112 _RetrieverGridMap.clear(); 00113 } 00114 else 00115 { 00116 f.serialCont(_RetrieverGridMap); 00117 } 00118 } |
|
Definition at line 43 of file ig_surface_light.cpp. References nlassert. Referenced by NL3D::CInstanceGroup::CInstanceGroup().
|
|
Definition at line 106 of file ig_surface_light.h. |
|
Definition at line 110 of file ig_surface_light.h. Referenced by build(), CIGSurfaceLight(), clear(), getCellSize(), and serial(). |
|
Definition at line 111 of file ig_surface_light.h. Referenced by build(), CIGSurfaceLight(), clear(), getOOCellSize(), and serial(). |
|
Definition at line 109 of file ig_surface_light.h. Referenced by NL3D::CSurfaceLightGrid::getStaticLightSetup(). |
|
Definition at line 112 of file ig_surface_light.h. Referenced by build(), clear(), getRetrieverGridMap(), getStaticLightSetup(), and serial(). |