wavelength 1.0.0
Loading...
Searching...
No Matches
triangle.h File Reference
#include "math/plane.h"
#include "math/vector3.h"
#include "os/prnstream.h"
Include dependency graph for triangle.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  Triangle
 Triangle stored as a corner, the two edges leaving it, and its normal. More...

Enumerations

enum  CullMode { kCullClockwise = 0 , kCullCounterClockwise = 1 , kCullNone = 2 }
 The faces a segment test against a triangle discards by winding. More...

Functions

PrnStream & operator<< (PrnStream &stream, CullMode nMode)
 Write the label of a cull mode.
bool IntersectSegmentTriangle (const Segment &segment, const Triangle &triangle, CullMode nCull, float *pflT)
 Report whether a segment passes through a triangle.

Enumeration Type Documentation

◆ CullMode

enum CullMode

The faces a segment test against a triangle discards by winding.

The name is inferred. The text writer labels the values "CW", "CCW", and "No".

Enumerator
kCullClockwise 

Discard faces whose normal points along the segment.

kCullCounterClockwise 

Discard faces whose normal points against the segment.

kCullNone 

Test both windings.

Function Documentation

◆ operator<<()

PrnStream & operator<< ( PrnStream & stream,
CullMode nMode )

Write the label of a cull mode.

A value outside CullMode writes nothing.

Parameters
streamThe stream to write to.
nModeThe mode.
Returns
The stream.
Ghidra address:
NTSC-U/C: 0x00290448
Ghidra address:
PAL: 0x00299e10

◆ IntersectSegmentTriangle()

bool IntersectSegmentTriangle ( const Segment & segment,
const Triangle & triangle,
CullMode nCull,
float * pflT )

Report whether a segment passes through a triangle.

The point where the line meets the triangle's plane is projected onto the first coordinate plane, of xy, xz, and yz, in which the edges are not parallel.

Parameters
segmentThe segment.
triangleThe triangle.
nCullThe windings to discard.
pflTReceives the parameter of the point where the line meets the plane, 0 at the start and 1 at the end. A face discarded by winding leaves it unchanged.
Returns
Whether the segment passes through the triangle.
Ghidra address:
NTSC-U/C: 0x00290878
Ghidra address:
PAL: 0x0029a240