rendered paste body Matrix4x4 projection, model, clip; float tmpfloat; glGetFloatv(GL_PROJECTION_MATRIX, projection.mMatrix); glGetFloatv(GL_MODELVIEW_MATRIX, model.mMatrix); clip.Multiply(&model,&projection); mFrustum.mPlane[P_RIGHT].normal[0] = clip.mMatrix[3] - clip.mMatrix[0]; mFrustum.mPlane[P_RIGHT].normal[1] = clip.mMatrix[7] - clip.mMatrix[4]; mFrustum.mPlane[P_RIGHT].normal[2] = clip.mMatrix[11] - clip.mMatrix[8]; mFrustum.mPlane[P_RIGHT].d = clip.mMatrix[15] - clip.mMatrix[12]; tmpfloat = sqrt(mFrustum.mPlane[P_RIGHT].normal[0] * mFrustum.mPlane[P_RIGHT].normal[0] + mFrustum.mPlane[P_RIGHT].normal[1] * mFrustum.mPlane[P_RIGHT].normal[1] + mFrustum.mPlane[P_RIGHT].normal[2] * mFrustum.mPlane[P_RIGHT].normal[2]); mFrustum.mPlane[P_RIGHT].normal[0] /= tmpfloat; mFrustum.mPlane[P_RIGHT].normal[1] /= tmpfloat; mFrustum.mPlane[P_RIGHT].normal[2] /= tmpfloat; mFrustum.mPlane[P_RIGHT].d /= tmpfloat; mFrustum.mPlane[P_LEFT].normal[0] = clip.mMatrix[3] + clip.mMatrix[0]; mFrustum.mPlane[P_LEFT].normal[1] = clip.mMatrix[7] + clip.mMatrix[4]; mFrustum.mPlane[P_LEFT].normal[2] = clip.mMatrix[11] + clip.mMatrix[8]; mFrustum.mPlane[P_LEFT].d = clip.mMatrix[15] + clip.mMatrix[12]; tmpfloat = sqrt(mFrustum.mPlane[P_LEFT].normal[0] * mFrustum.mPlane[P_LEFT].normal[0] + mFrustum.mPlane[P_LEFT].normal[1] * mFrustum.mPlane[P_LEFT].normal[1] + mFrustum.mPlane[P_LEFT].normal[2] * mFrustum.mPlane[P_LEFT].normal[2]); mFrustum.mPlane[P_LEFT].normal[0] /= tmpfloat; mFrustum.mPlane[P_LEFT].normal[1] /= tmpfloat; mFrustum.mPlane[P_LEFT].normal[2] /= tmpfloat; mFrustum.mPlane[P_LEFT].d /= tmpfloat; mFrustum.mPlane[P_BOTTOM].normal[0] = clip.mMatrix[3] + clip.mMatrix[1]; mFrustum.mPlane[P_BOTTOM].normal[1] = clip.mMatrix[7] + clip.mMatrix[5]; mFrustum.mPlane[P_BOTTOM].normal[2] = clip.mMatrix[11] + clip.mMatrix[9]; mFrustum.mPlane[P_BOTTOM].d = clip.mMatrix[15] + clip.mMatrix[13]; tmpfloat = sqrt(mFrustum.mPlane[P_BOTTOM].normal[0] * mFrustum.mPlane[P_BOTTOM].normal[0] + mFrustum.mPlane[P_BOTTOM].normal[1] * mFrustum.mPlane[P_BOTTOM].normal[1] + mFrustum.mPlane[P_BOTTOM].normal[2] * mFrustum.mPlane[P_BOTTOM].normal[2]); mFrustum.mPlane[P_BOTTOM].normal[0] /= tmpfloat; mFrustum.mPlane[P_BOTTOM].normal[1] /= tmpfloat; mFrustum.mPlane[P_BOTTOM].normal[2] /= tmpfloat; mFrustum.mPlane[P_BOTTOM].d /= tmpfloat; mFrustum.mPlane[P_TOP].normal[0] = clip.mMatrix[3] - clip.mMatrix[1]; mFrustum.mPlane[P_TOP].normal[1] = clip.mMatrix[7] - clip.mMatrix[5]; mFrustum.mPlane[P_TOP].normal[2] = clip.mMatrix[11] - clip.mMatrix[9]; mFrustum.mPlane[P_TOP].d = clip.mMatrix[15] - clip.mMatrix[13]; tmpfloat = sqrt(mFrustum.mPlane[P_TOP].normal[0] * mFrustum.mPlane[P_TOP].normal[0] + mFrustum.mPlane[P_TOP].normal[1] * mFrustum.mPlane[P_TOP].normal[1] + mFrustum.mPlane[P_TOP].normal[2] * mFrustum.mPlane[P_TOP].normal[2]); mFrustum.mPlane[P_TOP].normal[0] /= tmpfloat; mFrustum.mPlane[P_TOP].normal[1] /= tmpfloat; mFrustum.mPlane[P_TOP].normal[2] /= tmpfloat; mFrustum.mPlane[P_TOP].d /= tmpfloat; mFrustum.mPlane[P_FAR].normal[0] = clip.mMatrix[3] - clip.mMatrix[2]; mFrustum.mPlane[P_FAR].normal[1] = clip.mMatrix[7] - clip.mMatrix[6]; mFrustum.mPlane[P_FAR].normal[2] = clip.mMatrix[11] - clip.mMatrix[10]; mFrustum.mPlane[P_FAR].d = clip.mMatrix[15] - clip.mMatrix[14]; tmpfloat = sqrt(mFrustum.mPlane[P_FAR].normal[0] * mFrustum.mPlane[P_FAR].normal[0] + mFrustum.mPlane[P_FAR].normal[1] * mFrustum.mPlane[P_FAR].normal[1] + mFrustum.mPlane[P_FAR].normal[2] * mFrustum.mPlane[P_FAR].normal[2]); mFrustum.mPlane[P_FAR].normal[0] /= tmpfloat; mFrustum.mPlane[P_FAR].normal[1] /= tmpfloat; mFrustum.mPlane[P_FAR].normal[2] /= tmpfloat; mFrustum.mPlane[P_FAR].d /= tmpfloat; mFrustum.mPlane[P_NEAR].normal[0] = clip.mMatrix[3] + clip.mMatrix[2]; mFrustum.mPlane[P_NEAR].normal[1] = clip.mMatrix[7] + clip.mMatrix[6]; mFrustum.mPlane[P_NEAR].normal[2] = clip.mMatrix[11] + clip.mMatrix[10]; mFrustum.mPlane[P_NEAR].d = clip.mMatrix[15] + clip.mMatrix[14]; tmpfloat = sqrt(mFrustum.mPlane[P_FAR].normal[0] * mFrustum.mPlane[P_FAR].normal[0] + mFrustum.mPlane[P_FAR].normal[1] * mFrustum.mPlane[P_FAR].normal[1] + mFrustum.mPlane[P_FAR].normal[2] * mFrustum.mPlane[P_FAR].normal[2]); mFrustum.mPlane[P_NEAR].normal[0] /= tmpfloat; mFrustum.mPlane[P_NEAR].normal[1] /= tmpfloat; mFrustum.mPlane[P_NEAR].normal[2] /= tmpfloat; mFrustum.mPlane[P_NEAR].d /= tmpfloat;