MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / g3_CodePoint

Function g3_CodePoint

renderer/HardwarePoints.cpp:25–60  ·  view source on GitHub ↗

code a point. fills in the p3_codes field of the point, and returns the codes

Source from the content-addressed store, hash-verified

23extern vector Clip_plane_point;
24// code a point. fills in the p3_codes field of the point, and returns the codes
25uint8_t g3_CodePoint(g3Point *p) {
26 uint8_t cc = 0;
27
28 if (p->p3_x > p->p3_z)
29 cc |= CC_OFF_RIGHT;
30
31 if (p->p3_y > p->p3_z)
32 cc |= CC_OFF_TOP;
33
34 if (p->p3_x < -p->p3_z)
35 cc |= CC_OFF_LEFT;
36
37 if (p->p3_y < -p->p3_z)
38 cc |= CC_OFF_BOT;
39
40 if (p->p3_z < 0)
41 cc |= CC_BEHIND;
42
43 if (p->p3_z > Far_clip_z)
44 cc |= CC_OFF_FAR;
45
46 // Check to see if we should be clipped to the custom plane
47 if (Clip_custom) {
48 vector vec = p->p3_vec - Clip_plane_point;
49 vec.x /= Matrix_scale.x;
50 vec.y /= Matrix_scale.y;
51 vec.z /= Matrix_scale.z;
52
53 float dp = vec * Clip_plane;
54 if (dp < -0.005f) {
55 cc |= CC_OFF_CUSTOM;
56 }
57 }
58
59 return p->p3_codes = cc;
60}
61
62// rotates a point. returns codes. does not check if already rotated
63uint8_t g3_RotatePoint(g3Point *dest, vector *src) {

Callers 15

g3_RotatePointFunction · 0.85
g3_AddDeltaVecFunction · 0.85
ClipFarEdgeFunction · 0.85
ClipCustomEdgeFunction · 0.85
ClipEdgeFunction · 0.85
DrawTerrainPointsFunction · 0.85
DrawNumberFunction · 0.85
DrawNumberFunction · 0.85
IsPointVisibleFunction · 0.85
ExternalRoomVisibleFunction · 0.85
DrawLightningSkyFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected