#include <patch.h>
Inheritance diagram for NL3D::CTrianglePatch:

Nevrax France
Definition at line 178 of file patch.h.
Public Member Functions | |
| void | computeGradient (float c0, float c1, float c2, CVector &grad) const |
| bool | intersect (const CVector &p0, const CVector &p1, CVector &hit, const class NLMISC::CPlane &plane) const |
Data Fields | |
| CPatchIdent | PatchId |
| from which patch this triangle comes from. | |
| CUV | Uv0 |
| CUV | Uv1 |
| CUV | Uv2 |
| CVector | V0 |
| CVector | V1 |
| CVector | V2 |
|
||||||||||||||||||||
|
3D Gradient computation. Given 3 values at the 3 corners 'ci' (gouraud, uv....), this method compute the gradients Grad. The formula to compute the interpolated value according to a 3d position 'v' in space is then simply: Definition at line 67 of file triangle.cpp. References NLMISC::CVector::normalize(), NLMISC::CVector::set(), NLMISC::CTriangle::V0, NLMISC::CTriangle::V1, NLMISC::CTriangle::V2, NLMISC::CVector::x, NLMISC::CVector::y, and NLMISC::CVector::z. Referenced by NL3D::BuildTangentSpace(), NL3D::CLodCharacterShapeBuild::compile(), NL3D::CTessFace::computeTesselatedPos(), NL3D::CVisualCollisionEntity::computeUvForPos(), and RenderTriangle().
00068 {
00069 // Compute basis for 2D triangle.
00070 CVector locI, locJ, locK;
00071 locI= V1-V0;
00072 locJ= V2-V0;
00073 locK= locI^locJ;
00074 locK.normalize();
00075 locI.normalize();
00076 locJ= locK^locI;
00077
00078 // compute triangle in 2D.
00079 CTriangle tri2D;
00080 tri2D.V0.set(0,0,0);
00081 tri2D.V1.x= (V1-V0)*locI;
00082 tri2D.V1.y= (V1-V0)*locJ;
00083 tri2D.V1.z= 0;
00084 tri2D.V2.x= (V2-V0)*locI;
00085 tri2D.V2.y= (V2-V0)*locJ;
00086 tri2D.V2.z= 0;
00087
00088 // Compute 2 2D Gradients.
00089 float dx01= tri2D.V0.x - tri2D.V2.x;
00090 float dx02= tri2D.V1.x - tri2D.V2.x;
00091 float dy01= tri2D.V0.y - tri2D.V2.y;
00092 float dy02= tri2D.V1.y - tri2D.V2.y;
00093 float dc01= c0 - c2;
00094 float dc02= c1 - c2;
00095 float gd= dx02*dy01 - dx01*dy02;
00096
00097 float OOgd;
00098 if(gd!=0)
00099 OOgd= 1.0f/gd;
00100 else
00101 OOgd= 1; // for now, do not manage correctly this case.
00102 float gx, gy;
00103 gx= (dc02*dy01 - dc01*dy02) * OOgd;
00104 gy= (dc01*dx02 - dc02*dx01) * OOgd;
00105
00106 // transform in 3D.
00107 grad= locI*gx + locJ*gy;
00108 }
|
|
||||||||||||||||||||
|
Intersection detection with a segment. You must pass the normalized plane of the triangle as parameter.
Referenced by NL3D::CInstanceLighter::computeSunContribution(), NL3D::CZoneLighter::CPointLightRT::testRaytrace(), and NL3D::CInstanceLighter::CPointLightRT::testRaytrace(). |
|
|
from which patch this triangle comes from.
Definition at line 181 of file patch.h. Referenced by NL3D::CPatch::addTileTrianglesInBBox(), NL3D::CPatchQuadBlock::buildTileTriangles(), NL3D::CVisualCollisionEntity::getStaticLightSetup(), NL3D::CVisualCollisionEntity::getSurfaceInfo(), and NL3D::CVisualCollisionEntity::snapToLandscapeCurrentTesselation(). |
|
|
Definition at line 170 of file geom_ext.h. Referenced by NL3D::CPatch::addTileTrianglesInBBox(), NL3D::CPatchQuadBlock::buildTileTriangles(), NL3D::CVisualCollisionEntity::computeUvForPos(), and NL3D::CDriverUser::drawTriangle(). |
|
|
Definition at line 170 of file geom_ext.h. Referenced by NL3D::CPatch::addTileTrianglesInBBox(), NL3D::CPatchQuadBlock::buildTileTriangles(), NL3D::CVisualCollisionEntity::computeUvForPos(), and NL3D::CDriverUser::drawTriangle(). |
|
|
Definition at line 170 of file geom_ext.h. Referenced by NL3D::CPatch::addTileTrianglesInBBox(), NL3D::CPatchQuadBlock::buildTileTriangles(), NL3D::CVisualCollisionEntity::computeUvForPos(), and NL3D::CDriverUser::drawTriangle(). |
|
|
|
1.3.6