Oculus VR DK2 Support

- Updated to work with 0.5.x SDK
- Uses Oculus Rendering rather than PostFX
- Stereo rendering refactored so more rendering info is grabbed from the DisplayDevice
- Implements an Offscreen Canvas for in-game gui with oculus
- Message dialogs and metrics display can now go to the OffScreen Canvas (if oculus demo is setup correctly)
This commit is contained in:
James Urquhart 2015-05-06 23:07:48 +01:00
parent b3170bcddf
commit 3a457749ec
56 changed files with 2654 additions and 1426 deletions

View file

@ -21,6 +21,7 @@
//-----------------------------------------------------------------------------
#include "platform/platform.h"
#include "math/util/frustum.h"
#include "math/mathUtils.h"
#include "math/mMath.h"
@ -1409,6 +1410,29 @@ void makeProjection( MatrixF *outMatrix,
//-----------------------------------------------------------------------------
void makeFovPortFrustum(
Frustum *outFrustum,
bool isOrtho,
F32 nearDist,
F32 farDist,
const FovPort &inPort,
const MatrixF &transform)
{
F32 leftSize = nearDist * inPort.leftTan;
F32 rightSize = nearDist * inPort.rightTan;
F32 upSize = nearDist * inPort.upTan;
F32 downSize = nearDist * inPort.downTan;
F32 left = -leftSize;
F32 right = rightSize;
F32 top = upSize;
F32 bottom = -downSize;
outFrustum->set(isOrtho, left, right, top, bottom, nearDist, farDist, transform);
}
//-----------------------------------------------------------------------------
/// This is the special rotation matrix applied to
/// projection matricies for GFX.
///

View file

@ -39,6 +39,10 @@
#include "core/util/tVector.h"
#endif
#ifndef _MATHUTIL_FRUSTUM_H_
#include "math/util/frustum.h"
#endif
class Box3F;
class RectI;
@ -326,6 +330,13 @@ namespace MathUtils
F32 aspectRatio,
F32 nearPlane );
void makeFovPortFrustum( Frustum *outFrustum,
bool isOrtho,
F32 nearDist,
F32 farDist,
const FovPort &inPort,
const MatrixF &transform = MatrixF(1) );
/// Build a GFX projection matrix from the frustum parameters
/// including the optional rotation required by GFX.
void makeProjection( MatrixF *outMatrix,

View file

@ -28,6 +28,8 @@
#include "math/mSphere.h"
#include "platform/profiler.h"
static const MatrixF sGFXProjRotMatrix( EulerF( (M_PI_F / 2.0f), 0.0f, 0.0f ) );
//TODO: For OBB/frustum intersections and ortho frustums, we can resort to a much quicker AABB/OBB test
@ -174,7 +176,7 @@ void Frustum::set( const MatrixF &projMat, bool normalize )
mPlanes[ i ].normalize();
}
/* // Create the corner points via plane intersections.
/*// Create the corner points via plane intersections.
mPlanes[ PlaneNear ].intersect( mPlanes[ PlaneTop ], mPlanes[ PlaneLeft ], &mPoints[ NearTopLeft ] );
mPlanes[ PlaneNear ].intersect( mPlanes[ PlaneTop ], mPlanes[ PlaneRight ], &mPoints[ NearTopRight ] );
mPlanes[ PlaneNear ].intersect( mPlanes[ PlaneBottom ], mPlanes[ PlaneLeft ], &mPoints[ NearBottomLeft ] );

View file

@ -53,6 +53,14 @@
class OrientedBox3F;
/// Advanced fov specification for oculus
struct FovPort
{
float upTan;
float downTan;
float leftTan;
float rightTan;
};
/// Polyhedron data for use by frustums. Uses fixed-size vectors
/// and a static vector for the edge list as that never changes