|
|
@ -10,7 +10,7 @@ static INLINE void frustum_buildPlane(MATRIX *rot_matrix, VECTOR *normal, SVECTO |
|
|
{ |
|
|
{ |
|
|
ApplyMatrixLV(rot_matrix, normal, normal); |
|
|
ApplyMatrixLV(rot_matrix, normal, normal); |
|
|
VectorNormalS(normal, outPlane); |
|
|
VectorNormalS(normal, outPlane); |
|
|
outPlane->pad = -m_dot12(cam_pos, *outPlane); |
|
|
|
|
|
|
|
|
outPlane->pad = -m_dot12(&cam_pos, outPlane); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void frustum_update(int width, int height) |
|
|
void frustum_update(int width, int height) |
|
|
@ -61,29 +61,29 @@ void frustum_update(int width, int height) |
|
|
|
|
|
|
|
|
static INLINE u_char frustum_pointInside_(const SVECTOR p) |
|
|
static INLINE u_char frustum_pointInside_(const SVECTOR p) |
|
|
{ |
|
|
{ |
|
|
if (m_dot12(*left, p) + left->pad < 0) return 0; |
|
|
|
|
|
if (m_dot12(*right, p) + right->pad < 0) return 0; |
|
|
|
|
|
if (m_dot12(*top, p) + top->pad < 0) return 0; |
|
|
|
|
|
if (m_dot12(*bottom, p) + bottom->pad < 0) return 0; |
|
|
|
|
|
|
|
|
if (m_dot12(left, &p) + left->pad < 0) return 0; |
|
|
|
|
|
if (m_dot12(right, &p) + right->pad < 0) return 0; |
|
|
|
|
|
if (m_dot12(top, &p) + top->pad < 0) return 0; |
|
|
|
|
|
if (m_dot12(bottom, &p) + bottom->pad < 0) return 0; |
|
|
return 1; |
|
|
return 1; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
u_char frustum_pointInside(const SVECTOR *point) |
|
|
u_char frustum_pointInside(const SVECTOR *point) |
|
|
{ |
|
|
{ |
|
|
if (m_dot12(*left, *point) + left->pad < 0) return 0; |
|
|
|
|
|
if (m_dot12(*right, *point) + right->pad < 0) return 0; |
|
|
|
|
|
if (m_dot12(*top, *point) + top->pad < 0) return 0; |
|
|
|
|
|
if (m_dot12(*bottom, *point) + bottom->pad < 0) return 0; |
|
|
|
|
|
|
|
|
if (m_dot12(left, point) + left->pad < 0) return 0; |
|
|
|
|
|
if (m_dot12(right, point) + right->pad < 0) return 0; |
|
|
|
|
|
if (m_dot12(top, point) + top->pad < 0) return 0; |
|
|
|
|
|
if (m_dot12(bottom, point) + bottom->pad < 0) return 0; |
|
|
return 1; |
|
|
return 1; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
u_char frustum_sphereInside(const SVECTOR *sphere) |
|
|
u_char frustum_sphereInside(const SVECTOR *sphere) |
|
|
{ |
|
|
{ |
|
|
short radius = -sphere->pad; |
|
|
short radius = -sphere->pad; |
|
|
if (m_dot12(*left, *sphere) + left->pad < radius) return 0; |
|
|
|
|
|
if (m_dot12(*right, *sphere) + right->pad < radius) return 0; |
|
|
|
|
|
if (m_dot12(*top, *sphere) + top->pad < radius) return 0; |
|
|
|
|
|
if (m_dot12(*bottom, *sphere) + bottom->pad < radius) return 0; |
|
|
|
|
|
|
|
|
if (m_dot12(left, sphere) + left->pad < radius) return 0; |
|
|
|
|
|
if (m_dot12(right, sphere) + right->pad < radius) return 0; |
|
|
|
|
|
if (m_dot12(top, sphere) + top->pad < radius) return 0; |
|
|
|
|
|
if (m_dot12(bottom, sphere) + bottom->pad < radius) return 0; |
|
|
return 1; |
|
|
return 1; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|