static inline void _BrushTransormPlanes(ConvexPolyhedron *pBrush, Matrix *pMtx) { //go through the sides for(s32 i = 0; i < pBrush->numPlane; i++) { PlaneTransform(pMtx, &pBrush->planes[i], &pBrush->tPlanes[i]); PlaneNormalize(&pBrush->tPlanes[i], &pBrush->tPlanes[i]); } }
//transform the plane model space static inline void _BrushRawTransormPlanes(ConvexPolyhedron *pBrush, Matrix *pMtx) { //go through the sides for(int i = 0; i < pBrush->numPlane; i++) { pBrush->planes[i].d *= -1; //convert d's sign, for some reason, PlaneTransform doesn't //like id software's plane format... PlaneTransform(pMtx, &pBrush->planes[i], &pBrush->planes[i]); PlaneNormalize(&pBrush->planes[i], &pBrush->planes[i]); pBrush->tPlanes[i] = pBrush->planes[i]; } }
void Frustum::ConstructFrom(Mat4x4F combo) { // Left clipping planeT planes[PLANE_LEFT] = PlaneNormalize( Vec4ANegate(Vec4AAdd(Mat4x4Row(combo, 0), Mat4x4Row(combo, 3)))); // Right clipping planeT planes[PLANE_RIGHT] = PlaneNormalize( Vec4ASub(Mat4x4Row(combo, 0), Mat4x4Row(combo, 3))); // Top clipping planeT planes[PLANE_TOP] = PlaneNormalize( Vec4ASub(Mat4x4Row(combo, 1), Mat4x4Row(combo, 3))); // Bottom clipping planeT planes[PLANE_BOTTOM] = PlaneNormalize( Vec4ANegate(Vec4AAdd(Mat4x4Row(combo, 1), Mat4x4Row(combo, 3)))); // Near clipping planeT planes[PLANE_NEAR] = PlaneNormalize(Vec4ANegate(Mat4x4Row(combo, 2))); // Far clipping planeT planes[PLANE_FAR] = PlaneNormalize( Vec4ASub(Mat4x4Row(combo, 2), Mat4x4Row(combo, 3))); }