|
|
|
|
Documentation |
|
Main Page Namespace List Class Hierarchy Alphabetical List Compound List File List Namespace Members Compound Members File Members Related Pages Search
NL3D::CZoneLighter Class Reference#include <zone_lighter.h>
List of all members.
Static PointLights mgt. |
void | compilePointLightRT (uint gridSize, float gridCellSize, std::vector< CTriangle > &obstacles, bool doShadow) |
| Fill CubeGrid, and set PointLightRT in _StaticPointLightQuadGrid. More...
|
void | processZonePointLightRT (std::vector< CPointLightNamed > &listPointLight) |
| Process the zone, ie process _PatchInfo. More...
|
std::vector< CPointLightRT > | _StaticPointLights |
| List of PointLights. More...
|
CQuadGrid< CPointLightRT * > | _StaticPointLightQuadGrid |
| QuadGrid of PointLights. Builded from _StaticPointLights. More...
|
Public Methods |
| CZoneLighter () |
virtual | ~CZoneLighter () |
void | init () |
void | light (CLandscape &landscape, CZone &output, uint zoneToLight, const CLightDesc &description, std::vector< CTriangle > &obstacles, std::vector< uint > &listZone) |
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) |
void | addLightableShape (IShape *shape, const NLMISC::CMatrix &modelMT) |
| Some shape (water shapes for now) can be lit. More...
|
void | addWaterShape (CWaterShape *shape, const NLMISC::CMatrix &MT) |
| Add a water shape. This is needed to decide wether tiles are above / below water. More...
|
virtual void | progress (const char *message, float progress) |
|
void | addStaticPointLight (const CPointLightNamed &pln) |
| Append a static point light to compute. call at setup stage (before light() ). More...
|
Static Public Methods |
bool | isLightableShape (IShape &shape) |
| check wether a shape is lightable. More...
|
Private Types |
typedef std::vector< CShapeInfo > | TShapeVect |
| A vector of lightable shapes. More...
|
typedef CQuadGrid< CWaterShape * > | TWaterShapeQuadGrid |
Private Methods |
void | addTriangles (const CMeshGeom &meshGeom, const NLMISC::CMatrix &modelMT, std::vector< CTriangle > &triangleArray) |
void | addTriangles (const CMeshMRMGeom &meshGeom, const CMatrix &modelMT, std::vector< CTriangle > &triangleArray) |
void | processCalc (uint process, const CLightDesc &description) |
void | buildZoneInformation (CLandscape &landscape, const std::vector< uint > &listZone, bool oversampling, const CLightDesc &lightDesc) |
void | excludeAllPatchFromRefineAll (CLandscape &landscape, std::vector< uint > &listZone, bool exclude) |
void | getPatchNormalAndPositions (std::vector< CLumelDescriptor > &lumels, CLandscape &landscape, uint zoneToLight, uint patch, CPatchUVLocator *locator, bool *binded) |
float | calcSkyContribution (sint s, sint t, float height, float skyIntensity, const CVector &normal) const |
float | getSkyContribution (const CVector &pos, const CVector &normal, float SkyIntensity) const |
| compute the sky contribution at the given position. More...
|
uint8 | getMaxPhi (sint s, sint t, sint deltaS, sint deltaT, float heightPos) const |
void | rayTrace (const CVector &position, const CVector &normal, float s, float t, uint patchId, float &factor, CMultiShape &shape, CMultiShape &shapeTmp, uint cpu) |
void | getNormal (const NL3D::CPatch *pPatch, sint16 lumelS, sint16 lumelT, std::vector< NL3D::CPatchUVLocator > &locator, const std::vector< NL3D::CPatch::CBindInfo > &bindInfo, const std::vector< bool > &binded, std::set< uint64 > &visited, float deltaS, float deltaT, uint rotation, const NL3D::CBezierPatch &bezierPatch, uint lastEdge=5) |
void | rayTraceTriangle (const NLMISC::CTriangle &toOverSample, NLMISC::CVector &normal, uint order, float s, float t, float &factor, uint &tested, uint patchId) |
void | testRaytrace (const CVector &position, const CVector &normal, const CPlane &plane, float s, float t, uint patchId, CMultiShape &shape, CMultiShape &shapeTmp, uint cpu) |
bool | isLumelOnEdgeMustBeOversample (uint patch, uint edge, sint s, sint t, const std::vector< bool > &binded, const std::vector< bool > &oversampleEdges, std::vector< CPatchUVLocator > &locator, uint8 shadowed, std::vector< std::vector< uint8 > > &shadowBuffer) |
void | lightShapes (uint zoneID, const CLightDesc &description) |
| Launch a set of threads to perform lighting of lightable shapes. More...
|
void | processLightableShapeCalc (uint process, TShapeVect *shapeToLit, uint firstShape, uint lastShape, const CLightDesc &description) |
| Process lighting for a set of lightable shapes. This is called by the threads created by lightShapes(). More...
|
void | lightSingleShape (CShapeInfo &lsi, CMultiShape &shape, CMultiShape &shapeTmp, const CLightDesc &description, uint cpu) |
| Compute the lighting for a single lightable shape. More...
|
void | lightWater (CWaterShape &ws, const CMatrix &MT, CMultiShape &shape, CMultiShape &shapeTmp, const CLightDesc &description, uint cpu) |
| Compute the lighting for a water shape. More...
|
void | makeQuadGridFromWaterShapes (NLMISC::CAABBox zoneBBox) |
| Make a quad grid of all the water shapes that where registered by calling addWaterShape() The vector of water shapes is released then. More...
|
void | computeTileFlagsForPositionTowardWater (const CLightDesc &lightDesc, std::vector< const CTessFace * > &tessFaces) |
| For each tile of the current zone, check wether it below or above water. More...
|
void | setTileFlagsToDefault (std::vector< const CTessFace * > &tessFaces) |
| If no water surface overlap the zone, so we set all the flags to 'AboveWater", or don't change them if they were set to 'DisableVegetable'. More...
|
uint | getAPatch (uint process) |
| ***********************************************************. More...
|
Static Private Methods |
void | copyTileFlags (CZone &destZone, const CZone &srcZone) |
| This copy the flags of the tiles from the source zone to a dest zone (result of the lighting). More...
|
Private Attributes |
CQuadGrid< const CTriangle * > | _QuadGrid [MAX_CPU_PROCESS] |
NLMISC::CMatrix | _RayBasis |
NLMISC::CVector | _RayAdd |
NLMISC::CVector | _LightDirection |
uint | _ZoneToLight |
NL3D::CLandscape * | _Landscape |
float | _ShadowBias |
bool | _Softshadow |
std::vector< std::vector<
uint8 > > | _ShadowArray |
CSynchronized< std::vector<
bool > > | _PatchComputed |
std::vector< uint > | _LastPatchComputed |
uint | _NumberOfPatchComputed |
uint | _ProcessCount |
uint64 | _CPUMask |
volatile uint | _ProcessExited |
CShape | _Shape |
float | _ShapeArea |
float | _ShapeRadius |
float | _FallofDistance |
std::vector< float > | _HeightField |
sint | _HeightFieldCellCount |
NLMISC::CVector | _OrigineHeightField |
float | _HeightfieldCellSize |
std::vector< CPatchInfo > | _PatchInfo |
std::vector< CBorderVertex > | _BorderVertices |
std::vector< std::vector<
CLumelDescriptor > > | _Lumels |
std::vector< std::vector<
CBezierPatch > > | _BezierPatch |
std::vector< std::vector<
std::vector< CPatchUVLocator > > > | _Locator |
std::vector< std::vector<
std::vector< CPatch::CBindInfo > > > | _BindInfo |
std::vector< std::vector<
std::vector< bool > > > | _Binded |
std::vector< std::vector<
bool > > | _OversampleEdges |
std::map< uint, uint > | _ZoneId |
const NL3D::CPatch * | _GetNormalPatch |
NLMISC::CVector | _GetNormalNormal |
uint | _GetNormalRadius |
uint | _GetNormalSqRadius |
NLMISC::CPoolMemory< CTriangleList > | _TriangleListAllocateur |
NLMISC::CVector | _K [256][8] |
TShapeVect | _LightableShapes |
| lightable shapes. More...
|
uint | _NumLightableShapesProcessed |
TShapeVect | _WaterShapes |
| List of all the water shapes in the zone. More...
|
TWaterShapeQuadGrid | _WaterShapeQuadGrid |
Static Private Attributes |
sint16 | _GetNormalDeltaS [4] = { -1, 0, 1, 0 } |
sint16 | _GetNormalDeltaT [4] = { 0, 1, 0, -1 } |
Friends |
class | NL3D::CCalcRunnable |
class | CCalcLightableShapeRunnable |
Member Typedef Documentation
typedef std::vector<CShapeInfo> NL3D::CZoneLighter::TShapeVect [private]
|
|
Constructor & Destructor Documentation
CZoneLighter::CZoneLighter |
( |
|
) |
|
|
virtual NL3D::CZoneLighter::~CZoneLighter |
( |
|
) |
[inline, virtual] |
|
Member Function Documentation
void CZoneLighter::addTriangles |
( |
const CMeshMRMGeom & |
meshGeom, |
|
|
const CMatrix & |
modelMT, |
|
|
std::vector< CTriangle > & |
triangleArray |
|
) |
[private] |
|
void CZoneLighter::addTriangles |
( |
CLandscape & |
landscape, |
|
|
std::vector< uint > & |
listZone, |
|
|
uint |
order, |
|
|
std::vector< CTriangle > & |
triangleArray |
|
) |
|
|
void CZoneLighter::buildZoneInformation |
( |
CLandscape & |
landscape, |
|
|
const std::vector< uint > & |
listZone, |
|
|
bool |
oversampling, |
|
|
const CLightDesc & |
lightDesc |
|
) |
[private] |
|
|
Definition at line 1713 of file zone_lighter.cpp.
References _BezierPatch, _Binded, _BindInfo, _GetNormalNormal, _Locator, _Lumels, _OversampleEdges, _TriangleListAllocateur, _WaterShapes, _ZoneId, _ZoneToLight, NLMISC::CPoolMemory< CTriangleList >::allocate, computeTileFlagsForPositionTowardWater, easineasout, getNormal, NLMISC::getPowerOf2, index, NLMISC::isPowerOf2, makeQuadGridFromWaterShapes, NL_LUMEL_BY_TILE, NL_MAX_TILES_BY_PATCH_EDGE, nlassert, NLMISC::CVector::normalize, progress, s, setTileFlagsToDefault, t, and value.
Referenced by light. |
float CZoneLighter::calcSkyContribution |
( |
sint |
s, |
|
|
sint |
t, |
|
|
float |
height, |
|
|
float |
skyIntensity, |
|
|
const CVector & |
normal |
|
) |
const [private] |
|
void CZoneLighter::compilePointLightRT |
( |
uint |
gridSize, |
|
|
float |
gridCellSize, |
|
|
std::vector< CTriangle > & |
obstacles, |
|
|
bool |
doShadow |
|
) |
[private] |
|
void CZoneLighter::computeTileFlagsForPositionTowardWater |
( |
const CLightDesc & |
lightDesc, |
|
|
std::vector< const CTessFace * > & |
tessFaces |
|
) |
[private] |
|
|
For each tile of the current zone, check wether it below or above water.
The result is stored in the flags of the tile. The quadtree is removed then.
Definition at line 3205 of file zone_lighter.cpp.
References _WaterShapeQuadGrid, _ZoneToLight, NLMISC::contReset, NLMISC::CAABBox::extend, NLMISC::CAABBox::getMax, NLMISC::CPolygon2D::intersect, NLMISC::CVector::K, nlinfo, progress, NLMISC::CAABBox::setMinMax, TTileOfPatchMap, NLMISC::CPolygon2D::Vertices, NLMISC::CVector::x, NLMISC::CVector::y, z, and NLMISC::CVector::z.
Referenced by buildZoneInformation. |
void CZoneLighter::copyTileFlags |
( |
CZone & |
destZone, |
|
|
const CZone & |
srcZone |
|
) |
[static, private] |
|
|
This copy the flags of the tiles from the source zone to a dest zone (result of the lighting).
This is needed beacuse these flags are updated to say wether a given tile is above / below water IMPORTANT : the source and destination zones must match of course...
Definition at line 606 of file zone_lighter.cpp.
References nlassert.
Referenced by light. |
void CZoneLighter::excludeAllPatchFromRefineAll |
( |
CLandscape & |
landscape, |
|
|
std::vector< uint > & |
listZone, |
|
|
bool |
exclude |
|
) |
[private] |
|
uint CZoneLighter::getAPatch |
( |
uint |
process |
) |
[private] |
|
uint8 CZoneLighter::getMaxPhi |
( |
sint |
s, |
|
|
sint |
t, |
|
|
sint |
deltaS, |
|
|
sint |
deltaT, |
|
|
float |
heightPos |
|
) |
const [private] |
|
void CZoneLighter::getNormal |
( |
const NL3D::CPatch * |
pPatch, |
|
|
sint16 |
lumelS, |
|
|
sint16 |
lumelT, |
|
|
std::vector< NL3D::CPatchUVLocator > & |
locator, |
|
|
const std::vector< NL3D::CPatch::CBindInfo > & |
bindInfo, |
|
|
const std::vector< bool > & |
binded, |
|
|
std::set< uint64 > & |
visited, |
|
|
float |
deltaS, |
|
|
float |
deltaT, |
|
|
uint |
rotation, |
|
|
const NL3D::CBezierPatch & |
bezierPatch, |
|
|
uint |
lastEdge = 5 |
|
) |
[private] |
|
float CZoneLighter::getSkyContribution |
( |
const CVector & |
pos, |
|
|
const CVector & |
normal, |
|
|
float |
SkyIntensity |
|
) |
const [private] |
|
void CZoneLighter::init |
( |
|
) |
|
|
bool CZoneLighter::isLightableShape |
( |
IShape & |
shape |
) |
[static] |
|
bool CZoneLighter::isLumelOnEdgeMustBeOversample |
( |
uint |
patch, |
|
|
uint |
edge, |
|
|
sint |
s, |
|
|
sint |
t, |
|
|
const std::vector< bool > & |
binded, |
|
|
const std::vector< bool > & |
oversampleEdges, |
|
|
std::vector< CPatchUVLocator > & |
locator, |
|
|
uint8 |
shadowed, |
|
|
std::vector< std::vector< uint8 > > & |
shadowBuffer |
|
) |
[private] |
|
|
Definition at line 283 of file zone_lighter.cpp.
References _BorderVertices, _CPUMask, _FallofDistance, _HeightField, _HeightFieldCellCount, _HeightfieldCellSize, _Landscape, _LastPatchComputed, _LightDirection, _NumberOfPatchComputed, _OrigineHeightField, _PatchComputed, _PatchInfo, _ProcessCount, _ProcessExited, _QuadGrid, _RayAdd, _RayBasis, _ShadowArray, _ShadowBias, _Shape, _ShapeArea, _ShapeRadius, _Softshadow, _ZoneToLight, buildZoneInformation, compilePointLightRT, copyTileFlags, NLMISC::CMatrix::getI, NLMISC::CMatrix::getJ, NLMISC::CMatrix::invert, lightShapes, MAX_CPU_PROCESS, min, NEL3DCalcBase, nlassert, NLMISC::nlSleep, NLMISC::CVector::normalize, NL3D::CZoneLighter::CShape::NumVertex, NLMISC::Pi, processZonePointLightRT, progress, NL3D::CZoneLighter::CShape::Vertices, x, NLMISC::CVector::x, y, and NLMISC::CVector::y. |
void CZoneLighter::lightShapes |
( |
uint |
zoneID, |
|
|
const CLightDesc & |
description |
|
) |
[private] |
|
|
Compute the lighting for a water shape.
Definition at line 2584 of file zone_lighter.cpp.
References NLMISC::clamp, getExt, NLMISC::CPolygon::getNumVertices, getSkyContribution, height, NLMISC::CMatrix::inverted, NLMISC::CVector::K, min, NLMISC::CRGBA::modulateFromColor, nlwarning, rayTrace, NLMISC::CMatrix::setPos, NLMISC::CMatrix::setRot, NLMISC::CPolygon::Vertices, width, x, NLMISC::CVector::x, NLMISC::CVector2f::x, y, NLMISC::CVector::y, and NLMISC::CVector2f::y.
Referenced by lightSingleShape. |
void CZoneLighter::makeQuadGridFromWaterShapes |
( |
NLMISC::CAABBox |
zoneBBox |
) |
[private] |
|
void CZoneLighter::processCalc |
( |
uint |
process, |
|
|
const CLightDesc & |
description |
|
) |
[private] |
|
|
Definition at line 638 of file zone_lighter.cpp.
References _Binded, _Landscape, _LightDirection, _Locator, _Lumels, _OversampleEdges, _PatchInfo, _ShadowArray, _ZoneId, _ZoneToLight, NLMISC::clamp, getAPatch, getSkyContribution, NL3D::CLandscape::getZone, isLumelOnEdgeMustBeOversample, nlassert, rayTrace, rayTraceTriangle, s, SHAPE_MAX, and t. |
void CZoneLighter::processLightableShapeCalc |
( |
uint |
process, |
|
|
TShapeVect * |
shapeToLit, |
|
|
uint |
firstShape, |
|
|
uint |
lastShape, |
|
|
const CLightDesc & |
description |
|
) |
[private] |
|
void CZoneLighter::processZonePointLightRT |
( |
std::vector< CPointLightNamed > & |
listPointLight |
) |
[private] |
|
|
Process the zone, ie process _PatchInfo.
MultiCPU: not done for now. Be aware of CPointLightRT::RefCount!!!!
Definition at line 2988 of file zone_lighter.cpp.
References _Landscape, _PatchInfo, _StaticPointLightQuadGrid, _StaticPointLights, _ZoneToLight, NLMISC::clamp, NL3D::CLandscape::getZone, min, progress, s, t, w, x, and y.
Referenced by light. |
virtual void NL3D::CZoneLighter::progress |
( |
const char * |
message, |
|
|
float |
progress |
|
) |
[inline, virtual] |
|
void CZoneLighter::rayTrace |
( |
const CVector & |
position, |
|
|
const CVector & |
normal, |
|
|
float |
s, |
|
|
float |
t, |
|
|
uint |
patchId, |
|
|
float & |
factor, |
|
|
CMultiShape & |
shape, |
|
|
CMultiShape & |
shapeTmp, |
|
|
uint |
cpu |
|
) |
[private] |
|
void CZoneLighter::setTileFlagsToDefault |
( |
std::vector< const CTessFace * > & |
tessFaces |
) |
[private] |
|
void CZoneLighter::testRaytrace |
( |
const CVector & |
position, |
|
|
const CVector & |
normal, |
|
|
const CPlane & |
plane, |
|
|
float |
s, |
|
|
float |
t, |
|
|
uint |
patchId, |
|
|
CMultiShape & |
shape, |
|
|
CMultiShape & |
shapeTmp, |
|
|
uint |
cpu |
|
) |
[private] |
|
|
Definition at line 927 of file zone_lighter.cpp.
References _FallofDistance, _LightDirection, _QuadGrid, _RayAdd, _RayBasis, _ShadowBias, _ShapeRadius, _Softshadow, _ZoneToLight, AllBack, Clipped, s, NLMISC::CMatrix::setPos, SHAPE_VERTICES_MAX, t, v, NLMISC::CTriangle::V0, NLMISC::CTriangle::V1, NLMISC::CTriangle::V2, x, and y.
Referenced by rayTrace. |
Friends And Related Function Documentation
friend class CCalcLightableShapeRunnable [friend]
|
|
friend class NL3D::CCalcRunnable [friend]
|
|
Member Data Documentation
std::vector<std::vector<CBezierPatch> > NL3D::CZoneLighter::_BezierPatch [private]
|
|
std::vector<std::vector<std::vector<bool> > > NL3D::CZoneLighter::_Binded [private]
|
|
std::vector<std::vector<std::vector<CPatch::CBindInfo> > > NL3D::CZoneLighter::_BindInfo [private]
|
|
std::vector<CBorderVertex> NL3D::CZoneLighter::_BorderVertices [private]
|
|
uint64 NL3D::CZoneLighter::_CPUMask [private]
|
|
float NL3D::CZoneLighter::_FallofDistance [private]
|
|
sint16 CZoneLighter::_GetNormalDeltaS = { -1, 0, 1, 0 } [static, private]
|
|
sint16 CZoneLighter::_GetNormalDeltaT = { 0, 1, 0, -1 } [static, private]
|
|
const NL3D::CPatch* NL3D::CZoneLighter::_GetNormalPatch [private]
|
|
uint NL3D::CZoneLighter::_GetNormalRadius [private]
|
|
uint NL3D::CZoneLighter::_GetNormalSqRadius [private]
|
|
std::vector<float> NL3D::CZoneLighter::_HeightField [private]
|
|
sint NL3D::CZoneLighter::_HeightFieldCellCount [private]
|
|
float NL3D::CZoneLighter::_HeightfieldCellSize [private]
|
|
std::vector<uint> NL3D::CZoneLighter::_LastPatchComputed [private]
|
|
TShapeVect NL3D::CZoneLighter::_LightableShapes [private]
|
|
std::vector<std::vector<std::vector<CPatchUVLocator> > > NL3D::CZoneLighter::_Locator [private]
|
|
std::vector<std::vector<CLumelDescriptor> > NL3D::CZoneLighter::_Lumels [private]
|
|
uint NL3D::CZoneLighter::_NumberOfPatchComputed [private]
|
|
uint NL3D::CZoneLighter::_NumLightableShapesProcessed [private]
|
|
std::vector<std::vector<bool> > NL3D::CZoneLighter::_OversampleEdges [private]
|
|
CSynchronized<std::vector<bool> > NL3D::CZoneLighter::_PatchComputed [private]
|
|
std::vector<CPatchInfo> NL3D::CZoneLighter::_PatchInfo [private]
|
|
uint NL3D::CZoneLighter::_ProcessCount [private]
|
|
volatile uint NL3D::CZoneLighter::_ProcessExited [private]
|
|
std::vector<std::vector<uint8> > NL3D::CZoneLighter::_ShadowArray [private]
|
|
float NL3D::CZoneLighter::_ShadowBias [private]
|
|
CShape NL3D::CZoneLighter::_Shape [private]
|
|
float NL3D::CZoneLighter::_ShapeArea [private]
|
|
float NL3D::CZoneLighter::_ShapeRadius [private]
|
|
bool NL3D::CZoneLighter::_Softshadow [private]
|
|
std::vector<CPointLightRT> NL3D::CZoneLighter::_StaticPointLights [private]
|
|
TShapeVect NL3D::CZoneLighter::_WaterShapes [private]
|
|
std::map<uint, uint> NL3D::CZoneLighter::_ZoneId [private]
|
|
uint NL3D::CZoneLighter::_ZoneToLight [private]
|
|
The documentation for this class was generated from the following files:
|
|