MCPcopy Create free account
hub / github.com/OpenNFS/OpenNFS / VertexNormal

Function VertexNormal

src/Util/Raytracer.cpp:65–90  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63}
64
65FLOATPT VertexNormal(int blk, int VertexIndex, TRKBLOCK *trk, POLYGONBLOCK *poly) {
66 FLOATPT a, b, c, d;
67 FLOATPT normal;
68 LPPOLYGONDATA p;
69 FLOATPT *v;
70
71 normal.x = 0;
72 normal.y = 0;
73 normal.z = 0;
74
75 v = trk[blk].vert;
76 p = poly[blk].poly[4];
77 int num = poly[blk].sz[4];
78 for (int32_t j = 0; j < num; j++, p++) {
79 for (uint32_t k = 0; k < 4; k++) {
80 if (p->vertex[k] == VertexIndex) {
81 a = v[p->vertex[0]];
82 b = v[p->vertex[1]];
83 c = v[p->vertex[2]];
84 d = v[p->vertex[3]];
85 normal = SumVector(normal, QuadNormalVectorCalc(a, b, c, d));
86 }
87 }
88 }
89 return normal;
90}
91
92int intersect_triangle(double orig[3], double dir[3], double vert0[3], double vert1[3], double vert2[3], double *t,
93 double *u, double *v) {

Callers 2

BlockShadingFixerFunction · 0.85
ObjectShadingFixerFunction · 0.85

Calls 2

SumVectorFunction · 0.85
QuadNormalVectorCalcFunction · 0.85

Tested by

no test coverage detected