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

@ -30,16 +30,29 @@
#include "math/mMath.h"
#endif
#ifndef _MATTEXTURETARGET_H_
#include "materials/matTextureTarget.h"
#endif
class IDisplayDevice;
class GuiOffscreenCanvas;
struct CameraQuery
{
SimObject* object;
F32 nearPlane;
F32 farPlane;
F32 fov;
FovPort fovPort[2]; // fov for each eye
Point2F projectionOffset;
Point3F eyeOffset;
Point3F eyeOffset[2];
MatrixF eyeTransforms[2];
bool ortho;
MatrixF cameraMatrix;
RectI stereoViewports[2]; // destination viewports
GFXTextureTarget* stereoTargets[2];
GuiCanvas* drawCanvas; // Canvas we are drawing to. Needed for VR
};
/// Abstract base class for 3D viewport GUIs.
@ -50,11 +63,12 @@ class GuiTSCtrl : public GuiContainer
public:
enum RenderStyles {
RenderStyleStandard = 0,
RenderStyleStereoSideBySide = (1<<0),
RenderStyleStereoSideBySide = (1<<0)
};
protected:
static U32 smFrameCount;
static bool smUseLatestDisplayTransform;
F32 mCameraZRot;
F32 mForceFOV;
@ -83,7 +97,11 @@ protected:
/// The last camera query set in onRender.
/// @see getLastCameraQuery
CameraQuery mLastCameraQuery;
CameraQuery mLastCameraQuery;
NamedTexTargetRef mStereoGuiTarget;
GFXVertexBufferHandle<GFXVertexPCT> mStereoOverlayVB;
GFXStateBlockRef mStereoGuiSB;
public:
@ -155,6 +173,10 @@ public:
static const U32& getFrameCount() { return smFrameCount; }
bool shouldRenderChildControls() { return mRenderStyle == RenderStyleStandard; }
void setStereoGui(GuiOffscreenCanvas *canvas);
DECLARE_CONOBJECT(GuiTSCtrl);
DECLARE_CATEGORY( "Gui 3D" );
DECLARE_DESCRIPTION( "Abstract base class for controls that render a 3D viewport." );