# Home    # nevrax.com   
Nevrax
Nevrax.org
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#License
Docs
 
Documentation  
Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Search  

NL3D::CInstanceLighter Class Reference

A class to precompute "StaticSetup" lighting for instances in an InstanceGroup. More...

#include <instance_lighter.h>

List of all members.

Cell Iteration. ie iteration on _IGRetrieverGridMap cells and _IGSurfaceLightBuild cells

void beginCell ()
void nextCell ()
bool isEndCell ()
CSurfaceLightGrid::CCellCornergetCurrentCell ()
CIGSurfaceLightBuild::CCellCornergetCurrentCellInfo ()
bool isCurrentNeighborCellInSurface (sint xnb, sint ynb)
CSurfaceLightGrid::CCellCornergetCurrentNeighborCell (sint xnb, sint ynb)
CIGSurfaceLightBuild::CCellCornergetCurrentNeighborCellInfo (sint xnb, sint ynb)
uint getCurrentCellNumber () const
uint getTotalCellNumber () const
void progressCell (const char *message)
CIGSurfaceLight::ItRetrieverGridMap _ItRetriever
CIGSurfaceLightBuild::ItRetrieverGridMap _ItRetrieverInfo
uint _ItSurfId
uint _ItCellId
bool _IsEndCell
uint _ItCurrentCellNumber
uint _TotalCellNumber
float _LastCellProgress

Public Types

enum  { MaxOverSamples = 16 }

Public Methods

 CInstanceLighter ()
 Constructor. More...

virtual ~CInstanceLighter ()
 Destructor. More...

void init ()
void light (const CInstanceGroup &igIn, CInstanceGroup &igOut, const CLightDesc &lightDesc, std::vector< CTriangle > &obstacles, CLandscape *landscape=NULL, CIGSurfaceLightBuild *igSurfaceLightBuild=NULL)
 Light an InstanceGroup igOut has different PointLights than igIn. More...

virtual void progress (const char *message, float progress)
Static PointLights mgt.
void addStaticPointLight (const CPointLightNamed &pln)
 Append a static point light to compute. More...


Static Public Methods

void lightIgSimple (CInstanceLighter &instLighter, const CInstanceGroup &igIn, CInstanceGroup &igOut, const CLightDesc &lightDesc)
 Tool method which take a single IG, and do all the god job to light this one, with no other dependencies NB: it uses instLighter passed, init() ing it. More...

void addTriangles (CLandscape &landscape, std::vector< uint > &listZone, uint order, std::vector< CTriangle > &triangleArray)
void addTriangles (const IShape &shape, const NLMISC::CMatrix &modelMT, std::vector< CTriangle > &triangleArray, sint instanceId)
 Add triangles from a transform shape. More...


Private Methods

void computeSunContribution (const CLightDesc &lightDesc, std::vector< CTriangle > &obstacles, CLandscape *landscape)
void dilateLightingOnSurfaceCells ()
void compilePointLightRT (uint gridSize, float gridCellSize, std::vector< CTriangle > &obstacles, bool doShadow)
 Fill CubeGrid, and set PointLightRT in _StaticPointLightQuadGrid. More...

void processIGPointLightRT (std::vector< CPointLightNamed > &listPointLight)
 Process the IG, ie process _InstanceInfos. More...


Static Private Methods

void addTriangles (const CMeshGeom &meshGeom, const NLMISC::CMatrix &modelMT, std::vector< CTriangle > &triangleArray, sint instanceId)
void addTriangles (const CMeshMRMGeom &meshGeom, const NLMISC::CMatrix &modelMT, std::vector< CTriangle > &triangleArray, sint instanceId)
void excludeAllPatchFromRefineAll (CLandscape &landscape, std::vector< uint > &listZone, bool exclude)

Private Attributes

std::vector< CInstanceGroup::CInstance_Instances
std::vector< CInstanceInfo_InstanceInfos
sint _CurrentInstanceComputed
CIGSurfaceLightBuild_IGSurfaceLightBuild
CIGSurfaceLight::TRetrieverGridMap _IGRetrieverGridMap
std::vector< CPointLightRT_StaticPointLights
 List of PointLights. More...

CQuadGrid< CPointLightRT * > _StaticPointLightQuadGrid
 QuadGrid of PointLights. Builded from _StaticPointLights. More...


Detailed Description

A class to precompute "StaticSetup" lighting for instances in an InstanceGroup.

Class "inspired" from CZoneLighter :)

Author:
Lionel Berenguier , Nevrax France
Date:
2001

Definition at line 55 of file instance_lighter.h.


Member Enumeration Documentation

anonymous enum
 

Enumeration values:
MaxOverSamples 

Definition at line 59 of file instance_lighter.h.


Constructor & Destructor Documentation

NL3D::CInstanceLighter::CInstanceLighter  
 

Constructor.

Definition at line 66 of file instance_lighter.cpp.

References _IGSurfaceLightBuild.

virtual NL3D::CInstanceLighter::~CInstanceLighter   [inline, virtual]
 

Destructor.

Definition at line 131 of file instance_lighter.h.


Member Function Documentation

void NL3D::CInstanceLighter::addStaticPointLight const CPointLightNamed   pln
 

Append a static point light to compute.

call at setup stage (before light() ). NB: you must append all PointLights of intersets, even ones from the IG to compute.

Definition at line 999 of file instance_lighter.cpp.

References _StaticPointLights.

void NL3D::CInstanceLighter::addTriangles const CMeshMRMGeom   meshGeom,
const NLMISC::CMatrix   modelMT,
std::vector< CTriangle > &    triangleArray,
sint    instanceId
[static, private]
 

Definition at line 231 of file instance_lighter.cpp.

void NL3D::CInstanceLighter::addTriangles const CMeshGeom   meshGeom,
const NLMISC::CMatrix   modelMT,
std::vector< CTriangle > &    triangleArray,
sint    instanceId
[static, private]
 

Definition at line 179 of file instance_lighter.cpp.

void NL3D::CInstanceLighter::addTriangles const IShape   shape,
const NLMISC::CMatrix   modelMT,
std::vector< CTriangle > &    triangleArray,
sint    instanceId
[static]
 

Add triangles from a transform shape.

Work only for CMesh, CMultiMesh and CMeshMRM all without skinning. Give An instanceId!=-1 only for instances of the IG to compute. This is to avoid auto-shadowing.

Definition at line 129 of file instance_lighter.cpp.

References addTriangles.

void NL3D::CInstanceLighter::addTriangles CLandscape   landscape,
std::vector< uint > &    listZone,
uint    order,
std::vector< CTriangle > &    triangleArray
[static]
 

Definition at line 77 of file instance_lighter.cpp.

References excludeAllPatchFromRefineAll.

Referenced by addTriangles.

void NL3D::CInstanceLighter::beginCell   [private]
 

Definition at line 1615 of file instance_lighter.cpp.

References _IGRetrieverGridMap, _IGSurfaceLightBuild, _IsEndCell, _ItCellId, _ItCurrentCellNumber, _ItRetriever, _ItRetrieverInfo, _ItSurfId, _LastCellProgress, and nlassert.

Referenced by computeSunContribution, dilateLightingOnSurfaceCells, and processIGPointLightRT.

void NL3D::CInstanceLighter::compilePointLightRT uint    gridSize,
float    gridCellSize,
std::vector< CTriangle > &    obstacles,
bool    doShadow
[private]
 

Fill CubeGrid, and set PointLightRT in _StaticPointLightQuadGrid.

Definition at line 1022 of file instance_lighter.cpp.

References _StaticPointLightQuadGrid, _StaticPointLights, NL3D_INSTANCE_LIGHTER_CUBE_GRID_SIZE, and progress.

Referenced by light.

void NL3D::CInstanceLighter::computeSunContribution const CLightDesc   lightDesc,
std::vector< CTriangle > &    obstacles,
CLandscape   landscape
[private]
 

Definition at line 633 of file instance_lighter.cpp.

References _CurrentInstanceComputed, _InstanceInfos, _Instances, beginCell, getCurrentCell, getCurrentCellInfo, isEndCell, NEL3DCalcBase, nextCell, nlassert, progress, and progressCell.

Referenced by light.

void NL3D::CInstanceLighter::dilateLightingOnSurfaceCells   [private]
 

Definition at line 1781 of file instance_lighter.cpp.

References beginCell, getCurrentCell, getCurrentCellInfo, getCurrentNeighborCell, getCurrentNeighborCellInfo, isCurrentNeighborCellInSurface, isEndCell, nextCell, and progressCell.

Referenced by light.

void NL3D::CInstanceLighter::excludeAllPatchFromRefineAll CLandscape   landscape,
std::vector< uint > &    listZone,
bool    exclude
[static, private]
 

Definition at line 278 of file instance_lighter.cpp.

Referenced by addTriangles.

CSurfaceLightGrid::CCellCorner & NL3D::CInstanceLighter::getCurrentCell   [private]
 

Definition at line 1685 of file instance_lighter.cpp.

References _ItCellId, _ItRetriever, _ItSurfId, isEndCell, and nlassert.

Referenced by computeSunContribution, dilateLightingOnSurfaceCells, and processIGPointLightRT.

CIGSurfaceLightBuild::CCellCorner & NL3D::CInstanceLighter::getCurrentCellInfo   [private]
 

Definition at line 1694 of file instance_lighter.cpp.

References _ItCellId, _ItRetrieverInfo, _ItSurfId, isEndCell, and nlassert.

Referenced by computeSunContribution, dilateLightingOnSurfaceCells, and processIGPointLightRT.

uint NL3D::CInstanceLighter::getCurrentCellNumber   const [inline, private]
 

Definition at line 284 of file instance_lighter.h.

References _ItCurrentCellNumber.

Referenced by progressCell.

CSurfaceLightGrid::CCellCorner & NL3D::CInstanceLighter::getCurrentNeighborCell sint    xnb,
sint    ynb
[private]
 

Definition at line 1737 of file instance_lighter.cpp.

References _ItCellId, _ItRetriever, _ItSurfId, isCurrentNeighborCellInSurface, and nlassert.

Referenced by dilateLightingOnSurfaceCells.

CIGSurfaceLightBuild::CCellCorner & NL3D::CInstanceLighter::getCurrentNeighborCellInfo sint    xnb,
sint    ynb
[private]
 

Definition at line 1759 of file instance_lighter.cpp.

References _ItCellId, _ItRetrieverInfo, _ItSurfId, isCurrentNeighborCellInSurface, and nlassert.

Referenced by dilateLightingOnSurfaceCells.

uint NL3D::CInstanceLighter::getTotalCellNumber   const [inline, private]
 

Definition at line 285 of file instance_lighter.h.

References _TotalCellNumber.

Referenced by progressCell.

void NL3D::CInstanceLighter::init  
 

Definition at line 72 of file instance_lighter.cpp.

bool NL3D::CInstanceLighter::isCurrentNeighborCellInSurface sint    xnb,
sint    ynb
[private]
 

Definition at line 1704 of file instance_lighter.cpp.

References _ItCellId, _ItRetriever, _ItRetrieverInfo, _ItSurfId, isEndCell, and nlassert.

Referenced by dilateLightingOnSurfaceCells, getCurrentNeighborCell, and getCurrentNeighborCellInfo.

bool NL3D::CInstanceLighter::isEndCell   [private]
 

Definition at line 1679 of file instance_lighter.cpp.

References _IsEndCell.

Referenced by computeSunContribution, dilateLightingOnSurfaceCells, getCurrentCell, getCurrentCellInfo, isCurrentNeighborCellInSurface, nextCell, and processIGPointLightRT.

void NL3D::CInstanceLighter::light const CInstanceGroup   igIn,
CInstanceGroup   igOut,
const CLightDesc   lightDesc,
std::vector< CTriangle > &    obstacles,
CLandscape   landscape = NULL,
CIGSurfaceLightBuild   igSurfaceLightBuild = NULL
 

Light an InstanceGroup igOut has different PointLights than igIn.

eg: if a pointLight do not light anything, then it is not present in igOut. NB: shapes are used to retrieve usefull info on them (center of AABBox ...) . They are taken from lightDesc.UserShapeMap, or loaded from lightDesc.ShapePath if not found.

Parameters:
landscape  if !NULL use this Landscape SunContribution, looking landscape faces under each instance, for faster computing, and to get influence of Sky. NB: this landscape does not have to be tesselated, but all Zones that lies under igIn should be loaded in.
igSurfaceLightBuild  if !NULL, light() will compute igOut.IGSurfaceLight, else it is just cleared.

Definition at line 305 of file instance_lighter.cpp.

References _IGRetrieverGridMap, _IGSurfaceLightBuild, _InstanceInfos, _Instances, _IsEndCell, _TotalCellNumber, compilePointLightRT, computeSunContribution, dilateLightingOnSurfaceCells, MaxOverSamples, nlassert, nlwarning, and processIGPointLightRT.

void NL3D::CInstanceLighter::lightIgSimple CInstanceLighter &    instLighter,
const CInstanceGroup   igIn,
CInstanceGroup   igOut,
const CLightDesc   lightDesc
[static]
 

Tool method which take a single IG, and do all the god job to light this one, with no other dependencies NB: it uses instLighter passed, init() ing it.

It use lightDesc.UserShapeMap or it load Shape in directory lightDesc.ShapePath

Definition at line 1482 of file instance_lighter.cpp.

References nlwarning.

void NL3D::CInstanceLighter::nextCell   [private]
 

Definition at line 1643 of file instance_lighter.cpp.

References _IGRetrieverGridMap, _IGSurfaceLightBuild, _IsEndCell, _ItCellId, _ItCurrentCellNumber, _ItRetriever, _ItRetrieverInfo, _ItSurfId, isEndCell, and nlassert.

Referenced by computeSunContribution, dilateLightingOnSurfaceCells, and processIGPointLightRT.

void NL3D::CInstanceLighter::processIGPointLightRT std::vector< CPointLightNamed > &    listPointLight [private]
 

Process the IG, ie process _InstanceInfos.

Also process SurfaceLightGrid MultiCPU: not done for now. Be aware of CPointLightRT::RefCount!!!!

Definition at line 1160 of file instance_lighter.cpp.

References _CurrentInstanceComputed, _InstanceInfos, _Instances, _StaticPointLightQuadGrid, _StaticPointLights, beginCell, getCurrentCell, getCurrentCellInfo, isEndCell, min, nextCell, progress, and progressCell.

Referenced by light.

virtual void NL3D::CInstanceLighter::progress const char *    message,
float    progress
[inline, virtual]
 

Definition at line 159 of file instance_lighter.h.

References progress.

Referenced by compilePointLightRT, computeSunContribution, processIGPointLightRT, progress, and progressCell.

void NL3D::CInstanceLighter::progressCell const char *    message [private]
 

Definition at line 1603 of file instance_lighter.cpp.

References _LastCellProgress, getCurrentCellNumber, getTotalCellNumber, and progress.

Referenced by computeSunContribution, dilateLightingOnSurfaceCells, and processIGPointLightRT.


Member Data Documentation

sint NL3D::CInstanceLighter::_CurrentInstanceComputed [private]
 

Definition at line 210 of file instance_lighter.h.

Referenced by computeSunContribution, and processIGPointLightRT.

CIGSurfaceLight::TRetrieverGridMap NL3D::CInstanceLighter::_IGRetrieverGridMap [private]
 

Definition at line 214 of file instance_lighter.h.

Referenced by beginCell, light, and nextCell.

CIGSurfaceLightBuild* NL3D::CInstanceLighter::_IGSurfaceLightBuild [private]
 

Definition at line 212 of file instance_lighter.h.

Referenced by beginCell, CInstanceLighter, light, and nextCell.

std::vector<CInstanceInfo> NL3D::CInstanceLighter::_InstanceInfos [private]
 

Definition at line 208 of file instance_lighter.h.

Referenced by computeSunContribution, light, and processIGPointLightRT.

std::vector<CInstanceGroup::CInstance> NL3D::CInstanceLighter::_Instances [private]
 

Definition at line 206 of file instance_lighter.h.

Referenced by computeSunContribution, light, and processIGPointLightRT.

bool NL3D::CInstanceLighter::_IsEndCell [private]
 

Definition at line 293 of file instance_lighter.h.

Referenced by beginCell, isEndCell, light, and nextCell.

uint NL3D::CInstanceLighter::_ItCellId [private]
 

Definition at line 292 of file instance_lighter.h.

Referenced by beginCell, getCurrentCell, getCurrentCellInfo, getCurrentNeighborCell, getCurrentNeighborCellInfo, isCurrentNeighborCellInSurface, and nextCell.

uint NL3D::CInstanceLighter::_ItCurrentCellNumber [private]
 

Definition at line 294 of file instance_lighter.h.

Referenced by beginCell, getCurrentCellNumber, and nextCell.

CIGSurfaceLight::ItRetrieverGridMap NL3D::CInstanceLighter::_ItRetriever [private]
 

Definition at line 289 of file instance_lighter.h.

Referenced by beginCell, getCurrentCell, getCurrentNeighborCell, isCurrentNeighborCellInSurface, and nextCell.

CIGSurfaceLightBuild::ItRetrieverGridMap NL3D::CInstanceLighter::_ItRetrieverInfo [private]
 

Definition at line 290 of file instance_lighter.h.

Referenced by beginCell, getCurrentCellInfo, getCurrentNeighborCellInfo, isCurrentNeighborCellInSurface, and nextCell.

uint NL3D::CInstanceLighter::_ItSurfId [private]
 

Definition at line 291 of file instance_lighter.h.

Referenced by beginCell, getCurrentCell, getCurrentCellInfo, getCurrentNeighborCell, getCurrentNeighborCellInfo, isCurrentNeighborCellInSurface, and nextCell.

float NL3D::CInstanceLighter::_LastCellProgress [private]
 

Definition at line 296 of file instance_lighter.h.

Referenced by beginCell, and progressCell.

CQuadGrid<CPointLightRT*> NL3D::CInstanceLighter::_StaticPointLightQuadGrid [private]
 

QuadGrid of PointLights. Builded from _StaticPointLights.

Definition at line 255 of file instance_lighter.h.

Referenced by compilePointLightRT, and processIGPointLightRT.

std::vector<CPointLightRT> NL3D::CInstanceLighter::_StaticPointLights [private]
 

List of PointLights.

Definition at line 253 of file instance_lighter.h.

Referenced by addStaticPointLight, compilePointLightRT, and processIGPointLightRT.

uint NL3D::CInstanceLighter::_TotalCellNumber [private]
 

Definition at line 295 of file instance_lighter.h.

Referenced by getTotalCellNumber, and light.


The documentation for this class was generated from the following files: