benilla-re systems structs docs

IntersectRayTriangleIndexed

function · cmath · primitive

Address
0x7c29f0 · 581 bytes, up to 0x7c2c34
Signature
bool __fastcall (const NTempest::C3Ray *ray, const NTempest::C3Vector *vertices, const uint16_t *tri, float *t, float *uv, float eps)
Meaning
Tests a ray against an indexed triangle, two-sided, and writes its parameter and barycentrics
Confidence
verified, proof two
Finding
cmath/geometry#ray-and-triangle
Test
cmath::intersect_difftest

Finding: Ray and triangle in cmath: intersections

0x7c29f0(indices, outT, outUV, slack) intersects the ray in ecx with the triangle whose 16-bit vertex indices are at [ebp+8] into the vertex array in edx, both faces, by Möller–Trumbore. e1 = v1 − v0, e2 = v2 − v0, p = dir × e2, det = e1·p; it misses for −1e-6 < det < 1e-6. With s = origin − v0: u = (s·p)/det, q = s × e1, v = (dir·q)/det, and it hits when u ≥ −slack, v ≥ −slack and u + v ≤ 1 + slack, where the caller gives slack. t = (e2·q)/det goes to outT and (u, v) to outUV when non-null; t is not range-checked. 0x7c2c40 is the same for 32-bit indices.

The derivation is in the doc.

Callers 3

Callees 1

Calls and jumps by a bare address, from tables/calls.tsv.