Code:
diff --git a/Horde3D/Source/Horde3DEngine/egPrimitives.cpp b/Horde3D/Source/Horde3DEngine/egPrimitives.cpp
index 37ab444..6b77219 100644
--- a/Horde3D/Source/Horde3DEngine/egPrimitives.cpp
+++ b/Horde3D/Source/Horde3DEngine/egPrimitives.cpp
@@ -105,10 +105,10 @@ void Frustum::buildViewFrustum( const Matrix4f &viewMat, const Matrix4f &projMat
_corners[1] = mm * Vec3f( 1, -1, 1 );
_corners[2] = mm * Vec3f( 1, 1, 1 );
_corners[3] = mm * Vec3f( -1, 1, 1 );
- _corners[4] = mm * Vec3f( -1, -1, 1 );
- _corners[5] = mm * Vec3f( 1, -1, 1 );
- _corners[6] = mm * Vec3f( 1, 1, 1 );
- _corners[7] = mm * Vec3f( -1, 1, 1 );*/
+ _corners[4] = mm * Vec3f( -1, -1, -1 );
+ _corners[5] = mm * Vec3f( 1, -1, -1 );
+ _corners[6] = mm * Vec3f( 1, 1, -1 );
+ _corners[7] = mm * Vec3f( -1, 1, -1 );*/
}
At least I think that's what you meant.
EDIT: Well, no, doesn't work that way either? o.O
EDIT2: This does what I expected that code to do (copied from pickRay()):
Code:
Matrix4f mm = m.inverted();
Vec4f corner = mm * Vec4f( -1, -1, 1, 1 );
corner.x /= corner.w; corner.y /= corner.w; corner.z /= corner.w;
_corners[0] = Vec3f( corner.x, corner.y, corner.z );
corner = mm * Vec4f( 1, -1, 1, 1 );
corner.x /= corner.w; corner.y /= corner.w; corner.z /= corner.w;
_corners[1] = Vec3f( corner.x, corner.y, corner.z );
corner = mm * Vec4f( 1, 1, 1, 1 );
corner.x /= corner.w; corner.y /= corner.w; corner.z /= corner.w;
_corners[2] = Vec3f( corner.x, corner.y, corner.z );
corner = mm * Vec4f( -1, 1, 1, 1 );
corner.x /= corner.w; corner.y /= corner.w; corner.z /= corner.w;
_corners[3] = Vec3f( corner.x, corner.y, corner.z );
corner = mm * Vec4f( -1, -1, -1, 1 );
corner.x /= corner.w; corner.y /= corner.w; corner.z /= corner.w;
_corners[4] = Vec3f( corner.x, corner.y, corner.z );
corner = mm * Vec4f( 1, -1, -1, 1 );
corner.x /= corner.w; corner.y /= corner.w; corner.z /= corner.w;
_corners[5] = Vec3f( corner.x, corner.y, corner.z );
corner = mm * Vec4f( 1, 1, -1, 1 );
corner.x /= corner.w; corner.y /= corner.w; corner.z /= corner.w;
_corners[6] = Vec3f( corner.x, corner.y, corner.z );
corner = mm * Vec4f( -1, 1, -1, 1 );
corner.x /= corner.w; corner.y /= corner.w; corner.z /= corner.w;
_corners[7] = Vec3f( corner.x, corner.y, corner.z );
Did I get the use of this corner data wrong? Now it just outputs the corners of the frustum in world coordinates.