aboutsummaryrefslogtreecommitdiffstats
path: root/LibOVR/Src/CAPI/CAPI_DistortionRenderer.cpp
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2015-03-28 01:43:35 +0100
committerSven Gothel <[email protected]>2015-03-28 01:43:35 +0100
commit4207f9c279e832e3afcb3f5fc6cd8d84cb4cfe4c (patch)
treecf3671058d55b47ab6cb6f36f369928606137628 /LibOVR/Src/CAPI/CAPI_DistortionRenderer.cpp
parentc29cd1a2fbff6282bab956ad61661ac9d48c4e6e (diff)
Bump OculusVR RIFT SDK to 0.5.0.1vanilla_0.5.0.1
Diffstat (limited to 'LibOVR/Src/CAPI/CAPI_DistortionRenderer.cpp')
-rw-r--r--LibOVR/Src/CAPI/CAPI_DistortionRenderer.cpp61
1 files changed, 49 insertions, 12 deletions
diff --git a/LibOVR/Src/CAPI/CAPI_DistortionRenderer.cpp b/LibOVR/Src/CAPI/CAPI_DistortionRenderer.cpp
index 78e49e7..4b61ba5 100644
--- a/LibOVR/Src/CAPI/CAPI_DistortionRenderer.cpp
+++ b/LibOVR/Src/CAPI/CAPI_DistortionRenderer.cpp
@@ -29,17 +29,8 @@ limitations under the License.
#if defined (OVR_OS_WIN32)
// TBD: Move to separate config file that handles back-ends.
-#define OVR_D3D_VERSION 11
-#include "D3D1X/CAPI_D3D1X_DistortionRenderer.h"
-#undef OVR_D3D_VERSION
-
-#define OVR_D3D_VERSION 10
-#include "D3D1X/CAPI_D3D1X_DistortionRenderer.h"
-#undef OVR_D3D_VERSION
-
-#define OVR_D3D_VERSION 9
+#include "D3D1X/CAPI_D3D11_DistortionRenderer.h"
#include "D3D9/CAPI_D3D9_DistortionRenderer.h"
-#undef OVR_D3D_VERSION
#endif
@@ -47,6 +38,7 @@ limitations under the License.
namespace OVR { namespace CAPI {
+
//-------------------------------------------------------------------------------------
// ***** DistortionRenderer
@@ -59,7 +51,7 @@ DistortionRenderer::CreateFunc DistortionRenderer::APICreateRegistry[ovrRenderAP
0, // Android_GLES
#if defined (OVR_OS_WIN32)
&D3D9::DistortionRenderer::Create,
- &D3D10::DistortionRenderer::Create,
+ 0, // D3D10
&D3D11::DistortionRenderer::Create
#else
0,
@@ -68,6 +60,51 @@ DistortionRenderer::CreateFunc DistortionRenderer::APICreateRegistry[ovrRenderAP
#endif
};
+DistortionRenderer::DistortionRenderer() :
+ LastUsedOverdriveTextureIndex(-1),
+ LatencyTestActive(false),
+ LatencyTest2Active(false),
+ RenderAPI(ovrRenderAPI_None),
+ Timing(nullptr),
+ RenderState(nullptr),
+ GfxState(),
+ RegisteredPostDistortionCallback(NULL)
+{
+#ifdef OVR_OS_WIN32
+ timer = CreateWaitableTimer(NULL, TRUE, NULL);
+ OVR_ASSERT(timer != NULL);
+#endif
+
+ // set to invalid values to catch uninit case
+ PositionTimewarpDesc.FarClip = -1.0f;
+ PositionTimewarpDesc.NearClip = -1.0f;
+ PositionTimewarpDesc.HmdToEyeViewOffset[0] = Vector3f(MATH_FLOAT_MAXVALUE, MATH_FLOAT_MAXVALUE, MATH_FLOAT_MAXVALUE);
+ PositionTimewarpDesc.HmdToEyeViewOffset[1] = Vector3f(MATH_FLOAT_MAXVALUE, MATH_FLOAT_MAXVALUE, MATH_FLOAT_MAXVALUE);
+}
+
+DistortionRenderer::~DistortionRenderer()
+{
+}
+
+bool DistortionRenderer::Initialize(ovrRenderAPIConfig const* apiConfig,
+ Vision::TrackingStateReader* stateReader,
+ DistortionTimer* timing,
+ HMDRenderState const* renderState)
+{
+ if (!apiConfig || !renderState || !timing || !stateReader)
+ {
+ OVR_ASSERT(false);
+ return false;
+ }
+
+ RenderAPI = apiConfig->Header.API;
+ SensorReader = stateReader;
+ Timing = timing;
+ RenderState = renderState;
+
+ return initializeRenderer(apiConfig);
+}
+
void DistortionRenderer::SetLatencyTestColor(unsigned char* color)
{
if(color)
@@ -153,5 +190,5 @@ double DistortionRenderer::WaitTillTime(double absTime)
return newTime - initialTime;
}
-}} // namespace OVR::CAPI
+}} // namespace OVR::CAPI