summaryrefslogtreecommitdiffstats
path: root/LibOVR/Src/CAPI/CAPI_DistortionRenderer.cpp
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2015-03-28 02:08:11 +0100
committerSven Gothel <[email protected]>2015-03-28 02:08:11 +0100
commit450aa6f7df9e67dd256b86f94e65eaf707032aad (patch)
tree04aa207d84ddc8ca246d2573aaaf756b3ce8a0b5 /LibOVR/Src/CAPI/CAPI_DistortionRenderer.cpp
parent3c7b8a17e907f4ef2afd9f77db566a3f6179cbe4 (diff)
parent4207f9c279e832e3afcb3f5fc6cd8d84cb4cfe4c (diff)
Merge branch 'vanilla_0.5.0.1' into jogamp_0.5.0.1
Conflicts: LibOVR/Include/OVR_CAPI_0_5_0.h LibOVR/Src/CAPI/CAPI_HMDState.cpp LibOVR/Src/Displays/OVR_Win32_Dxgi_Display.h LibOVR/Src/Kernel/OVR_System.cpp LibOVR/Src/OVR_CAPI.cpp LibOVR/Src/OVR_Profile.cpp LibOVRKernel/Src/Kernel/OVR_ThreadsWinAPI.cpp LibOVRKernel/Src/Kernel/OVR_Types.h
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 262d4db..a4e9e0d 100644
--- a/LibOVR/Src/CAPI/CAPI_DistortionRenderer.cpp
+++ b/LibOVR/Src/CAPI/CAPI_DistortionRenderer.cpp
@@ -30,17 +30,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
@@ -49,6 +40,7 @@ limitations under the License.
namespace OVR { namespace CAPI {
+
//-------------------------------------------------------------------------------------
// ***** DistortionRenderer
@@ -62,7 +54,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,
@@ -74,6 +66,51 @@ DistortionRenderer::CreateFunc DistortionRenderer::APICreateRegistry[ovrRenderAP
#endif /* !defined(HEADLESS_APP) */
};
+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)
@@ -159,5 +196,5 @@ double DistortionRenderer::WaitTillTime(double absTime)
return newTime - initialTime;
}
-}} // namespace OVR::CAPI
+}} // namespace OVR::CAPI