void TransformFrustum(Plane Frustum[6], const matrix& obj_to_view) // Given a transformation matrix from object space to view space, // this function transforms the given view-space frustum into object-space, // so that clipping/culling can be done in object space. { int i; vec3 n, p, q; for (i = 0; i < 6; i++) { // There's a faster, more direct way to do this. Deal with later. obj_to_view.ApplyInverseRotation(&n, Frustum[i].Normal); p = Frustum[i].Normal * Frustum[i].D; obj_to_view.ApplyInverse(&q, p); Frustum[i].Normal = n; Frustum[i].D = n * q; } }