diff options
author | neodarz <neodarz@neodarz.net> | 2018-08-11 20:21:34 +0200 |
---|---|---|
committer | neodarz <neodarz@neodarz.net> | 2018-08-11 20:21:34 +0200 |
commit | 0ea5fc66924303d1bf73ba283a383e2aadee02f2 (patch) | |
tree | 2568e71a7ccc44ec23b8bb3f0ff97fb6bf2ed709 /docs/doxygen/nel/a03739.html | |
download | nevrax-website-self-hostable-0ea5fc66924303d1bf73ba283a383e2aadee02f2.tar.xz nevrax-website-self-hostable-0ea5fc66924303d1bf73ba283a383e2aadee02f2.zip |
Initial commit
Diffstat (limited to '')
-rw-r--r-- | docs/doxygen/nel/a03739.html | 5912 |
1 files changed, 5912 insertions, 0 deletions
diff --git a/docs/doxygen/nel/a03739.html b/docs/doxygen/nel/a03739.html new file mode 100644 index 00000000..b0eb7236 --- /dev/null +++ b/docs/doxygen/nel/a03739.html @@ -0,0 +1,5912 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> +<title>NeL: NL3D::CZoneLighter class Reference</title> +<link href="doxygen.css" rel="stylesheet" type="text/css"> +</head><body> +<!-- Generated by Doxygen 1.3.6 --> +<div class="qindex"> <form class="search" action="search.php" method="get"> +<a class="qindex" href="main.html">Main Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical List</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="namespacemembers.html">Namespace Members</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related Pages</a> | <span class="search"><u>S</u>earch for <input class="search" type="text" name="query" value="" size="20" accesskey="s"/></span></form></div> +<h1>NL3D::CZoneLighter Class Reference</h1><code>#include <<a class="el" href="a06769.html">zone_lighter.h</a>></code> +<p> +<table border=0 cellpadding=0 cellspacing=0> +<tr><td></td></tr> +<tr><td colspan=2><br><h2>Static PointLights mgt.</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a03739.html#NL3D_1_1CZoneLighterz1203_0">compilePointLightRT</a> (<a class="el" href="a04558.html#a15">uint</a> gridSize, float gridCellSize, std::vector< <a class="el" href="a03750.html">CTriangle</a> > &obstacles, bool doShadow)</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Fill CubeGrid, and set PointLightRT in _StaticPointLightQuadGrid. <a href="#NL3D_1_1CZoneLighterz1203_0"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a03739.html#NL3D_1_1CZoneLighterz1203_1">processZonePointLightRT</a> (std::vector< <a class="el" href="a03094.html">CPointLightNamed</a> > &listPointLight)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03273.html">CQuadGrid</a>< <a class="el" href="a03746.html">CPointLightRT</a> * > </td><td class="memItemRight" valign=bottom><a class="el" href="a03739.html#NL3D_1_1CZoneLighterz1203_2">_StaticPointLightQuadGrid</a></td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">QuadGrid of PointLights. Builded from _StaticPointLights. <a href="#NL3D_1_1CZoneLighterz1203_2"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>std::vector< <a class="el" href="a03746.html">CPointLightRT</a> > </td><td class="memItemRight" valign=bottom><a class="el" href="a03739.html#NL3D_1_1CZoneLighterz1203_3">_StaticPointLights</a></td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">List of PointLights. <a href="#NL3D_1_1CZoneLighterz1203_3"></a><br><br></td></tr> +<tr><td colspan=2><br><h2>Public Member Functions</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a03739.html#NL3D_1_1CZoneLightera0">addLightableShape</a> (<a class="el" href="a02539.html">IShape</a> *shape, const <a class="el" href="a02851.html">NLMISC::CMatrix</a> &modelMT)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a03739.html#NL3D_1_1CZoneLightera1">addTriangles</a> (const <a class="el" href="a02539.html">IShape</a> &shape, const <a class="el" href="a02851.html">NLMISC::CMatrix</a> &modelMT, std::vector< <a class="el" href="a03750.html">CTriangle</a> > &triangleArray)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a03739.html#NL3D_1_1CZoneLightera2">addTriangles</a> (<a class="el" href="a02702.html">CLandscape</a> &landscape, std::vector< <a class="el" href="a04558.html#a15">uint</a> > &listZone, <a class="el" href="a04558.html#a15">uint</a> order, std::vector< <a class="el" href="a03750.html">CTriangle</a> > &triangleArray)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a03739.html#NL3D_1_1CZoneLightera3">addWaterShape</a> (<a class="el" href="a03724.html">CWaterShape</a> *shape, const <a class="el" href="a02851.html">NLMISC::CMatrix</a> &MT)</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Add a water shape. This is needed to decide wether tiles are above / below water. <a href="#NL3D_1_1CZoneLightera3"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>float </td><td class="memItemRight" valign=bottom><a class="el" href="a03739.html#NL3D_1_1CZoneLightera4">attenuation</a> (const <a class="el" href="a03128.html">CVector</a> &pos, const <a class="el" href="a03741.html">CZoneLighter::CLightDesc</a> &description)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top> </td><td class="memItemRight" valign=bottom><a class="el" href="a03739.html#NL3D_1_1CZoneLightera5">CZoneLighter</a> ()</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a03739.html#NL3D_1_1CZoneLightera6">init</a> ()</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a03739.html#NL3D_1_1CZoneLightera7">light</a> (<a class="el" href="a02702.html">CLandscape</a> &landscape, <a class="el" href="a03730.html">CZone</a> &output, <a class="el" href="a04558.html#a15">uint</a> zoneToLight, const <a class="el" href="a03741.html">CLightDesc</a> &description, std::vector< <a class="el" href="a03750.html">CTriangle</a> > &obstacles, std::vector< <a class="el" href="a04558.html#a15">uint</a> > &listZone)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>virtual void </td><td class="memItemRight" valign=bottom><a class="el" href="a03739.html#NL3D_1_1CZoneLightera8">progress</a> (const char *message, float progress)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>virtual </td><td class="memItemRight" valign=bottom><a class="el" href="a03739.html#NL3D_1_1CZoneLightera9">~CZoneLighter</a> ()</td></tr> + +<tr><td colspan="2"><div class="groupHeader">Static PointLights mgt.</div></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a03739.html#NL3D_1_1CZoneLighterz1201_0">addStaticPointLight</a> (const <a class="el" href="a03094.html">CPointLightNamed</a> &pln)</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Append a static point light to compute. call at setup stage (before <a class="el" href="a03739.html#NL3D_1_1CZoneLightera7">light()</a> ). <a href="#NL3D_1_1CZoneLighterz1201_0"></a><br><br></td></tr> +<tr><td colspan=2><br><h2>Static Public Member Functions</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a03739.html#NL3D_1_1CZoneLightere0">isLightableShape</a> (<a class="el" href="a02539.html">IShape</a> &shape)</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">check wether a shape is lightable. <a href="#NL3D_1_1CZoneLightere0"></a><br><br></td></tr> +<tr><td colspan=2><br><h2>Data Fields</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>std::vector< <a class="el" href="a03751.html">CZBuffer</a> > </td><td class="memItemRight" valign=bottom><a class="el" href="a03739.html#NL3D_1_1CZoneLightero0">_ZBufferLandscape</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03751.html">CZBuffer</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a03739.html#NL3D_1_1CZoneLightero1">_ZBufferObject</a></td></tr> + +<tr><td colspan=2><br><h2>Private Types</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>typedef std::vector< <a class="el" href="a03748.html">CShapeInfo</a> > </td><td class="memItemRight" valign=bottom><a class="el" href="a03739.html#NL3D_1_1CZoneLightery0">TShapeVect</a></td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">A vector of lightable shapes. <a href="#NL3D_1_1CZoneLightery0"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>typedef <a class="el" href="a03273.html">CQuadGrid</a>< <a class="el" href="a03724.html">CWaterShape</a> * > </td><td class="memItemRight" valign=bottom><a class="el" href="a03739.html#NL3D_1_1CZoneLightery1">TWaterShapeQuadGrid</a></td></tr> + +<tr><td colspan=2><br><h2>Private Member Functions</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a03739.html#NL3D_1_1CZoneLighterd0">addTriangles</a> (const <a class="el" href="a02858.html">CMeshBase</a> &meshBase, const <a class="el" href="a02892.html">CMeshMRMGeom</a> &meshGeom, const <a class="el" href="a02851.html">CMatrix</a> &modelMT, std::vector< <a class="el" href="a03750.html">CTriangle</a> > &triangleArray)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a03739.html#NL3D_1_1CZoneLighterd1">addTriangles</a> (const <a class="el" href="a02858.html">CMeshBase</a> &meshBase, const <a class="el" href="a02878.html">CMeshGeom</a> &meshGeom, const <a class="el" href="a02851.html">NLMISC::CMatrix</a> &modelMT, std::vector< <a class="el" href="a03750.html">CTriangle</a> > &triangleArray)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a03739.html#NL3D_1_1CZoneLighterd2">buildZoneInformation</a> (<a class="el" href="a02702.html">CLandscape</a> &landscape, const std::vector< <a class="el" href="a04558.html#a15">uint</a> > &listZone, const <a class="el" href="a03741.html">CLightDesc</a> &lightDesc)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>float </td><td class="memItemRight" valign=bottom><a class="el" href="a03739.html#NL3D_1_1CZoneLighterd3">calcSkyContribution</a> (<a class="el" href="a04558.html#a14">sint</a> <a class="el" href="a04223.html#a626">s</a>, <a class="el" href="a04558.html#a14">sint</a> <a class="el" href="a04223.html#a627">t</a>, float <a class="el" href="a04223.html#a633">height</a>, float skyIntensity, const <a class="el" href="a03128.html">CVector</a> &normal) const </td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a03739.html#NL3D_1_1CZoneLighterd4">computeTileFlagsForPositionTowardWater</a> (const <a class="el" href="a03741.html">CLightDesc</a> &lightDesc, std::vector< const <a class="el" href="a03476.html">CTessFace</a> * > &tessFaces)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a03739.html#NL3D_1_1CZoneLighterd5">excludeAllPatchFromRefineAll</a> (<a class="el" href="a02702.html">CLandscape</a> &landscape, std::vector< <a class="el" href="a04558.html#a15">uint</a> > &listZone, bool exclude)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a15">uint</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a03739.html#NL3D_1_1CZoneLighterd6">getAPatch</a> (<a class="el" href="a04558.html#a15">uint</a> process)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a7">uint8</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a03739.html#NL3D_1_1CZoneLighterd7">getMaxPhi</a> (<a class="el" href="a04558.html#a14">sint</a> <a class="el" href="a04223.html#a626">s</a>, <a class="el" href="a04558.html#a14">sint</a> <a class="el" href="a04223.html#a627">t</a>, <a class="el" href="a04558.html#a14">sint</a> deltaS, <a class="el" href="a04558.html#a14">sint</a> deltaT, float heightPos) const </td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a03739.html#NL3D_1_1CZoneLighterd8">getNormal</a> (const <a class="el" href="a03057.html">NL3D::CPatch</a> *pPatch, <a class="el" href="a04558.html#a8">sint16</a> lumelS, <a class="el" href="a04558.html#a8">sint16</a> lumelT, std::vector< <a class="el" href="a03070.html">NL3D::CPatchUVLocator</a> > &locator, const std::vector< <a class="el" href="a03058.html">NL3D::CPatch::CBindInfo</a> > &bindInfo, const std::vector< bool > &binded, std::set< <a class="el" href="a04558.html#a13">uint64</a> > &visited, float deltaS, float deltaT, <a class="el" href="a04558.html#a15">uint</a> rotation, const <a class="el" href="a02258.html">NL3D::CBezierPatch</a> &bezierPatch, <a class="el" href="a04558.html#a15">uint</a> lastEdge=5)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a03739.html#NL3D_1_1CZoneLighterd9">getPatchNormalAndPositions</a> (std::vector< <a class="el" href="a03744.html">CLumelDescriptor</a> > &lumels, <a class="el" href="a02702.html">CLandscape</a> &landscape, <a class="el" href="a04558.html#a15">uint</a> zoneToLight, <a class="el" href="a04558.html#a15">uint</a> patch, <a class="el" href="a03070.html">CPatchUVLocator</a> *locator, bool *binded)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>float </td><td class="memItemRight" valign=bottom><a class="el" href="a03739.html#NL3D_1_1CZoneLighterd10">getSkyContribution</a> (const <a class="el" href="a03128.html">CVector</a> &pos, const <a class="el" href="a03128.html">CVector</a> &normal, float SkyIntensity) const </td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">compute the sky contribution at the given position <a href="#NL3D_1_1CZoneLighterd10"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a03739.html#NL3D_1_1CZoneLighterd11">getTexture</a> (const <a class="el" href="a02839.html">CMaterial</a> &material, <a class="el" href="a02268.html">NLMISC::CBitmap</a> *&result, bool &clampU, bool &clampV, <a class="el" href="a04558.html#a7">uint8</a> &alphaTestThreshold, bool &doubleSided)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a03739.html#NL3D_1_1CZoneLighterd12">isLumelOnEdgeMustBeOversample</a> (<a class="el" href="a04558.html#a15">uint</a> patch, <a class="el" href="a04558.html#a15">uint</a> edge, <a class="el" href="a04558.html#a14">sint</a> <a class="el" href="a04223.html#a626">s</a>, <a class="el" href="a04558.html#a14">sint</a> <a class="el" href="a04223.html#a627">t</a>, const std::vector< bool > &binded, const std::vector< bool > &oversampleEdges, std::vector< <a class="el" href="a03070.html">CPatchUVLocator</a> > &locator, <a class="el" href="a04558.html#a7">uint8</a> shadowed, std::vector< std::vector< <a class="el" href="a04558.html#a7">uint8</a> > > &shadowBuffer)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a03739.html#NL3D_1_1CZoneLighterd13">lightShapes</a> (<a class="el" href="a04558.html#a15">uint</a> zoneID, const <a class="el" href="a03741.html">CLightDesc</a> &description)</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Launch a set of threads to perform lighting of lightable shapes. <a href="#NL3D_1_1CZoneLighterd13"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a03739.html#NL3D_1_1CZoneLighterd14">lightSingleShape</a> (<a class="el" href="a03748.html">CShapeInfo</a> &lsi, const <a class="el" href="a03741.html">CLightDesc</a> &description, <a class="el" href="a04558.html#a15">uint</a> cpu)</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Compute the lighting for a single lightable shape. <a href="#NL3D_1_1CZoneLighterd14"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a03739.html#NL3D_1_1CZoneLighterd15">lightWater</a> (<a class="el" href="a03724.html">CWaterShape</a> &ws, const <a class="el" href="a02851.html">CMatrix</a> &MT, const <a class="el" href="a03741.html">CLightDesc</a> &description, <a class="el" href="a04558.html#a15">uint</a> cpu)</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Compute the lighting for a water shape. <a href="#NL3D_1_1CZoneLighterd15"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a03739.html#NL3D_1_1CZoneLighterd16">makeQuadGridFromWaterShapes</a> (<a class="el" href="a02156.html">NLMISC::CAABBox</a> zoneBBox)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a03739.html#NL3D_1_1CZoneLighterd17">processCalc</a> (<a class="el" href="a04558.html#a15">uint</a> process, const <a class="el" href="a03741.html">CLightDesc</a> &description)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a03739.html#NL3D_1_1CZoneLighterd18">processLightableShapeCalc</a> (<a class="el" href="a04558.html#a15">uint</a> process, <a class="el" href="a03739.html#NL3D_1_1CZoneLightery0">TShapeVect</a> *shapeToLit, <a class="el" href="a04558.html#a15">uint</a> firstShape, <a class="el" href="a04558.html#a15">uint</a> lastShape, const <a class="el" href="a03741.html">CLightDesc</a> &description)</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Process lighting for a set of lightable shapes. This is called by the threads created by <a class="el" href="a03739.html#NL3D_1_1CZoneLighterd13">lightShapes()</a>. <a href="#NL3D_1_1CZoneLighterd18"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a03739.html#NL3D_1_1CZoneLighterd19">setTileFlagsToDefault</a> (std::vector< const <a class="el" href="a03476.html">CTessFace</a> * > &tessFaces)</td></tr> + +<tr><td colspan=2><br><h2>Static Private Member Functions</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a03739.html#NL3D_1_1CZoneLighterh0">copyTileFlags</a> (<a class="el" href="a03730.html">CZone</a> &destZone, const <a class="el" href="a03730.html">CZone</a> &srcZone)</td></tr> + +<tr><td colspan=2><br><h2>Private Attributes</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>std::vector< std::vector<<br> + <a class="el" href="a02258.html">CBezierPatch</a> > > </td><td class="memItemRight" valign=bottom><a class="el" href="a03739.html#NL3D_1_1CZoneLighterr0">_BezierPatch</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>std::vector< std::vector<<br> + std::vector< bool > > > </td><td class="memItemRight" valign=bottom><a class="el" href="a03739.html#NL3D_1_1CZoneLighterr1">_Binded</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>std::vector< std::vector<<br> + std::vector< <a class="el" href="a03058.html">CPatch::CBindInfo</a> > > > </td><td class="memItemRight" valign=bottom><a class="el" href="a03739.html#NL3D_1_1CZoneLighterr2">_BindInfo</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>std::map< std::string, <a class="el" href="a02268.html">NLMISC::CBitmap</a> > </td><td class="memItemRight" valign=bottom><a class="el" href="a03739.html#NL3D_1_1CZoneLighterr3">_Bitmaps</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>std::vector< <a class="el" href="a02290.html">CBorderVertex</a> > </td><td class="memItemRight" valign=bottom><a class="el" href="a03739.html#NL3D_1_1CZoneLighterr4">_BorderVertices</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a13">uint64</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a03739.html#NL3D_1_1CZoneLighterr5">_CPUMask</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03128.html">NLMISC::CVector</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a03739.html#NL3D_1_1CZoneLighterr6">_GetNormalNormal</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>const <a class="el" href="a03057.html">NL3D::CPatch</a> * </td><td class="memItemRight" valign=bottom><a class="el" href="a03739.html#NL3D_1_1CZoneLighterr7">_GetNormalPatch</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a15">uint</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a03739.html#NL3D_1_1CZoneLighterr8">_GetNormalRadius</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a15">uint</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a03739.html#NL3D_1_1CZoneLighterr9">_GetNormalSqRadius</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>std::vector< float > </td><td class="memItemRight" valign=bottom><a class="el" href="a03739.html#NL3D_1_1CZoneLighterr10">_HeightField</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a14">sint</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a03739.html#NL3D_1_1CZoneLighterr11">_HeightFieldCellCount</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>float </td><td class="memItemRight" valign=bottom><a class="el" href="a03739.html#NL3D_1_1CZoneLighterr12">_HeightfieldCellSize</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03128.html">NLMISC::CVector</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a03739.html#NL3D_1_1CZoneLighterr13">_K</a> [256][8]</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a02702.html">NL3D::CLandscape</a> * </td><td class="memItemRight" valign=bottom><a class="el" href="a03739.html#NL3D_1_1CZoneLighterr14">_Landscape</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>std::vector< <a class="el" href="a04558.html#a15">uint</a> > </td><td class="memItemRight" valign=bottom><a class="el" href="a03739.html#NL3D_1_1CZoneLighterr15">_LastPatchComputed</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03739.html#NL3D_1_1CZoneLightery0">TShapeVect</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a03739.html#NL3D_1_1CZoneLighterr16">_LightableShapes</a></td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">lightable shapes <a href="#NL3D_1_1CZoneLighterr16"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>std::vector< std::vector<<br> + std::vector< <a class="el" href="a03070.html">CPatchUVLocator</a> > > > </td><td class="memItemRight" valign=bottom><a class="el" href="a03739.html#NL3D_1_1CZoneLighterr17">_Locator</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>std::vector< std::vector<<br> + <a class="el" href="a03744.html">CLumelDescriptor</a> > > </td><td class="memItemRight" valign=bottom><a class="el" href="a03739.html#NL3D_1_1CZoneLighterr18">_Lumels</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a02516.html">NLMISC::CFastMutex</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a03739.html#NL3D_1_1CZoneLighterr19">_Mutex</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a15">uint</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a03739.html#NL3D_1_1CZoneLighterr20">_NumberOfPatchComputed</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a15">uint</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a03739.html#NL3D_1_1CZoneLighterr21">_NumLightableShapesProcessed</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03128.html">NLMISC::CVector</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a03739.html#NL3D_1_1CZoneLighterr22">_OrigineHeightField</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>std::vector< std::vector<<br> + bool > > </td><td class="memItemRight" valign=bottom><a class="el" href="a03739.html#NL3D_1_1CZoneLighterr23">_OversampleEdges</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>NLMISC::CSynchronized< std::vector<<br> + bool > > </td><td class="memItemRight" valign=bottom><a class="el" href="a03739.html#NL3D_1_1CZoneLighterr24">_PatchComputed</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>std::vector< <a class="el" href="a03066.html">CPatchInfo</a> > </td><td class="memItemRight" valign=bottom><a class="el" href="a03739.html#NL3D_1_1CZoneLighterr25">_PatchInfo</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a15">uint</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a03739.html#NL3D_1_1CZoneLighterr26">_ProcessCount</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>volatile <a class="el" href="a04558.html#a15">uint</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a03739.html#NL3D_1_1CZoneLighterr27">_ProcessExited</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03273.html">CQuadGrid</a>< const <a class="el" href="a03750.html">CTriangle</a> * > </td><td class="memItemRight" valign=bottom><a class="el" href="a03739.html#NL3D_1_1CZoneLighterr28">_QuadGrid</a> [10]</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03302.html">NLMISC::CRandom</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a03739.html#NL3D_1_1CZoneLighterr29">_Random</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a02851.html">NLMISC::CMatrix</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a03739.html#NL3D_1_1CZoneLighterr30">_RayBasis</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>std::vector< std::vector<<br> + <a class="el" href="a04558.html#a7">uint8</a> > > </td><td class="memItemRight" valign=bottom><a class="el" href="a03739.html#NL3D_1_1CZoneLighterr31">_ShadowArray</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>float </td><td class="memItemRight" valign=bottom><a class="el" href="a03739.html#NL3D_1_1CZoneLighterr32">_ShadowBias</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a03739.html#NL3D_1_1CZoneLighterr33">_Softshadow</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03128.html">NLMISC::CVector</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a03739.html#NL3D_1_1CZoneLighterr34">_SunDirection</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03273.html">TWaterShapeQuadGrid</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a03739.html#NL3D_1_1CZoneLighterr35">_WaterShapeQuadGrid</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03739.html#NL3D_1_1CZoneLightery0">TShapeVect</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a03739.html#NL3D_1_1CZoneLighterr36">_WaterShapes</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a03739.html#NL3D_1_1CZoneLighterr37">_ZBufferOverflow</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>std::map< <a class="el" href="a04558.html#a15">uint</a>, <a class="el" href="a04558.html#a15">uint</a> > </td><td class="memItemRight" valign=bottom><a class="el" href="a03739.html#NL3D_1_1CZoneLighterr38">_ZoneId</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a15">uint</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a03739.html#NL3D_1_1CZoneLighterr39">_ZoneToLight</a></td></tr> + +<tr><td colspan=2><br><h2>Static Private Attributes</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a8">sint16</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a03739.html#NL3D_1_1CZoneLighterv0">_GetNormalDeltaS</a> [4] = { -1, 0, 1, 0 }</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a8">sint16</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a03739.html#NL3D_1_1CZoneLighterv1">_GetNormalDeltaT</a> [4] = { 0, 1, 0, -1 }</td></tr> + +<tr><td colspan=2><br><h2>Friends</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>class </td><td class="memItemRight" valign=bottom><a class="el" href="a03739.html#NL3D_1_1CZoneLightern0">CCalcLightableShapeRunnable</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>class </td><td class="memItemRight" valign=bottom><a class="el" href="a03739.html#NL3D_1_1CZoneLightern1">NL3D::CLightRunnable</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>class </td><td class="memItemRight" valign=bottom><a class="el" href="a03739.html#NL3D_1_1CZoneLightern2">NL3D::CRenderZBuffer</a></td></tr> + +</table> +<hr><h2>Member Typedef Documentation</h2> +<a class="anchor" name="NL3D_1_1CZoneLightery0" doxytag="NL3D::CZoneLighter::TShapeVect" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> typedef std::vector<<a class="el" href="a03748.html">CShapeInfo</a>> <a class="el" href="a03739.html#NL3D_1_1CZoneLightery0">NL3D::CZoneLighter::TShapeVect</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +A vector of lightable shapes. +<p> + +<p> +Definition at line <a class="el" href="a06769.html#l00403">403</a> of file <a class="el" href="a06769.html">zone_lighter.h</a>. +<p> +Referenced by <a class="el" href="a06768.html#l00680">NL3D::CCalcLightableShapeRunnable::CCalcLightableShapeRunnable()</a>, and <a class="el" href="a06768.html#l02836">processLightableShapeCalc()</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneLightery1" doxytag="NL3D::CZoneLighter::TWaterShapeQuadGrid" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> typedef <a class="el" href="a03273.html">CQuadGrid</a><<a class="el" href="a03724.html">CWaterShape</a> *> <a class="el" href="a03273.html">NL3D::CZoneLighter::TWaterShapeQuadGrid</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06769.html#l00605">605</a> of file <a class="el" href="a06769.html">zone_lighter.h</a>. </td> + </tr> +</table> +<hr><h2>Constructor & Destructor Documentation</h2> +<a class="anchor" name="NL3D_1_1CZoneLightera5" doxytag="NL3D::CZoneLighter::CZoneLighter" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> CZoneLighter::CZoneLighter </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06768.html#l00245">245</a> of file <a class="el" href="a06768.html">zone_lighter.cpp</a>. +<p> +<div class="fragment"><pre>00245 : <a class="code" href="a03739.html#NL3D_1_1CZoneLighterr24">_PatchComputed</a> (<span class="stringliteral">"PatchComputed"</span>) +00246 { +00247 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneLightera9" doxytag="NL3D::CZoneLighter::~CZoneLighter" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> virtual NL3D::CZoneLighter::~<a class="el" href="a03739.html">CZoneLighter</a> </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [inline, virtual]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06769.html#l00070">70</a> of file <a class="el" href="a06769.html">zone_lighter.h</a>. +<p> +<div class="fragment"><pre>00070 {} +</pre></div> </td> + </tr> +</table> +<hr><h2>Member Function Documentation</h2> +<a class="anchor" name="NL3D_1_1CZoneLightera0" doxytag="NL3D::CZoneLighter::addLightableShape" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void CZoneLighter::addLightableShape </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a02539.html">IShape</a> * </td> + <td class="mdname" nowrap> <em>shape</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const <a class="el" href="a02851.html">NLMISC::CMatrix</a> & </td> + <td class="mdname" nowrap> <em>modelMT</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Some shape (water shapes for now) can be lit. This add such a shape to the process of lighting. <dl compact><dt><b>See also:</b></dt><dd><a class="el" href="a03739.html#NL3D_1_1CZoneLightere0">isLightableShape()</a></dd></dl> + +<p> +Definition at line <a class="el" href="a06768.html#l02773">2773</a> of file <a class="el" href="a06768.html">zone_lighter.cpp</a>. +<p> +References <a class="el" href="a06769.html#l00598">_LightableShapes</a>, <a class="el" href="a06769.html#l00400">NL3D::CZoneLighter::CShapeInfo::MT</a>, and <a class="el" href="a06769.html#l00399">NL3D::CZoneLighter::CShapeInfo::Shape</a>. +<p> +<div class="fragment"><pre>02774 { +02775 CShapeInfo lsi; +02776 lsi.MT = MT; +02777 lsi.Shape = shape; +02778 <a class="code" href="a03739.html#NL3D_1_1CZoneLighterr16">_LightableShapes</a>.push_back(lsi); +02779 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneLighterz1201_0" doxytag="NL3D::CZoneLighter::addStaticPointLight" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void CZoneLighter::addStaticPointLight </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const <a class="el" href="a03094.html">CPointLightNamed</a> & </td> + <td class="mdname1" valign="top" nowrap> <em>pln</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Append a static point light to compute. call at setup stage (before <a class="el" href="a03739.html#NL3D_1_1CZoneLightera7">light()</a> ). +<p> + +<p> +Definition at line <a class="el" href="a06768.html#l03179">3179</a> of file <a class="el" href="a06768.html">zone_lighter.cpp</a>. +<p> +References <a class="el" href="a06769.html#l00536">NL3D::CZoneLighter::CPointLightRT::BSphere</a>, <a class="el" href="a05505.html#l00048">NLMISC::CBSphere::Center</a>, <a class="el" href="a06180.html#l00141">NL3D::CPointLight::getAttenuationBegin()</a>, <a class="el" href="a06180.html#l00143">NL3D::CPointLight::getAttenuationEnd()</a>, <a class="el" href="a06180.html#l00116">NL3D::CPointLight::getPosition()</a>, <a class="el" href="a06769.html#l00534">NL3D::CZoneLighter::CPointLightRT::OODeltaAttenuation</a>, <a class="el" href="a06769.html#l00533">NL3D::CZoneLighter::CPointLightRT::PointLight</a>, and <a class="el" href="a05505.html#l00049">NLMISC::CBSphere::Radius</a>. +<p> +<div class="fragment"><pre>03180 { +03181 <span class="comment">// build the plRT.</span> +03182 CPointLightRT plRT; +03183 plRT.PointLight= pln; +03184 <span class="comment">// compute plRT.OODeltaAttenuation</span> +03185 plRT.OODeltaAttenuation= pln.getAttenuationEnd() - pln.getAttenuationBegin(); +03186 <span class="keywordflow">if</span>(plRT.OODeltaAttenuation <=0 ) +03187 plRT.OODeltaAttenuation= 0; +03188 <span class="keywordflow">else</span> +03189 plRT.OODeltaAttenuation= 1.0f / plRT.OODeltaAttenuation; +03190 <span class="comment">// compute plRT.BSphere</span> +03191 plRT.BSphere.Center= pln.getPosition(); +03192 plRT.BSphere.Radius= pln.getAttenuationEnd(); +03193 <span class="comment">// NB: FaceCubeGrid will be computed during light()</span> +03194 +03195 <span class="comment">// add the plRT</span> +03196 <a class="code" href="a03739.html#NL3D_1_1CZoneLighterz1203_3">_StaticPointLights</a>.push_back(plRT); +03197 +03198 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneLighterd0" doxytag="NL3D::CZoneLighter::addTriangles" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void CZoneLighter::addTriangles </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const <a class="el" href="a02858.html">CMeshBase</a> & </td> + <td class="mdname" nowrap> <em>meshBase</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const <a class="el" href="a02892.html">CMeshMRMGeom</a> & </td> + <td class="mdname" nowrap> <em>meshGeom</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const <a class="el" href="a02851.html">CMatrix</a> & </td> + <td class="mdname" nowrap> <em>modelMT</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>std::vector< <a class="el" href="a03750.html">CTriangle</a> > & </td> + <td class="mdname" nowrap> <em>triangleArray</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06768.html#l01887">1887</a> of file <a class="el" href="a06768.html">zone_lighter.cpp</a>. +<p> +References <a class="el" href="a05992.html#l00179">NL3D::CMeshBase::getMaterial()</a>, <a class="el" href="a06006.html#l00192">NL3D::CMeshMRMGeom::getNbRdrPass()</a>, <a class="el" href="a06198.html#l00141">NL3D::CPrimitiveBlock::getNumQuad()</a>, <a class="el" href="a06198.html#l00108">NL3D::CPrimitiveBlock::getNumTri()</a>, <a class="el" href="a06197.html#l00149">NL3D::CPrimitiveBlock::getQuadPointer()</a>, <a class="el" href="a06006.html#l00209">NL3D::CMeshMRMGeom::getRdrPassMaterial()</a>, <a class="el" href="a06006.html#l00199">NL3D::CMeshMRMGeom::getRdrPassPrimitiveBlock()</a>, <a class="el" href="a06710.html#l00497">NL3D::CVertexBuffer::getTexCoordPointer()</a>, <a class="el" href="a06768.html#l01820">getTexture()</a>, <a class="el" href="a06197.html#l00091">NL3D::CPrimitiveBlock::getTriPointer()</a>, <a class="el" href="a06006.html#l00176">NL3D::CMeshMRMGeom::getVertexBuffer()</a>, <a class="el" href="a06710.html#l00438">NL3D::CVertexBuffer::getVertexCoordPointer()</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a05981.html#l00100">uint32</a>, <a class="el" href="a05981.html#l00096">uint8</a>, and <a class="el" href="a05646.html#l00237">v</a>. +<p> +<div class="fragment"><pre>01888 { +01889 <span class="comment">// Get the vertex buffer</span> +01890 <span class="keyword">const</span> CVertexBuffer &vb=meshGeom.<a class="code" href="a02892.html#NL3D_1_1CMeshMRMGeomz471_9">getVertexBuffer</a>(); +01891 +01892 <span class="comment">// For each render pass</span> +01893 <a class="code" href="a04558.html#a15">uint</a> numRenderPass=meshGeom.<a class="code" href="a02892.html#NL3D_1_1CMeshMRMGeomz471_5">getNbRdrPass</a>(0); +01894 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a15">uint</a> pass=0; pass<numRenderPass; pass++) +01895 { +01896 <span class="comment">// Get the primitive block</span> +01897 <span class="keyword">const</span> <a class="code" href="a03105.html">CPrimitiveBlock</a> &primitive=meshGeom.<a class="code" href="a02892.html#NL3D_1_1CMeshMRMGeomz471_7">getRdrPassPrimitiveBlock</a> ( 0, pass); +01898 +01899 <span class="comment">// Get the material</span> +01900 <span class="keyword">const</span> CMaterial &material = meshBase.<a class="code" href="a02858.html#NL3D_1_1CMeshMultiLodz431_1">getMaterial</a> (meshGeom.<a class="code" href="a02892.html#NL3D_1_1CMeshMRMGeomz471_6">getRdrPassMaterial</a> (0, pass)); +01901 +01902 <span class="comment">// ** Get the bitmap</span> +01903 +01904 <span class="comment">// Texture informations, not NULL only if texture is used for alpha test</span> +01905 <a class="code" href="a02268.html">CBitmap</a> *texture; +01906 <span class="keywordtype">bool</span> clampU; +01907 <span class="keywordtype">bool</span> clampV; +01908 <a class="code" href="a04558.html#a7">uint8</a> alphaTestThreshold; +01909 <span class="keywordtype">bool</span> doubleSided; +01910 <span class="keywordflow">if</span> (<a class="code" href="a03739.html#NL3D_1_1CZoneLighterd11">getTexture</a> (material, texture, clampU, clampV, alphaTestThreshold, doubleSided)) +01911 { +01912 <span class="comment">// Dump triangles</span> +01913 <span class="keyword">const</span> <a class="code" href="a04558.html#a11">uint32</a>* triIndex=primitive.<a class="code" href="a03105.html#NL3D_1_1CPrimitiveBlocka16">getTriPointer</a> (); +01914 <a class="code" href="a04558.html#a15">uint</a> numTri=primitive.<a class="code" href="a03105.html#NL3D_1_1CPrimitiveBlocka11">getNumTri</a> (); +01915 <a class="code" href="a04558.html#a15">uint</a> tri; +01916 <span class="keywordflow">for</span> (tri=0; tri<numTri; tri++) +01917 { +01918 <span class="comment">// Vertex</span> +01919 CVector v0=modelMT*(*(CVector*)vb.getVertexCoordPointer (triIndex[tri*3])); +01920 CVector v1=modelMT*(*(CVector*)vb.getVertexCoordPointer (triIndex[tri*3+1])); +01921 CVector v2=modelMT*(*(CVector*)vb.getVertexCoordPointer (triIndex[tri*3+2])); +01922 +01923 <span class="comment">// UV</span> +01924 <span class="keywordtype">float</span> u[3]; +01925 <span class="keywordtype">float</span> <a class="code" href="a04223.html#a576">v</a>[3]; +01926 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a15">uint</a> i=0; i<3; i++) +01927 { +01928 <span class="comment">// Get UV coordinates</span> +01929 <span class="keywordtype">float</span> *uv = (<span class="keywordtype">float</span>*)vb.getTexCoordPointer (triIndex[tri*3+i], 0); +01930 <span class="keywordflow">if</span> (uv) +01931 { +01932 <span class="comment">// Copy it</span> +01933 u[i] = uv[0]; +01934 <a class="code" href="a04223.html#a576">v</a>[i] = uv[1]; +01935 } +01936 } +01937 +01938 <span class="comment">// Make a triangle</span> +01939 triangleArray.push_back (CTriangle (<a class="code" href="a03616.html">NLMISC::CTriangle</a> (v0, v1, v2), doubleSided, texture, clampU, clampV, u, v, +01940 alphaTestThreshold)); +01941 } +01942 +01943 <span class="comment">// Dump quad</span> +01944 triIndex=primitive.<a class="code" href="a03105.html#NL3D_1_1CPrimitiveBlocka14">getQuadPointer</a> (); +01945 numTri=primitive.<a class="code" href="a03105.html#NL3D_1_1CPrimitiveBlocka10">getNumQuad</a> (); +01946 <span class="keywordflow">for</span> (tri=0; tri<numTri; tri++) +01947 { +01948 <span class="comment">// Vertex</span> +01949 CVector v0=modelMT*(*(CVector*)vb.getVertexCoordPointer (triIndex[tri*4])); +01950 CVector v1=modelMT*(*(CVector*)vb.getVertexCoordPointer (triIndex[tri*4+1])); +01951 CVector v2=modelMT*(*(CVector*)vb.getVertexCoordPointer (triIndex[tri*4+2])); +01952 CVector v3=modelMT*(*(CVector*)vb.getVertexCoordPointer (triIndex[tri*4+3])); +01953 +01954 <span class="comment">// UV</span> +01955 <span class="keywordtype">float</span> u[4]; +01956 <span class="keywordtype">float</span> <a class="code" href="a04223.html#a576">v</a>[4]; +01957 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a15">uint</a> i=0; i<4; i++) +01958 { +01959 <span class="comment">// Get UV coordinates</span> +01960 <span class="keywordtype">float</span> *uv = (<span class="keywordtype">float</span>*)vb.getTexCoordPointer (triIndex[tri*4+i], 0); +01961 <span class="keywordflow">if</span> (uv) +01962 { +01963 <span class="comment">// Copy it</span> +01964 u[i] = uv[0]; +01965 <a class="code" href="a04223.html#a576">v</a>[i] = uv[1]; +01966 } +01967 } +01968 +01969 <span class="comment">// Make 2 triangles</span> +01970 triangleArray.push_back (CTriangle (<a class="code" href="a03616.html">NLMISC::CTriangle</a> (v0, v1, v2), doubleSided, texture, clampU, clampV, u, v, +01971 alphaTestThreshold)); +01972 u[1] = u[2]; +01973 u[2] = u[3]; +01974 <a class="code" href="a04223.html#a576">v</a>[1] = <a class="code" href="a04223.html#a576">v</a>[2]; +01975 <a class="code" href="a04223.html#a576">v</a>[2] = <a class="code" href="a04223.html#a576">v</a>[3]; +01976 triangleArray.push_back (CTriangle (<a class="code" href="a03616.html">NLMISC::CTriangle</a> (v0, v2, v3), doubleSided, texture, clampU, clampV, u, v, +01977 alphaTestThreshold)); +01978 } +01979 } +01980 } +01981 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneLighterd1" doxytag="NL3D::CZoneLighter::addTriangles" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void CZoneLighter::addTriangles </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const <a class="el" href="a02858.html">CMeshBase</a> & </td> + <td class="mdname" nowrap> <em>meshBase</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const <a class="el" href="a02878.html">CMeshGeom</a> & </td> + <td class="mdname" nowrap> <em>meshGeom</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const <a class="el" href="a02851.html">NLMISC::CMatrix</a> & </td> + <td class="mdname" nowrap> <em>modelMT</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>std::vector< <a class="el" href="a03750.html">CTriangle</a> > & </td> + <td class="mdname" nowrap> <em>triangleArray</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06768.html#l01717">1717</a> of file <a class="el" href="a06768.html">zone_lighter.cpp</a>. +<p> +References <a class="el" href="a05992.html#l00179">NL3D::CMeshBase::getMaterial()</a>, <a class="el" href="a05990.html#l00393">NL3D::CMeshGeom::getNbMatrixBlock()</a>, <a class="el" href="a05990.html#l00398">NL3D::CMeshGeom::getNbRdrPass()</a>, <a class="el" href="a06198.html#l00141">NL3D::CPrimitiveBlock::getNumQuad()</a>, <a class="el" href="a06198.html#l00108">NL3D::CPrimitiveBlock::getNumTri()</a>, <a class="el" href="a06197.html#l00149">NL3D::CPrimitiveBlock::getQuadPointer()</a>, <a class="el" href="a05990.html#l00413">NL3D::CMeshGeom::getRdrPassMaterial()</a>, <a class="el" href="a05990.html#l00404">NL3D::CMeshGeom::getRdrPassPrimitiveBlock()</a>, <a class="el" href="a06710.html#l00497">NL3D::CVertexBuffer::getTexCoordPointer()</a>, <a class="el" href="a06768.html#l01820">getTexture()</a>, <a class="el" href="a06197.html#l00091">NL3D::CPrimitiveBlock::getTriPointer()</a>, <a class="el" href="a05990.html#l00390">NL3D::CMeshGeom::getVertexBuffer()</a>, <a class="el" href="a06710.html#l00438">NL3D::CVertexBuffer::getVertexCoordPointer()</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a05981.html#l00100">uint32</a>, <a class="el" href="a05981.html#l00096">uint8</a>, and <a class="el" href="a05646.html#l00237">v</a>. +<p> +<div class="fragment"><pre>01718 { +01719 <span class="comment">// Get the vertex buffer</span> +01720 <span class="keyword">const</span> CVertexBuffer &vb=meshGeom.<a class="code" href="a02878.html#NL3D_1_1CMeshGeomz413_6">getVertexBuffer</a>(); +01721 +01722 <span class="comment">// For each matrix block</span> +01723 <a class="code" href="a04558.html#a15">uint</a> numBlock=meshGeom.<a class="code" href="a02878.html#NL3D_1_1CMeshGeomz413_2">getNbMatrixBlock</a>(); +01724 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a15">uint</a> block=0; block<numBlock; block++) +01725 { +01726 <span class="comment">// For each render pass</span> +01727 <a class="code" href="a04558.html#a15">uint</a> numRenderPass=meshGeom.<a class="code" href="a02878.html#NL3D_1_1CMeshGeomz413_3">getNbRdrPass</a>(block); +01728 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a15">uint</a> pass=0; pass<numRenderPass; pass++) +01729 { +01730 <span class="comment">// Get the primitive block</span> +01731 <span class="keyword">const</span> <a class="code" href="a03105.html">CPrimitiveBlock</a> &primitive=meshGeom.<a class="code" href="a02878.html#NL3D_1_1CMeshGeomz413_5">getRdrPassPrimitiveBlock</a> ( block, pass); +01732 +01733 <span class="comment">// Get the material</span> +01734 <span class="keyword">const</span> CMaterial &material = meshBase.<a class="code" href="a02858.html#NL3D_1_1CMeshMultiLodz431_1">getMaterial</a> (meshGeom.<a class="code" href="a02878.html#NL3D_1_1CMeshGeomz413_4">getRdrPassMaterial</a> ( block, pass)); +01735 +01736 <span class="comment">// ** Get the bitmap</span> +01737 +01738 <span class="comment">// Texture informations, not NULL only if texture is used for alpha test</span> +01739 <a class="code" href="a02268.html">CBitmap</a> *texture; +01740 <span class="keywordtype">bool</span> clampU; +01741 <span class="keywordtype">bool</span> clampV; +01742 <a class="code" href="a04558.html#a7">uint8</a> alphaTestThreshold; +01743 <span class="keywordtype">bool</span> doubleSided; +01744 <span class="keywordflow">if</span> (<a class="code" href="a03739.html#NL3D_1_1CZoneLighterd11">getTexture</a> (material, texture, clampU, clampV, alphaTestThreshold, doubleSided)) +01745 { +01746 <span class="comment">// Dump triangles</span> +01747 <span class="keyword">const</span> <a class="code" href="a04558.html#a11">uint32</a>* triIndex=primitive.<a class="code" href="a03105.html#NL3D_1_1CPrimitiveBlocka16">getTriPointer</a> (); +01748 <a class="code" href="a04558.html#a15">uint</a> numTri=primitive.<a class="code" href="a03105.html#NL3D_1_1CPrimitiveBlocka11">getNumTri</a> (); +01749 <a class="code" href="a04558.html#a15">uint</a> tri; +01750 <span class="keywordflow">for</span> (tri=0; tri<numTri; tri++) +01751 { +01752 <span class="comment">// Vertex</span> +01753 CVector v0=modelMT*(*(CVector*)vb.getVertexCoordPointer (triIndex[tri*3])); +01754 CVector v1=modelMT*(*(CVector*)vb.getVertexCoordPointer (triIndex[tri*3+1])); +01755 CVector v2=modelMT*(*(CVector*)vb.getVertexCoordPointer (triIndex[tri*3+2])); +01756 +01757 <span class="comment">// UV</span> +01758 <span class="keywordtype">float</span> u[3]; +01759 <span class="keywordtype">float</span> <a class="code" href="a04223.html#a576">v</a>[3]; +01760 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a15">uint</a> i=0; i<3; i++) +01761 { +01762 <span class="comment">// Get UV coordinates</span> +01763 <span class="keywordtype">float</span> *uv = (<span class="keywordtype">float</span>*)vb.getTexCoordPointer (triIndex[tri*3+i], 0); +01764 <span class="keywordflow">if</span> (uv) +01765 { +01766 <span class="comment">// Copy it</span> +01767 u[i] = uv[0]; +01768 <a class="code" href="a04223.html#a576">v</a>[i] = uv[1]; +01769 } +01770 } +01771 +01772 <span class="comment">// Make a triangle</span> +01773 triangleArray.push_back (CTriangle (<a class="code" href="a03616.html">NLMISC::CTriangle</a> (v0, v1, v2), doubleSided, texture, clampU, clampV, u, v, +01774 alphaTestThreshold)); +01775 } +01776 +01777 <span class="comment">// Dump quad</span> +01778 triIndex=primitive.<a class="code" href="a03105.html#NL3D_1_1CPrimitiveBlocka14">getQuadPointer</a> (); +01779 numTri=primitive.<a class="code" href="a03105.html#NL3D_1_1CPrimitiveBlocka10">getNumQuad</a> (); +01780 <span class="keywordflow">for</span> (tri=0; tri<numTri; tri++) +01781 { +01782 <span class="comment">// Vertex</span> +01783 CVector v0=modelMT*(*(CVector*)vb.getVertexCoordPointer (triIndex[tri*4])); +01784 CVector v1=modelMT*(*(CVector*)vb.getVertexCoordPointer (triIndex[tri*4+1])); +01785 CVector v2=modelMT*(*(CVector*)vb.getVertexCoordPointer (triIndex[tri*4+2])); +01786 CVector v3=modelMT*(*(CVector*)vb.getVertexCoordPointer (triIndex[tri*4+3])); +01787 +01788 <span class="comment">// UV</span> +01789 <span class="keywordtype">float</span> u[4]; +01790 <span class="keywordtype">float</span> <a class="code" href="a04223.html#a576">v</a>[4]; +01791 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a15">uint</a> i=0; i<4; i++) +01792 { +01793 <span class="comment">// Get UV coordinates</span> +01794 <span class="keywordtype">float</span> *uv = (<span class="keywordtype">float</span>*)vb.getTexCoordPointer (triIndex[tri*4+i], 0); +01795 <span class="keywordflow">if</span> (uv) +01796 { +01797 <span class="comment">// Copy it</span> +01798 u[i] = uv[0]; +01799 <a class="code" href="a04223.html#a576">v</a>[i] = uv[1]; +01800 } +01801 } +01802 +01803 <span class="comment">// Make 2 triangles</span> +01804 triangleArray.push_back (CTriangle (<a class="code" href="a03616.html">NLMISC::CTriangle</a> (v0, v1, v2), doubleSided, texture, clampU, clampV, u, v, +01805 alphaTestThreshold)); +01806 u[1] = u[2]; +01807 u[2] = u[3]; +01808 <a class="code" href="a04223.html#a576">v</a>[1] = <a class="code" href="a04223.html#a576">v</a>[2]; +01809 <a class="code" href="a04223.html#a576">v</a>[2] = <a class="code" href="a04223.html#a576">v</a>[3]; +01810 triangleArray.push_back (CTriangle (<a class="code" href="a03616.html">NLMISC::CTriangle</a> (v0, v2, v3), doubleSided, texture, clampU, clampV, u, v, +01811 alphaTestThreshold)); +01812 } +01813 } +01814 } +01815 } +01816 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneLightera1" doxytag="NL3D::CZoneLighter::addTriangles" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void CZoneLighter::addTriangles </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const <a class="el" href="a02539.html">IShape</a> & </td> + <td class="mdname" nowrap> <em>shape</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const <a class="el" href="a02851.html">NLMISC::CMatrix</a> & </td> + <td class="mdname" nowrap> <em>modelMT</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>std::vector< <a class="el" href="a03750.html">CTriangle</a> > & </td> + <td class="mdname" nowrap> <em>triangleArray</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06768.html#l01670">1670</a> of file <a class="el" href="a06768.html">zone_lighter.cpp</a>. +<p> +References <a class="el" href="a06768.html#l01613">addTriangles()</a>, <a class="el" href="a06005.html#l02992">NL3D::CMeshMRM::getMeshGeom()</a>, <a class="el" href="a06016.html#l00599">NL3D::CMeshMultiLod::getMeshGeom()</a>, and <a class="el" href="a05989.html#l02463">NL3D::CMesh::getMeshGeom()</a>. +<p> +<div class="fragment"><pre>01671 { +01672 <span class="comment">// Cast to CMesh</span> +01673 <span class="keyword">const</span> <a class="code" href="a02857.html">CMesh</a> *mesh=dynamic_cast<const CMesh*>(&shape); +01674 +01675 <span class="comment">// Cast to CMeshMultiLod</span> +01676 <span class="keyword">const</span> <a class="code" href="a02910.html">CMeshMultiLod</a> *meshMulti=dynamic_cast<const CMeshMultiLod*>(&shape); +01677 +01678 <span class="comment">// Cast to CMeshMultiLod</span> +01679 <span class="keyword">const</span> <a class="code" href="a02891.html">CMeshMRM</a> *meshMRM=dynamic_cast<const CMeshMRM*>(&shape); +01680 +01681 <span class="comment">// It is a mesh ?</span> +01682 <span class="keywordflow">if</span> (mesh) +01683 { +01684 <span class="comment">// Add its triangles</span> +01685 <a class="code" href="a03739.html#NL3D_1_1CZoneLightera2">addTriangles</a> (*mesh, mesh-><a class="code" href="a02857.html#NL3D_1_1CMeshz407_1">getMeshGeom</a> (), modelMT, triangleArray); +01686 } +01687 <span class="comment">// It is a CMeshMultiLod ?</span> +01688 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (meshMulti) +01689 { +01690 <span class="comment">// Get the first geommesh</span> +01691 <span class="keyword">const</span> IMeshGeom *meshGeom=&meshMulti-><a class="code" href="a02910.html#NL3D_1_1CMeshMultiLoda4">getMeshGeom</a> (0); +01692 +01693 <span class="comment">// Dynamic cast</span> +01694 <span class="keyword">const</span> <a class="code" href="a02878.html">CMeshGeom</a> *geomMesh=dynamic_cast<const CMeshGeom*>(meshGeom); +01695 <span class="keywordflow">if</span> (geomMesh) +01696 { +01697 <a class="code" href="a03739.html#NL3D_1_1CZoneLightera2">addTriangles</a> (*meshMulti, *geomMesh, modelMT, triangleArray); +01698 } +01699 +01700 <span class="comment">// Dynamic cast</span> +01701 <span class="keyword">const</span> <a class="code" href="a02892.html">CMeshMRMGeom</a> *mrmGeomMesh=dynamic_cast<const CMeshMRMGeom*>(meshGeom); +01702 <span class="keywordflow">if</span> (mrmGeomMesh) +01703 { +01704 <a class="code" href="a03739.html#NL3D_1_1CZoneLightera2">addTriangles</a> (*meshMulti, *mrmGeomMesh, modelMT, triangleArray); +01705 } +01706 } +01707 <span class="comment">// It is a CMeshMultiLod ?</span> +01708 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (meshMRM) +01709 { +01710 <span class="comment">// Get the first lod mesh geom</span> +01711 <a class="code" href="a03739.html#NL3D_1_1CZoneLightera2">addTriangles</a> (*meshMRM, meshMRM-><a class="code" href="a02891.html#NL3D_1_1CMeshMRMz495_1">getMeshGeom</a> (), modelMT, triangleArray); +01712 } +01713 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneLightera2" doxytag="NL3D::CZoneLighter::addTriangles" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void CZoneLighter::addTriangles </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a02702.html">CLandscape</a> & </td> + <td class="mdname" nowrap> <em>landscape</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>std::vector< <a class="el" href="a04558.html#a15">uint</a> > & </td> + <td class="mdname" nowrap> <em>listZone</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a15">uint</a> </td> + <td class="mdname" nowrap> <em>order</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>std::vector< <a class="el" href="a03750.html">CTriangle</a> > & </td> + <td class="mdname" nowrap> <em>triangleArray</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06768.html#l01613">1613</a> of file <a class="el" href="a06768.html">zone_lighter.cpp</a>. +<p> +References <a class="el" href="a06498.html#l00102">NL3D::CTessVertex::EndPos</a>, <a class="el" href="a06768.html#l01985">excludeAllPatchFromRefineAll()</a>, <a class="el" href="a06498.html#l00080">NL3D::CParamCoord::getS()</a>, <a class="el" href="a06498.html#l00081">NL3D::CParamCoord::getT()</a>, <a class="el" href="a05862.html#l02899">NL3D::CLandscape::getTessellationLeaves()</a>, <a class="el" href="a05484.html#l00038">min</a>, <a class="el" href="a06498.html#l00245">NL3D::CTessFace::PVBase</a>, <a class="el" href="a06498.html#l00245">NL3D::CTessFace::PVLeft</a>, <a class="el" href="a06498.html#l00245">NL3D::CTessFace::PVRight</a>, <a class="el" href="a05862.html#l00737">NL3D::CLandscape::refineAll()</a>, <a class="el" href="a05862.html#l00318">NL3D::CLandscape::setThreshold()</a>, <a class="el" href="a05862.html#l00344">NL3D::CLandscape::setTileMaxSubdivision()</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a06498.html#l00241">NL3D::CTessFace::VBase</a>, <a class="el" href="a06498.html#l00241">NL3D::CTessFace::VLeft</a>, and <a class="el" href="a06498.html#l00241">NL3D::CTessFace::VRight</a>. +<p> +Referenced by <a class="el" href="a06768.html#l01670">addTriangles()</a>. +<p> +<div class="fragment"><pre>01614 { +01615 <span class="comment">// Set all to refine</span> +01616 <a class="code" href="a03739.html#NL3D_1_1CZoneLighterd5">excludeAllPatchFromRefineAll</a> (landscape, listZone, <span class="keyword">false</span>); +01617 +01618 <span class="comment">// Setup the landscape</span> +01619 landscape.setThreshold (0); +01620 landscape.setTileMaxSubdivision (order); +01621 +01622 <span class="comment">// Refine it</span> +01623 landscape.refineAll (CVector (0, 0, 0)); +01624 +01625 <span class="comment">// Dump tesselated triangles</span> +01626 std::vector<const CTessFace*> leaves; +01627 landscape.getTessellationLeaves(leaves); +01628 +01629 <span class="comment">// Number of leaves</span> +01630 <a class="code" href="a04558.html#a15">uint</a> leavesCount=leaves.size(); +01631 +01632 <span class="comment">// Reserve the array</span> +01633 triangleArray.reserve (triangleArray.size()+leavesCount); +01634 +01635 <span class="comment">// Scan each leaves</span> +01636 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a15">uint</a> leave=0; leave<leavesCount; leave++) +01637 { +01638 <span class="comment">// Leave</span> +01639 <span class="keyword">const</span> <a class="code" href="a03476.html">CTessFace</a> *face=leaves[leave]; +01640 +01641 <span class="comment">// Start and end coordinate</span> +01642 <span class="keywordtype">float</span> startS=<a class="code" href="a04061.html#a0">min</a> (min (face-><a class="code" href="a03476.html#NL3D_1_1CTessFacez968_6">PVBase</a>.<a class="code" href="a03040.html#NL3D_1_1CParamCoorda3">getS</a>(), face-><a class="code" href="a03476.html#NL3D_1_1CTessFacez968_7">PVLeft</a>.<a class="code" href="a03040.html#NL3D_1_1CParamCoorda3">getS</a>()), face-><a class="code" href="a03476.html#NL3D_1_1CTessFacez968_8">PVRight</a>.<a class="code" href="a03040.html#NL3D_1_1CParamCoorda3">getS</a>()); +01643 <span class="keywordtype">float</span> endS=max (max (face-><a class="code" href="a03476.html#NL3D_1_1CTessFacez968_6">PVBase</a>.<a class="code" href="a03040.html#NL3D_1_1CParamCoorda3">getS</a>(), face-><a class="code" href="a03476.html#NL3D_1_1CTessFacez968_7">PVLeft</a>.<a class="code" href="a03040.html#NL3D_1_1CParamCoorda3">getS</a>()), face-><a class="code" href="a03476.html#NL3D_1_1CTessFacez968_8">PVRight</a>.<a class="code" href="a03040.html#NL3D_1_1CParamCoorda3">getS</a>()); +01644 <span class="keywordtype">float</span> startT=<a class="code" href="a04061.html#a0">min</a> (min (face-><a class="code" href="a03476.html#NL3D_1_1CTessFacez968_6">PVBase</a>.<a class="code" href="a03040.html#NL3D_1_1CParamCoorda4">getT</a>(), face-><a class="code" href="a03476.html#NL3D_1_1CTessFacez968_7">PVLeft</a>.<a class="code" href="a03040.html#NL3D_1_1CParamCoorda4">getT</a>()), face-><a class="code" href="a03476.html#NL3D_1_1CTessFacez968_8">PVRight</a>.<a class="code" href="a03040.html#NL3D_1_1CParamCoorda4">getT</a>()); +01645 <span class="keywordtype">float</span> endT=max (max (face-><a class="code" href="a03476.html#NL3D_1_1CTessFacez968_6">PVBase</a>.<a class="code" href="a03040.html#NL3D_1_1CParamCoorda4">getT</a>(), face-><a class="code" href="a03476.html#NL3D_1_1CTessFacez968_7">PVLeft</a>.<a class="code" href="a03040.html#NL3D_1_1CParamCoorda4">getT</a>()), face-><a class="code" href="a03476.html#NL3D_1_1CTessFacez968_8">PVRight</a>.<a class="code" href="a03040.html#NL3D_1_1CParamCoorda4">getT</a>()); +01646 +01647 <span class="comment">// Add a triangle</span> +01648 triangleArray.push_back (CTriangle (<a class="code" href="a03616.html">NLMISC::CTriangle</a> (face-><a class="code" href="a03476.html#NL3D_1_1CTessFacez968_13">VBase</a>->EndPos, face-><a class="code" href="a03476.html#NL3D_1_1CTessFacez968_14">VLeft</a>->EndPos, face-><a class="code" href="a03476.html#NL3D_1_1CTessFacez968_15">VRight</a>->EndPos))); +01649 } +01650 +01651 <span class="comment">// Setup the landscape</span> +01652 landscape.setThreshold (1000); +01653 landscape.setTileMaxSubdivision (0); +01654 +01655 <span class="comment">// Remove all triangles</span> +01656 landscape.refineAll (CVector (0, 0, 0)); +01657 landscape.refineAll (CVector (0, 0, 0)); +01658 landscape.refineAll (CVector (0, 0, 0)); +01659 landscape.refineAll (CVector (0, 0, 0)); +01660 landscape.refineAll (CVector (0, 0, 0)); +01661 landscape.refineAll (CVector (0, 0, 0)); +01662 landscape.refineAll (CVector (0, 0, 0)); +01663 landscape.refineAll (CVector (0, 0, 0)); +01664 landscape.refineAll (CVector (0, 0, 0)); +01665 landscape.refineAll (CVector (0, 0, 0)); +01666 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneLightera3" doxytag="NL3D::CZoneLighter::addWaterShape" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void CZoneLighter::addWaterShape </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a03724.html">CWaterShape</a> * </td> + <td class="mdname" nowrap> <em>shape</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const <a class="el" href="a02851.html">NLMISC::CMatrix</a> & </td> + <td class="mdname" nowrap> <em>MT</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Add a water shape. This is needed to decide wether tiles are above / below water. +<p> +make sure it hasn't been inserted twice +<p> +Definition at line <a class="el" href="a06768.html#l03057">3057</a> of file <a class="el" href="a06768.html">zone_lighter.cpp</a>. +<p> +References <a class="el" href="a06769.html#l00400">NL3D::CZoneLighter::CShapeInfo::MT</a>, and <a class="el" href="a06769.html#l00399">NL3D::CZoneLighter::CShapeInfo::Shape</a>. +<p> +<div class="fragment"><pre>03058 { +03060 CShapeInfo ci; +03061 ci.Shape = shape; +03062 ci.MT = MT; +03063 <a class="code" href="a03739.html#NL3D_1_1CZoneLighterr36">_WaterShapes</a>.push_back(ci); +03064 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneLightera4" doxytag="NL3D::CZoneLighter::attenuation" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> float CZoneLighter::attenuation </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const <a class="el" href="a03128.html">CVector</a> & </td> + <td class="mdname" nowrap> <em>pos</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const <a class="el" href="a03741.html">CZoneLighter::CLightDesc</a> & </td> + <td class="mdname" nowrap> <em>description</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06768.html#l03767">3767</a> of file <a class="el" href="a06768.html">zone_lighter.cpp</a>. +<p> +References <a class="el" href="a06769.html#l00491">_Random</a>, <a class="el" href="a06769.html#l00483">_ZBufferLandscape</a>, <a class="el" href="a06769.html#l00484">_ZBufferObject</a>, <a class="el" href="a06769.html#l00488">_ZBufferOverflow</a>, <a class="el" href="a06769.html#l00278">NL3D::CZoneLighter::CZBuffer::LocalZBufferXMin</a>, <a class="el" href="a06769.html#l00280">NL3D::CZoneLighter::CZBuffer::LocalZBufferYMin</a>, <a class="el" href="a05484.html#l00038">min</a>, <a class="el" href="a06312.html#l00070">NLMISC::CRandom::rand()</a>, <a class="el" href="a03302.html#NLMISC_1_1CRandomw0NLMISC_1_1CRandomw1">NLMISC::CRandom::RandMax</a>, <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a06769.html#l00131">NL3D::CZoneLighter::CLightDesc::SoftShadowJitter</a>, <a class="el" href="a06769.html#l00128">NL3D::CZoneLighter::CLightDesc::SoftShadowSamplesSqrt</a>, <a class="el" href="a06768.html#l00201">testZPercentageCloserFilter()</a>, <a class="el" href="a06768.html#l00170">transformVectorToZBuffer()</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a06673.html#l00051">NLMISC::CVector::x</a>, <a class="el" href="a05646.html#l00236">x</a>, <a class="el" href="a06673.html#l00051">NLMISC::CVector::y</a>, <a class="el" href="a05646.html#l00236">y</a>, and <a class="el" href="a06673.html#l00051">NLMISC::CVector::z</a>. +<p> +Referenced by <a class="el" href="a06768.html#l02927">lightWater()</a>, and <a class="el" href="a06768.html#l01293">processCalc()</a>. +<p> +<div class="fragment"><pre>03768 { +03769 <span class="comment">// Clipped ?</span> +03770 +03771 <span class="comment">// *** Landscape attenuation</span> +03772 +03773 <span class="comment">// Current value</span> +03774 <span class="keywordtype">float</span> averageAttenuation = 0; +03775 <span class="keywordtype">float</span> randomSum = 0; +03776 +03777 <span class="comment">// For each sample</span> +03778 <a class="code" href="a04558.html#a15">uint</a> sample; +03779 <span class="keyword">const</span> <a class="code" href="a04558.html#a15">uint</a> samples = description.<a class="code" href="a03741.html#NL3D_1_1CZoneLighter_1_1CLightDescz1206_6">SoftShadowSamplesSqrt</a>*description.<a class="code" href="a03741.html#NL3D_1_1CZoneLighter_1_1CLightDescz1206_6">SoftShadowSamplesSqrt</a>; +03780 <span class="keywordflow">for</span> (sample=0; sample<samples; sample++) +03781 { +03782 <span class="comment">// The zbuffer</span> +03783 CZBuffer &zbuffer = <a class="code" href="a03739.html#NL3D_1_1CZoneLightero0">_ZBufferLandscape</a>[sample]; +03784 +03785 <span class="comment">// Get position in z buffer</span> +03786 CVector zPos; +03787 <a class="code" href="a05345.html#a23">transformVectorToZBuffer</a> (zbuffer, pos, zPos); +03788 +03789 <a class="code" href="a04558.html#a14">sint</a> <a class="code" href="a04223.html#a572">x</a> = (<a class="code" href="a04558.html#a14">sint</a>)floor (zPos.x); +03790 <a class="code" href="a04558.html#a14">sint</a> <a class="code" href="a04223.html#a573">y</a> = (<a class="code" href="a04558.html#a14">sint</a>)floor (zPos.y); +03791 +03792 <span class="comment">// Get the z</span> +03793 <span class="keywordtype">float</span> random = (<span class="keywordtype">float</span>)<a class="code" href="a03739.html#NL3D_1_1CZoneLighterr29">_Random</a>.<a class="code" href="a03302.html#NLMISC_1_1CRandoma4">rand</a> () * description.<a class="code" href="a03741.html#NL3D_1_1CZoneLighter_1_1CLightDescz1206_5">SoftShadowJitter</a> + <a class="code" href="a03739.html#NL3D_1_1CZoneLighterr29">_Random</a>.<a class="code" href="a03302.html#NLMISC_1_1CRandomw0NLMISC_1_1CRandomw1">RandMax</a> * (1.f - description.<a class="code" href="a03741.html#NL3D_1_1CZoneLighter_1_1CLightDescz1206_5">SoftShadowJitter</a>); +03794 averageAttenuation += random * <a class="code" href="a05345.html#a24">testZPercentageCloserFilter</a> (zPos.x-(<span class="keywordtype">float</span>)zbuffer.LocalZBufferXMin, zPos.y-(<span class="keywordtype">float</span>)zbuffer.LocalZBufferYMin, zPos.z, zbuffer, description, _ZBufferOverflow); +03795 randomSum += random; +03796 } +03797 +03798 <span class="comment">// Average landscape attenuation</span> +03799 averageAttenuation /= randomSum; +03800 +03801 +03802 +03803 <span class="comment">// *** Attenuation in the object zbuffer</span> +03804 +03805 <span class="comment">// Get position in z buffer</span> +03806 CVector zPos; +03807 <a class="code" href="a05345.html#a23">transformVectorToZBuffer</a> (_ZBufferObject, pos, zPos); +03808 +03809 <span class="keyword">const</span> <a class="code" href="a04558.html#a14">sint</a> <a class="code" href="a04223.html#a572">x</a> = (<a class="code" href="a04558.html#a14">sint</a>)floor (zPos.x); +03810 <span class="keyword">const</span> <a class="code" href="a04558.html#a14">sint</a> <a class="code" href="a04223.html#a573">y</a> = (<a class="code" href="a04558.html#a14">sint</a>)floor (zPos.y); +03811 +03812 <span class="keyword">const</span> <span class="keywordtype">float</span> objectAttenuation = <a class="code" href="a05345.html#a24">testZPercentageCloserFilter</a> (zPos.x-(<span class="keywordtype">float</span>)<a class="code" href="a03739.html#NL3D_1_1CZoneLightero1">_ZBufferObject</a>.<a class="code" href="a03751.html#NL3D_1_1CZoneLighter_1_1CZBuffero4">LocalZBufferXMin</a>, zPos.y-(<span class="keywordtype">float</span>)<a class="code" href="a03739.html#NL3D_1_1CZoneLightero1">_ZBufferObject</a>.<a class="code" href="a03751.html#NL3D_1_1CZoneLighter_1_1CZBuffero6">LocalZBufferYMin</a>, zPos.z, _ZBufferObject, description, _ZBufferOverflow); +03813 +03814 +03815 <span class="comment">// *** Return the min of the both</span> +03816 <span class="keywordflow">return</span> <a class="code" href="a04061.html#a0">std::min</a> (objectAttenuation, averageAttenuation); +03817 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneLighterd2" doxytag="NL3D::CZoneLighter::buildZoneInformation" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void CZoneLighter::buildZoneInformation </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a02702.html">CLandscape</a> & </td> + <td class="mdname" nowrap> <em>landscape</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const std::vector< <a class="el" href="a04558.html#a15">uint</a> > & </td> + <td class="mdname" nowrap> <em>listZone</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const <a class="el" href="a03741.html">CLightDesc</a> & </td> + <td class="mdname" nowrap> <em>lightDesc</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +make a quad grid of each water shape <p> +check for each tile if it is above / below water +<p> +Definition at line <a class="el" href="a06768.html#l02045">2045</a> of file <a class="el" href="a06768.html">zone_lighter.cpp</a>. +<p> +References <a class="el" href="a06769.html#l00508">_BezierPatch</a>, <a class="el" href="a06769.html#l00511">_Binded</a>, <a class="el" href="a06769.html#l00510">_BindInfo</a>, <a class="el" href="a06769.html#l00517">_GetNormalNormal</a>, <a class="el" href="a06769.html#l00509">_Locator</a>, <a class="el" href="a06769.html#l00506">_Lumels</a>, <a class="el" href="a06769.html#l00512">_OversampleEdges</a>, <a class="el" href="a06769.html#l00513">_ZoneId</a>, <a class="el" href="a06769.html#l00459">_ZoneToLight</a>, <a class="el" href="a05345.html#a18">BLUR_SIZE</a>, <a class="el" href="a06768.html#l03563">computeTileFlagsForPositionTowardWater()</a>, <a class="el" href="a05646.html#l00240">count</a>, <a class="el" href="a06768.html#l00158">easineasout()</a>, <a class="el" href="a06498.html#l00102">NL3D::CTessVertex::EndPos</a>, <a class="el" href="a05478.html#l00187">NL3D::CBezierPatch::evalNormal()</a>, <a class="el" href="a05862.html#l00760">NL3D::CLandscape::excludePatchFromRefineAll()</a>, <a class="el" href="a05385.html#l00206">NLMISC::CAABBoxExt::getAABBox()</a>, <a class="el" href="a06155.html#l02213">NL3D::CPatch::getBindNeighbor()</a>, <a class="el" href="a06768.html#l01506">getNormal()</a>, <a class="el" href="a06172.html#l00035">NLMISC::CPlane::getNormal()</a>, <a class="el" href="a06760.html#l00489">NL3D::CZone::getNumPatchs()</a>, <a class="el" href="a06156.html#l00392">NL3D::CPatch::getOrderS()</a>, <a class="el" href="a06156.html#l00393">NL3D::CPatch::getOrderT()</a>, <a class="el" href="a06156.html#l00398">NL3D::CPatch::getPatchId()</a>, <a class="el" href="a05586.html#l00358">NLMISC::getPowerOf2()</a>, <a class="el" href="a06498.html#l00080">NL3D::CParamCoord::getS()</a>, <a class="el" href="a06498.html#l00081">NL3D::CParamCoord::getT()</a>, <a class="el" href="a05862.html#l02899">NL3D::CLandscape::getTessellationLeaves()</a>, <a class="el" href="a06156.html#l00391">NL3D::CPatch::getZone()</a>, <a class="el" href="a05862.html#l02206">NL3D::CLandscape::getZone()</a>, <a class="el" href="a06760.html#l00491">NL3D::CZone::getZoneBB()</a>, <a class="el" href="a06760.html#l00488">NL3D::CZone::getZoneId()</a>, <a class="el" href="a05646.html#l00225">index</a>, <a class="el" href="a05586.html#l00371">NLMISC::isPowerOf2()</a>, <a class="el" href="a06170.html#l00036">NLMISC::CPlane::make()</a>, <a class="el" href="a06768.html#l03067">makeQuadGridFromWaterShapes()</a>, <a class="el" href="a06156.html#l00060">NL_LUMEL_BY_TILE</a>, <a class="el" href="a06156.html#l00053">NL_MAX_TILES_BY_PATCH_EDGE</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a06769.html#l00256">NL3D::CZoneLighter::CLumelDescriptor::Normal</a>, <a class="el" href="a06682.html#l00119">NLMISC::CVector::normalize()</a>, <a class="el" href="a06498.html#l00240">NL3D::CTessFace::Patch</a>, <a class="el" href="a06769.html#l00255">NL3D::CZoneLighter::CLumelDescriptor::Position</a>, <a class="el" href="a06769.html#l00342">progress()</a>, <a class="el" href="a06498.html#l00245">NL3D::CTessFace::PVBase</a>, <a class="el" href="a06498.html#l00245">NL3D::CTessFace::PVLeft</a>, <a class="el" href="a06498.html#l00245">NL3D::CTessFace::PVRight</a>, <a class="el" href="a05862.html#l00737">NL3D::CLandscape::refineAll()</a>, <a class="el" href="a05646.html#l00977">s</a>, <a class="el" href="a06769.html#l00257">NL3D::CZoneLighter::CLumelDescriptor::S</a>, <a class="el" href="a06682.html#l00136">NLMISC::CVector::set()</a>, <a class="el" href="a05862.html#l00318">NL3D::CLandscape::setThreshold()</a>, <a class="el" href="a06768.html#l03710">setTileFlagsToDefault()</a>, <a class="el" href="a05862.html#l00344">NL3D::CLandscape::setTileMaxSubdivision()</a>, <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a05646.html#l00985">t</a>, <a class="el" href="a06769.html#l00258">NL3D::CZoneLighter::CLumelDescriptor::T</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a06155.html#l00182">NL3D::CPatch::unpackIntoCache()</a>, <a class="el" href="a05646.html#l01132">value</a>, <a class="el" href="a06498.html#l00241">NL3D::CTessFace::VBase</a>, <a class="el" href="a06498.html#l00241">NL3D::CTessFace::VLeft</a>, and <a class="el" href="a06498.html#l00241">NL3D::CTessFace::VRight</a>. +<p> +Referenced by <a class="el" href="a06768.html#l00920">light()</a>. +<p> +<div class="fragment"><pre>02046 { +02047 <span class="comment">// Bool visit</span> +02048 vector<vector<uint> > visited; +02049 +02050 <span class="comment">// Zone count</span> +02051 <a class="code" href="a04558.html#a15">uint</a> zoneCount=listZone.size(); +02052 +02053 <span class="comment">// Resize arries</span> +02054 <a class="code" href="a03739.html#NL3D_1_1CZoneLighterr17">_Locator</a>.resize (zoneCount); +02055 <a class="code" href="a03739.html#NL3D_1_1CZoneLighterr1">_Binded</a>.resize (zoneCount); +02056 <a class="code" href="a03739.html#NL3D_1_1CZoneLighterr2">_BindInfo</a>.resize (zoneCount); +02057 <a class="code" href="a03739.html#NL3D_1_1CZoneLighterr0">_BezierPatch</a>.resize (zoneCount); +02058 +02059 <span class="comment">// For each zone</span> +02060 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a15">uint</a> zone=0; zone<zoneCount; zone++) +02061 { +02062 <span class="comment">// Get num patches</span> +02063 <a class="code" href="a04558.html#a15">uint</a> patchCount=landscape.getZone(listZone[zone])->getNumPatchs(); +02064 +02065 <span class="comment">// Insert zone id</span> +02066 <a class="code" href="a03739.html#NL3D_1_1CZoneLighterr38">_ZoneId</a>.insert (map<uint, uint>::value_type (listZone[zone], zone)); +02067 +02068 <span class="comment">// This is the zone to light ?</span> +02069 <span class="keywordflow">if</span> (listZone[zone]==<a class="code" href="a03739.html#NL3D_1_1CZoneLighterr39">_ZoneToLight</a>) +02070 { +02071 <span class="comment">// Resize the arraies</span> +02072 <a class="code" href="a03739.html#NL3D_1_1CZoneLighterr18">_Lumels</a>.resize(patchCount); +02073 <span class="comment">// _LumelCorners.resize(patchCount);</span> +02074 <span class="comment">// _BezierPatch.resize(patchCount);</span> +02075 <a class="code" href="a03739.html#NL3D_1_1CZoneLighterr23">_OversampleEdges</a>.resize(patchCount); +02076 visited.resize(patchCount); +02077 } +02078 +02079 <span class="comment">// Common arries</span> +02080 <a class="code" href="a03739.html#NL3D_1_1CZoneLighterr17">_Locator</a>[zone].resize(patchCount); +02081 <a class="code" href="a03739.html#NL3D_1_1CZoneLighterr1">_Binded</a>[zone].resize(patchCount); +02082 <a class="code" href="a03739.html#NL3D_1_1CZoneLighterr2">_BindInfo</a>[zone].resize(patchCount); +02083 <a class="code" href="a03739.html#NL3D_1_1CZoneLighterr0">_BezierPatch</a>[zone].resize(patchCount); +02084 +02085 <span class="comment">// For each patch</span> +02086 <a class="code" href="a04558.html#a15">uint</a> patch; +02087 <span class="keywordflow">for</span> (patch=0; patch<patchCount; patch++) +02088 { +02089 <span class="comment">// Get a patch pointer</span> +02090 <span class="keyword">const</span> CPatch* pPatch=(const_cast<const CZone*>(landscape.getZone(listZone[zone])))->getPatch (patch); +02091 +02092 <span class="comment">// Progress bar</span> +02093 <a class="code" href="a03739.html#NL3D_1_1CZoneLightera8">progress</a> (<span class="stringliteral">"Scan all patches"</span>, (<span class="keywordtype">float</span>)patch/(<span class="keywordtype">float</span>)patchCount); +02094 +02095 <span class="comment">// Get pointer on arries</span> +02096 vector<bool> &binded=<a class="code" href="a03739.html#NL3D_1_1CZoneLighterr1">_Binded</a>[zone][patch]; +02097 vector<CPatch::CBindInfo> &bindInfo=<a class="code" href="a03739.html#NL3D_1_1CZoneLighterr2">_BindInfo</a>[zone][patch]; +02098 vector<CPatchUVLocator> &locator=<a class="code" href="a03739.html#NL3D_1_1CZoneLighterr17">_Locator</a>[zone][patch]; +02099 CBezierPatch &bezierPatch=<a class="code" href="a03739.html#NL3D_1_1CZoneLighterr0">_BezierPatch</a>[zone][patch]; +02100 binded.resize (4, <span class="keyword">false</span>); +02101 bindInfo.resize (4); +02102 locator.resize (4); +02103 +02104 <span class="comment">// Contruct the patch</span> +02105 bezierPatch=*pPatch->unpackIntoCache(); +02106 +02107 <span class="comment">// Same zone ?</span> +02108 <span class="keywordflow">if</span> (listZone[zone]==<a class="code" href="a03739.html#NL3D_1_1CZoneLighterr39">_ZoneToLight</a>) +02109 { +02110 <span class="comment">// oversample this edge</span> +02111 <a class="code" href="a03739.html#NL3D_1_1CZoneLighterr23">_OversampleEdges</a>[patch].resize (4, <span class="keyword">false</span>); +02112 } +02113 +02114 <span class="comment">// *** Build bind info</span> +02115 +02116 <span class="comment">// *** Build neighboorhood information</span> +02117 <a class="code" href="a04558.html#a15">uint</a> edge; +02118 <span class="keywordflow">for</span> (edge=0; edge<4; edge++) +02119 { +02120 <span class="comment">// Bond neighbor</span> +02121 pPatch->getBindNeighbor (edge, bindInfo[edge]); +02122 +02123 <span class="comment">// Patch binded</span> +02124 <span class="keywordflow">if</span> (bindInfo[edge].NPatchs>0) +02125 { +02126 <span class="comment">// This edeg is binded</span> +02127 binded[edge]=<span class="keyword">true</span>; +02128 +02129 <span class="comment">// Same zone ?</span> +02130 <span class="keywordflow">if</span> ((listZone[zone]==<a class="code" href="a03739.html#NL3D_1_1CZoneLighterr39">_ZoneToLight</a>)&&(bindInfo[edge].Zone->getZoneId()!=<a class="code" href="a03739.html#NL3D_1_1CZoneLighterr39">_ZoneToLight</a>)) +02131 { +02132 <span class="comment">// oversample this edge</span> +02133 <a class="code" href="a03739.html#NL3D_1_1CZoneLighterr23">_OversampleEdges</a>[patch][edge]=<span class="keyword">true</span>; +02134 } +02135 locator[edge].build (pPatch, edge, bindInfo[edge]); +02136 } +02137 <span class="keywordflow">else</span> +02138 { +02139 <span class="keywordflow">if</span> (listZone[zone]==<a class="code" href="a03739.html#NL3D_1_1CZoneLighterr39">_ZoneToLight</a>) +02140 { +02141 <span class="comment">// oversample this edge</span> +02142 <a class="code" href="a03739.html#NL3D_1_1CZoneLighterr23">_OversampleEdges</a>[patch][edge]=<span class="keyword">true</span>; +02143 } +02144 } +02145 } +02146 +02147 <span class="comment">// This is the zone to light ?</span> +02148 <span class="keywordflow">if</span> (listZone[zone]==<a class="code" href="a03739.html#NL3D_1_1CZoneLighterr39">_ZoneToLight</a>) +02149 { +02150 <span class="comment">// *** Resize lumel array for this patch</span> +02151 +02152 <span class="comment">// Get patch order</span> +02153 <a class="code" href="a04558.html#a15">uint</a> orderS=pPatch->getOrderS(); +02154 <a class="code" href="a04558.html#a15">uint</a> orderT=pPatch->getOrderT(); +02155 +02156 <span class="comment">// Number of lumels</span> +02157 <a class="code" href="a04558.html#a15">uint</a> lumelCount = orderS*orderT*16; +02158 <a class="code" href="a04558.html#a15">uint</a> lumelCornerCount = (orderS*4+1)*(orderT*4+1); +02159 +02160 <span class="comment">// Resize the lumel descriptor</span> +02161 CLumelDescriptor descriptor; +02162 descriptor.Normal.set (0,0,0); +02163 descriptor.Position.set (0,0,0); +02164 descriptor.S=0; +02165 descriptor.T=0; +02166 <a class="code" href="a03739.html#NL3D_1_1CZoneLighterr18">_Lumels</a>[patch].resize (lumelCount, descriptor); +02167 visited[patch].resize (lumelCount, 0); +02168 <span class="comment">// _LumelCorners[patch].resize (lumelCornerCount);</span> +02169 +02170 +02171 <span class="comment">// *** Unexclude this patch</span> +02172 +02173 <span class="comment">// Exclude all the patches from refine all</span> +02174 landscape.excludePatchFromRefineAll (listZone[zone], patch, <span class="keyword">false</span>); +02175 } +02176 <span class="keywordflow">else</span> +02177 { +02178 <span class="comment">// Exclude all the patches from refine all</span> +02179 landscape.excludePatchFromRefineAll (listZone[zone], patch, <span class="keyword">true</span>); +02180 } +02181 } +02182 } +02183 +02184 <span class="comment">// *** Now tesselate this zone to shadow casters accuracy</span> +02185 +02186 <span class="comment">// Setup the landscape</span> +02187 landscape.setThreshold (0); +02188 landscape.setTileMaxSubdivision (0); +02189 +02190 <span class="comment">// Refine all</span> +02191 <a class="code" href="a03739.html#NL3D_1_1CZoneLightera8">progress</a> (<span class="stringliteral">"Refine landscape to shadow accuracy"</span>, 0.5f); +02192 landscape.refineAll (CVector (0, 0, 0)); +02193 +02194 <span class="comment">// Get tesselated faces</span> +02195 std::vector<const CTessFace*> leaves; +02196 landscape.getTessellationLeaves(leaves); +02197 +02198 +02199 +02200 +02201 <span class="keywordflow">if</span> (<a class="code" href="a03739.html#NL3D_1_1CZoneLighterr36">_WaterShapes</a>.size() != 0) <span class="comment">// any water shape in this zone ?</span> +02202 { +02204 <a class="code" href="a03739.html#NL3D_1_1CZoneLighterd16">makeQuadGridFromWaterShapes</a>(landscape.getZone(_ZoneToLight)->getZoneBB().getAABBox()); +02205 +02207 <a class="code" href="a03739.html#NL3D_1_1CZoneLighterd4">computeTileFlagsForPositionTowardWater</a>(lightDesc, leaves); +02208 } +02209 <span class="keywordflow">else</span> +02210 { +02211 <a class="code" href="a03739.html#NL3D_1_1CZoneLighterd19">setTileFlagsToDefault</a>(leaves); +02212 } +02213 +02214 +02215 <span class="comment">// Id of this zone in the array</span> +02216 <a class="code" href="a04558.html#a15">uint</a> zoneNumber=<a class="code" href="a03739.html#NL3D_1_1CZoneLighterr38">_ZoneId</a>[<a class="code" href="a03739.html#NL3D_1_1CZoneLighterr39">_ZoneToLight</a>]; +02217 +02218 <span class="comment">// Scan each leaves</span> +02219 <a class="code" href="a04558.html#a15">uint</a> leavesCount=leaves.size(); +02220 <a class="code" href="a04558.html#a15">uint</a> leave; +02221 <span class="keywordflow">for</span> (leave=0; leave<leavesCount; leave++) +02222 { +02223 <span class="comment">// Progress bar</span> +02224 <span class="keywordflow">if</span> ( (leave&0xff) == 0) +02225 <a class="code" href="a03739.html#NL3D_1_1CZoneLightera8">progress</a> (<span class="stringliteral">"Precompute lumel position"</span>, (<span class="keywordtype">float</span>)leave/(<span class="keywordtype">float</span>)leavesCount); +02226 +02227 <span class="comment">// Leave</span> +02228 <span class="keyword">const</span> <a class="code" href="a03476.html">CTessFace</a> *face=leaves[leave]; +02229 +02230 <span class="comment">// Get zone id</span> +02231 <span class="keywordflow">if</span> (face-><a class="code" href="a03476.html#NL3D_1_1CTessFacez968_5">Patch</a>->getZone()->getZoneId()==<a class="code" href="a03739.html#NL3D_1_1CZoneLighterr39">_ZoneToLight</a>) +02232 { +02233 <span class="comment">// Get a patch pointer</span> +02234 <span class="keyword">const</span> CPatch* pPatch=face-><a class="code" href="a03476.html#NL3D_1_1CTessFacez968_5">Patch</a>; +02235 +02236 <span class="comment">// Get order</span> +02237 <a class="code" href="a04558.html#a15">uint</a> orderS=pPatch->getOrderS(); +02238 <a class="code" href="a04558.html#a15">uint</a> orderT=pPatch->getOrderT(); +02239 +02240 <span class="comment">// *** Base Coordinates</span> +02241 +02242 CVector pos[15]; +02243 pos[0]=face-><a class="code" href="a03476.html#NL3D_1_1CTessFacez968_13">VBase</a>->EndPos; <span class="comment">// p0</span> +02244 pos[1]=face-><a class="code" href="a03476.html#NL3D_1_1CTessFacez968_15">VRight</a>->EndPos; +02245 pos[2]=face-><a class="code" href="a03476.html#NL3D_1_1CTessFacez968_14">VLeft</a>->EndPos; <span class="comment">// p2</span> +02246 pos[3]=(pos[1]+pos[2])/2; +02247 pos[4]=(pos[0]+pos[1])/2; <span class="comment">// p4</span> +02248 pos[5]=(pos[0]+pos[2])/2; +02249 pos[6]=(pos[0]+pos[3])/2; <span class="comment">// p6</span> +02250 pos[7]=(pos[2]+pos[3])/2; +02251 pos[8]=(pos[1]+pos[3])/2; <span class="comment">// p8</span> +02252 pos[9]=(pos[0]+pos[4])/2; +02253 pos[10]=(pos[1]+pos[4])/2; <span class="comment">// p10</span> +02254 pos[11]=(pos[0]+pos[5])/2; +02255 pos[12]=(pos[2]+pos[5])/2; <span class="comment">// p12</span> +02256 pos[13]=(pos[3]+pos[5])/2; +02257 pos[14]=(pos[3]+pos[4])/2; <span class="comment">// p14</span> +02258 +02259 <span class="keywordtype">float</span> s0=face-><a class="code" href="a03476.html#NL3D_1_1CTessFacez968_6">PVBase</a>.<a class="code" href="a03040.html#NL3D_1_1CParamCoorda3">getS</a>(); +02260 <span class="keywordtype">float</span> s1=face-><a class="code" href="a03476.html#NL3D_1_1CTessFacez968_8">PVRight</a>.<a class="code" href="a03040.html#NL3D_1_1CParamCoorda3">getS</a>(); +02261 <span class="keywordtype">float</span> s2=face-><a class="code" href="a03476.html#NL3D_1_1CTessFacez968_7">PVLeft</a>.<a class="code" href="a03040.html#NL3D_1_1CParamCoorda3">getS</a>(); +02262 <span class="keywordtype">float</span> s3=(s1+s2)/2; +02263 <span class="keywordtype">float</span> s4=(s0+s1)/2; +02264 <span class="keywordtype">float</span> s5=(s0+s2)/2; +02265 <span class="keywordtype">float</span> s6=(s4+s5)/2; +02266 <span class="keywordtype">float</span> s7=(s2+s3)/2; +02267 <span class="keywordtype">float</span> s8=(s1+s3)/2; +02268 +02269 <span class="keywordtype">float</span> t0=face-><a class="code" href="a03476.html#NL3D_1_1CTessFacez968_6">PVBase</a>.<a class="code" href="a03040.html#NL3D_1_1CParamCoorda4">getT</a>(); +02270 <span class="keywordtype">float</span> t1=face-><a class="code" href="a03476.html#NL3D_1_1CTessFacez968_8">PVRight</a>.<a class="code" href="a03040.html#NL3D_1_1CParamCoorda4">getT</a>(); +02271 <span class="keywordtype">float</span> t2=face-><a class="code" href="a03476.html#NL3D_1_1CTessFacez968_7">PVLeft</a>.<a class="code" href="a03040.html#NL3D_1_1CParamCoorda4">getT</a>(); +02272 <span class="keywordtype">float</span> t3=(t1+t2)/2; +02273 <span class="keywordtype">float</span> t4=(t0+t1)/2; +02274 <span class="keywordtype">float</span> t5=(t0+t2)/2; +02275 <span class="keywordtype">float</span> t6=(t4+t5)/2; +02276 <span class="keywordtype">float</span> t7=(t2+t3)/2; +02277 <span class="keywordtype">float</span> t8=(t1+t3)/2; +02278 +02279 <span class="comment">// *** Interpolated value</span> +02280 CVector interpolatedP[10]= +02281 { +02282 (pos[0]+pos[6])/2, +02283 (pos[4]+pos[6])/2, +02284 (pos[4]+pos[8])/2, +02285 (pos[1]+pos[8])/2, +02286 (pos[5]+pos[6])/2, +02287 (pos[3]+pos[6])/2, +02288 (pos[3]+pos[8])/2, +02289 (pos[5]+pos[7])/2, +02290 (pos[3]+pos[7])/2, +02291 (pos[2]+pos[7])/2, +02292 }; +02293 +02294 <span class="comment">// Does the border are snapped ?</span> +02295 <a class="code" href="a04558.html#a15">uint</a> sBase = (<a class="code" href="a04558.html#a15">uint</a>)floor ((<span class="keywordtype">float</span>)orderS * face-><a class="code" href="a03476.html#NL3D_1_1CTessFacez968_6">PVBase</a>.<a class="code" href="a03040.html#NL3D_1_1CParamCoorda3">getS</a>() + 0.5); +02296 <a class="code" href="a04558.html#a15">uint</a> tBase = (<a class="code" href="a04558.html#a15">uint</a>)floor ((<span class="keywordtype">float</span>)orderT * face-><a class="code" href="a03476.html#NL3D_1_1CTessFacez968_6">PVBase</a>.<a class="code" href="a03040.html#NL3D_1_1CParamCoorda4">getT</a>() + 0.5); +02297 <a class="code" href="a04558.html#a15">uint</a> sLeft = (<a class="code" href="a04558.html#a15">uint</a>)floor ((<span class="keywordtype">float</span>)orderS * face-><a class="code" href="a03476.html#NL3D_1_1CTessFacez968_7">PVLeft</a>.<a class="code" href="a03040.html#NL3D_1_1CParamCoorda3">getS</a>() + 0.5); +02298 <a class="code" href="a04558.html#a15">uint</a> tLeft = (<a class="code" href="a04558.html#a15">uint</a>)floor ((<span class="keywordtype">float</span>)orderT * face-><a class="code" href="a03476.html#NL3D_1_1CTessFacez968_7">PVLeft</a>.<a class="code" href="a03040.html#NL3D_1_1CParamCoorda4">getT</a>() + 0.5); +02299 <a class="code" href="a04558.html#a15">uint</a> sRight = (<a class="code" href="a04558.html#a15">uint</a>)floor ((<span class="keywordtype">float</span>)orderS * face-><a class="code" href="a03476.html#NL3D_1_1CTessFacez968_8">PVRight</a>.<a class="code" href="a03040.html#NL3D_1_1CParamCoorda3">getS</a>() + 0.5); +02300 <a class="code" href="a04558.html#a15">uint</a> tRight = (<a class="code" href="a04558.html#a15">uint</a>)floor ((<span class="keywordtype">float</span>)orderT * face-><a class="code" href="a03476.html#NL3D_1_1CTessFacez968_8">PVRight</a>.<a class="code" href="a03040.html#NL3D_1_1CParamCoorda4">getT</a>() + 0.5); +02301 <span class="keywordtype">bool</span> snapedLeft[2]= +02302 { +02303 (sBase == 0) && (sRight == 0), +02304 (sBase == 0) && (sLeft == 0), +02305 }; +02306 <span class="keywordtype">bool</span> snapedRight[2]= +02307 { +02308 (sBase == orderS) && (sRight == orderS), +02309 (sBase == orderS) && (sLeft == orderS), +02310 }; +02311 <span class="keywordtype">bool</span> snapedTop[2]= +02312 { +02313 (tBase == 0) && (tRight == 0), +02314 (tBase == 0) && (tLeft == 0), +02315 }; +02316 <span class="keywordtype">bool</span> snapedBottom[2]= +02317 { +02318 (tBase == orderT) && (tRight == orderT), +02319 (tBase == orderT) && (tLeft == orderT), +02320 }; +02321 <span class="keywordtype">bool</span> snapedBorder[2]= +02322 { +02323 snapedLeft[0]||snapedRight[0]||snapedTop[0]||snapedBottom[0], +02324 snapedLeft[1]||snapedRight[1]||snapedTop[1]||snapedBottom[1], +02325 }; +02326 +02327 <span class="keywordtype">bool</span> snapedCorner[3]= +02328 { +02329 ((sBase == 0) && ((tBase == 0) || (tBase == orderT))) || +02330 ((sBase == orderS) && ((tBase == 0) || (tBase == orderT))), +02331 ((sRight == 0) && ((tRight == 0) || (tRight == orderT))) || +02332 ((sRight == orderS) && ((tRight == 0) || (tRight == orderT))), +02333 ((sLeft == 0) && ((tLeft == 0) || (tLeft == orderT))) || +02334 ((sLeft == orderS) && ((tLeft == 0) || (tLeft == orderT))), +02335 }; +02336 +02337 <span class="comment">// Snap on the border</span> +02338 <a class="code" href="a04558.html#a15">uint</a> i; +02339 <span class="keywordflow">for</span> (i=0; i<8; i++) +02340 { +02341 <span class="comment">// Snaped on left ?</span> +02342 <span class="keywordflow">if</span> (snapedBorder[VertexThanCanBeSnappedOnABorder[i][1]]) +02343 { +02344 <span class="comment">// Compute the border vertex</span> +02345 interpolatedP[VertexThanCanBeSnappedOnABorder[i][0]] = (pos[VertexThanCanBeSnappedOnABorder[i][2]] +02346 + pos[VertexThanCanBeSnappedOnABorder[i][3]])/2; +02347 } +02348 } +02349 +02350 <span class="comment">// Snap on the corner</span> +02351 <span class="keywordflow">for</span> (i=0; i<3; i++) +02352 { +02353 <span class="comment">// Snaped on a corner ?</span> +02354 <a class="code" href="a04558.html#a15">uint</a> tesselCornerIndex = VertexThanCanBeSnappedOnACorner[i][1]; +02355 <span class="keywordflow">if</span> ( snapedCorner[tesselCornerIndex] ) +02356 { +02357 <span class="comment">// Compute the border vertex</span> +02358 interpolatedP[VertexThanCanBeSnappedOnACorner[i][0]] = pos[tesselCornerIndex]; +02359 } +02360 } +02361 +02362 <span class="keywordtype">float</span> interpolatedS[10]= +02363 { +02364 (s0+s6)/2, +02365 (s4+s6)/2, +02366 (s4+s8)/2, +02367 (s1+s8)/2, +02368 (s5+s6)/2, +02369 (s3+s6)/2, +02370 (s3+s8)/2, +02371 (s5+s7)/2, +02372 (s3+s7)/2, +02373 (s2+s7)/2, +02374 }; +02375 +02376 <span class="keywordtype">float</span> interpolatedT[10]= +02377 { +02378 (t0+t6)/2, +02379 (t4+t6)/2, +02380 (t4+t8)/2, +02381 (t1+t8)/2, +02382 (t5+t6)/2, +02383 (t3+t6)/2, +02384 (t3+t8)/2, +02385 (t5+t7)/2, +02386 (t3+t7)/2, +02387 (t2+t7)/2, +02388 }; +02389 +02390 <span class="keywordflow">for</span> (i=0; i<10; i++) +02391 { +02392 <a class="code" href="a04558.html#a14">sint</a> <a class="code" href="a04223.html#a626">s</a>=(<a class="code" href="a04558.html#a14">sint</a>)((<span class="keywordtype">float</span>)orderS*4*interpolatedS[i]); +02393 <a class="code" href="a04558.html#a14">sint</a> <a class="code" href="a04223.html#a627">t</a>=(<a class="code" href="a04558.html#a14">sint</a>)((<span class="keywordtype">float</span>)orderT*4*interpolatedT[i]); +02394 +02395 <span class="keywordflow">if</span> ((<a class="code" href="a04223.html#a626">s</a>>=0)&&(<a class="code" href="a04223.html#a626">s<(sint)orderS*4)&&(t></a>=0)&&(<a class="code" href="a04223.html#a627">t</a><(<a class="code" href="a04558.html#a14">sint</a>)orderT*4)) +02396 { +02397 <span class="comment">// Triangle index</span> +02398 <a class="code" href="a04558.html#a15">uint</a> <a class="code" href="a04223.html#a566">index</a>=<a class="code" href="a04223.html#a626">s</a>+<a class="code" href="a04223.html#a627">t</a>*orderS*4; +02399 +02400 <span class="comment">// Ge tthe patch id</span> +02401 <a class="code" href="a04558.html#a15">uint</a> patchId=pPatch->getPatchId(); +02402 +02403 <span class="comment">// Get lumel array</span> +02404 vector<CLumelDescriptor> &lumels=<a class="code" href="a03739.html#NL3D_1_1CZoneLighterr18">_Lumels</a>[patchId]; +02405 +02406 <span class="comment">// Visited</span> +02407 visited[patchId][<a class="code" href="a04223.html#a566">index</a>]++; +02408 +02409 <span class="comment">// Position</span> +02410 lumels[<a class="code" href="a04223.html#a566">index</a>].Position+=interpolatedP[i]; +02411 } +02412 } +02413 } +02414 } +02415 +02416 <span class="comment">// *** Now, finalise patch informations for shadow source positions</span> +02417 +02418 <span class="comment">// For each patches</span> +02419 <a class="code" href="a04558.html#a15">uint</a> patchCount=landscape.getZone(_ZoneToLight)->getNumPatchs(); +02420 <a class="code" href="a04558.html#a15">uint</a> patch; +02421 <span class="keywordflow">for</span> (patch=0; patch<patchCount; patch++) +02422 { +02423 <span class="comment">// Info</span> +02424 <a class="code" href="a03739.html#NL3D_1_1CZoneLightera8">progress</a> (<span class="stringliteral">"Finalize lumel positions"</span>, (<span class="keywordtype">float</span>)patch/(<span class="keywordtype">float</span>)patchCount); +02425 +02426 <span class="comment">// *** Resize lumel array for this patch</span> +02427 +02428 <span class="comment">// Get a patch pointer</span> +02429 <span class="keyword">const</span> CPatch* pPatch=(const_cast<const CZone*>(landscape.getZone(_ZoneToLight)))->getPatch (patch); +02430 <a class="code" href="a04558.html#a15">uint</a> orderS=pPatch->getOrderS(); +02431 <a class="code" href="a04558.html#a15">uint</a> orderT=pPatch->getOrderT(); +02432 +02433 <span class="comment">// Get lumel array</span> +02434 vector<CLumelDescriptor> &lumels=<a class="code" href="a03739.html#NL3D_1_1CZoneLighterr18">_Lumels</a>[patch]; +02435 +02436 <span class="comment">// *** Average position</span> +02437 +02438 <span class="comment">// Renormalize</span> +02439 <a class="code" href="a04199.html#a6">nlassert</a> (isPowerOf2 (orderS)); +02440 <a class="code" href="a04199.html#a6">nlassert</a> (isPowerOf2 (orderT)); +02441 <a class="code" href="a04558.html#a15">uint</a> lumelS=4<<<a class="code" href="a05378.html#a263">getPowerOf2</a> (orderS); +02442 <a class="code" href="a04558.html#a15">uint</a> lumelT=4<<<a class="code" href="a05378.html#a263">getPowerOf2</a> (orderT); +02443 +02444 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a15">uint</a> <a class="code" href="a04223.html#a627">t</a>=0; <a class="code" href="a04223.html#a627">t</a><lumelT; <a class="code" href="a04223.html#a627">t</a>++) +02445 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a15">uint</a> <a class="code" href="a04223.html#a626">s</a>=0; <a class="code" href="a04223.html#a626">s</a><lumelS; <a class="code" href="a04223.html#a626">s</a>++) +02446 { +02447 <span class="comment">// Lumel index</span> +02448 <a class="code" href="a04558.html#a15">uint</a> lumelIndex=<a class="code" href="a04223.html#a626">s</a>+<a class="code" href="a04223.html#a627">t</a>*lumelS; +02449 +02450 <span class="comment">// *** Number of visit</span> +02451 <a class="code" href="a04558.html#a15">uint</a> visitedCount=visited[patch][lumelIndex]; +02452 +02453 <span class="comment">// If visited, renormalise other values</span> +02454 <span class="keywordflow">if</span> (visitedCount) +02455 { +02456 <span class="comment">// Normalise position</span> +02457 lumels[lumelIndex].Position/=(<span class="keywordtype">float</span>)visitedCount; +02458 } +02459 +02460 <span class="comment">// Not visited for next pass</span> +02461 visited[patch][lumelIndex]=<span class="keyword">false</span>; +02462 } +02463 } +02464 +02465 <span class="comment">// *** Now tesselate this zone to shadow receivers accuracy</span> +02466 +02467 <span class="comment">// Setup the landscape</span> +02468 landscape.setThreshold (0); +02469 landscape.setTileMaxSubdivision (4); +02470 +02471 <span class="comment">// Refine all</span> +02472 <a class="code" href="a03739.html#NL3D_1_1CZoneLightera8">progress</a> (<span class="stringliteral">"Refine landscape to lumels"</span>, 0.5f); +02473 landscape.refineAll (CVector (0, 0, 0)); +02474 +02475 <span class="comment">// Get tesselated faces</span> +02476 leaves.clear (); +02477 landscape.getTessellationLeaves(leaves); +02478 +02479 <span class="comment">// Scan each leaves</span> +02480 leavesCount=leaves.size(); +02481 <span class="keywordflow">for</span> (leave=0; leave<leavesCount; leave++) +02482 { +02483 <span class="comment">// Progress bar</span> +02484 <span class="keywordflow">if</span> ( (leave&0xff) == 0) +02485 <a class="code" href="a03739.html#NL3D_1_1CZoneLightera8">progress</a> (<span class="stringliteral">"Precompute tesselation"</span>, (<span class="keywordtype">float</span>)leave/(<span class="keywordtype">float</span>)leavesCount); +02486 +02487 <span class="comment">// Leave</span> +02488 <span class="keyword">const</span> <a class="code" href="a03476.html">CTessFace</a> *face=leaves[leave]; +02489 +02490 <span class="comment">// Get zone id</span> +02491 <span class="keywordflow">if</span> (face-><a class="code" href="a03476.html#NL3D_1_1CTessFacez968_5">Patch</a>->getZone()->getZoneId()==<a class="code" href="a03739.html#NL3D_1_1CZoneLighterr39">_ZoneToLight</a>) +02492 { +02493 <span class="comment">// Get a patch pointer</span> +02494 <span class="keyword">const</span> CPatch* pPatch=face-><a class="code" href="a03476.html#NL3D_1_1CTessFacez968_5">Patch</a>; +02495 +02496 <span class="comment">// Get order</span> +02497 <a class="code" href="a04558.html#a15">uint</a> orderS=pPatch->getOrderS(); +02498 <a class="code" href="a04558.html#a15">uint</a> orderT=pPatch->getOrderT(); +02499 +02500 <span class="comment">// Coordinates</span> +02501 <span class="keywordtype">float</span> fS=(face-><a class="code" href="a03476.html#NL3D_1_1CTessFacez968_6">PVBase</a>.<a class="code" href="a03040.html#NL3D_1_1CParamCoorda3">getS</a>()+face-><a class="code" href="a03476.html#NL3D_1_1CTessFacez968_7">PVLeft</a>.<a class="code" href="a03040.html#NL3D_1_1CParamCoorda3">getS</a>()+face-><a class="code" href="a03476.html#NL3D_1_1CTessFacez968_8">PVRight</a>.<a class="code" href="a03040.html#NL3D_1_1CParamCoorda3">getS</a>())/3.f; +02502 <span class="keywordtype">float</span> fT=(face-><a class="code" href="a03476.html#NL3D_1_1CTessFacez968_6">PVBase</a>.<a class="code" href="a03040.html#NL3D_1_1CParamCoorda4">getT</a>()+face-><a class="code" href="a03476.html#NL3D_1_1CTessFacez968_7">PVLeft</a>.<a class="code" href="a03040.html#NL3D_1_1CParamCoorda4">getT</a>()+face-><a class="code" href="a03476.html#NL3D_1_1CTessFacez968_8">PVRight</a>.<a class="code" href="a03040.html#NL3D_1_1CParamCoorda4">getT</a>())/3.f; +02503 <a class="code" href="a04558.html#a15">uint</a> <a class="code" href="a04223.html#a626">s</a>=(<a class="code" href="a04558.html#a15">uint</a>)((<span class="keywordtype">float</span>)orderS*4*fS); +02504 <a class="code" href="a04558.html#a15">uint</a> <a class="code" href="a04223.html#a627">t</a>=(<a class="code" href="a04558.html#a15">uint</a>)((<span class="keywordtype">float</span>)orderT*4*fT); +02505 <a class="code" href="a04199.html#a6">nlassert</a> (s>=0); +02506 <a class="code" href="a04199.html#a6">nlassert</a> (s<orderS*4); +02507 <a class="code" href="a04199.html#a6">nlassert</a> (t>=0); +02508 <a class="code" href="a04199.html#a6">nlassert</a> (t<orderT*4); +02509 +02510 <span class="comment">// Triangle index</span> +02511 <a class="code" href="a04558.html#a15">uint</a> <a class="code" href="a04223.html#a566">index</a>=<a class="code" href="a04223.html#a626">s</a>+<a class="code" href="a04223.html#a627">t</a>*orderS*4; +02512 +02513 <span class="comment">// Ge tthe patch id</span> +02514 <a class="code" href="a04558.html#a15">uint</a> patchId=pPatch->getPatchId(); +02515 +02516 <span class="comment">// Get lumel array</span> +02517 vector<CLumelDescriptor> &lumels=_Lumels[patchId]; +02518 +02519 <span class="comment">// Visited</span> +02520 visited[patchId][<a class="code" href="a04223.html#a566">index</a>]++; +02521 +02522 <span class="comment">// Lumel s and t</span> +02523 lumels[<a class="code" href="a04223.html#a566">index</a>].S+=fS; +02524 lumels[<a class="code" href="a04223.html#a566">index</a>].T+=fT; +02525 +02526 <span class="comment">// Normal</span> +02527 CPlane plane; +02528 plane.make (face-><a class="code" href="a03476.html#NL3D_1_1CTessFacez968_13">VBase</a>->EndPos, face-><a class="code" href="a03476.html#NL3D_1_1CTessFacez968_14">VLeft</a>->EndPos, face-><a class="code" href="a03476.html#NL3D_1_1CTessFacez968_15">VRight</a>->EndPos); +02529 lumels[<a class="code" href="a04223.html#a566">index</a>].Normal+=plane.getNormal(); +02530 } +02531 } +02532 +02533 <span class="comment">// *** Now, finalise patch informations</span> +02534 +02535 <span class="comment">// For each patches</span> +02536 patchCount=landscape.getZone(_ZoneToLight)->getNumPatchs(); +02537 <span class="keywordflow">for</span> (patch=0; patch<patchCount; patch++) +02538 { +02539 <span class="comment">// Info</span> +02540 <a class="code" href="a03739.html#NL3D_1_1CZoneLightera8">progress</a> (<span class="stringliteral">"Finalize patches"</span>, (<span class="keywordtype">float</span>)patch/(<span class="keywordtype">float</span>)patchCount); +02541 +02542 <span class="comment">// *** Resize lumel array for this patch</span> +02543 +02544 <span class="comment">// Get a patch pointer</span> +02545 <span class="keyword">const</span> CPatch* pPatch=(const_cast<const CZone*>(landscape.getZone(_ZoneToLight)))->getPatch (patch); +02546 <a class="code" href="a04558.html#a15">uint</a> orderS=pPatch->getOrderS(); +02547 <a class="code" href="a04558.html#a15">uint</a> orderT=pPatch->getOrderT(); +02548 +02549 <span class="comment">// Get lumel array</span> +02550 vector<CLumelDescriptor> &lumels=_Lumels[patch]; +02551 +02552 <span class="comment">// *** Compute an interpolated normal</span> +02553 +02554 <span class="comment">// Get pointer on arries</span> +02555 vector<bool> &binded=<a class="code" href="a03739.html#NL3D_1_1CZoneLighterr1">_Binded</a>[zoneNumber][patch]; +02556 vector<CPatchUVLocator> &locator=<a class="code" href="a03739.html#NL3D_1_1CZoneLighterr17">_Locator</a>[zoneNumber][patch]; +02557 vector<CPatch::CBindInfo> &bindInfo=<a class="code" href="a03739.html#NL3D_1_1CZoneLighterr2">_BindInfo</a>[zoneNumber][patch]; +02558 CBezierPatch &bezierPatch=<a class="code" href="a03739.html#NL3D_1_1CZoneLighterr0">_BezierPatch</a>[zoneNumber][patch]; +02559 +02560 <span class="comment">// Renormalize</span> +02561 <a class="code" href="a04199.html#a6">nlassert</a> (isPowerOf2 (orderS)); +02562 <a class="code" href="a04199.html#a6">nlassert</a> (isPowerOf2 (orderT)); +02563 <a class="code" href="a04558.html#a15">uint</a> powerS=<a class="code" href="a05378.html#a263">getPowerOf2</a> (orderS); +02564 <a class="code" href="a04558.html#a15">uint</a> powerT=<a class="code" href="a05378.html#a263">getPowerOf2</a> (orderT); +02565 <a class="code" href="a04558.html#a15">uint</a> lumelS=4<<powerS; +02566 <a class="code" href="a04558.html#a15">uint</a> lumelT=4<<powerT; +02567 +02568 <span class="comment">// Sample edge normal</span> +02569 CVector normals[<a class="code" href="a04733.html#a1">NL_MAX_TILES_BY_PATCH_EDGE</a>*<a class="code" href="a04733.html#a7">NL_LUMEL_BY_TILE</a>+1][4]; +02570 <a class="code" href="a04558.html#a15">uint</a> sFixed[4] = { 0, 0xffffffff, lumelS-1, 0xffffffff }; +02571 <a class="code" href="a04558.html#a15">uint</a> tFixed[4] = { 0xffffffff, lumelT-1, 0xffffffff, 0 }; +02572 <span class="keywordtype">float</span> sOri[4] = { 0, -1, (<span class="keywordtype">float</span>)lumelS, -1 }; +02573 <span class="keywordtype">float</span> tOri[4] = { -1, (<span class="keywordtype">float</span>)lumelT, -1, 0 }; +02574 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a15">uint</a> edge=0; edge<4; edge++) +02575 { +02576 <span class="comment">// s and t</span> +02577 <a class="code" href="a04558.html#a15">uint</a> <a class="code" href="a04223.html#a577">count</a>=(edge&1)?lumelS:lumelT; +02578 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a15">uint</a> lumel=0; lumel<=<a class="code" href="a04223.html#a577">count</a>; lumel++) +02579 { +02580 <span class="comment">// Start coordinates</span> +02581 <span class="keywordtype">float</span> origineS; +02582 <span class="keywordtype">float</span> origineT; +02583 <a class="code" href="a04558.html#a15">uint</a> startS; +02584 <a class="code" href="a04558.html#a15">uint</a> startT; +02585 <span class="keywordflow">if</span> (edge&1) +02586 { +02587 <span class="keywordflow">if</span> (lumel==<a class="code" href="a04223.html#a577">count</a>) +02588 startS=<a class="code" href="a04223.html#a577">count</a>-1; +02589 <span class="keywordflow">else</span> +02590 startS=lumel; +02591 startT=tFixed[edge]; +02592 origineS=(<span class="keywordtype">float</span>)lumel; +02593 origineT=tOri[edge]; +02594 } +02595 <span class="keywordflow">else</span> +02596 { +02597 <span class="keywordflow">if</span> (lumel==<a class="code" href="a04223.html#a577">count</a>) +02598 startT=<a class="code" href="a04223.html#a577">count</a>-1; +02599 <span class="keywordflow">else</span> +02600 startT=lumel; +02601 startS=sFixed[edge]; +02602 origineT=(<span class="keywordtype">float</span>)lumel; +02603 origineS=sOri[edge]; +02604 } +02605 <a class="code" href="a03739.html#NL3D_1_1CZoneLighterr6">_GetNormalNormal</a>=CVector::Null; +02606 set<uint64> visitedLumels; +02607 <a class="code" href="a03739.html#NL3D_1_1CZoneLighterd8">getNormal</a> (pPatch, startS, startT, locator, bindInfo, binded, visitedLumels, +02608 startS+0.5f-origineS, startT+0.5f-origineT, 0, bezierPatch); +02609 <a class="code" href="a03739.html#NL3D_1_1CZoneLighterr6">_GetNormalNormal</a>.<a class="code" href="a03128.html#NLMISC_1_1CVectorz2049_1">normalize</a> (); +02610 normals[lumel][edge]=<a class="code" href="a03739.html#NL3D_1_1CZoneLighterr6">_GetNormalNormal</a>; +02611 } +02612 +02613 <span class="comment">// Smooth the corners</span> +02614 <span class="preprocessor">#define BLUR_SIZE 4</span> +02615 <span class="preprocessor"></span> <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a15">uint</a> i=1; i<<a class="code" href="a05345.html#a18">BLUR_SIZE</a>; i++) +02616 { +02617 <span class="keywordtype">float</span> <a class="code" href="a04223.html#a658">value</a>=(<span class="keywordtype">float</span>)i/<a class="code" href="a05345.html#a18">BLUR_SIZE</a>; +02618 <a class="code" href="a04223.html#a658">value</a>=<a class="code" href="a05345.html#a22">easineasout</a>(value); +02619 normals[i][edge]=normals[0][edge]*(1-<a class="code" href="a04223.html#a658">value</a>)+normals[i][edge]*<a class="code" href="a04223.html#a658">value</a>; +02620 normals[i][edge].normalize(); +02621 normals[<a class="code" href="a04223.html#a577">count</a>-i][edge]=normals[<a class="code" href="a04223.html#a577">count</a>][edge]*(1-<a class="code" href="a04223.html#a658">value</a>)+normals[<a class="code" href="a04223.html#a577">count</a>-i][edge]*<a class="code" href="a04223.html#a658">value</a>; +02622 normals[<a class="code" href="a04223.html#a577">count</a>-i][edge].normalize(); +02623 } +02624 } +02625 +02626 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a15">uint</a> <a class="code" href="a04223.html#a627">t</a>=0; <a class="code" href="a04223.html#a627">t</a><lumelT; <a class="code" href="a04223.html#a627">t</a>++) +02627 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a15">uint</a> <a class="code" href="a04223.html#a626">s</a>=0; <a class="code" href="a04223.html#a626">s</a><lumelS; <a class="code" href="a04223.html#a626">s</a>++) +02628 { +02629 <span class="comment">// Lumel index</span> +02630 <a class="code" href="a04558.html#a15">uint</a> lumelIndex=<a class="code" href="a04223.html#a626">s</a>+<a class="code" href="a04223.html#a627">t</a>*lumelS; +02631 +02632 <span class="comment">// *** Calc the smoothed normal</span> +02633 +02634 <span class="comment">// For each edge</span> +02635 CVector normalS=bezierPatch.evalNormal (((<span class="keywordtype">float</span>)s+0.5f)/(<span class="keywordtype">float</span>)lumelS, ((<span class="keywordtype">float</span>)t+0.5f)/(<span class="keywordtype">float</span>)lumelT); +02636 <span class="keywordtype">float</span> sFactor=0; +02637 CVector normalT=normalS; +02638 <span class="keywordtype">float</span> tFactor=0; +02639 <span class="keywordtype">bool</span> sGood=<span class="keyword">false</span>, tGood=<span class="keyword">false</span>; +02640 <span class="keywordflow">if</span> (<a class="code" href="a04223.html#a626">s</a><<a class="code" href="a05345.html#a18">BLUR_SIZE</a>) +02641 { +02642 sGood=<span class="keyword">true</span>; +02643 <span class="comment">// Average the two normals</span> +02644 CVector average=normals[<a class="code" href="a04223.html#a627">t</a>][0]; +02645 average+=normals[<a class="code" href="a04223.html#a627">t</a>+1][0]; +02646 average/=2; +02647 +02648 <span class="comment">// Blend</span> +02649 <span class="keywordtype">float</span> <a class="code" href="a04223.html#a658">value</a>=<a class="code" href="a04223.html#a626">s</a>+0.5f; +02650 sFactor=<a class="code" href="a05345.html#a18">BLUR_SIZE</a>-<a class="code" href="a04223.html#a658">value</a>; +02651 <a class="code" href="a04223.html#a658">value</a>/=<a class="code" href="a05345.html#a18">BLUR_SIZE</a>; +02652 <a class="code" href="a04223.html#a658">value</a>=<a class="code" href="a05345.html#a22">easineasout</a>(value); +02653 normalS=(normalS*<a class="code" href="a04223.html#a658">value</a>+average*(1-<a class="code" href="a04223.html#a658">value</a>)); +02654 normalS.normalize(); +02655 } +02656 <span class="keywordflow">if</span> (<a class="code" href="a04223.html#a626">s</a>>=lumelS-<a class="code" href="a05345.html#a18">BLUR_SIZE</a>) +02657 { +02658 sGood=<span class="keyword">true</span>; +02659 <span class="comment">// Average the two normals</span> +02660 CVector average=normals[<a class="code" href="a04223.html#a627">t</a>][2]; +02661 average+=normals[<a class="code" href="a04223.html#a627">t</a>+1][2]; +02662 average/=2; +02663 +02664 <span class="comment">// Blend</span> +02665 <span class="keywordtype">float</span> <a class="code" href="a04223.html#a658">value</a>=<a class="code" href="a04223.html#a626">s</a>+0.5f; +02666 sFactor=<a class="code" href="a05345.html#a18">BLUR_SIZE</a>-(lumelS-<a class="code" href="a04223.html#a658">value</a>); +02667 <a class="code" href="a04223.html#a658">value</a>=(lumelS-<a class="code" href="a04223.html#a658">value</a>)/<a class="code" href="a05345.html#a18">BLUR_SIZE</a>; +02668 <a class="code" href="a04223.html#a658">value</a>=<a class="code" href="a05345.html#a22">easineasout</a>(value); +02669 normalS=(normalS*<a class="code" href="a04223.html#a658">value</a>+average*(1-<a class="code" href="a04223.html#a658">value</a>)); +02670 normalS.normalize(); +02671 } +02672 <span class="keywordflow">if</span> (<a class="code" href="a04223.html#a627">t</a><<a class="code" href="a05345.html#a18">BLUR_SIZE</a>) +02673 { +02674 tGood=<span class="keyword">true</span>; +02675 <span class="comment">// Average the two normals</span> +02676 CVector average=normals[<a class="code" href="a04223.html#a626">s</a>][3]; +02677 average+=normals[<a class="code" href="a04223.html#a626">s</a>+1][3]; +02678 average/=2; +02679 +02680 <span class="comment">// Blend</span> +02681 <span class="keywordtype">float</span> <a class="code" href="a04223.html#a658">value</a>=<a class="code" href="a04223.html#a627">t</a>+0.5f; +02682 tFactor=<a class="code" href="a05345.html#a18">BLUR_SIZE</a>-<a class="code" href="a04223.html#a658">value</a>; +02683 <a class="code" href="a04223.html#a658">value</a>/=<a class="code" href="a05345.html#a18">BLUR_SIZE</a>; +02684 <a class="code" href="a04223.html#a658">value</a>=<a class="code" href="a05345.html#a22">easineasout</a>(value); +02685 normalT=(normalT*<a class="code" href="a04223.html#a658">value</a>+average*(1-<a class="code" href="a04223.html#a658">value</a>)); +02686 normalT.normalize(); +02687 } +02688 <span class="keywordflow">if</span> (<a class="code" href="a04223.html#a627">t</a>>=lumelT-<a class="code" href="a05345.html#a18">BLUR_SIZE</a>) +02689 { +02690 tGood=<span class="keyword">true</span>; +02691 <span class="comment">// Average the two normals</span> +02692 CVector average=normals[<a class="code" href="a04223.html#a626">s</a>][1]; +02693 average+=normals[<a class="code" href="a04223.html#a626">s</a>+1][1]; +02694 average/=2; +02695 +02696 <span class="comment">// Blend</span> +02697 <span class="keywordtype">float</span> <a class="code" href="a04223.html#a658">value</a>=<a class="code" href="a04223.html#a627">t</a>+0.5f; +02698 tFactor=<a class="code" href="a05345.html#a18">BLUR_SIZE</a>-(lumelT-<a class="code" href="a04223.html#a658">value</a>); +02699 <a class="code" href="a04223.html#a658">value</a>=((lumelT)-<a class="code" href="a04223.html#a658">value</a>)/<a class="code" href="a05345.html#a18">BLUR_SIZE</a>; +02700 <a class="code" href="a04223.html#a658">value</a>=<a class="code" href="a05345.html#a22">easineasout</a>(value); +02701 normalT=(normalT*<a class="code" href="a04223.html#a658">value</a>+average*(1-<a class="code" href="a04223.html#a658">value</a>)); +02702 normalT.normalize(); +02703 } +02704 +02705 <span class="comment">// The smooth normal</span> +02706 CVector smoothNormal; +02707 +02708 <span class="keywordflow">if</span> ((sGood)&&(tGood)) +02709 { +02710 <span class="keywordflow">if</span> ((sFactor!=<a class="code" href="a05345.html#a18">BLUR_SIZE</a>)||(tFactor!=<a class="code" href="a05345.html#a18">BLUR_SIZE</a>)) +02711 smoothNormal=normalS*(<a class="code" href="a05345.html#a18">BLUR_SIZE</a>-tFactor)+normalT*(<a class="code" href="a05345.html#a18">BLUR_SIZE</a>-sFactor); +02712 <span class="keywordflow">else</span> +02713 smoothNormal=normalS+normalT; +02714 } +02715 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (sGood) +02716 smoothNormal=normalS; +02717 <span class="keywordflow">else</span> +02718 smoothNormal=normalT; +02719 +02720 <span class="comment">// Normalize it</span> +02721 smoothNormal.normalize(); +02722 +02723 <span class="comment">// The pure normal</span> +02724 CVector purNormal=bezierPatch.evalNormal (((<span class="keywordtype">float</span>)s+0.5f)/(<span class="keywordtype">float</span>)lumelS, ((<span class="keywordtype">float</span>)t+0.5f)/(<span class="keywordtype">float</span>)lumelT); +02725 +02726 <span class="comment">// Normalize the noisy normal</span> +02727 lumels[lumelIndex].Normal.normalize(); +02728 +02729 <span class="comment">// Final normal</span> +02730 lumels[lumelIndex].Normal=lumels[lumelIndex].Normal-purNormal+smoothNormal; +02731 lumels[lumelIndex].Normal.normalize (); +02732 +02733 <span class="comment">// *** Number of visit</span> +02734 <a class="code" href="a04558.html#a15">uint</a> visitedCount=visited[patch][lumelIndex]; +02735 +02736 <span class="comment">// Some lumel have not been found in tesselation</span> +02737 <span class="comment">//nlassert (visitedCount==2);</span> +02738 +02739 <span class="comment">// If visited, renormalise other values</span> +02740 <span class="keywordflow">if</span> (visitedCount) +02741 { +02742 <span class="comment">// Normalise position</span> +02743 lumels[lumelIndex].S/=(<span class="keywordtype">float</span>)visitedCount; +02744 lumels[lumelIndex].T/=(<span class="keywordtype">float</span>)visitedCount; +02745 } +02746 } +02747 } +02748 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneLighterd3" doxytag="NL3D::CZoneLighter::calcSkyContribution" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> float CZoneLighter::calcSkyContribution </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a04558.html#a14">sint</a> </td> + <td class="mdname" nowrap> <em>s</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a14">sint</a> </td> + <td class="mdname" nowrap> <em>t</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>float </td> + <td class="mdname" nowrap> <em>height</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>float </td> + <td class="mdname" nowrap> <em>skyIntensity</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const <a class="el" href="a03128.html">CVector</a> & </td> + <td class="mdname" nowrap> <em>normal</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"> const<code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06768.html#l00296">296</a> of file <a class="el" href="a06768.html">zone_lighter.cpp</a>. +<p> +References <a class="el" href="a05587.html#l00115">NLMISC::clamp()</a>, <a class="el" href="a06768.html#l00282">deltaDirection</a>, <a class="el" href="a06768.html#l01390">getMaxPhi()</a>, <a class="el" href="a05646.html#l01013">height</a>, <a class="el" href="a05587.html#l00079">NLMISC::Pi</a>, <a class="el" href="a05646.html#l00977">s</a>, <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a05646.html#l00985">t</a>, <a class="el" href="a05981.html#l00105">uint</a>, and <a class="el" href="a05981.html#l00096">uint8</a>. +<p> +Referenced by <a class="el" href="a06768.html#l01271">getSkyContribution()</a>. +<p> +<div class="fragment"><pre>00297 { +00298 <span class="comment">// Sky contribution</span> +00299 <span class="keywordtype">float</span> skyContribution; +00300 +00301 <span class="comment">// Calc k</span> +00302 CVector k (0, 0, 0); +00303 +00304 <span class="comment">// For the height direction</span> +00305 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a15">uint</a> i=0; i<8; i++) +00306 { +00307 <span class="comment">// Get phi for this point</span> +00308 <a class="code" href="a04558.html#a7">uint8</a> phi=<a class="code" href="a03739.html#NL3D_1_1CZoneLighterd7">getMaxPhi</a> (s, t, deltaDirection[i][0], deltaDirection[i][1], height); +00309 +00310 <span class="comment">// Add to k</span> +00311 k+=<a class="code" href="a03739.html#NL3D_1_1CZoneLighterr13">_K</a>[phi][i]; +00312 } +00313 +00314 <span class="comment">// Finalize sky contribution</span> +00315 skyContribution=(<span class="keywordtype">float</span>)(skyIntensity*(normal*k)/(2*<a class="code" href="a05378.html#a44">Pi</a>)); +00316 skyContribution=(<span class="keywordtype">float</span>)(skyIntensity*(normal*k)/(2*<a class="code" href="a05378.html#a44">Pi</a>)); +00317 <a class="code" href="a05378.html#a374">clamp</a> (skyContribution, 0.f, 1.f); +00318 <span class="keywordflow">return</span> skyContribution; +00319 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneLighterz1203_0" doxytag="NL3D::CZoneLighter::compilePointLightRT" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void CZoneLighter::compilePointLightRT </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a04558.html#a15">uint</a> </td> + <td class="mdname" nowrap> <em>gridSize</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>float </td> + <td class="mdname" nowrap> <em>gridCellSize</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>std::vector< <a class="el" href="a03750.html">CTriangle</a> > & </td> + <td class="mdname" nowrap> <em>obstacles</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>bool </td> + <td class="mdname" nowrap> <em>doShadow</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Fill CubeGrid, and set PointLightRT in _StaticPointLightQuadGrid. +<p> + +<p> +Definition at line <a class="el" href="a06768.html#l03202">3202</a> of file <a class="el" href="a06768.html">zone_lighter.cpp</a>. +<p> +References <a class="el" href="a06300.html#l00641">NL3D::CQuadGrid< T >::begin()</a>, <a class="el" href="a06769.html#l00536">NL3D::CZoneLighter::CPointLightRT::BSphere</a>, <a class="el" href="a05505.html#l00048">NLMISC::CBSphere::Center</a>, <a class="el" href="a02423.html#NL3D_1_1CCubeGrida1">NL3D::CCubeGrid< const CTriangle * >::compile()</a>, <a class="el" href="a02423.html#NL3D_1_1CCubeGrida2">NL3D::CCubeGrid< const CTriangle * >::create()</a>, <a class="el" href="a06300.html#l00433">NL3D::CQuadGrid< T >::create()</a>, <a class="el" href="a03273.html#NL3D_1_1CQuadGridz772_1">NL3D::CQuadGrid< CPointLightRT * >::create()</a>, <a class="el" href="a06300.html#l00646">NL3D::CQuadGrid< T >::end()</a>, <a class="el" href="a05384.html#l00215">NLMISC::CAABBox::extend()</a>, <a class="el" href="a06769.html#l00539">NL3D::CZoneLighter::CPointLightRT::FaceCubeGrid</a>, <a class="el" href="a06180.html#l00143">NL3D::CPointLight::getAttenuationEnd()</a>, <a class="el" href="a05385.html#l00087">NLMISC::CAABBox::getMax()</a>, <a class="el" href="a05385.html#l00086">NLMISC::CAABBox::getMin()</a>, <a class="el" href="a06769.html#l00239">NL3D::CZoneLighter::CTriangle::getPlane()</a>, <a class="el" href="a06180.html#l00116">NL3D::CPointLight::getPosition()</a>, <a class="el" href="a06179.html#l00138">NL3D::CPointLight::getType()</a>, <a class="el" href="a02423.html#NL3D_1_1CCubeGrida4">NL3D::CCubeGrid< const CTriangle * >::insert()</a>, <a class="el" href="a06300.html#l00516">NL3D::CQuadGrid< T >::insert()</a>, <a class="el" href="a03273.html#NL3D_1_1CQuadGridz774_2">NL3D::CQuadGrid< CPointLightRT * >::insert()</a>, <a class="el" href="a05384.html#l00107">NLMISC::CAABBox::intersect()</a>, <a class="el" href="a06768.html#l00082">NL3D_ZONE_LIGHTER_CUBE_GRID_SIZE</a>, <a class="el" href="a06769.html#l00533">NL3D::CZoneLighter::CPointLightRT::PointLight</a>, <a class="el" href="a06769.html#l00342">progress()</a>, <a class="el" href="a05505.html#l00049">NLMISC::CBSphere::Radius</a>, <a class="el" href="a06769.html#l00541">NL3D::CZoneLighter::CPointLightRT::RefCount</a>, <a class="el" href="a06300.html#l00613">NL3D::CQuadGrid< T >::select()</a>, <a class="el" href="a05385.html#l00066">NLMISC::CAABBox::setCenter()</a>, <a class="el" href="a05385.html#l00067">NLMISC::CAABBox::setHalfSize()</a>, <a class="el" href="a05646.html#l00645">size</a>, <a class="el" href="a06769.html#l00225">NL3D::CZoneLighter::CTriangle::Triangle</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a06585.html#l00051">NLMISC::CTriangle::V0</a>, <a class="el" href="a06585.html#l00051">NLMISC::CTriangle::V1</a>, and <a class="el" href="a06585.html#l00051">NLMISC::CTriangle::V2</a>. +<p> +Referenced by <a class="el" href="a06768.html#l00920">light()</a>. +<p> +<div class="fragment"><pre>03203 { +03204 <a class="code" href="a04558.html#a15">uint</a> i; +03205 +03206 <span class="comment">// Fill the quadGrid of Lights.</span> +03207 <span class="comment">// ===========</span> +03208 <a class="code" href="a03739.html#NL3D_1_1CZoneLighterz1203_2">_StaticPointLightQuadGrid</a>.<a class="code" href="a03273.html#NL3D_1_1CQuadGridz772_1">create</a>(gridSize, gridCellSize); +03209 <span class="keywordflow">for</span>(i=0; i<<a class="code" href="a03739.html#NL3D_1_1CZoneLighterz1203_3">_StaticPointLights</a>.size();i++) +03210 { +03211 CPointLightRT &plRT= <a class="code" href="a03739.html#NL3D_1_1CZoneLighterz1203_3">_StaticPointLights</a>[i]; +03212 +03213 <span class="comment">// Compute the bbox of the light</span> +03214 CAABBox bbox; +03215 bbox.setCenter(plRT.BSphere.Center); +03216 <span class="keywordtype">float</span> hl= plRT.BSphere.Radius; +03217 bbox.setHalfSize(CVector(hl,hl,hl)); +03218 +03219 <span class="comment">// Insert the pointLight in the quadGrid.</span> +03220 <a class="code" href="a03739.html#NL3D_1_1CZoneLighterz1203_2">_StaticPointLightQuadGrid</a>.<a class="code" href="a03273.html#NL3D_1_1CQuadGridz774_2">insert</a>(bbox.getMin(), bbox.getMax(), &plRT); +03221 } +03222 +03223 +03224 <span class="comment">// Append triangles to cubeGrid ??</span> +03225 <span class="keywordflow">if</span>(doShadow) +03226 { +03227 <span class="comment">// Point lights ?</span> +03228 <span class="keywordflow">if</span> (!_StaticPointLights.empty ()) +03229 { +03230 <span class="comment">// For all obstacles, Fill a quadGrid.</span> +03231 <span class="comment">// ===========</span> +03232 CQuadGrid<CTriangle*> obstacleGrid; +03233 obstacleGrid.create(gridSize, gridCellSize); +03234 <a class="code" href="a04558.html#a15">uint</a> <a class="code" href="a04223.html#a587">size</a>= obstacles.size(); +03235 <span class="keywordflow">for</span>(i=0; i<<a class="code" href="a04223.html#a587">size</a>; i++) +03236 { +03237 <span class="comment">// bbox of triangle</span> +03238 CAABBox bbox; +03239 bbox.setCenter(obstacles[i].Triangle.V0); +03240 bbox.extend(obstacles[i].Triangle.V1); +03241 bbox.extend(obstacles[i].Triangle.V2); +03242 <span class="comment">// insert triangle in quadGrid.</span> +03243 obstacleGrid.insert(bbox.getMin(), bbox.getMax(), &obstacles[i]); +03244 } +03245 +03246 +03247 <span class="comment">// For all PointLights, fill his CubeGrid</span> +03248 <span class="comment">// ===========</span> +03249 <span class="keywordflow">for</span>(i=0; i<_StaticPointLights.size();i++) +03250 { +03251 <span class="comment">// progress</span> +03252 <a class="code" href="a03739.html#NL3D_1_1CZoneLightera8">progress</a> (<span class="stringliteral">"Compute Influences of PointLights"</span>, 0.5f*i / (<span class="keywordtype">float</span>)(_StaticPointLights.size()-1)); +03253 +03254 CPointLightRT &plRT= _StaticPointLights[i]; +03255 <span class="comment">// Create the cubeGrid</span> +03256 plRT.FaceCubeGrid.create(plRT.PointLight.getPosition(), <a class="code" href="a05345.html#a9">NL3D_ZONE_LIGHTER_CUBE_GRID_SIZE</a>); +03257 +03258 <span class="comment">// AmbiantLIghts: do nothing.</span> +03259 <span class="keywordflow">if</span>(plRT.PointLight.getType()!=CPointLight::AmbientLight) +03260 { +03261 <span class="comment">// Select only obstacle Faces around the light. Other are not usefull</span> +03262 CAABBox bbox; +03263 bbox.setCenter(plRT.PointLight.getPosition()); +03264 <span class="keywordtype">float</span> hl= plRT.PointLight.getAttenuationEnd(); +03265 bbox.setHalfSize(CVector(hl,hl,hl)); +03266 obstacleGrid.select(bbox.getMin(), bbox.getMax()); +03267 +03268 <span class="comment">// For all faces, fill the cubeGrid.</span> +03269 CQuadGrid<CTriangle*>::CIterator itObstacle; +03270 itObstacle= obstacleGrid.begin(); +03271 <span class="keywordflow">while</span>( itObstacle!=obstacleGrid.end() ) +03272 { +03273 CTriangle &tri= *(*itObstacle); +03274 +03275 <span class="comment">// Triangle bounding box</span> +03276 CAABBox triBbox; +03277 triBbox.setCenter (tri.Triangle.V0); +03278 triBbox.extend (tri.Triangle.V1); +03279 triBbox.extend (tri.Triangle.V2); +03280 +03281 <span class="comment">// Triangle in the light</span> +03282 <span class="keywordflow">if</span> (triBbox.intersect (bbox)) +03283 { +03284 <span class="comment">// Test BackFace culling. Only faces which are BackFace the point light are inserted.</span> +03285 <span class="comment">// This is to avoid AutoOccluding problems</span> +03286 <span class="keywordflow">if</span>( tri.getPlane() * plRT.BSphere.Center < 0) +03287 { +03288 <span class="comment">// Insert the triangle in the CubeGrid</span> +03289 plRT.FaceCubeGrid.insert( tri.Triangle, &tri); +03290 } +03291 } +03292 +03293 itObstacle++; +03294 } +03295 } +03296 +03297 <span class="comment">// Compile the CubeGrid.</span> +03298 plRT.FaceCubeGrid.compile(); +03299 +03300 <span class="comment">// And Reset RefCount.</span> +03301 plRT.RefCount= 0; +03302 } +03303 } +03304 } +03305 <span class="comment">// else, just build empty grid</span> +03306 <span class="keywordflow">else</span> +03307 { +03308 <span class="keywordflow">for</span>(i=0; i<_StaticPointLights.size();i++) +03309 { +03310 <span class="comment">// progress</span> +03311 <a class="code" href="a03739.html#NL3D_1_1CZoneLightera8">progress</a> (<span class="stringliteral">"Compute Influences of PointLights"</span>, 0.5f*i / (<span class="keywordtype">float</span>)(_StaticPointLights.size()-1)); +03312 +03313 CPointLightRT &plRT= _StaticPointLights[i]; +03314 <span class="comment">// Create a dummy empty cubeGrid => no rayTrace :)</span> +03315 plRT.FaceCubeGrid.create(plRT.PointLight.getPosition(), 4); +03316 +03317 <span class="comment">// Compile the CubeGrid.</span> +03318 plRT.FaceCubeGrid.compile(); +03319 +03320 <span class="comment">// And Reset RefCount.</span> +03321 plRT.RefCount= 0; +03322 } +03323 } +03324 +03325 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneLighterd4" doxytag="NL3D::CZoneLighter::computeTileFlagsForPositionTowardWater" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void CZoneLighter::computeTileFlagsForPositionTowardWater </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const <a class="el" href="a03741.html">CLightDesc</a> & </td> + <td class="mdname" nowrap> <em>lightDesc</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>std::vector< const <a class="el" href="a03476.html">CTessFace</a> * > & </td> + <td class="mdname" nowrap> <em>tessFaces</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +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. +<p> +Definition at line <a class="el" href="a06768.html#l03563">3563</a> of file <a class="el" href="a06768.html">zone_lighter.cpp</a>. +<p> +References <a class="el" href="a06769.html#l00607">_WaterShapeQuadGrid</a>, <a class="el" href="a06769.html#l00459">_ZoneToLight</a>, <a class="el" href="a06300.html#l00641">NL3D::CQuadGrid< T >::begin()</a>, <a class="el" href="a06300.html#l00567">NL3D::CQuadGrid< T >::clearSelection()</a>, <a class="el" href="a05587.html#l00141">NLMISC::contReset()</a>, <a class="el" href="a06300.html#l00646">NL3D::CQuadGrid< T >::end()</a>, <a class="el" href="a05384.html#l00215">NLMISC::CAABBox::extend()</a>, <a class="el" href="a05385.html#l00087">NLMISC::CAABBox::getMax()</a>, <a class="el" href="a06190.html#l01857">NLMISC::CPolygon2D::intersect()</a>, <a class="el" href="a05622.html#l00111">nlinfo</a>, <a class="el" href="a06769.html#l00342">progress()</a>, <a class="el" href="a06300.html#l00613">NL3D::CQuadGrid< T >::select()</a>, <a class="el" href="a05385.html#l00071">NLMISC::CAABBox::setMinMax()</a>, <a class="el" href="a06540.html#l00089">NL3D::CTileElement::setVegetableState()</a>, <a class="el" href="a06768.html#l03560">TTileOfPatchMap</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a06769.html#l00158">NL3D::CZoneLighter::CLightDesc::VegetableHeight</a>, <a class="el" href="a06191.html#l00055">NLMISC::CPolygon::Vertices</a>, <a class="el" href="a06191.html#l00126">NLMISC::CPolygon2D::Vertices</a>, <a class="el" href="a06673.html#l00051">NLMISC::CVector::x</a>, <a class="el" href="a06673.html#l00051">NLMISC::CVector::y</a>, <a class="el" href="a05646.html#l00236">z</a>, and <a class="el" href="a06673.html#l00051">NLMISC::CVector::z</a>. +<p> +Referenced by <a class="el" href="a06768.html#l02045">buildZoneInformation()</a>. +<p> +<div class="fragment"><pre>03566 { +03567 <a class="code" href="a04558.html#a15">uint</a> numTileAbove = 0; +03568 <a class="code" href="a04558.html#a15">uint</a> numTileBelow = 0; +03569 <a class="code" href="a04558.html#a15">uint</a> numTileIntersect = 0; +03570 +03572 <a class="code" href="a05345.html#a21">TTileOfPatchMap</a> tiles; +03573 +03575 <span class="comment">// First, build the bbox for all tiles //</span> +03577 <span class="comment"></span> +03578 <a class="code" href="a04558.html#a15">uint</a> triCount = 0, totalTriCount = tessFaces.size(); +03579 +03580 <a class="code" href="a04199.html#a1">nlinfo</a>(<span class="stringliteral">"Dealing with %d tessFaces"</span>, tessFaces.size()); +03581 <span class="keywordflow">for</span> (std::vector<const CTessFace*>::iterator it = tessFaces.begin(); it != tessFaces.end(); ++it, ++triCount) +03582 { +03584 <span class="keywordflow">if</span> ((*it)->Patch->getZone()->getZoneId() != <a class="code" href="a03739.html#NL3D_1_1CZoneLighterr39">_ZoneToLight</a>) <span class="keywordflow">continue</span>; +03586 <span class="keywordflow">if</span> ((*it)->Patch->Tiles[(*it)->TileId].getVegetableState() == CTileElement::VegetableDisabled) +03587 <span class="keywordflow">continue</span>; +03588 +03589 <a class="code" href="a03533.html">CTileOfPatch</a> top((*it)->TileId, (*it)->Patch); +03590 TTileOfPatchMap::iterator tileIt = tiles.find(top); +03591 +03593 <span class="keywordflow">if</span> (tileIt == tiles.end()) <span class="comment">// first time ?</span> +03594 { +03596 <a class="code" href="a02156.html">NLMISC::CAABBox</a> b; +03597 b.<a class="code" href="a02156.html#NLMISC_1_1CAABBoxz1902_3">setMinMax</a>((*it)->VBase->EndPos, (*it)->VLeft->EndPos); +03598 b.<a class="code" href="a02156.html#NLMISC_1_1CAABBoxExtz1902_0">extend</a>((*it)->VRight->EndPos); +03599 b.<a class="code" href="a02156.html#NLMISC_1_1CAABBoxExtz1902_0">extend</a>(b.<a class="code" href="a02156.html#NLMISC_1_1CAABBoxz1904_3">getMax</a>() + lightDesc.VegetableHeight * <a class="code" href="a03128.html#NLMISC_1_1CVectors2">NLMISC::CVector::K</a>); <span class="comment">// adds vegetable height </span> +03600 tiles[top] = b; +03601 } +03602 <span class="keywordflow">else</span> <span class="comment">// extends the bbox with the given face</span> +03603 { +03604 <a class="code" href="a02156.html">NLMISC::CAABBox</a> &b = tileIt->second; +03605 b.<a class="code" href="a02156.html#NLMISC_1_1CAABBoxExtz1902_0">extend</a>((*it)->VBase->EndPos); +03606 b.<a class="code" href="a02156.html#NLMISC_1_1CAABBoxExtz1902_0">extend</a>((*it)->VRight->EndPos); +03607 b.<a class="code" href="a02156.html#NLMISC_1_1CAABBoxExtz1902_0">extend</a>((*it)->VLeft->EndPos); +03608 } +03609 +03610 <span class="keywordflow">if</span> ((triCount % 100) == 0) +03611 { +03612 <a class="code" href="a03739.html#NL3D_1_1CZoneLightera8">progress</a>(<span class="stringliteral">"Building bbox from tiles"</span>, (<span class="keywordtype">float</span>) triCount / totalTriCount); +03613 } +03614 } +03615 +03616 <a class="code" href="a03739.html#NL3D_1_1CZoneLightera8">progress</a>(<span class="stringliteral">"Building bbox from tiles"</span>, 1.f); +03617 +03618 +03619 +03621 <span class="comment">// Now, check each tile bbox against water shapes //</span> +03623 <span class="comment"></span> <a class="code" href="a03100.html">NLMISC::CPolygon</a> waterPoly; +03624 <a class="code" href="a03101.html">NLMISC::CPolygon2D</a> tilePoly; +03625 tilePoly.<a class="code" href="a03101.html#NLMISC_1_1CPolygon2Do0">Vertices</a>.resize(4); +03626 +03627 <a class="code" href="a04558.html#a15">uint</a> tileCount = 0, totalTileCount = tiles.size(); +03628 +03629 <span class="keywordflow">for</span> (TTileOfPatchMap::iterator tileIt = tiles.begin(); tileIt != tiles.end(); ++tileIt, ++tileCount) +03630 { +03631 <span class="keyword">const</span> <a class="code" href="a03128.html">NLMISC::CVector</a> v0 = tileIt->second.getMin(); +03632 <span class="keyword">const</span> <a class="code" href="a03128.html">NLMISC::CVector</a> v1 = tileIt->second.getMax(); +03633 +03635 tilePoly.<a class="code" href="a03101.html#NLMISC_1_1CPolygon2Do0">Vertices</a>[0].set(v0.<a class="code" href="a03128.html#NLMISC_1_1CVectoro0">x</a>, v0.<a class="code" href="a03128.html#NLMISC_1_1CVectoro1">y</a>); +03636 tilePoly.<a class="code" href="a03101.html#NLMISC_1_1CPolygon2Do0">Vertices</a>[1].set(v1.<a class="code" href="a03128.html#NLMISC_1_1CVectoro0">x</a>, v0.<a class="code" href="a03128.html#NLMISC_1_1CVectoro1">y</a>); +03637 tilePoly.<a class="code" href="a03101.html#NLMISC_1_1CPolygon2Do0">Vertices</a>[2].set(v1.<a class="code" href="a03128.html#NLMISC_1_1CVectoro0">x</a>, v1.<a class="code" href="a03128.html#NLMISC_1_1CVectoro1">y</a>); +03638 tilePoly.<a class="code" href="a03101.html#NLMISC_1_1CPolygon2Do0">Vertices</a>[3].set(v0.<a class="code" href="a03128.html#NLMISC_1_1CVectoro0">x</a>, v1.<a class="code" href="a03128.html#NLMISC_1_1CVectoro1">y</a>); +03639 +03641 <a class="code" href="a03739.html#NL3D_1_1CZoneLighterr35">_WaterShapeQuadGrid</a>.<a class="code" href="a03273.html#NL3D_1_1CQuadGridz776_1">clearSelection</a>(); +03642 <a class="code" href="a03739.html#NL3D_1_1CZoneLighterr35">_WaterShapeQuadGrid</a>.<a class="code" href="a03273.html#NL3D_1_1CQuadGridz776_3">select</a>(tileIt->second.getMin(), tileIt->second.getMax()); +03643 +03644 CTileElement &te = tileIt->first.Patch->Tiles[tileIt->first.TileId]; <span class="comment">// alias to the current tile element</span> +03645 +03647 TWaterShapeQuadGrid::CIterator qgIt; +03648 <span class="keywordflow">for</span> (qgIt = <a class="code" href="a03739.html#NL3D_1_1CZoneLighterr35">_WaterShapeQuadGrid</a>.<a class="code" href="a03273.html#NL3D_1_1CQuadGridz776_0">begin</a>(); qgIt != <a class="code" href="a03739.html#NL3D_1_1CZoneLighterr35">_WaterShapeQuadGrid</a>.<a class="code" href="a03273.html#NL3D_1_1CQuadGridz776_2">end</a>(); ++qgIt) +03649 { +03650 +03651 (*qgIt)->getShapeInWorldSpace(waterPoly); +03652 <a class="code" href="a03101.html">NLMISC::CPolygon2D</a> poly(waterPoly); +03653 <span class="keywordflow">if</span> (poly.<a class="code" href="a03101.html#NLMISC_1_1CPolygon2Da11">intersect</a>(tilePoly)) <span class="comment">// above or below a water surface ? </span> +03654 { +03656 <span class="keywordtype">float</span> waterHeight = waterPoly.<a class="code" href="a03100.html#NLMISC_1_1CPolygono0">Vertices</a>[0].z; +03657 +03658 <span class="keywordflow">if</span> (v1.<a class="code" href="a03128.html#NLMISC_1_1CVectoro2">z</a> < waterHeight) +03659 { +03660 <span class="comment">// below</span> +03661 te.setVegetableState(CTileElement::UnderWater); +03662 <span class="comment">//nlassert(te.getVegetableState() == CTileElement::UnderWater);</span> +03663 ++ numTileBelow; +03664 } +03665 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (v0. <a class="code" href="a04223.html#a574">z</a> > waterHeight) +03666 { +03667 <span class="comment">// above</span> +03668 te.setVegetableState(CTileElement::AboveWater); +03669 <span class="comment">//nlassert(te.getVegetableState() == CTileElement::AboveWater);</span> +03670 ++ numTileAbove; +03671 } +03672 <span class="keywordflow">else</span> +03673 { +03674 <span class="comment">// intersect water</span> +03675 te.setVegetableState(CTileElement::IntersectWater); +03676 <span class="comment">//nlassert(te.getVegetableState() == CTileElement::IntersectWater);</span> +03677 ++ numTileIntersect; +03678 } +03679 <span class="keywordflow">break</span>; +03680 } +03681 } +03682 +03683 <span class="keywordflow">if</span> (qgIt == <a class="code" href="a03739.html#NL3D_1_1CZoneLighterr35">_WaterShapeQuadGrid</a>.<a class="code" href="a03273.html#NL3D_1_1CQuadGridz776_2">end</a>()) <span class="comment">// no intersection found ? if yes it's above water</span> +03684 { +03685 te.setVegetableState(CTileElement::AboveWater); +03686 <span class="comment">//nlassert(te.getVegetableState() == CTileElement::AboveWater);</span> +03687 ++ numTileAbove; +03688 } +03689 +03690 <span class="keywordflow">if</span> ((tileCount % 50) == 0) +03691 { +03692 <a class="code" href="a03739.html#NL3D_1_1CZoneLightera8">progress</a>(<span class="stringliteral">"Computing tile position towards water"</span>, (<span class="keywordtype">float</span>) tileCount / totalTileCount); +03693 } +03694 } +03695 +03696 <a class="code" href="a03739.html#NL3D_1_1CZoneLightera8">progress</a>(<span class="stringliteral">"Computing tile position towards water"</span>, 1.f); +03697 +03698 <a class="code" href="a04199.html#a1">nlinfo</a>(<span class="stringliteral">" %d tiles are above water."</span>, numTileAbove); +03699 <a class="code" href="a04199.html#a1">nlinfo</a>(<span class="stringliteral">" %d tiles are below water."</span>, numTileBelow); +03700 <a class="code" href="a04199.html#a1">nlinfo</a>(<span class="stringliteral">" %d tiles intersect water."</span>, numTileIntersect); +03701 +03702 +03703 +03705 <a class="code" href="a05378.html#a381">NLMISC::contReset</a>(_WaterShapeQuadGrid); +03706 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneLighterh0" doxytag="NL3D::CZoneLighter::copyTileFlags" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void CZoneLighter::copyTileFlags </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a03730.html">CZone</a> & </td> + <td class="mdname" nowrap> <em>destZone</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const <a class="el" href="a03730.html">CZone</a> & </td> + <td class="mdname" nowrap> <em>srcZone</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [static, private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +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... +<p> +Definition at line <a class="el" href="a06768.html#l01261">1261</a> of file <a class="el" href="a06768.html">zone_lighter.cpp</a>. +<p> +References <a class="el" href="a06758.html#l01542">NL3D::CZone::copyTilesFlags()</a>, <a class="el" href="a06760.html#l00489">NL3D::CZone::getNumPatchs()</a>, <a class="el" href="a06760.html#l00499">NL3D::CZone::getPatch()</a>, <a class="el" href="a06760.html#l00488">NL3D::CZone::getZoneId()</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, and <a class="el" href="a05981.html#l00104">sint</a>. +<p> +Referenced by <a class="el" href="a06768.html#l00920">light()</a>. +<p> +<div class="fragment"><pre>01262 { +01263 <a class="code" href="a04199.html#a6">nlassert</a>(destZone.getZoneId() == srcZone.getZoneId()); +01264 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a14">sint</a> k = 0; k < srcZone.getNumPatchs(); ++k) +01265 { +01266 destZone.copyTilesFlags(k, srcZone.getPatch(k)); +01267 } +01268 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneLighterd5" doxytag="NL3D::CZoneLighter::excludeAllPatchFromRefineAll" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void CZoneLighter::excludeAllPatchFromRefineAll </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a02702.html">CLandscape</a> & </td> + <td class="mdname" nowrap> <em>landscape</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>std::vector< <a class="el" href="a04558.html#a15">uint</a> > & </td> + <td class="mdname" nowrap> <em>listZone</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>bool </td> + <td class="mdname" nowrap> <em>exclude</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06768.html#l01985">1985</a> of file <a class="el" href="a06768.html">zone_lighter.cpp</a>. +<p> +References <a class="el" href="a05862.html#l00760">NL3D::CLandscape::excludePatchFromRefineAll()</a>, <a class="el" href="a06760.html#l00489">NL3D::CZone::getNumPatchs()</a>, <a class="el" href="a05862.html#l02206">NL3D::CLandscape::getZone()</a>, and <a class="el" href="a05981.html#l00105">uint</a>. +<p> +Referenced by <a class="el" href="a06768.html#l01613">addTriangles()</a>. +<p> +<div class="fragment"><pre>01986 { +01987 <span class="comment">// For each zone</span> +01988 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a15">uint</a> zone=0; zone<listZone.size(); zone++) +01989 { +01990 <span class="comment">// Get num patches</span> +01991 <a class="code" href="a04558.html#a15">uint</a> patchCount=landscape.getZone(listZone[zone])->getNumPatchs(); +01992 +01993 <span class="comment">// For each patches</span> +01994 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a15">uint</a> patch=0; patch<patchCount; patch++) +01995 { +01996 <span class="comment">// Exclude all the patches from refine all</span> +01997 landscape.excludePatchFromRefineAll (listZone[zone], patch, exclude); +01998 } +01999 } +02000 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneLighterd6" doxytag="NL3D::CZoneLighter::getAPatch" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a15">uint</a> CZoneLighter::getAPatch </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a04558.html#a15">uint</a> </td> + <td class="mdname1" valign="top" nowrap> <em>process</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06768.html#l03726">3726</a> of file <a class="el" href="a06768.html">zone_lighter.cpp</a>. +<p> +References <a class="el" href="a06769.html#l00467">_LastPatchComputed</a>, <a class="el" href="a06769.html#l00468">_NumberOfPatchComputed</a>, <a class="el" href="a06769.html#l00466">_PatchComputed</a>, <a class="el" href="a06769.html#l00504">_PatchInfo</a>, <a class="el" href="a05646.html#l00225">index</a>, and <a class="el" href="a05981.html#l00105">uint</a>. +<p> +Referenced by <a class="el" href="a06768.html#l01293">processCalc()</a>. +<p> +<div class="fragment"><pre>03727 { +03728 <span class="comment">// Accessor</span> +03729 CSynchronized<std::vector<bool> >::CAccessor access (&_PatchComputed); +03730 +03731 <span class="comment">// Current index</span> +03732 <a class="code" href="a04558.html#a15">uint</a> <a class="code" href="a04223.html#a566">index</a> = <a class="code" href="a03739.html#NL3D_1_1CZoneLighterr15">_LastPatchComputed</a>[process]; +03733 <a class="code" href="a04558.html#a15">uint</a> firstIndex = <a class="code" href="a04223.html#a566">index</a>; +03734 +03735 <span class="keywordflow">if</span> (access.value().size() == 0) +03736 <span class="comment">// no more patches</span> +03737 <span class="keywordflow">return</span> 0xffffffff; +03738 +03739 <span class="keywordflow">while</span> (access.value()[<a class="code" href="a04223.html#a566">index</a>]) +03740 { +03741 <span class="comment">// Next patch</span> +03742 <a class="code" href="a04223.html#a566">index</a>++; +03743 +03744 <span class="comment">// Last patch ?</span> +03745 <span class="keywordflow">if</span> (<a class="code" href="a04223.html#a566">index</a> == <a class="code" href="a03739.html#NL3D_1_1CZoneLighterr25">_PatchInfo</a>.size()) +03746 <a class="code" href="a04223.html#a566">index</a> = 0; +03747 +03748 <span class="comment">// First ?</span> +03749 <span class="keywordflow">if</span> (firstIndex == <a class="code" href="a04223.html#a566">index</a>) +03750 <span class="comment">// no more patches</span> +03751 <span class="keywordflow">return</span> 0xffffffff; +03752 } +03753 +03754 <span class="comment">// Visited</span> +03755 access.value()[<a class="code" href="a04223.html#a566">index</a>] = <span class="keyword">true</span>; +03756 +03757 <span class="comment">// Last index</span> +03758 _LastPatchComputed[process] = <a class="code" href="a04223.html#a566">index</a>; +03759 <a class="code" href="a03739.html#NL3D_1_1CZoneLighterr20">_NumberOfPatchComputed</a>++; +03760 +03761 <span class="comment">// Return the index</span> +03762 <span class="keywordflow">return</span> <a class="code" href="a04223.html#a566">index</a>; +03763 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneLighterd7" doxytag="NL3D::CZoneLighter::getMaxPhi" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a7">uint8</a> CZoneLighter::getMaxPhi </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a04558.html#a14">sint</a> </td> + <td class="mdname" nowrap> <em>s</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a14">sint</a> </td> + <td class="mdname" nowrap> <em>t</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a14">sint</a> </td> + <td class="mdname" nowrap> <em>deltaS</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a14">sint</a> </td> + <td class="mdname" nowrap> <em>deltaT</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>float </td> + <td class="mdname" nowrap> <em>heightPos</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"> const<code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06768.html#l01390">1390</a> of file <a class="el" href="a06768.html">zone_lighter.cpp</a>. +<p> +References <a class="el" href="a06769.html#l00495">_HeightFieldCellCount</a>, <a class="el" href="a06769.html#l00497">_HeightfieldCellSize</a>, <a class="el" href="a05587.html#l00115">NLMISC::clamp()</a>, <a class="el" href="a05646.html#l01013">height</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a05587.html#l00079">NLMISC::Pi</a>, <a class="el" href="a05646.html#l01119">res</a>, <a class="el" href="a05646.html#l00977">s</a>, <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a05646.html#l00985">t</a>, and <a class="el" href="a05981.html#l00096">uint8</a>. +<p> +Referenced by <a class="el" href="a06768.html#l00296">calcSkyContribution()</a>. +<p> +<div class="fragment"><pre>01391 { +01392 <span class="comment">// Start position</span> +01393 <a class="code" href="a04223.html#a626">s</a>+=deltaS; +01394 <a class="code" href="a04223.html#a627">t</a>+=deltaT; +01395 +01396 <span class="comment">// Distance increment</span> +01397 <span class="keywordtype">float</span> stepDistance=CVector (deltaS*_HeightfieldCellSize, deltaT*_HeightfieldCellSize,0).norm (); +01398 +01399 <span class="comment">// Current distance</span> +01400 <span class="keywordtype">float</span> distance=stepDistance; +01401 +01402 <span class="comment">// Max height</span> +01403 <span class="keywordtype">float</span> maxHeight=0; +01404 <span class="keywordtype">float</span> maxTanTeta=0; +01405 +01406 <span class="comment">// For all the line</span> +01407 <span class="keywordflow">while</span> ((<a class="code" href="a04223.html#a626">s<_HeightFieldCellCount)&&(t<_HeightFieldCellCount)&&(s></a>=0)&&(<a class="code" href="a04223.html#a627">t</a>>=0)) +01408 { +01409 <span class="comment">// Get height</span> +01410 <span class="keywordtype">float</span> <a class="code" href="a04223.html#a633">height</a>=<a class="code" href="a03739.html#NL3D_1_1CZoneLighterr10">_HeightField</a>[<a class="code" href="a04223.html#a626">s</a>+<a class="code" href="a04223.html#a627">t</a>*<a class="code" href="a03739.html#NL3D_1_1CZoneLighterr11">_HeightFieldCellCount</a>]; +01411 <a class="code" href="a04223.html#a633">height</a>-=heightPos; +01412 +01413 <span class="comment">// Better ?</span> +01414 <span class="keywordflow">if</span> (<a class="code" href="a04223.html#a633">height</a>>maxHeight) +01415 { +01416 <span class="comment">// Calc sin teta</span> +01417 <span class="keywordtype">float</span> tanTeta=<a class="code" href="a04223.html#a633">height</a>/distance; +01418 <a class="code" href="a04199.html#a6">nlassert</a> (tanTeta>=0); +01419 +01420 <span class="comment">// Better ?</span> +01421 <span class="keywordflow">if</span> (tanTeta>maxTanTeta) +01422 { +01423 <span class="comment">// New max height</span> +01424 maxHeight=<a class="code" href="a04223.html#a633">height</a>; +01425 maxTanTeta=tanTeta; +01426 } +01427 } +01428 <a class="code" href="a04223.html#a626">s</a>+=deltaS; +01429 <a class="code" href="a04223.html#a627">t</a>+=deltaT; +01430 distance+=stepDistance; +01431 } +01432 +01433 <span class="comment">// return phi</span> +01434 <span class="keywordtype">float</span> teta=(<span class="keywordtype">float</span>)atan (maxTanTeta); +01435 <a class="code" href="a04199.html#a6">nlassert</a> (teta>=0); +01436 <a class="code" href="a04199.html#a6">nlassert</a> (teta<=Pi/2); +01437 <a class="code" href="a05378.html#a374">clamp</a> (teta, 0.f, (<span class="keywordtype">float</span>)Pi/2); +01438 <a class="code" href="a04558.html#a14">sint</a> <a class="code" href="a04223.html#a643">res</a>=(<a class="code" href="a04558.html#a14">sint</a>)((<a class="code" href="a05378.html#a44">Pi</a>/2-teta)*256/(<a class="code" href="a05378.html#a44">Pi</a>/2)); +01439 <a class="code" href="a05378.html#a374">clamp</a> (res, 0, 255); +01440 <span class="keywordflow">return</span> (<a class="code" href="a04558.html#a7">uint8</a>)<a class="code" href="a04223.html#a643">res</a>; +01441 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneLighterd8" doxytag="NL3D::CZoneLighter::getNormal" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void CZoneLighter::getNormal </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const <a class="el" href="a03057.html">NL3D::CPatch</a> * </td> + <td class="mdname" nowrap> <em>pPatch</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a8">sint16</a> </td> + <td class="mdname" nowrap> <em>lumelS</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a8">sint16</a> </td> + <td class="mdname" nowrap> <em>lumelT</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>std::vector< <a class="el" href="a03070.html">NL3D::CPatchUVLocator</a> > & </td> + <td class="mdname" nowrap> <em>locator</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const std::vector< <a class="el" href="a03058.html">NL3D::CPatch::CBindInfo</a> > & </td> + <td class="mdname" nowrap> <em>bindInfo</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const std::vector< bool > & </td> + <td class="mdname" nowrap> <em>binded</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>std::set< <a class="el" href="a04558.html#a13">uint64</a> > & </td> + <td class="mdname" nowrap> <em>visited</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>float </td> + <td class="mdname" nowrap> <em>deltaS</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>float </td> + <td class="mdname" nowrap> <em>deltaT</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a15">uint</a> </td> + <td class="mdname" nowrap> <em>rotation</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const <a class="el" href="a02258.html">NL3D::CBezierPatch</a> & </td> + <td class="mdname" nowrap> <em>bezierPatch</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a15">uint</a> </td> + <td class="mdname" nowrap> <em>lastEdge</em> = 5</td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06768.html#l01506">1506</a> of file <a class="el" href="a06768.html">zone_lighter.cpp</a>. +<p> +References <a class="el" href="a06769.html#l00508">_BezierPatch</a>, <a class="el" href="a06769.html#l00511">_Binded</a>, <a class="el" href="a06769.html#l00510">_BindInfo</a>, <a class="el" href="a06768.html#l01501">_GetNormalDeltaS</a>, <a class="el" href="a06768.html#l01502">_GetNormalDeltaT</a>, <a class="el" href="a06769.html#l00517">_GetNormalNormal</a>, <a class="el" href="a06769.html#l00509">_Locator</a>, <a class="el" href="a06769.html#l00513">_ZoneId</a>, <a class="el" href="a05478.html#l00187">NL3D::CBezierPatch::evalNormal()</a>, <a class="el" href="a06156.html#l00392">NL3D::CPatch::getOrderS()</a>, <a class="el" href="a06156.html#l00393">NL3D::CPatch::getOrderT()</a>, <a class="el" href="a06156.html#l00398">NL3D::CPatch::getPatchId()</a>, <a class="el" href="a06156.html#l00579">NL3D::CPatch::getSmoothFlag()</a>, <a class="el" href="a06156.html#l00391">NL3D::CPatch::getZone()</a>, <a class="el" href="a06760.html#l00488">NL3D::CZone::getZoneId()</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a05981.html#l00097">sint16</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a05981.html#l00098">uint16</a>, <a class="el" href="a05981.html#l00102">uint64</a>, <a class="el" href="a06677.html#l00052">NLMISC::CVector2f::x</a>, and <a class="el" href="a06677.html#l00052">NLMISC::CVector2f::y</a>. +<p> +Referenced by <a class="el" href="a06768.html#l02045">buildZoneInformation()</a>. +<p> +<div class="fragment"><pre>01509 { +01510 <span class="comment">// Build a desc srructure</span> +01511 <a class="code" href="a04558.html#a13">uint64</a> <span class="keywordtype">id</span>=(<a class="code" href="a04558.html#a13">uint64</a>)lumelS|(((<a class="code" href="a04558.html#a13">uint64</a>)lumelT)<<16)|(((<a class="code" href="a04558.html#a13">uint64</a>)pPatch-><a class="code" href="a03057.html#NL3D_1_1CPatcha18">getPatchId</a>())<<32)|(((<a class="code" href="a04558.html#a13">uint64</a>)pPatch-><a class="code" href="a03057.html#NL3D_1_1CPatcha20">getZone</a>()->getZoneId())<<48); +01512 +01513 <span class="comment">// Insert it</span> +01514 <span class="keywordflow">if</span> (visited.insert (<span class="keywordtype">id</span>).second) +01515 { +01516 <span class="comment">// Clip</span> +01517 <span class="keywordtype">float</span> sqDist=deltaS*deltaS+deltaT*deltaT; +01518 <span class="keywordflow">if</span> ( sqDist < 1 ) +01519 { +01520 <span class="comment">// Continue...</span> +01521 +01522 <a class="code" href="a04558.html#a14">sint</a> orderSx4=pPatch-><a class="code" href="a03057.html#NL3D_1_1CPatcha16">getOrderS</a>()<<2; +01523 <a class="code" href="a04558.html#a14">sint</a> orderTx4=pPatch-><a class="code" href="a03057.html#NL3D_1_1CPatcha17">getOrderT</a>()<<2; +01524 +01525 <a class="code" href="a04558.html#a8">sint16</a> _GetNormalBorderS[4]={ 0, -10, 1, -10 }; +01526 <a class="code" href="a04558.html#a8">sint16</a> _GetNormalBorderT[4]={ -10, 1, -10, 0 }; +01527 _GetNormalBorderS[2]=orderSx4-1; +01528 _GetNormalBorderT[1]=orderTx4-1; +01529 +01530 <span class="comment">// Add normal</span> +01531 <a class="code" href="a03739.html#NL3D_1_1CZoneLighterr6">_GetNormalNormal</a>+=bezierPatch.<a class="code" href="a02258.html#NL3D_1_1CBezierPatcha4">evalNormal</a> ( ((<span class="keywordtype">float</span>)lumelS+0.5f)/(<span class="keywordtype">float</span>)orderSx4, ((<span class="keywordtype">float</span>)lumelT+0.5f)/(<span class="keywordtype">float</span>)orderTx4 ); +01532 +01533 <span class="comment">// For the four neighbors</span> +01534 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a15">uint</a> edge=0; edge<4; edge++) +01535 { +01536 <span class="comment">// Not last edge ?</span> +01537 <span class="keywordflow">if</span> (edge!=lastEdge) +01538 { +01539 <span class="comment">// Direction</span> +01540 <a class="code" href="a04558.html#a15">uint</a> globalDirection=(edge+(4-rotation))&0x3; +01541 +01542 <span class="comment">// Neighbor</span> +01543 <span class="keywordflow">if</span> ( (lumelS==_GetNormalBorderS[edge]) || (lumelT==_GetNormalBorderT[edge]) ) +01544 { +01545 <span class="comment">// Binded ?</span> +01546 <span class="keywordtype">bool</span> bind=binded[edge]; +01547 <span class="keywordtype">bool</span> smooth=pPatch-><a class="code" href="a03057.html#NL3D_1_1CPatchz641_0">getSmoothFlag</a> (edge); +01548 <span class="keywordflow">if</span> (bind&&smooth) +01549 { +01550 <span class="comment">// Lumel coord</span> +01551 <a class="code" href="a03660.html">CVector2f</a> lumelCoord ( ((<span class="keywordtype">float</span>)(lumelS+_GetNormalDeltaS[edge])+0.5f)/4, +01552 ((<span class="keywordtype">float</span>)(lumelT+_GetNormalDeltaT[edge])+0.5f)/4 ); +01553 +01554 <span class="comment">// Get neighbor pixel</span> +01555 <a class="code" href="a04558.html#a15">uint</a> otherPatch=locator[edge].selectPatch(lumelCoord); +01556 +01557 <span class="comment">// Get uv</span> +01558 <a class="code" href="a03660.html">CVector2f</a> neighborUV; +01559 CPatch *patchOut; +01560 locator[edge].locateUV (lumelCoord, otherPatch, patchOut, neighborUV); +01561 +01562 <span class="comment">// New coordinates</span> +01563 <a class="code" href="a04558.html#a8">sint16</a> newLumelS=(<a class="code" href="a04558.html#a8">sint16</a>)(4.f*neighborUV.<a class="code" href="a03660.html#NLMISC_1_1CVector2fo0">x</a>); +01564 <a class="code" href="a04558.html#a8">sint16</a> newLumelT=(<a class="code" href="a04558.html#a8">sint16</a>)(4.f*neighborUV.<a class="code" href="a03660.html#NLMISC_1_1CVector2fo1">y</a>); +01565 +01566 <span class="comment">// Zone id</span> +01567 <a class="code" href="a04558.html#a9">uint16</a> patchId=patchOut->getPatchId(); +01568 <a class="code" href="a04558.html#a9">uint16</a> zoneId=<a class="code" href="a03739.html#NL3D_1_1CZoneLighterr38">_ZoneId</a>[patchOut->getZone()->getZoneId ()]; +01569 +01570 <span class="comment">// Get edge</span> +01571 <a class="code" href="a04558.html#a15">uint</a> newEdge=0; +01572 <a class="code" href="a04558.html#a15">uint</a> i; +01573 <span class="keywordflow">for</span> (i=0; i<=(<a class="code" href="a04558.html#a15">uint</a>)bindInfo[edge].NPatchs; i++) +01574 { +01575 <span class="comment">// Good patch ?</span> +01576 <span class="keywordflow">if</span> (bindInfo[edge].Next[i]==patchOut) +01577 { +01578 <span class="comment">// Get its edge</span> +01579 newEdge=bindInfo[edge].Edge[i]; +01580 <span class="keywordflow">break</span>; +01581 } +01582 } +01583 +01584 <span class="comment">// Rotation </span> +01585 <a class="code" href="a04558.html#a15">uint</a> newRotation=(2-edge+rotation+newEdge)&0x3; +01586 +01587 <span class="comment">// Must found it</span> +01588 <a class="code" href="a04199.html#a6">nlassert</a> (i!=(<a class="code" href="a04558.html#a15">uint</a>)bindInfo[edge].NPatchs); +01589 +01590 <span class="comment">// Get the bezier patch</span> +01591 CBezierPatch &NewBezierPatch=<a class="code" href="a03739.html#NL3D_1_1CZoneLighterr0">_BezierPatch</a>[zoneId][patchId]; +01592 +01593 <span class="comment">// Next lumel</span> +01594 <a class="code" href="a03739.html#NL3D_1_1CZoneLighterd8">getNormal</a> (patchOut, newLumelS, newLumelT, _Locator[zoneId][patchId], _BindInfo[zoneId][patchId], +01595 _Binded[zoneId][patchId], visited, deltaS+_GetNormalDeltaS[globalDirection], +01596 deltaT+_GetNormalDeltaT[globalDirection], newRotation, NewBezierPatch, newEdge); +01597 } +01598 } +01599 <span class="keywordflow">else</span> +01600 { +01601 <span class="comment">// Left internal</span> +01602 <a class="code" href="a03739.html#NL3D_1_1CZoneLighterd8">getNormal</a> (pPatch, lumelS+_GetNormalDeltaS[edge], lumelT+_GetNormalDeltaT[edge], locator, bindInfo, binded, visited, +01603 deltaS+_GetNormalDeltaS[globalDirection], deltaT+_GetNormalDeltaT[globalDirection], rotation, bezierPatch, (edge+2)&0x3); +01604 } +01605 } +01606 } +01607 } +01608 } +01609 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneLighterd9" doxytag="NL3D::CZoneLighter::getPatchNormalAndPositions" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NL3D::CZoneLighter::getPatchNormalAndPositions </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">std::vector< <a class="el" href="a03744.html">CLumelDescriptor</a> > & </td> + <td class="mdname" nowrap> <em>lumels</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a02702.html">CLandscape</a> & </td> + <td class="mdname" nowrap> <em>landscape</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a15">uint</a> </td> + <td class="mdname" nowrap> <em>zoneToLight</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a15">uint</a> </td> + <td class="mdname" nowrap> <em>patch</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a03070.html">CPatchUVLocator</a> * </td> + <td class="mdname" nowrap> <em>locator</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>bool * </td> + <td class="mdname" nowrap> <em>binded</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneLighterd10" doxytag="NL3D::CZoneLighter::getSkyContribution" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> float CZoneLighter::getSkyContribution </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const <a class="el" href="a03128.html">CVector</a> & </td> + <td class="mdname" nowrap> <em>pos</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const <a class="el" href="a03128.html">CVector</a> & </td> + <td class="mdname" nowrap> <em>normal</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>float </td> + <td class="mdname" nowrap> <em>SkyIntensity</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"> const<code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +compute the sky contribution at the given position +<p> + +<p> +Definition at line <a class="el" href="a06768.html#l01271">1271</a> of file <a class="el" href="a06768.html">zone_lighter.cpp</a>. +<p> +References <a class="el" href="a06769.html#l00497">_HeightfieldCellSize</a>, <a class="el" href="a06769.html#l00496">_OrigineHeightField</a>, <a class="el" href="a06768.html#l00296">calcSkyContribution()</a>, <a class="el" href="a05646.html#l00977">s</a>, <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a05646.html#l00985">t</a>, <a class="el" href="a06673.html#l00051">NLMISC::CVector::x</a>, <a class="el" href="a06673.html#l00051">NLMISC::CVector::y</a>, and <a class="el" href="a06673.html#l00051">NLMISC::CVector::z</a>. +<p> +Referenced by <a class="el" href="a06768.html#l02927">lightWater()</a>, and <a class="el" href="a06768.html#l01293">processCalc()</a>. +<p> +<div class="fragment"><pre>01272 { +01273 <span class="keywordtype">float</span> <a class="code" href="a04223.html#a626">s</a>=(pos.x-<a class="code" href="a03739.html#NL3D_1_1CZoneLighterr22">_OrigineHeightField</a>.<a class="code" href="a03128.html#NLMISC_1_1CVectoro0">x</a>)/<a class="code" href="a03739.html#NL3D_1_1CZoneLighterr12">_HeightfieldCellSize</a>; +01274 <span class="keywordtype">float</span> <a class="code" href="a04223.html#a627">t</a>=(pos.y-<a class="code" href="a03739.html#NL3D_1_1CZoneLighterr22">_OrigineHeightField</a>.<a class="code" href="a03128.html#NLMISC_1_1CVectoro1">y</a>)/<a class="code" href="a03739.html#NL3D_1_1CZoneLighterr12">_HeightfieldCellSize</a>; +01275 <a class="code" href="a04558.html#a14">sint</a> sInt=(<a class="code" href="a04558.html#a14">sint</a>)(floor (s+0.5f)); +01276 <a class="code" href="a04558.html#a14">sint</a> tInt=(<a class="code" href="a04558.html#a14">sint</a>)(floor (t+0.5f)); +01277 +01278 <span class="comment">// Bilinear</span> +01279 <span class="keywordtype">float</span> skyContributionTab[2][2]; +01280 skyContributionTab[0][0] = <a class="code" href="a03739.html#NL3D_1_1CZoneLighterd3">calcSkyContribution</a> (sInt-1, tInt-1, pos.z, skyIntensity, normal); +01281 skyContributionTab[1][0] = <a class="code" href="a03739.html#NL3D_1_1CZoneLighterd3">calcSkyContribution</a> (sInt, tInt-1, pos.z, skyIntensity, normal); +01282 skyContributionTab[1][1] = <a class="code" href="a03739.html#NL3D_1_1CZoneLighterd3">calcSkyContribution</a> (sInt, tInt, pos.z, skyIntensity, normal); +01283 skyContributionTab[0][1] = <a class="code" href="a03739.html#NL3D_1_1CZoneLighterd3">calcSkyContribution</a> (sInt-1, tInt, pos.z, skyIntensity, normal); +01284 +01285 <span class="keywordtype">float</span> sFact=<a class="code" href="a04223.html#a626">s</a>+0.5f-sInt; +01286 <span class="keywordtype">float</span> tFact=<a class="code" href="a04223.html#a627">t</a>+0.5f-tInt; +01287 <span class="keywordflow">return</span> (skyContributionTab[0][0]*(1.f-sFact) + skyContributionTab[1][0]*sFact)*(1.f-tFact) + +01288 (skyContributionTab[0][1]*(1.f-sFact) + skyContributionTab[1][1]*sFact)*tFact; +01289 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneLighterd11" doxytag="NL3D::CZoneLighter::getTexture" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool CZoneLighter::getTexture </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const <a class="el" href="a02839.html">CMaterial</a> & </td> + <td class="mdname" nowrap> <em>material</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a02268.html">NLMISC::CBitmap</a> *& </td> + <td class="mdname" nowrap> <em>result</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>bool & </td> + <td class="mdname" nowrap> <em>clampU</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>bool & </td> + <td class="mdname" nowrap> <em>clampV</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a7">uint8</a> & </td> + <td class="mdname" nowrap> <em>alphaTestThreshold</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>bool & </td> + <td class="mdname" nowrap> <em>doubleSided</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06768.html#l01820">1820</a> of file <a class="el" href="a06768.html">zone_lighter.cpp</a>. +<p> +References <a class="el" href="a06769.html#l00474">_Bitmaps</a>, <a class="el" href="a05587.html#l00115">NLMISC::clamp()</a>, <a class="el" href="a05486.html#l00926">NLMISC::CBitmap::convertToType()</a>, <a class="el" href="a06506.html#l00309">NL3D::ITexture::generate()</a>, <a class="el" href="a05969.html#l00314">NL3D::CMaterial::getAlphaTest()</a>, <a class="el" href="a05969.html#l00320">NL3D::CMaterial::getAlphaTestThreshold()</a>, <a class="el" href="a05969.html#l00278">NL3D::CMaterial::getBlend()</a>, <a class="el" href="a05969.html#l00308">NL3D::CMaterial::getDoubleSided()</a>, <a class="el" href="a06506.html#l00338">NL3D::ITexture::getShareName()</a>, <a class="el" href="a05641.html#l00046">NL3D::CMaterial::getTexture()</a>, <a class="el" href="a06506.html#l00204">NL3D::ITexture::getWrapS()</a>, <a class="el" href="a06506.html#l00205">NL3D::ITexture::getWrapT()</a>, <a class="el" href="a06506.html#l00327">NL3D::ITexture::release()</a>, <a class="el" href="a06506.html#l00332">NL3D::ITexture::supportSharing()</a>, and <a class="el" href="a05981.html#l00096">uint8</a>. +<p> +Referenced by <a class="el" href="a06768.html#l01717">addTriangles()</a>. +<p> +<div class="fragment"><pre>01821 { +01822 <span class="comment">// Texture informations, not NULL only if texture is used for alpha test</span> +01823 result = NULL; +01824 clampU = <span class="keyword">false</span>; +01825 clampV = <span class="keyword">false</span>; +01826 +01827 <span class="comment">// Alpha test threashold</span> +01828 <span class="keywordtype">float</span> alphaTestThresholdF = material.getAlphaTestThreshold () * 255; +01829 <a class="code" href="a05378.html#a374">clamp</a> (alphaTestThresholdF, 0.f, 255.f); +01830 alphaTestThreshold = (<a class="code" href="a04558.html#a7">uint8</a>)alphaTestThresholdF; +01831 +01832 <span class="comment">// Drawable material ?</span> +01833 <span class="keywordflow">if</span> (material.getBlend ()) +01834 <span class="keywordflow">return</span> <span class="keyword">false</span>; +01835 +01836 <span class="comment">// Use alpha test ?</span> +01837 <span class="keywordflow">if</span> (material.getAlphaTest ()) +01838 { +01839 <span class="comment">// Get the texture</span> +01840 ITexture *texture = material.getTexture (0); +01841 +01842 <span class="comment">// Is texture shared ?</span> +01843 <span class="keywordflow">if</span> (texture && texture->supportSharing ()) +01844 { +01845 <span class="comment">// Share name</span> +01846 string name = texture->getShareName(); +01847 +01848 <span class="comment">// Texture exist ?</span> +01849 std::map<string, NLMISC::CBitmap>::iterator ite = <a class="code" href="a03739.html#NL3D_1_1CZoneLighterr3">_Bitmaps</a>.find (name); +01850 <span class="keywordflow">if</span> (ite != <a class="code" href="a03739.html#NL3D_1_1CZoneLighterr3">_Bitmaps</a>.end ()) +01851 { +01852 <span class="comment">// Yes</span> +01853 result = &(ite->second); +01854 } +01855 <span class="keywordflow">else</span> +01856 { +01857 <span class="comment">// No, add it</span> +01858 ite = <a class="code" href="a03739.html#NL3D_1_1CZoneLighterr3">_Bitmaps</a>.insert (std::map<string, NLMISC::CBitmap>::value_type (name, <a class="code" href="a02268.html">CBitmap</a>())).first; +01859 result = &(ite->second); +01860 +01861 <span class="comment">// Generate the texture</span> +01862 texture->generate (); +01863 +01864 <span class="comment">// Convert to RGBA</span> +01865 texture->convertToType (CBitmap::RGBA); +01866 +01867 <span class="comment">// Copy it</span> +01868 *result = *texture; +01869 +01870 <span class="comment">// Release the texture</span> +01871 texture->release (); +01872 } +01873 +01874 <span class="comment">// Wrap flags</span> +01875 clampU = texture->getWrapS () == ITexture::Clamp; +01876 clampV = texture->getWrapT () == ITexture::Clamp; +01877 } +01878 } +01879 +01880 <span class="comment">// Get double sided flag</span> +01881 doubleSided = material.getDoubleSided (); +01882 <span class="keywordflow">return</span> <span class="keyword">true</span>; +01883 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneLightera6" doxytag="NL3D::CZoneLighter::init" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void CZoneLighter::init </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06768.html#l00251">251</a> of file <a class="el" href="a06768.html">zone_lighter.cpp</a>. +<p> +References <a class="el" href="a06769.html#l00474">_Bitmaps</a>, <a class="el" href="a06769.html#l00488">_ZBufferOverflow</a>, <a class="el" href="a05587.html#l00079">NLMISC::Pi</a>, <a class="el" href="a06682.html#l00136">NLMISC::CVector::set()</a>, and <a class="el" href="a05981.html#l00105">uint</a>. +<p> +<div class="fragment"><pre>00252 { +00253 <span class="comment">// Precalc some values</span> +00254 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a15">uint</a> i=0; i<8; i++) +00255 { +00256 <span class="comment">// Precalc sinP and cosP</span> +00257 <span class="keywordtype">float</span> sinP=(<span class="keywordtype">float</span>)(sin((Pi/4)*(i+0.5))-sin((Pi/4)*(i-0.5))); +00258 <span class="keywordtype">float</span> cosP=(<span class="keywordtype">float</span>)(cos((Pi/4)*(i-0.5))-cos((Pi/4)*(i+0.5))); +00259 +00260 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a15">uint</a> phi=0; phi<256; phi++) +00261 { +00262 <span class="comment">// Real phi</span> +00263 <span class="keywordtype">float</span> fPhi=(<span class="keywordtype">float</span>)((<a class="code" href="a05378.html#a44">Pi</a>/2)*phi/256.0); +00264 +00265 <span class="comment">// Tmp result</span> +00266 <span class="keywordtype">float</span> tmp0=(<span class="keywordtype">float</span>)(fPhi-sin(2*fPhi)/2); +00267 <span class="keywordtype">float</span> tmp1=(<span class="keywordtype">float</span>)sin(fPhi); +00268 +00269 <span class="comment">// Calc K</span> +00270 <a class="code" href="a03739.html#NL3D_1_1CZoneLighterr13">_K</a>[phi][i].<a class="code" href="a03128.html#NLMISC_1_1CVectorz2051_8">set</a> (tmp0*sinP, tmp0*cosP, (<span class="keywordtype">float</span>)((Pi/4)*tmp1*tmp1)); +00271 } +00272 } +00273 +00274 <span class="comment">// Init some containers</span> +00275 <a class="code" href="a03739.html#NL3D_1_1CZoneLighterr37">_ZBufferOverflow</a> = <span class="keyword">false</span>; +00276 <a class="code" href="a03739.html#NL3D_1_1CZoneLighterr3">_Bitmaps</a>.clear (); +00277 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneLightere0" doxytag="NL3D::CZoneLighter::isLightableShape" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool CZoneLighter::isLightableShape </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a02539.html">IShape</a> & </td> + <td class="mdname1" valign="top" nowrap> <em>shape</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [static]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +check wether a shape is lightable. +<p> +for now, the only shape that we lit are water shapes +<p> +Definition at line <a class="el" href="a06768.html#l02783">2783</a> of file <a class="el" href="a06768.html">zone_lighter.cpp</a>. +<p> +References <a class="el" href="a06742.html#l00172">NL3D::CWaterShape::getColorMap()</a>, and <a class="el" href="a06742.html#l00197">NL3D::CWaterShape::isLightMappingEnabled()</a>. +<p> +Referenced by <a class="el" href="a06768.html#l02836">processLightableShapeCalc()</a>. +<p> +<div class="fragment"><pre>02784 { +02786 <span class="keywordflow">if</span> (dynamic_cast<CWaterShape *>(&shape) != NULL) +02787 { +02788 <span class="comment">// check that this water surface has a diffuse map that is a CTextureFile (we must be able to save it !)</span> +02789 CWaterShape *ws = static_cast<CWaterShape *>(&shape); +02790 <span class="keyword">const</span> ITexture *tex = ws->getColorMap(); +02791 <span class="keywordflow">if</span> (dynamic_cast<const CTextureFile *>(tex) != NULL) +02792 { +02793 <span class="keywordflow">return</span> ws->isLightMappingEnabled(); +02794 } +02795 } +02796 <span class="keywordflow">return</span> <span class="keyword">false</span>; +02797 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneLighterd12" doxytag="NL3D::CZoneLighter::isLumelOnEdgeMustBeOversample" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool CZoneLighter::isLumelOnEdgeMustBeOversample </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a04558.html#a15">uint</a> </td> + <td class="mdname" nowrap> <em>patch</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a15">uint</a> </td> + <td class="mdname" nowrap> <em>edge</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a14">sint</a> </td> + <td class="mdname" nowrap> <em>s</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a14">sint</a> </td> + <td class="mdname" nowrap> <em>t</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const std::vector< bool > & </td> + <td class="mdname" nowrap> <em>binded</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const std::vector< bool > & </td> + <td class="mdname" nowrap> <em>oversampleEdges</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>std::vector< <a class="el" href="a03070.html">CPatchUVLocator</a> > & </td> + <td class="mdname" nowrap> <em>locator</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a7">uint8</a> </td> + <td class="mdname" nowrap> <em>shadowed</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>std::vector< std::vector< <a class="el" href="a04558.html#a7">uint8</a> > > & </td> + <td class="mdname" nowrap> <em>shadowBuffer</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06768.html#l01451">1451</a> of file <a class="el" href="a06768.html">zone_lighter.cpp</a>. +<p> +References <a class="el" href="a06768.html#l01501">_GetNormalDeltaS</a>, <a class="el" href="a06768.html#l01502">_GetNormalDeltaT</a>, <a class="el" href="a06156.html#l00392">NL3D::CPatch::getOrderS()</a>, <a class="el" href="a06156.html#l00398">NL3D::CPatch::getPatchId()</a>, <a class="el" href="a05646.html#l00977">s</a>, <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a05646.html#l00985">t</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a05981.html#l00096">uint8</a>, <a class="el" href="a06677.html#l00052">NLMISC::CVector2f::x</a>, and <a class="el" href="a06677.html#l00052">NLMISC::CVector2f::y</a>. +<p> +<div class="fragment"><pre>01454 { +01455 <span class="comment">// Must force oversampling of this edge ?</span> +01456 <span class="keywordflow">if</span> (oversampleEdges[edge]) +01457 <span class="keywordflow">return</span> <span class="keyword">true</span>; +01458 <span class="keywordflow">else</span> +01459 { +01460 <span class="comment">// binded ?</span> +01461 <span class="keywordflow">if</span> (binded[edge]) +01462 { +01463 <span class="comment">// Lumel coord</span> +01464 <a class="code" href="a03660.html">CVector2f</a> lumelCoord (((<span class="keywordtype">float</span>)(s+_GetNormalDeltaS[edge])+0.5f)/4.f, ((<span class="keywordtype">float</span>)(t+_GetNormalDeltaT[edge])+0.5f)/4.f); +01465 <a class="code" href="a04558.html#a15">uint</a> otherPatch=locator[edge].selectPatch(lumelCoord); +01466 +01467 <span class="comment">// Get uv</span> +01468 <a class="code" href="a03660.html">CVector2f</a> neighborUV; +01469 CPatch *patchOut; +01470 locator[edge].locateUV (lumelCoord, otherPatch, patchOut, neighborUV); +01471 +01472 <span class="comment">// Is the same shadowed flag ?</span> +01473 <a class="code" href="a04558.html#a14">sint</a> ss=(<a class="code" href="a04558.html#a14">sint</a>)(neighborUV.<a class="code" href="a03660.html#NLMISC_1_1CVector2fo0">x</a>*4.f); +01474 <a class="code" href="a04558.html#a14">sint</a> tt=(<a class="code" href="a04558.html#a14">sint</a>)(neighborUV.<a class="code" href="a03660.html#NLMISC_1_1CVector2fo1">y</a>*4.f); +01475 <span class="keywordflow">return</span> (shadowBuffer[patchOut->getPatchId()][ss+(patchOut->getOrderS()<<2)*tt]!=shadowed); +01476 } +01477 <span class="keywordflow">else</span> +01478 { +01479 <span class="comment">// Not oversample if not binded</span> +01480 <span class="keywordflow">return</span> <span class="keyword">false</span>; +01481 } +01482 } +01483 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneLightera7" doxytag="NL3D::CZoneLighter::light" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void CZoneLighter::light </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a02702.html">CLandscape</a> & </td> + <td class="mdname" nowrap> <em>landscape</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a03730.html">CZone</a> & </td> + <td class="mdname" nowrap> <em>output</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a15">uint</a> </td> + <td class="mdname" nowrap> <em>zoneToLight</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const <a class="el" href="a03741.html">CLightDesc</a> & </td> + <td class="mdname" nowrap> <em>description</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>std::vector< <a class="el" href="a03750.html">CTriangle</a> > & </td> + <td class="mdname" nowrap> <em>obstacles</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>std::vector< <a class="el" href="a04558.html#a15">uint</a> > & </td> + <td class="mdname" nowrap> <em>listZone</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +copy the tiles flags from the zone to light to the output zone<p> +Perform lightning of some ig's of the current zone (if any) +<p> +Definition at line <a class="el" href="a06768.html#l00920">920</a> of file <a class="el" href="a06768.html">zone_lighter.cpp</a>. +<p> +References <a class="el" href="a06769.html#l00505">_BorderVertices</a>, <a class="el" href="a06769.html#l00470">_CPUMask</a>, <a class="el" href="a06769.html#l00495">_HeightFieldCellCount</a>, <a class="el" href="a06769.html#l00497">_HeightfieldCellSize</a>, <a class="el" href="a06769.html#l00467">_LastPatchComputed</a>, <a class="el" href="a06769.html#l00468">_NumberOfPatchComputed</a>, <a class="el" href="a06769.html#l00496">_OrigineHeightField</a>, <a class="el" href="a06769.html#l00466">_PatchComputed</a>, <a class="el" href="a06769.html#l00504">_PatchInfo</a>, <a class="el" href="a06769.html#l00241">NL3D::CZoneLighter::CTriangle::_Plane</a>, <a class="el" href="a06769.html#l00469">_ProcessCount</a>, <a class="el" href="a06769.html#l00471">_ProcessExited</a>, <a class="el" href="a06769.html#l00457">_RayBasis</a>, <a class="el" href="a06769.html#l00463">_ShadowArray</a>, <a class="el" href="a06769.html#l00483">_ZBufferLandscape</a>, <a class="el" href="a06769.html#l00484">_ZBufferObject</a>, <a class="el" href="a06769.html#l00488">_ZBufferOverflow</a>, <a class="el" href="a06769.html#l00459">_ZoneToLight</a>, <a class="el" href="a06760.html#l00274">NL3D::CZoneInfo::BorderVertices</a>, <a class="el" href="a06758.html#l00122">NL3D::CZone::build()</a>, <a class="el" href="a06768.html#l02045">buildZoneInformation()</a>, <a class="el" href="a06768.html#l03202">compilePointLightRT()</a>, <a class="el" href="a06768.html#l01261">copyTileFlags()</a>, <a class="el" href="a06768.html#l00883">FilterZBuffer()</a>, <a class="el" href="a06769.html#l00228">NL3D::CZoneLighter::CTriangle::Flags</a>, <a class="el" href="a05385.html#l00199">NLMISC::CAABBoxExt::getCenter()</a>, <a class="el" href="a03872.html#NLMISC_1_1IProcessa0">NLMISC::IProcess::getCPUMask()</a>, <a class="el" href="a03880.html#NLMISC_1_1IThreada0">NLMISC::IThread::getCPUMask()</a>, <a class="el" href="a05972.html#l00419">NLMISC::CMatrix::getI()</a>, <a class="el" href="a05972.html#l00427">NLMISC::CMatrix::getJ()</a>, <a class="el" href="a06760.html#l00491">NL3D::CZone::getZoneBB()</a>, <a class="el" href="a06769.html#l00083">NL3D::CZoneLighter::CLightDesc::GridCellSize</a>, <a class="el" href="a06769.html#l00080">NL3D::CZoneLighter::CLightDesc::GridSize</a>, <a class="el" href="a06769.html#l00089">NL3D::CZoneLighter::CLightDesc::HeightfieldCellSize</a>, <a class="el" href="a06769.html#l00086">NL3D::CZoneLighter::CLightDesc::HeightfieldSize</a>, <a class="el" href="a06768.html#l00741">InitZBuffer()</a>, <a class="el" href="a05972.html#l00914">NLMISC::CMatrix::invert()</a>, <a class="el" href="a06768.html#l02800">lightShapes()</a>, <a class="el" href="a06769.html#l00285">NL3D::CZoneLighter::CZBuffer::LocalZBufferHeight</a>, <a class="el" href="a06769.html#l00284">NL3D::CZoneLighter::CZBuffer::LocalZBufferWidth</a>, <a class="el" href="a06170.html#l00036">NLMISC::CPlane::make()</a>, <a class="el" href="a06769.html#l00246">MAX_CPU_PROCESS</a>, <a class="el" href="a06682.html#l00192">NLMISC::CVector::maxof()</a>, <a class="el" href="a05484.html#l00038">min</a>, <a class="el" href="a06682.html#l00186">NLMISC::CVector::minof()</a>, <a class="el" href="a05824.html#l00617">NL3D::NEL3DCalcBase()</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a05586.html#l00073">NLMISC::nlSleep()</a>, <a class="el" href="a05622.html#l00135">nlwarning</a>, <a class="el" href="a06769.html#l00161">NL3D::CZoneLighter::CLightDesc::NumCPU</a>, <a class="el" href="a06760.html#l00269">NL3D::CZoneInfo::Patchs</a>, <a class="el" href="a06760.html#l00279">NL3D::CZoneInfo::PointLights</a>, <a class="el" href="a06768.html#l03346">processZonePointLightRT()</a>, <a class="el" href="a06769.html#l00342">progress()</a>, <a class="el" href="a06758.html#l00289">NL3D::CZone::retrieve()</a>, <a class="el" href="a03880.html#NLMISC_1_1IThreada3">NLMISC::IThread::setCPUMask()</a>, <a class="el" href="a06769.html#l00092">NL3D::CZoneLighter::CLightDesc::Shadow</a>, <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a05646.html#l00645">size</a>, <a class="el" href="a06769.html#l00128">NL3D::CZoneLighter::CLightDesc::SoftShadowSamplesSqrt</a>, <a class="el" href="a03880.html#NLMISC_1_1IThreada4">NLMISC::IThread::start()</a>, <a class="el" href="a06769.html#l00108">NL3D::CZoneLighter::CLightDesc::SunCenter</a>, <a class="el" href="a06769.html#l00099">NL3D::CZoneLighter::CLightDesc::SunDirection</a>, <a class="el" href="a06769.html#l00102">NL3D::CZoneLighter::CLightDesc::SunDistance</a>, <a class="el" href="a06769.html#l00111">NL3D::CZoneLighter::CLightDesc::SunRadius</a>, <a class="el" href="a06768.html#l00378">NL3D::CLightRunnable::Thread</a>, <a class="el" href="a06768.html#l00418">NL3D::CRenderZBuffer::Thread</a>, <a class="el" href="a06229.html#l02652">NLMISC::toString()</a>, <a class="el" href="a06769.html#l00225">NL3D::CZoneLighter::CTriangle::Triangle</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a05981.html#l00102">uint64</a>, <a class="el" href="a06585.html#l00051">NLMISC::CTriangle::V0</a>, <a class="el" href="a06585.html#l00051">NLMISC::CTriangle::V1</a>, <a class="el" href="a06585.html#l00051">NLMISC::CTriangle::V2</a>, <a class="el" href="a05646.html#l00236">x</a>, <a class="el" href="a06673.html#l00051">NLMISC::CVector::x</a>, <a class="el" href="a05646.html#l00236">y</a>, <a class="el" href="a06673.html#l00051">NLMISC::CVector::y</a>, <a class="el" href="a06673.html#l00051">NLMISC::CVector::z</a>, <a class="el" href="a06769.html#l00118">NL3D::CZoneLighter::CLightDesc::ZBufferLandscapeSize</a>, <a class="el" href="a06769.html#l00121">NL3D::CZoneLighter::CLightDesc::ZBufferObjectSize</a>, and <a class="el" href="a06760.html#l00267">NL3D::CZoneInfo::ZoneId</a>. +<p> +<div class="fragment"><pre>00921 { +00922 <span class="comment">/*</span> +00923 <span class="comment"> * Lighting algorithm</span> +00924 <span class="comment"> * ------------------</span> +00925 <span class="comment"> *</span> +00926 <span class="comment"> * - Create a quad grid to store shadow casting triangles</span> +00927 <span class="comment"> * - Create a heightfield used for global illumination. Cells are initialized with -FLT_MAX</span> +00928 <span class="comment"> * - Insert each shadow casting triangles in the quad grid and fill the heightfield's cells overlapped by the bounding box of the triangle with</span> +00929 <span class="comment"> * the max height of the triangle if its height is > than the current height in the heightfield's cell.</span> +00930 <span class="comment"> * - </span> +00931 <span class="comment"> */</span> +00932 +00933 <span class="comment">// Backup thread mask</span> +00934 <a class="code" href="a03880.html">IThread</a> *currentThread = <a class="code" href="a03880.html#NLMISC_1_1IThreade1">IThread::getCurrentThread</a> (); +00935 <a class="code" href="a04558.html#a13">uint64</a> threadMask = currentThread-><a class="code" href="a03880.html#NLMISC_1_1IThreada0">getCPUMask</a>(); +00936 currentThread-><a class="code" href="a03880.html#NLMISC_1_1IThreada3">setCPUMask</a> (1); +00937 +00938 <span class="comment">// Calc the ray basis</span> +00939 <a class="code" href="a03739.html#NL3D_1_1CZoneLighterr34">_SunDirection</a>=description.SunDirection; +00940 <a class="code" href="a05363.html#a423">NEL3DCalcBase</a> (_SunDirection, _RayBasis); +00941 +00942 <span class="comment">// Zone to light</span> +00943 <a class="code" href="a03739.html#NL3D_1_1CZoneLighterr39">_ZoneToLight</a>=zoneToLight; +00944 +00945 <span class="comment">// Landscape </span> +00946 <a class="code" href="a03739.html#NL3D_1_1CZoneLighterr14">_Landscape</a>=&landscape; +00947 +00948 <span class="comment">// Process count</span> +00949 <a class="code" href="a03739.html#NL3D_1_1CZoneLighterr26">_ProcessCount</a>=description.NumCPU; +00950 <span class="keywordflow">if</span> (<a class="code" href="a03739.html#NL3D_1_1CZoneLighterr26">_ProcessCount</a>==0) +00951 { +00952 <span class="comment">// Create a doomy thread</span> +00953 <a class="code" href="a03872.html">IProcess</a> *pProcess=<a class="code" href="a03872.html#NLMISC_1_1IProcesse0">IProcess::getCurrentProcess</a> (); +00954 <a class="code" href="a03739.html#NL3D_1_1CZoneLighterr5">_CPUMask</a> = pProcess-><a class="code" href="a03872.html#NLMISC_1_1IProcessa0">getCPUMask</a>(); +00955 <a class="code" href="a03739.html#NL3D_1_1CZoneLighterr26">_ProcessCount</a> = 0; +00956 <a class="code" href="a04558.html#a13">uint64</a> i; +00957 <span class="keywordflow">for</span> (i=0; i<64; i++) +00958 { +00959 <span class="keywordflow">if</span> (<a class="code" href="a03739.html#NL3D_1_1CZoneLighterr5">_CPUMask</a>&((<a class="code" href="a04558.html#a13">uint64</a>)1<<i)) +00960 <a class="code" href="a03739.html#NL3D_1_1CZoneLighterr26">_ProcessCount</a>++; +00961 } +00962 } +00963 <span class="keywordflow">if</span> (<a class="code" href="a03739.html#NL3D_1_1CZoneLighterr26">_ProcessCount</a>><a class="code" href="a05346.html#a2">MAX_CPU_PROCESS</a>) +00964 <a class="code" href="a03739.html#NL3D_1_1CZoneLighterr26">_ProcessCount</a>=<a class="code" href="a05346.html#a2">MAX_CPU_PROCESS</a>; +00965 +00966 <span class="comment">// Number of obstacle polygones</span> +00967 printf (<span class="stringliteral">"Obstacle polygones : %d\n"</span>, obstacles.size ()); +00968 +00969 <span class="comment">// Number of CPUS used</span> +00970 printf (<span class="stringliteral">"Number of CPU used: %d\n"</span>, _ProcessCount); +00971 +00972 <span class="comment">// Zone pointer</span> +00973 CZone *pZone=landscape.getZone (_ZoneToLight); +00974 <span class="keywordflow">if</span> (pZone) +00975 { +00976 <span class="comment">// *** Compute center of the object</span> +00977 +00978 <span class="comment">// Get the zone bounding box</span> +00979 <span class="keyword">const</span> <a class="code" href="a02157.html">CAABBoxExt</a> &zoneBB=pZone->getZoneBB(); +00980 +00981 <span class="comment">// Get the center</span> +00982 CVector center = zoneBB.<a class="code" href="a02157.html#NLMISC_1_1CAABBoxExtz1912_1">getCenter</a> (); +00983 +00984 <span class="comment">// *** Compute planes</span> +00985 <span class="keyword">const</span> <a class="code" href="a04558.html#a15">uint</a> <a class="code" href="a04223.html#a587">size</a>=obstacles.size(); +00986 <a class="code" href="a04558.html#a15">uint</a> triangleId; +00987 <span class="keywordflow">for</span> (triangleId=0; triangleId<<a class="code" href="a04223.html#a587">size</a>; triangleId++) +00988 { +00989 <span class="comment">// Triangle ref</span> +00990 <a class="code" href="a03750.html">CZoneLighter::CTriangle</a>& triangle=obstacles[triangleId]; +00991 +00992 <span class="comment">// Calc the plane</span> +00993 triangle.<a class="code" href="a03750.html#NL3D_1_1CZoneLighter_1_1CTriangler0">_Plane</a>.<a class="code" href="a03082.html#NLMISC_1_1CPlanez1990_2">make</a> (triangle.<a class="code" href="a03750.html#NL3D_1_1CZoneLighter_1_1CTriangleo3">Triangle</a>.<a class="code" href="a03616.html#NLMISC_1_1CTriangleUVo3">V0</a>, triangle.<a class="code" href="a03750.html#NL3D_1_1CZoneLighter_1_1CTriangleo3">Triangle</a>.<a class="code" href="a03616.html#NLMISC_1_1CTriangleUVo4">V1</a>, triangle.<a class="code" href="a03750.html#NL3D_1_1CZoneLighter_1_1CTriangleo3">Triangle</a>.<a class="code" href="a03616.html#NLMISC_1_1CTriangleUVo5">V2</a>); +00994 } +00995 +00996 <span class="comment">// Create landscape zbuffers</span> +00997 <a class="code" href="a03739.html#NL3D_1_1CZoneLightero0">_ZBufferLandscape</a>.resize (description.SoftShadowSamplesSqrt*description.SoftShadowSamplesSqrt); +00998 +00999 <a class="code" href="a04558.html#a15">uint</a> sampleX; +01000 <a class="code" href="a04558.html#a15">uint</a> sampleY; +01001 <span class="keywordflow">for</span> (sampleY=0; sampleY<description.SoftShadowSamplesSqrt; sampleY++) +01002 <span class="keywordflow">for</span> (sampleX=0; sampleX<description.SoftShadowSamplesSqrt; sampleX++) +01003 { +01004 <span class="comment">// *** Render the light zbuffer</span> +01005 CZBuffer &zbuffer = <a class="code" href="a03739.html#NL3D_1_1CZoneLightero0">_ZBufferLandscape</a>[sampleX + sampleY*description.SoftShadowSamplesSqrt]; +01006 +01007 <span class="comment">// Delta pos for area light</span> +01008 <span class="keywordtype">float</span> deltaX = ( (<span class="keywordtype">float</span>)sampleX + 0.5f - (<span class="keywordtype">float</span>)description.SoftShadowSamplesSqrt / 2.f) / (<span class="keywordtype">float</span>)description.SoftShadowSamplesSqrt; +01009 <span class="keywordtype">float</span> deltaY = ( (<span class="keywordtype">float</span>)sampleY + 0.5f - (<span class="keywordtype">float</span>)description.SoftShadowSamplesSqrt / 2.f) / (<span class="keywordtype">float</span>)description.SoftShadowSamplesSqrt; +01010 CVector lightPos = <a class="code" href="a03739.html#NL3D_1_1CZoneLighterr30">_RayBasis</a>.<a class="code" href="a02851.html#NLMISC_1_1CMatrixz1963_2">getI</a> () * ((<span class="keywordtype">float</span>)description.SunRadius * deltaX) + <a class="code" href="a03739.html#NL3D_1_1CZoneLighterr30">_RayBasis</a>.<a class="code" href="a02851.html#NLMISC_1_1CMatrixz1963_3">getJ</a> () * ((<span class="keywordtype">float</span>)description.SunRadius * deltaY); +01011 lightPos = description.SunCenter - (description.SunDirection * description.SunDistance) + lightPos; +01012 +01013 <a class="code" href="a05345.html#a29">InitZBuffer</a> (zbuffer, lightPos, _RayBasis, zoneBB, description.ZBufferLandscapeSize, description); +01014 printf (<span class="stringliteral">"Zbuffer %d size : %d x %d\n"</span>, sampleX+sampleY*description.SoftShadowSamplesSqrt, zbuffer.LocalZBufferWidth, zbuffer.LocalZBufferHeight); +01015 } +01016 +01017 +01018 <span class="comment">// *** Init the zbuffer for the vegetation</span> +01019 CVector lightPos = description.SunCenter - (description.SunDirection * description.SunDistance); +01020 <a class="code" href="a05345.html#a29">InitZBuffer</a> (_ZBufferObject, lightPos, _RayBasis, zoneBB, description.ZBufferObjectSize, description); +01021 printf (<span class="stringliteral">"Zbuffer object size : %d x %d\n"</span>, <a class="code" href="a03739.html#NL3D_1_1CZoneLightero1">_ZBufferObject</a>.<a class="code" href="a03751.html#NL3D_1_1CZoneLighter_1_1CZBuffero2">LocalZBufferWidth</a>, <a class="code" href="a03739.html#NL3D_1_1CZoneLightero1">_ZBufferObject</a>.<a class="code" href="a03751.html#NL3D_1_1CZoneLighter_1_1CZBuffero1">LocalZBufferHeight</a>); +01022 +01023 +01024 <span class="comment">// Compute the zbuffer in multi thread</span> +01025 <a class="code" href="a03739.html#NL3D_1_1CZoneLighterr27">_ProcessExited</a> = 0; +01026 +01027 <span class="comment">// Number of triangle to render per thread</span> +01028 <a class="code" href="a04558.html#a15">uint</a> numTriangle = (obstacles.size () / <a class="code" href="a03739.html#NL3D_1_1CZoneLighterr26">_ProcessCount</a>) + 1; +01029 +01030 <span class="comment">// First triangle for the thread</span> +01031 <a class="code" href="a04558.html#a15">uint</a> firstTriangle = 0; +01032 +01033 <span class="comment">// Count</span> +01034 <a class="code" href="a03739.html#NL3D_1_1CZoneLighterr20">_NumberOfPatchComputed</a> = 0; +01035 +01036 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a15">uint</a> process=0; process<<a class="code" href="a03739.html#NL3D_1_1CZoneLighterr26">_ProcessCount</a>; process++) +01037 { +01038 <span class="comment">// Get list of triangles to render</span> +01039 <a class="code" href="a04558.html#a15">uint</a> lastTriangle=firstTriangle+numTriangle; +01040 <span class="keywordflow">if</span> (lastTriangle>obstacles.size ()) +01041 lastTriangle=obstacles.size (); +01042 +01043 <span class="comment">// Create a thread</span> +01044 <a class="code" href="a03326.html">CRenderZBuffer</a> *runnable = <span class="keyword">new</span> <a class="code" href="a03326.html">CRenderZBuffer</a> (process, <span class="keyword">this</span>, &description, firstTriangle, lastTriangle - firstTriangle, &obstacles); +01045 <a class="code" href="a03880.html">IThread</a> *pThread=<a class="code" href="a03880.html#NLMISC_1_1IThreade0">IThread::create</a> (runnable); +01046 runnable-><a class="code" href="a03326.html#NL3D_1_1CRenderZBuffero0">Thread</a> = pThread; +01047 +01048 <span class="comment">// New first patch</span> +01049 firstTriangle = lastTriangle; +01050 +01051 <span class="comment">// Launch</span> +01052 pThread-><a class="code" href="a03880.html#NLMISC_1_1IThreada4">start</a>(); +01053 } +01054 +01055 <span class="comment">// Wait for others processes</span> +01056 <span class="keywordflow">while</span> (<a class="code" href="a03739.html#NL3D_1_1CZoneLighterr27">_ProcessExited</a>!=_ProcessCount) +01057 { +01058 <a class="code" href="a05378.html#a256">nlSleep</a> (1000); +01059 +01060 <span class="comment">// Call the progress callback</span> +01061 <a class="code" href="a03739.html#NL3D_1_1CZoneLightera8">progress</a> (<span class="stringliteral">"Render triangles"</span>, (<span class="keywordtype">float</span>)_NumberOfPatchComputed/(<span class="keywordtype">float</span>)obstacles.size()); +01062 } +01063 +01064 <span class="comment">// * Save the zbuffer</span> +01065 <a class="code" href="a04558.html#a15">uint</a> sample; +01066 <span class="keyword">const</span> <a class="code" href="a04558.html#a15">uint</a> samples = description.SoftShadowSamplesSqrt*description.SoftShadowSamplesSqrt; +01067 <span class="preprocessor">#ifdef SAVE_ZBUFFER</span> +01068 <span class="preprocessor"></span> <span class="keywordflow">for</span> (sample=0; sample<samples; sample++) +01069 { +01070 <span class="comment">// *** The zbuffer</span> +01071 CZBuffer &zbuffer = <a class="code" href="a03739.html#NL3D_1_1CZoneLightero0">_ZBufferLandscape</a>[sample]; +01072 +01073 string zbufferFilename = SAVE_ZBUFFER<span class="stringliteral">"/zbuffer_landscape_"</span> + <a class="code" href="a05378.html#a244">toString</a> (sample) + <span class="stringliteral">".jpg"</span>; +01074 +01075 SaveZBuffer (zbuffer, zbufferFilename.c_str ()); +01076 } +01077 +01078 <span class="comment">// Save the object zbuffer</span> +01079 SaveZBuffer (_ZBufferObject, SAVE_ZBUFFER<span class="stringliteral">"/zbuffer_object.jpg"</span>); +01080 <span class="preprocessor">#endif // SAVE_ZBUFFER</span> +01081 <span class="preprocessor"></span> +01082 <span class="comment">// *** Filter the zbuffer</span> +01083 <span class="keywordflow">for</span> (sample=0; sample<samples; sample++) +01084 { +01085 <span class="comment">// For landscape zbuffer, expand the z to neighbor</span> +01086 <a class="code" href="a05345.html#a30">FilterZBuffer</a> (_ZBufferLandscape[sample], 5); +01087 } +01088 +01089 <span class="comment">// Change the quadGrid basis</span> +01090 <a class="code" href="a02851.html">CMatrix</a> invRayBasis=<a class="code" href="a03739.html#NL3D_1_1CZoneLighterr30">_RayBasis</a>; +01091 invRayBasis.<a class="code" href="a02851.html#NLMISC_1_1CMatrixz1967_0">invert</a> (); +01092 +01093 <span class="comment">// Init the heightfield</span> +01094 <a class="code" href="a03739.html#NL3D_1_1CZoneLighterr12">_HeightfieldCellSize</a>=description.HeightfieldCellSize; +01095 <a class="code" href="a03739.html#NL3D_1_1CZoneLighterr11">_HeightFieldCellCount</a>=(<a class="code" href="a04558.html#a14">sint</a>)(description.HeightfieldSize/<a class="code" href="a03739.html#NL3D_1_1CZoneLighterr12">_HeightfieldCellSize</a>); +01096 <a class="code" href="a04199.html#a6">nlassert</a> (_HeightFieldCellCount!=0); +01097 <a class="code" href="a03739.html#NL3D_1_1CZoneLighterr22">_OrigineHeightField</a>=zoneBB.<a class="code" href="a02157.html#NLMISC_1_1CAABBoxExtz1912_1">getCenter</a> ()-CVector (description.HeightfieldSize/2, description.HeightfieldSize/2, 0); +01098 <a class="code" href="a03739.html#NL3D_1_1CZoneLighterr10">_HeightField</a>.resize (_HeightFieldCellCount*_HeightFieldCellCount, -FLT_MAX); +01099 +01100 <span class="comment">// Fill the quadGrid and the heightField</span> +01101 <span class="keywordflow">for</span> (triangleId=0; triangleId<<a class="code" href="a04223.html#a587">size</a>; triangleId++) +01102 { +01103 <span class="comment">// Progress bar</span> +01104 <span class="keywordflow">if</span> ( (triangleId&0xff) == 0) +01105 <a class="code" href="a03739.html#NL3D_1_1CZoneLightera8">progress</a> (<span class="stringliteral">"Build quadtree and heightfield"</span>, (<span class="keywordtype">float</span>)triangleId/(<span class="keywordtype">float</span>)size); +01106 +01107 <span class="comment">// Triangle ref</span> +01108 <a class="code" href="a03750.html">CZoneLighter::CTriangle</a>& triangle=obstacles[triangleId]; +01109 +01110 <span class="comment">// Look for the min coordinate, in World Basis</span> +01111 CVector minv; +01112 minv.minof (triangle.<a class="code" href="a03750.html#NL3D_1_1CZoneLighter_1_1CTriangleo3">Triangle</a>.<a class="code" href="a03616.html#NLMISC_1_1CTriangleUVo3">V0</a>, triangle.<a class="code" href="a03750.html#NL3D_1_1CZoneLighter_1_1CTriangleo3">Triangle</a>.<a class="code" href="a03616.html#NLMISC_1_1CTriangleUVo4">V1</a>); +01113 minv.minof (minv, triangle.<a class="code" href="a03750.html#NL3D_1_1CZoneLighter_1_1CTriangleo3">Triangle</a>.<a class="code" href="a03616.html#NLMISC_1_1CTriangleUVo5">V2</a>); +01114 +01115 <span class="comment">// Look for the max coordinate, in World Basis</span> +01116 CVector maxv; +01117 maxv.maxof (triangle.<a class="code" href="a03750.html#NL3D_1_1CZoneLighter_1_1CTriangleo3">Triangle</a>.<a class="code" href="a03616.html#NLMISC_1_1CTriangleUVo3">V0</a>, triangle.<a class="code" href="a03750.html#NL3D_1_1CZoneLighter_1_1CTriangleo3">Triangle</a>.<a class="code" href="a03616.html#NLMISC_1_1CTriangleUVo4">V1</a>); +01118 maxv.maxof (maxv, triangle.<a class="code" href="a03750.html#NL3D_1_1CZoneLighter_1_1CTriangleo3">Triangle</a>.<a class="code" href="a03616.html#NLMISC_1_1CTriangleUVo5">V2</a>); +01119 +01120 <span class="comment">// Lanscape tri ?</span> +01121 <span class="keywordflow">if</span> (triangle.<a class="code" href="a03750.html#NL3D_1_1CZoneLighter_1_1CTriangleo1">Flags</a> & CTriangle::Landscape) +01122 { +01123 <span class="comment">// Fill the heightfield</span> +01124 <a class="code" href="a04558.html#a14">sint</a> minX=std::max (0, (<a class="code" href="a04558.html#a14">sint</a>)floor (0.5f+(minv.x-<a class="code" href="a03739.html#NL3D_1_1CZoneLighterr22">_OrigineHeightField</a>.<a class="code" href="a03128.html#NLMISC_1_1CVectoro0">x</a>)/_HeightfieldCellSize)); +01125 <a class="code" href="a04558.html#a14">sint</a> maxX=<a class="code" href="a04061.html#a0">std::min</a> (_HeightFieldCellCount, (<a class="code" href="a04558.html#a14">sint</a>)floor (0.5f+(maxv.x-<a class="code" href="a03739.html#NL3D_1_1CZoneLighterr22">_OrigineHeightField</a>.<a class="code" href="a03128.html#NLMISC_1_1CVectoro0">x</a>)/_HeightfieldCellSize)); +01126 <a class="code" href="a04558.html#a14">sint</a> minY=std::max (0, (<a class="code" href="a04558.html#a14">sint</a>)floor (0.5f+(minv.y-<a class="code" href="a03739.html#NL3D_1_1CZoneLighterr22">_OrigineHeightField</a>.<a class="code" href="a03128.html#NLMISC_1_1CVectoro1">y</a>)/_HeightfieldCellSize)); +01127 <a class="code" href="a04558.html#a14">sint</a> maxY=<a class="code" href="a04061.html#a0">std::min</a> (_HeightFieldCellCount, (<a class="code" href="a04558.html#a14">sint</a>)floor (0.5f+(maxv.y-<a class="code" href="a03739.html#NL3D_1_1CZoneLighterr22">_OrigineHeightField</a>.<a class="code" href="a03128.html#NLMISC_1_1CVectoro1">y</a>)/_HeightfieldCellSize)); +01128 +01129 <span class="comment">// Calc position in the heightfield</span> +01130 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a14">sint</a> <a class="code" href="a04223.html#a573">y</a>=minY; <a class="code" href="a04223.html#a573">y</a><maxY; <a class="code" href="a04223.html#a573">y</a>++) +01131 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a14">sint</a> <a class="code" href="a04223.html#a572">x</a>=minX; <a class="code" href="a04223.html#a572">x</a><maxX; <a class="code" href="a04223.html#a572">x</a>++) +01132 { +01133 <span class="comment">// Valid position, try to insert it</span> +01134 <span class="keywordflow">if</span> (maxv.z><a class="code" href="a03739.html#NL3D_1_1CZoneLighterr10">_HeightField</a>[<a class="code" href="a04223.html#a572">x</a>+<a class="code" href="a04223.html#a573">y</a>*<a class="code" href="a03739.html#NL3D_1_1CZoneLighterr11">_HeightFieldCellCount</a>]) +01135 { +01136 <span class="comment">// New height in this cell</span> +01137 <a class="code" href="a03739.html#NL3D_1_1CZoneLighterr10">_HeightField</a>[<a class="code" href="a04223.html#a572">x</a>+<a class="code" href="a04223.html#a573">y</a>*<a class="code" href="a03739.html#NL3D_1_1CZoneLighterr11">_HeightFieldCellCount</a>]=maxv.z; +01138 } +01139 } +01140 } +01141 } +01142 +01143 <span class="comment">// Retrieve the zone to fill its shaded value</span> +01144 pZone->retrieve (_PatchInfo, _BorderVertices); +01145 +01146 <span class="comment">// Number of patch</span> +01147 <a class="code" href="a04558.html#a15">uint</a> patchCount=<a class="code" href="a03739.html#NL3D_1_1CZoneLighterr25">_PatchInfo</a>.size(); +01148 +01149 <span class="comment">// Bit array to know if the lumel is shadowed</span> +01150 <span class="keywordflow">if</span> (description.Shadow) +01151 <a class="code" href="a03739.html#NL3D_1_1CZoneLighterr31">_ShadowArray</a>.resize (patchCount); +01152 +01153 <span class="comment">// A lumel vector by patch</span> +01154 vector<vector<CLumelDescriptor> > lumels; +01155 lumels.resize (patchCount); +01156 +01157 <span class="comment">// Build zone informations</span> +01158 <a class="code" href="a03739.html#NL3D_1_1CZoneLighterd2">buildZoneInformation</a> (landscape, +01159 listZone, +01160 description); +01161 +01162 } +01163 +01164 <span class="comment">// Number of patch</span> +01165 <a class="code" href="a04558.html#a15">uint</a> patchCount=<a class="code" href="a03739.html#NL3D_1_1CZoneLighterr25">_PatchInfo</a>.size(); +01166 +01167 <span class="comment">// Reset patch count</span> +01168 { +01169 CSynchronized<std::vector<bool> >::CAccessor access (&_PatchComputed); +01170 access.value().resize (0); +01171 access.value().resize (patchCount, <span class="keyword">false</span>); +01172 } +01173 +01174 <span class="comment">// Patch by thread</span> +01175 <a class="code" href="a04558.html#a15">uint</a> patchCountByThread = patchCount/_ProcessCount; +01176 patchCountByThread++; +01177 +01178 <span class="comment">// Patch to allocate</span> +01179 <a class="code" href="a04558.html#a15">uint</a> firstPatch=0; +01180 <a class="code" href="a03739.html#NL3D_1_1CZoneLighterr20">_NumberOfPatchComputed</a> = 0; +01181 +01182 <span class="comment">// Reset exited process</span> +01183 <a class="code" href="a03739.html#NL3D_1_1CZoneLighterr27">_ProcessExited</a>=0; +01184 +01185 <span class="comment">// Set the thread state</span> +01186 <a class="code" href="a03739.html#NL3D_1_1CZoneLighterr15">_LastPatchComputed</a>.resize (_ProcessCount); +01187 +01188 <span class="comment">// Launch threads</span> +01189 <a class="code" href="a04558.html#a15">uint</a> process; +01190 <span class="keywordflow">for</span> (process=0; process<_ProcessCount; process++) +01191 { +01192 <span class="comment">// Last patch</span> +01193 <a class="code" href="a04558.html#a15">uint</a> lastPatch=firstPatch+patchCountByThread; +01194 <span class="keywordflow">if</span> (lastPatch>patchCount) +01195 lastPatch=patchCount; +01196 +01197 <span class="comment">// Last patch computed</span> +01198 <a class="code" href="a03739.html#NL3D_1_1CZoneLighterr15">_LastPatchComputed</a>[process] = firstPatch; +01199 +01200 <span class="comment">// Create a thread</span> +01201 <a class="code" href="a02752.html">CLightRunnable</a> *runnable = <span class="keyword">new</span> <a class="code" href="a02752.html">CLightRunnable</a> (process, <span class="keyword">this</span>, &description); +01202 <a class="code" href="a03880.html">IThread</a> *pThread=<a class="code" href="a03880.html#NLMISC_1_1IThreade0">IThread::create</a> (runnable); +01203 runnable-><a class="code" href="a02752.html#NL3D_1_1CLightRunnableo0">Thread</a> = pThread; +01204 +01205 <span class="comment">// New first patch</span> +01206 firstPatch=lastPatch; +01207 +01208 <span class="comment">// Launch</span> +01209 pThread-><a class="code" href="a03880.html#NLMISC_1_1IThreada4">start</a>(); +01210 } +01211 +01212 <span class="comment">// Wait for others processes</span> +01213 <span class="keywordflow">while</span> (<a class="code" href="a03739.html#NL3D_1_1CZoneLighterr27">_ProcessExited</a>!=_ProcessCount) +01214 { +01215 <a class="code" href="a05378.html#a256">nlSleep</a> (1000); +01216 +01217 <span class="comment">// Call the progress callback</span> +01218 <a class="code" href="a03739.html#NL3D_1_1CZoneLightera8">progress</a> (<span class="stringliteral">"Lighting patches"</span>, (<span class="keywordtype">float</span>)_NumberOfPatchComputed/(<span class="keywordtype">float</span>)<a class="code" href="a03739.html#NL3D_1_1CZoneLighterr25">_PatchInfo</a>.size()); +01219 } +01220 +01221 <span class="comment">// Reset old thread mask</span> +01222 currentThread-><a class="code" href="a03880.html#NLMISC_1_1IThreada3">setCPUMask</a> (threadMask); +01223 +01224 <span class="comment">// overflow ?</span> +01225 <span class="keywordflow">if</span> (<a class="code" href="a03739.html#NL3D_1_1CZoneLighterr37">_ZBufferOverflow</a>) +01226 <a class="code" href="a04199.html#a2">nlwarning</a> (<span class="stringliteral">"Error : zbuffer overflow"</span>); +01227 +01228 <span class="comment">// Progress bar</span> +01229 <a class="code" href="a03739.html#NL3D_1_1CZoneLightera8">progress</a> (<span class="stringliteral">"Compute Influences of PointLights"</span>, 0.f); +01230 +01231 <span class="comment">// Compute PointLight influences on zone.</span> +01232 <span class="comment">// Some precalc.</span> +01233 <a class="code" href="a03739.html#NL3D_1_1CZoneLighterz1203_0">compilePointLightRT</a>(description.GridSize, description.GridCellSize, obstacles, description.Shadow); +01234 <span class="comment">// Influence patchs and get light list of interest</span> +01235 std::vector<CPointLightNamed> listPointLight; +01236 <a class="code" href="a03739.html#NL3D_1_1CZoneLighterz1203_1">processZonePointLightRT</a>(listPointLight); +01237 +01238 +01239 <span class="comment">// Rebuild the zone</span> +01240 +01241 <span class="comment">// Progress bar</span> +01242 <a class="code" href="a03739.html#NL3D_1_1CZoneLightera8">progress</a> (<span class="stringliteral">"Compress the lightmap"</span>, 0.6f); +01243 +01244 <span class="comment">// Build, with list of lights.</span> +01245 CZoneInfo zinfo; +01246 zinfo.ZoneId= <a class="code" href="a03739.html#NL3D_1_1CZoneLighterr39">_ZoneToLight</a>; +01247 zinfo.Patchs= <a class="code" href="a03739.html#NL3D_1_1CZoneLighterr25">_PatchInfo</a>; +01248 zinfo.BorderVertices= <a class="code" href="a03739.html#NL3D_1_1CZoneLighterr4">_BorderVertices</a>; +01249 zinfo.PointLights= listPointLight; +01250 output.build (zinfo); +01251 +01253 <a class="code" href="a03739.html#NL3D_1_1CZoneLighterh0">copyTileFlags</a>(output, *(landscape.getZone(zoneToLight))); +01254 +01256 <a class="code" href="a03739.html#NL3D_1_1CZoneLighterd13">lightShapes</a>(zoneToLight, description); +01257 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneLighterd13" doxytag="NL3D::CZoneLighter::lightShapes" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void CZoneLighter::lightShapes </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a04558.html#a15">uint</a> </td> + <td class="mdname" nowrap> <em>zoneID</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const <a class="el" href="a03741.html">CLightDesc</a> & </td> + <td class="mdname" nowrap> <em>description</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Launch a set of threads to perform lighting of lightable shapes. +<p> +compute light for the lightable shapes in the given zone<p> +wait for other process +<p> +Definition at line <a class="el" href="a06768.html#l02800">2800</a> of file <a class="el" href="a06768.html">zone_lighter.cpp</a>. +<p> +References <a class="el" href="a06769.html#l00598">_LightableShapes</a>, <a class="el" href="a06769.html#l00599">_NumLightableShapesProcessed</a>, <a class="el" href="a06769.html#l00469">_ProcessCount</a>, <a class="el" href="a06769.html#l00471">_ProcessExited</a>, <a class="el" href="a06769.html#l00356">CCalcLightableShapeRunnable</a>, <a class="el" href="a05484.html#l00038">min</a>, <a class="el" href="a05586.html#l00073">NLMISC::nlSleep()</a>, <a class="el" href="a06769.html#l00342">progress()</a>, <a class="el" href="a03880.html#NLMISC_1_1IThreada4">NLMISC::IThread::start()</a>, and <a class="el" href="a05981.html#l00105">uint</a>. +<p> +Referenced by <a class="el" href="a06768.html#l00920">light()</a>. +<p> +<div class="fragment"><pre>02801 { +02803 <span class="keywordflow">if</span> (<a class="code" href="a03739.html#NL3D_1_1CZoneLighterr16">_LightableShapes</a>.size() == 0) <span class="keywordflow">return</span>; +02804 +02805 <a class="code" href="a04558.html#a15">uint</a> numShapePerThread = 1 + (<a class="code" href="a03739.html#NL3D_1_1CZoneLighterr16">_LightableShapes</a>.size() / <a class="code" href="a03739.html#NL3D_1_1CZoneLighterr26">_ProcessCount</a>); +02806 <a class="code" href="a04558.html#a15">uint</a> currShapeIndex = 0; +02807 <a class="code" href="a04558.html#a15">uint</a> process = 0; +02808 <a class="code" href="a03739.html#NL3D_1_1CZoneLighterr27">_ProcessExited</a> = 0; +02809 +02810 <a class="code" href="a03739.html#NL3D_1_1CZoneLighterr21">_NumLightableShapesProcessed</a> = 0; +02811 +02812 +02813 <a class="code" href="a03739.html#NL3D_1_1CZoneLightera8">progress</a>(<span class="stringliteral">"Processing lightable shapes"</span>, 0); +02814 +02815 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a15">uint</a> k = 0; k < <a class="code" href="a03739.html#NL3D_1_1CZoneLighterr16">_LightableShapes</a>.size(); ++k, ++process) +02816 { +02817 <a class="code" href="a04558.html#a15">uint</a> lastShapeIndex = currShapeIndex + numShapePerThread; +02818 lastShapeIndex = <a class="code" href="a04061.html#a0">std::min</a>((<a class="code" href="a04558.html#a15">uint</a>)<a class="code" href="a03739.html#NL3D_1_1CZoneLighterr16">_LightableShapes</a>.size(), lastShapeIndex); +02819 <a class="code" href="a03880.html">IThread</a> *pThread = <a class="code" href="a03880.html#NLMISC_1_1IThreade0">IThread::create</a> (<span class="keyword">new</span> <a class="code" href="a03739.html#NL3D_1_1CZoneLightern0">CCalcLightableShapeRunnable</a>(process, <span class="keyword">this</span>, &description, &_LightableShapes, currShapeIndex, lastShapeIndex)); +02820 pThread-><a class="code" href="a03880.html#NLMISC_1_1IThreada4">start</a>(); +02821 currShapeIndex = lastShapeIndex; +02822 } +02823 +02825 <span class="keywordflow">while</span> (<a class="code" href="a03739.html#NL3D_1_1CZoneLighterr27">_ProcessExited</a> != <a class="code" href="a03739.html#NL3D_1_1CZoneLighterr26">_ProcessCount</a>) +02826 { +02827 <a class="code" href="a05378.html#a256">nlSleep</a> (10); +02828 } +02829 +02830 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneLighterd14" doxytag="NL3D::CZoneLighter::lightSingleShape" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void CZoneLighter::lightSingleShape </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a03748.html">CShapeInfo</a> & </td> + <td class="mdname" nowrap> <em>si</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const <a class="el" href="a03741.html">CLightDesc</a> & </td> + <td class="mdname" nowrap> <em>description</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a15">uint</a> </td> + <td class="mdname" nowrap> <em>cpu</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Compute the lighting for a single lightable shape. +<p> +we compute the lighting for one single shape +<p> +Definition at line <a class="el" href="a06768.html#l02852">2852</a> of file <a class="el" href="a06768.html">zone_lighter.cpp</a>. +<p> +References <a class="el" href="a06769.html#l00598">_LightableShapes</a>, <a class="el" href="a06769.html#l00599">_NumLightableShapesProcessed</a>, <a class="el" href="a06768.html#l02927">lightWater()</a>, <a class="el" href="a06769.html#l00400">NL3D::CZoneLighter::CShapeInfo::MT</a>, <a class="el" href="a06769.html#l00342">progress()</a>, <a class="el" href="a06769.html#l00399">NL3D::CZoneLighter::CShapeInfo::Shape</a>, and <a class="el" href="a05981.html#l00105">uint</a>. +<p> +Referenced by <a class="el" href="a06768.html#l02836">processLightableShapeCalc()</a>. +<p> +<div class="fragment"><pre>02853 { +02855 <span class="keywordflow">if</span> (dynamic_cast<CWaterShape *>(si.Shape)) +02856 { +02857 <a class="code" href="a03739.html#NL3D_1_1CZoneLighterd15">lightWater</a>(* static_cast<CWaterShape *>(si.Shape), si.MT, description, cpu); +02858 } +02859 ++<a class="code" href="a03739.html#NL3D_1_1CZoneLighterr21">_NumLightableShapesProcessed</a>; +02860 <a class="code" href="a03739.html#NL3D_1_1CZoneLightera8">progress</a>(<span class="stringliteral">"Processing lightable shapes"</span>, (<span class="keywordtype">float</span>) _NumLightableShapesProcessed / <a class="code" href="a03739.html#NL3D_1_1CZoneLighterr16">_LightableShapes</a>.size()); +02861 <span class="keywordflow">return</span>; +02862 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneLighterd15" doxytag="NL3D::CZoneLighter::lightWater" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void CZoneLighter::lightWater </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a03724.html">CWaterShape</a> & </td> + <td class="mdname" nowrap> <em>ws</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const <a class="el" href="a02851.html">CMatrix</a> & </td> + <td class="mdname" nowrap> <em>MT</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const <a class="el" href="a03741.html">CLightDesc</a> & </td> + <td class="mdname" nowrap> <em>description</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a15">uint</a> </td> + <td class="mdname" nowrap> <em>cpu</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Compute the lighting for a water shape. +<p> +get the diffuse map<p> +build a matrix to convert from water space to uv space<p> +get min and max uvs<p> +raytrace each texel<p> +now, save the result +<p> +Definition at line <a class="el" href="a06768.html#l02927">2927</a> of file <a class="el" href="a06768.html">zone_lighter.cpp</a>. +<p> +References <a class="el" href="a06768.html#l03767">attenuation()</a>, <a class="el" href="a05587.html#l00115">NLMISC::clamp()</a>, <a class="el" href="a05708.html#l00531">NLMISC::COFile::close()</a>, <a class="el" href="a06506.html#l00309">NL3D::ITexture::generate()</a>, <a class="el" href="a06742.html#l00172">NL3D::CWaterShape::getColorMap()</a>, <a class="el" href="a06741.html#l00559">NL3D::CWaterShape::getColorMapMat()</a>, <a class="el" href="a06768.html#l02910">getExt()</a>, <a class="el" href="a06522.html#l00089">NL3D::CTextureFile::getFileName()</a>, <a class="el" href="a05486.html#l01388">NLMISC::CBitmap::getHeight()</a>, <a class="el" href="a06191.html#l00064">NLMISC::CPolygon::getNumVertices()</a>, <a class="el" href="a05487.html#l00308">NLMISC::CBitmap::getPixels()</a>, <a class="el" href="a06741.html#l00609">NL3D::CWaterShape::getShapeInWorldSpace()</a>, <a class="el" href="a06768.html#l01271">getSkyContribution()</a>, <a class="el" href="a05486.html#l01363">NLMISC::CBitmap::getWidth()</a>, <a class="el" href="a05646.html#l01013">height</a>, <a class="el" href="a05972.html#l01090">NLMISC::CMatrix::inverted()</a>, <a class="el" href="a05484.html#l00038">min</a>, <a class="el" href="a06340.html#l00133">NLMISC::CRGBA::modulateFromColor()</a>, <a class="el" href="a06769.html#l00155">NL3D::CZoneLighter::CLightDesc::ModulateWaterColor</a>, <a class="el" href="a05622.html#l00135">nlwarning</a>, <a class="el" href="a05708.html#l00503">NLMISC::COFile::open()</a>, <a class="el" href="a05972.html#l00267">NLMISC::CMatrix::setPos()</a>, <a class="el" href="a05972.html#l00209">NLMISC::CMatrix::setRot()</a>, <a class="el" href="a06769.html#l00092">NL3D::CZoneLighter::CLightDesc::Shadow</a>, <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a06769.html#l00152">NL3D::CZoneLighter::CLightDesc::SkyContributionForWater</a>, <a class="el" href="a06769.html#l00140">NL3D::CZoneLighter::CLightDesc::SkyIntensity</a>, <a class="el" href="a06769.html#l00099">NL3D::CZoneLighter::CLightDesc::SunDirection</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a05981.html#l00096">uint8</a>, <a class="el" href="a06191.html#l00055">NLMISC::CPolygon::Vertices</a>, <a class="el" href="a06769.html#l00146">NL3D::CZoneLighter::CLightDesc::WaterAmbient</a>, <a class="el" href="a06769.html#l00149">NL3D::CZoneLighter::CLightDesc::WaterDiffuse</a>, <a class="el" href="a06769.html#l00143">NL3D::CZoneLighter::CLightDesc::WaterShadowBias</a>, <a class="el" href="a05646.html#l01013">width</a>, <a class="el" href="a05486.html#l02139">NLMISC::CBitmap::writeTGA()</a>, <a class="el" href="a05646.html#l00236">x</a>, <a class="el" href="a06673.html#l00051">NLMISC::CVector::x</a>, <a class="el" href="a06677.html#l00052">NLMISC::CVector2f::x</a>, <a class="el" href="a05646.html#l00236">y</a>, <a class="el" href="a06673.html#l00051">NLMISC::CVector::y</a>, and <a class="el" href="a06677.html#l00052">NLMISC::CVector2f::y</a>. +<p> +Referenced by <a class="el" href="a06768.html#l02852">lightSingleShape()</a>. +<p> +<div class="fragment"><pre>02928 { +02929 <span class="keywordflow">try</span> +02930 { +02932 CTextureFile *diffuseTex = NLMISC::safe_cast<CTextureFile *>(ws.getColorMap()); +02933 std::string texFileName = CPath::lookup(diffuseTex->getFileName()); +02934 diffuseTex->generate(); +02935 <span class="keyword">const</span> <a class="code" href="a04558.html#a15">uint</a> <a class="code" href="a04223.html#a632">width</a> = diffuseTex->getWidth(); +02936 <span class="keyword">const</span> <a class="code" href="a04558.html#a15">uint</a> <a class="code" href="a04223.html#a633">height</a> = diffuseTex->getHeight(); +02937 +02939 <a class="code" href="a02851.html">NLMISC::CMatrix</a> worldSpaceToUVs; +02940 <a class="code" href="a03660.html">NLMISC::CVector2f</a> col0, col1, pos; +02941 ws.getColorMapMat(col0, col1, pos); +02942 worldSpaceToUVs.<a class="code" href="a02851.html#NLMISC_1_1CMatrixz1961_10">setRot</a>(<a class="code" href="a03128.html">NLMISC::CVector</a>(col0.<a class="code" href="a03660.html#NLMISC_1_1CVector2fo0">x</a> * width, col0.<a class="code" href="a03660.html#NLMISC_1_1CVector2fo1">y</a> * height, 0), +02943 <a class="code" href="a03128.html">NLMISC::CVector</a>(col1.<a class="code" href="a03660.html#NLMISC_1_1CVector2fo0">x</a> * width, col1.<a class="code" href="a03660.html#NLMISC_1_1CVector2fo1">y</a> * height, 0), +02944 NLMISC::CVector::K); +02945 worldSpaceToUVs.<a class="code" href="a02851.html#NLMISC_1_1CMatrixz1961_4">setPos</a>(<a class="code" href="a03128.html">NLMISC::CVector</a>(pos.<a class="code" href="a03660.html#NLMISC_1_1CVector2fo0">x</a> * width, pos.<a class="code" href="a03660.html#NLMISC_1_1CVector2fo1">y</a> * height, 0)); +02946 +02948 <a class="code" href="a03100.html">NLMISC::CPolygon</a> p; +02949 ws.getShapeInWorldSpace(p); +02950 +02951 <span class="keywordtype">float</span> minU, maxU; +02952 <span class="keywordtype">float</span> minV, maxV; +02953 +02954 <a class="code" href="a03128.html">NLMISC::CVector</a> uvs = worldSpaceToUVs * p.<a class="code" href="a03100.html#NLMISC_1_1CPolygono0">Vertices</a>[0]; +02955 minU = maxU = uvs.<a class="code" href="a03128.html#NLMISC_1_1CVectoro0">x</a>; +02956 minV = maxV = uvs.<a class="code" href="a03128.html#NLMISC_1_1CVectoro1">y</a>; +02957 +02958 +02959 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a15">uint</a> k = 1; k < (<a class="code" href="a04558.html#a15">uint</a>) p.<a class="code" href="a03100.html#NLMISC_1_1CPolygona7">getNumVertices</a>(); ++k) +02960 { +02961 uvs = worldSpaceToUVs * p.<a class="code" href="a03100.html#NLMISC_1_1CPolygono0">Vertices</a>[k]; +02962 minU = <a class="code" href="a04061.html#a0">std::min</a>(uvs.<a class="code" href="a03128.html#NLMISC_1_1CVectoro0">x</a>, minU); +02963 minV = <a class="code" href="a04061.html#a0">std::min</a>(uvs.<a class="code" href="a03128.html#NLMISC_1_1CVectoro1">y</a>, minV); +02964 maxU = std::max(uvs.<a class="code" href="a03128.html#NLMISC_1_1CVectoro0">x</a>, maxU); +02965 maxV = std::max(uvs.<a class="code" href="a03128.html#NLMISC_1_1CVectoro1">y</a>, maxV); +02966 } +02967 +02968 +02969 +02970 +02971 <a class="code" href="a04558.html#a14">sint</a> iMinU = (<a class="code" href="a04558.html#a14">sint</a>) minU; +02972 <a class="code" href="a04558.html#a14">sint</a> iMaxU = (<a class="code" href="a04558.html#a14">sint</a>) maxU; +02973 <a class="code" href="a04558.html#a14">sint</a> iMinV = (<a class="code" href="a04558.html#a14">sint</a>) minV; +02974 <a class="code" href="a04558.html#a14">sint</a> iMaxV = (<a class="code" href="a04558.html#a14">sint</a>) maxV; +02975 +02976 <a class="code" href="a05378.html#a374">NLMISC::clamp</a>(iMinU, 0, (<a class="code" href="a04558.html#a14">sint</a>) width); +02977 <a class="code" href="a05378.html#a374">NLMISC::clamp</a>(iMaxU, 0, (<a class="code" href="a04558.html#a14">sint</a>) width); +02978 <a class="code" href="a05378.html#a374">NLMISC::clamp</a>(iMinV, 0, (<a class="code" href="a04558.html#a14">sint</a>) height); +02979 <a class="code" href="a05378.html#a374">NLMISC::clamp</a>(iMaxV, 0, (<a class="code" href="a04558.html#a14">sint</a>) height); +02980 +02981 <span class="comment">// matrix to go from uv space to worldspace</span> +02982 <a class="code" href="a02851.html">NLMISC::CMatrix</a> UVSpaceToWorldSpace = worldSpaceToUVs.<a class="code" href="a02851.html#NLMISC_1_1CMatrixz1967_1">inverted</a>(); +02983 +02984 <a class="code" href="a03000.html">CObjectVector<uint8></a> &pixs8 = diffuseTex->getPixels(); +02985 <a class="code" href="a03337.html">NLMISC::CRGBA</a> *rgbPixs = (<a class="code" href="a03337.html">NLMISC::CRGBA</a> *) &pixs8[0]; +02986 +02987 +02989 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a14">sint</a> <a class="code" href="a04223.html#a572">x</a> = iMinU; <a class="code" href="a04223.html#a572">x</a> < iMaxU; ++<a class="code" href="a04223.html#a572">x</a>) +02990 { +02991 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a14">sint</a> <a class="code" href="a04223.html#a573">y</a> = iMinV; <a class="code" href="a04223.html#a573">y</a> < iMaxV; ++<a class="code" href="a04223.html#a573">y</a>) +02992 { +02993 <span class="keywordtype">float</span> factor; +02994 <a class="code" href="a03128.html">NLMISC::CVector</a> pos = UVSpaceToWorldSpace * <a class="code" href="a03128.html">NLMISC::CVector</a>( x + 0.5f, y + 0.5f, 0 ) +02995 + description.WaterShadowBias * <a class="code" href="a03128.html#NLMISC_1_1CVectors2">NLMISC::CVector::K</a>; +02996 <span class="keywordflow">if</span> (description.Shadow) +02997 { +02998 factor = <a class="code" href="a03739.html#NL3D_1_1CZoneLightera4">attenuation</a> (pos, description); +02999 } +03000 <span class="keywordflow">else</span> +03001 { +03002 factor = - <a class="code" href="a03128.html#NLMISC_1_1CVectors2">NLMISC::CVector::K</a> * description.SunDirection; +03003 } +03004 <a class="code" href="a05378.html#a374">clamp</a>(factor, 0.f, 1.f); +03005 factor = factor * description.WaterDiffuse + description.WaterAmbient; +03006 <span class="keywordflow">if</span> (description.SkyContributionForWater) +03007 { +03008 factor += <a class="code" href="a03739.html#NL3D_1_1CZoneLighterd10">getSkyContribution</a>(pos, NLMISC::CVector::K, description.SkyIntensity); +03009 } +03010 <a class="code" href="a05378.html#a374">clamp</a>(factor, 0.f, 1.f); +03011 <a class="code" href="a04558.html#a15">uint</a> intensity = (<a class="code" href="a04558.html#a7">uint8</a>) (255 * factor); +03012 <a class="code" href="a03337.html">NLMISC::CRGBA</a> srcCol(intensity, +03013 intensity, +03014 intensity, +03015 255); +03016 +03017 <span class="keywordflow">if</span> (!description.ModulateWaterColor) +03018 { +03019 rgbPixs[<a class="code" href="a04223.html#a572">x</a> + <a class="code" href="a04223.html#a573">y</a> * <a class="code" href="a04223.html#a632">width</a>] = srcCol; +03020 } +03021 <span class="keywordflow">else</span> +03022 { +03023 <a class="code" href="a03337.html">NLMISC::CRGBA</a> &col = rgbPixs[<a class="code" href="a04223.html#a572">x</a> + <a class="code" href="a04223.html#a573">y</a> * <a class="code" href="a04223.html#a632">width</a>]; +03024 col.<a class="code" href="a03337.html#NLMISC_1_1CRGBAa8">modulateFromColor</a>(col, srcCol); +03025 } +03026 } +03027 } +03028 +03030 <span class="keywordflow">if</span> (<a class="code" href="a05345.html#a34">getExt</a>(texFileName) != <span class="stringliteral">".tga"</span>) +03031 { +03032 <a class="code" href="a04199.html#a2">nlwarning</a>(<span class="stringliteral">"Zone lighter : error when lighting a water surface : input bitmap is not a tga file"</span>); +03033 } +03034 <span class="keywordflow">else</span> +03035 { +03036 <span class="keywordflow">try</span> +03037 { +03038 <a class="code" href="a03011.html">COFile</a> of; +03039 of.<a class="code" href="a03011.html#NLMISC_1_1COFilea9">open</a>(texFileName); +03040 diffuseTex->writeTGA(of, 24); +03041 of.<a class="code" href="a03011.html#NLMISC_1_1COFilea0">close</a>(); +03042 } +03043 <span class="keywordflow">catch</span> (<a class="code" href="a02482.html">NLMISC::Exception</a> &) +03044 { +03045 <a class="code" href="a04199.html#a2">nlwarning</a>(<span class="stringliteral">"Zone lighter : while lighting a water shape, writing %s failed! "</span>, texFileName.c_str()); +03046 } +03047 } +03048 } +03049 <span class="keywordflow">catch</span>(<a class="code" href="a02482.html">NLMISC::Exception</a> &e) +03050 { +03051 <a class="code" href="a04199.html#a2">nlwarning</a>(<span class="stringliteral">"Water shape lighting failed !"</span>); +03052 <a class="code" href="a04199.html#a2">nlwarning</a>(e.what()); +03053 } +03054 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneLighterd16" doxytag="NL3D::CZoneLighter::makeQuadGridFromWaterShapes" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void CZoneLighter::makeQuadGridFromWaterShapes </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a02156.html">NLMISC::CAABBox</a> </td> + <td class="mdname1" valign="top" nowrap> <em>zoneBBox</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Make a quad grid of all the water shapes that where registered by calling <a class="el" href="a03739.html#NL3D_1_1CZoneLightera3">addWaterShape()</a> The vector of water shapes is released then <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign=top><em>bbox</em> </td><td>the bbox of the zone containing the water shapes</td></tr> + </table> +</dl> + +<p> +Definition at line <a class="el" href="a06768.html#l03067">3067</a> of file <a class="el" href="a06768.html">zone_lighter.cpp</a>. +<p> +References <a class="el" href="a06769.html#l00607">_WaterShapeQuadGrid</a>, <a class="el" href="a05587.html#l00141">NLMISC::contReset()</a>, <a class="el" href="a05646.html#l00240">count</a>, <a class="el" href="a06300.html#l00433">NL3D::CQuadGrid< T >::create()</a>, <a class="el" href="a05385.html#l00087">NLMISC::CAABBox::getMax()</a>, <a class="el" href="a05385.html#l00086">NLMISC::CAABBox::getMin()</a>, <a class="el" href="a05646.html#l01013">height</a>, <a class="el" href="a06300.html#l00516">NL3D::CQuadGrid< T >::insert()</a>, <a class="el" href="a05384.html#l00107">NLMISC::CAABBox::intersect()</a>, <a class="el" href="a06769.html#l00342">progress()</a>, <a class="el" href="a05384.html#l00262">NLMISC::CAABBox::transformAABBox()</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a05646.html#l01013">width</a>, <a class="el" href="a06673.html#l00051">NLMISC::CVector::x</a>, and <a class="el" href="a06673.html#l00051">NLMISC::CVector::y</a>. +<p> +Referenced by <a class="el" href="a06768.html#l02045">buildZoneInformation()</a>. +<p> +<div class="fragment"><pre>03068 { +03069 <span class="keywordflow">if</span> (!<a class="code" href="a03739.html#NL3D_1_1CZoneLighterr36">_WaterShapes</a>.size()) <span class="keywordflow">return</span>; +03070 +03071 <a class="code" href="a02156.html">NLMISC::CAABBox</a> tmpBox; +03072 +03074 <span class="keyword">const</span> <a class="code" href="a04558.html#a15">uint</a> numCells = 16; +03075 +03077 <span class="keywordtype">float</span> <a class="code" href="a04223.html#a632">width</a> = zoneBBox.<a class="code" href="a02156.html#NLMISC_1_1CAABBoxz1904_3">getMax</a>().x - zoneBBox.<a class="code" href="a02156.html#NLMISC_1_1CAABBoxz1904_5">getMin</a>().x; +03078 <span class="keywordtype">float</span> <a class="code" href="a04223.html#a633">height</a> = zoneBBox.<a class="code" href="a02156.html#NLMISC_1_1CAABBoxz1904_3">getMax</a>().y - zoneBBox.<a class="code" href="a02156.html#NLMISC_1_1CAABBoxz1904_5">getMin</a>().y; +03079 +03080 <span class="keywordtype">float</span> dim = std::max(width, height); +03081 +03082 +03084 <a class="code" href="a03739.html#NL3D_1_1CZoneLighterr35">_WaterShapeQuadGrid</a>.<a class="code" href="a03273.html#NL3D_1_1CQuadGridz772_1">create</a>(numCells, dim / numCells); +03085 +03086 +03087 <a class="code" href="a04558.html#a15">uint</a> <a class="code" href="a04223.html#a577">count</a> = 0, totalCount = <a class="code" href="a03739.html#NL3D_1_1CZoneLighterr36">_WaterShapes</a>.size(); +03088 +03090 <span class="keywordflow">for</span> (TShapeVect::iterator it = <a class="code" href="a03739.html#NL3D_1_1CZoneLighterr36">_WaterShapes</a>.begin(); it != <a class="code" href="a03739.html#NL3D_1_1CZoneLighterr36">_WaterShapes</a>.end(); ++it, ++<a class="code" href="a04223.html#a577">count</a>) +03091 { +03093 it->Shape->getAABBox(tmpBox); +03094 <a class="code" href="a02156.html">NLMISC::CAABBox</a> currBB = <a class="code" href="a02156.html#NLMISC_1_1CAABBoxExtz1908_3">NLMISC::CAABBox::transformAABBox</a>(it->MT, tmpBox); +03095 +03097 <span class="keywordflow">if</span> (zoneBBox.<a class="code" href="a02156.html#NLMISC_1_1CAABBoxExtz1906_5">intersect</a>(currBB)) +03098 { +03099 <a class="code" href="a03739.html#NL3D_1_1CZoneLighterr35">_WaterShapeQuadGrid</a>.<a class="code" href="a03273.html#NL3D_1_1CQuadGridz774_2">insert</a>(currBB.<a class="code" href="a02156.html#NLMISC_1_1CAABBoxz1904_5">getMin</a>(), currBB.<a class="code" href="a02156.html#NLMISC_1_1CAABBoxz1904_3">getMax</a>(), NLMISC::safe_cast<CWaterShape *>(it->Shape)); +03100 } +03101 <a class="code" href="a03739.html#NL3D_1_1CZoneLightera8">progress</a>(<span class="stringliteral">"Building quadtree from water surfaces"</span>, (<span class="keywordtype">float</span>) count / totalCount); +03102 } +03103 +03105 <a class="code" href="a05378.html#a381">NLMISC::contReset</a>(_WaterShapes); +03106 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneLighterd17" doxytag="NL3D::CZoneLighter::processCalc" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void CZoneLighter::processCalc </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a04558.html#a15">uint</a> </td> + <td class="mdname" nowrap> <em>process</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const <a class="el" href="a03741.html">CLightDesc</a> & </td> + <td class="mdname" nowrap> <em>description</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06768.html#l01293">1293</a> of file <a class="el" href="a06768.html">zone_lighter.cpp</a>. +<p> +References <a class="el" href="a06769.html#l00506">_Lumels</a>, <a class="el" href="a06769.html#l00504">_PatchInfo</a>, <a class="el" href="a06769.html#l00463">_ShadowArray</a>, <a class="el" href="a06769.html#l00459">_ZoneToLight</a>, <a class="el" href="a06768.html#l03767">attenuation()</a>, <a class="el" href="a05587.html#l00115">NLMISC::clamp()</a>, <a class="el" href="a06768.html#l03726">getAPatch()</a>, <a class="el" href="a06768.html#l01271">getSkyContribution()</a>, <a class="el" href="a05862.html#l02206">NL3D::CLandscape::getZone()</a>, <a class="el" href="a06760.html#l00161">NL3D::CPatchInfo::Lumels</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a06769.html#l00092">NL3D::CZoneLighter::CLightDesc::Shadow</a>, <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a06769.html#l00137">NL3D::CZoneLighter::CLightDesc::SkyContribution</a>, <a class="el" href="a06769.html#l00140">NL3D::CZoneLighter::CLightDesc::SkyIntensity</a>, <a class="el" href="a06769.html#l00134">NL3D::CZoneLighter::CLightDesc::SunContribution</a>, and <a class="el" href="a05981.html#l00105">uint</a>. +<p> +<div class="fragment"><pre>01294 { +01295 <span class="comment">// *** Raytrace each patches</span> +01296 +01297 <span class="comment">// Pointer on the zone</span> +01298 CZone *pZone=<a class="code" href="a03739.html#NL3D_1_1CZoneLighterr14">_Landscape</a>-><a class="code" href="a02702.html#NL3D_1_1CLandscapez243_1">getZone</a> (_ZoneToLight); +01299 +01300 <span class="comment">// Get a patch</span> +01301 <a class="code" href="a04558.html#a15">uint</a> patch = <a class="code" href="a03739.html#NL3D_1_1CZoneLighterd6">getAPatch</a> (process); +01302 <span class="keywordflow">while</span> (patch != 0xffffffff) +01303 { +01304 <span class="comment">// For each patch</span> +01305 <span class="keywordflow">if</span> (description.Shadow) +01306 { +01307 <span class="comment">// Lumels</span> +01308 std::vector<CLumelDescriptor> &lumels=<a class="code" href="a03739.html#NL3D_1_1CZoneLighterr18">_Lumels</a>[patch]; +01309 +01310 <span class="comment">// Lumel count</span> +01311 <a class="code" href="a04558.html#a15">uint</a> lumelCount=lumels.size(); +01312 CPatchInfo &patchInfo=<a class="code" href="a03739.html#NL3D_1_1CZoneLighterr25">_PatchInfo</a>[patch]; +01313 <a class="code" href="a04199.html#a6">nlassert</a> (patchInfo.Lumels.size()==lumelCount); +01314 +01315 <span class="comment">// Resize shadow array</span> +01316 <a class="code" href="a03739.html#NL3D_1_1CZoneLighterr31">_ShadowArray</a>[patch].resize (lumelCount); +01317 +01318 <span class="comment">// For each lumel</span> +01319 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a15">uint</a> lumel=0; lumel<lumelCount; lumel++) +01320 { +01321 <span class="keywordtype">float</span> factor=0; +01322 factor = <a class="code" href="a03739.html#NL3D_1_1CZoneLightera4">attenuation</a> (lumels[lumel].Position, description); +01323 patchInfo.Lumels[lumel]=(<a class="code" href="a04558.html#a15">uint</a>)(factor*255); +01324 } +01325 } +01326 <span class="keywordflow">else</span> +01327 { +01328 <span class="comment">// Lumels</span> +01329 std::vector<CLumelDescriptor> &lumels=<a class="code" href="a03739.html#NL3D_1_1CZoneLighterr18">_Lumels</a>[patch]; +01330 +01331 <span class="comment">// Lumel count</span> +01332 <a class="code" href="a04558.html#a15">uint</a> lumelCount=lumels.size(); +01333 CPatchInfo &patchInfo=<a class="code" href="a03739.html#NL3D_1_1CZoneLighterr25">_PatchInfo</a>[patch]; +01334 <a class="code" href="a04199.html#a6">nlassert</a> (patchInfo.Lumels.size()==lumelCount); +01335 +01336 <span class="comment">// For each lumel</span> +01337 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a15">uint</a> lumel=0; lumel<lumelCount; lumel++) +01338 { +01339 <span class="comment">// Not shadowed</span> +01340 patchInfo.Lumels[lumel]=255; +01341 } +01342 } +01343 +01344 <span class="comment">// *** Lighting</span> +01345 +01346 <span class="comment">// Get the patch info</span> +01347 CPatchInfo &patchInfo=<a class="code" href="a03739.html#NL3D_1_1CZoneLighterr25">_PatchInfo</a>[patch]; +01348 +01349 <span class="comment">// ** Pointer on arries</span> +01350 std::vector<CLumelDescriptor> &lumels=<a class="code" href="a03739.html#NL3D_1_1CZoneLighterr18">_Lumels</a>[patch]; +01351 +01352 <span class="comment">// Go for light each lumel</span> +01353 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a15">uint</a> lumel=0; lumel<lumels.size(); lumel++) +01354 { +01355 <span class="comment">// Sky contribution</span> +01356 <span class="keywordtype">float</span> skyContribution; +01357 +01358 <span class="keywordflow">if</span> (description.SkyContribution) +01359 { +01360 skyContribution = <a class="code" href="a03739.html#NL3D_1_1CZoneLighterd10">getSkyContribution</a>(lumels[lumel].Position, lumels[lumel].Normal, description.SkyIntensity); +01361 } +01362 <span class="keywordflow">else</span> +01363 { +01364 skyContribution = 0.f; +01365 } +01366 +01367 <span class="comment">// Sun contribution</span> +01368 <span class="keywordtype">float</span> sunContribution; +01369 <span class="keywordflow">if</span> (description.SunContribution) +01370 { +01371 sunContribution=(-lumels[lumel].Normal*<a class="code" href="a03739.html#NL3D_1_1CZoneLighterr34">_SunDirection</a>)-skyContribution; +01372 <a class="code" href="a05378.html#a374">clamp</a> (sunContribution, 0.f, 1.f); +01373 } +01374 <span class="keywordflow">else</span> +01375 sunContribution=0; +01376 +01377 <span class="comment">// Final lighting</span> +01378 <a class="code" href="a04558.html#a14">sint</a> finalLighting=(<a class="code" href="a04558.html#a14">sint</a>)(255.f*(((<span class="keywordtype">float</span>)patchInfo.Lumels[lumel])*sunContribution/255.f+skyContribution)); +01379 <a class="code" href="a05378.html#a374">clamp</a> (finalLighting, 0, 255); +01380 patchInfo.Lumels[lumel]=finalLighting; +01381 } +01382 +01383 <span class="comment">// Next patch</span> +01384 patch = <a class="code" href="a03739.html#NL3D_1_1CZoneLighterd6">getAPatch</a> (process); +01385 } +01386 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneLighterd18" doxytag="NL3D::CZoneLighter::processLightableShapeCalc" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void CZoneLighter::processLightableShapeCalc </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a04558.html#a15">uint</a> </td> + <td class="mdname" nowrap> <em>process</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a03739.html#NL3D_1_1CZoneLightery0">TShapeVect</a> * </td> + <td class="mdname" nowrap> <em>shapeToLit</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a15">uint</a> </td> + <td class="mdname" nowrap> <em>firstShape</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a15">uint</a> </td> + <td class="mdname" nowrap> <em>lastShape</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const <a class="el" href="a03741.html">CLightDesc</a> & </td> + <td class="mdname" nowrap> <em>description</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Process lighting for a set of lightable shapes. This is called by the threads created by <a class="el" href="a03739.html#NL3D_1_1CZoneLighterd13">lightShapes()</a>. +<p> + +<p> +Definition at line <a class="el" href="a06768.html#l02836">2836</a> of file <a class="el" href="a06768.html">zone_lighter.cpp</a>. +<p> +References <a class="el" href="a06768.html#l02783">isLightableShape()</a>, <a class="el" href="a06768.html#l02852">lightSingleShape()</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a06769.html#l00403">TShapeVect</a>, and <a class="el" href="a05981.html#l00105">uint</a>. +<p> +<div class="fragment"><pre>02841 { +02842 <span class="comment">// for each lightable shape</span> +02843 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a15">uint</a> k = firstShape; k < lastShape; ++k) +02844 { +02845 <a class="code" href="a04199.html#a6">nlassert</a>(<a class="code" href="a03739.html#NL3D_1_1CZoneLightere0">isLightableShape</a>(* (*shapesToLit)[k].Shape)); <span class="comment">// make sure it is a lightable shape </span> +02846 <a class="code" href="a03739.html#NL3D_1_1CZoneLighterd14">lightSingleShape</a>((*shapesToLit)[k], description, process); +02847 } +02848 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneLighterz1203_1" doxytag="NL3D::CZoneLighter::processZonePointLightRT" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void CZoneLighter::processZonePointLightRT </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">std::vector< <a class="el" href="a03094.html">CPointLightNamed</a> > & </td> + <td class="mdname1" valign="top" nowrap> <em>listPointLight</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Process the zone, ie process _PatchInfo. MultiCPU: not done for now. Be aware of <a class="el" href="a03746.html#NL3D_1_1CZoneLighter_1_1CPointLightRTo5">CPointLightRT::RefCount</a>!!!! +<p> +Definition at line <a class="el" href="a06768.html#l03346">3346</a> of file <a class="el" href="a06768.html">zone_lighter.cpp</a>. +<p> +References <a class="el" href="a06769.html#l00504">_PatchInfo</a>, <a class="el" href="a06769.html#l00459">_ZoneToLight</a>, <a class="el" href="a03273.html#NL3D_1_1CQuadGridz776_0">NL3D::CQuadGrid< CPointLightRT * >::begin()</a>, <a class="el" href="a06769.html#l00536">NL3D::CZoneLighter::CPointLightRT::BSphere</a>, <a class="el" href="a05505.html#l00048">NLMISC::CBSphere::Center</a>, <a class="el" href="a05587.html#l00115">NLMISC::clamp()</a>, <a class="el" href="a06179.html#l00267">NL3D::CPointLight::computeLinearAttenuation()</a>, <a class="el" href="a06155.html#l01338">NL3D::CPatch::computeVertex()</a>, <a class="el" href="a06769.html#l00543">NL3D::CZoneLighter::CPointLightRT::DstId</a>, <a class="el" href="a03273.html#NL3D_1_1CQuadGridz776_2">NL3D::CQuadGrid< CPointLightRT * >::end()</a>, <a class="el" href="a05478.html#l00187">NL3D::CBezierPatch::evalNormal()</a>, <a class="el" href="a05862.html#l02206">NL3D::CLandscape::getZone()</a>, <a class="el" href="a06769.html#l00575">NL3D::CZoneLighter::CPatchForPL::HeightTLI</a>, <a class="el" href="a06545.html#l00060">NL3D::CTileLightInfluence::Light</a>, <a class="el" href="a06769.html#l00567">NL3D::CZoneLighter::CTileLightInfUnpack::Light</a>, <a class="el" href="a06769.html#l00568">NL3D::CZoneLighter::CTileLightInfUnpack::LightFactor</a>, <a class="el" href="a05484.html#l00038">min</a>, <a class="el" href="a06682.html#l00119">NLMISC::CVector::normalize()</a>, <a class="el" href="a06769.html#l00558">NL3D::CZoneLighter::CPredPointLightToPoint::Point</a>, <a class="el" href="a06769.html#l00533">NL3D::CZoneLighter::CPointLightRT::PointLight</a>, <a class="el" href="a06769.html#l00342">progress()</a>, <a class="el" href="a06769.html#l00541">NL3D::CZoneLighter::CPointLightRT::RefCount</a>, <a class="el" href="a05646.html#l00977">s</a>, <a class="el" href="a03273.html#NL3D_1_1CQuadGridz776_3">NL3D::CQuadGrid< CPointLightRT * >::select()</a>, <a class="el" href="a06544.html#l00036">NL3D::CTileLightInfluence::setDiffuseLightFactor()</a>, <a class="el" href="a05646.html#l00985">t</a>, <a class="el" href="a06768.html#l03139">NL3D::CZoneLighter::CPointLightRT::testRaytrace()</a>, <a class="el" href="a06760.html#l00171">NL3D::CPatchInfo::TileLightInfluences</a>, <a class="el" href="a06769.html#l00576">NL3D::CZoneLighter::CPatchForPL::TileLightInfluences</a>, <a class="el" href="a05981.html#l00105">uint</a>, <a class="el" href="a05981.html#l00096">uint8</a>, <a class="el" href="a06155.html#l00182">NL3D::CPatch::unpackIntoCache()</a>, <a class="el" href="a05646.html#l00236">w</a>, <a class="el" href="a06769.html#l00575">NL3D::CZoneLighter::CPatchForPL::WidthTLI</a>, <a class="el" href="a05646.html#l00236">x</a>, and <a class="el" href="a05646.html#l00236">y</a>. +<p> +Referenced by <a class="el" href="a06768.html#l00920">light()</a>. +<p> +<div class="fragment"><pre>03347 { +03348 <a class="code" href="a04558.html#a15">uint</a> i; +03349 vector<CPointLightRT*> lightInfs; +03350 lightInfs.reserve(1024); +03351 +03352 <span class="comment">// clear result list</span> +03353 listPointLight.clear(); +03354 +03355 <span class="comment">// zoneToLight</span> +03356 CZone *zoneToLight= <a class="code" href="a03739.html#NL3D_1_1CZoneLighterr14">_Landscape</a>-><a class="code" href="a02702.html#NL3D_1_1CLandscapez243_1">getZone</a>(_ZoneToLight); +03357 <span class="keywordflow">if</span>(!zoneToLight) +03358 <span class="keywordflow">return</span>; +03359 +03360 <span class="comment">// Build patchForPLs</span> +03361 <span class="comment">//===========</span> +03362 vector<CPatchForPL> patchForPLs; +03363 patchForPLs.resize(<a class="code" href="a03739.html#NL3D_1_1CZoneLighterr25">_PatchInfo</a>.size()); +03364 <span class="keywordflow">for</span>(i=0; i<patchForPLs.size(); i++) +03365 { +03366 <span class="comment">// Get OrderS/OrderT</span> +03367 patchForPLs[i].OrderS= <a class="code" href="a03739.html#NL3D_1_1CZoneLighterr25">_PatchInfo</a>[i].OrderS; +03368 patchForPLs[i].OrderT= <a class="code" href="a03739.html#NL3D_1_1CZoneLighterr25">_PatchInfo</a>[i].OrderT; +03369 <span class="comment">// resize TileLightInfluences</span> +03370 <a class="code" href="a04558.html#a15">uint</a> <a class="code" href="a04223.html#a575">w</a>= patchForPLs[i].WidthTLI= patchForPLs[i].OrderS/2 +1 ; +03371 <a class="code" href="a04558.html#a15">uint</a> h= patchForPLs[i].HeightTLI= patchForPLs[i].OrderT/2 +1; +03372 patchForPLs[i].TileLightInfluences.resize(w*h); +03373 } +03374 +03375 +03376 <span class="comment">// compute each TileLightInfluence</span> +03377 <span class="comment">//===========</span> +03378 <span class="keywordflow">for</span>(i=0; i<patchForPLs.size(); i++) +03379 { +03380 <span class="comment">// progress</span> +03381 <a class="code" href="a03739.html#NL3D_1_1CZoneLightera8">progress</a> (<span class="stringliteral">"Compute Influences of PointLights"</span>, 0.5f + 0.5f*i / (<span class="keywordtype">float</span>)patchForPLs.size()); +03382 +03383 CPatchForPL &pfpl= patchForPLs[i]; +03384 <span class="keyword">const</span> CPatch *patch= const_cast<const CZone*>(zoneToLight)->getPatch(i); +03385 +03386 <a class="code" href="a04558.html#a15">uint</a> <a class="code" href="a04223.html#a572">x</a>, <a class="code" href="a04223.html#a573">y</a>; +03387 <span class="keywordflow">for</span>(<a class="code" href="a04223.html#a573">y</a>= 0; <a class="code" href="a04223.html#a573">y</a><pfpl.HeightTLI; <a class="code" href="a04223.html#a573">y</a>++) +03388 { +03389 <span class="keywordflow">for</span>(<a class="code" href="a04223.html#a572">x</a>= 0; <a class="code" href="a04223.html#a572">x</a><pfpl.WidthTLI; <a class="code" href="a04223.html#a572">x</a>++) +03390 { +03391 <span class="comment">// compute the point and normal (normalized) where the TLI lies.</span> +03392 <span class="comment">//---------</span> +03393 CVector pos, normal; +03394 <span class="keywordtype">float</span> <a class="code" href="a04223.html#a626">s</a>, <a class="code" href="a04223.html#a627">t</a>; +03395 <a class="code" href="a04223.html#a626">s</a>= (<span class="keywordtype">float</span>)<a class="code" href="a04223.html#a572">x</a> / (pfpl.WidthTLI-1); +03396 <a class="code" href="a04223.html#a627">t</a>= (<span class="keywordtype">float</span>)<a class="code" href="a04223.html#a573">y</a> / (pfpl.HeightTLI-1); +03397 <span class="comment">// Compute the Vertex, with Noise information (important for accurate raytracing).</span> +03398 pos= patch->computeVertex(s, t); +03399 <span class="comment">// Use UnNoised normal from BezierPatch, because the lighting does not need to be so precise.</span> +03400 CBezierPatch *bp= patch->unpackIntoCache(); +03401 normal= bp->evalNormal(s, t); +03402 +03403 +03404 <span class="comment">// Compute Which light influences him.</span> +03405 <span class="comment">//---------</span> +03406 lightInfs.clear(); +03407 <span class="comment">// Search possible lights around the position.</span> +03408 <a class="code" href="a03739.html#NL3D_1_1CZoneLighterz1203_2">_StaticPointLightQuadGrid</a>.<a class="code" href="a03273.html#NL3D_1_1CQuadGridz776_3">select</a>(pos, pos); +03409 <span class="comment">// For all of them, get the ones which touch this point.</span> +03410 CQuadGrid<CPointLightRT*>::CIterator it= <a class="code" href="a03739.html#NL3D_1_1CZoneLighterz1203_2">_StaticPointLightQuadGrid</a>.<a class="code" href="a03273.html#NL3D_1_1CQuadGridz776_0">begin</a>(); +03411 <span class="keywordflow">while</span>(it != <a class="code" href="a03739.html#NL3D_1_1CZoneLighterz1203_2">_StaticPointLightQuadGrid</a>.<a class="code" href="a03273.html#NL3D_1_1CQuadGridz776_2">end</a>()) +03412 { +03413 CPointLightRT *pl= *it; +03414 +03415 <span class="comment">// a light influence a TLI only if this one is FrontFaced to the light !!</span> +03416 <span class="keywordflow">if</span>( ( pl->BSphere.Center - pos ) * normal > 0) +03417 { +03418 <span class="comment">// Add 5cm else it fails in some case where ( pl->BSphere.Center - pos ) * normal is </span> +03419 <span class="comment">// nearly 0 and the point should be occluded.</span> +03420 <span class="keyword">const</span> <span class="keywordtype">float</span> deltaY= 0.05f; +03421 CVector posToRT= pos + normal * deltaY; +03422 <span class="comment">// Test if really in the radius of the light, if no occlusion, and if in SpotAngle</span> +03423 <span class="keywordflow">if</span>( pl->testRaytrace(posToRT) ) +03424 { +03425 <span class="comment">// Ok, add the light to the lights which influence the TLI </span> +03426 lightInfs.push_back(pl); +03427 } +03428 } +03429 +03430 <span class="comment">// next</span> +03431 it++; +03432 } +03433 +03434 <span class="comment">// Choose the Best ones.</span> +03435 <span class="comment">//---------</span> +03436 CPredPointLightToPoint predPLTP; +03437 predPLTP.Point= pos; +03438 <span class="comment">// sort.</span> +03439 sort(lightInfs.begin(), lightInfs.end(), predPLTP); +03440 <span class="comment">// truncate.</span> +03441 lightInfs.resize( <a class="code" href="a04061.html#a0">min</a>((<a class="code" href="a04558.html#a15">uint</a>)lightInfs.size(), (<a class="code" href="a04558.html#a15">uint</a>)CTileLightInfluence::NumLightPerCorner) ); +03442 +03443 +03444 <span class="comment">// For each of them, fill TLI</span> +03445 <span class="comment">//---------</span> +03446 CTileLightInfUnpack tli; +03447 <a class="code" href="a04558.html#a15">uint</a> lightInfId; +03448 <span class="keywordflow">for</span>(lightInfId=0; lightInfId<lightInfs.size(); lightInfId++) +03449 { +03450 CPointLightRT *pl= lightInfs[lightInfId]; +03451 +03452 <span class="comment">// copy light.</span> +03453 tli.Light[lightInfId]= pl; +03454 <span class="comment">// Compute light Diffuse factor.</span> +03455 CVector dir= pl->BSphere.Center - pos; +03456 dir.normalize(); +03457 tli.LightFactor[lightInfId]= dir * normal; +03458 <a class="code" href="a05378.html#a374">clamp</a>(tli.LightFactor[lightInfId], 0.f, 1.f); +03459 <span class="comment">// modulate by light attenuation.</span> +03460 tli.LightFactor[lightInfId]*= pl->PointLight.computeLinearAttenuation(pos); +03461 +03462 <span class="comment">// Inc RefCount of the light.</span> +03463 pl->RefCount++; +03464 } +03465 <span class="comment">// Reset any empty slot to NULL.</span> +03466 <span class="keywordflow">for</span>(; lightInfId<CTileLightInfluence::NumLightPerCorner; lightInfId++) +03467 { +03468 tli.Light[lightInfId]= NULL; +03469 } +03470 +03471 +03472 <span class="comment">// Set TLI in patch.</span> +03473 <span class="comment">//---------</span> +03474 pfpl.TileLightInfluences[<a class="code" href="a04223.html#a573">y</a>*pfpl.WidthTLI + <a class="code" href="a04223.html#a572">x</a>]= tli; +03475 } +03476 } +03477 } +03478 +03479 +03480 <span class="comment">// compress and setup _PatchInfo with compressed data.</span> +03481 <span class="comment">//===========</span> +03482 <a class="code" href="a04558.html#a15">uint</a> plId= 0; +03483 <span class="comment">// Process each pointLights</span> +03484 <span class="keywordflow">for</span>(i=0; i<<a class="code" href="a03739.html#NL3D_1_1CZoneLighterz1203_3">_StaticPointLights</a>.size(); i++) +03485 { +03486 CPointLightRT &plRT= <a class="code" href="a03739.html#NL3D_1_1CZoneLighterz1203_3">_StaticPointLights</a>[i]; +03487 <span class="comment">// If this light is used.</span> +03488 <span class="keywordflow">if</span>(plRT.RefCount > 0) +03489 { +03490 <span class="comment">// Must Copy it into Zone.</span> +03491 listPointLight.push_back(plRT.PointLight); +03492 plRT.DstId= plId++; +03493 <span class="comment">// If index >= 255, too many lights (NB: => because 255 is a NULL code).</span> +03494 <span class="keywordflow">if</span>(plId>=0xFF) +03495 { +03496 <span class="keywordflow">throw</span> <a class="code" href="a02482.html">Exception</a>(<span class="stringliteral">"Too many Static Point Lights influence the zone!!"</span>); +03497 } +03498 } +03499 } +03500 +03501 <span class="comment">// For each patch, compress TLI in PatchInfo.</span> +03502 <span class="keywordflow">for</span>(i=0; i<patchForPLs.size(); i++) +03503 { +03504 CPatchForPL &pfpl= patchForPLs[i]; +03505 CPatchInfo &pInfo= <a class="code" href="a03739.html#NL3D_1_1CZoneLighterr25">_PatchInfo</a>[i]; +03506 +03507 <a class="code" href="a04558.html#a15">uint</a> <a class="code" href="a04223.html#a575">w</a>= pfpl.WidthTLI; +03508 <a class="code" href="a04558.html#a15">uint</a> h= pfpl.HeightTLI; +03509 +03510 <span class="comment">// Fill pInfo.TileLightInfluences</span> +03511 pInfo.TileLightInfluences.resize(w*h); +03512 <a class="code" href="a04558.html#a15">uint</a> <a class="code" href="a04223.html#a572">x</a>, <a class="code" href="a04223.html#a573">y</a>; +03513 <span class="keywordflow">for</span>(<a class="code" href="a04223.html#a573">y</a>= 0; <a class="code" href="a04223.html#a573">y</a><h; <a class="code" href="a04223.html#a573">y</a>++) +03514 { +03515 <span class="keywordflow">for</span>(<a class="code" href="a04223.html#a572">x</a>= 0; <a class="code" href="a04223.html#a572">x</a><<a class="code" href="a04223.html#a575">w</a>; <a class="code" href="a04223.html#a572">x</a>++) +03516 { +03517 <a class="code" href="a04558.html#a15">uint</a> tliId= <a class="code" href="a04223.html#a573">y</a>*<a class="code" href="a04223.html#a575">w</a> + <a class="code" href="a04223.html#a572">x</a>; +03518 <span class="comment">// For all light slot</span> +03519 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a15">uint</a> lightId= 0; lightId<CTileLightInfluence::NumLightPerCorner; lightId++) +03520 { +03521 CTileLightInfUnpack &tliSrc= pfpl.TileLightInfluences[tliId]; +03522 CTileLightInfluence &tliDst= pInfo.TileLightInfluences[tliId]; +03523 <span class="keywordflow">if</span>(tliSrc.Light[lightId] == NULL) +03524 { +03525 <span class="comment">// Mark as unused.</span> +03526 tliDst.Light[lightId]= 0xFF; +03527 } +03528 <span class="keywordflow">else</span> +03529 { +03530 <span class="comment">// Get index.</span> +03531 tliDst.Light[lightId]= tliSrc.Light[lightId]->DstId; +03532 <span class="comment">// Get Diffuse Factor.</span> +03533 tliDst.setDiffuseLightFactor(lightId, (<a class="code" href="a04558.html#a7">uint8</a>)(tliSrc.LightFactor[lightId]*255)); +03534 } +03535 } +03536 } +03537 } +03538 +03539 } +03540 +03541 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneLightera8" doxytag="NL3D::CZoneLighter::progress" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> virtual void NL3D::CZoneLighter::progress </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const char * </td> + <td class="mdname" nowrap> <em>message</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>float </td> + <td class="mdname" nowrap> <em>progress</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [inline, virtual]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06769.html#l00342">342</a> of file <a class="el" href="a06769.html">zone_lighter.h</a>. +<p> +Referenced by <a class="el" href="a06768.html#l02045">buildZoneInformation()</a>, <a class="el" href="a06768.html#l03202">compilePointLightRT()</a>, <a class="el" href="a06768.html#l03563">computeTileFlagsForPositionTowardWater()</a>, <a class="el" href="a06768.html#l00920">light()</a>, <a class="el" href="a06768.html#l02800">lightShapes()</a>, <a class="el" href="a06768.html#l02852">lightSingleShape()</a>, <a class="el" href="a06768.html#l03067">makeQuadGridFromWaterShapes()</a>, and <a class="el" href="a06768.html#l03346">processZonePointLightRT()</a>. +<p> +<div class="fragment"><pre>00342 {}; +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneLighterd19" doxytag="NL3D::CZoneLighter::setTileFlagsToDefault" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void CZoneLighter::setTileFlagsToDefault </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">std::vector< const <a class="el" href="a03476.html">CTessFace</a> * > & </td> + <td class="mdname1" valign="top" nowrap> <em>tessFaces</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +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' +<p> +Definition at line <a class="el" href="a06768.html#l03710">3710</a> of file <a class="el" href="a06768.html">zone_lighter.cpp</a>. +<p> +References <a class="el" href="a06769.html#l00459">_ZoneToLight</a>, <a class="el" href="a06541.html#l00131">NL3D::CTileElement::getVegetableState()</a>, and <a class="el" href="a06540.html#l00089">NL3D::CTileElement::setVegetableState()</a>. +<p> +Referenced by <a class="el" href="a06768.html#l02045">buildZoneInformation()</a>. +<p> +<div class="fragment"><pre>03711 { +03713 <span class="keywordflow">for</span> (std::vector<const CTessFace*>::iterator it = tessFaces.begin(); it != tessFaces.end(); ++it) +03714 { +03715 <span class="keywordflow">if</span> ((*it)->Patch->getZone()->getZoneId() != <a class="code" href="a03739.html#NL3D_1_1CZoneLighterr39">_ZoneToLight</a>) <span class="keywordflow">continue</span>; +03716 CTileElement &te = (*it)->Patch->Tiles[(*it)->TileId]; +03717 <span class="keywordflow">if</span> (te.getVegetableState() != CTileElement::VegetableDisabled) +03718 { +03719 te.setVegetableState(CTileElement::AboveWater); +03720 } +03721 } +03722 } +</pre></div> </td> + </tr> +</table> +<hr><h2>Friends And Related Function Documentation</h2> +<a class="anchor" name="NL3D_1_1CZoneLightern0" doxytag="NL3D::CZoneLighter::CCalcLightableShapeRunnable" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> friend class <a class="el" href="a02304.html">CCalcLightableShapeRunnable</a><code> [friend]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06769.html#l00356">356</a> of file <a class="el" href="a06769.html">zone_lighter.h</a>. +<p> +Referenced by <a class="el" href="a06768.html#l02800">lightShapes()</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneLightern1" doxytag="NL3D::CZoneLighter::NL3D::CLightRunnable" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> friend class <a class="el" href="a02752.html">NL3D::CLightRunnable</a><code> [friend]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06769.html#l00066">66</a> of file <a class="el" href="a06769.html">zone_lighter.h</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneLightern2" doxytag="NL3D::CZoneLighter::NL3D::CRenderZBuffer" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> friend class <a class="el" href="a03326.html">NL3D::CRenderZBuffer</a><code> [friend]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06769.html#l00067">67</a> of file <a class="el" href="a06769.html">zone_lighter.h</a>. </td> + </tr> +</table> +<hr><h2>Field Documentation</h2> +<a class="anchor" name="NL3D_1_1CZoneLighterr0" doxytag="NL3D::CZoneLighter::_BezierPatch" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> std::vector<std::vector<<a class="el" href="a02258.html">CBezierPatch</a>> > <a class="el" href="a03739.html#NL3D_1_1CZoneLighterr0">NL3D::CZoneLighter::_BezierPatch</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06769.html#l00508">508</a> of file <a class="el" href="a06769.html">zone_lighter.h</a>. +<p> +Referenced by <a class="el" href="a06768.html#l02045">buildZoneInformation()</a>, and <a class="el" href="a06768.html#l01506">getNormal()</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneLighterr1" doxytag="NL3D::CZoneLighter::_Binded" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> std::vector<std::vector<std::vector<bool> > > <a class="el" href="a03739.html#NL3D_1_1CZoneLighterr1">NL3D::CZoneLighter::_Binded</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06769.html#l00511">511</a> of file <a class="el" href="a06769.html">zone_lighter.h</a>. +<p> +Referenced by <a class="el" href="a06768.html#l02045">buildZoneInformation()</a>, and <a class="el" href="a06768.html#l01506">getNormal()</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneLighterr2" doxytag="NL3D::CZoneLighter::_BindInfo" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> std::vector<std::vector<std::vector<<a class="el" href="a03058.html">CPatch::CBindInfo</a>> > > <a class="el" href="a03739.html#NL3D_1_1CZoneLighterr2">NL3D::CZoneLighter::_BindInfo</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06769.html#l00510">510</a> of file <a class="el" href="a06769.html">zone_lighter.h</a>. +<p> +Referenced by <a class="el" href="a06768.html#l02045">buildZoneInformation()</a>, and <a class="el" href="a06768.html#l01506">getNormal()</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneLighterr3" doxytag="NL3D::CZoneLighter::_Bitmaps" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> std::map<std::string, <a class="el" href="a02268.html">NLMISC::CBitmap</a>> <a class="el" href="a03739.html#NL3D_1_1CZoneLighterr3">NL3D::CZoneLighter::_Bitmaps</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06769.html#l00474">474</a> of file <a class="el" href="a06769.html">zone_lighter.h</a>. +<p> +Referenced by <a class="el" href="a06768.html#l01820">getTexture()</a>, and <a class="el" href="a06768.html#l00251">init()</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneLighterr4" doxytag="NL3D::CZoneLighter::_BorderVertices" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> std::vector<<a class="el" href="a02290.html">CBorderVertex</a>> <a class="el" href="a03739.html#NL3D_1_1CZoneLighterr4">NL3D::CZoneLighter::_BorderVertices</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06769.html#l00505">505</a> of file <a class="el" href="a06769.html">zone_lighter.h</a>. +<p> +Referenced by <a class="el" href="a06768.html#l00920">light()</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneLighterr5" doxytag="NL3D::CZoneLighter::_CPUMask" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a13">uint64</a> <a class="el" href="a03739.html#NL3D_1_1CZoneLighterr5">NL3D::CZoneLighter::_CPUMask</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06769.html#l00470">470</a> of file <a class="el" href="a06769.html">zone_lighter.h</a>. +<p> +Referenced by <a class="el" href="a06768.html#l00920">light()</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneLighterv0" doxytag="NL3D::CZoneLighter::_GetNormalDeltaS" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a8">sint16</a> <a class="el" href="a03739.html#NL3D_1_1CZoneLighterv0">CZoneLighter::_GetNormalDeltaS</a> = { -1, 0, 1, 0 }<code> [static, private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06768.html#l01501">1501</a> of file <a class="el" href="a06768.html">zone_lighter.cpp</a>. +<p> +Referenced by <a class="el" href="a06768.html#l01506">getNormal()</a>, and <a class="el" href="a06768.html#l01451">isLumelOnEdgeMustBeOversample()</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneLighterv1" doxytag="NL3D::CZoneLighter::_GetNormalDeltaT" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a8">sint16</a> <a class="el" href="a03739.html#NL3D_1_1CZoneLighterv1">CZoneLighter::_GetNormalDeltaT</a> = { 0, 1, 0, -1 }<code> [static, private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06768.html#l01502">1502</a> of file <a class="el" href="a06768.html">zone_lighter.cpp</a>. +<p> +Referenced by <a class="el" href="a06768.html#l01506">getNormal()</a>, and <a class="el" href="a06768.html#l01451">isLumelOnEdgeMustBeOversample()</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneLighterr6" doxytag="NL3D::CZoneLighter::_GetNormalNormal" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a03128.html">NLMISC::CVector</a> <a class="el" href="a03739.html#NL3D_1_1CZoneLighterr6">NL3D::CZoneLighter::_GetNormalNormal</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06769.html#l00517">517</a> of file <a class="el" href="a06769.html">zone_lighter.h</a>. +<p> +Referenced by <a class="el" href="a06768.html#l02045">buildZoneInformation()</a>, and <a class="el" href="a06768.html#l01506">getNormal()</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneLighterr7" doxytag="NL3D::CZoneLighter::_GetNormalPatch" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> const <a class="el" href="a03057.html">NL3D::CPatch</a>* <a class="el" href="a03739.html#NL3D_1_1CZoneLighterr7">NL3D::CZoneLighter::_GetNormalPatch</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06769.html#l00516">516</a> of file <a class="el" href="a06769.html">zone_lighter.h</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneLighterr8" doxytag="NL3D::CZoneLighter::_GetNormalRadius" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a15">uint</a> <a class="el" href="a03739.html#NL3D_1_1CZoneLighterr8">NL3D::CZoneLighter::_GetNormalRadius</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06769.html#l00518">518</a> of file <a class="el" href="a06769.html">zone_lighter.h</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneLighterr9" doxytag="NL3D::CZoneLighter::_GetNormalSqRadius" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a15">uint</a> <a class="el" href="a03739.html#NL3D_1_1CZoneLighterr9">NL3D::CZoneLighter::_GetNormalSqRadius</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06769.html#l00519">519</a> of file <a class="el" href="a06769.html">zone_lighter.h</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneLighterr10" doxytag="NL3D::CZoneLighter::_HeightField" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> std::vector<float> <a class="el" href="a03739.html#NL3D_1_1CZoneLighterr10">NL3D::CZoneLighter::_HeightField</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06769.html#l00494">494</a> of file <a class="el" href="a06769.html">zone_lighter.h</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneLighterr11" doxytag="NL3D::CZoneLighter::_HeightFieldCellCount" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a14">sint</a> <a class="el" href="a03739.html#NL3D_1_1CZoneLighterr11">NL3D::CZoneLighter::_HeightFieldCellCount</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06769.html#l00495">495</a> of file <a class="el" href="a06769.html">zone_lighter.h</a>. +<p> +Referenced by <a class="el" href="a06768.html#l01390">getMaxPhi()</a>, and <a class="el" href="a06768.html#l00920">light()</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneLighterr12" doxytag="NL3D::CZoneLighter::_HeightfieldCellSize" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> float <a class="el" href="a03739.html#NL3D_1_1CZoneLighterr12">NL3D::CZoneLighter::_HeightfieldCellSize</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06769.html#l00497">497</a> of file <a class="el" href="a06769.html">zone_lighter.h</a>. +<p> +Referenced by <a class="el" href="a06768.html#l01390">getMaxPhi()</a>, <a class="el" href="a06768.html#l01271">getSkyContribution()</a>, and <a class="el" href="a06768.html#l00920">light()</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneLighterr13" doxytag="NL3D::CZoneLighter::_K" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a03128.html">NLMISC::CVector</a> <a class="el" href="a03739.html#NL3D_1_1CZoneLighterr13">NL3D::CZoneLighter::_K</a>[256][8]<code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06769.html#l00524">524</a> of file <a class="el" href="a06769.html">zone_lighter.h</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneLighterr14" doxytag="NL3D::CZoneLighter::_Landscape" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a02702.html">NL3D::CLandscape</a>* <a class="el" href="a03739.html#NL3D_1_1CZoneLighterr14">NL3D::CZoneLighter::_Landscape</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06769.html#l00460">460</a> of file <a class="el" href="a06769.html">zone_lighter.h</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneLighterr15" doxytag="NL3D::CZoneLighter::_LastPatchComputed" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> std::vector<<a class="el" href="a04558.html#a15">uint</a>> <a class="el" href="a03739.html#NL3D_1_1CZoneLighterr15">NL3D::CZoneLighter::_LastPatchComputed</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06769.html#l00467">467</a> of file <a class="el" href="a06769.html">zone_lighter.h</a>. +<p> +Referenced by <a class="el" href="a06768.html#l03726">getAPatch()</a>, and <a class="el" href="a06768.html#l00920">light()</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneLighterr16" doxytag="NL3D::CZoneLighter::_LightableShapes" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a03739.html#NL3D_1_1CZoneLightery0">TShapeVect</a> <a class="el" href="a03739.html#NL3D_1_1CZoneLighterr16">NL3D::CZoneLighter::_LightableShapes</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +lightable shapes +<p> + +<p> +Definition at line <a class="el" href="a06769.html#l00598">598</a> of file <a class="el" href="a06769.html">zone_lighter.h</a>. +<p> +Referenced by <a class="el" href="a06768.html#l02773">addLightableShape()</a>, <a class="el" href="a06768.html#l02800">lightShapes()</a>, and <a class="el" href="a06768.html#l02852">lightSingleShape()</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneLighterr17" doxytag="NL3D::CZoneLighter::_Locator" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> std::vector<std::vector<std::vector<<a class="el" href="a03070.html">CPatchUVLocator</a>> > > <a class="el" href="a03739.html#NL3D_1_1CZoneLighterr17">NL3D::CZoneLighter::_Locator</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06769.html#l00509">509</a> of file <a class="el" href="a06769.html">zone_lighter.h</a>. +<p> +Referenced by <a class="el" href="a06768.html#l02045">buildZoneInformation()</a>, and <a class="el" href="a06768.html#l01506">getNormal()</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneLighterr18" doxytag="NL3D::CZoneLighter::_Lumels" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> std::vector<std::vector<<a class="el" href="a03744.html">CLumelDescriptor</a>> > <a class="el" href="a03739.html#NL3D_1_1CZoneLighterr18">NL3D::CZoneLighter::_Lumels</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06769.html#l00506">506</a> of file <a class="el" href="a06769.html">zone_lighter.h</a>. +<p> +Referenced by <a class="el" href="a06768.html#l02045">buildZoneInformation()</a>, and <a class="el" href="a06768.html#l01293">processCalc()</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneLighterr19" doxytag="NL3D::CZoneLighter::_Mutex" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a02516.html">NLMISC::CFastMutex</a> <a class="el" href="a03739.html#NL3D_1_1CZoneLighterr19">NL3D::CZoneLighter::_Mutex</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06769.html#l00479">479</a> of file <a class="el" href="a06769.html">zone_lighter.h</a>. +<p> +Referenced by <a class="el" href="a06768.html#l00633">NL3D::CRenderZBuffer::run()</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneLighterr20" doxytag="NL3D::CZoneLighter::_NumberOfPatchComputed" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a15">uint</a> <a class="el" href="a03739.html#NL3D_1_1CZoneLighterr20">NL3D::CZoneLighter::_NumberOfPatchComputed</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06769.html#l00468">468</a> of file <a class="el" href="a06769.html">zone_lighter.h</a>. +<p> +Referenced by <a class="el" href="a06768.html#l03726">getAPatch()</a>, <a class="el" href="a06768.html#l00920">light()</a>, and <a class="el" href="a06768.html#l00633">NL3D::CRenderZBuffer::run()</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneLighterr21" doxytag="NL3D::CZoneLighter::_NumLightableShapesProcessed" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a15">uint</a> <a class="el" href="a03739.html#NL3D_1_1CZoneLighterr21">NL3D::CZoneLighter::_NumLightableShapesProcessed</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06769.html#l00599">599</a> of file <a class="el" href="a06769.html">zone_lighter.h</a>. +<p> +Referenced by <a class="el" href="a06768.html#l02800">lightShapes()</a>, and <a class="el" href="a06768.html#l02852">lightSingleShape()</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneLighterr22" doxytag="NL3D::CZoneLighter::_OrigineHeightField" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a03128.html">NLMISC::CVector</a> <a class="el" href="a03739.html#NL3D_1_1CZoneLighterr22">NL3D::CZoneLighter::_OrigineHeightField</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06769.html#l00496">496</a> of file <a class="el" href="a06769.html">zone_lighter.h</a>. +<p> +Referenced by <a class="el" href="a06768.html#l01271">getSkyContribution()</a>, and <a class="el" href="a06768.html#l00920">light()</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneLighterr23" doxytag="NL3D::CZoneLighter::_OversampleEdges" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> std::vector<std::vector<bool> > <a class="el" href="a03739.html#NL3D_1_1CZoneLighterr23">NL3D::CZoneLighter::_OversampleEdges</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06769.html#l00512">512</a> of file <a class="el" href="a06769.html">zone_lighter.h</a>. +<p> +Referenced by <a class="el" href="a06768.html#l02045">buildZoneInformation()</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneLighterr24" doxytag="NL3D::CZoneLighter::_PatchComputed" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> NLMISC::CSynchronized<std::vector<bool> > <a class="el" href="a03739.html#NL3D_1_1CZoneLighterr24">NL3D::CZoneLighter::_PatchComputed</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06769.html#l00466">466</a> of file <a class="el" href="a06769.html">zone_lighter.h</a>. +<p> +Referenced by <a class="el" href="a06768.html#l03726">getAPatch()</a>, and <a class="el" href="a06768.html#l00920">light()</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneLighterr25" doxytag="NL3D::CZoneLighter::_PatchInfo" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> std::vector<<a class="el" href="a03066.html">CPatchInfo</a>> <a class="el" href="a03739.html#NL3D_1_1CZoneLighterr25">NL3D::CZoneLighter::_PatchInfo</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06769.html#l00504">504</a> of file <a class="el" href="a06769.html">zone_lighter.h</a>. +<p> +Referenced by <a class="el" href="a06768.html#l03726">getAPatch()</a>, <a class="el" href="a06768.html#l00920">light()</a>, <a class="el" href="a06768.html#l01293">processCalc()</a>, and <a class="el" href="a06768.html#l03346">processZonePointLightRT()</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneLighterr26" doxytag="NL3D::CZoneLighter::_ProcessCount" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a15">uint</a> <a class="el" href="a03739.html#NL3D_1_1CZoneLighterr26">NL3D::CZoneLighter::_ProcessCount</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06769.html#l00469">469</a> of file <a class="el" href="a06769.html">zone_lighter.h</a>. +<p> +Referenced by <a class="el" href="a06768.html#l00920">light()</a>, and <a class="el" href="a06768.html#l02800">lightShapes()</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneLighterr27" doxytag="NL3D::CZoneLighter::_ProcessExited" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> volatile <a class="el" href="a04558.html#a15">uint</a> <a class="el" href="a03739.html#NL3D_1_1CZoneLighterr27">NL3D::CZoneLighter::_ProcessExited</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06769.html#l00471">471</a> of file <a class="el" href="a06769.html">zone_lighter.h</a>. +<p> +Referenced by <a class="el" href="a06768.html#l00920">light()</a>, <a class="el" href="a06768.html#l02800">lightShapes()</a>, and <a class="el" href="a06768.html#l00633">NL3D::CRenderZBuffer::run()</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneLighterr28" doxytag="NL3D::CZoneLighter::_QuadGrid" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a03273.html">CQuadGrid</a><const <a class="el" href="a03750.html">CTriangle</a>*> <a class="el" href="a03739.html#NL3D_1_1CZoneLighterr28">NL3D::CZoneLighter::_QuadGrid</a>[ 10 ]<code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06769.html#l00456">456</a> of file <a class="el" href="a06769.html">zone_lighter.h</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneLighterr29" doxytag="NL3D::CZoneLighter::_Random" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a03302.html">NLMISC::CRandom</a> <a class="el" href="a03739.html#NL3D_1_1CZoneLighterr29">NL3D::CZoneLighter::_Random</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06769.html#l00491">491</a> of file <a class="el" href="a06769.html">zone_lighter.h</a>. +<p> +Referenced by <a class="el" href="a06768.html#l03767">attenuation()</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneLighterr30" doxytag="NL3D::CZoneLighter::_RayBasis" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a02851.html">NLMISC::CMatrix</a> <a class="el" href="a03739.html#NL3D_1_1CZoneLighterr30">NL3D::CZoneLighter::_RayBasis</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06769.html#l00457">457</a> of file <a class="el" href="a06769.html">zone_lighter.h</a>. +<p> +Referenced by <a class="el" href="a06768.html#l00920">light()</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneLighterr31" doxytag="NL3D::CZoneLighter::_ShadowArray" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> std::vector<std::vector<<a class="el" href="a04558.html#a7">uint8</a>> > <a class="el" href="a03739.html#NL3D_1_1CZoneLighterr31">NL3D::CZoneLighter::_ShadowArray</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06769.html#l00463">463</a> of file <a class="el" href="a06769.html">zone_lighter.h</a>. +<p> +Referenced by <a class="el" href="a06768.html#l00920">light()</a>, and <a class="el" href="a06768.html#l01293">processCalc()</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneLighterr32" doxytag="NL3D::CZoneLighter::_ShadowBias" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> float <a class="el" href="a03739.html#NL3D_1_1CZoneLighterr32">NL3D::CZoneLighter::_ShadowBias</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06769.html#l00461">461</a> of file <a class="el" href="a06769.html">zone_lighter.h</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneLighterr33" doxytag="NL3D::CZoneLighter::_Softshadow" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool <a class="el" href="a03739.html#NL3D_1_1CZoneLighterr33">NL3D::CZoneLighter::_Softshadow</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06769.html#l00462">462</a> of file <a class="el" href="a06769.html">zone_lighter.h</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneLighterz1203_2" doxytag="NL3D::CZoneLighter::_StaticPointLightQuadGrid" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a03273.html">CQuadGrid</a><<a class="el" href="a03746.html">CPointLightRT</a>*> <a class="el" href="a03739.html#NL3D_1_1CZoneLighterz1203_2">NL3D::CZoneLighter::_StaticPointLightQuadGrid</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +QuadGrid of PointLights. Builded from _StaticPointLights. +<p> + +<p> +Definition at line <a class="el" href="a06769.html#l00582">582</a> of file <a class="el" href="a06769.html">zone_lighter.h</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneLighterz1203_3" doxytag="NL3D::CZoneLighter::_StaticPointLights" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> std::vector<<a class="el" href="a03746.html">CPointLightRT</a>> <a class="el" href="a03739.html#NL3D_1_1CZoneLighterz1203_3">NL3D::CZoneLighter::_StaticPointLights</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +List of PointLights. +<p> + +<p> +Definition at line <a class="el" href="a06769.html#l00580">580</a> of file <a class="el" href="a06769.html">zone_lighter.h</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneLighterr34" doxytag="NL3D::CZoneLighter::_SunDirection" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a03128.html">NLMISC::CVector</a> <a class="el" href="a03739.html#NL3D_1_1CZoneLighterr34">NL3D::CZoneLighter::_SunDirection</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06769.html#l00458">458</a> of file <a class="el" href="a06769.html">zone_lighter.h</a>. +<p> +Referenced by <a class="el" href="a06768.html#l00633">NL3D::CRenderZBuffer::run()</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneLighterr35" doxytag="NL3D::CZoneLighter::_WaterShapeQuadGrid" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a03273.html">TWaterShapeQuadGrid</a> <a class="el" href="a03739.html#NL3D_1_1CZoneLighterr35">NL3D::CZoneLighter::_WaterShapeQuadGrid</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06769.html#l00607">607</a> of file <a class="el" href="a06769.html">zone_lighter.h</a>. +<p> +Referenced by <a class="el" href="a06768.html#l03563">computeTileFlagsForPositionTowardWater()</a>, and <a class="el" href="a06768.html#l03067">makeQuadGridFromWaterShapes()</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneLighterr36" doxytag="NL3D::CZoneLighter::_WaterShapes" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a03739.html#NL3D_1_1CZoneLightery0">TShapeVect</a> <a class="el" href="a03739.html#NL3D_1_1CZoneLighterr36">NL3D::CZoneLighter::_WaterShapes</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +List of all the water shapes in the zone. We need them to check wether the tiles are above / below water, or if theyr intersect water +<p> +Definition at line <a class="el" href="a06769.html#l00603">603</a> of file <a class="el" href="a06769.html">zone_lighter.h</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneLightero0" doxytag="NL3D::CZoneLighter::_ZBufferLandscape" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> std::vector<<a class="el" href="a03751.html">CZBuffer</a>> <a class="el" href="a03739.html#NL3D_1_1CZoneLightero0">NL3D::CZoneLighter::_ZBufferLandscape</a> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06769.html#l00483">483</a> of file <a class="el" href="a06769.html">zone_lighter.h</a>. +<p> +Referenced by <a class="el" href="a06768.html#l03767">attenuation()</a>, <a class="el" href="a06768.html#l00920">light()</a>, and <a class="el" href="a06768.html#l00633">NL3D::CRenderZBuffer::run()</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneLightero1" doxytag="NL3D::CZoneLighter::_ZBufferObject" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a03751.html">CZBuffer</a> <a class="el" href="a03739.html#NL3D_1_1CZoneLightero1">NL3D::CZoneLighter::_ZBufferObject</a> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06769.html#l00484">484</a> of file <a class="el" href="a06769.html">zone_lighter.h</a>. +<p> +Referenced by <a class="el" href="a06768.html#l03767">attenuation()</a>, <a class="el" href="a06768.html#l00920">light()</a>, and <a class="el" href="a06768.html#l00633">NL3D::CRenderZBuffer::run()</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneLighterr37" doxytag="NL3D::CZoneLighter::_ZBufferOverflow" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool <a class="el" href="a03739.html#NL3D_1_1CZoneLighterr37">NL3D::CZoneLighter::_ZBufferOverflow</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06769.html#l00488">488</a> of file <a class="el" href="a06769.html">zone_lighter.h</a>. +<p> +Referenced by <a class="el" href="a06768.html#l03767">attenuation()</a>, <a class="el" href="a06768.html#l00251">init()</a>, and <a class="el" href="a06768.html#l00920">light()</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneLighterr38" doxytag="NL3D::CZoneLighter::_ZoneId" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> std::map<<a class="el" href="a04558.html#a15">uint</a>, <a class="el" href="a04558.html#a15">uint</a>> <a class="el" href="a03739.html#NL3D_1_1CZoneLighterr38">NL3D::CZoneLighter::_ZoneId</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06769.html#l00513">513</a> of file <a class="el" href="a06769.html">zone_lighter.h</a>. +<p> +Referenced by <a class="el" href="a06768.html#l02045">buildZoneInformation()</a>, and <a class="el" href="a06768.html#l01506">getNormal()</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CZoneLighterr39" doxytag="NL3D::CZoneLighter::_ZoneToLight" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a15">uint</a> <a class="el" href="a03739.html#NL3D_1_1CZoneLighterr39">NL3D::CZoneLighter::_ZoneToLight</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06769.html#l00459">459</a> of file <a class="el" href="a06769.html">zone_lighter.h</a>. +<p> +Referenced by <a class="el" href="a06768.html#l02045">buildZoneInformation()</a>, <a class="el" href="a06768.html#l03563">computeTileFlagsForPositionTowardWater()</a>, <a class="el" href="a06768.html#l00920">light()</a>, <a class="el" href="a06768.html#l01293">processCalc()</a>, <a class="el" href="a06768.html#l03346">processZonePointLightRT()</a>, and <a class="el" href="a06768.html#l03710">setTileFlagsToDefault()</a>. </td> + </tr> +</table> +<hr>The documentation for this class was generated from the following files:<ul> +<li><a class="el" href="a06769.html">zone_lighter.h</a><li><a class="el" href="a06768.html">zone_lighter.cpp</a></ul> +<hr size="1"><address style="align: right;"><small>Generated on Tue Mar 16 08:35:04 2004 for NeL by +<a href="http://www.doxygen.org/index.html"> +<img src="doxygen.png" alt="doxygen" align="middle" border=0 > +</a>1.3.6 </small></address> +</body> +</html> |