#include <tessellation.h>
Nevrax France
Definition at line 97 of file tessellation.h.
Public Member Functions | |
| void | computeGeomPos () |
| CTessVertex () | |
Data Fields | |
| CVector | EndPos |
| float | MaxFaceSize |
| float | MaxNearLimit |
| CVector | Pos |
| CVector | StartPos |
|
|
Definition at line 107 of file tessellation.h. References MaxFaceSize, and MaxNearLimit.
00108 {
00109 // init to 0, so max always() works.
00110 MaxFaceSize= 0;
00111 MaxNearLimit= 0;
00112 }
|
|
|
Definition at line 113 of file tessellation.cpp. References NLMISC::clamp(), EndPos, MaxFaceSize, MaxNearLimit, NLMISC::sqr(), and StartPos. Referenced by NL3D::CPatch::computeGeomorphVertexList(), and NL3D::CTessFace::computeTesselatedPos().
00114 {
00115 // Compute Basic ErrorMetric.
00116 float sqrDist= (StartPos - CLandscapeGlobals::RefineCenter).sqrnorm();
00117 float pgeom= MaxFaceSize * CLandscapeGlobals::OORefineThreshold / sqrDist;
00118
00119 // Compute ErrorMetric modified by TileNear transition, only if TileNear transition.
00120 if( sqrDist< CLandscapeGlobals::TileDistFarSqr )
00121 {
00122 // Soft optim: do it only if necessary, ie result of max(errorMetric, errorMetricModified) is foreseeable here.
00123 if(pgeom < MaxNearLimit)
00124 {
00125 float f= (CLandscapeGlobals::TileDistFarSqr - sqrDist) * CLandscapeGlobals::OOTileDistDeltaSqr;
00126 clamp(f, 0, 1);
00127 // ^4 gives better smooth result
00128 f= sqr(f);
00129 f= sqr(f);
00130 // interpolate the errorMetric
00131 pgeom= MaxNearLimit*f + pgeom*(1-f);
00132 }
00133 }
00134
00135 // Interpolate StartPos to EndPos, between 1 and 2.
00136 if(pgeom<=1.0f)
00137 Pos= StartPos;
00138 else if(pgeom>=2.0f)
00139 Pos= EndPos;
00140 else
00141 {
00142 float f= pgeom - 1.0f;
00143 Pos= f * (EndPos-StartPos) + StartPos;
00144 }
00145 }
|
|
|
|
Definition at line 104 of file tessellation.h. Referenced by computeGeomPos(), CTessVertex(), NL3D::CPatch::fillFar0VertexVB(), NL3D::CPatch::fillFar1VertexVB(), NL3D::CPatch::fillTileVertexVB(), NL3D::CPatch::makeRoots(), NL3D::CTessFace::split(), NL3D::CTessFace::splitRectangular(), and NL3D::CTessFace::unbind(). |
|
|
Definition at line 105 of file tessellation.h. Referenced by computeGeomPos(), CTessVertex(), NL3D::CPatch::fillFar0VertexVB(), NL3D::CPatch::fillFar1VertexVB(), NL3D::CPatch::fillTileVertexVB(), NL3D::CPatch::makeRoots(), NL3D::CTessFace::split(), NL3D::CTessFace::splitRectangular(), and NL3D::CTessFace::unbind(). |
|
|
1.3.6