From 266f3f654bcf0fb0d171683912d47f011a090d06 Mon Sep 17 00:00:00 2001 From: Dario Seyb Date: Sat, 20 Feb 2016 20:11:18 +0100 Subject: [PATCH] improved vignette --- data/shader/Blit.fsh | 25 +- .../OculusSDK/3rdParty/TinyXml/tinyxml2.cpp | 2101 ++++ extern/OculusSDK/3rdParty/TinyXml/tinyxml2.h | 1911 ++++ extern/OculusSDK/Doc/sdk_docs_have_moved.txt | 3 + extern/OculusSDK/LICENSE.txt | 264 + .../LibOVR/Include/Extras/OVR_CAPI_Util.h | 183 + .../LibOVR/Include/Extras/OVR_Math.h | 3785 +++++++ .../Include/Extras/OVR_StereoProjection.h | 70 + extern/OculusSDK/LibOVR/Include/OVR.h | 21 + extern/OculusSDK/LibOVR/Include/OVR_CAPI.h | 1 + .../OculusSDK/LibOVR/Include/OVR_CAPI_0_8_0.h | 2009 ++++ .../OculusSDK/LibOVR/Include/OVR_CAPI_Audio.h | 48 + .../OculusSDK/LibOVR/Include/OVR_CAPI_D3D.h | 128 + extern/OculusSDK/LibOVR/Include/OVR_CAPI_GL.h | 103 + .../OculusSDK/LibOVR/Include/OVR_CAPI_Keys.h | 61 + .../OculusSDK/LibOVR/Include/OVR_ErrorCode.h | 145 + extern/OculusSDK/LibOVR/Include/OVR_Kernel.h | 25 + extern/OculusSDK/LibOVR/Include/OVR_Version.h | 69 + .../Projects/Windows/ForceRebuild.props | 26 + .../LibOVR/Projects/Windows/LibOVR.props | 30 + .../LibOVR/Projects/Windows/OVRRootPath.props | 15 + .../Projects/Windows/VS2010/LibOVR.vcxproj | 235 + .../Windows/VS2010/LibOVR.vcxproj.filters | 37 + .../Projects/Windows/VS2012/LibOVR.vcxproj | 234 + .../Windows/VS2012/LibOVR.vcxproj.filters | 37 + .../Projects/Windows/VS2013/LibOVR.vcxproj | 453 + .../Windows/VS2013/LibOVR.vcxproj.filters | 39 + .../Projects/Windows/VS2015/LibOVR.vcxproj | 453 + .../Windows/VS2015/LibOVR.vcxproj.filters | 39 + extern/OculusSDK/LibOVR/Src/OVR_CAPIShim.c | 1424 +++ extern/OculusSDK/LibOVR/Src/OVR_CAPI_Util.cpp | 211 + .../LibOVR/Src/OVR_StereoProjection.cpp | 227 + .../LibOVR/Src/Resources/Windows/LibOVR.rc | Bin 0 -> 4838 bytes .../LibOVR/Src/Resources/Windows/Oculus.ico | Bin 0 -> 105425 bytes .../LibOVR/Src/Resources/Windows/resource.h | 0 .../Projects/Windows/OVRRootPath.props | 15 + .../Windows/VS2010/LibOVRKernel.vcxproj | 521 + .../VS2010/LibOVRKernel.vcxproj.filters | 246 + .../Windows/VS2012/LibOVRKernel.vcxproj | 526 + .../VS2012/LibOVRKernel.vcxproj.filters | 237 + .../Projects/Windows/VS2013/LibOVRKernel.sln | 28 + .../Windows/VS2013/LibOVRKernel.vcxproj | 638 ++ .../VS2013/LibOVRKernel.vcxproj.filters | 289 + .../Projects/Windows/VS2015/LibOVRKernel.sln | 28 + .../Windows/VS2015/LibOVRKernel.vcxproj | 638 ++ .../VS2015/LibOVRKernel.vcxproj.filters | 289 + .../LibOVRKernel/Src/GL/CAPI_GLE.cpp | 7988 ++++++++++++++ .../OculusSDK/LibOVRKernel/Src/GL/CAPI_GLE.h | 2047 ++++ .../LibOVRKernel/Src/GL/CAPI_GLE_GL.h | 4833 +++++++++ .../LibOVRKernel/Src/Kernel/OVR_Alg.cpp | 57 + .../LibOVRKernel/Src/Kernel/OVR_Alg.h | 1248 +++ .../LibOVRKernel/Src/Kernel/OVR_Allocator.cpp | 1059 ++ .../LibOVRKernel/Src/Kernel/OVR_Allocator.h | 674 ++ .../LibOVRKernel/Src/Kernel/OVR_Array.h | 847 ++ .../LibOVRKernel/Src/Kernel/OVR_Atomic.cpp | 139 + .../LibOVRKernel/Src/Kernel/OVR_Atomic.h | 1049 ++ .../LibOVRKernel/Src/Kernel/OVR_CRC32.cpp | 203 + .../LibOVRKernel/Src/Kernel/OVR_CRC32.h | 78 + .../LibOVRKernel/Src/Kernel/OVR_Callbacks.cpp | 45 + .../LibOVRKernel/Src/Kernel/OVR_Callbacks.h | 325 + .../Src/Kernel/OVR_CallbacksInternal.h | 366 + .../LibOVRKernel/Src/Kernel/OVR_Color.h | 73 + .../LibOVRKernel/Src/Kernel/OVR_Compiler.h | 1544 +++ .../Src/Kernel/OVR_ContainerAllocator.h | 279 + .../LibOVRKernel/Src/Kernel/OVR_DebugHelp.cpp | 4241 ++++++++ .../LibOVRKernel/Src/Kernel/OVR_DebugHelp.h | 598 ++ .../LibOVRKernel/Src/Kernel/OVR_Delegates.h | 541 + .../LibOVRKernel/Src/Kernel/OVR_Deque.h | 316 + .../LibOVRKernel/Src/Kernel/OVR_File.cpp | 585 + .../LibOVRKernel/Src/Kernel/OVR_File.h | 523 + .../LibOVRKernel/Src/Kernel/OVR_FileFILE.cpp | 615 ++ .../LibOVRKernel/Src/Kernel/OVR_Hash.h | 1306 +++ .../LibOVRKernel/Src/Kernel/OVR_JSON.cpp | 1335 +++ .../LibOVRKernel/Src/Kernel/OVR_JSON.h | 171 + .../LibOVRKernel/Src/Kernel/OVR_KeyCodes.h | 255 + .../LibOVRKernel/Src/Kernel/OVR_List.h | 402 + .../LibOVRKernel/Src/Kernel/OVR_Lockless.cpp | 225 + .../LibOVRKernel/Src/Kernel/OVR_Lockless.h | 150 + .../LibOVRKernel/Src/Kernel/OVR_Log.cpp | 578 + .../LibOVRKernel/Src/Kernel/OVR_Log.h | 252 + .../Src/Kernel/OVR_NewOverride.inl | 197 + .../LibOVRKernel/Src/Kernel/OVR_Nullptr.h | 150 + .../LibOVRKernel/Src/Kernel/OVR_Rand.cpp | 79 + .../LibOVRKernel/Src/Kernel/OVR_Rand.h | 201 + .../LibOVRKernel/Src/Kernel/OVR_RefCount.cpp | 105 + .../LibOVRKernel/Src/Kernel/OVR_RefCount.h | 554 + .../Src/Kernel/OVR_SharedMemory.cpp | 747 ++ .../Src/Kernel/OVR_SharedMemory.h | 254 + .../LibOVRKernel/Src/Kernel/OVR_Std.cpp | 1119 ++ .../LibOVRKernel/Src/Kernel/OVR_Std.h | 626 ++ .../LibOVRKernel/Src/Kernel/OVR_String.cpp | 855 ++ .../LibOVRKernel/Src/Kernel/OVR_String.h | 689 ++ .../LibOVRKernel/Src/Kernel/OVR_StringHash.h | 100 + .../Src/Kernel/OVR_String_FormatUtil.cpp | 80 + .../Src/Kernel/OVR_String_PathUtil.cpp | 210 + .../LibOVRKernel/Src/Kernel/OVR_SysFile.cpp | 139 + .../LibOVRKernel/Src/Kernel/OVR_SysFile.h | 104 + .../LibOVRKernel/Src/Kernel/OVR_System.cpp | 205 + .../LibOVRKernel/Src/Kernel/OVR_System.h | 173 + .../Src/Kernel/OVR_ThreadCommandQueue.cpp | 410 + .../Src/Kernel/OVR_ThreadCommandQueue.h | 318 + .../LibOVRKernel/Src/Kernel/OVR_Threads.h | 443 + .../Src/Kernel/OVR_ThreadsPthread.cpp | 1006 ++ .../Src/Kernel/OVR_ThreadsWinAPI.cpp | 1155 ++ .../LibOVRKernel/Src/Kernel/OVR_Timer.cpp | 483 + .../LibOVRKernel/Src/Kernel/OVR_Timer.h | 108 + .../LibOVRKernel/Src/Kernel/OVR_Types.h | 1072 ++ .../LibOVRKernel/Src/Kernel/OVR_UTF8Util.cpp | 459 + .../LibOVRKernel/Src/Kernel/OVR_UTF8Util.h | 144 + .../Src/Kernel/OVR_Win32_IncludeWindows.h | 225 + .../Src/Kernel/OVR_mach_exc_OSX.c | 2961 ++++++ .../Src/Kernel/OVR_mach_exc_OSX.h | 277 + .../LibOVRKernel/Src/Tracing/.gitignore | 1 + .../LibOVRKernel/Src/Tracing/LibOVREvents.h | 2342 ++++ .../LibOVRKernel/Src/Tracing/LibOVREvents.man | 719 ++ .../LibOVRKernel/Src/Tracing/LibOVREvents.rc | 3 + .../Src/Tracing/LibOVREventsTEMP.BIN | Bin 0 -> 28810 bytes .../Src/Tracing/LibOVREvents_MSG00001.bin | Bin 0 -> 1704 bytes .../LibOVRKernel/Src/Tracing/README.md | 55 + .../LibOVRKernel/Src/Tracing/Tracing.h | 363 + .../LibOVRKernel/Src/Tracing/build.cmd | 15 + .../LibOVRKernel/Src/Tracing/clean.cmd | 6 + .../LibOVRKernel/Src/Tracing/install.cmd | 130 + .../LibOVRKernel/Src/Util/Shaders/Blt_ps.hlsl | 8 + .../LibOVRKernel/Src/Util/Shaders/Blt_vs.hlsl | 8 + .../Src/Util/Util_D3D11_Blitter.cpp | 229 + .../Src/Util/Util_D3D11_Blitter.h | 74 + .../LibOVRKernel/Src/Util/Util_Direct3D.cpp | 102 + .../LibOVRKernel/Src/Util/Util_Direct3D.h | 157 + .../LibOVRKernel/Src/Util/Util_GL_Blitter.cpp | 105 + .../LibOVRKernel/Src/Util/Util_GL_Blitter.h | 67 + .../Src/Util/Util_GetSystemSpecs.cpp | 455 + .../Src/Util/Util_ImageWindow.cpp | 591 + .../LibOVRKernel/Src/Util/Util_ImageWindow.h | 201 + .../Src/Util/Util_LongPollThread.cpp | 97 + .../Src/Util/Util_LongPollThread.h | 72 + .../LibOVRKernel/Src/Util/Util_SystemGUI.cpp | 274 + .../LibOVRKernel/Src/Util/Util_SystemGUI.h | 45 + .../Src/Util/Util_SystemGUI_OSX.mm | 69 + .../LibOVRKernel/Src/Util/Util_SystemInfo.cpp | 717 ++ .../LibOVRKernel/Src/Util/Util_SystemInfo.h | 108 + .../Src/Util/Util_SystemInfo_OSX.mm | 111 + .../LibOVRKernel/Src/Util/Util_Watchdog.cpp | 249 + .../LibOVRKernel/Src/Util/Util_Watchdog.h | 113 + extern/OculusSDK/Oculus World Demo.lnk | Bin 0 -> 2351 bytes extern/OculusSDK/Samples/CommonSrc/Oculus.ico | Bin 0 -> 105425 bytes .../Samples/CommonSrc/Platform/Gamepad.h | 103 + .../Samples/CommonSrc/Platform/Platform.cpp | 61 + .../Samples/CommonSrc/Platform/Platform.h | 248 + .../CommonSrc/Platform/Platform_Default.h | 57 + .../CommonSrc/Platform/Win32_Gamepad.cpp | 125 + .../CommonSrc/Platform/Win32_Gamepad.h | 55 + .../CommonSrc/Platform/Win32_Platform.cpp | 688 ++ .../CommonSrc/Platform/Win32_Platform.h | 135 + .../CommonSrc/Render/Render_D3D11_Device.cpp | 2466 +++++ .../CommonSrc/Render/Render_D3D11_Device.h | 318 + .../CommonSrc/Render/Render_Device.cpp | 1148 ++ .../Samples/CommonSrc/Render/Render_Device.h | 1023 ++ .../Samples/CommonSrc/Render/Render_Font.h | 51 + .../Render/Render_FontEmbed_DejaVu48.h | 9463 +++++++++++++++++ .../CommonSrc/Render/Render_GL_Device.cpp | 2232 ++++ .../CommonSrc/Render/Render_GL_Device.h | 426 + .../Render/Render_GL_Win32_Device.cpp | 215 + .../CommonSrc/Render/Render_GL_Win32_Device.h | 58 + .../Render/Render_LoadTextureDDS.cpp | 146 + .../Render/Render_LoadTextureTGA.cpp | 199 + .../Render/Render_XmlSceneLoader.cpp | 436 + .../CommonSrc/Render/Render_XmlSceneLoader.h | 72 + .../Samples/CommonSrc/Util/OptionMenu.cpp | 1147 ++ .../Samples/CommonSrc/Util/OptionMenu.h | 490 + .../Samples/CommonSrc/Util/RenderProfiler.cpp | 101 + .../Samples/CommonSrc/Util/RenderProfiler.h | 72 + .../Projects/Windows/OVRRootPath.props | 15 + .../VS2010/OculusRoomTiny (DX11).vcxproj | 261 + .../VS2012/OculusRoomTiny (DX11).vcxproj | 261 + .../VS2013/OculusRoomTiny (DX11).vcxproj | 261 + .../OculusRoomTiny (DX11).vcxproj.filters | 9 + .../VS2015/OculusRoomTiny (DX11).vcxproj | 261 + .../OculusRoomTiny (DX11).vcxproj.filters | 9 + .../OculusRoomTiny (DX11)/main.cpp | 296 + .../Projects/Windows/OVRRootPath.props | 15 + .../VS2010/OculusRoomTiny (GL).vcxproj | 261 + .../VS2012/OculusRoomTiny (GL).vcxproj | 261 + .../VS2013/OculusRoomTiny (GL).vcxproj | 261 + .../OculusRoomTiny (GL).vcxproj.filters | 9 + .../VS2015/OculusRoomTiny (GL).vcxproj | 261 + .../OculusRoomTiny (GL).vcxproj.filters | 9 + .../OculusRoomTiny (GL)/main.cpp | 236 + .../Projects/Windows/OVRRootPath.props | 15 + .../Windows/VS2013/ORT (App-rendered).vcxproj | 258 + .../VS2013/ORT (App-rendered).vcxproj.filters | 6 + .../Windows/VS2015/ORT (App-rendered).vcxproj | 258 + .../VS2015/ORT (App-rendered).vcxproj.filters | 6 + .../App-rendered/ORT (App-rendered)/main.cpp | 68 + .../Projects/Windows/OVRRootPath.props | 15 + .../VS2013/ORT (Parallet CPU GPU).vcxproj | 258 + .../ORT (Parallet CPU GPU).vcxproj.filters | 6 + .../VS2015/ORT (Parallet CPU GPU).vcxproj | 258 + .../ORT (Parallet CPU GPU).vcxproj.filters | 6 + .../ORT (Parallel CPU GPU)/main.cpp | 83 + .../Projects/Windows/OVRRootPath.props | 15 + .../VS2013/ORT (Vary Timing, Relief).vcxproj | 258 + .../ORT (Vary Timing, Relief).vcxproj.filters | 6 + .../VS2015/ORT (Vary Timing, Relief).vcxproj | 258 + .../ORT (Vary Timing, Relief).vcxproj.filters | 6 + .../ORT (Vary Timing, Relief)/main.cpp | 103 + .../Common/Win32_AppRendered.h | 191 + .../Common/Win32_BasicVR.h | 511 + .../Common/Win32_CameraCone.h | 151 + .../Common/Win32_ControlMethods.h | 135 + .../Common/Win32_DirectXAppUtil.h | 890 ++ .../Common/Win32_GLAppUtil.h | 857 ++ .../Projects/Windows/OVRRootPath.props | 15 + .../Windows/VS2010/ORT (Adjust IPD).vcxproj | 258 + .../Windows/VS2012/ORT (Adjust IPD).vcxproj | 258 + .../Windows/VS2013/ORT (Adjust IPD).vcxproj | 258 + .../VS2013/ORT (Adjust IPD).vcxproj.filters | 6 + .../Windows/VS2015/ORT (Adjust IPD).vcxproj | 258 + .../VS2015/ORT (Adjust IPD).vcxproj.filters | 6 + .../ORT (Adjust IPD)/main.cpp | 65 + .../Projects/Windows/OVRRootPath.props | 15 + .../VS2013/ORT (Auto Linear Velocity).vcxproj | 258 + ...ORT (Auto Linear Velocity).vcxproj.filters | 6 + .../VS2015/ORT (Auto Linear Velocity).vcxproj | 258 + ...ORT (Auto Linear Velocity).vcxproj.filters | 6 + .../ORT (Auto Linear Velocity)/main.cpp | 73 + .../Projects/Windows/OVRRootPath.props | 15 + .../Windows/VS2013/ORT (Auto Yaw).vcxproj | 258 + .../VS2013/ORT (Auto Yaw).vcxproj.filters | 6 + .../Windows/VS2015/ORT (Auto Yaw).vcxproj | 258 + .../VS2015/ORT (Auto Yaw).vcxproj.filters | 6 + .../ORT (Auto Yaw)/main.cpp | 64 + .../Projects/Windows/OVRRootPath.props | 15 + .../VS2013/ORT (Black Outside Volume).vcxproj | 258 + ...ORT (Black Outside Volume).vcxproj.filters | 6 + .../VS2015/ORT (Black Outside Volume).vcxproj | 258 + ...ORT (Black Outside Volume).vcxproj.filters | 6 + .../ORT (Black Outside Volume)/main.cpp | 89 + .../Projects/Windows/OVRRootPath.props | 15 + .../Windows/VS2013/ORT (Blank Frames).vcxproj | 258 + .../VS2013/ORT (Blank Frames).vcxproj.filters | 6 + .../Windows/VS2015/ORT (Blank Frames).vcxproj | 258 + .../VS2015/ORT (Blank Frames).vcxproj.filters | 6 + .../ORT (Blank Frames)/main.cpp | 73 + .../Projects/Windows/OVRRootPath.props | 15 + .../VS2013/ORT (Camera Volume).vcxproj | 261 + .../ORT (Camera Volume).vcxproj.filters | 9 + .../VS2015/ORT (Camera Volume).vcxproj | 261 + .../ORT (Camera Volume).vcxproj.filters | 9 + .../ORT (Camera Volume)/main.cpp | 82 + .../Projects/Windows/OVRRootPath.props | 15 + .../ORT (Cockpit, Mono Exterior).vcxproj | 258 + ...T (Cockpit, Mono Exterior).vcxproj.filters | 6 + .../ORT (Cockpit, Mono Exterior).vcxproj | 258 + ...T (Cockpit, Mono Exterior).vcxproj.filters | 6 + .../ORT (Cockpit, Mono Exterior)/main.cpp | 105 + .../Projects/Windows/OVRRootPath.props | 15 + .../VS2013/ORT (Control Combination).vcxproj | 258 + .../ORT (Control Combination).vcxproj.filters | 6 + .../VS2015/ORT (Control Combination).vcxproj | 258 + .../ORT (Control Combination).vcxproj.filters | 6 + .../ORT (Control Combination)/main.cpp | 96 + .../Projects/Win/OVRRootPath.props | 15 + .../Win/VS2013/ORT (Controllers).vcxproj | 258 + .../VS2013/ORT (Controllers).vcxproj.filters | 6 + .../Win/VS2015/ORT (Controllers).vcxproj | 258 + .../VS2015/ORT (Controllers).vcxproj.filters | 6 + .../ORT (Controllers)/main.cpp | 83 + .../Projects/Win/OVRRootPath.props | 15 + .../Win/VS2013/ORT (Debug HUD).vcxproj | 258 + .../Win/VS2015/ORT (Debug HUD).vcxproj | 258 + .../ORT (Debug HUD)/main.cpp | 100 + .../Projects/Win/OVRRootPath.props | 15 + .../Win/VS2013/ORT (Direct Quad).vcxproj | 258 + .../Win/VS2015/ORT (Direct Quad).vcxproj | 258 + .../ORT (Direct Quad)/main.cpp | 109 + .../Oculus PC SDK Engine Integration.docx | Bin 0 -> 16044 bytes .../Projects/Windows/OVRRootPath.props | 15 + .../ORT (Engine Integration Stages).vcxproj | 266 + ...Engine Integration Stages).vcxproj.filters | 14 + .../ORT (Engine Integration Stages).vcxproj | 266 + ...Engine Integration Stages).vcxproj.filters | 14 + .../ORT (Engine Integration Stages)/main.cpp | 53 + .../stage1 - Start with nonVR application.h | 53 + .../stage2 - Add LibOVR.h | 34 + .../stage3 - Render to eye buffers.h | 56 + .../stage4 - Hook into sensors.h | 57 + .../stage5 - Output to headset.h | 115 + .../stage6 - Add mirror.h | 52 + .../Projects/Windows/OVRRootPath.props | 15 + .../VS2013/ORT (Fading Camera Volume).vcxproj | 258 + ...ORT (Fading Camera Volume).vcxproj.filters | 6 + .../VS2015/ORT (Fading Camera Volume).vcxproj | 258 + ...ORT (Fading Camera Volume).vcxproj.filters | 6 + .../ORT (Fading Camera Volume)/main.cpp | 87 + .../Projects/Win/OVRRootPath.props | 15 + .../Win/VS2010/ORT (Freeze Timewarp).vcxproj | 258 + .../Win/VS2012/ORT (Freeze Timewarp).vcxproj | 258 + .../Win/VS2013/ORT (Freeze Timewarp).vcxproj | 258 + .../ORT (Freeze Timewarp).vcxproj.filters | 6 + .../Win/VS2015/ORT (Freeze Timewarp).vcxproj | 258 + .../ORT (Freeze Timewarp).vcxproj.filters | 6 + .../ORT (Freeze Timewarp)/main.cpp | 72 + .../Projects/Windows/OVRRootPath.props | 15 + .../ORT (Jump From Accelerometers).vcxproj | 258 + ...(Jump From Accelerometers).vcxproj.filters | 6 + .../ORT (Jump From Accelerometers).vcxproj | 258 + ...(Jump From Accelerometers).vcxproj.filters | 6 + .../ORT (Jump From Accelerometers)/main.cpp | 64 + .../Projects/Windows/OVRRootPath.props | 15 + .../Windows/VS2013/ORT (Layers).vcxproj | 258 + .../VS2013/ORT (Layers).vcxproj.filters | 6 + .../Windows/VS2015/ORT (Layers).vcxproj | 258 + .../VS2015/ORT (Layers).vcxproj.filters | 6 + .../ORT (Layers)/main.cpp | 87 + .../ORT (MSAA)/Projects/Win/OVRRootPath.props | 15 + .../Projects/Win/VS2010/ORT (MSAA).vcxproj | 258 + .../Projects/Win/VS2012/ORT (MSAA).vcxproj | 258 + .../Projects/Win/VS2013/ORT (MSAA).vcxproj | 258 + .../Win/VS2013/ORT (MSAA).vcxproj.filters | 6 + .../Projects/Win/VS2015/ORT (MSAA).vcxproj | 258 + .../Win/VS2015/ORT (MSAA).vcxproj.filters | 6 + .../ORT (MSAA)/main.cpp | 87 + .../Projects/Windows/OVRRootPath.props | 15 + .../ORT (Matching Alternate Eye).vcxproj | 258 + .../ORT (Matching Alternate Eye).vcxproj | 258 + .../ORT (Matching Alternate Eye).vcxproj | 258 + ...T (Matching Alternate Eye).vcxproj.filters | 6 + .../ORT (Matching Alternate Eye).vcxproj | 258 + ...T (Matching Alternate Eye).vcxproj.filters | 6 + .../ORT (Matching Alternate Eye)/main.cpp | 131 + .../Projects/Windows/OVRRootPath.props | 15 + .../ORT (Mid Mono, Exaggerate Far).vcxproj | 258 + ...(Mid Mono, Exaggerate Far).vcxproj.filters | 6 + .../ORT (Mid Mono, Exaggerate Far).vcxproj | 258 + ...(Mid Mono, Exaggerate Far).vcxproj.filters | 6 + .../ORT (Mid Mono, Exaggerate Far)/main.cpp | 126 + .../Projects/Win/OVRRootPath.props | 15 + .../Win/VS2013/ORT (Mirror Variants).vcxproj | 258 + .../ORT (Mirror Variants).vcxproj.filters | 6 + .../Win/VS2015/ORT (Mirror Variants).vcxproj | 258 + .../ORT (Mirror Variants).vcxproj.filters | 6 + .../ORT (Mirror Variants)/main.cpp | 162 + .../Projects/Windows/OVRRootPath.props | 15 + .../Windows/VS2010/ORT (Monoscopic).vcxproj | 258 + .../Windows/VS2012/ORT (Monoscopic).vcxproj | 258 + .../Windows/VS2013/ORT (Monoscopic).vcxproj | 258 + .../VS2013/ORT (Monoscopic).vcxproj.filters | 6 + .../Windows/VS2015/ORT (Monoscopic).vcxproj | 258 + .../VS2015/ORT (Monoscopic).vcxproj.filters | 6 + .../ORT (Monoscopic)/main.cpp | 90 + .../Projects/Windows/OVRRootPath.props | 15 + .../ORT (Motion In Look Direction).vcxproj | 258 + ...(Motion In Look Direction).vcxproj.filters | 6 + .../ORT (Motion In Look Direction).vcxproj | 258 + ...(Motion In Look Direction).vcxproj.filters | 6 + .../ORT (Motion In Look Direction)/main.cpp | 72 + .../Projects/Windows/OVRRootPath.props | 15 + .../ORT (Near Stereo, Far Mono).vcxproj | 258 + ...RT (Near Stereo, Far Mono).vcxproj.filters | 6 + .../ORT (Near Stereo, Far Mono).vcxproj | 258 + ...RT (Near Stereo, Far Mono).vcxproj.filters | 6 + .../ORT (Near Stereo, Far Mono)/main.cpp | 117 + .../Projects/Win/OVRRootPath.props | 15 + .../Win/VS2013/ORT (Performance HUD).vcxproj | 258 + .../Win/VS2015/ORT (Performance HUD).vcxproj | 258 + .../ORT (Performance HUD)/main.cpp | 149 + .../Projects/Windows/OVRRootPath.props | 15 + .../VS2013/ORT (Quantized Yaw).vcxproj | 258 + .../ORT (Quantized Yaw).vcxproj.filters | 6 + .../VS2015/ORT (Quantized Yaw).vcxproj | 258 + .../ORT (Quantized Yaw).vcxproj.filters | 6 + .../ORT (Quantized Yaw)/main.cpp | 75 + .../Projects/Win/OVRRootPath.props | 15 + .../Win/VS2013/ORT (Queue Ahead).vcxproj | 258 + .../VS2013/ORT (Queue Ahead).vcxproj.filters | 6 + .../Win/VS2015/ORT (Queue Ahead).vcxproj | 258 + .../VS2015/ORT (Queue Ahead).vcxproj.filters | 6 + .../ORT (Queue Ahead)/main.cpp | 122 + .../Projects/Windows/OVRRootPath.props | 15 + .../VS2010/ORT (Recenter Pose).vcxproj | 258 + .../VS2012/ORT (Recenter Pose).vcxproj | 258 + .../VS2013/ORT (Recenter Pose).vcxproj | 258 + .../ORT (Recenter Pose).vcxproj.filters | 6 + .../VS2015/ORT (Recenter Pose).vcxproj | 258 + .../ORT (Recenter Pose).vcxproj.filters | 6 + .../ORT (Recenter Pose)/main.cpp | 65 + .../Projects/Win/OVRRootPath.props | 15 + .../Win/VS2013/ORT (Remapped Keys).vcxproj | 258 + .../ORT (Remapped Keys).vcxproj.filters | 6 + .../Win/VS2015/ORT (Remapped Keys).vcxproj | 258 + .../ORT (Remapped Keys).vcxproj.filters | 6 + .../ORT (Remapped Keys)/main.cpp | 98 + .../Projects/Windows/OVRRootPath.props | 15 + .../VS2010/ORT (Simple Alternate Eye).vcxproj | 258 + .../VS2012/ORT (Simple Alternate Eye).vcxproj | 258 + .../VS2013/ORT (Simple Alternate Eye).vcxproj | 258 + ...ORT (Simple Alternate Eye).vcxproj.filters | 6 + .../VS2015/ORT (Simple Alternate Eye).vcxproj | 258 + ...ORT (Simple Alternate Eye).vcxproj.filters | 6 + .../ORT (Simple Alternate Eye)/main.cpp | 90 + .../Projects/Windows/OVRRootPath.props | 15 + .../VS2013/ORT (Smooth Quantized Yaw).vcxproj | 258 + ...ORT (Smooth Quantized Yaw).vcxproj.filters | 6 + .../VS2015/ORT (Smooth Quantized Yaw).vcxproj | 258 + ...ORT (Smooth Quantized Yaw).vcxproj.filters | 6 + .../ORT (Smooth Quantized Yaw)/main.cpp | 100 + .../Projects/Windows/OVRRootPath.props | 15 + .../VS2013/ORT (Static Background).vcxproj | 258 + .../ORT (Static Background).vcxproj.filters | 6 + .../VS2015/ORT (Static Background).vcxproj | 258 + .../ORT (Static Background).vcxproj.filters | 6 + .../ORT (Static Background)/main.cpp | 81 + .../Projects/Win/OVRRootPath.props | 15 + .../Win/VS2013/ORT (Super Minimal).vcxproj | 258 + .../ORT (Super Minimal).vcxproj.filters | 6 + .../Win/VS2015/ORT (Super Minimal).vcxproj | 258 + .../ORT (Super Minimal).vcxproj.filters | 6 + .../ORT (Super Minimal)/main.cpp | 163 + .../Projects/Windows/OVRRootPath.props | 15 + .../VS2013/ORT (Tap Detection).vcxproj | 258 + .../ORT (Tap Detection).vcxproj.filters | 6 + .../VS2015/ORT (Tap Detection).vcxproj | 258 + .../ORT (Tap Detection).vcxproj.filters | 6 + .../ORT (Tap Detection)/main.cpp | 70 + .../Projects/Win/OVRRootPath.props | 15 + .../Win/VS2013/ORT (Threading).vcxproj | 262 + .../Win/VS2015/ORT (Threading).vcxproj | 262 + .../ORT (Threading)/main.cpp | 548 + .../Projects/Windows/OVRRootPath.props | 15 + .../ORT (Tilt Controlled Locked).vcxproj | 258 + ...T (Tilt Controlled Locked).vcxproj.filters | 6 + .../ORT (Tilt Controlled Locked).vcxproj | 258 + ...T (Tilt Controlled Locked).vcxproj.filters | 6 + .../ORT (Tilt Controlled Locked)/main.cpp | 97 + .../Projects/Windows/OVRRootPath.props | 15 + .../VS2013/ORT (Tilt Controlled).vcxproj | 258 + .../ORT (Tilt Controlled).vcxproj.filters | 6 + .../VS2015/ORT (Tilt Controlled).vcxproj | 258 + .../ORT (Tilt Controlled).vcxproj.filters | 6 + .../ORT (Tilt Controlled)/main.cpp | 64 + .../Projects/Win/OVRRootPath.props | 15 + .../Win/VS2010/ORT (Using BasicVR).vcxproj | 258 + .../Win/VS2012/ORT (Using BasicVR).vcxproj | 258 + .../Win/VS2013/ORT (Using BasicVR).vcxproj | 258 + .../ORT (Using BasicVR).vcxproj.filters | 6 + .../Win/VS2015/ORT (Using BasicVR).vcxproj | 258 + .../ORT (Using BasicVR).vcxproj.filters | 6 + .../ORT (Using BasicVR)/main.cpp | 57 + .../Projects/Windows/OVRRootPath.props | 15 + .../Windows/VS2010/ORT (Vary FOV).vcxproj | 258 + .../Windows/VS2012/ORT (Vary FOV).vcxproj | 258 + .../Windows/VS2013/ORT (Vary FOV).vcxproj | 258 + .../VS2013/ORT (Vary FOV).vcxproj.filters | 6 + .../Windows/VS2015/ORT (Vary FOV).vcxproj | 258 + .../VS2015/ORT (Vary FOV).vcxproj.filters | 6 + .../ORT (Vary Fov)/main.cpp | 76 + .../Projects/Windows/OVRRootPath.props | 15 + .../VS2010/ORT (Vary Resolution).vcxproj | 258 + .../VS2012/ORT (Vary Resolution).vcxproj | 258 + .../VS2013/ORT (Vary Resolution).vcxproj | 258 + .../ORT (Vary Resolution).vcxproj.filters | 6 + .../VS2015/ORT (Vary Resolution).vcxproj | 258 + .../ORT (Vary Resolution).vcxproj.filters | 6 + .../ORT (Vary Resolution)/main.cpp | 75 + .../Projects/Windows/OVRRootPath.props | 15 + .../VS2010/ORT (World Scaling).vcxproj | 258 + .../VS2012/ORT (World Scaling).vcxproj | 258 + .../VS2013/ORT (World Scaling).vcxproj | 258 + .../ORT (World Scaling).vcxproj.filters | 6 + .../VS2015/ORT (World Scaling).vcxproj | 258 + .../ORT (World Scaling).vcxproj.filters | 6 + .../ORT (World Scaling)/main.cpp | 74 + .../ORT (Zoom)/Projects/Win/OVRRootPath.props | 15 + .../Projects/Win/VS2013/ORT (Zoom).vcxproj | 258 + .../Projects/Win/VS2015/ORT (Zoom).vcxproj | 258 + .../ORT (Zoom)/main.cpp | 117 + .../OculusWorldDemo/Assets/Tuscany/Bark.dds | Bin 0 -> 1398248 bytes .../OculusWorldDemo/Assets/Tuscany/Barrel.dds | Bin 0 -> 699192 bytes .../OculusWorldDemo/Assets/Tuscany/Bench.dds | Bin 0 -> 699192 bytes .../OculusWorldDemo/Assets/Tuscany/Book.dds | Bin 0 -> 174904 bytes .../OculusWorldDemo/Assets/Tuscany/Chair1.dds | Bin 0 -> 699192 bytes .../OculusWorldDemo/Assets/Tuscany/Chair2.dds | Bin 0 -> 699192 bytes .../Assets/Tuscany/ChimneyBrick.dds | Bin 0 -> 1398248 bytes .../Assets/Tuscany/Concrete1.dds | Bin 0 -> 349672 bytes .../Assets/Tuscany/Concrete2.dds | Bin 0 -> 699192 bytes .../Assets/Tuscany/Distance Tree.dds | Bin 0 -> 1398256 bytes .../Assets/Tuscany/Distance1_c.dds | Bin 0 -> 1398248 bytes .../Assets/Tuscany/Distance2_c.dds | Bin 0 -> 349712 bytes .../Assets/Tuscany/Distance3_c.dds | Bin 0 -> 2796368 bytes .../Assets/Tuscany/FireWood.dds | Bin 0 -> 174904 bytes .../OculusWorldDemo/Assets/Tuscany/Floor.dds | Bin 0 -> 2796344 bytes .../Assets/Tuscany/Fountain.dds | Bin 0 -> 349672 bytes .../Assets/Tuscany/HouseBack.dds | Bin 0 -> 2796344 bytes .../Assets/Tuscany/HouseFront.dds | Bin 0 -> 2796344 bytes .../Assets/Tuscany/HouseLeft.dds | Bin 0 -> 2796344 bytes .../Assets/Tuscany/HouseRight.dds | Bin 0 -> 2796344 bytes .../Tuscany/House_InteriorLightingMap.dds | Bin 0 -> 2796344 bytes .../OculusWorldDemo/Assets/Tuscany/Hutch.dds | Bin 0 -> 699192 bytes .../Assets/Tuscany/InteriorLeft.dds | Bin 0 -> 2796344 bytes .../Assets/Tuscany/IntertiorBack.dds | Bin 0 -> 2796344 bytes .../Assets/Tuscany/IntertiorFront.dds | Bin 0 -> 2796344 bytes .../OculusWorldDemo/Assets/Tuscany/Iron.dds | Bin 0 -> 174904 bytes .../OculusWorldDemo/Assets/Tuscany/Leaves.dds | Bin 0 -> 699192 bytes .../Assets/Tuscany/LeftController.xml | 21 + .../Assets/Tuscany/MetalRusty.dds | Bin 0 -> 349672 bytes .../Assets/Tuscany/MossConcrete.dds | Bin 0 -> 174904 bytes .../OculusWorldDemo/Assets/Tuscany/Ocean.dds | Bin 0 -> 699192 bytes .../Assets/Tuscany/Picture1.dds | Bin 0 -> 174904 bytes .../Assets/Tuscany/Picture2.dds | Bin 0 -> 174904 bytes .../Assets/Tuscany/Picture3.dds | Bin 0 -> 174904 bytes .../Tuscany/Props_ExteriorLightingMap.dds | Bin 0 -> 699192 bytes .../Tuscany/Props_InteriorLightingMap.dds | Bin 0 -> 699192 bytes .../OculusWorldDemo/Assets/Tuscany/Rocks.dds | Bin 0 -> 699192 bytes .../Assets/Tuscany/RoofShingles.dds | Bin 0 -> 699192 bytes .../Assets/Tuscany/Shutter.dds | Bin 0 -> 87528 bytes .../OculusWorldDemo/Assets/Tuscany/Sky0_c.dds | Bin 0 -> 174904 bytes .../OculusWorldDemo/Assets/Tuscany/Sky1_c.dds | Bin 0 -> 174904 bytes .../OculusWorldDemo/Assets/Tuscany/Sky2_c.dds | Bin 0 -> 174904 bytes .../OculusWorldDemo/Assets/Tuscany/Sky3_c.dds | Bin 0 -> 174904 bytes .../OculusWorldDemo/Assets/Tuscany/Sky4_c.dds | Bin 0 -> 174904 bytes .../OculusWorldDemo/Assets/Tuscany/Spore.dds | Bin 0 -> 5616 bytes .../Assets/Tuscany/StoneWall.dds | Bin 0 -> 2796344 bytes .../OculusWorldDemo/Assets/Tuscany/Table1.dds | Bin 0 -> 699192 bytes .../OculusWorldDemo/Assets/Tuscany/Table2.dds | Bin 0 -> 174904 bytes .../Assets/Tuscany/Terrain Ground1.dds | Bin 0 -> 2796344 bytes .../Assets/Tuscany/Terrain Ground2.dds | Bin 0 -> 2796344 bytes .../Assets/Tuscany/Terrain Ground3.dds | Bin 0 -> 2796344 bytes .../Tuscany/Terrain_DistanceLightingMap.dds | Bin 0 -> 699192 bytes .../Tuscany/Terrain_YardLightingMap.dds | Bin 0 -> 2796344 bytes .../Tuscany/Terrain_YardLightingMap_c.dds | Bin 0 -> 2796344 bytes .../Assets/Tuscany/TreeSkinny.dds | Bin 0 -> 349672 bytes .../Assets/Tuscany/Tree_ TallLightingMap.dds | Bin 0 -> 699192 bytes .../Assets/Tuscany/Tuscany.xml | 2294 ++++ .../Assets/Tuscany/Tuscany_Cockpit_Panel.tga | Bin 0 -> 1048594 bytes .../Assets/Tuscany/Tuscany_LoadScreen.tga | Bin 0 -> 331713 bytes .../Assets/Tuscany/Tuscany_OculusCube.tga | Bin 0 -> 1533719 bytes .../Assets/Tuscany/Tuscany_greenCube.tga | Bin 0 -> 1440044 bytes .../Assets/Tuscany/Tuscany_redCube.tga | Bin 0 -> 1440044 bytes .../OculusWorldDemo/Assets/Tuscany/Vase.dds | Bin 0 -> 1398256 bytes .../Assets/Tuscany/VaseLightingMap.dds | Bin 0 -> 2796344 bytes .../Assets/Tuscany/Village Houses.dds | Bin 0 -> 699192 bytes .../Assets/Tuscany/VillageLightingMap.dds | Bin 0 -> 699192 bytes .../OculusWorldDemo/Assets/Tuscany/Window.dds | Bin 0 -> 699192 bytes .../Assets/Tuscany/WoodPlanks.dds | Bin 0 -> 1398248 bytes .../Assets/Tuscany/WoodPlanksSmall.dds | Bin 0 -> 174904 bytes .../OculusWorldDemo/Assets/Tuscany/Yard1.dds | Bin 0 -> 2796344 bytes .../OculusWorldDemo/Assets/Tuscany/Yard2.dds | Bin 0 -> 2796344 bytes .../OculusWorldDemo/Assets/Tuscany/Yard3.dds | Bin 0 -> 2796344 bytes .../Assets/Tuscany/Yard_Patio1.dds | Bin 0 -> 2796344 bytes .../Assets/Tuscany/Yard_Patio2.dds | Bin 0 -> 2796344 bytes .../Assets/Tuscany/Yard_Plain.dds | Bin 0 -> 2796344 bytes .../Tuscany/house_exteriorLightingMap.dds | Bin 0 -> 699192 bytes .../Assets/Tuscany/tree_A01LightingMap.dds | Bin 0 -> 699192 bytes .../Assets/Tuscany/tree_A02LightingMap.dds | Bin 0 -> 699192 bytes .../Assets/Tuscany/tree_A03LightingMap.dds | Bin 0 -> 699192 bytes .../Assets/Tuscany/tree_BLightingMap.dds | Bin 0 -> 699192 bytes .../Assets/Tuscany/tree_CLightingMap.dds | Bin 0 -> 699192 bytes .../OculusWorldDemo/OculusWorldDemo.cpp | 3399 ++++++ .../Samples/OculusWorldDemo/OculusWorldDemo.h | 623 ++ .../OculusWorldDemo/OculusWorldDemo.rc | Bin 0 -> 144 bytes .../OculusWorldDemo/OculusWorldDemo_Scene.cpp | 540 + .../Samples/OculusWorldDemo/Player.cpp | 214 + .../Samples/OculusWorldDemo/Player.h | 100 + .../Projects/Windows/OVRRootPath.props | 15 + .../Windows/VS2013/OculusWorldDemo.vcxproj | 268 + .../VS2013/OculusWorldDemo.vcxproj.filters | 105 + .../Windows/VS2015/OculusWorldDemo.vcxproj | 268 + .../VS2015/OculusWorldDemo.vcxproj.filters | 105 + .../Projects/Windows/VS2010/Samples.sln | 242 + .../Projects/Windows/VS2012/Samples.sln | 243 + .../Windows/VS2013/Samples (Experimental).sln | 705 ++ .../Projects/Windows/VS2013/Samples.sln | 394 + .../Windows/VS2015/.vs/Samples/v14/.suo | Bin 0 -> 3584 bytes .../Windows/VS2015/Samples (Experimental).sln | 705 ++ .../Projects/Windows/VS2015/Samples.VC.opendb | Bin 0 -> 28 bytes .../Projects/Windows/VS2015/Samples.sdf | Bin 0 -> 72351744 bytes .../Projects/Windows/VS2015/Samples.sln | 394 + extern/OculusSDK/THIRD_PARTY_NOTICES.txt | 290 + .../include/engine/graphics/BloomPostFX.hpp | 2 +- src/game/include/engine/graphics/PostFX.hpp | 6 +- .../engine/graphics/RendererSystem.hpp | 7 +- src/game/src/engine/graphics/BloomPostFX.cpp | 2 +- 583 files changed, 148227 insertions(+), 8 deletions(-) create mode 100644 extern/OculusSDK/3rdParty/TinyXml/tinyxml2.cpp create mode 100644 extern/OculusSDK/3rdParty/TinyXml/tinyxml2.h create mode 100644 extern/OculusSDK/Doc/sdk_docs_have_moved.txt create mode 100644 extern/OculusSDK/LICENSE.txt create mode 100644 extern/OculusSDK/LibOVR/Include/Extras/OVR_CAPI_Util.h create mode 100644 extern/OculusSDK/LibOVR/Include/Extras/OVR_Math.h create mode 100644 extern/OculusSDK/LibOVR/Include/Extras/OVR_StereoProjection.h create mode 100644 extern/OculusSDK/LibOVR/Include/OVR.h create mode 100644 extern/OculusSDK/LibOVR/Include/OVR_CAPI.h create mode 100644 extern/OculusSDK/LibOVR/Include/OVR_CAPI_0_8_0.h create mode 100644 extern/OculusSDK/LibOVR/Include/OVR_CAPI_Audio.h create mode 100644 extern/OculusSDK/LibOVR/Include/OVR_CAPI_D3D.h create mode 100644 extern/OculusSDK/LibOVR/Include/OVR_CAPI_GL.h create mode 100644 extern/OculusSDK/LibOVR/Include/OVR_CAPI_Keys.h create mode 100644 extern/OculusSDK/LibOVR/Include/OVR_ErrorCode.h create mode 100644 extern/OculusSDK/LibOVR/Include/OVR_Kernel.h create mode 100644 extern/OculusSDK/LibOVR/Include/OVR_Version.h create mode 100644 extern/OculusSDK/LibOVR/Projects/Windows/ForceRebuild.props create mode 100644 extern/OculusSDK/LibOVR/Projects/Windows/LibOVR.props create mode 100644 extern/OculusSDK/LibOVR/Projects/Windows/OVRRootPath.props create mode 100644 extern/OculusSDK/LibOVR/Projects/Windows/VS2010/LibOVR.vcxproj create mode 100644 extern/OculusSDK/LibOVR/Projects/Windows/VS2010/LibOVR.vcxproj.filters create mode 100644 extern/OculusSDK/LibOVR/Projects/Windows/VS2012/LibOVR.vcxproj create mode 100644 extern/OculusSDK/LibOVR/Projects/Windows/VS2012/LibOVR.vcxproj.filters create mode 100644 extern/OculusSDK/LibOVR/Projects/Windows/VS2013/LibOVR.vcxproj create mode 100644 extern/OculusSDK/LibOVR/Projects/Windows/VS2013/LibOVR.vcxproj.filters create mode 100644 extern/OculusSDK/LibOVR/Projects/Windows/VS2015/LibOVR.vcxproj create mode 100644 extern/OculusSDK/LibOVR/Projects/Windows/VS2015/LibOVR.vcxproj.filters create mode 100644 extern/OculusSDK/LibOVR/Src/OVR_CAPIShim.c create mode 100644 extern/OculusSDK/LibOVR/Src/OVR_CAPI_Util.cpp create mode 100644 extern/OculusSDK/LibOVR/Src/OVR_StereoProjection.cpp create mode 100644 extern/OculusSDK/LibOVR/Src/Resources/Windows/LibOVR.rc create mode 100644 extern/OculusSDK/LibOVR/Src/Resources/Windows/Oculus.ico create mode 100644 extern/OculusSDK/LibOVR/Src/Resources/Windows/resource.h create mode 100644 extern/OculusSDK/LibOVRKernel/Projects/Windows/OVRRootPath.props create mode 100644 extern/OculusSDK/LibOVRKernel/Projects/Windows/VS2010/LibOVRKernel.vcxproj create mode 100644 extern/OculusSDK/LibOVRKernel/Projects/Windows/VS2010/LibOVRKernel.vcxproj.filters create mode 100644 extern/OculusSDK/LibOVRKernel/Projects/Windows/VS2012/LibOVRKernel.vcxproj create mode 100644 extern/OculusSDK/LibOVRKernel/Projects/Windows/VS2012/LibOVRKernel.vcxproj.filters create mode 100644 extern/OculusSDK/LibOVRKernel/Projects/Windows/VS2013/LibOVRKernel.sln create mode 100644 extern/OculusSDK/LibOVRKernel/Projects/Windows/VS2013/LibOVRKernel.vcxproj create mode 100644 extern/OculusSDK/LibOVRKernel/Projects/Windows/VS2013/LibOVRKernel.vcxproj.filters create mode 100644 extern/OculusSDK/LibOVRKernel/Projects/Windows/VS2015/LibOVRKernel.sln create mode 100644 extern/OculusSDK/LibOVRKernel/Projects/Windows/VS2015/LibOVRKernel.vcxproj create mode 100644 extern/OculusSDK/LibOVRKernel/Projects/Windows/VS2015/LibOVRKernel.vcxproj.filters create mode 100644 extern/OculusSDK/LibOVRKernel/Src/GL/CAPI_GLE.cpp create mode 100644 extern/OculusSDK/LibOVRKernel/Src/GL/CAPI_GLE.h create mode 100644 extern/OculusSDK/LibOVRKernel/Src/GL/CAPI_GLE_GL.h create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Kernel/OVR_Alg.cpp create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Kernel/OVR_Alg.h create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Kernel/OVR_Allocator.cpp create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Kernel/OVR_Allocator.h create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Kernel/OVR_Array.h create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Kernel/OVR_Atomic.cpp create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Kernel/OVR_Atomic.h create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Kernel/OVR_CRC32.cpp create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Kernel/OVR_CRC32.h create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Kernel/OVR_Callbacks.cpp create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Kernel/OVR_Callbacks.h create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Kernel/OVR_CallbacksInternal.h create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Kernel/OVR_Color.h create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Kernel/OVR_Compiler.h create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Kernel/OVR_ContainerAllocator.h create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Kernel/OVR_DebugHelp.cpp create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Kernel/OVR_DebugHelp.h create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Kernel/OVR_Delegates.h create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Kernel/OVR_Deque.h create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Kernel/OVR_File.cpp create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Kernel/OVR_File.h create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Kernel/OVR_FileFILE.cpp create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Kernel/OVR_Hash.h create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Kernel/OVR_JSON.cpp create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Kernel/OVR_JSON.h create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Kernel/OVR_KeyCodes.h create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Kernel/OVR_List.h create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Kernel/OVR_Lockless.cpp create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Kernel/OVR_Lockless.h create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Kernel/OVR_Log.cpp create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Kernel/OVR_Log.h create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Kernel/OVR_NewOverride.inl create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Kernel/OVR_Nullptr.h create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Kernel/OVR_Rand.cpp create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Kernel/OVR_Rand.h create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Kernel/OVR_RefCount.cpp create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Kernel/OVR_RefCount.h create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Kernel/OVR_SharedMemory.cpp create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Kernel/OVR_SharedMemory.h create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Kernel/OVR_Std.cpp create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Kernel/OVR_Std.h create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Kernel/OVR_String.cpp create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Kernel/OVR_String.h create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Kernel/OVR_StringHash.h create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Kernel/OVR_String_FormatUtil.cpp create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Kernel/OVR_String_PathUtil.cpp create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Kernel/OVR_SysFile.cpp create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Kernel/OVR_SysFile.h create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Kernel/OVR_System.cpp create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Kernel/OVR_System.h create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Kernel/OVR_ThreadCommandQueue.cpp create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Kernel/OVR_ThreadCommandQueue.h create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Kernel/OVR_Threads.h create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Kernel/OVR_ThreadsPthread.cpp create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Kernel/OVR_ThreadsWinAPI.cpp create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Kernel/OVR_Timer.cpp create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Kernel/OVR_Timer.h create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Kernel/OVR_Types.h create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Kernel/OVR_UTF8Util.cpp create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Kernel/OVR_UTF8Util.h create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Kernel/OVR_Win32_IncludeWindows.h create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Kernel/OVR_mach_exc_OSX.c create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Kernel/OVR_mach_exc_OSX.h create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Tracing/.gitignore create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Tracing/LibOVREvents.h create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Tracing/LibOVREvents.man create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Tracing/LibOVREvents.rc create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Tracing/LibOVREventsTEMP.BIN create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Tracing/LibOVREvents_MSG00001.bin create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Tracing/README.md create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Tracing/Tracing.h create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Tracing/build.cmd create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Tracing/clean.cmd create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Tracing/install.cmd create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Util/Shaders/Blt_ps.hlsl create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Util/Shaders/Blt_vs.hlsl create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Util/Util_D3D11_Blitter.cpp create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Util/Util_D3D11_Blitter.h create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Util/Util_Direct3D.cpp create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Util/Util_Direct3D.h create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Util/Util_GL_Blitter.cpp create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Util/Util_GL_Blitter.h create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Util/Util_GetSystemSpecs.cpp create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Util/Util_ImageWindow.cpp create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Util/Util_ImageWindow.h create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Util/Util_LongPollThread.cpp create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Util/Util_LongPollThread.h create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Util/Util_SystemGUI.cpp create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Util/Util_SystemGUI.h create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Util/Util_SystemGUI_OSX.mm create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Util/Util_SystemInfo.cpp create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Util/Util_SystemInfo.h create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Util/Util_SystemInfo_OSX.mm create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Util/Util_Watchdog.cpp create mode 100644 extern/OculusSDK/LibOVRKernel/Src/Util/Util_Watchdog.h create mode 100644 extern/OculusSDK/Oculus World Demo.lnk create mode 100644 extern/OculusSDK/Samples/CommonSrc/Oculus.ico create mode 100644 extern/OculusSDK/Samples/CommonSrc/Platform/Gamepad.h create mode 100644 extern/OculusSDK/Samples/CommonSrc/Platform/Platform.cpp create mode 100644 extern/OculusSDK/Samples/CommonSrc/Platform/Platform.h create mode 100644 extern/OculusSDK/Samples/CommonSrc/Platform/Platform_Default.h create mode 100644 extern/OculusSDK/Samples/CommonSrc/Platform/Win32_Gamepad.cpp create mode 100644 extern/OculusSDK/Samples/CommonSrc/Platform/Win32_Gamepad.h create mode 100644 extern/OculusSDK/Samples/CommonSrc/Platform/Win32_Platform.cpp create mode 100644 extern/OculusSDK/Samples/CommonSrc/Platform/Win32_Platform.h create mode 100644 extern/OculusSDK/Samples/CommonSrc/Render/Render_D3D11_Device.cpp create mode 100644 extern/OculusSDK/Samples/CommonSrc/Render/Render_D3D11_Device.h create mode 100644 extern/OculusSDK/Samples/CommonSrc/Render/Render_Device.cpp create mode 100644 extern/OculusSDK/Samples/CommonSrc/Render/Render_Device.h create mode 100644 extern/OculusSDK/Samples/CommonSrc/Render/Render_Font.h create mode 100644 extern/OculusSDK/Samples/CommonSrc/Render/Render_FontEmbed_DejaVu48.h create mode 100644 extern/OculusSDK/Samples/CommonSrc/Render/Render_GL_Device.cpp create mode 100644 extern/OculusSDK/Samples/CommonSrc/Render/Render_GL_Device.h create mode 100644 extern/OculusSDK/Samples/CommonSrc/Render/Render_GL_Win32_Device.cpp create mode 100644 extern/OculusSDK/Samples/CommonSrc/Render/Render_GL_Win32_Device.h create mode 100644 extern/OculusSDK/Samples/CommonSrc/Render/Render_LoadTextureDDS.cpp create mode 100644 extern/OculusSDK/Samples/CommonSrc/Render/Render_LoadTextureTGA.cpp create mode 100644 extern/OculusSDK/Samples/CommonSrc/Render/Render_XmlSceneLoader.cpp create mode 100644 extern/OculusSDK/Samples/CommonSrc/Render/Render_XmlSceneLoader.h create mode 100644 extern/OculusSDK/Samples/CommonSrc/Util/OptionMenu.cpp create mode 100644 extern/OculusSDK/Samples/CommonSrc/Util/OptionMenu.h create mode 100644 extern/OculusSDK/Samples/CommonSrc/Util/RenderProfiler.cpp create mode 100644 extern/OculusSDK/Samples/CommonSrc/Util/RenderProfiler.h create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny/OculusRoomTiny (DX11)/Projects/Windows/OVRRootPath.props create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny/OculusRoomTiny (DX11)/Projects/Windows/VS2010/OculusRoomTiny (DX11).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny/OculusRoomTiny (DX11)/Projects/Windows/VS2012/OculusRoomTiny (DX11).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny/OculusRoomTiny (DX11)/Projects/Windows/VS2013/OculusRoomTiny (DX11).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny/OculusRoomTiny (DX11)/Projects/Windows/VS2013/OculusRoomTiny (DX11).vcxproj.filters create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny/OculusRoomTiny (DX11)/Projects/Windows/VS2015/OculusRoomTiny (DX11).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny/OculusRoomTiny (DX11)/Projects/Windows/VS2015/OculusRoomTiny (DX11).vcxproj.filters create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny/OculusRoomTiny (DX11)/main.cpp create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny/OculusRoomTiny (GL)/Projects/Windows/OVRRootPath.props create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny/OculusRoomTiny (GL)/Projects/Windows/VS2010/OculusRoomTiny (GL).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny/OculusRoomTiny (GL)/Projects/Windows/VS2012/OculusRoomTiny (GL).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny/OculusRoomTiny (GL)/Projects/Windows/VS2013/OculusRoomTiny (GL).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny/OculusRoomTiny (GL)/Projects/Windows/VS2013/OculusRoomTiny (GL).vcxproj.filters create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny/OculusRoomTiny (GL)/Projects/Windows/VS2015/OculusRoomTiny (GL).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny/OculusRoomTiny (GL)/Projects/Windows/VS2015/OculusRoomTiny (GL).vcxproj.filters create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny/OculusRoomTiny (GL)/main.cpp create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/App-rendered/ORT (App-rendered)/Projects/Windows/OVRRootPath.props create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/App-rendered/ORT (App-rendered)/Projects/Windows/VS2013/ORT (App-rendered).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/App-rendered/ORT (App-rendered)/Projects/Windows/VS2013/ORT (App-rendered).vcxproj.filters create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/App-rendered/ORT (App-rendered)/Projects/Windows/VS2015/ORT (App-rendered).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/App-rendered/ORT (App-rendered)/Projects/Windows/VS2015/ORT (App-rendered).vcxproj.filters create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/App-rendered/ORT (App-rendered)/main.cpp create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/App-rendered/ORT (Parallel CPU GPU)/Projects/Windows/OVRRootPath.props create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/App-rendered/ORT (Parallel CPU GPU)/Projects/Windows/VS2013/ORT (Parallet CPU GPU).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/App-rendered/ORT (Parallel CPU GPU)/Projects/Windows/VS2013/ORT (Parallet CPU GPU).vcxproj.filters create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/App-rendered/ORT (Parallel CPU GPU)/Projects/Windows/VS2015/ORT (Parallet CPU GPU).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/App-rendered/ORT (Parallel CPU GPU)/Projects/Windows/VS2015/ORT (Parallet CPU GPU).vcxproj.filters create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/App-rendered/ORT (Parallel CPU GPU)/main.cpp create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/App-rendered/ORT (Vary Timing, Relief)/Projects/Windows/OVRRootPath.props create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/App-rendered/ORT (Vary Timing, Relief)/Projects/Windows/VS2013/ORT (Vary Timing, Relief).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/App-rendered/ORT (Vary Timing, Relief)/Projects/Windows/VS2013/ORT (Vary Timing, Relief).vcxproj.filters create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/App-rendered/ORT (Vary Timing, Relief)/Projects/Windows/VS2015/ORT (Vary Timing, Relief).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/App-rendered/ORT (Vary Timing, Relief)/Projects/Windows/VS2015/ORT (Vary Timing, Relief).vcxproj.filters create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/App-rendered/ORT (Vary Timing, Relief)/main.cpp create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/Common/Win32_AppRendered.h create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/Common/Win32_BasicVR.h create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/Common/Win32_CameraCone.h create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/Common/Win32_ControlMethods.h create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/Common/Win32_DirectXAppUtil.h create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/Common/Win32_GLAppUtil.h create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Adjust IPD)/Projects/Windows/OVRRootPath.props create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Adjust IPD)/Projects/Windows/VS2010/ORT (Adjust IPD).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Adjust IPD)/Projects/Windows/VS2012/ORT (Adjust IPD).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Adjust IPD)/Projects/Windows/VS2013/ORT (Adjust IPD).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Adjust IPD)/Projects/Windows/VS2013/ORT (Adjust IPD).vcxproj.filters create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Adjust IPD)/Projects/Windows/VS2015/ORT (Adjust IPD).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Adjust IPD)/Projects/Windows/VS2015/ORT (Adjust IPD).vcxproj.filters create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Adjust IPD)/main.cpp create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Auto Linear Velocity)/Projects/Windows/OVRRootPath.props create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Auto Linear Velocity)/Projects/Windows/VS2013/ORT (Auto Linear Velocity).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Auto Linear Velocity)/Projects/Windows/VS2013/ORT (Auto Linear Velocity).vcxproj.filters create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Auto Linear Velocity)/Projects/Windows/VS2015/ORT (Auto Linear Velocity).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Auto Linear Velocity)/Projects/Windows/VS2015/ORT (Auto Linear Velocity).vcxproj.filters create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Auto Linear Velocity)/main.cpp create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Auto Yaw)/Projects/Windows/OVRRootPath.props create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Auto Yaw)/Projects/Windows/VS2013/ORT (Auto Yaw).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Auto Yaw)/Projects/Windows/VS2013/ORT (Auto Yaw).vcxproj.filters create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Auto Yaw)/Projects/Windows/VS2015/ORT (Auto Yaw).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Auto Yaw)/Projects/Windows/VS2015/ORT (Auto Yaw).vcxproj.filters create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Auto Yaw)/main.cpp create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Black Outside Volume)/Projects/Windows/OVRRootPath.props create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Black Outside Volume)/Projects/Windows/VS2013/ORT (Black Outside Volume).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Black Outside Volume)/Projects/Windows/VS2013/ORT (Black Outside Volume).vcxproj.filters create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Black Outside Volume)/Projects/Windows/VS2015/ORT (Black Outside Volume).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Black Outside Volume)/Projects/Windows/VS2015/ORT (Black Outside Volume).vcxproj.filters create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Black Outside Volume)/main.cpp create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Blank Frames)/Projects/Windows/OVRRootPath.props create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Blank Frames)/Projects/Windows/VS2013/ORT (Blank Frames).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Blank Frames)/Projects/Windows/VS2013/ORT (Blank Frames).vcxproj.filters create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Blank Frames)/Projects/Windows/VS2015/ORT (Blank Frames).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Blank Frames)/Projects/Windows/VS2015/ORT (Blank Frames).vcxproj.filters create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Blank Frames)/main.cpp create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Camera Volume)/Projects/Windows/OVRRootPath.props create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Camera Volume)/Projects/Windows/VS2013/ORT (Camera Volume).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Camera Volume)/Projects/Windows/VS2013/ORT (Camera Volume).vcxproj.filters create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Camera Volume)/Projects/Windows/VS2015/ORT (Camera Volume).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Camera Volume)/Projects/Windows/VS2015/ORT (Camera Volume).vcxproj.filters create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Camera Volume)/main.cpp create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Cockpit, Mono Exterior)/Projects/Windows/OVRRootPath.props create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Cockpit, Mono Exterior)/Projects/Windows/VS2013/ORT (Cockpit, Mono Exterior).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Cockpit, Mono Exterior)/Projects/Windows/VS2013/ORT (Cockpit, Mono Exterior).vcxproj.filters create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Cockpit, Mono Exterior)/Projects/Windows/VS2015/ORT (Cockpit, Mono Exterior).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Cockpit, Mono Exterior)/Projects/Windows/VS2015/ORT (Cockpit, Mono Exterior).vcxproj.filters create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Cockpit, Mono Exterior)/main.cpp create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Control Combination)/Projects/Windows/OVRRootPath.props create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Control Combination)/Projects/Windows/VS2013/ORT (Control Combination).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Control Combination)/Projects/Windows/VS2013/ORT (Control Combination).vcxproj.filters create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Control Combination)/Projects/Windows/VS2015/ORT (Control Combination).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Control Combination)/Projects/Windows/VS2015/ORT (Control Combination).vcxproj.filters create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Control Combination)/main.cpp create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Controllers)/Projects/Win/OVRRootPath.props create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Controllers)/Projects/Win/VS2013/ORT (Controllers).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Controllers)/Projects/Win/VS2013/ORT (Controllers).vcxproj.filters create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Controllers)/Projects/Win/VS2015/ORT (Controllers).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Controllers)/Projects/Win/VS2015/ORT (Controllers).vcxproj.filters create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Controllers)/main.cpp create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Debug HUD)/Projects/Win/OVRRootPath.props create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Debug HUD)/Projects/Win/VS2013/ORT (Debug HUD).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Debug HUD)/Projects/Win/VS2015/ORT (Debug HUD).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Debug HUD)/main.cpp create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Direct Quad)/Projects/Win/OVRRootPath.props create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Direct Quad)/Projects/Win/VS2013/ORT (Direct Quad).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Direct Quad)/Projects/Win/VS2015/ORT (Direct Quad).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Direct Quad)/main.cpp create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Engine Integration Stages)/Oculus PC SDK Engine Integration.docx create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Engine Integration Stages)/Projects/Windows/OVRRootPath.props create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Engine Integration Stages)/Projects/Windows/VS2013/ORT (Engine Integration Stages).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Engine Integration Stages)/Projects/Windows/VS2013/ORT (Engine Integration Stages).vcxproj.filters create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Engine Integration Stages)/Projects/Windows/VS2015/ORT (Engine Integration Stages).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Engine Integration Stages)/Projects/Windows/VS2015/ORT (Engine Integration Stages).vcxproj.filters create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Engine Integration Stages)/main.cpp create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Engine Integration Stages)/stage1 - Start with nonVR application.h create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Engine Integration Stages)/stage2 - Add LibOVR.h create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Engine Integration Stages)/stage3 - Render to eye buffers.h create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Engine Integration Stages)/stage4 - Hook into sensors.h create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Engine Integration Stages)/stage5 - Output to headset.h create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Engine Integration Stages)/stage6 - Add mirror.h create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Fading Camera Volume)/Projects/Windows/OVRRootPath.props create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Fading Camera Volume)/Projects/Windows/VS2013/ORT (Fading Camera Volume).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Fading Camera Volume)/Projects/Windows/VS2013/ORT (Fading Camera Volume).vcxproj.filters create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Fading Camera Volume)/Projects/Windows/VS2015/ORT (Fading Camera Volume).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Fading Camera Volume)/Projects/Windows/VS2015/ORT (Fading Camera Volume).vcxproj.filters create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Fading Camera Volume)/main.cpp create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Freeze Timewarp)/Projects/Win/OVRRootPath.props create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Freeze Timewarp)/Projects/Win/VS2010/ORT (Freeze Timewarp).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Freeze Timewarp)/Projects/Win/VS2012/ORT (Freeze Timewarp).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Freeze Timewarp)/Projects/Win/VS2013/ORT (Freeze Timewarp).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Freeze Timewarp)/Projects/Win/VS2013/ORT (Freeze Timewarp).vcxproj.filters create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Freeze Timewarp)/Projects/Win/VS2015/ORT (Freeze Timewarp).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Freeze Timewarp)/Projects/Win/VS2015/ORT (Freeze Timewarp).vcxproj.filters create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Freeze Timewarp)/main.cpp create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Jump From Accelerometers)/Projects/Windows/OVRRootPath.props create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Jump From Accelerometers)/Projects/Windows/VS2013/ORT (Jump From Accelerometers).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Jump From Accelerometers)/Projects/Windows/VS2013/ORT (Jump From Accelerometers).vcxproj.filters create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Jump From Accelerometers)/Projects/Windows/VS2015/ORT (Jump From Accelerometers).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Jump From Accelerometers)/Projects/Windows/VS2015/ORT (Jump From Accelerometers).vcxproj.filters create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Jump From Accelerometers)/main.cpp create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Layers)/Projects/Windows/OVRRootPath.props create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Layers)/Projects/Windows/VS2013/ORT (Layers).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Layers)/Projects/Windows/VS2013/ORT (Layers).vcxproj.filters create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Layers)/Projects/Windows/VS2015/ORT (Layers).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Layers)/Projects/Windows/VS2015/ORT (Layers).vcxproj.filters create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Layers)/main.cpp create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (MSAA)/Projects/Win/OVRRootPath.props create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (MSAA)/Projects/Win/VS2010/ORT (MSAA).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (MSAA)/Projects/Win/VS2012/ORT (MSAA).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (MSAA)/Projects/Win/VS2013/ORT (MSAA).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (MSAA)/Projects/Win/VS2013/ORT (MSAA).vcxproj.filters create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (MSAA)/Projects/Win/VS2015/ORT (MSAA).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (MSAA)/Projects/Win/VS2015/ORT (MSAA).vcxproj.filters create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (MSAA)/main.cpp create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Matching Alternate Eye)/Projects/Windows/OVRRootPath.props create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Matching Alternate Eye)/Projects/Windows/VS2010/ORT (Matching Alternate Eye).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Matching Alternate Eye)/Projects/Windows/VS2012/ORT (Matching Alternate Eye).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Matching Alternate Eye)/Projects/Windows/VS2013/ORT (Matching Alternate Eye).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Matching Alternate Eye)/Projects/Windows/VS2013/ORT (Matching Alternate Eye).vcxproj.filters create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Matching Alternate Eye)/Projects/Windows/VS2015/ORT (Matching Alternate Eye).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Matching Alternate Eye)/Projects/Windows/VS2015/ORT (Matching Alternate Eye).vcxproj.filters create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Matching Alternate Eye)/main.cpp create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Mid Mono, Exaggerate Far)/Projects/Windows/OVRRootPath.props create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Mid Mono, Exaggerate Far)/Projects/Windows/VS2013/ORT (Mid Mono, Exaggerate Far).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Mid Mono, Exaggerate Far)/Projects/Windows/VS2013/ORT (Mid Mono, Exaggerate Far).vcxproj.filters create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Mid Mono, Exaggerate Far)/Projects/Windows/VS2015/ORT (Mid Mono, Exaggerate Far).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Mid Mono, Exaggerate Far)/Projects/Windows/VS2015/ORT (Mid Mono, Exaggerate Far).vcxproj.filters create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Mid Mono, Exaggerate Far)/main.cpp create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Mirror Variants)/Projects/Win/OVRRootPath.props create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Mirror Variants)/Projects/Win/VS2013/ORT (Mirror Variants).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Mirror Variants)/Projects/Win/VS2013/ORT (Mirror Variants).vcxproj.filters create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Mirror Variants)/Projects/Win/VS2015/ORT (Mirror Variants).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Mirror Variants)/Projects/Win/VS2015/ORT (Mirror Variants).vcxproj.filters create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Mirror Variants)/main.cpp create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Monoscopic)/Projects/Windows/OVRRootPath.props create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Monoscopic)/Projects/Windows/VS2010/ORT (Monoscopic).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Monoscopic)/Projects/Windows/VS2012/ORT (Monoscopic).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Monoscopic)/Projects/Windows/VS2013/ORT (Monoscopic).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Monoscopic)/Projects/Windows/VS2013/ORT (Monoscopic).vcxproj.filters create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Monoscopic)/Projects/Windows/VS2015/ORT (Monoscopic).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Monoscopic)/Projects/Windows/VS2015/ORT (Monoscopic).vcxproj.filters create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Monoscopic)/main.cpp create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Motion In Look Direction)/Projects/Windows/OVRRootPath.props create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Motion In Look Direction)/Projects/Windows/VS2013/ORT (Motion In Look Direction).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Motion In Look Direction)/Projects/Windows/VS2013/ORT (Motion In Look Direction).vcxproj.filters create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Motion In Look Direction)/Projects/Windows/VS2015/ORT (Motion In Look Direction).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Motion In Look Direction)/Projects/Windows/VS2015/ORT (Motion In Look Direction).vcxproj.filters create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Motion In Look Direction)/main.cpp create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Near Stereo, Far Mono)/Projects/Windows/OVRRootPath.props create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Near Stereo, Far Mono)/Projects/Windows/VS2013/ORT (Near Stereo, Far Mono).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Near Stereo, Far Mono)/Projects/Windows/VS2013/ORT (Near Stereo, Far Mono).vcxproj.filters create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Near Stereo, Far Mono)/Projects/Windows/VS2015/ORT (Near Stereo, Far Mono).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Near Stereo, Far Mono)/Projects/Windows/VS2015/ORT (Near Stereo, Far Mono).vcxproj.filters create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Near Stereo, Far Mono)/main.cpp create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Performance HUD)/Projects/Win/OVRRootPath.props create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Performance HUD)/Projects/Win/VS2013/ORT (Performance HUD).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Performance HUD)/Projects/Win/VS2015/ORT (Performance HUD).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Performance HUD)/main.cpp create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Quantized Yaw)/Projects/Windows/OVRRootPath.props create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Quantized Yaw)/Projects/Windows/VS2013/ORT (Quantized Yaw).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Quantized Yaw)/Projects/Windows/VS2013/ORT (Quantized Yaw).vcxproj.filters create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Quantized Yaw)/Projects/Windows/VS2015/ORT (Quantized Yaw).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Quantized Yaw)/Projects/Windows/VS2015/ORT (Quantized Yaw).vcxproj.filters create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Quantized Yaw)/main.cpp create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Queue Ahead)/Projects/Win/OVRRootPath.props create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Queue Ahead)/Projects/Win/VS2013/ORT (Queue Ahead).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Queue Ahead)/Projects/Win/VS2013/ORT (Queue Ahead).vcxproj.filters create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Queue Ahead)/Projects/Win/VS2015/ORT (Queue Ahead).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Queue Ahead)/Projects/Win/VS2015/ORT (Queue Ahead).vcxproj.filters create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Queue Ahead)/main.cpp create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Recenter Pose)/Projects/Windows/OVRRootPath.props create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Recenter Pose)/Projects/Windows/VS2010/ORT (Recenter Pose).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Recenter Pose)/Projects/Windows/VS2012/ORT (Recenter Pose).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Recenter Pose)/Projects/Windows/VS2013/ORT (Recenter Pose).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Recenter Pose)/Projects/Windows/VS2013/ORT (Recenter Pose).vcxproj.filters create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Recenter Pose)/Projects/Windows/VS2015/ORT (Recenter Pose).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Recenter Pose)/Projects/Windows/VS2015/ORT (Recenter Pose).vcxproj.filters create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Recenter Pose)/main.cpp create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Remapped Keys)/Projects/Win/OVRRootPath.props create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Remapped Keys)/Projects/Win/VS2013/ORT (Remapped Keys).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Remapped Keys)/Projects/Win/VS2013/ORT (Remapped Keys).vcxproj.filters create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Remapped Keys)/Projects/Win/VS2015/ORT (Remapped Keys).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Remapped Keys)/Projects/Win/VS2015/ORT (Remapped Keys).vcxproj.filters create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Remapped Keys)/main.cpp create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Simple Alternate Eye)/Projects/Windows/OVRRootPath.props create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Simple Alternate Eye)/Projects/Windows/VS2010/ORT (Simple Alternate Eye).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Simple Alternate Eye)/Projects/Windows/VS2012/ORT (Simple Alternate Eye).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Simple Alternate Eye)/Projects/Windows/VS2013/ORT (Simple Alternate Eye).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Simple Alternate Eye)/Projects/Windows/VS2013/ORT (Simple Alternate Eye).vcxproj.filters create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Simple Alternate Eye)/Projects/Windows/VS2015/ORT (Simple Alternate Eye).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Simple Alternate Eye)/Projects/Windows/VS2015/ORT (Simple Alternate Eye).vcxproj.filters create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Simple Alternate Eye)/main.cpp create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Smooth Quantized Yaw)/Projects/Windows/OVRRootPath.props create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Smooth Quantized Yaw)/Projects/Windows/VS2013/ORT (Smooth Quantized Yaw).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Smooth Quantized Yaw)/Projects/Windows/VS2013/ORT (Smooth Quantized Yaw).vcxproj.filters create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Smooth Quantized Yaw)/Projects/Windows/VS2015/ORT (Smooth Quantized Yaw).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Smooth Quantized Yaw)/Projects/Windows/VS2015/ORT (Smooth Quantized Yaw).vcxproj.filters create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Smooth Quantized Yaw)/main.cpp create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Static Background)/Projects/Windows/OVRRootPath.props create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Static Background)/Projects/Windows/VS2013/ORT (Static Background).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Static Background)/Projects/Windows/VS2013/ORT (Static Background).vcxproj.filters create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Static Background)/Projects/Windows/VS2015/ORT (Static Background).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Static Background)/Projects/Windows/VS2015/ORT (Static Background).vcxproj.filters create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Static Background)/main.cpp create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Super Minimal)/Projects/Win/OVRRootPath.props create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Super Minimal)/Projects/Win/VS2013/ORT (Super Minimal).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Super Minimal)/Projects/Win/VS2013/ORT (Super Minimal).vcxproj.filters create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Super Minimal)/Projects/Win/VS2015/ORT (Super Minimal).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Super Minimal)/Projects/Win/VS2015/ORT (Super Minimal).vcxproj.filters create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Super Minimal)/main.cpp create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Tap Detection)/Projects/Windows/OVRRootPath.props create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Tap Detection)/Projects/Windows/VS2013/ORT (Tap Detection).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Tap Detection)/Projects/Windows/VS2013/ORT (Tap Detection).vcxproj.filters create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Tap Detection)/Projects/Windows/VS2015/ORT (Tap Detection).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Tap Detection)/Projects/Windows/VS2015/ORT (Tap Detection).vcxproj.filters create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Tap Detection)/main.cpp create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Threading)/Projects/Win/OVRRootPath.props create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Threading)/Projects/Win/VS2013/ORT (Threading).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Threading)/Projects/Win/VS2015/ORT (Threading).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Threading)/main.cpp create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Tilt Controlled Locked)/Projects/Windows/OVRRootPath.props create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Tilt Controlled Locked)/Projects/Windows/VS2013/ORT (Tilt Controlled Locked).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Tilt Controlled Locked)/Projects/Windows/VS2013/ORT (Tilt Controlled Locked).vcxproj.filters create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Tilt Controlled Locked)/Projects/Windows/VS2015/ORT (Tilt Controlled Locked).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Tilt Controlled Locked)/Projects/Windows/VS2015/ORT (Tilt Controlled Locked).vcxproj.filters create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Tilt Controlled Locked)/main.cpp create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Tilt Controlled)/Projects/Windows/OVRRootPath.props create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Tilt Controlled)/Projects/Windows/VS2013/ORT (Tilt Controlled).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Tilt Controlled)/Projects/Windows/VS2013/ORT (Tilt Controlled).vcxproj.filters create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Tilt Controlled)/Projects/Windows/VS2015/ORT (Tilt Controlled).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Tilt Controlled)/Projects/Windows/VS2015/ORT (Tilt Controlled).vcxproj.filters create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Tilt Controlled)/main.cpp create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Using BasicVR)/Projects/Win/OVRRootPath.props create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Using BasicVR)/Projects/Win/VS2010/ORT (Using BasicVR).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Using BasicVR)/Projects/Win/VS2012/ORT (Using BasicVR).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Using BasicVR)/Projects/Win/VS2013/ORT (Using BasicVR).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Using BasicVR)/Projects/Win/VS2013/ORT (Using BasicVR).vcxproj.filters create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Using BasicVR)/Projects/Win/VS2015/ORT (Using BasicVR).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Using BasicVR)/Projects/Win/VS2015/ORT (Using BasicVR).vcxproj.filters create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Using BasicVR)/main.cpp create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Vary Fov)/Projects/Windows/OVRRootPath.props create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Vary Fov)/Projects/Windows/VS2010/ORT (Vary FOV).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Vary Fov)/Projects/Windows/VS2012/ORT (Vary FOV).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Vary Fov)/Projects/Windows/VS2013/ORT (Vary FOV).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Vary Fov)/Projects/Windows/VS2013/ORT (Vary FOV).vcxproj.filters create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Vary Fov)/Projects/Windows/VS2015/ORT (Vary FOV).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Vary Fov)/Projects/Windows/VS2015/ORT (Vary FOV).vcxproj.filters create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Vary Fov)/main.cpp create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Vary Resolution)/Projects/Windows/OVRRootPath.props create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Vary Resolution)/Projects/Windows/VS2010/ORT (Vary Resolution).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Vary Resolution)/Projects/Windows/VS2012/ORT (Vary Resolution).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Vary Resolution)/Projects/Windows/VS2013/ORT (Vary Resolution).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Vary Resolution)/Projects/Windows/VS2013/ORT (Vary Resolution).vcxproj.filters create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Vary Resolution)/Projects/Windows/VS2015/ORT (Vary Resolution).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Vary Resolution)/Projects/Windows/VS2015/ORT (Vary Resolution).vcxproj.filters create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Vary Resolution)/main.cpp create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (World Scaling)/Projects/Windows/OVRRootPath.props create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (World Scaling)/Projects/Windows/VS2010/ORT (World Scaling).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (World Scaling)/Projects/Windows/VS2012/ORT (World Scaling).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (World Scaling)/Projects/Windows/VS2013/ORT (World Scaling).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (World Scaling)/Projects/Windows/VS2013/ORT (World Scaling).vcxproj.filters create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (World Scaling)/Projects/Windows/VS2015/ORT (World Scaling).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (World Scaling)/Projects/Windows/VS2015/ORT (World Scaling).vcxproj.filters create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (World Scaling)/main.cpp create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Zoom)/Projects/Win/OVRRootPath.props create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Zoom)/Projects/Win/VS2013/ORT (Zoom).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Zoom)/Projects/Win/VS2015/ORT (Zoom).vcxproj create mode 100644 extern/OculusSDK/Samples/OculusRoomTiny_Advanced/ORT (Zoom)/main.cpp create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/Assets/Tuscany/Bark.dds create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/Assets/Tuscany/Barrel.dds create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/Assets/Tuscany/Bench.dds create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/Assets/Tuscany/Book.dds create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/Assets/Tuscany/Chair1.dds create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/Assets/Tuscany/Chair2.dds create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/Assets/Tuscany/ChimneyBrick.dds create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/Assets/Tuscany/Concrete1.dds create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/Assets/Tuscany/Concrete2.dds create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/Assets/Tuscany/Distance Tree.dds create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/Assets/Tuscany/Distance1_c.dds create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/Assets/Tuscany/Distance2_c.dds create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/Assets/Tuscany/Distance3_c.dds create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/Assets/Tuscany/FireWood.dds create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/Assets/Tuscany/Floor.dds create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/Assets/Tuscany/Fountain.dds create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/Assets/Tuscany/HouseBack.dds create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/Assets/Tuscany/HouseFront.dds create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/Assets/Tuscany/HouseLeft.dds create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/Assets/Tuscany/HouseRight.dds create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/Assets/Tuscany/House_InteriorLightingMap.dds create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/Assets/Tuscany/Hutch.dds create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/Assets/Tuscany/InteriorLeft.dds create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/Assets/Tuscany/IntertiorBack.dds create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/Assets/Tuscany/IntertiorFront.dds create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/Assets/Tuscany/Iron.dds create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/Assets/Tuscany/Leaves.dds create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/Assets/Tuscany/LeftController.xml create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/Assets/Tuscany/MetalRusty.dds create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/Assets/Tuscany/MossConcrete.dds create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/Assets/Tuscany/Ocean.dds create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/Assets/Tuscany/Picture1.dds create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/Assets/Tuscany/Picture2.dds create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/Assets/Tuscany/Picture3.dds create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/Assets/Tuscany/Props_ExteriorLightingMap.dds create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/Assets/Tuscany/Props_InteriorLightingMap.dds create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/Assets/Tuscany/Rocks.dds create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/Assets/Tuscany/RoofShingles.dds create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/Assets/Tuscany/Shutter.dds create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/Assets/Tuscany/Sky0_c.dds create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/Assets/Tuscany/Sky1_c.dds create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/Assets/Tuscany/Sky2_c.dds create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/Assets/Tuscany/Sky3_c.dds create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/Assets/Tuscany/Sky4_c.dds create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/Assets/Tuscany/Spore.dds create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/Assets/Tuscany/StoneWall.dds create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/Assets/Tuscany/Table1.dds create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/Assets/Tuscany/Table2.dds create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/Assets/Tuscany/Terrain Ground1.dds create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/Assets/Tuscany/Terrain Ground2.dds create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/Assets/Tuscany/Terrain Ground3.dds create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/Assets/Tuscany/Terrain_DistanceLightingMap.dds create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/Assets/Tuscany/Terrain_YardLightingMap.dds create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/Assets/Tuscany/Terrain_YardLightingMap_c.dds create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/Assets/Tuscany/TreeSkinny.dds create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/Assets/Tuscany/Tree_ TallLightingMap.dds create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/Assets/Tuscany/Tuscany.xml create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/Assets/Tuscany/Tuscany_Cockpit_Panel.tga create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/Assets/Tuscany/Tuscany_LoadScreen.tga create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/Assets/Tuscany/Tuscany_OculusCube.tga create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/Assets/Tuscany/Tuscany_greenCube.tga create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/Assets/Tuscany/Tuscany_redCube.tga create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/Assets/Tuscany/Vase.dds create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/Assets/Tuscany/VaseLightingMap.dds create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/Assets/Tuscany/Village Houses.dds create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/Assets/Tuscany/VillageLightingMap.dds create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/Assets/Tuscany/Window.dds create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/Assets/Tuscany/WoodPlanks.dds create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/Assets/Tuscany/WoodPlanksSmall.dds create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/Assets/Tuscany/Yard1.dds create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/Assets/Tuscany/Yard2.dds create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/Assets/Tuscany/Yard3.dds create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/Assets/Tuscany/Yard_Patio1.dds create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/Assets/Tuscany/Yard_Patio2.dds create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/Assets/Tuscany/Yard_Plain.dds create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/Assets/Tuscany/house_exteriorLightingMap.dds create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/Assets/Tuscany/tree_A01LightingMap.dds create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/Assets/Tuscany/tree_A02LightingMap.dds create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/Assets/Tuscany/tree_A03LightingMap.dds create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/Assets/Tuscany/tree_BLightingMap.dds create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/Assets/Tuscany/tree_CLightingMap.dds create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/OculusWorldDemo.cpp create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/OculusWorldDemo.h create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/OculusWorldDemo.rc create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/OculusWorldDemo_Scene.cpp create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/Player.cpp create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/Player.h create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/Projects/Windows/OVRRootPath.props create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/Projects/Windows/VS2013/OculusWorldDemo.vcxproj create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/Projects/Windows/VS2013/OculusWorldDemo.vcxproj.filters create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/Projects/Windows/VS2015/OculusWorldDemo.vcxproj create mode 100644 extern/OculusSDK/Samples/OculusWorldDemo/Projects/Windows/VS2015/OculusWorldDemo.vcxproj.filters create mode 100644 extern/OculusSDK/Samples/Projects/Windows/VS2010/Samples.sln create mode 100644 extern/OculusSDK/Samples/Projects/Windows/VS2012/Samples.sln create mode 100644 extern/OculusSDK/Samples/Projects/Windows/VS2013/Samples (Experimental).sln create mode 100644 extern/OculusSDK/Samples/Projects/Windows/VS2013/Samples.sln create mode 100644 extern/OculusSDK/Samples/Projects/Windows/VS2015/.vs/Samples/v14/.suo create mode 100644 extern/OculusSDK/Samples/Projects/Windows/VS2015/Samples (Experimental).sln create mode 100644 extern/OculusSDK/Samples/Projects/Windows/VS2015/Samples.VC.opendb create mode 100644 extern/OculusSDK/Samples/Projects/Windows/VS2015/Samples.sdf create mode 100644 extern/OculusSDK/Samples/Projects/Windows/VS2015/Samples.sln create mode 100644 extern/OculusSDK/THIRD_PARTY_NOTICES.txt diff --git a/data/shader/Blit.fsh b/data/shader/Blit.fsh index 3b312f6..bf177c9 100644 --- a/data/shader/Blit.fsh +++ b/data/shader/Blit.fsh @@ -23,6 +23,27 @@ vec3 Uncharted2Tonemap(vec3 x) return ((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F; } +//RADIUS of our vignette, where 0.5 results in a circle fitting the screen +const float RADIUS = 0.65; + +//softness of our vignette, between 0.0 and 1.0 +const float SOFTNESS = 0.35; + + +vec3 Vignette(vec3 color) { + //determine center position + vec2 position = vTexCoord - vec2(0.5); + + //determine the vector length of the center position + float len = length(position); + + //use smoothstep to create a smooth vignette + float vignette = smoothstep(RADIUS, RADIUS-SOFTNESS, len); + + //apply the vignette with 50% opacity + return mix(color, color * vignette, 0.8); +} + void main() { @@ -36,8 +57,8 @@ void main() vec3 whiteScale = vec3(1.0f)/Uncharted2Tonemap(vec3(W)); color = curr*whiteScale; - vec2 centerDist = abs(vTexCoord * 2.0 - 1.0); - color *= length(vec2(1.0) - centerDist); + color = Vignette(color); + vec3 retColor = pow(color, vec3(1.0/2.2)); retColor += vec3(rand(gl_FragCoord.xy) * 1.0/255 - 0.5/255); diff --git a/extern/OculusSDK/3rdParty/TinyXml/tinyxml2.cpp b/extern/OculusSDK/3rdParty/TinyXml/tinyxml2.cpp new file mode 100644 index 0000000..6af1435 --- /dev/null +++ b/extern/OculusSDK/3rdParty/TinyXml/tinyxml2.cpp @@ -0,0 +1,2101 @@ +/* +Original code by Lee Thomason (www.grinninglizard.com) + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any +damages arising from the use of this software. + +Permission is granted to anyone to use this software for any +purpose, including commercial applications, and to alter it and +redistribute it freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must +not claim that you wrote the original software. If you use this +software in a product, an acknowledgment in the product documentation +would be appreciated but is not required. + +2. Altered source versions must be plainly marked as such, and +must not be misrepresented as being the original software. + +3. This notice may not be removed or altered from any source +distribution. +*/ + +#include "tinyxml2.h" + +#include // yes, this one new style header, is in the Android SDK. +# ifdef ANDROID_NDK +# include +#else +# include +#endif + +static const char LINE_FEED = (char)0x0a; // all line endings are normalized to LF +static const char LF = LINE_FEED; +static const char CARRIAGE_RETURN = (char)0x0d; // CR gets filtered out +static const char CR = CARRIAGE_RETURN; +static const char SINGLE_QUOTE = '\''; +static const char DOUBLE_QUOTE = '\"'; + +// Bunch of unicode info at: +// http://www.unicode.org/faq/utf_bom.html +// ef bb bf (Microsoft "lead bytes") - designates UTF-8 + +static const unsigned char TIXML_UTF_LEAD_0 = 0xefU; +static const unsigned char TIXML_UTF_LEAD_1 = 0xbbU; +static const unsigned char TIXML_UTF_LEAD_2 = 0xbfU; + + +#define DELETE_NODE( node ) { \ + if ( node ) { \ + MemPool* pool = node->_memPool; \ + node->~XMLNode(); \ + pool->Free( node ); \ + } \ + } +#define DELETE_ATTRIBUTE( attrib ) { \ + if ( attrib ) { \ + MemPool* pool = attrib->_memPool; \ + attrib->~XMLAttribute(); \ + pool->Free( attrib ); \ + } \ + } + +namespace tinyxml2 +{ + +struct Entity { + const char* pattern; + int length; + char value; +}; + +static const int NUM_ENTITIES = 5; +static const Entity entities[NUM_ENTITIES] = { + { "quot", 4, DOUBLE_QUOTE }, + { "amp", 3, '&' }, + { "apos", 4, SINGLE_QUOTE }, + { "lt", 2, '<' }, + { "gt", 2, '>' } +}; + + +StrPair::~StrPair() +{ + Reset(); +} + + +void StrPair::Reset() +{ + if ( _flags & NEEDS_DELETE ) { + delete [] _start; + } + _flags = 0; + _start = 0; + _end = 0; +} + + +void StrPair::SetStr( const char* str, int flags ) +{ + Reset(); + size_t len = strlen( str ); + _start = new char[ len+1 ]; + memcpy( _start, str, len+1 ); + _end = _start + len; + _flags = flags | NEEDS_DELETE; +} + + +char* StrPair::ParseText( char* p, const char* endTag, int strFlags ) +{ + TIXMLASSERT( endTag && *endTag ); + + char* start = p; // fixme: hides a member + char endChar = *endTag; + size_t length = strlen( endTag ); + + // Inner loop of text parsing. + while ( *p ) { + if ( *p == endChar && strncmp( p, endTag, length ) == 0 ) { + Set( start, p, strFlags ); + return p + length; + } + ++p; + } + return 0; +} + + +char* StrPair::ParseName( char* p ) +{ + char* start = p; + + if ( !start || !(*start) ) { + return 0; + } + + while( *p && ( + XMLUtil::IsAlphaNum( (unsigned char) *p ) + || *p == '_' + || *p == ':' + || (*p == '-' && p>start ) // can be in a name, but not lead it. + || (*p == '.' && p>start ) )) { // can be in a name, but not lead it. + ++p; + } + + if ( p > start ) { + Set( start, p, 0 ); + return p; + } + return 0; +} + + +void StrPair::CollapseWhitespace() +{ + // Trim leading space. + _start = XMLUtil::SkipWhiteSpace( _start ); + + if ( _start && *_start ) { + char* p = _start; // the read pointer + char* q = _start; // the write pointer + + while( *p ) { + if ( XMLUtil::IsWhiteSpace( *p )) { + p = XMLUtil::SkipWhiteSpace( p ); + if ( *p == 0 ) { + break; // don't write to q; this trims the trailing space. + } + *q = ' '; + ++q; + } + *q = *p; + ++q; + ++p; + } + *q = 0; + } +} + + +const char* StrPair::GetStr() +{ + if ( _flags & NEEDS_FLUSH ) { + *_end = 0; + _flags ^= NEEDS_FLUSH; + + if ( _flags ) { + char* p = _start; // the read pointer + char* q = _start; // the write pointer + + while( p < _end ) { + if ( (_flags & NEEDS_NEWLINE_NORMALIZATION) && *p == CR ) { + // CR-LF pair becomes LF + // CR alone becomes LF + // LF-CR becomes LF + if ( *(p+1) == LF ) { + p += 2; + } + else { + ++p; + } + *q++ = LF; + } + else if ( (_flags & NEEDS_NEWLINE_NORMALIZATION) && *p == LF ) { + if ( *(p+1) == CR ) { + p += 2; + } + else { + ++p; + } + *q++ = LF; + } + else if ( (_flags & NEEDS_ENTITY_PROCESSING) && *p == '&' ) { + // Entities handled by tinyXML2: + // - special entities in the entity table [in/out] + // - numeric character reference [in] + // 中 or 中 + + if ( *(p+1) == '#' ) { + char buf[10] = { 0 }; + int len; + p = const_cast( XMLUtil::GetCharacterRef( p, buf, &len ) ); + for( int i=0; i(p); + // Check for BOM: + if ( *(pu+0) == TIXML_UTF_LEAD_0 + && *(pu+1) == TIXML_UTF_LEAD_1 + && *(pu+2) == TIXML_UTF_LEAD_2 ) { + *bom = true; + p += 3; + } + return p; +} + + +void XMLUtil::ConvertUTF32ToUTF8( unsigned long input, char* output, int* length ) +{ + const unsigned long BYTE_MASK = 0xBF; + const unsigned long BYTE_MARK = 0x80; + const unsigned long FIRST_BYTE_MARK[7] = { 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC }; + + if (input < 0x80) { + *length = 1; + } + else if ( input < 0x800 ) { + *length = 2; + } + else if ( input < 0x10000 ) { + *length = 3; + } + else if ( input < 0x200000 ) { + *length = 4; + } + else { + *length = 0; // This code won't covert this correctly anyway. + return; + } + + output += *length; + + // Scary scary fall throughs. + switch (*length) { + case 4: + --output; + *output = (char)((input | BYTE_MARK) & BYTE_MASK); + input >>= 6; + case 3: + --output; + *output = (char)((input | BYTE_MARK) & BYTE_MASK); + input >>= 6; + case 2: + --output; + *output = (char)((input | BYTE_MARK) & BYTE_MASK); + input >>= 6; + case 1: + --output; + *output = (char)(input | FIRST_BYTE_MARK[*length]); + default: + break; + } +} + + +const char* XMLUtil::GetCharacterRef( const char* p, char* value, int* length ) +{ + // Presume an entity, and pull it out. + *length = 0; + + if ( *(p+1) == '#' && *(p+2) ) { + unsigned long ucs = 0; + ptrdiff_t delta = 0; + unsigned mult = 1; + + if ( *(p+2) == 'x' ) { + // Hexadecimal. + if ( !*(p+3) ) { + return 0; + } + + const char* q = p+3; + q = strchr( q, ';' ); + + if ( !q || !*q ) { + return 0; + } + + delta = q-p; + --q; + + while ( *q != 'x' ) { + if ( *q >= '0' && *q <= '9' ) { + ucs += mult * (*q - '0'); + } + else if ( *q >= 'a' && *q <= 'f' ) { + ucs += mult * (*q - 'a' + 10); + } + else if ( *q >= 'A' && *q <= 'F' ) { + ucs += mult * (*q - 'A' + 10 ); + } + else { + return 0; + } + mult *= 16; + --q; + } + } + else { + // Decimal. + if ( !*(p+2) ) { + return 0; + } + + const char* q = p+2; + q = strchr( q, ';' ); + + if ( !q || !*q ) { + return 0; + } + + delta = q-p; + --q; + + while ( *q != '#' ) { + if ( *q >= '0' && *q <= '9' ) { + ucs += mult * (*q - '0'); + } + else { + return 0; + } + mult *= 10; + --q; + } + } + // convert the UCS to UTF-8 + ConvertUTF32ToUTF8( ucs, value, length ); + return p + delta + 1; + } + return p+1; +} + + +void XMLUtil::ToStr( int v, char* buffer, int bufferSize ) +{ + TIXML_SNPRINTF( buffer, bufferSize, "%d", v ); +} + + +void XMLUtil::ToStr( unsigned v, char* buffer, int bufferSize ) +{ + TIXML_SNPRINTF( buffer, bufferSize, "%u", v ); +} + + +void XMLUtil::ToStr( bool v, char* buffer, int bufferSize ) +{ + TIXML_SNPRINTF( buffer, bufferSize, "%d", v ? 1 : 0 ); +} + + +void XMLUtil::ToStr( float v, char* buffer, int bufferSize ) +{ + TIXML_SNPRINTF( buffer, bufferSize, "%g", v ); +} + + +void XMLUtil::ToStr( double v, char* buffer, int bufferSize ) +{ + TIXML_SNPRINTF( buffer, bufferSize, "%g", v ); +} + + +bool XMLUtil::ToInt( const char* str, int* value ) +{ + if ( TIXML_SSCANF( str, "%d", value ) == 1 ) { + return true; + } + return false; +} + +bool XMLUtil::ToUnsigned( const char* str, unsigned *value ) +{ + if ( TIXML_SSCANF( str, "%u", value ) == 1 ) { + return true; + } + return false; +} + +bool XMLUtil::ToBool( const char* str, bool* value ) +{ + int ival = 0; + if ( ToInt( str, &ival )) { + *value = (ival==0) ? false : true; + return true; + } + if ( StringEqual( str, "true" ) ) { + *value = true; + return true; + } + else if ( StringEqual( str, "false" ) ) { + *value = false; + return true; + } + return false; +} + + +bool XMLUtil::ToFloat( const char* str, float* value ) +{ + if ( TIXML_SSCANF( str, "%f", value ) == 1 ) { + return true; + } + return false; +} + +bool XMLUtil::ToDouble( const char* str, double* value ) +{ + if ( TIXML_SSCANF( str, "%lf", value ) == 1 ) { + return true; + } + return false; +} + + +char* XMLDocument::Identify( char* p, XMLNode** node ) +{ + XMLNode* returnNode = 0; + char* start = p; + p = XMLUtil::SkipWhiteSpace( p ); + if( !p || !*p ) { + return p; + } + + // What is this thing? + // - Elements start with a letter or underscore, but xml is reserved. + // - Comments: + // + // With a special case: + // + // + // + // + // Where the closing element (/foo) *must* be the next thing after the opening + // element, and the names must match. BUT the tricky bit is that the closing + // element will be read by the child. + // + // 'endTag' is the end tag for this node, it is returned by a call to a child. + // 'parentEnd' is the end tag for the parent, which is filled in and returned. + + while( p && *p ) { + XMLNode* node = 0; + + p = _document->Identify( p, &node ); + if ( p == 0 || node == 0 ) { + break; + } + + StrPair endTag; + p = node->ParseDeep( p, &endTag ); + if ( !p ) { + DELETE_NODE( node ); + node = 0; + if ( !_document->Error() ) { + _document->SetError( XML_ERROR_PARSING, 0, 0 ); + } + break; + } + + // We read the end tag. Return it to the parent. + if ( node->ToElement() && node->ToElement()->ClosingType() == XMLElement::CLOSING ) { + if ( parentEnd ) { + *parentEnd = static_cast(node)->_value; + } + node->_memPool->SetTracked(); // created and then immediately deleted. + DELETE_NODE( node ); + return p; + } + + // Handle an end tag returned to this level. + // And handle a bunch of annoying errors. + XMLElement* ele = node->ToElement(); + if ( ele ) { + if ( endTag.Empty() && ele->ClosingType() == XMLElement::OPEN ) { + _document->SetError( XML_ERROR_MISMATCHED_ELEMENT, node->Value(), 0 ); + p = 0; + } + else if ( !endTag.Empty() && ele->ClosingType() != XMLElement::OPEN ) { + _document->SetError( XML_ERROR_MISMATCHED_ELEMENT, node->Value(), 0 ); + p = 0; + } + else if ( !endTag.Empty() ) { + if ( !XMLUtil::StringEqual( endTag.GetStr(), node->Value() )) { + _document->SetError( XML_ERROR_MISMATCHED_ELEMENT, node->Value(), 0 ); + p = 0; + } + } + } + if ( p == 0 ) { + DELETE_NODE( node ); + node = 0; + } + if ( node ) { + this->InsertEndChild( node ); + } + } + return 0; +} + +// --------- XMLText ---------- // +char* XMLText::ParseDeep( char* p, StrPair* ) +{ + const char* start = p; + if ( this->CData() ) { + p = _value.ParseText( p, "]]>", StrPair::NEEDS_NEWLINE_NORMALIZATION ); + if ( !p ) { + _document->SetError( XML_ERROR_PARSING_CDATA, start, 0 ); + } + return p; + } + else { + int flags = _document->ProcessEntities() ? StrPair::TEXT_ELEMENT : StrPair::TEXT_ELEMENT_LEAVE_ENTITIES; + if ( _document->WhitespaceMode() == COLLAPSE_WHITESPACE ) { + flags |= StrPair::COLLAPSE_WHITESPACE; + } + + p = _value.ParseText( p, "<", flags ); + if ( !p ) { + _document->SetError( XML_ERROR_PARSING_TEXT, start, 0 ); + } + if ( p && *p ) { + return p-1; + } + } + return 0; +} + + +XMLNode* XMLText::ShallowClone( XMLDocument* doc ) const +{ + if ( !doc ) { + doc = _document; + } + XMLText* text = doc->NewText( Value() ); // fixme: this will always allocate memory. Intern? + text->SetCData( this->CData() ); + return text; +} + + +bool XMLText::ShallowEqual( const XMLNode* compare ) const +{ + return ( compare->ToText() && XMLUtil::StringEqual( compare->ToText()->Value(), Value() )); +} + + +bool XMLText::Accept( XMLVisitor* visitor ) const +{ + return visitor->Visit( *this ); +} + + +// --------- XMLComment ---------- // + +XMLComment::XMLComment( XMLDocument* doc ) : XMLNode( doc ) +{ +} + + +XMLComment::~XMLComment() +{ +} + + +char* XMLComment::ParseDeep( char* p, StrPair* ) +{ + // Comment parses as text. + const char* start = p; + p = _value.ParseText( p, "-->", StrPair::COMMENT ); + if ( p == 0 ) { + _document->SetError( XML_ERROR_PARSING_COMMENT, start, 0 ); + } + return p; +} + + +XMLNode* XMLComment::ShallowClone( XMLDocument* doc ) const +{ + if ( !doc ) { + doc = _document; + } + XMLComment* comment = doc->NewComment( Value() ); // fixme: this will always allocate memory. Intern? + return comment; +} + + +bool XMLComment::ShallowEqual( const XMLNode* compare ) const +{ + return ( compare->ToComment() && XMLUtil::StringEqual( compare->ToComment()->Value(), Value() )); +} + + +bool XMLComment::Accept( XMLVisitor* visitor ) const +{ + return visitor->Visit( *this ); +} + + +// --------- XMLDeclaration ---------- // + +XMLDeclaration::XMLDeclaration( XMLDocument* doc ) : XMLNode( doc ) +{ +} + + +XMLDeclaration::~XMLDeclaration() +{ + //printf( "~XMLDeclaration\n" ); +} + + +char* XMLDeclaration::ParseDeep( char* p, StrPair* ) +{ + // Declaration parses as text. + const char* start = p; + p = _value.ParseText( p, "?>", StrPair::NEEDS_NEWLINE_NORMALIZATION ); + if ( p == 0 ) { + _document->SetError( XML_ERROR_PARSING_DECLARATION, start, 0 ); + } + return p; +} + + +XMLNode* XMLDeclaration::ShallowClone( XMLDocument* doc ) const +{ + if ( !doc ) { + doc = _document; + } + XMLDeclaration* dec = doc->NewDeclaration( Value() ); // fixme: this will always allocate memory. Intern? + return dec; +} + + +bool XMLDeclaration::ShallowEqual( const XMLNode* compare ) const +{ + return ( compare->ToDeclaration() && XMLUtil::StringEqual( compare->ToDeclaration()->Value(), Value() )); +} + + + +bool XMLDeclaration::Accept( XMLVisitor* visitor ) const +{ + return visitor->Visit( *this ); +} + +// --------- XMLUnknown ---------- // + +XMLUnknown::XMLUnknown( XMLDocument* doc ) : XMLNode( doc ) +{ +} + + +XMLUnknown::~XMLUnknown() +{ +} + + +char* XMLUnknown::ParseDeep( char* p, StrPair* ) +{ + // Unknown parses as text. + const char* start = p; + + p = _value.ParseText( p, ">", StrPair::NEEDS_NEWLINE_NORMALIZATION ); + if ( !p ) { + _document->SetError( XML_ERROR_PARSING_UNKNOWN, start, 0 ); + } + return p; +} + + +XMLNode* XMLUnknown::ShallowClone( XMLDocument* doc ) const +{ + if ( !doc ) { + doc = _document; + } + XMLUnknown* text = doc->NewUnknown( Value() ); // fixme: this will always allocate memory. Intern? + return text; +} + + +bool XMLUnknown::ShallowEqual( const XMLNode* compare ) const +{ + return ( compare->ToUnknown() && XMLUtil::StringEqual( compare->ToUnknown()->Value(), Value() )); +} + + +bool XMLUnknown::Accept( XMLVisitor* visitor ) const +{ + return visitor->Visit( *this ); +} + +// --------- XMLAttribute ---------- // +char* XMLAttribute::ParseDeep( char* p, bool processEntities ) +{ + // Parse using the name rules: bug fix, was using ParseText before + p = _name.ParseName( p ); + if ( !p || !*p ) { + return 0; + } + + // Skip white space before = + p = XMLUtil::SkipWhiteSpace( p ); + if ( !p || *p != '=' ) { + return 0; + } + + ++p; // move up to opening quote + p = XMLUtil::SkipWhiteSpace( p ); + if ( *p != '\"' && *p != '\'' ) { + return 0; + } + + char endTag[2] = { *p, 0 }; + ++p; // move past opening quote + + p = _value.ParseText( p, endTag, processEntities ? StrPair::ATTRIBUTE_VALUE : StrPair::ATTRIBUTE_VALUE_LEAVE_ENTITIES ); + return p; +} + + +void XMLAttribute::SetName( const char* n ) +{ + _name.SetStr( n ); +} + + +XMLError XMLAttribute::QueryIntValue( int* value ) const +{ + if ( XMLUtil::ToInt( Value(), value )) { + return XML_NO_ERROR; + } + return XML_WRONG_ATTRIBUTE_TYPE; +} + + +XMLError XMLAttribute::QueryUnsignedValue( unsigned int* value ) const +{ + if ( XMLUtil::ToUnsigned( Value(), value )) { + return XML_NO_ERROR; + } + return XML_WRONG_ATTRIBUTE_TYPE; +} + + +XMLError XMLAttribute::QueryBoolValue( bool* value ) const +{ + if ( XMLUtil::ToBool( Value(), value )) { + return XML_NO_ERROR; + } + return XML_WRONG_ATTRIBUTE_TYPE; +} + + +XMLError XMLAttribute::QueryFloatValue( float* value ) const +{ + if ( XMLUtil::ToFloat( Value(), value )) { + return XML_NO_ERROR; + } + return XML_WRONG_ATTRIBUTE_TYPE; +} + + +XMLError XMLAttribute::QueryDoubleValue( double* value ) const +{ + if ( XMLUtil::ToDouble( Value(), value )) { + return XML_NO_ERROR; + } + return XML_WRONG_ATTRIBUTE_TYPE; +} + + +void XMLAttribute::SetAttribute( const char* v ) +{ + _value.SetStr( v ); +} + + +void XMLAttribute::SetAttribute( int v ) +{ + char buf[BUF_SIZE]; + XMLUtil::ToStr( v, buf, BUF_SIZE ); + _value.SetStr( buf ); +} + + +void XMLAttribute::SetAttribute( unsigned v ) +{ + char buf[BUF_SIZE]; + XMLUtil::ToStr( v, buf, BUF_SIZE ); + _value.SetStr( buf ); +} + + +void XMLAttribute::SetAttribute( bool v ) +{ + char buf[BUF_SIZE]; + XMLUtil::ToStr( v, buf, BUF_SIZE ); + _value.SetStr( buf ); +} + +void XMLAttribute::SetAttribute( double v ) +{ + char buf[BUF_SIZE]; + XMLUtil::ToStr( v, buf, BUF_SIZE ); + _value.SetStr( buf ); +} + +void XMLAttribute::SetAttribute( float v ) +{ + char buf[BUF_SIZE]; + XMLUtil::ToStr( v, buf, BUF_SIZE ); + _value.SetStr( buf ); +} + + +// --------- XMLElement ---------- // +XMLElement::XMLElement( XMLDocument* doc ) : XMLNode( doc ), + _closingType( 0 ), + _rootAttribute( 0 ) +{ +} + + +XMLElement::~XMLElement() +{ + while( _rootAttribute ) { + XMLAttribute* next = _rootAttribute->_next; + DELETE_ATTRIBUTE( _rootAttribute ); + _rootAttribute = next; + } +} + + +XMLAttribute* XMLElement::FindAttribute( const char* name ) +{ + XMLAttribute* a = 0; + for( a=_rootAttribute; a; a = a->_next ) { + if ( XMLUtil::StringEqual( a->Name(), name ) ) { + return a; + } + } + return 0; +} + + +const XMLAttribute* XMLElement::FindAttribute( const char* name ) const +{ + XMLAttribute* a = 0; + for( a=_rootAttribute; a; a = a->_next ) { + if ( XMLUtil::StringEqual( a->Name(), name ) ) { + return a; + } + } + return 0; +} + + +const char* XMLElement::Attribute( const char* name, const char* value ) const +{ + const XMLAttribute* a = FindAttribute( name ); + if ( !a ) { + return 0; + } + if ( !value || XMLUtil::StringEqual( a->Value(), value )) { + return a->Value(); + } + return 0; +} + + +const char* XMLElement::GetText() const +{ + if ( FirstChild() && FirstChild()->ToText() ) { + return FirstChild()->ToText()->Value(); + } + return 0; +} + + +XMLError XMLElement::QueryIntText( int* ival ) const +{ + if ( FirstChild() && FirstChild()->ToText() ) { + const char* t = FirstChild()->ToText()->Value(); + if ( XMLUtil::ToInt( t, ival ) ) { + return XML_SUCCESS; + } + return XML_CAN_NOT_CONVERT_TEXT; + } + return XML_NO_TEXT_NODE; +} + + +XMLError XMLElement::QueryUnsignedText( unsigned* uval ) const +{ + if ( FirstChild() && FirstChild()->ToText() ) { + const char* t = FirstChild()->ToText()->Value(); + if ( XMLUtil::ToUnsigned( t, uval ) ) { + return XML_SUCCESS; + } + return XML_CAN_NOT_CONVERT_TEXT; + } + return XML_NO_TEXT_NODE; +} + + +XMLError XMLElement::QueryBoolText( bool* bval ) const +{ + if ( FirstChild() && FirstChild()->ToText() ) { + const char* t = FirstChild()->ToText()->Value(); + if ( XMLUtil::ToBool( t, bval ) ) { + return XML_SUCCESS; + } + return XML_CAN_NOT_CONVERT_TEXT; + } + return XML_NO_TEXT_NODE; +} + + +XMLError XMLElement::QueryDoubleText( double* dval ) const +{ + if ( FirstChild() && FirstChild()->ToText() ) { + const char* t = FirstChild()->ToText()->Value(); + if ( XMLUtil::ToDouble( t, dval ) ) { + return XML_SUCCESS; + } + return XML_CAN_NOT_CONVERT_TEXT; + } + return XML_NO_TEXT_NODE; +} + + +XMLError XMLElement::QueryFloatText( float* fval ) const +{ + if ( FirstChild() && FirstChild()->ToText() ) { + const char* t = FirstChild()->ToText()->Value(); + if ( XMLUtil::ToFloat( t, fval ) ) { + return XML_SUCCESS; + } + return XML_CAN_NOT_CONVERT_TEXT; + } + return XML_NO_TEXT_NODE; +} + + + +XMLAttribute* XMLElement::FindOrCreateAttribute( const char* name ) +{ + XMLAttribute* last = 0; + XMLAttribute* attrib = 0; + for( attrib = _rootAttribute; + attrib; + last = attrib, attrib = attrib->_next ) { + if ( XMLUtil::StringEqual( attrib->Name(), name ) ) { + break; + } + } + if ( !attrib ) { + attrib = new (_document->_attributePool.Alloc() ) XMLAttribute(); + attrib->_memPool = &_document->_attributePool; + if ( last ) { + last->_next = attrib; + } + else { + _rootAttribute = attrib; + } + attrib->SetName( name ); + attrib->_memPool->SetTracked(); // always created and linked. + } + return attrib; +} + + +void XMLElement::DeleteAttribute( const char* name ) +{ + XMLAttribute* prev = 0; + for( XMLAttribute* a=_rootAttribute; a; a=a->_next ) { + if ( XMLUtil::StringEqual( name, a->Name() ) ) { + if ( prev ) { + prev->_next = a->_next; + } + else { + _rootAttribute = a->_next; + } + DELETE_ATTRIBUTE( a ); + break; + } + prev = a; + } +} + + +char* XMLElement::ParseAttributes( char* p ) +{ + const char* start = p; + XMLAttribute* prevAttribute = 0; + + // Read the attributes. + while( p ) { + p = XMLUtil::SkipWhiteSpace( p ); + if ( !p || !(*p) ) { + _document->SetError( XML_ERROR_PARSING_ELEMENT, start, Name() ); + return 0; + } + + // attribute. + if ( XMLUtil::IsAlpha( *p ) ) { + XMLAttribute* attrib = new (_document->_attributePool.Alloc() ) XMLAttribute(); + attrib->_memPool = &_document->_attributePool; + attrib->_memPool->SetTracked(); + + p = attrib->ParseDeep( p, _document->ProcessEntities() ); + if ( !p || Attribute( attrib->Name() ) ) { + DELETE_ATTRIBUTE( attrib ); + _document->SetError( XML_ERROR_PARSING_ATTRIBUTE, start, p ); + return 0; + } + // There is a minor bug here: if the attribute in the source xml + // document is duplicated, it will not be detected and the + // attribute will be doubly added. However, tracking the 'prevAttribute' + // avoids re-scanning the attribute list. Preferring performance for + // now, may reconsider in the future. + if ( prevAttribute ) { + prevAttribute->_next = attrib; + } + else { + _rootAttribute = attrib; + } + prevAttribute = attrib; + } + // end of the tag + else if ( *p == '/' && *(p+1) == '>' ) { + _closingType = CLOSED; + return p+2; // done; sealed element. + } + // end of the tag + else if ( *p == '>' ) { + ++p; + break; + } + else { + _document->SetError( XML_ERROR_PARSING_ELEMENT, start, p ); + return 0; + } + } + return p; +} + + +// +// +// foobar +// +char* XMLElement::ParseDeep( char* p, StrPair* strPair ) +{ + // Read the element name. + p = XMLUtil::SkipWhiteSpace( p ); + if ( !p ) { + return 0; + } + + // The closing element is the form. It is + // parsed just like a regular element then deleted from + // the DOM. + if ( *p == '/' ) { + _closingType = CLOSING; + ++p; + } + + p = _value.ParseName( p ); + if ( _value.Empty() ) { + return 0; + } + + p = ParseAttributes( p ); + if ( !p || !*p || _closingType ) { + return p; + } + + p = XMLNode::ParseDeep( p, strPair ); + return p; +} + + + +XMLNode* XMLElement::ShallowClone( XMLDocument* doc ) const +{ + if ( !doc ) { + doc = _document; + } + XMLElement* element = doc->NewElement( Value() ); // fixme: this will always allocate memory. Intern? + for( const XMLAttribute* a=FirstAttribute(); a; a=a->Next() ) { + element->SetAttribute( a->Name(), a->Value() ); // fixme: this will always allocate memory. Intern? + } + return element; +} + + +bool XMLElement::ShallowEqual( const XMLNode* compare ) const +{ + const XMLElement* other = compare->ToElement(); + if ( other && XMLUtil::StringEqual( other->Value(), Value() )) { + + const XMLAttribute* a=FirstAttribute(); + const XMLAttribute* b=other->FirstAttribute(); + + while ( a && b ) { + if ( !XMLUtil::StringEqual( a->Value(), b->Value() ) ) { + return false; + } + a = a->Next(); + b = b->Next(); + } + if ( a || b ) { + // different count + return false; + } + return true; + } + return false; +} + + +bool XMLElement::Accept( XMLVisitor* visitor ) const +{ + if ( visitor->VisitEnter( *this, _rootAttribute ) ) { + for ( const XMLNode* node=FirstChild(); node; node=node->NextSibling() ) { + if ( !node->Accept( visitor ) ) { + break; + } + } + } + return visitor->VisitExit( *this ); +} + + +// --------- XMLDocument ----------- // +XMLDocument::XMLDocument( bool processEntities, Whitespace whitespace ) : + XMLNode( 0 ), + _writeBOM( false ), + _processEntities( processEntities ), + _errorID( XML_NO_ERROR ), + _whitespace( whitespace ), + _errorStr1( 0 ), + _errorStr2( 0 ), + _charBuffer( 0 ) +{ + _document = this; // avoid warning about 'this' in initializer list +} + + +XMLDocument::~XMLDocument() +{ + DeleteChildren(); + delete [] _charBuffer; + +#if 0 + textPool.Trace( "text" ); + elementPool.Trace( "element" ); + commentPool.Trace( "comment" ); + attributePool.Trace( "attribute" ); +#endif + +#ifdef DEBUG + if ( Error() == false ) { + TIXMLASSERT( _elementPool.CurrentAllocs() == _elementPool.Untracked() ); + TIXMLASSERT( _attributePool.CurrentAllocs() == _attributePool.Untracked() ); + TIXMLASSERT( _textPool.CurrentAllocs() == _textPool.Untracked() ); + TIXMLASSERT( _commentPool.CurrentAllocs() == _commentPool.Untracked() ); + } +#endif +} + + +void XMLDocument::InitDocument() +{ + _errorID = XML_NO_ERROR; + _errorStr1 = 0; + _errorStr2 = 0; + + delete [] _charBuffer; + _charBuffer = 0; +} + + +XMLElement* XMLDocument::NewElement( const char* name ) +{ + XMLElement* ele = new (_elementPool.Alloc()) XMLElement( this ); + ele->_memPool = &_elementPool; + ele->SetName( name ); + return ele; +} + + +XMLComment* XMLDocument::NewComment( const char* str ) +{ + XMLComment* comment = new (_commentPool.Alloc()) XMLComment( this ); + comment->_memPool = &_commentPool; + comment->SetValue( str ); + return comment; +} + + +XMLText* XMLDocument::NewText( const char* str ) +{ + XMLText* text = new (_textPool.Alloc()) XMLText( this ); + text->_memPool = &_textPool; + text->SetValue( str ); + return text; +} + + +XMLDeclaration* XMLDocument::NewDeclaration( const char* str ) +{ + XMLDeclaration* dec = new (_commentPool.Alloc()) XMLDeclaration( this ); + dec->_memPool = &_commentPool; + dec->SetValue( str ? str : "xml version=\"1.0\" encoding=\"UTF-8\"" ); + return dec; +} + + +XMLUnknown* XMLDocument::NewUnknown( const char* str ) +{ + XMLUnknown* unk = new (_commentPool.Alloc()) XMLUnknown( this ); + unk->_memPool = &_commentPool; + unk->SetValue( str ); + return unk; +} + + +XMLError XMLDocument::LoadFile( const char* filename ) +{ + DeleteChildren(); + InitDocument(); + FILE* fp = 0; + +#if defined(_MSC_VER) && (_MSC_VER >= 1400 ) + errno_t err = fopen_s(&fp, filename, "rb" ); + if ( !fp || err) { +#else + fp = fopen( filename, "rb" ); + if ( !fp) { +#endif + SetError( XML_ERROR_FILE_NOT_FOUND, filename, 0 ); + return _errorID; + } + LoadFile( fp ); + fclose( fp ); + return _errorID; +} + + +XMLError XMLDocument::LoadFile( FILE* fp ) +{ + DeleteChildren(); + InitDocument(); + + fseek( fp, 0, SEEK_END ); + size_t size = ftell( fp ); + fseek( fp, 0, SEEK_SET ); + + if ( size == 0 ) { + return _errorID; + } + + _charBuffer = new char[size+1]; + size_t read = fread( _charBuffer, 1, size, fp ); + if ( read != size ) { + SetError( XML_ERROR_FILE_READ_ERROR, 0, 0 ); + return _errorID; + } + + _charBuffer[size] = 0; + + const char* p = _charBuffer; + p = XMLUtil::SkipWhiteSpace( p ); + p = XMLUtil::ReadBOM( p, &_writeBOM ); + if ( !p || !*p ) { + SetError( XML_ERROR_EMPTY_DOCUMENT, 0, 0 ); + return _errorID; + } + + ParseDeep( _charBuffer + (p-_charBuffer), 0 ); + return _errorID; +} + + +XMLError XMLDocument::SaveFile( const char* filename, bool compact ) +{ + FILE* fp = 0; +#if defined(_MSC_VER) && (_MSC_VER >= 1400 ) + errno_t err = fopen_s(&fp, filename, "w" ); + if ( !fp || err) { +#else + fp = fopen( filename, "w" ); + if ( !fp) { +#endif + SetError( XML_ERROR_FILE_COULD_NOT_BE_OPENED, filename, 0 ); + return _errorID; + } + SaveFile(fp, compact); + fclose( fp ); + return _errorID; +} + + +XMLError XMLDocument::SaveFile( FILE* fp, bool compact ) +{ + XMLPrinter stream( fp, compact ); + Print( &stream ); + return _errorID; +} + + +XMLError XMLDocument::Parse( const char* p, size_t len ) +{ + DeleteChildren(); + InitDocument(); + + if ( !p || !*p ) { + SetError( XML_ERROR_EMPTY_DOCUMENT, 0, 0 ); + return _errorID; + } + if ( len == (size_t)(-1) ) { + len = strlen( p ); + } + _charBuffer = new char[ len+1 ]; + memcpy( _charBuffer, p, len ); + _charBuffer[len] = 0; + + p = XMLUtil::SkipWhiteSpace( p ); + p = XMLUtil::ReadBOM( p, &_writeBOM ); + if ( !p || !*p ) { + SetError( XML_ERROR_EMPTY_DOCUMENT, 0, 0 ); + return _errorID; + } + + ParseDeep( _charBuffer, 0 ); + return _errorID; +} + + +void XMLDocument::Print( XMLPrinter* streamer ) +{ + XMLPrinter stdStreamer( stdout ); + if ( !streamer ) { + streamer = &stdStreamer; + } + Accept( streamer ); +} + + +void XMLDocument::SetError( XMLError error, const char* str1, const char* str2 ) +{ + _errorID = error; + _errorStr1 = str1; + _errorStr2 = str2; +} + + +void XMLDocument::PrintError() const +{ + if ( _errorID ) { + static const int LEN = 20; + char buf1[LEN] = { 0 }; + char buf2[LEN] = { 0 }; + + if ( _errorStr1 ) { + TIXML_SNPRINTF( buf1, LEN, "%s", _errorStr1 ); + } + if ( _errorStr2 ) { + TIXML_SNPRINTF( buf2, LEN, "%s", _errorStr2 ); + } + + printf( "XMLDocument error id=%d str1=%s str2=%s\n", + _errorID, buf1, buf2 ); + } +} + + +XMLPrinter::XMLPrinter( FILE* file, bool compact ) : + _elementJustOpened( false ), + _firstElement( true ), + _fp( file ), + _depth( 0 ), + _textDepth( -1 ), + _processEntities( true ), + _compactMode( compact ) +{ + for( int i=0; i'] = true; // not required, but consistency is nice + _buffer.Push( 0 ); +} + + +void XMLPrinter::Print( const char* format, ... ) +{ + va_list va; + va_start( va, format ); + + if ( _fp ) { + vfprintf( _fp, format, va ); + } + else { + // This seems brutally complex. Haven't figured out a better + // way on windows. +#ifdef _MSC_VER + int len = -1; + int expand = 1000; + while ( len < 0 ) { + len = vsnprintf_s( _accumulator.Mem(), _accumulator.Capacity(), _TRUNCATE, format, va ); + if ( len < 0 ) { + expand *= 3/2; + _accumulator.PushArr( expand ); + } + } + char* p = _buffer.PushArr( len ) - 1; + memcpy( p, _accumulator.Mem(), len+1 ); +#else + int len = vsnprintf( 0, 0, format, va ); + // Close out and re-start the va-args + va_end( va ); + va_start( va, format ); + char* p = _buffer.PushArr( len ) - 1; + vsnprintf( p, len+1, format, va ); +#endif + } + va_end( va ); +} + + +void XMLPrinter::PrintSpace( int depth ) +{ + for( int i=0; i 0 && *q < ENTITY_RANGE ) { + // Check for entities. If one is found, flush + // the stream up until the entity, write the + // entity, and keep looking. + if ( flag[(unsigned)(*q)] ) { + while ( p < q ) { + Print( "%c", *p ); + ++p; + } + for( int i=0; i 0) ) { + Print( "%s", p ); + } +} + + +void XMLPrinter::PushHeader( bool writeBOM, bool writeDec ) +{ + static const unsigned char bom[] = { TIXML_UTF_LEAD_0, TIXML_UTF_LEAD_1, TIXML_UTF_LEAD_2, 0 }; + if ( writeBOM ) { + Print( "%s", bom ); + } + if ( writeDec ) { + PushDeclaration( "xml version=\"1.0\"" ); + } +} + + +void XMLPrinter::OpenElement( const char* name ) +{ + if ( _elementJustOpened ) { + SealElement(); + } + _stack.Push( name ); + + if ( _textDepth < 0 && !_firstElement && !_compactMode ) { + Print( "\n" ); + PrintSpace( _depth ); + } + + Print( "<%s", name ); + _elementJustOpened = true; + _firstElement = false; + ++_depth; +} + + +void XMLPrinter::PushAttribute( const char* name, const char* value ) +{ + TIXMLASSERT( _elementJustOpened ); + Print( " %s=\"", name ); + PrintString( value, false ); + Print( "\"" ); +} + + +void XMLPrinter::PushAttribute( const char* name, int v ) +{ + char buf[BUF_SIZE]; + XMLUtil::ToStr( v, buf, BUF_SIZE ); + PushAttribute( name, buf ); +} + + +void XMLPrinter::PushAttribute( const char* name, unsigned v ) +{ + char buf[BUF_SIZE]; + XMLUtil::ToStr( v, buf, BUF_SIZE ); + PushAttribute( name, buf ); +} + + +void XMLPrinter::PushAttribute( const char* name, bool v ) +{ + char buf[BUF_SIZE]; + XMLUtil::ToStr( v, buf, BUF_SIZE ); + PushAttribute( name, buf ); +} + + +void XMLPrinter::PushAttribute( const char* name, double v ) +{ + char buf[BUF_SIZE]; + XMLUtil::ToStr( v, buf, BUF_SIZE ); + PushAttribute( name, buf ); +} + + +void XMLPrinter::CloseElement() +{ + --_depth; + const char* name = _stack.Pop(); + + if ( _elementJustOpened ) { + Print( "/>" ); + } + else { + if ( _textDepth < 0 && !_compactMode) { + Print( "\n" ); + PrintSpace( _depth ); + } + Print( "", name ); + } + + if ( _textDepth == _depth ) { + _textDepth = -1; + } + if ( _depth == 0 && !_compactMode) { + Print( "\n" ); + } + _elementJustOpened = false; +} + + +void XMLPrinter::SealElement() +{ + _elementJustOpened = false; + Print( ">" ); +} + + +void XMLPrinter::PushText( const char* text, bool cdata ) +{ + _textDepth = _depth-1; + + if ( _elementJustOpened ) { + SealElement(); + } + if ( cdata ) { + Print( "" ); + } + else { + PrintString( text, true ); + } +} + +void XMLPrinter::PushText( int value ) +{ + char buf[BUF_SIZE]; + XMLUtil::ToStr( value, buf, BUF_SIZE ); + PushText( buf, false ); +} + + +void XMLPrinter::PushText( unsigned value ) +{ + char buf[BUF_SIZE]; + XMLUtil::ToStr( value, buf, BUF_SIZE ); + PushText( buf, false ); +} + + +void XMLPrinter::PushText( bool value ) +{ + char buf[BUF_SIZE]; + XMLUtil::ToStr( value, buf, BUF_SIZE ); + PushText( buf, false ); +} + + +void XMLPrinter::PushText( float value ) +{ + char buf[BUF_SIZE]; + XMLUtil::ToStr( value, buf, BUF_SIZE ); + PushText( buf, false ); +} + + +void XMLPrinter::PushText( double value ) +{ + char buf[BUF_SIZE]; + XMLUtil::ToStr( value, buf, BUF_SIZE ); + PushText( buf, false ); +} + + +void XMLPrinter::PushComment( const char* comment ) +{ + if ( _elementJustOpened ) { + SealElement(); + } + if ( _textDepth < 0 && !_firstElement && !_compactMode) { + Print( "\n" ); + PrintSpace( _depth ); + } + _firstElement = false; + Print( "", comment ); +} + + +void XMLPrinter::PushDeclaration( const char* value ) +{ + if ( _elementJustOpened ) { + SealElement(); + } + if ( _textDepth < 0 && !_firstElement && !_compactMode) { + Print( "\n" ); + PrintSpace( _depth ); + } + _firstElement = false; + Print( "", value ); +} + + +void XMLPrinter::PushUnknown( const char* value ) +{ + if ( _elementJustOpened ) { + SealElement(); + } + if ( _textDepth < 0 && !_firstElement && !_compactMode) { + Print( "\n" ); + PrintSpace( _depth ); + } + _firstElement = false; + Print( "", value ); +} + + +bool XMLPrinter::VisitEnter( const XMLDocument& doc ) +{ + _processEntities = doc.ProcessEntities(); + if ( doc.HasBOM() ) { + PushHeader( true, false ); + } + return true; +} + + +bool XMLPrinter::VisitEnter( const XMLElement& element, const XMLAttribute* attribute ) +{ + OpenElement( element.Name() ); + while ( attribute ) { + PushAttribute( attribute->Name(), attribute->Value() ); + attribute = attribute->Next(); + } + return true; +} + + +bool XMLPrinter::VisitExit( const XMLElement& ) +{ + CloseElement(); + return true; +} + + +bool XMLPrinter::Visit( const XMLText& text ) +{ + PushText( text.Value(), text.CData() ); + return true; +} + + +bool XMLPrinter::Visit( const XMLComment& comment ) +{ + PushComment( comment.Value() ); + return true; +} + +bool XMLPrinter::Visit( const XMLDeclaration& declaration ) +{ + PushDeclaration( declaration.Value() ); + return true; +} + + +bool XMLPrinter::Visit( const XMLUnknown& unknown ) +{ + PushUnknown( unknown.Value() ); + return true; +} + +} // namespace tinyxml2 + diff --git a/extern/OculusSDK/3rdParty/TinyXml/tinyxml2.h b/extern/OculusSDK/3rdParty/TinyXml/tinyxml2.h new file mode 100644 index 0000000..ba1b249 --- /dev/null +++ b/extern/OculusSDK/3rdParty/TinyXml/tinyxml2.h @@ -0,0 +1,1911 @@ +/* +Original code by Lee Thomason (www.grinninglizard.com) + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any +damages arising from the use of this software. + +Permission is granted to anyone to use this software for any +purpose, including commercial applications, and to alter it and +redistribute it freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must +not claim that you wrote the original software. If you use this +software in a product, an acknowledgment in the product documentation +would be appreciated but is not required. + +2. Altered source versions must be plainly marked as such, and +must not be misrepresented as being the original software. + +3. This notice may not be removed or altered from any source +distribution. +*/ + +#ifndef TINYXML2_INCLUDED +#define TINYXML2_INCLUDED + +#if defined(ANDROID_NDK) || defined(__BORLANDC__) +# include +# include +# include +# include +# include +# include +#else +# include +# include +# include +# include +# include +# include +#endif + +/* + TODO: intern strings instead of allocation. +*/ +/* + gcc: + g++ -Wall -DDEBUG tinyxml2.cpp xmltest.cpp -o gccxmltest.exe + + Formatting, Artistic Style: + AStyle.exe --style=1tbs --indent-switches --break-closing-brackets --indent-preprocessor tinyxml2.cpp tinyxml2.h +*/ + +#if defined( _DEBUG ) || defined( DEBUG ) || defined (__DEBUG__) +# ifndef DEBUG +# define DEBUG +# endif +#endif + + +#if defined(DEBUG) +# if defined(_MSC_VER) +# define TIXMLASSERT( x ) if ( !(x)) { __debugbreak(); } //if ( !(x)) WinDebugBreak() +# elif defined (ANDROID_NDK) +# include +# define TIXMLASSERT( x ) if ( !(x)) { __android_log_assert( "assert", "grinliz", "ASSERT in '%s' at %d.", __FILE__, __LINE__ ); } +# else +# include +# define TIXMLASSERT assert +# endif +# else +# define TIXMLASSERT( x ) {} +#endif + + +#if defined(_MSC_VER) && (_MSC_VER >= 1400 ) +// Microsoft visual studio, version 2005 and higher. +/*int _snprintf_s( + char *buffer, + size_t sizeOfBuffer, + size_t count, + const char *format [, + argument] ... +);*/ +inline int TIXML_SNPRINTF( char* buffer, size_t size, const char* format, ... ) +{ + va_list va; + va_start( va, format ); + int result = vsnprintf_s( buffer, size, _TRUNCATE, format, va ); + va_end( va ); + return result; +} +#define TIXML_SSCANF sscanf_s +#else +// GCC version 3 and higher +//#warning( "Using sn* functions." ) +#define TIXML_SNPRINTF snprintf +#define TIXML_SSCANF sscanf +#endif + +static const int TIXML2_MAJOR_VERSION = 1; +static const int TIXML2_MINOR_VERSION = 0; +static const int TIXML2_PATCH_VERSION = 9; + +namespace tinyxml2 +{ +class XMLDocument; +class XMLElement; +class XMLAttribute; +class XMLComment; +class XMLNode; +class XMLText; +class XMLDeclaration; +class XMLUnknown; + +class XMLPrinter; + +/* + A class that wraps strings. Normally stores the start and end + pointers into the XML file itself, and will apply normalization + and entity translation if actually read. Can also store (and memory + manage) a traditional char[] +*/ +class StrPair +{ +public: + enum { + NEEDS_ENTITY_PROCESSING = 0x01, + NEEDS_NEWLINE_NORMALIZATION = 0x02, + COLLAPSE_WHITESPACE = 0x04, + + TEXT_ELEMENT = NEEDS_ENTITY_PROCESSING | NEEDS_NEWLINE_NORMALIZATION, + TEXT_ELEMENT_LEAVE_ENTITIES = NEEDS_NEWLINE_NORMALIZATION, + ATTRIBUTE_NAME = 0, + ATTRIBUTE_VALUE = NEEDS_ENTITY_PROCESSING | NEEDS_NEWLINE_NORMALIZATION, + ATTRIBUTE_VALUE_LEAVE_ENTITIES = NEEDS_NEWLINE_NORMALIZATION, + COMMENT = NEEDS_NEWLINE_NORMALIZATION + }; + + StrPair() : _flags( 0 ), _start( 0 ), _end( 0 ) {} + ~StrPair(); + + void Set( char* start, char* end, int flags ) { + Reset(); + _start = start; + _end = end; + _flags = flags | NEEDS_FLUSH; + } + + const char* GetStr(); + + bool Empty() const { + return _start == _end; + } + + void SetInternedStr( const char* str ) { + Reset(); + _start = const_cast(str); + } + + void SetStr( const char* str, int flags=0 ); + + char* ParseText( char* in, const char* endTag, int strFlags ); + char* ParseName( char* in ); + +private: + void Reset(); + void CollapseWhitespace(); + + enum { + NEEDS_FLUSH = 0x100, + NEEDS_DELETE = 0x200 + }; + + // After parsing, if *end != 0, it can be set to zero. + int _flags; + char* _start; + char* _end; +}; + + +/* + A dynamic array of Plain Old Data. Doesn't support constructors, etc. + Has a small initial memory pool, so that low or no usage will not + cause a call to new/delete +*/ +template +class DynArray +{ +public: + DynArray< T, INIT >() { + _mem = _pool; + _allocated = INIT; + _size = 0; + } + + ~DynArray() { + if ( _mem != _pool ) { + delete [] _mem; + } + } + + void Push( T t ) { + EnsureCapacity( _size+1 ); + _mem[_size++] = t; + } + + T* PushArr( int count ) { + EnsureCapacity( _size+count ); + T* ret = &_mem[_size]; + _size += count; + return ret; + } + + T Pop() { + return _mem[--_size]; + } + + void PopArr( int count ) { + TIXMLASSERT( _size >= count ); + _size -= count; + } + + bool Empty() const { + return _size == 0; + } + + T& operator[](int i) { + TIXMLASSERT( i>= 0 && i < _size ); + return _mem[i]; + } + + const T& operator[](int i) const { + TIXMLASSERT( i>= 0 && i < _size ); + return _mem[i]; + } + + int Size() const { + return _size; + } + + int Capacity() const { + return _allocated; + } + + const T* Mem() const { + return _mem; + } + + T* Mem() { + return _mem; + } + +private: + void EnsureCapacity( int cap ) { + if ( cap > _allocated ) { + int newAllocated = cap * 2; + T* newMem = new T[newAllocated]; + memcpy( newMem, _mem, sizeof(T)*_size ); // warning: not using constructors, only works for PODs + if ( _mem != _pool ) { + delete [] _mem; + } + _mem = newMem; + _allocated = newAllocated; + } + } + + T* _mem; + T _pool[INIT]; + int _allocated; // objects allocated + int _size; // number objects in use +}; + + +/* + Parent virtual class of a pool for fast allocation + and deallocation of objects. +*/ +class MemPool +{ +public: + MemPool() {} + virtual ~MemPool() {} + + virtual int ItemSize() const = 0; + virtual void* Alloc() = 0; + virtual void Free( void* ) = 0; + virtual void SetTracked() = 0; +}; + + +/* + Template child class to create pools of the correct type. +*/ +template< int SIZE > +class MemPoolT : public MemPool +{ +public: + MemPoolT() : _root(0), _currentAllocs(0), _nAllocs(0), _maxAllocs(0), _nUntracked(0) {} + ~MemPoolT() { + // Delete the blocks. + for( int i=0; i<_blockPtrs.Size(); ++i ) { + delete _blockPtrs[i]; + } + } + + virtual int ItemSize() const { + return SIZE; + } + int CurrentAllocs() const { + return _currentAllocs; + } + + virtual void* Alloc() { + if ( !_root ) { + // Need a new block. + Block* block = new Block(); + _blockPtrs.Push( block ); + + for( int i=0; ichunk[i].next = &block->chunk[i+1]; + } + block->chunk[COUNT-1].next = 0; + _root = block->chunk; + } + void* result = _root; + _root = _root->next; + + ++_currentAllocs; + if ( _currentAllocs > _maxAllocs ) { + _maxAllocs = _currentAllocs; + } + _nAllocs++; + _nUntracked++; + return result; + } + virtual void Free( void* mem ) { + if ( !mem ) { + return; + } + --_currentAllocs; + Chunk* chunk = (Chunk*)mem; +#ifdef DEBUG + memset( chunk, 0xfe, sizeof(Chunk) ); +#endif + chunk->next = _root; + _root = chunk; + } + void Trace( const char* name ) { + printf( "Mempool %s watermark=%d [%dk] current=%d size=%d nAlloc=%d blocks=%d\n", + name, _maxAllocs, _maxAllocs*SIZE/1024, _currentAllocs, SIZE, _nAllocs, _blockPtrs.Size() ); + } + + void SetTracked() { + _nUntracked--; + } + + int Untracked() const { + return _nUntracked; + } + + enum { COUNT = 1024/SIZE }; // Some compilers do not accept to use COUNT in private part if COUNT is private + +private: + union Chunk { + Chunk* next; + char mem[SIZE]; + }; + struct Block { + Chunk chunk[COUNT]; + }; + DynArray< Block*, 10 > _blockPtrs; + Chunk* _root; + + int _currentAllocs; + int _nAllocs; + int _maxAllocs; + int _nUntracked; +}; + + + +/** + Implements the interface to the "Visitor pattern" (see the Accept() method.) + If you call the Accept() method, it requires being passed a XMLVisitor + class to handle callbacks. For nodes that contain other nodes (Document, Element) + you will get called with a VisitEnter/VisitExit pair. Nodes that are always leafs + are simply called with Visit(). + + If you return 'true' from a Visit method, recursive parsing will continue. If you return + false, no children of this node or its sibilings will be visited. + + All flavors of Visit methods have a default implementation that returns 'true' (continue + visiting). You need to only override methods that are interesting to you. + + Generally Accept() is called on the TiXmlDocument, although all nodes support visiting. + + You should never change the document from a callback. + + @sa XMLNode::Accept() +*/ +class XMLVisitor +{ +public: + virtual ~XMLVisitor() {} + + /// Visit a document. + virtual bool VisitEnter( const XMLDocument& /*doc*/ ) { + return true; + } + /// Visit a document. + virtual bool VisitExit( const XMLDocument& /*doc*/ ) { + return true; + } + + /// Visit an element. + virtual bool VisitEnter( const XMLElement& /*element*/, const XMLAttribute* /*firstAttribute*/ ) { + return true; + } + /// Visit an element. + virtual bool VisitExit( const XMLElement& /*element*/ ) { + return true; + } + + /// Visit a declaration. + virtual bool Visit( const XMLDeclaration& /*declaration*/ ) { + return true; + } + /// Visit a text node. + virtual bool Visit( const XMLText& /*text*/ ) { + return true; + } + /// Visit a comment node. + virtual bool Visit( const XMLComment& /*comment*/ ) { + return true; + } + /// Visit an unknown node. + virtual bool Visit( const XMLUnknown& /*unknown*/ ) { + return true; + } +}; + + +/* + Utility functionality. +*/ +class XMLUtil +{ +public: + // Anything in the high order range of UTF-8 is assumed to not be whitespace. This isn't + // correct, but simple, and usually works. + static const char* SkipWhiteSpace( const char* p ) { + while( !IsUTF8Continuation(*p) && isspace( *reinterpret_cast(p) ) ) { + ++p; + } + return p; + } + static char* SkipWhiteSpace( char* p ) { + while( !IsUTF8Continuation(*p) && isspace( *reinterpret_cast(p) ) ) { + ++p; + } + return p; + } + static bool IsWhiteSpace( char p ) { + return !IsUTF8Continuation(p) && isspace( static_cast(p) ); + } + + inline static bool StringEqual( const char* p, const char* q, int nChar=INT_MAX ) { + int n = 0; + if ( p == q ) { + return true; + } + while( *p && *q && *p == *q && n(const_cast(this)->FirstChildElement( value )); + } + + /// Get the last child node, or null if none exists. + const XMLNode* LastChild() const { + return _lastChild; + } + + XMLNode* LastChild() { + return const_cast(const_cast(this)->LastChild() ); + } + + /** Get the last child element or optionally the last child + element with the specified name. + */ + const XMLElement* LastChildElement( const char* value=0 ) const; + + XMLElement* LastChildElement( const char* value=0 ) { + return const_cast(const_cast(this)->LastChildElement(value) ); + } + + /// Get the previous (left) sibling node of this node. + const XMLNode* PreviousSibling() const { + return _prev; + } + + XMLNode* PreviousSibling() { + return _prev; + } + + /// Get the previous (left) sibling element of this node, with an opitionally supplied name. + const XMLElement* PreviousSiblingElement( const char* value=0 ) const ; + + XMLElement* PreviousSiblingElement( const char* value=0 ) { + return const_cast(const_cast(this)->PreviousSiblingElement( value ) ); + } + + /// Get the next (right) sibling node of this node. + const XMLNode* NextSibling() const { + return _next; + } + + XMLNode* NextSibling() { + return _next; + } + + /// Get the next (right) sibling element of this node, with an opitionally supplied name. + const XMLElement* NextSiblingElement( const char* value=0 ) const; + + XMLElement* NextSiblingElement( const char* value=0 ) { + return const_cast(const_cast(this)->NextSiblingElement( value ) ); + } + + /** + Add a child node as the last (right) child. + */ + XMLNode* InsertEndChild( XMLNode* addThis ); + + XMLNode* LinkEndChild( XMLNode* addThis ) { + return InsertEndChild( addThis ); + } + /** + Add a child node as the first (left) child. + */ + XMLNode* InsertFirstChild( XMLNode* addThis ); + /** + Add a node after the specified child node. + */ + XMLNode* InsertAfterChild( XMLNode* afterThis, XMLNode* addThis ); + + /** + Delete all the children of this node. + */ + void DeleteChildren(); + + /** + Delete a child of this node. + */ + void DeleteChild( XMLNode* node ); + + /** + Make a copy of this node, but not its children. + You may pass in a Document pointer that will be + the owner of the new Node. If the 'document' is + null, then the node returned will be allocated + from the current Document. (this->GetDocument()) + + Note: if called on a XMLDocument, this will return null. + */ + virtual XMLNode* ShallowClone( XMLDocument* document ) const = 0; + + /** + Test if 2 nodes are the same, but don't test children. + The 2 nodes do not need to be in the same Document. + + Note: if called on a XMLDocument, this will return false. + */ + virtual bool ShallowEqual( const XMLNode* compare ) const = 0; + + /** Accept a hierarchical visit of the nodes in the TinyXML DOM. Every node in the + XML tree will be conditionally visited and the host will be called back + via the TiXmlVisitor interface. + + This is essentially a SAX interface for TinyXML. (Note however it doesn't re-parse + the XML for the callbacks, so the performance of TinyXML is unchanged by using this + interface versus any other.) + + The interface has been based on ideas from: + + - http://www.saxproject.org/ + - http://c2.com/cgi/wiki?HierarchicalVisitorPattern + + Which are both good references for "visiting". + + An example of using Accept(): + @verbatim + TiXmlPrinter printer; + tinyxmlDoc.Accept( &printer ); + const char* xmlcstr = printer.CStr(); + @endverbatim + */ + virtual bool Accept( XMLVisitor* visitor ) const = 0; + + // internal + virtual char* ParseDeep( char*, StrPair* ); + +protected: + XMLNode( XMLDocument* ); + virtual ~XMLNode(); + XMLNode( const XMLNode& ); // not supported + XMLNode& operator=( const XMLNode& ); // not supported + + XMLDocument* _document; + XMLNode* _parent; + mutable StrPair _value; + + XMLNode* _firstChild; + XMLNode* _lastChild; + + XMLNode* _prev; + XMLNode* _next; + +private: + MemPool* _memPool; + void Unlink( XMLNode* child ); +}; + + +/** XML text. + + Note that a text node can have child element nodes, for example: + @verbatim + This is bold + @endverbatim + + A text node can have 2 ways to output the next. "normal" output + and CDATA. It will default to the mode it was parsed from the XML file and + you generally want to leave it alone, but you can change the output mode with + SetCDATA() and query it with CDATA(). +*/ +class XMLText : public XMLNode +{ + friend class XMLBase; + friend class XMLDocument; +public: + virtual bool Accept( XMLVisitor* visitor ) const; + + virtual XMLText* ToText() { + return this; + } + virtual const XMLText* ToText() const { + return this; + } + + /// Declare whether this should be CDATA or standard text. + void SetCData( bool isCData ) { + _isCData = isCData; + } + /// Returns true if this is a CDATA text element. + bool CData() const { + return _isCData; + } + + char* ParseDeep( char*, StrPair* endTag ); + virtual XMLNode* ShallowClone( XMLDocument* document ) const; + virtual bool ShallowEqual( const XMLNode* compare ) const; + +protected: + XMLText( XMLDocument* doc ) : XMLNode( doc ), _isCData( false ) {} + virtual ~XMLText() {} + XMLText( const XMLText& ); // not supported + XMLText& operator=( const XMLText& ); // not supported + +private: + bool _isCData; +}; + + +/** An XML Comment. */ +class XMLComment : public XMLNode +{ + friend class XMLDocument; +public: + virtual XMLComment* ToComment() { + return this; + } + virtual const XMLComment* ToComment() const { + return this; + } + + virtual bool Accept( XMLVisitor* visitor ) const; + + char* ParseDeep( char*, StrPair* endTag ); + virtual XMLNode* ShallowClone( XMLDocument* document ) const; + virtual bool ShallowEqual( const XMLNode* compare ) const; + +protected: + XMLComment( XMLDocument* doc ); + virtual ~XMLComment(); + XMLComment( const XMLComment& ); // not supported + XMLComment& operator=( const XMLComment& ); // not supported + +private: +}; + + +/** In correct XML the declaration is the first entry in the file. + @verbatim + + @endverbatim + + TinyXML2 will happily read or write files without a declaration, + however. + + The text of the declaration isn't interpreted. It is parsed + and written as a string. +*/ +class XMLDeclaration : public XMLNode +{ + friend class XMLDocument; +public: + virtual XMLDeclaration* ToDeclaration() { + return this; + } + virtual const XMLDeclaration* ToDeclaration() const { + return this; + } + + virtual bool Accept( XMLVisitor* visitor ) const; + + char* ParseDeep( char*, StrPair* endTag ); + virtual XMLNode* ShallowClone( XMLDocument* document ) const; + virtual bool ShallowEqual( const XMLNode* compare ) const; + +protected: + XMLDeclaration( XMLDocument* doc ); + virtual ~XMLDeclaration(); + XMLDeclaration( const XMLDeclaration& ); // not supported + XMLDeclaration& operator=( const XMLDeclaration& ); // not supported +}; + + +/** Any tag that tinyXml doesn't recognize is saved as an + unknown. It is a tag of text, but should not be modified. + It will be written back to the XML, unchanged, when the file + is saved. + + DTD tags get thrown into TiXmlUnknowns. +*/ +class XMLUnknown : public XMLNode +{ + friend class XMLDocument; +public: + virtual XMLUnknown* ToUnknown() { + return this; + } + virtual const XMLUnknown* ToUnknown() const { + return this; + } + + virtual bool Accept( XMLVisitor* visitor ) const; + + char* ParseDeep( char*, StrPair* endTag ); + virtual XMLNode* ShallowClone( XMLDocument* document ) const; + virtual bool ShallowEqual( const XMLNode* compare ) const; + +protected: + XMLUnknown( XMLDocument* doc ); + virtual ~XMLUnknown(); + XMLUnknown( const XMLUnknown& ); // not supported + XMLUnknown& operator=( const XMLUnknown& ); // not supported +}; + + +enum XMLError { + XML_NO_ERROR = 0, + XML_SUCCESS = 0, + + XML_NO_ATTRIBUTE, + XML_WRONG_ATTRIBUTE_TYPE, + + XML_ERROR_FILE_NOT_FOUND, + XML_ERROR_FILE_COULD_NOT_BE_OPENED, + XML_ERROR_FILE_READ_ERROR, + XML_ERROR_ELEMENT_MISMATCH, + XML_ERROR_PARSING_ELEMENT, + XML_ERROR_PARSING_ATTRIBUTE, + XML_ERROR_IDENTIFYING_TAG, + XML_ERROR_PARSING_TEXT, + XML_ERROR_PARSING_CDATA, + XML_ERROR_PARSING_COMMENT, + XML_ERROR_PARSING_DECLARATION, + XML_ERROR_PARSING_UNKNOWN, + XML_ERROR_EMPTY_DOCUMENT, + XML_ERROR_MISMATCHED_ELEMENT, + XML_ERROR_PARSING, + + XML_CAN_NOT_CONVERT_TEXT, + XML_NO_TEXT_NODE +}; + + +/** An attribute is a name-value pair. Elements have an arbitrary + number of attributes, each with a unique name. + + @note The attributes are not XMLNodes. You may only query the + Next() attribute in a list. +*/ +class XMLAttribute +{ + friend class XMLElement; +public: + /// The name of the attribute. + const char* Name() const { + return _name.GetStr(); + } + /// The value of the attribute. + const char* Value() const { + return _value.GetStr(); + } + /// The next attribute in the list. + const XMLAttribute* Next() const { + return _next; + } + + /** IntAttribute interprets the attribute as an integer, and returns the value. + If the value isn't an integer, 0 will be returned. There is no error checking; + use QueryIntAttribute() if you need error checking. + */ + int IntValue() const { + int i=0; + QueryIntValue( &i ); + return i; + } + /// Query as an unsigned integer. See IntAttribute() + unsigned UnsignedValue() const { + unsigned i=0; + QueryUnsignedValue( &i ); + return i; + } + /// Query as a boolean. See IntAttribute() + bool BoolValue() const { + bool b=false; + QueryBoolValue( &b ); + return b; + } + /// Query as a double. See IntAttribute() + double DoubleValue() const { + double d=0; + QueryDoubleValue( &d ); + return d; + } + /// Query as a float. See IntAttribute() + float FloatValue() const { + float f=0; + QueryFloatValue( &f ); + return f; + } + + /** QueryIntAttribute interprets the attribute as an integer, and returns the value + in the provided paremeter. The function will return XML_NO_ERROR on success, + and XML_WRONG_ATTRIBUTE_TYPE if the conversion is not successful. + */ + XMLError QueryIntValue( int* value ) const; + /// See QueryIntAttribute + XMLError QueryUnsignedValue( unsigned int* value ) const; + /// See QueryIntAttribute + XMLError QueryBoolValue( bool* value ) const; + /// See QueryIntAttribute + XMLError QueryDoubleValue( double* value ) const; + /// See QueryIntAttribute + XMLError QueryFloatValue( float* value ) const; + + /// Set the attribute to a string value. + void SetAttribute( const char* value ); + /// Set the attribute to value. + void SetAttribute( int value ); + /// Set the attribute to value. + void SetAttribute( unsigned value ); + /// Set the attribute to value. + void SetAttribute( bool value ); + /// Set the attribute to value. + void SetAttribute( double value ); + /// Set the attribute to value. + void SetAttribute( float value ); + +private: + enum { BUF_SIZE = 200 }; + + XMLAttribute() : _next( 0 ) {} + virtual ~XMLAttribute() {} + + XMLAttribute( const XMLAttribute& ); // not supported + void operator=( const XMLAttribute& ); // not supported + void SetName( const char* name ); + + char* ParseDeep( char* p, bool processEntities ); + + mutable StrPair _name; + mutable StrPair _value; + XMLAttribute* _next; + MemPool* _memPool; +}; + + +/** The element is a container class. It has a value, the element name, + and can contain other elements, text, comments, and unknowns. + Elements also contain an arbitrary number of attributes. +*/ +class XMLElement : public XMLNode +{ + friend class XMLBase; + friend class XMLDocument; +public: + /// Get the name of an element (which is the Value() of the node.) + const char* Name() const { + return Value(); + } + /// Set the name of the element. + void SetName( const char* str, bool staticMem=false ) { + SetValue( str, staticMem ); + } + + virtual XMLElement* ToElement() { + return this; + } + virtual const XMLElement* ToElement() const { + return this; + } + virtual bool Accept( XMLVisitor* visitor ) const; + + /** Given an attribute name, Attribute() returns the value + for the attribute of that name, or null if none + exists. For example: + + @verbatim + const char* value = ele->Attribute( "foo" ); + @endverbatim + + The 'value' parameter is normally null. However, if specified, + the attribute will only be returned if the 'name' and 'value' + match. This allow you to write code: + + @verbatim + if ( ele->Attribute( "foo", "bar" ) ) callFooIsBar(); + @endverbatim + + rather than: + @verbatim + if ( ele->Attribute( "foo" ) ) { + if ( strcmp( ele->Attribute( "foo" ), "bar" ) == 0 ) callFooIsBar(); + } + @endverbatim + */ + const char* Attribute( const char* name, const char* value=0 ) const; + + /** Given an attribute name, IntAttribute() returns the value + of the attribute interpreted as an integer. 0 will be + returned if there is an error. For a method with error + checking, see QueryIntAttribute() + */ + int IntAttribute( const char* name ) const { + int i=0; + QueryIntAttribute( name, &i ); + return i; + } + /// See IntAttribute() + unsigned UnsignedAttribute( const char* name ) const { + unsigned i=0; + QueryUnsignedAttribute( name, &i ); + return i; + } + /// See IntAttribute() + bool BoolAttribute( const char* name ) const { + bool b=false; + QueryBoolAttribute( name, &b ); + return b; + } + /// See IntAttribute() + double DoubleAttribute( const char* name ) const { + double d=0; + QueryDoubleAttribute( name, &d ); + return d; + } + /// See IntAttribute() + float FloatAttribute( const char* name ) const { + float f=0; + QueryFloatAttribute( name, &f ); + return f; + } + + /** Given an attribute name, QueryIntAttribute() returns + XML_NO_ERROR, XML_WRONG_ATTRIBUTE_TYPE if the conversion + can't be performed, or XML_NO_ATTRIBUTE if the attribute + doesn't exist. If successful, the result of the conversion + will be written to 'value'. If not successful, nothing will + be written to 'value'. This allows you to provide default + value: + + @verbatim + int value = 10; + QueryIntAttribute( "foo", &value ); // if "foo" isn't found, value will still be 10 + @endverbatim + */ + XMLError QueryIntAttribute( const char* name, int* value ) const { + const XMLAttribute* a = FindAttribute( name ); + if ( !a ) { + return XML_NO_ATTRIBUTE; + } + return a->QueryIntValue( value ); + } + /// See QueryIntAttribute() + XMLError QueryUnsignedAttribute( const char* name, unsigned int* value ) const { + const XMLAttribute* a = FindAttribute( name ); + if ( !a ) { + return XML_NO_ATTRIBUTE; + } + return a->QueryUnsignedValue( value ); + } + /// See QueryIntAttribute() + XMLError QueryBoolAttribute( const char* name, bool* value ) const { + const XMLAttribute* a = FindAttribute( name ); + if ( !a ) { + return XML_NO_ATTRIBUTE; + } + return a->QueryBoolValue( value ); + } + /// See QueryIntAttribute() + XMLError QueryDoubleAttribute( const char* name, double* value ) const { + const XMLAttribute* a = FindAttribute( name ); + if ( !a ) { + return XML_NO_ATTRIBUTE; + } + return a->QueryDoubleValue( value ); + } + /// See QueryIntAttribute() + XMLError QueryFloatAttribute( const char* name, float* value ) const { + const XMLAttribute* a = FindAttribute( name ); + if ( !a ) { + return XML_NO_ATTRIBUTE; + } + return a->QueryFloatValue( value ); + } + + /// Sets the named attribute to value. + void SetAttribute( const char* name, const char* value ) { + XMLAttribute* a = FindOrCreateAttribute( name ); + a->SetAttribute( value ); + } + /// Sets the named attribute to value. + void SetAttribute( const char* name, int value ) { + XMLAttribute* a = FindOrCreateAttribute( name ); + a->SetAttribute( value ); + } + /// Sets the named attribute to value. + void SetAttribute( const char* name, unsigned value ) { + XMLAttribute* a = FindOrCreateAttribute( name ); + a->SetAttribute( value ); + } + /// Sets the named attribute to value. + void SetAttribute( const char* name, bool value ) { + XMLAttribute* a = FindOrCreateAttribute( name ); + a->SetAttribute( value ); + } + /// Sets the named attribute to value. + void SetAttribute( const char* name, double value ) { + XMLAttribute* a = FindOrCreateAttribute( name ); + a->SetAttribute( value ); + } + + /** + Delete an attribute. + */ + void DeleteAttribute( const char* name ); + + /// Return the first attribute in the list. + const XMLAttribute* FirstAttribute() const { + return _rootAttribute; + } + /// Query a specific attribute in the list. + const XMLAttribute* FindAttribute( const char* name ) const; + + /** Convenience function for easy access to the text inside an element. Although easy + and concise, GetText() is limited compared to getting the TiXmlText child + and accessing it directly. + + If the first child of 'this' is a TiXmlText, the GetText() + returns the character string of the Text node, else null is returned. + + This is a convenient method for getting the text of simple contained text: + @verbatim + This is text + const char* str = fooElement->GetText(); + @endverbatim + + 'str' will be a pointer to "This is text". + + Note that this function can be misleading. If the element foo was created from + this XML: + @verbatim + This is text + @endverbatim + + then the value of str would be null. The first child node isn't a text node, it is + another element. From this XML: + @verbatim + This is text + @endverbatim + GetText() will return "This is ". + */ + const char* GetText() const; + + /** + Convenience method to query the value of a child text node. This is probably best + shown by example. Given you have a document is this form: + @verbatim + + 1 + 1.4 + + @endverbatim + + The QueryIntText() and similar functions provide a safe and easier way to get to the + "value" of x and y. + + @verbatim + int x = 0; + float y = 0; // types of x and y are contrived for example + const XMLElement* xElement = pointElement->FirstChildElement( "x" ); + const XMLElement* yElement = pointElement->FirstChildElement( "y" ); + xElement->QueryIntText( &x ); + yElement->QueryFloatText( &y ); + @endverbatim + + @returns XML_SUCCESS (0) on success, XML_CAN_NOT_CONVERT_TEXT if the text cannot be converted + to the requested type, and XML_NO_TEXT_NODE if there is no child text to query. + + */ + XMLError QueryIntText( int* ival ) const; + /// See QueryIntText() + XMLError QueryUnsignedText( unsigned* uval ) const; + /// See QueryIntText() + XMLError QueryBoolText( bool* bval ) const; + /// See QueryIntText() + XMLError QueryDoubleText( double* dval ) const; + /// See QueryIntText() + XMLError QueryFloatText( float* fval ) const; + + // internal: + enum { + OPEN, // + CLOSED, // + CLOSING // + }; + int ClosingType() const { + return _closingType; + } + char* ParseDeep( char* p, StrPair* endTag ); + virtual XMLNode* ShallowClone( XMLDocument* document ) const; + virtual bool ShallowEqual( const XMLNode* compare ) const; + +private: + XMLElement( XMLDocument* doc ); + virtual ~XMLElement(); + XMLElement( const XMLElement& ); // not supported + void operator=( const XMLElement& ); // not supported + + XMLAttribute* FindAttribute( const char* name ); + XMLAttribute* FindOrCreateAttribute( const char* name ); + //void LinkAttribute( XMLAttribute* attrib ); + char* ParseAttributes( char* p ); + + int _closingType; + // The attribute list is ordered; there is no 'lastAttribute' + // because the list needs to be scanned for dupes before adding + // a new attribute. + XMLAttribute* _rootAttribute; +}; + + +enum Whitespace { + PRESERVE_WHITESPACE, + COLLAPSE_WHITESPACE +}; + + +/** A Document binds together all the functionality. + It can be saved, loaded, and printed to the screen. + All Nodes are connected and allocated to a Document. + If the Document is deleted, all its Nodes are also deleted. +*/ +class XMLDocument : public XMLNode +{ + friend class XMLElement; +public: + /// constructor + XMLDocument( bool processEntities = true, Whitespace = PRESERVE_WHITESPACE ); + ~XMLDocument(); + + virtual XMLDocument* ToDocument() { + return this; + } + virtual const XMLDocument* ToDocument() const { + return this; + } + + /** + Parse an XML file from a character string. + Returns XML_NO_ERROR (0) on success, or + an errorID. + + You may optionally pass in the 'nBytes', which is + the number of bytes which will be parsed. If not + specified, TinyXML will assume 'xml' points to a + null terminated string. + */ + XMLError Parse( const char* xml, size_t nBytes=(size_t)(-1) ); + + /** + Load an XML file from disk. + Returns XML_NO_ERROR (0) on success, or + an errorID. + */ + XMLError LoadFile( const char* filename ); + + /** + Load an XML file from disk. You are responsible + for providing and closing the FILE*. + + Returns XML_NO_ERROR (0) on success, or + an errorID. + */ + XMLError LoadFile( FILE* ); + + /** + Save the XML file to disk. + Returns XML_NO_ERROR (0) on success, or + an errorID. + */ + XMLError SaveFile( const char* filename, bool compact = false ); + + /** + Save the XML file to disk. You are responsible + for providing and closing the FILE*. + + Returns XML_NO_ERROR (0) on success, or + an errorID. + */ + XMLError SaveFile( FILE* fp, bool compact = false ); + + bool ProcessEntities() const { + return _processEntities; + } + Whitespace WhitespaceMode() const { + return _whitespace; + } + + /** + Returns true if this document has a leading Byte Order Mark of UTF8. + */ + bool HasBOM() const { + return _writeBOM; + } + /** Sets whether to write the BOM when writing the file. + */ + void SetBOM( bool useBOM ) { + _writeBOM = useBOM; + } + + /** Return the root element of DOM. Equivalent to FirstChildElement(). + To get the first node, use FirstChild(). + */ + XMLElement* RootElement() { + return FirstChildElement(); + } + const XMLElement* RootElement() const { + return FirstChildElement(); + } + + /** Print the Document. If the Printer is not provided, it will + print to stdout. If you provide Printer, this can print to a file: + @verbatim + XMLPrinter printer( fp ); + doc.Print( &printer ); + @endverbatim + + Or you can use a printer to print to memory: + @verbatim + XMLPrinter printer; + doc->Print( &printer ); + // printer.CStr() has a const char* to the XML + @endverbatim + */ + void Print( XMLPrinter* streamer=0 ); + virtual bool Accept( XMLVisitor* visitor ) const; + + /** + Create a new Element associated with + this Document. The memory for the Element + is managed by the Document. + */ + XMLElement* NewElement( const char* name ); + /** + Create a new Comment associated with + this Document. The memory for the Comment + is managed by the Document. + */ + XMLComment* NewComment( const char* comment ); + /** + Create a new Text associated with + this Document. The memory for the Text + is managed by the Document. + */ + XMLText* NewText( const char* text ); + /** + Create a new Declaration associated with + this Document. The memory for the object + is managed by the Document. + + If the 'text' param is null, the standard + declaration is used.: + @verbatim + + @endverbatim + */ + XMLDeclaration* NewDeclaration( const char* text=0 ); + /** + Create a new Unknown associated with + this Document. The memory forthe object + is managed by the Document. + */ + XMLUnknown* NewUnknown( const char* text ); + + /** + Delete a node associated with this document. + It will be unlinked from the DOM. + */ + void DeleteNode( XMLNode* node ) { + node->_parent->DeleteChild( node ); + } + + void SetError( XMLError error, const char* str1, const char* str2 ); + + /// Return true if there was an error parsing the document. + bool Error() const { + return _errorID != XML_NO_ERROR; + } + /// Return the errorID. + XMLError ErrorID() const { + return _errorID; + } + /// Return a possibly helpful diagnostic location or string. + const char* GetErrorStr1() const { + return _errorStr1; + } + /// Return a possibly helpful secondary diagnostic location or string. + const char* GetErrorStr2() const { + return _errorStr2; + } + /// If there is an error, print it to stdout. + void PrintError() const; + + // internal + char* Identify( char* p, XMLNode** node ); + + virtual XMLNode* ShallowClone( XMLDocument* /*document*/ ) const { + return 0; + } + virtual bool ShallowEqual( const XMLNode* /*compare*/ ) const { + return false; + } + +private: + XMLDocument( const XMLDocument& ); // not supported + void operator=( const XMLDocument& ); // not supported + void InitDocument(); + + bool _writeBOM; + bool _processEntities; + XMLError _errorID; + Whitespace _whitespace; + const char* _errorStr1; + const char* _errorStr2; + char* _charBuffer; + + MemPoolT< sizeof(XMLElement) > _elementPool; + MemPoolT< sizeof(XMLAttribute) > _attributePool; + MemPoolT< sizeof(XMLText) > _textPool; + MemPoolT< sizeof(XMLComment) > _commentPool; +}; + + +/** + A XMLHandle is a class that wraps a node pointer with null checks; this is + an incredibly useful thing. Note that XMLHandle is not part of the TinyXML + DOM structure. It is a separate utility class. + + Take an example: + @verbatim + + + + + + + @endverbatim + + Assuming you want the value of "attributeB" in the 2nd "Child" element, it's very + easy to write a *lot* of code that looks like: + + @verbatim + XMLElement* root = document.FirstChildElement( "Document" ); + if ( root ) + { + XMLElement* element = root->FirstChildElement( "Element" ); + if ( element ) + { + XMLElement* child = element->FirstChildElement( "Child" ); + if ( child ) + { + XMLElement* child2 = child->NextSiblingElement( "Child" ); + if ( child2 ) + { + // Finally do something useful. + @endverbatim + + And that doesn't even cover "else" cases. XMLHandle addresses the verbosity + of such code. A XMLHandle checks for null pointers so it is perfectly safe + and correct to use: + + @verbatim + XMLHandle docHandle( &document ); + XMLElement* child2 = docHandle.FirstChild( "Document" ).FirstChild( "Element" ).FirstChild().NextSibling().ToElement(); + if ( child2 ) + { + // do something useful + @endverbatim + + Which is MUCH more concise and useful. + + It is also safe to copy handles - internally they are nothing more than node pointers. + @verbatim + XMLHandle handleCopy = handle; + @endverbatim + + See also XMLConstHandle, which is the same as XMLHandle, but operates on const objects. +*/ +class XMLHandle +{ +public: + /// Create a handle from any node (at any depth of the tree.) This can be a null pointer. + XMLHandle( XMLNode* node ) { + _node = node; + } + /// Create a handle from a node. + XMLHandle( XMLNode& node ) { + _node = &node; + } + /// Copy constructor + XMLHandle( const XMLHandle& ref ) { + _node = ref._node; + } + /// Assignment + XMLHandle& operator=( const XMLHandle& ref ) { + _node = ref._node; + return *this; + } + + /// Get the first child of this handle. + XMLHandle FirstChild() { + return XMLHandle( _node ? _node->FirstChild() : 0 ); + } + /// Get the first child element of this handle. + XMLHandle FirstChildElement( const char* value=0 ) { + return XMLHandle( _node ? _node->FirstChildElement( value ) : 0 ); + } + /// Get the last child of this handle. + XMLHandle LastChild() { + return XMLHandle( _node ? _node->LastChild() : 0 ); + } + /// Get the last child element of this handle. + XMLHandle LastChildElement( const char* _value=0 ) { + return XMLHandle( _node ? _node->LastChildElement( _value ) : 0 ); + } + /// Get the previous sibling of this handle. + XMLHandle PreviousSibling() { + return XMLHandle( _node ? _node->PreviousSibling() : 0 ); + } + /// Get the previous sibling element of this handle. + XMLHandle PreviousSiblingElement( const char* _value=0 ) { + return XMLHandle( _node ? _node->PreviousSiblingElement( _value ) : 0 ); + } + /// Get the next sibling of this handle. + XMLHandle NextSibling() { + return XMLHandle( _node ? _node->NextSibling() : 0 ); + } + /// Get the next sibling element of this handle. + XMLHandle NextSiblingElement( const char* _value=0 ) { + return XMLHandle( _node ? _node->NextSiblingElement( _value ) : 0 ); + } + + /// Safe cast to XMLNode. This can return null. + XMLNode* ToNode() { + return _node; + } + /// Safe cast to XMLElement. This can return null. + XMLElement* ToElement() { + return ( ( _node && _node->ToElement() ) ? _node->ToElement() : 0 ); + } + /// Safe cast to XMLText. This can return null. + XMLText* ToText() { + return ( ( _node && _node->ToText() ) ? _node->ToText() : 0 ); + } + /// Safe cast to XMLUnknown. This can return null. + XMLUnknown* ToUnknown() { + return ( ( _node && _node->ToUnknown() ) ? _node->ToUnknown() : 0 ); + } + /// Safe cast to XMLDeclaration. This can return null. + XMLDeclaration* ToDeclaration() { + return ( ( _node && _node->ToDeclaration() ) ? _node->ToDeclaration() : 0 ); + } + +private: + XMLNode* _node; +}; + + +/** + A variant of the XMLHandle class for working with const XMLNodes and Documents. It is the + same in all regards, except for the 'const' qualifiers. See XMLHandle for API. +*/ +class XMLConstHandle +{ +public: + XMLConstHandle( const XMLNode* node ) { + _node = node; + } + XMLConstHandle( const XMLNode& node ) { + _node = &node; + } + XMLConstHandle( const XMLConstHandle& ref ) { + _node = ref._node; + } + + XMLConstHandle& operator=( const XMLConstHandle& ref ) { + _node = ref._node; + return *this; + } + + const XMLConstHandle FirstChild() const { + return XMLConstHandle( _node ? _node->FirstChild() : 0 ); + } + const XMLConstHandle FirstChildElement( const char* value=0 ) const { + return XMLConstHandle( _node ? _node->FirstChildElement( value ) : 0 ); + } + const XMLConstHandle LastChild() const { + return XMLConstHandle( _node ? _node->LastChild() : 0 ); + } + const XMLConstHandle LastChildElement( const char* _value=0 ) const { + return XMLConstHandle( _node ? _node->LastChildElement( _value ) : 0 ); + } + const XMLConstHandle PreviousSibling() const { + return XMLConstHandle( _node ? _node->PreviousSibling() : 0 ); + } + const XMLConstHandle PreviousSiblingElement( const char* _value=0 ) const { + return XMLConstHandle( _node ? _node->PreviousSiblingElement( _value ) : 0 ); + } + const XMLConstHandle NextSibling() const { + return XMLConstHandle( _node ? _node->NextSibling() : 0 ); + } + const XMLConstHandle NextSiblingElement( const char* _value=0 ) const { + return XMLConstHandle( _node ? _node->NextSiblingElement( _value ) : 0 ); + } + + + const XMLNode* ToNode() const { + return _node; + } + const XMLElement* ToElement() const { + return ( ( _node && _node->ToElement() ) ? _node->ToElement() : 0 ); + } + const XMLText* ToText() const { + return ( ( _node && _node->ToText() ) ? _node->ToText() : 0 ); + } + const XMLUnknown* ToUnknown() const { + return ( ( _node && _node->ToUnknown() ) ? _node->ToUnknown() : 0 ); + } + const XMLDeclaration* ToDeclaration() const { + return ( ( _node && _node->ToDeclaration() ) ? _node->ToDeclaration() : 0 ); + } + +private: + const XMLNode* _node; +}; + + +/** + Printing functionality. The XMLPrinter gives you more + options than the XMLDocument::Print() method. + + It can: + -# Print to memory. + -# Print to a file you provide. + -# Print XML without a XMLDocument. + + Print to Memory + + @verbatim + XMLPrinter printer; + doc->Print( &printer ); + SomeFunction( printer.CStr() ); + @endverbatim + + Print to a File + + You provide the file pointer. + @verbatim + XMLPrinter printer( fp ); + doc.Print( &printer ); + @endverbatim + + Print without a XMLDocument + + When loading, an XML parser is very useful. However, sometimes + when saving, it just gets in the way. The code is often set up + for streaming, and constructing the DOM is just overhead. + + The Printer supports the streaming case. The following code + prints out a trivially simple XML file without ever creating + an XML document. + + @verbatim + XMLPrinter printer( fp ); + printer.OpenElement( "foo" ); + printer.PushAttribute( "foo", "bar" ); + printer.CloseElement(); + @endverbatim +*/ +class XMLPrinter : public XMLVisitor +{ +public: + /** Construct the printer. If the FILE* is specified, + this will print to the FILE. Else it will print + to memory, and the result is available in CStr(). + If 'compact' is set to true, then output is created + with only required whitespace and newlines. + */ + XMLPrinter( FILE* file=0, bool compact = false ); + ~XMLPrinter() {} + + /** If streaming, write the BOM and declaration. */ + void PushHeader( bool writeBOM, bool writeDeclaration ); + /** If streaming, start writing an element. + The element must be closed with CloseElement() + */ + void OpenElement( const char* name ); + /// If streaming, add an attribute to an open element. + void PushAttribute( const char* name, const char* value ); + void PushAttribute( const char* name, int value ); + void PushAttribute( const char* name, unsigned value ); + void PushAttribute( const char* name, bool value ); + void PushAttribute( const char* name, double value ); + /// If streaming, close the Element. + void CloseElement(); + + /// Add a text node. + void PushText( const char* text, bool cdata=false ); + /// Add a text node from an integer. + void PushText( int value ); + /// Add a text node from an unsigned. + void PushText( unsigned value ); + /// Add a text node from a bool. + void PushText( bool value ); + /// Add a text node from a float. + void PushText( float value ); + /// Add a text node from a double. + void PushText( double value ); + + /// Add a comment + void PushComment( const char* comment ); + + void PushDeclaration( const char* value ); + void PushUnknown( const char* value ); + + virtual bool VisitEnter( const XMLDocument& /*doc*/ ); + virtual bool VisitExit( const XMLDocument& /*doc*/ ) { + return true; + } + + virtual bool VisitEnter( const XMLElement& element, const XMLAttribute* attribute ); + virtual bool VisitExit( const XMLElement& element ); + + virtual bool Visit( const XMLText& text ); + virtual bool Visit( const XMLComment& comment ); + virtual bool Visit( const XMLDeclaration& declaration ); + virtual bool Visit( const XMLUnknown& unknown ); + + /** + If in print to memory mode, return a pointer to + the XML file in memory. + */ + const char* CStr() const { + return _buffer.Mem(); + } + /** + If in print to memory mode, return the size + of the XML file in memory. (Note the size returned + includes the terminating null.) + */ + int CStrSize() const { + return _buffer.Size(); + } + +private: + void SealElement(); + void PrintSpace( int depth ); + void PrintString( const char*, bool restrictedEntitySet ); // prints out, after detecting entities. + void Print( const char* format, ... ); + + bool _elementJustOpened; + bool _firstElement; + FILE* _fp; + int _depth; + int _textDepth; + bool _processEntities; + bool _compactMode; + + enum { + ENTITY_RANGE = 64, + BUF_SIZE = 200 + }; + bool _entityFlag[ENTITY_RANGE]; + bool _restrictedEntityFlag[ENTITY_RANGE]; + + DynArray< const char*, 10 > _stack; + DynArray< char, 20 > _buffer; +#ifdef _MSC_VER + DynArray< char, 20 > _accumulator; +#endif +}; + + +} // tinyxml2 + + +#endif // TINYXML2_INCLUDED diff --git a/extern/OculusSDK/Doc/sdk_docs_have_moved.txt b/extern/OculusSDK/Doc/sdk_docs_have_moved.txt new file mode 100644 index 0000000..343d0e5 --- /dev/null +++ b/extern/OculusSDK/Doc/sdk_docs_have_moved.txt @@ -0,0 +1,3 @@ +All SDK and Integration documentation are now available on-line at the following link: + +https://developer.oculus.com/documentation/ \ No newline at end of file diff --git a/extern/OculusSDK/LICENSE.txt b/extern/OculusSDK/LICENSE.txt new file mode 100644 index 0000000..7328d9b --- /dev/null +++ b/extern/OculusSDK/LICENSE.txt @@ -0,0 +1,264 @@ +Oculus VR, LLC Software Development Kit License Agreement + +Copyright © 2014 Oculus VR, LLC All rights reserved. + +The text of this may be found at: https://developer.oculus.com/licenses/pc-3.2/ + +Human-Readable Summary*: + +You are Free to: + +Use, modify, and distribute the Oculus VR Rift SDK in source and binary +form with your applications/software. + +With the Following Restrictions: + +You can only distribute or re-distribute the source code to LibOVR in +whole, not in part. + +Modifications to the Oculus VR Rift SDK in source or binary form must +be shared with Oculus VR. + +If your applications cause health and safety issues, you may lose your +right to use the Oculus VR Rift SDK, including LibOVR. + +The Oculus VR Rift SDK may not be used to interface with unapproved commercial +virtual reality mobile or non-mobile products or hardware. + +* - This human-readable Summary is not a license. It is simply a convenient +reference for understanding the full Oculus VR Rift SDK License Agreement. +The Summary is written as a user-friendly interface to the full Oculus VR Rift +SDK License below. This Summary itself has no legal value, and its contents do +not appear in the actual license. + +Full-length Legal Copy: + +1. Subject to the terms and conditions of this License Agreement (the "License"), +Oculus VR, LLC ("Oculus VR") hereby grants to you a perpetual, worldwide, +non-exclusive, no-charge, royalty-free, sublicenseable copyright license to use, +reproduce, redistribute (subject to restrictions below), modify, and improve the +software contained in this Oculus VR Rift Software Development Kit ("RIFT SDK"), +including, but not limited to, the samples, headers, LibOVR headers, and LibOVR +source. This license is subject to the following terms and conditions: + +1.1. This license includes the non-exclusive license and right to use (i) the RIFT +SDK to make applications, content, games and demos (collectively and generally +referred to as "Developer Content") that run on the Oculus VR approved mobile hardware +and software products ("Oculus Approved Rift Products") and which may incorporate +the RIFT SDK in whole or in part in binary or object code; and (ii) to use the +RIFT SDK to create derivative works of the RIFT SDK itself ("RIFT SDK Derivatives"), +whether in source, binary, or object form, in whole or in part, including third +party software unless otherwise noted. + +1.2. RIFT SDK Derivatives are further defined as source, binary or object code +derived exclusively from the RIFT SDK by you; provided, however, that RIFT SDK +Derivatives do not include the Developer Content (engines, utilities, applications, +content, games or demos) which may be developed using the RIFT SDK. By way of example +a mobile application or game or demo that is developed using the RIFT SDK would not +be a RIFT SDK Derivative , nor would a utility or tool set in a pre-existing game +engine that is adapted to work with the RIFT SDK be a RIFT SDK Derivative. +By way of example, but not limitation, a RIFT SDK Derivative is or would be: either (i) +an adaptation of a utility or piece of code from the RIFT SDK to improve efficiency; +or (ii) an addition of code or improvement to the RIFT SDK that adds functionality. + +1.3 For the sake of clarification when you use the RIFT SDK (including RIFT SDK +Derivatives) in or with Developer Content, you retain all rights to your Developer +Content, and you have no obligations to share or license Developer Content (including +your source and object code) to Oculus VR or any third parties; provided, however, +Oculus VR retains all rights to the RIFT SDK and the RIFT SDK Derivatives that may +be incorporated into your Developer Content. + +1.4 You agree to and you will use the Flash Screen Warning and the Health and +Safety Warnings (collectively the "Oculus Warnings") and the Oculus VR health and +safety protocols found in the Oculus Best Practices Guide ("Oculus H&S Protocols"), +and your use of the Oculus Warnings and the Oculus end user license agreement +("Oculus EULA") with your Developer Content as provided for in the Oculus Developer +Center, all of which can be found at the following link: +https://developer.oculus.com/documentation/ + +2. You, the recipient and user of the RIFT SDK, hereby agree and accept that +Oculus VR shall own all right, title and interest to the intellectual property +rights, including, but not limited to copyright, trademark and patent rights, to any +RIFT SDK Derivatives that you may create, and you hereby assign any and all such +rights to such RIFT SDK Derivatives to Oculus VR, subject to the following. + +2.1 We hereby grant to you the a fully paid up, no-charge, royalty-free, +world-wide, in perpetuity, non-exclusive right and license back to use these RIFT +SDK Derivatives solely in conjunction with the RIFT SDK (or any components of the +RIFT SDK) and/or Developer Content on Oculus Rift Products as set forth herein. + +2.2 Furthermore, for the sake of clarification, Oculus VR and its assignees and +licensees shall be free to use such RIFT SDK Derivatives without any approval +from you and without compensation or attribution to you. + +2.3 You also agree upon Oculus VR's request to provide the source and binary code +of any RIFT SDK Derivatives to Oculus VR. FAILURE TO COMPLY WITH THIS REQUEST +IS THE BASIS FOR AUTOMATIC TERMINATION OF THIS LICENSE BY OCULUS VR. + +3. Subject to the terms and conditions of this License, your license to redistribute +and sublicense the RIFT SDK and RIFT SDK Derivatives is also expressly made +subject to the following conditions: + +3.1. You may sublicense and redistribute the source, binary, or object code of +the RIFT SDK in whole or in part by itself for no charge or as part of a for charge +piece of Developer Content; provided, however, you may only license, sublicense +or redistribute the source, binary or object code of LibOVR in whole, and you may +not license, sublicense or redistribute any portion or element of LibOVR separately +or in part (in either source, binary or object form). If you license, sublicense +or redistribute RIFT SDK Derivatives in and of themselves (not as a part of a +piece of Developer Content) then you may only do that solely with and in conjunction +with either the RIFT SDK or LibOVR. The RIFT SDK (including, but not limited to +LibOVR), any RIFT SDK Derivatives, and any Developer Content may only be used +with Oculus Approved Rift Products and may not be used, licensed, or sublicensed +to interface with mobile software or hardware or other commercial headsets, +mobile tablets or phones that are not authorized and approved by Oculus VR; + +3.2. You must include with all such redistributed or sublicensed RIFT SDK +or RIFT SDK Derivatives code the following copyright notice: +"Copyright © 2014 Oculus VR, LLC. All rights reserved," and include the +list of conditions contained in this Section 3, including the full text of +the disclaimer in Section 3.6 below; + +3.3. Neither the name of Oculus VR, LLC nor the names of Oculus VR, LLC's +contributors, licensors, employees, or contractors, may be used to endorse or promote +products derived from this RIFT SDK without specific prior written permission +of Oculus VR, LLC; + +3.4. You must give any other recipients of the RIFT SDK or any elements thereof, +including LibOVR or RIFT SDK Derivatives, a copy of this License as such recipients, +licensees or sublicensees may only use the RIFT SDK or any RIFT SDK Derivatives +or any elements thereof subject to the terms of this License and such recipients, +licensees or sublicensees agreement and acceptance of this License with Oculus VR +(which will convey all rights to the recipients’ or licensees’ or sublicensees’ +RIFT SDK Derivatives to Oculus VR), and you must cause any modified files to +carry prominent notices stating that you changed the files; + +3.5. If the RIFT SDK or a specific element thereof such as LibOVR includes a +"LICENSE" text file as part of its distribution (the "License Notice"), then +any RIFT SDK Derivatives that you distribute with the RIFT SDK in whole or in +part must include a readable copy of such attribution notices as are contained +within the applicable License Notice file (excluding those notices that do not +pertain to any part of the RIFT SDK Derivatives), in at least one of the following +places: within a License Notice text file distributed as part of the RIFT SDK +Derivatives; within the source form or documentation, if provided along with +the RIFT SDK Derivatives; or, within a display generated by the RIFT SDK Derivatives, +if and wherever such third-party notices normally appear. You must also include +in the License Notice file for all RIFT SDK Derivatives a copy of all notices +(including any product liability or health and safety notices). The contents +of the License Notice file are for informational purposes only and do not modify +the License. You may add your own attribution notices within RIFT SDK Derivatives +that you distribute, alongside or as an addendum to the License Notice text from +the RIFT SDK or any part thereof, provided that such additional attribution notices +cannot be construed as modifying the License. + +3.6. THIS RIFT SDK AND ANY COMPONENT THEREOF IS PROVIDED BY OCULUS VR AND +ITS CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL OCULUS VR AS THE +COPYRIGHT OWNER OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, +OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS RIFT +SDK OR THE RIFT SDK DERIVATIVES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +4. This License does not grant permission to use the trade names, trademarks, +service marks, or product names of Oculus VR, except as required for reasonable +and customary use in describing the origin of the RIFT SDK, LibOVR, or any +element thereof, and reproducing the content of the License Notice file. +Oculus VR reserves all rights not expressly granted to you under this License. + +5. In no event and under no legal theory, whether in tort (including negligence), +contract, or otherwise, unless required by applicable law (such as +deliberate and grossly negligent acts) or agreed to in writing, shall Oculus VR +or any contributor be liable to you or your licensees or sublicensees for +damages, including any direct, indirect, special, incidental, or consequential +damages of any character arising as a result of this License or out of the use +or inability to use the RIFT SDK, LibOVR, any element thereof or any RIFT SDK +Derivatives (including but not limited to damages for loss of goodwill, work +stoppage, computer failure or malfunction, or any and all other commercial +damages or losses), even if you or such contributor has been advised of the +possibility of such damages. + +6. Your acceptance of the terms and conditions of this License in and of +itself and for all Developer Content created as of March 1, 2014, may be +evidenced by any of the following: your usage of the RIFT SDK or any element +thereof, acceptance of the click-through agreement, or opening the packaging +of the CD-ROM containing the RIFT SDK or any element thereof, including LibOVR. +As this License is updated for future releases of the RIFT SDK and/or LibOVR, +you agree to abide by and meet all requirements of future updates of this +License for those future RIFT SDK releases as evidenced by the same usage of +the RIFT SDK or any element thereof and the future updates of this License +will apply for that future Developer Content that may developed for or with +that future RIFT SDK or any element thereof (i.e., you cannot sidestep out +of the requirements of future updates of the License by developing against +an older release of the RIFT SDK or License). + +7. Oculus VR reserves the right to terminate this License and all your +rights hereunder in the event you materially breach this License and fail +to cure such breach within ten (10) business days after notice of breach +from Oculus VR. + +8. Furthermore, Oculus VR also reserves the right to cancel or terminate +this License for any of the following reasons upon notice to you, subject +to the appeal process set forth in Section 14 for a wrongful termination: + + a) Intellectual property infringement by you with Developer Content + or RIFT SDK Derivatives created by you that is used with or by the + RIFT SDK or any part thereof, or any of the RIFT SDK Derivatives; + + b) Developer Content that violates or infringes upon applicable law; + + c) Health and safety issues associated with your Developer Content; + + d) Failure to comply with or use properly the Oculus Warnings, + Oculus H&S Protocols, or Oculus EULA; + + e) Use of the RIFT SDK, RIFT SDK Derivatives or LibOVR with a + commercial product other than an Oculus Approved Product; and + + f) Failure to provide required notices or deliver source code + and/or binary of RIFT SDK Derivatives as set forth above. + +If you believe that you have been wrongfully terminated under this Section 8 +with respect to material breach or with respect to these above conditions, +you have the right to appeal the termination of this License under Section 14. + +9. This License may be amended by Oculus VR on a prospective basis, and your +usage of the License after such amendments or changes signifies your consent +to and acceptance of any such amendments or changes on a going forward basis. + +10. In the event any provision of this License is determined to be invalid, +prohibited or unenforceable by a court or other body of competent jurisdiction, +this License shall be construed as if such invalid, prohibited or unenforceable +provision has been more narrowly drawn so as not to be invalid, prohibited or +unenforceable. + +11. You may not assign any rights or obligations under this License without +the advance written consent of Oculus VR, which may be withheld in its sole +discretion. Oculus VR may assign its rights or obligations under this License +in its sole discretion. + +12. Failure of either party at any time to enforce any of the provisions of +this License will not be construed as a waiver of such provisions or in any way +affect the validity of this License or parts thereof. + +13. Your remedies under this License shall be limited to the right to collect +money damages, if any, and you hereby waive your right to injunctive or other +equitable relief. + +14. This License shall be governed by the laws of the State of California, +without giving effect to choice of law principles. All disputes relating to +this License shall be resolved by binding non-appearance-based arbitration +before a neutral arbitrator in Orange County, California. If your License +has been terminated hereunder by Oculus, you may appeal your termination +through this arbitration process on an expedited basis with an arbitration +within thirty days of your giving Oculus VR notice of the appeal. The +arbitration shall be conducted in accordance with the rules and procedures +of JAMS then in effect, and the judgment of the arbitrator shall be final +and capable of entry in any court of competent jurisdiction. You agree +to submit to the personal jurisdiction of the courts located within Orange +County, California in connection with any entrance of an arbitrator’s judgment +or decision or any dispute with respect to the arbitration process or procedure +or Oculus VR’s exercise of its equitable rights or remedies. \ No newline at end of file diff --git a/extern/OculusSDK/LibOVR/Include/Extras/OVR_CAPI_Util.h b/extern/OculusSDK/LibOVR/Include/Extras/OVR_CAPI_Util.h new file mode 100644 index 0000000..dfb6e76 --- /dev/null +++ b/extern/OculusSDK/LibOVR/Include/Extras/OVR_CAPI_Util.h @@ -0,0 +1,183 @@ +/********************************************************************************//** +\file OVR_CAPI_Util.h +\brief This header provides LibOVR utility function declarations +\copyright Copyright 2015 Oculus VR, LLC All Rights reserved. +*************************************************************************************/ + +#ifndef OVR_CAPI_Util_h +#define OVR_CAPI_Util_h + + +#include "OVR_CAPI.h" + + +#ifdef __cplusplus +extern "C" { +#endif + + +/// Enumerates modifications to the projection matrix based on the application's needs. +/// +/// \see ovrMatrix4f_Projection +/// +typedef enum ovrProjectionModifier_ +{ + /// Use for generating a default projection matrix that is: + /// * Left-handed. + /// * Near depth values stored in the depth buffer are smaller than far depth values. + /// * Both near and far are explicitly defined. + /// * With a clipping range that is (0 to w). + ovrProjection_None = 0x00, + + /// Enable if using right-handed transformations in your application. + ovrProjection_RightHanded = 0x01, + + /// After the projection transform is applied, far values stored in the depth buffer will be less than closer depth values. + /// NOTE: Enable only if the application is using a floating-point depth buffer for proper precision. + ovrProjection_FarLessThanNear = 0x02, + + /// When this flag is used, the zfar value pushed into ovrMatrix4f_Projection() will be ignored + /// NOTE: Enable only if ovrProjection_FarLessThanNear is also enabled where the far clipping plane will be pushed to infinity. + ovrProjection_FarClipAtInfinity = 0x04, + + /// Enable if the application is rendering with OpenGL and expects a projection matrix with a clipping range of (-w to w). + /// Ignore this flag if your application already handles the conversion from D3D range (0 to w) to OpenGL. + ovrProjection_ClipRangeOpenGL = 0x08, +} ovrProjectionModifier; + + +/// Return values for ovr_Detect. +/// +/// \see ovr_Detect +/// +typedef struct OVR_ALIGNAS(8) ovrDetectResult_ +{ + /// Is ovrFalse when the Oculus Service is not running. + /// This means that the Oculus Service is either uninstalled or stopped. + /// IsOculusHMDConnected will be ovrFalse in this case. + /// Is ovrTrue when the Oculus Service is running. + /// This means that the Oculus Service is installed and running. + /// IsOculusHMDConnected will reflect the state of the HMD. + ovrBool IsOculusServiceRunning; + + /// Is ovrFalse when an Oculus HMD is not detected. + /// If the Oculus Service is not running, this will be ovrFalse. + /// Is ovrTrue when an Oculus HMD is detected. + /// This implies that the Oculus Service is also installed and running. + ovrBool IsOculusHMDConnected; + + OVR_UNUSED_STRUCT_PAD(pad0, 6) ///< \internal struct padding + +} ovrDetectResult; + +OVR_STATIC_ASSERT(sizeof(ovrDetectResult) == 8, "ovrDetectResult size mismatch"); + + +/// Detects Oculus Runtime and Device Status +/// +/// Checks for Oculus Runtime and Oculus HMD device status without loading the LibOVRRT +/// shared library. This may be called before ovr_Initialize() to help decide whether or +/// not to initialize LibOVR. +/// +/// \param[in] timeoutMsec Specifies a timeout to wait for HMD to be attached or 0 to poll. +/// +/// \return Returns an ovrDetectResult object indicating the result of detection. +/// +/// \see ovrDetectResult +/// +OVR_PUBLIC_FUNCTION(ovrDetectResult) ovr_Detect(int timeoutMsec); + +// On the Windows platform, +#ifdef _WIN32 + /// This is the Windows Named Event name that is used to check for HMD connected state. + #define OVR_HMD_CONNECTED_EVENT_NAME L"OculusHMDConnected" +#endif // _WIN32 + + +/// Used to generate projection from ovrEyeDesc::Fov. +/// +/// \param[in] fov Specifies the ovrFovPort to use. +/// \param[in] znear Distance to near Z limit. +/// \param[in] zfar Distance to far Z limit. +/// \param[in] projectionModFlags A combination of the ovrProjectionModifier flags. +/// +/// \return Returns the calculated projection matrix. +/// +/// \see ovrProjectionModifier +/// +OVR_PUBLIC_FUNCTION(ovrMatrix4f) ovrMatrix4f_Projection(ovrFovPort fov, float znear, float zfar, unsigned int projectionModFlags); + + +/// Extracts the required data from the result of ovrMatrix4f_Projection. +/// +/// \param[in] projection Specifies the project matrix from which to extract ovrTimewarpProjectionDesc. +/// \param[in] projectionModFlags A combination of the ovrProjectionModifier flags. +/// \return Returns the extracted ovrTimewarpProjectionDesc. +/// \see ovrTimewarpProjectionDesc +/// +OVR_PUBLIC_FUNCTION(ovrTimewarpProjectionDesc) ovrTimewarpProjectionDesc_FromProjection(ovrMatrix4f projection, unsigned int projectionModFlags); + + +/// Generates an orthographic sub-projection. +/// +/// Used for 2D rendering, Y is down. +/// +/// \param[in] projection The perspective matrix that the orthographic matrix is derived from. +/// \param[in] orthoScale Equal to 1.0f / pixelsPerTanAngleAtCenter. +/// \param[in] orthoDistance Equal to the distance from the camera in meters, such as 0.8m. +/// \param[in] hmdToEyeViewOffsetX Specifies the offset of the eye from the center. +/// +/// \return Returns the calculated projection matrix. +/// +OVR_PUBLIC_FUNCTION(ovrMatrix4f) ovrMatrix4f_OrthoSubProjection(ovrMatrix4f projection, ovrVector2f orthoScale, + float orthoDistance, float hmdToEyeViewOffsetX); + + + +/// Computes offset eye poses based on headPose returned by ovrTrackingState. +/// +/// \param[in] headPose Indicates the HMD position and orientation to use for the calculation. +/// \param[in] hmdToEyeViewOffset Can be ovrEyeRenderDesc.HmdToEyeViewOffset returned from +/// ovr_GetRenderDesc. For monoscopic rendering, use a vector that is the average +/// of the two vectors for both eyes. +/// \param[out] outEyePoses If outEyePoses are used for rendering, they should be passed to +/// ovr_SubmitFrame in ovrLayerEyeFov::RenderPose or ovrLayerEyeFovDepth::RenderPose. +/// +OVR_PUBLIC_FUNCTION(void) ovr_CalcEyePoses(ovrPosef headPose, + const ovrVector3f hmdToEyeViewOffset[2], + ovrPosef outEyePoses[2]); + + +/// Returns the predicted head pose in outHmdTrackingState and offset eye poses in outEyePoses. +/// +/// This is a thread-safe function where caller should increment frameIndex with every frame +/// and pass that index where applicable to functions called on the rendering thread. +/// Assuming outEyePoses are used for rendering, it should be passed as a part of ovrLayerEyeFov. +/// The caller does not need to worry about applying HmdToEyeViewOffset to the returned outEyePoses variables. +/// +/// \param[in] hmd Specifies an ovrHmd previously returned by ovr_Create. +/// \param[in] frameIndex Specifies the targeted frame index, or 0 to refer to one frame after +/// the last time ovr_SubmitFrame was called. +/// \param[in] hmdToEyeViewOffset Can be ovrEyeRenderDesc.HmdToEyeViewOffset returned from +/// ovr_GetRenderDesc. For monoscopic rendering, use a vector that is the average +/// of the two vectors for both eyes. +/// \param[in] latencyMarker Specifies that this call is the point in time where +/// the "App-to-Mid-Photon" latency timer starts from. If a given ovrLayer +/// provides "SensorSampleTimestamp", that will override the value stored here. +/// \param[out] outEyePoses The predicted eye poses. +/// \param[out] outHmdTrackingState The predicted ovrTrackingState. May be NULL, in which case it is ignored. +/// +OVR_PUBLIC_FUNCTION(void) ovr_GetEyePoses(ovrSession session, long long frameIndex, ovrBool latencyMarker, + const ovrVector3f hmdToEyeViewOffset[2], + ovrPosef outEyePoses[2], + ovrTrackingState* outHmdTrackingState); + + + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + + +#endif // Header include guard diff --git a/extern/OculusSDK/LibOVR/Include/Extras/OVR_Math.h b/extern/OculusSDK/LibOVR/Include/Extras/OVR_Math.h new file mode 100644 index 0000000..a3d9b64 --- /dev/null +++ b/extern/OculusSDK/LibOVR/Include/Extras/OVR_Math.h @@ -0,0 +1,3785 @@ +/********************************************************************************//** +\file OVR_Math.h +\brief Implementation of 3D primitives such as vectors, matrices. +\copyright Copyright 2014 Oculus VR, LLC All Rights reserved. +*************************************************************************************/ + +#ifndef OVR_Math_h +#define OVR_Math_h + + +// This file is intended to be independent of the rest of LibOVR and LibOVRKernel and thus +// has no #include dependencies on either. + +#include +#include +#include +#include +#include +#include +#include "../OVR_CAPI.h" // Currently required due to a dependence on the ovrFovPort_ declaration. + +#if defined(_MSC_VER) + #pragma warning(push) + #pragma warning(disable: 4127) // conditional expression is constant +#endif + + +#if defined(_MSC_VER) + #define OVRMath_sprintf sprintf_s +#else + #define OVRMath_sprintf snprintf +#endif + + +//------------------------------------------------------------------------------------- +// ***** OVR_MATH_ASSERT +// +// Independent debug break implementation for OVR_Math.h. + +#if !defined(OVR_MATH_DEBUG_BREAK) + #if defined(_DEBUG) + #if defined(_MSC_VER) + #define OVR_MATH_DEBUG_BREAK __debugbreak() + #else + #define OVR_MATH_DEBUG_BREAK __builtin_trap() + #endif + #else + #define OVR_MATH_DEBUG_BREAK ((void)0) + #endif +#endif + + +//------------------------------------------------------------------------------------- +// ***** OVR_MATH_ASSERT +// +// Independent OVR_MATH_ASSERT implementation for OVR_Math.h. + +#if !defined(OVR_MATH_ASSERT) + #if defined(_DEBUG) + #define OVR_MATH_ASSERT(p) if (!(p)) { OVR_MATH_DEBUG_BREAK; } + #else + #define OVR_MATH_ASSERT(p) ((void)0) + #endif +#endif + + +//------------------------------------------------------------------------------------- +// ***** OVR_MATH_STATIC_ASSERT +// +// Independent OVR_MATH_ASSERT implementation for OVR_Math.h. + +#if !defined(OVR_MATH_STATIC_ASSERT) + #if defined(__cplusplus) && ((defined(_MSC_VER) && (defined(_MSC_VER) >= 1600)) || defined(__GXX_EXPERIMENTAL_CXX0X__) || (__cplusplus >= 201103L)) + #define OVR_MATH_STATIC_ASSERT static_assert + #else + #if !defined(OVR_SA_UNUSED) + #if defined(__GNUC__) || defined(__clang__) + #define OVR_SA_UNUSED __attribute__((unused)) + #else + #define OVR_SA_UNUSED + #endif + #define OVR_SA_PASTE(a,b) a##b + #define OVR_SA_HELP(a,b) OVR_SA_PASTE(a,b) + #endif + + #define OVR_MATH_STATIC_ASSERT(expression, msg) typedef char OVR_SA_HELP(compileTimeAssert, __LINE__) [((expression) != 0) ? 1 : -1] OVR_SA_UNUSED + #endif +#endif + + + +namespace OVR { + +template +const T OVRMath_Min(const T a, const T b) +{ return (a < b) ? a : b; } + +template +const T OVRMath_Max(const T a, const T b) +{ return (b < a) ? a : b; } + +template +void OVRMath_Swap(T& a, T& b) +{ T temp(a); a = b; b = temp; } + + +//------------------------------------------------------------------------------------- +// ***** Constants for 3D world/axis definitions. + +// Definitions of axes for coordinate and rotation conversions. +enum Axis +{ + Axis_X = 0, Axis_Y = 1, Axis_Z = 2 +}; + +// RotateDirection describes the rotation direction around an axis, interpreted as follows: +// CW - Clockwise while looking "down" from positive axis towards the origin. +// CCW - Counter-clockwise while looking from the positive axis towards the origin, +// which is in the negative axis direction. +// CCW is the default for the RHS coordinate system. Oculus standard RHS coordinate +// system defines Y up, X right, and Z back (pointing out from the screen). In this +// system Rotate_CCW around Z will specifies counter-clockwise rotation in XY plane. +enum RotateDirection +{ + Rotate_CCW = 1, + Rotate_CW = -1 +}; + +// Constants for right handed and left handed coordinate systems +enum HandedSystem +{ + Handed_R = 1, Handed_L = -1 +}; + +// AxisDirection describes which way the coordinate axis points. Used by WorldAxes. +enum AxisDirection +{ + Axis_Up = 2, + Axis_Down = -2, + Axis_Right = 1, + Axis_Left = -1, + Axis_In = 3, + Axis_Out = -3 +}; + +struct WorldAxes +{ + AxisDirection XAxis, YAxis, ZAxis; + + WorldAxes(AxisDirection x, AxisDirection y, AxisDirection z) + : XAxis(x), YAxis(y), ZAxis(z) + { OVR_MATH_ASSERT(abs(x) != abs(y) && abs(y) != abs(z) && abs(z) != abs(x));} +}; + +} // namespace OVR + + +//------------------------------------------------------------------------------------// +// ***** C Compatibility Types + +// These declarations are used to support conversion between C types used in +// LibOVR C interfaces and their C++ versions. As an example, they allow passing +// Vector3f into a function that expects ovrVector3f. + +typedef struct ovrQuatf_ ovrQuatf; +typedef struct ovrQuatd_ ovrQuatd; +typedef struct ovrSizei_ ovrSizei; +typedef struct ovrSizef_ ovrSizef; +typedef struct ovrSized_ ovrSized; +typedef struct ovrRecti_ ovrRecti; +typedef struct ovrVector2i_ ovrVector2i; +typedef struct ovrVector2f_ ovrVector2f; +typedef struct ovrVector2d_ ovrVector2d; +typedef struct ovrVector3f_ ovrVector3f; +typedef struct ovrVector3d_ ovrVector3d; +typedef struct ovrVector4f_ ovrVector4f; +typedef struct ovrVector4d_ ovrVector4d; +typedef struct ovrMatrix2f_ ovrMatrix2f; +typedef struct ovrMatrix2d_ ovrMatrix2d; +typedef struct ovrMatrix3f_ ovrMatrix3f; +typedef struct ovrMatrix3d_ ovrMatrix3d; +typedef struct ovrMatrix4f_ ovrMatrix4f; +typedef struct ovrMatrix4d_ ovrMatrix4d; +typedef struct ovrPosef_ ovrPosef; +typedef struct ovrPosed_ ovrPosed; +typedef struct ovrPoseStatef_ ovrPoseStatef; +typedef struct ovrPoseStated_ ovrPoseStated; + +namespace OVR { + +// Forward-declare our templates. +template class Quat; +template class Size; +template class Rect; +template class Vector2; +template class Vector3; +template class Vector4; +template class Matrix2; +template class Matrix3; +template class Matrix4; +template class Pose; +template class PoseState; + +// CompatibleTypes::Type is used to lookup a compatible C-version of a C++ class. +template +struct CompatibleTypes +{ + // Declaration here seems necessary for MSVC; specializations are + // used instead. + typedef struct {} Type; +}; + +// Specializations providing CompatibleTypes::Type value. +template<> struct CompatibleTypes > { typedef ovrQuatf Type; }; +template<> struct CompatibleTypes > { typedef ovrQuatd Type; }; +template<> struct CompatibleTypes > { typedef ovrMatrix2f Type; }; +template<> struct CompatibleTypes > { typedef ovrMatrix2d Type; }; +template<> struct CompatibleTypes > { typedef ovrMatrix3f Type; }; +template<> struct CompatibleTypes > { typedef ovrMatrix3d Type; }; +template<> struct CompatibleTypes > { typedef ovrMatrix4f Type; }; +template<> struct CompatibleTypes > { typedef ovrMatrix4d Type; }; +template<> struct CompatibleTypes > { typedef ovrSizei Type; }; +template<> struct CompatibleTypes > { typedef ovrSizef Type; }; +template<> struct CompatibleTypes > { typedef ovrSized Type; }; +template<> struct CompatibleTypes > { typedef ovrRecti Type; }; +template<> struct CompatibleTypes > { typedef ovrVector2i Type; }; +template<> struct CompatibleTypes > { typedef ovrVector2f Type; }; +template<> struct CompatibleTypes > { typedef ovrVector2d Type; }; +template<> struct CompatibleTypes > { typedef ovrVector3f Type; }; +template<> struct CompatibleTypes > { typedef ovrVector3d Type; }; +template<> struct CompatibleTypes > { typedef ovrVector4f Type; }; +template<> struct CompatibleTypes > { typedef ovrVector4d Type; }; +template<> struct CompatibleTypes > { typedef ovrPosef Type; }; +template<> struct CompatibleTypes > { typedef ovrPosed Type; }; + +//------------------------------------------------------------------------------------// +// ***** Math +// +// Math class contains constants and functions. This class is a template specialized +// per type, with Math and Math being distinct. +template +class Math +{ +public: + // By default, support explicit conversion to float. This allows Vector2 to + // compile, for example. + typedef float OtherFloatType; + + static int Tolerance() { return 0; } // Default value so integer types compile +}; + + +//------------------------------------------------------------------------------------// +// ***** double constants +#define MATH_DOUBLE_PI 3.14159265358979323846 +#define MATH_DOUBLE_TWOPI (2*MATH_DOUBLE_PI) +#define MATH_DOUBLE_PIOVER2 (0.5*MATH_DOUBLE_PI) +#define MATH_DOUBLE_PIOVER4 (0.25*MATH_DOUBLE_PI) +#define MATH_FLOAT_MAXVALUE (FLT_MAX) + +#define MATH_DOUBLE_RADTODEGREEFACTOR (360.0 / MATH_DOUBLE_TWOPI) +#define MATH_DOUBLE_DEGREETORADFACTOR (MATH_DOUBLE_TWOPI / 360.0) + +#define MATH_DOUBLE_E 2.71828182845904523536 +#define MATH_DOUBLE_LOG2E 1.44269504088896340736 +#define MATH_DOUBLE_LOG10E 0.434294481903251827651 +#define MATH_DOUBLE_LN2 0.693147180559945309417 +#define MATH_DOUBLE_LN10 2.30258509299404568402 + +#define MATH_DOUBLE_SQRT2 1.41421356237309504880 +#define MATH_DOUBLE_SQRT1_2 0.707106781186547524401 + +#define MATH_DOUBLE_TOLERANCE 1e-12 // a default number for value equality tolerance: about 4500*Epsilon; +#define MATH_DOUBLE_SINGULARITYRADIUS 1e-12 // about 1-cos(.0001 degree), for gimbal lock numerical problems + +//------------------------------------------------------------------------------------// +// ***** float constants +#define MATH_FLOAT_PI float(MATH_DOUBLE_PI) +#define MATH_FLOAT_TWOPI float(MATH_DOUBLE_TWOPI) +#define MATH_FLOAT_PIOVER2 float(MATH_DOUBLE_PIOVER2) +#define MATH_FLOAT_PIOVER4 float(MATH_DOUBLE_PIOVER4) + +#define MATH_FLOAT_RADTODEGREEFACTOR float(MATH_DOUBLE_RADTODEGREEFACTOR) +#define MATH_FLOAT_DEGREETORADFACTOR float(MATH_DOUBLE_DEGREETORADFACTOR) + +#define MATH_FLOAT_E float(MATH_DOUBLE_E) +#define MATH_FLOAT_LOG2E float(MATH_DOUBLE_LOG2E) +#define MATH_FLOAT_LOG10E float(MATH_DOUBLE_LOG10E) +#define MATH_FLOAT_LN2 float(MATH_DOUBLE_LN2) +#define MATH_FLOAT_LN10 float(MATH_DOUBLE_LN10) + +#define MATH_FLOAT_SQRT2 float(MATH_DOUBLE_SQRT2) +#define MATH_FLOAT_SQRT1_2 float(MATH_DOUBLE_SQRT1_2) + +#define MATH_FLOAT_TOLERANCE 1e-5f // a default number for value equality tolerance: 1e-5, about 84*EPSILON; +#define MATH_FLOAT_SINGULARITYRADIUS 1e-7f // about 1-cos(.025 degree), for gimbal lock numerical problems + + + +// Single-precision Math constants class. +template<> +class Math +{ +public: + typedef double OtherFloatType; + + static inline float Tolerance() { return MATH_FLOAT_TOLERANCE; }; // a default number for value equality tolerance + static inline float SingularityRadius() { return MATH_FLOAT_SINGULARITYRADIUS; }; // for gimbal lock numerical problems +}; + +// Double-precision Math constants class +template<> +class Math +{ +public: + typedef float OtherFloatType; + + static inline double Tolerance() { return MATH_DOUBLE_TOLERANCE; }; // a default number for value equality tolerance + static inline double SingularityRadius() { return MATH_DOUBLE_SINGULARITYRADIUS; }; // for gimbal lock numerical problems +}; + +typedef Math Mathf; +typedef Math Mathd; + +// Conversion functions between degrees and radians +// (non-templated to ensure passing int arguments causes warning) +inline float RadToDegree(float rad) { return rad * MATH_FLOAT_RADTODEGREEFACTOR; } +inline double RadToDegree(double rad) { return rad * MATH_DOUBLE_RADTODEGREEFACTOR; } + +inline float DegreeToRad(float deg) { return deg * MATH_FLOAT_DEGREETORADFACTOR; } +inline double DegreeToRad(double deg) { return deg * MATH_DOUBLE_DEGREETORADFACTOR; } + +// Square function +template +inline T Sqr(T x) { return x*x; } + +// Sign: returns 0 if x == 0, -1 if x < 0, and 1 if x > 0 +template +inline T Sign(T x) { return (x != T(0)) ? (x < T(0) ? T(-1) : T(1)) : T(0); } + +// Numerically stable acos function +inline float Acos(float x) { return (x > 1.0f) ? 0.0f : (x < -1.0f) ? MATH_FLOAT_PI : acosf(x); } +inline double Acos(double x) { return (x > 1.0) ? 0.0 : (x < -1.0) ? MATH_DOUBLE_PI : acos(x); } + +// Numerically stable asin function +inline float Asin(float x) { return (x > 1.0f) ? MATH_FLOAT_PIOVER2 : (x < -1.0f) ? -MATH_FLOAT_PIOVER2 : asinf(x); } +inline double Asin(double x) { return (x > 1.0) ? MATH_DOUBLE_PIOVER2 : (x < -1.0) ? -MATH_DOUBLE_PIOVER2 : asin(x); } + +#if defined(_MSC_VER) + inline int isnan(double x) { return ::_isnan(x); } +#elif !defined(isnan) // Some libraries #define isnan. + inline int isnan(double x) { return ::isnan(x); } +#endif + +template +class Quat; + + +//------------------------------------------------------------------------------------- +// ***** Vector2<> + +// Vector2f (Vector2d) represents a 2-dimensional vector or point in space, +// consisting of coordinates x and y + +template +class Vector2 +{ +public: + typedef T ElementType; + static const size_t ElementCount = 2; + + T x, y; + + Vector2() : x(0), y(0) { } + Vector2(T x_, T y_) : x(x_), y(y_) { } + explicit Vector2(T s) : x(s), y(s) { } + explicit Vector2(const Vector2::OtherFloatType> &src) + : x((T)src.x), y((T)src.y) { } + + static Vector2 Zero() { return Vector2(0, 0); } + + // C-interop support. + typedef typename CompatibleTypes >::Type CompatibleType; + + Vector2(const CompatibleType& s) : x(s.x), y(s.y) { } + + operator const CompatibleType& () const + { + OVR_MATH_STATIC_ASSERT(sizeof(Vector2) == sizeof(CompatibleType), "sizeof(Vector2) failure"); + return reinterpret_cast(*this); + } + + + bool operator== (const Vector2& b) const { return x == b.x && y == b.y; } + bool operator!= (const Vector2& b) const { return x != b.x || y != b.y; } + + Vector2 operator+ (const Vector2& b) const { return Vector2(x + b.x, y + b.y); } + Vector2& operator+= (const Vector2& b) { x += b.x; y += b.y; return *this; } + Vector2 operator- (const Vector2& b) const { return Vector2(x - b.x, y - b.y); } + Vector2& operator-= (const Vector2& b) { x -= b.x; y -= b.y; return *this; } + Vector2 operator- () const { return Vector2(-x, -y); } + + // Scalar multiplication/division scales vector. + Vector2 operator* (T s) const { return Vector2(x*s, y*s); } + Vector2& operator*= (T s) { x *= s; y *= s; return *this; } + + Vector2 operator/ (T s) const { T rcp = T(1)/s; + return Vector2(x*rcp, y*rcp); } + Vector2& operator/= (T s) { T rcp = T(1)/s; + x *= rcp; y *= rcp; + return *this; } + + static Vector2 Min(const Vector2& a, const Vector2& b) { return Vector2((a.x < b.x) ? a.x : b.x, + (a.y < b.y) ? a.y : b.y); } + static Vector2 Max(const Vector2& a, const Vector2& b) { return Vector2((a.x > b.x) ? a.x : b.x, + (a.y > b.y) ? a.y : b.y); } + + Vector2 Clamped(T maxMag) const + { + T magSquared = LengthSq(); + if (magSquared <= Sqr(maxMag)) + return *this; + else + return *this * (maxMag / sqrt(magSquared)); + } + + // Compare two vectors for equality with tolerance. Returns true if vectors match withing tolerance. + bool IsEqual(const Vector2& b, T tolerance =Math::Tolerance()) const + { + return (fabs(b.x-x) <= tolerance) && + (fabs(b.y-y) <= tolerance); + } + bool Compare(const Vector2& b, T tolerance = Math::Tolerance()) const + { + return IsEqual(b, tolerance); + } + + // Access element by index + T& operator[] (int idx) + { + OVR_MATH_ASSERT(0 <= idx && idx < 2); + return *(&x + idx); + } + const T& operator[] (int idx) const + { + OVR_MATH_ASSERT(0 <= idx && idx < 2); + return *(&x + idx); + } + + // Entry-wise product of two vectors + Vector2 EntrywiseMultiply(const Vector2& b) const { return Vector2(x * b.x, y * b.y);} + + + // Multiply and divide operators do entry-wise math. Used Dot() for dot product. + Vector2 operator* (const Vector2& b) const { return Vector2(x * b.x, y * b.y); } + Vector2 operator/ (const Vector2& b) const { return Vector2(x / b.x, y / b.y); } + + // Dot product + // Used to calculate angle q between two vectors among other things, + // as (A dot B) = |a||b|cos(q). + T Dot(const Vector2& b) const { return x*b.x + y*b.y; } + + // Returns the angle from this vector to b, in radians. + T Angle(const Vector2& b) const + { + T div = LengthSq()*b.LengthSq(); + OVR_MATH_ASSERT(div != T(0)); + T result = Acos((this->Dot(b))/sqrt(div)); + return result; + } + + // Return Length of the vector squared. + T LengthSq() const { return (x * x + y * y); } + + // Return vector length. + T Length() const { return sqrt(LengthSq()); } + + // Returns squared distance between two points represented by vectors. + T DistanceSq(const Vector2& b) const { return (*this - b).LengthSq(); } + + // Returns distance between two points represented by vectors. + T Distance(const Vector2& b) const { return (*this - b).Length(); } + + // Determine if this a unit vector. + bool IsNormalized() const { return fabs(LengthSq() - T(1)) < Math::Tolerance(); } + + // Normalize, convention vector length to 1. + void Normalize() + { + T s = Length(); + if (s != T(0)) + s = T(1) / s; + *this *= s; + } + + // Returns normalized (unit) version of the vector without modifying itself. + Vector2 Normalized() const + { + T s = Length(); + if (s != T(0)) + s = T(1) / s; + return *this * s; + } + + // Linearly interpolates from this vector to another. + // Factor should be between 0.0 and 1.0, with 0 giving full value to this. + Vector2 Lerp(const Vector2& b, T f) const { return *this*(T(1) - f) + b*f; } + + // Projects this vector onto the argument; in other words, + // A.Project(B) returns projection of vector A onto B. + Vector2 ProjectTo(const Vector2& b) const + { + T l2 = b.LengthSq(); + OVR_MATH_ASSERT(l2 != T(0)); + return b * ( Dot(b) / l2 ); + } + + // returns true if vector b is clockwise from this vector + bool IsClockwise(const Vector2& b) const + { + return (x * b.y - y * b.x) < 0; + } +}; + + +typedef Vector2 Vector2f; +typedef Vector2 Vector2d; +typedef Vector2 Vector2i; + +typedef Vector2 Point2f; +typedef Vector2 Point2d; +typedef Vector2 Point2i; + +//------------------------------------------------------------------------------------- +// ***** Vector3<> - 3D vector of {x, y, z} + +// +// Vector3f (Vector3d) represents a 3-dimensional vector or point in space, +// consisting of coordinates x, y and z. + +template +class Vector3 +{ +public: + typedef T ElementType; + static const size_t ElementCount = 3; + + T x, y, z; + + // FIXME: default initialization of a vector class can be very expensive in a full-blown + // application. A few hundred thousand vector constructions is not unlikely and can add + // up to milliseconds of time on processors like the PS3 PPU. + Vector3() : x(0), y(0), z(0) { } + Vector3(T x_, T y_, T z_ = 0) : x(x_), y(y_), z(z_) { } + explicit Vector3(T s) : x(s), y(s), z(s) { } + explicit Vector3(const Vector3::OtherFloatType> &src) + : x((T)src.x), y((T)src.y), z((T)src.z) { } + + static Vector3 Zero() { return Vector3(0, 0, 0); } + + // C-interop support. + typedef typename CompatibleTypes >::Type CompatibleType; + + Vector3(const CompatibleType& s) : x(s.x), y(s.y), z(s.z) { } + + operator const CompatibleType& () const + { + OVR_MATH_STATIC_ASSERT(sizeof(Vector3) == sizeof(CompatibleType), "sizeof(Vector3) failure"); + return reinterpret_cast(*this); + } + + bool operator== (const Vector3& b) const { return x == b.x && y == b.y && z == b.z; } + bool operator!= (const Vector3& b) const { return x != b.x || y != b.y || z != b.z; } + + Vector3 operator+ (const Vector3& b) const { return Vector3(x + b.x, y + b.y, z + b.z); } + Vector3& operator+= (const Vector3& b) { x += b.x; y += b.y; z += b.z; return *this; } + Vector3 operator- (const Vector3& b) const { return Vector3(x - b.x, y - b.y, z - b.z); } + Vector3& operator-= (const Vector3& b) { x -= b.x; y -= b.y; z -= b.z; return *this; } + Vector3 operator- () const { return Vector3(-x, -y, -z); } + + // Scalar multiplication/division scales vector. + Vector3 operator* (T s) const { return Vector3(x*s, y*s, z*s); } + Vector3& operator*= (T s) { x *= s; y *= s; z *= s; return *this; } + + Vector3 operator/ (T s) const { T rcp = T(1)/s; + return Vector3(x*rcp, y*rcp, z*rcp); } + Vector3& operator/= (T s) { T rcp = T(1)/s; + x *= rcp; y *= rcp; z *= rcp; + return *this; } + + static Vector3 Min(const Vector3& a, const Vector3& b) + { + return Vector3((a.x < b.x) ? a.x : b.x, + (a.y < b.y) ? a.y : b.y, + (a.z < b.z) ? a.z : b.z); + } + static Vector3 Max(const Vector3& a, const Vector3& b) + { + return Vector3((a.x > b.x) ? a.x : b.x, + (a.y > b.y) ? a.y : b.y, + (a.z > b.z) ? a.z : b.z); + } + + Vector3 Clamped(T maxMag) const + { + T magSquared = LengthSq(); + if (magSquared <= Sqr(maxMag)) + return *this; + else + return *this * (maxMag / sqrt(magSquared)); + } + + // Compare two vectors for equality with tolerance. Returns true if vectors match withing tolerance. + bool IsEqual(const Vector3& b, T tolerance = Math::Tolerance()) const + { + return (fabs(b.x-x) <= tolerance) && + (fabs(b.y-y) <= tolerance) && + (fabs(b.z-z) <= tolerance); + } + bool Compare(const Vector3& b, T tolerance = Math::Tolerance()) const + { + return IsEqual(b, tolerance); + } + + T& operator[] (int idx) + { + OVR_MATH_ASSERT(0 <= idx && idx < 3); + return *(&x + idx); + } + + const T& operator[] (int idx) const + { + OVR_MATH_ASSERT(0 <= idx && idx < 3); + return *(&x + idx); + } + + // Entrywise product of two vectors + Vector3 EntrywiseMultiply(const Vector3& b) const { return Vector3(x * b.x, + y * b.y, + z * b.z);} + + // Multiply and divide operators do entry-wise math + Vector3 operator* (const Vector3& b) const { return Vector3(x * b.x, + y * b.y, + z * b.z); } + + Vector3 operator/ (const Vector3& b) const { return Vector3(x / b.x, + y / b.y, + z / b.z); } + + + // Dot product + // Used to calculate angle q between two vectors among other things, + // as (A dot B) = |a||b|cos(q). + T Dot(const Vector3& b) const { return x*b.x + y*b.y + z*b.z; } + + // Compute cross product, which generates a normal vector. + // Direction vector can be determined by right-hand rule: Pointing index finder in + // direction a and middle finger in direction b, thumb will point in a.Cross(b). + Vector3 Cross(const Vector3& b) const { return Vector3(y*b.z - z*b.y, + z*b.x - x*b.z, + x*b.y - y*b.x); } + + // Returns the angle from this vector to b, in radians. + T Angle(const Vector3& b) const + { + T div = LengthSq()*b.LengthSq(); + OVR_MATH_ASSERT(div != T(0)); + T result = Acos((this->Dot(b))/sqrt(div)); + return result; + } + + // Return Length of the vector squared. + T LengthSq() const { return (x * x + y * y + z * z); } + + // Return vector length. + T Length() const { return sqrt(LengthSq()); } + + // Returns squared distance between two points represented by vectors. + T DistanceSq(Vector3 const& b) const { return (*this - b).LengthSq(); } + + // Returns distance between two points represented by vectors. + T Distance(Vector3 const& b) const { return (*this - b).Length(); } + + bool IsNormalized() const { return fabs(LengthSq() - T(1)) < Math::Tolerance(); } + + // Normalize, convention vector length to 1. + void Normalize() + { + T s = Length(); + if (s != T(0)) + s = T(1) / s; + *this *= s; + } + + // Returns normalized (unit) version of the vector without modifying itself. + Vector3 Normalized() const + { + T s = Length(); + if (s != T(0)) + s = T(1) / s; + return *this * s; + } + + // Linearly interpolates from this vector to another. + // Factor should be between 0.0 and 1.0, with 0 giving full value to this. + Vector3 Lerp(const Vector3& b, T f) const { return *this*(T(1) - f) + b*f; } + + // Projects this vector onto the argument; in other words, + // A.Project(B) returns projection of vector A onto B. + Vector3 ProjectTo(const Vector3& b) const + { + T l2 = b.LengthSq(); + OVR_MATH_ASSERT(l2 != T(0)); + return b * ( Dot(b) / l2 ); + } + + // Projects this vector onto a plane defined by a normal vector + Vector3 ProjectToPlane(const Vector3& normal) const { return *this - this->ProjectTo(normal); } +}; + +typedef Vector3 Vector3f; +typedef Vector3 Vector3d; +typedef Vector3 Vector3i; + +OVR_MATH_STATIC_ASSERT((sizeof(Vector3f) == 3*sizeof(float)), "sizeof(Vector3f) failure"); +OVR_MATH_STATIC_ASSERT((sizeof(Vector3d) == 3*sizeof(double)), "sizeof(Vector3d) failure"); +OVR_MATH_STATIC_ASSERT((sizeof(Vector3i) == 3*sizeof(int32_t)), "sizeof(Vector3i) failure"); + +typedef Vector3 Point3f; +typedef Vector3 Point3d; +typedef Vector3 Point3i; + + +//------------------------------------------------------------------------------------- +// ***** Vector4<> - 4D vector of {x, y, z, w} + +// +// Vector4f (Vector4d) represents a 3-dimensional vector or point in space, +// consisting of coordinates x, y, z and w. + +template +class Vector4 +{ +public: + typedef T ElementType; + static const size_t ElementCount = 4; + + T x, y, z, w; + + // FIXME: default initialization of a vector class can be very expensive in a full-blown + // application. A few hundred thousand vector constructions is not unlikely and can add + // up to milliseconds of time on processors like the PS3 PPU. + Vector4() : x(0), y(0), z(0), w(0) { } + Vector4(T x_, T y_, T z_, T w_) : x(x_), y(y_), z(z_), w(w_) { } + explicit Vector4(T s) : x(s), y(s), z(s), w(s) { } + explicit Vector4(const Vector3& v, const T w_=T(1)) : x(v.x), y(v.y), z(v.z), w(w_) { } + explicit Vector4(const Vector4::OtherFloatType> &src) + : x((T)src.x), y((T)src.y), z((T)src.z), w((T)src.w) { } + + static Vector4 Zero() { return Vector4(0, 0, 0, 0); } + + // C-interop support. + typedef typename CompatibleTypes< Vector4 >::Type CompatibleType; + + Vector4(const CompatibleType& s) : x(s.x), y(s.y), z(s.z), w(s.w) { } + + operator const CompatibleType& () const + { + OVR_MATH_STATIC_ASSERT(sizeof(Vector4) == sizeof(CompatibleType), "sizeof(Vector4) failure"); + return reinterpret_cast(*this); + } + + Vector4& operator= (const Vector3& other) { x=other.x; y=other.y; z=other.z; w=1; return *this; } + bool operator== (const Vector4& b) const { return x == b.x && y == b.y && z == b.z && w == b.w; } + bool operator!= (const Vector4& b) const { return x != b.x || y != b.y || z != b.z || w != b.w; } + + Vector4 operator+ (const Vector4& b) const { return Vector4(x + b.x, y + b.y, z + b.z, w + b.w); } + Vector4& operator+= (const Vector4& b) { x += b.x; y += b.y; z += b.z; w += b.w; return *this; } + Vector4 operator- (const Vector4& b) const { return Vector4(x - b.x, y - b.y, z - b.z, w - b.w); } + Vector4& operator-= (const Vector4& b) { x -= b.x; y -= b.y; z -= b.z; w -= b.w; return *this; } + Vector4 operator- () const { return Vector4(-x, -y, -z, -w); } + + // Scalar multiplication/division scales vector. + Vector4 operator* (T s) const { return Vector4(x*s, y*s, z*s, w*s); } + Vector4& operator*= (T s) { x *= s; y *= s; z *= s; w *= s;return *this; } + + Vector4 operator/ (T s) const { T rcp = T(1)/s; + return Vector4(x*rcp, y*rcp, z*rcp, w*rcp); } + Vector4& operator/= (T s) { T rcp = T(1)/s; + x *= rcp; y *= rcp; z *= rcp; w *= rcp; + return *this; } + + static Vector4 Min(const Vector4& a, const Vector4& b) + { + return Vector4((a.x < b.x) ? a.x : b.x, + (a.y < b.y) ? a.y : b.y, + (a.z < b.z) ? a.z : b.z, + (a.w < b.w) ? a.w : b.w); + } + static Vector4 Max(const Vector4& a, const Vector4& b) + { + return Vector4((a.x > b.x) ? a.x : b.x, + (a.y > b.y) ? a.y : b.y, + (a.z > b.z) ? a.z : b.z, + (a.w > b.w) ? a.w : b.w); + } + + Vector4 Clamped(T maxMag) const + { + T magSquared = LengthSq(); + if (magSquared <= Sqr(maxMag)) + return *this; + else + return *this * (maxMag / sqrt(magSquared)); + } + + // Compare two vectors for equality with tolerance. Returns true if vectors match withing tolerance. + bool IsEqual(const Vector4& b, T tolerance = Math::Tolerance()) const + { + return (fabs(b.x-x) <= tolerance) && + (fabs(b.y-y) <= tolerance) && + (fabs(b.z-z) <= tolerance) && + (fabs(b.w-w) <= tolerance); + } + bool Compare(const Vector4& b, T tolerance = Math::Tolerance()) const + { + return IsEqual(b, tolerance); + } + + T& operator[] (int idx) + { + OVR_MATH_ASSERT(0 <= idx && idx < 4); + return *(&x + idx); + } + + const T& operator[] (int idx) const + { + OVR_MATH_ASSERT(0 <= idx && idx < 4); + return *(&x + idx); + } + + // Entry wise product of two vectors + Vector4 EntrywiseMultiply(const Vector4& b) const { return Vector4(x * b.x, + y * b.y, + z * b.z, + w * b.w);} + + // Multiply and divide operators do entry-wise math + Vector4 operator* (const Vector4& b) const { return Vector4(x * b.x, + y * b.y, + z * b.z, + w * b.w); } + + Vector4 operator/ (const Vector4& b) const { return Vector4(x / b.x, + y / b.y, + z / b.z, + w / b.w); } + + + // Dot product + T Dot(const Vector4& b) const { return x*b.x + y*b.y + z*b.z + w*b.w; } + + // Return Length of the vector squared. + T LengthSq() const { return (x * x + y * y + z * z + w * w); } + + // Return vector length. + T Length() const { return sqrt(LengthSq()); } + + bool IsNormalized() const { return fabs(LengthSq() - T(1)) < Math::Tolerance(); } + + // Normalize, convention vector length to 1. + void Normalize() + { + T s = Length(); + if (s != T(0)) + s = T(1) / s; + *this *= s; + } + + // Returns normalized (unit) version of the vector without modifying itself. + Vector4 Normalized() const + { + T s = Length(); + if (s != T(0)) + s = T(1) / s; + return *this * s; + } + + // Linearly interpolates from this vector to another. + // Factor should be between 0.0 and 1.0, with 0 giving full value to this. + Vector4 Lerp(const Vector4& b, T f) const { return *this*(T(1) - f) + b*f; } +}; + +typedef Vector4 Vector4f; +typedef Vector4 Vector4d; +typedef Vector4 Vector4i; + + +//------------------------------------------------------------------------------------- +// ***** Bounds3 + +// Bounds class used to describe a 3D axis aligned bounding box. + +template +class Bounds3 +{ +public: + Vector3 b[2]; + + Bounds3() + { + } + + Bounds3( const Vector3 & mins, const Vector3 & maxs ) +{ + b[0] = mins; + b[1] = maxs; + } + + void Clear() + { + b[0].x = b[0].y = b[0].z = Math::MaxValue; + b[1].x = b[1].y = b[1].z = -Math::MaxValue; + } + + void AddPoint( const Vector3 & v ) + { + b[0].x = (b[0].x < v.x ? b[0].x : v.x); + b[0].y = (b[0].y < v.y ? b[0].y : v.y); + b[0].z = (b[0].z < v.z ? b[0].z : v.z); + b[1].x = (v.x < b[1].x ? b[1].x : v.x); + b[1].y = (v.y < b[1].y ? b[1].y : v.y); + b[1].z = (v.z < b[1].z ? b[1].z : v.z); + } + + const Vector3 & GetMins() const { return b[0]; } + const Vector3 & GetMaxs() const { return b[1]; } + + Vector3 & GetMins() { return b[0]; } + Vector3 & GetMaxs() { return b[1]; } +}; + +typedef Bounds3 Bounds3f; +typedef Bounds3 Bounds3d; + + +//------------------------------------------------------------------------------------- +// ***** Size + +// Size class represents 2D size with Width, Height components. +// Used to describe distentions of render targets, etc. + +template +class Size +{ +public: + T w, h; + + Size() : w(0), h(0) { } + Size(T w_, T h_) : w(w_), h(h_) { } + explicit Size(T s) : w(s), h(s) { } + explicit Size(const Size::OtherFloatType> &src) + : w((T)src.w), h((T)src.h) { } + + // C-interop support. + typedef typename CompatibleTypes >::Type CompatibleType; + + Size(const CompatibleType& s) : w(s.w), h(s.h) { } + + operator const CompatibleType& () const + { + OVR_MATH_STATIC_ASSERT(sizeof(Size) == sizeof(CompatibleType), "sizeof(Size) failure"); + return reinterpret_cast(*this); + } + + bool operator== (const Size& b) const { return w == b.w && h == b.h; } + bool operator!= (const Size& b) const { return w != b.w || h != b.h; } + + Size operator+ (const Size& b) const { return Size(w + b.w, h + b.h); } + Size& operator+= (const Size& b) { w += b.w; h += b.h; return *this; } + Size operator- (const Size& b) const { return Size(w - b.w, h - b.h); } + Size& operator-= (const Size& b) { w -= b.w; h -= b.h; return *this; } + Size operator- () const { return Size(-w, -h); } + Size operator* (const Size& b) const { return Size(w * b.w, h * b.h); } + Size& operator*= (const Size& b) { w *= b.w; h *= b.h; return *this; } + Size operator/ (const Size& b) const { return Size(w / b.w, h / b.h); } + Size& operator/= (const Size& b) { w /= b.w; h /= b.h; return *this; } + + // Scalar multiplication/division scales both components. + Size operator* (T s) const { return Size(w*s, h*s); } + Size& operator*= (T s) { w *= s; h *= s; return *this; } + Size operator/ (T s) const { return Size(w/s, h/s); } + Size& operator/= (T s) { w /= s; h /= s; return *this; } + + static Size Min(const Size& a, const Size& b) { return Size((a.w < b.w) ? a.w : b.w, + (a.h < b.h) ? a.h : b.h); } + static Size Max(const Size& a, const Size& b) { return Size((a.w > b.w) ? a.w : b.w, + (a.h > b.h) ? a.h : b.h); } + + T Area() const { return w * h; } + + inline Vector2 ToVector() const { return Vector2(w, h); } +}; + + +typedef Size Sizei; +typedef Size Sizeu; +typedef Size Sizef; +typedef Size Sized; + + + +//----------------------------------------------------------------------------------- +// ***** Rect + +// Rect describes a rectangular area for rendering, that includes position and size. +template +class Rect +{ +public: + T x, y; + T w, h; + + Rect() { } + Rect(T x1, T y1, T w1, T h1) : x(x1), y(y1), w(w1), h(h1) { } + Rect(const Vector2& pos, const Size& sz) : x(pos.x), y(pos.y), w(sz.w), h(sz.h) { } + Rect(const Size& sz) : x(0), y(0), w(sz.w), h(sz.h) { } + + // C-interop support. + typedef typename CompatibleTypes >::Type CompatibleType; + + Rect(const CompatibleType& s) : x(s.Pos.x), y(s.Pos.y), w(s.Size.w), h(s.Size.h) { } + + operator const CompatibleType& () const + { + OVR_MATH_STATIC_ASSERT(sizeof(Rect) == sizeof(CompatibleType), "sizeof(Rect) failure"); + return reinterpret_cast(*this); + } + + Vector2 GetPos() const { return Vector2(x, y); } + Size GetSize() const { return Size(w, h); } + void SetPos(const Vector2& pos) { x = pos.x; y = pos.y; } + void SetSize(const Size& sz) { w = sz.w; h = sz.h; } + + bool operator == (const Rect& vp) const + { return (x == vp.x) && (y == vp.y) && (w == vp.w) && (h == vp.h); } + bool operator != (const Rect& vp) const + { return !operator == (vp); } +}; + +typedef Rect Recti; + + +//-------------------------------------------------------------------------------------// +// ***** Quat +// +// Quatf represents a quaternion class used for rotations. +// +// Quaternion multiplications are done in right-to-left order, to match the +// behavior of matrices. + + +template +class Quat +{ +public: + typedef T ElementType; + static const size_t ElementCount = 4; + + // x,y,z = axis*sin(angle), w = cos(angle) + T x, y, z, w; + + Quat() : x(0), y(0), z(0), w(1) { } + Quat(T x_, T y_, T z_, T w_) : x(x_), y(y_), z(z_), w(w_) { } + explicit Quat(const Quat::OtherFloatType> &src) + : x((T)src.x), y((T)src.y), z((T)src.z), w((T)src.w) + { + // NOTE: Converting a normalized Quat to Quat + // will generally result in an un-normalized quaternion. + // But we don't normalize here in case the quaternion + // being converted is not a normalized rotation quaternion. + } + + typedef typename CompatibleTypes >::Type CompatibleType; + + // C-interop support. + Quat(const CompatibleType& s) : x(s.x), y(s.y), z(s.z), w(s.w) { } + + operator CompatibleType () const + { + CompatibleType result; + result.x = x; + result.y = y; + result.z = z; + result.w = w; + return result; + } + + // Constructs quaternion for rotation around the axis by an angle. + Quat(const Vector3& axis, T angle) + { + // Make sure we don't divide by zero. + if (axis.LengthSq() == T(0)) + { + // Assert if the axis is zero, but the angle isn't + OVR_MATH_ASSERT(angle == T(0)); + x = y = z = T(0); w = T(1); + return; + } + + Vector3 unitAxis = axis.Normalized(); + T sinHalfAngle = sin(angle * T(0.5)); + + w = cos(angle * T(0.5)); + x = unitAxis.x * sinHalfAngle; + y = unitAxis.y * sinHalfAngle; + z = unitAxis.z * sinHalfAngle; + } + + // Constructs quaternion for rotation around one of the coordinate axis by an angle. + Quat(Axis A, T angle, RotateDirection d = Rotate_CCW, HandedSystem s = Handed_R) + { + T sinHalfAngle = s * d *sin(angle * T(0.5)); + T v[3]; + v[0] = v[1] = v[2] = T(0); + v[A] = sinHalfAngle; + + w = cos(angle * T(0.5)); + x = v[0]; + y = v[1]; + z = v[2]; + } + + Quat operator-() { return Quat(-x, -y, -z, -w); } // unary minus + + static Quat Identity() { return Quat(0, 0, 0, 1); } + + // Compute axis and angle from quaternion + void GetAxisAngle(Vector3* axis, T* angle) const + { + if ( x*x + y*y + z*z > Math::Tolerance() * Math::Tolerance() ) { + *axis = Vector3(x, y, z).Normalized(); + *angle = 2 * Acos(w); + if (*angle > ((T)MATH_DOUBLE_PI)) // Reduce the magnitude of the angle, if necessary + { + *angle = ((T)MATH_DOUBLE_TWOPI) - *angle; + *axis = *axis * (-1); + } + } + else + { + *axis = Vector3(1, 0, 0); + *angle= T(0); + } + } + + // Convert a quaternion to a rotation vector, also known as + // Rodrigues vector, AxisAngle vector, SORA vector, exponential map. + // A rotation vector describes a rotation about an axis: + // the axis of rotation is the vector normalized, + // the angle of rotation is the magnitude of the vector. + Vector3 ToRotationVector() const + { + OVR_MATH_ASSERT(IsNormalized() || LengthSq() == 0); + T s = T(0); + T sinHalfAngle = sqrt(x*x + y*y + z*z); + if (sinHalfAngle > T(0)) + { + T cosHalfAngle = w; + T halfAngle = atan2(sinHalfAngle, cosHalfAngle); + + // Ensure minimum rotation magnitude + if (cosHalfAngle < 0) + halfAngle -= T(MATH_DOUBLE_PI); + + s = T(2) * halfAngle / sinHalfAngle; + } + return Vector3(x*s, y*s, z*s); + } + + // Faster version of the above, optimized for use with small rotations, where rotation angle ~= sin(angle) + inline OVR::Vector3 FastToRotationVector() const + { + OVR_MATH_ASSERT(IsNormalized()); + T s; + T sinHalfSquared = x*x + y*y + z*z; + if (sinHalfSquared < T(.0037)) // =~ sin(7/2 degrees)^2 + { + // Max rotation magnitude error is about .062% at 7 degrees rotation, or about .0043 degrees + s = T(2) * Sign(w); + } + else + { + T sinHalfAngle = sqrt(sinHalfSquared); + T cosHalfAngle = w; + T halfAngle = atan2(sinHalfAngle, cosHalfAngle); + + // Ensure minimum rotation magnitude + if (cosHalfAngle < 0) + halfAngle -= T(MATH_DOUBLE_PI); + + s = T(2) * halfAngle / sinHalfAngle; + } + return Vector3(x*s, y*s, z*s); + } + + // Given a rotation vector of form unitRotationAxis * angle, + // returns the equivalent quaternion (unitRotationAxis * sin(angle), cos(Angle)). + static Quat FromRotationVector(const Vector3& v) + { + T angleSquared = v.LengthSq(); + T s = T(0); + T c = T(1); + if (angleSquared > T(0)) + { + T angle = sqrt(angleSquared); + s = sin(angle * T(0.5)) / angle; // normalize + c = cos(angle * T(0.5)); + } + return Quat(s*v.x, s*v.y, s*v.z, c); + } + + // Faster version of above, optimized for use with small rotation magnitudes, where rotation angle =~ sin(angle). + // If normalize is false, small-angle quaternions are returned un-normalized. + inline static Quat FastFromRotationVector(const OVR::Vector3& v, bool normalize = true) + { + T s, c; + T angleSquared = v.LengthSq(); + if (angleSquared < T(0.0076)) // =~ (5 degrees*pi/180)^2 + { + s = T(0.5); + c = T(1.0); + // Max rotation magnitude error (after normalization) is about .064% at 5 degrees rotation, or .0032 degrees + if (normalize && angleSquared > 0) + { + // sin(angle/2)^2 ~= (angle/2)^2 and cos(angle/2)^2 ~= 1 + T invLen = T(1) / sqrt(angleSquared * T(0.25) + T(1)); // normalize + s = s * invLen; + c = c * invLen; + } + } + else + { + T angle = sqrt(angleSquared); + s = sin(angle * T(0.5)) / angle; + c = cos(angle * T(0.5)); + } + return Quat(s*v.x, s*v.y, s*v.z, c); + } + + // Constructs the quaternion from a rotation matrix + explicit Quat(const Matrix4& m) + { + T trace = m.M[0][0] + m.M[1][1] + m.M[2][2]; + + // In almost all cases, the first part is executed. + // However, if the trace is not positive, the other + // cases arise. + if (trace > T(0)) + { + T s = sqrt(trace + T(1)) * T(2); // s=4*qw + w = T(0.25) * s; + x = (m.M[2][1] - m.M[1][2]) / s; + y = (m.M[0][2] - m.M[2][0]) / s; + z = (m.M[1][0] - m.M[0][1]) / s; + } + else if ((m.M[0][0] > m.M[1][1])&&(m.M[0][0] > m.M[2][2])) + { + T s = sqrt(T(1) + m.M[0][0] - m.M[1][1] - m.M[2][2]) * T(2); + w = (m.M[2][1] - m.M[1][2]) / s; + x = T(0.25) * s; + y = (m.M[0][1] + m.M[1][0]) / s; + z = (m.M[2][0] + m.M[0][2]) / s; + } + else if (m.M[1][1] > m.M[2][2]) + { + T s = sqrt(T(1) + m.M[1][1] - m.M[0][0] - m.M[2][2]) * T(2); // S=4*qy + w = (m.M[0][2] - m.M[2][0]) / s; + x = (m.M[0][1] + m.M[1][0]) / s; + y = T(0.25) * s; + z = (m.M[1][2] + m.M[2][1]) / s; + } + else + { + T s = sqrt(T(1) + m.M[2][2] - m.M[0][0] - m.M[1][1]) * T(2); // S=4*qz + w = (m.M[1][0] - m.M[0][1]) / s; + x = (m.M[0][2] + m.M[2][0]) / s; + y = (m.M[1][2] + m.M[2][1]) / s; + z = T(0.25) * s; + } + OVR_MATH_ASSERT(IsNormalized()); // Ensure input matrix is orthogonal + } + + // Constructs the quaternion from a rotation matrix + explicit Quat(const Matrix3& m) + { + T trace = m.M[0][0] + m.M[1][1] + m.M[2][2]; + + // In almost all cases, the first part is executed. + // However, if the trace is not positive, the other + // cases arise. + if (trace > T(0)) + { + T s = sqrt(trace + T(1)) * T(2); // s=4*qw + w = T(0.25) * s; + x = (m.M[2][1] - m.M[1][2]) / s; + y = (m.M[0][2] - m.M[2][0]) / s; + z = (m.M[1][0] - m.M[0][1]) / s; + } + else if ((m.M[0][0] > m.M[1][1])&&(m.M[0][0] > m.M[2][2])) + { + T s = sqrt(T(1) + m.M[0][0] - m.M[1][1] - m.M[2][2]) * T(2); + w = (m.M[2][1] - m.M[1][2]) / s; + x = T(0.25) * s; + y = (m.M[0][1] + m.M[1][0]) / s; + z = (m.M[2][0] + m.M[0][2]) / s; + } + else if (m.M[1][1] > m.M[2][2]) + { + T s = sqrt(T(1) + m.M[1][1] - m.M[0][0] - m.M[2][2]) * T(2); // S=4*qy + w = (m.M[0][2] - m.M[2][0]) / s; + x = (m.M[0][1] + m.M[1][0]) / s; + y = T(0.25) * s; + z = (m.M[1][2] + m.M[2][1]) / s; + } + else + { + T s = sqrt(T(1) + m.M[2][2] - m.M[0][0] - m.M[1][1]) * T(2); // S=4*qz + w = (m.M[1][0] - m.M[0][1]) / s; + x = (m.M[0][2] + m.M[2][0]) / s; + y = (m.M[1][2] + m.M[2][1]) / s; + z = T(0.25) * s; + } + OVR_MATH_ASSERT(IsNormalized()); // Ensure input matrix is orthogonal + } + + bool operator== (const Quat& b) const { return x == b.x && y == b.y && z == b.z && w == b.w; } + bool operator!= (const Quat& b) const { return x != b.x || y != b.y || z != b.z || w != b.w; } + + Quat operator+ (const Quat& b) const { return Quat(x + b.x, y + b.y, z + b.z, w + b.w); } + Quat& operator+= (const Quat& b) { w += b.w; x += b.x; y += b.y; z += b.z; return *this; } + Quat operator- (const Quat& b) const { return Quat(x - b.x, y - b.y, z - b.z, w - b.w); } + Quat& operator-= (const Quat& b) { w -= b.w; x -= b.x; y -= b.y; z -= b.z; return *this; } + + Quat operator* (T s) const { return Quat(x * s, y * s, z * s, w * s); } + Quat& operator*= (T s) { w *= s; x *= s; y *= s; z *= s; return *this; } + Quat operator/ (T s) const { T rcp = T(1)/s; return Quat(x * rcp, y * rcp, z * rcp, w *rcp); } + Quat& operator/= (T s) { T rcp = T(1)/s; w *= rcp; x *= rcp; y *= rcp; z *= rcp; return *this; } + + // Compare two quats for equality within tolerance. Returns true if quats match withing tolerance. + bool IsEqual(const Quat& b, T tolerance = Math::Tolerance()) const + { + return Abs(Dot(b)) >= T(1) - tolerance; + } + + static T Abs(const T v) { return (v >= 0) ? v : -v; } + + // Get Imaginary part vector + Vector3 Imag() const { return Vector3(x,y,z); } + + // Get quaternion length. + T Length() const { return sqrt(LengthSq()); } + + // Get quaternion length squared. + T LengthSq() const { return (x * x + y * y + z * z + w * w); } + + // Simple Euclidean distance in R^4 (not SLERP distance, but at least respects Haar measure) + T Distance(const Quat& q) const + { + T d1 = (*this - q).Length(); + T d2 = (*this + q).Length(); // Antipodal point check + return (d1 < d2) ? d1 : d2; + } + + T DistanceSq(const Quat& q) const + { + T d1 = (*this - q).LengthSq(); + T d2 = (*this + q).LengthSq(); // Antipodal point check + return (d1 < d2) ? d1 : d2; + } + + T Dot(const Quat& q) const + { + return x * q.x + y * q.y + z * q.z + w * q.w; + } + + // Angle between two quaternions in radians + T Angle(const Quat& q) const + { + return T(2) * Acos(Abs(Dot(q))); + } + + // Angle of quaternion + T Angle() const + { + return T(2) * Acos(Abs(w)); + } + + // Normalize + bool IsNormalized() const { return fabs(LengthSq() - T(1)) < Math::Tolerance(); } + + void Normalize() + { + T s = Length(); + if (s != T(0)) + s = T(1) / s; + *this *= s; + } + + Quat Normalized() const + { + T s = Length(); + if (s != T(0)) + s = T(1) / s; + return *this * s; + } + + inline void EnsureSameHemisphere(const Quat& o) + { + if (Dot(o) < T(0)) + { + x = -x; + y = -y; + z = -z; + w = -w; + } + } + + // Returns conjugate of the quaternion. Produces inverse rotation if quaternion is normalized. + Quat Conj() const { return Quat(-x, -y, -z, w); } + + // Quaternion multiplication. Combines quaternion rotations, performing the one on the + // right hand side first. + Quat operator* (const Quat& b) const { return Quat(w * b.x + x * b.w + y * b.z - z * b.y, + w * b.y - x * b.z + y * b.w + z * b.x, + w * b.z + x * b.y - y * b.x + z * b.w, + w * b.w - x * b.x - y * b.y - z * b.z); } + const Quat& operator*= (const Quat& b) { *this = *this * b; return *this; } + + // + // this^p normalized; same as rotating by this p times. + Quat PowNormalized(T p) const + { + Vector3 v; + T a; + GetAxisAngle(&v, &a); + return Quat(v, a * p); + } + + // Compute quaternion that rotates v into alignTo: alignTo = Quat::Align(alignTo, v).Rotate(v). + // NOTE: alignTo and v must be normalized. + static Quat Align(const Vector3& alignTo, const Vector3& v) + { + OVR_MATH_ASSERT(alignTo.IsNormalized() && v.IsNormalized()); + Vector3 bisector = (v + alignTo); + bisector.Normalize(); + T cosHalfAngle = v.Dot(bisector); // 0..1 + if (cosHalfAngle > T(0)) + { + Vector3 imag = v.Cross(bisector); + return Quat(imag.x, imag.y, imag.z, cosHalfAngle); + } + else + { + // cosHalfAngle == 0: a 180 degree rotation. + // sinHalfAngle == 1, rotation axis is any axis perpendicular + // to alignTo. Choose axis to include largest magnitude components + if (fabs(v.x) > fabs(v.y)) + { + // x or z is max magnitude component + // = Cross(v, (0,1,0)).Normalized(); + T invLen = sqrt(v.x*v.x + v.z*v.z); + if (invLen > T(0)) + invLen = T(1) / invLen; + return Quat(-v.z*invLen, 0, v.x*invLen, 0); + } + else + { + // y or z is max magnitude component + // = Cross(v, (1,0,0)).Normalized(); + T invLen = sqrt(v.y*v.y + v.z*v.z); + if (invLen > T(0)) + invLen = T(1) / invLen; + return Quat(0, v.z*invLen, -v.y*invLen, 0); + } + } + } + + // Normalized linear interpolation of quaternions + // NOTE: This function is a bad approximation of Slerp() + // when the angle between the *this and b is large. + // Use FastSlerp() or Slerp() instead. + Quat Lerp(const Quat& b, T s) const + { + return (*this * (T(1) - s) + b * (Dot(b) < 0 ? -s : s)).Normalized(); + } + + // Spherical linear interpolation between rotations + Quat Slerp(const Quat& b, T s) const + { + Vector3 delta = (b * this->Inverted()).ToRotationVector(); + return FromRotationVector(delta * s) * *this; + } + + // Spherical linear interpolation: much faster for small rotations, accurate for large rotations. See FastTo/FromRotationVector + Quat FastSlerp(const Quat& b, T s) const + { + Vector3 delta = (b * this->Inverted()).FastToRotationVector(); + return (FastFromRotationVector(delta * s, false) * *this).Normalized(); + } + + // Rotate transforms vector in a manner that matches Matrix rotations (counter-clockwise, + // assuming negative direction of the axis). Standard formula: q(t) * V * q(t)^-1. + Vector3 Rotate(const Vector3& v) const + { + OVR_MATH_ASSERT(IsNormalized()); + + // rv = q * (v,0) * q' + // Same as rv = v + real * cross(imag,v)*2 + cross(imag, cross(imag,v)*2); + + // uv = 2 * Imag().Cross(v); + T uvx = T(2) * (y*v.z - z*v.y); + T uvy = T(2) * (z*v.x - x*v.z); + T uvz = T(2) * (x*v.y - y*v.x); + + // return v + Real()*uv + Imag().Cross(uv); + return Vector3(v.x + w*uvx + y*uvz - z*uvy, + v.y + w*uvy + z*uvx - x*uvz, + v.z + w*uvz + x*uvy - y*uvx); + } + + // Rotation by inverse of *this + Vector3 InverseRotate(const Vector3& v) const + { + OVR_MATH_ASSERT(IsNormalized()); + + // rv = q' * (v,0) * q + // Same as rv = v + real * cross(-imag,v)*2 + cross(-imag, cross(-imag,v)*2); + // or rv = v - real * cross(imag,v)*2 + cross(imag, cross(imag,v)*2); + + // uv = 2 * Imag().Cross(v); + T uvx = T(2) * (y*v.z - z*v.y); + T uvy = T(2) * (z*v.x - x*v.z); + T uvz = T(2) * (x*v.y - y*v.x); + + // return v - Real()*uv + Imag().Cross(uv); + return Vector3(v.x - w*uvx + y*uvz - z*uvy, + v.y - w*uvy + z*uvx - x*uvz, + v.z - w*uvz + x*uvy - y*uvx); + } + + // Inversed quaternion rotates in the opposite direction. + Quat Inverted() const + { + return Quat(-x, -y, -z, w); + } + + Quat Inverse() const + { + return Quat(-x, -y, -z, w); + } + + // Sets this quaternion to the one rotates in the opposite direction. + void Invert() + { + *this = Quat(-x, -y, -z, w); + } + + // Time integration of constant angular velocity over dt + Quat TimeIntegrate(Vector3 angularVelocity, T dt) const + { + // solution is: this * exp( omega*dt/2 ); FromRotationVector(v) gives exp(v*.5). + return (*this * FastFromRotationVector(angularVelocity * dt, false)).Normalized(); + } + + // Time integration of constant angular acceleration and velocity over dt + // These are the first two terms of the "Magnus expansion" of the solution + // + // o = o * exp( W=(W1 + W2 + W3+...) * 0.5 ); + // + // omega1 = (omega + omegaDot*dt) + // W1 = (omega + omega1)*dt/2 + // W2 = cross(omega, omega1)/12*dt^2 % (= -cross(omega_dot, omega)/12*dt^3) + // Terms 3 and beyond are vanishingly small: + // W3 = cross(omega_dot, cross(omega_dot, omega))/240*dt^5 + // + Quat TimeIntegrate(Vector3 angularVelocity, Vector3 angularAcceleration, T dt) const + { + const Vector3& omega = angularVelocity; + const Vector3& omegaDot = angularAcceleration; + + Vector3 omega1 = (omega + omegaDot * dt); + Vector3 W = ( (omega + omega1) + omega.Cross(omega1) * (dt/T(6)) ) * (dt/T(2)); + + // FromRotationVector(v) is exp(v*.5) + return (*this * FastFromRotationVector(W, false)).Normalized(); + } + + // Decompose rotation into three rotations: + // roll radians about Z axis, then pitch radians about X axis, then yaw radians about Y axis. + // Call with nullptr if a return value is not needed. + void GetYawPitchRoll(T* yaw, T* pitch, T* roll) const + { + return GetEulerAngles(yaw, pitch, roll); + } + + // GetEulerAngles extracts Euler angles from the quaternion, in the specified order of + // axis rotations and the specified coordinate system. Right-handed coordinate system + // is the default, with CCW rotations while looking in the negative axis direction. + // Here a,b,c, are the Yaw/Pitch/Roll angles to be returned. + // Rotation order is c, b, a: + // rotation c around axis A3 + // is followed by rotation b around axis A2 + // is followed by rotation a around axis A1 + // rotations are CCW or CW (D) in LH or RH coordinate system (S) + // + template + void GetEulerAngles(T *a, T *b, T *c) const + { + OVR_MATH_ASSERT(IsNormalized()); + OVR_MATH_STATIC_ASSERT((A1 != A2) && (A2 != A3) && (A1 != A3), "(A1 != A2) && (A2 != A3) && (A1 != A3)"); + + T Q[3] = { x, y, z }; //Quaternion components x,y,z + + T ww = w*w; + T Q11 = Q[A1]*Q[A1]; + T Q22 = Q[A2]*Q[A2]; + T Q33 = Q[A3]*Q[A3]; + + T psign = T(-1); + // Determine whether even permutation + if (((A1 + 1) % 3 == A2) && ((A2 + 1) % 3 == A3)) + psign = T(1); + + T s2 = psign * T(2) * (psign*w*Q[A2] + Q[A1]*Q[A3]); + + T singularityRadius = Math::SingularityRadius(); + if (s2 < T(-1) + singularityRadius) + { // South pole singularity + if (a) *a = T(0); + if (b) *b = -S*D*((T)MATH_DOUBLE_PIOVER2); + if (c) *c = S*D*atan2(T(2)*(psign*Q[A1] * Q[A2] + w*Q[A3]), ww + Q22 - Q11 - Q33 ); + } + else if (s2 > T(1) - singularityRadius) + { // North pole singularity + if (a) *a = T(0); + if (b) *b = S*D*((T)MATH_DOUBLE_PIOVER2); + if (c) *c = S*D*atan2(T(2)*(psign*Q[A1] * Q[A2] + w*Q[A3]), ww + Q22 - Q11 - Q33); + } + else + { + if (a) *a = -S*D*atan2(T(-2)*(w*Q[A1] - psign*Q[A2] * Q[A3]), ww + Q33 - Q11 - Q22); + if (b) *b = S*D*asin(s2); + if (c) *c = S*D*atan2(T(2)*(w*Q[A3] - psign*Q[A1] * Q[A2]), ww + Q11 - Q22 - Q33); + } + } + + template + void GetEulerAngles(T *a, T *b, T *c) const + { GetEulerAngles(a, b, c); } + + template + void GetEulerAngles(T *a, T *b, T *c) const + { GetEulerAngles(a, b, c); } + + // GetEulerAnglesABA extracts Euler angles from the quaternion, in the specified order of + // axis rotations and the specified coordinate system. Right-handed coordinate system + // is the default, with CCW rotations while looking in the negative axis direction. + // Here a,b,c, are the Yaw/Pitch/Roll angles to be returned. + // rotation a around axis A1 + // is followed by rotation b around axis A2 + // is followed by rotation c around axis A1 + // Rotations are CCW or CW (D) in LH or RH coordinate system (S) + template + void GetEulerAnglesABA(T *a, T *b, T *c) const + { + OVR_MATH_ASSERT(IsNormalized()); + OVR_MATH_STATIC_ASSERT(A1 != A2, "A1 != A2"); + + T Q[3] = {x, y, z}; // Quaternion components + + // Determine the missing axis that was not supplied + int m = 3 - A1 - A2; + + T ww = w*w; + T Q11 = Q[A1]*Q[A1]; + T Q22 = Q[A2]*Q[A2]; + T Qmm = Q[m]*Q[m]; + + T psign = T(-1); + if ((A1 + 1) % 3 == A2) // Determine whether even permutation + { + psign = T(1); + } + + T c2 = ww + Q11 - Q22 - Qmm; + T singularityRadius = Math::SingularityRadius(); + if (c2 < T(-1) + singularityRadius) + { // South pole singularity + if (a) *a = T(0); + if (b) *b = S*D*((T)MATH_DOUBLE_PI); + if (c) *c = S*D*atan2(T(2)*(w*Q[A1] - psign*Q[A2] * Q[m]), + ww + Q22 - Q11 - Qmm); + } + else if (c2 > T(1) - singularityRadius) + { // North pole singularity + if (a) *a = T(0); + if (b) *b = T(0); + if (c) *c = S*D*atan2(T(2)*(w*Q[A1] - psign*Q[A2] * Q[m]), + ww + Q22 - Q11 - Qmm); + } + else + { + if (a) *a = S*D*atan2(psign*w*Q[m] + Q[A1] * Q[A2], + w*Q[A2] -psign*Q[A1]*Q[m]); + if (b) *b = S*D*acos(c2); + if (c) *c = S*D*atan2(-psign*w*Q[m] + Q[A1] * Q[A2], + w*Q[A2] + psign*Q[A1]*Q[m]); + } + } +}; + +typedef Quat Quatf; +typedef Quat Quatd; + +OVR_MATH_STATIC_ASSERT((sizeof(Quatf) == 4*sizeof(float)), "sizeof(Quatf) failure"); +OVR_MATH_STATIC_ASSERT((sizeof(Quatd) == 4*sizeof(double)), "sizeof(Quatd) failure"); + +//------------------------------------------------------------------------------------- +// ***** Pose +// +// Position and orientation combined. +// +// This structure needs to be the same size and layout on 32-bit and 64-bit arch. +// Update OVR_PadCheck.cpp when updating this object. +template +class Pose +{ +public: + typedef typename CompatibleTypes >::Type CompatibleType; + + Pose() { } + Pose(const Quat& orientation, const Vector3& pos) + : Rotation(orientation), Translation(pos) { } + Pose(const Pose& s) + : Rotation(s.Rotation), Translation(s.Translation) { } + Pose(const Matrix3& R, const Vector3& t) + : Rotation((Quat)R), Translation(t) { } + Pose(const CompatibleType& s) + : Rotation(s.Orientation), Translation(s.Position) { } + + explicit Pose(const Pose::OtherFloatType> &s) + : Rotation(s.Rotation), Translation(s.Translation) + { + // Ensure normalized rotation if converting from float to double + if (sizeof(T) > sizeof(Math::OtherFloatType)) + Rotation.Normalize(); + } + + static Pose Identity() { return Pose(Quat(0, 0, 0, 1), Vector3(0, 0, 0)); } + + void SetIdentity() { Rotation = Quat(0, 0, 0, 1); Translation = Vector3(0, 0, 0); } + + // used to make things obviously broken if someone tries to use the value + void SetInvalid() { Rotation = Quat(NAN, NAN, NAN, NAN); Translation = Vector3(NAN, NAN, NAN); } + + bool IsEqual(const Pose&b, T tolerance = Math::Tolerance()) const + { + return Translation.IsEqual(b.Translation, tolerance) && Rotation.IsEqual(b.Rotation, tolerance); + } + + operator typename CompatibleTypes >::Type () const + { + typename CompatibleTypes >::Type result; + result.Orientation = Rotation; + result.Position = Translation; + return result; + } + + Quat Rotation; + Vector3 Translation; + + OVR_MATH_STATIC_ASSERT((sizeof(T) == sizeof(double) || sizeof(T) == sizeof(float)), "(sizeof(T) == sizeof(double) || sizeof(T) == sizeof(float))"); + + void ToArray(T* arr) const + { + T temp[7] = { Rotation.x, Rotation.y, Rotation.z, Rotation.w, Translation.x, Translation.y, Translation.z }; + for (int i = 0; i < 7; i++) arr[i] = temp[i]; + } + + static Pose FromArray(const T* v) + { + Quat rotation(v[0], v[1], v[2], v[3]); + Vector3 translation(v[4], v[5], v[6]); + // Ensure rotation is normalized, in case it was originally a float, stored in a .json file, etc. + return Pose(rotation.Normalized(), translation); + } + + Vector3 Rotate(const Vector3& v) const + { + return Rotation.Rotate(v); + } + + Vector3 InverseRotate(const Vector3& v) const + { + return Rotation.InverseRotate(v); + } + + Vector3 Translate(const Vector3& v) const + { + return v + Translation; + } + + Vector3 Transform(const Vector3& v) const + { + return Rotate(v) + Translation; + } + + Vector3 InverseTransform(const Vector3& v) const + { + return InverseRotate(v - Translation); + } + + + Vector3 Apply(const Vector3& v) const + { + return Transform(v); + } + + Pose operator*(const Pose& other) const + { + return Pose(Rotation * other.Rotation, Apply(other.Translation)); + } + + Pose Inverted() const + { + Quat inv = Rotation.Inverted(); + return Pose(inv, inv.Rotate(-Translation)); + } + + // Interpolation between two poses: translation is interpolated with Lerp(), + // and rotations are interpolated with Slerp(). + Pose Lerp(const Pose& b, T s) + { + return Pose(Rotation.Slerp(b.Rotation, s), Translation.Lerp(b.Translation, s)); + } + + // Similar to Lerp above, except faster in case of small rotation differences. See Quat::FastSlerp. + Pose FastLerp(const Pose& b, T s) + { + return Pose(Rotation.FastSlerp(b.Rotation, s), Translation.Lerp(b.Translation, s)); + } + + Pose TimeIntegrate(const Vector3& linearVelocity, const Vector3& angularVelocity, T dt) const + { + return Pose( + (Rotation * Quat::FastFromRotationVector(angularVelocity * dt, false)).Normalized(), + Translation + linearVelocity * dt); + } + + Pose TimeIntegrate(const Vector3& linearVelocity, const Vector3& linearAcceleration, + const Vector3& angularVelocity, const Vector3& angularAcceleration, + T dt) const + { + return Pose(Rotation.TimeIntegrate(angularVelocity, angularAcceleration, dt), + Translation + linearVelocity*dt + linearAcceleration*dt*dt * T(0.5)); + } +}; + +typedef Pose Posef; +typedef Pose Posed; + +OVR_MATH_STATIC_ASSERT((sizeof(Posed) == sizeof(Quatd) + sizeof(Vector3d)), "sizeof(Posed) failure"); +OVR_MATH_STATIC_ASSERT((sizeof(Posef) == sizeof(Quatf) + sizeof(Vector3f)), "sizeof(Posef) failure"); + + +//------------------------------------------------------------------------------------- +// ***** Matrix4 +// +// Matrix4 is a 4x4 matrix used for 3d transformations and projections. +// Translation stored in the last column. +// The matrix is stored in row-major order in memory, meaning that values +// of the first row are stored before the next one. +// +// The arrangement of the matrix is chosen to be in Right-Handed +// coordinate system and counterclockwise rotations when looking down +// the axis +// +// Transformation Order: +// - Transformations are applied from right to left, so the expression +// M1 * M2 * M3 * V means that the vector V is transformed by M3 first, +// followed by M2 and M1. +// +// Coordinate system: Right Handed +// +// Rotations: Counterclockwise when looking down the axis. All angles are in radians. +// +// | sx 01 02 tx | // First column (sx, 10, 20): Axis X basis vector. +// | 10 sy 12 ty | // Second column (01, sy, 21): Axis Y basis vector. +// | 20 21 sz tz | // Third columnt (02, 12, sz): Axis Z basis vector. +// | 30 31 32 33 | +// +// The basis vectors are first three columns. + +template +class Matrix4 +{ +public: + typedef T ElementType; + static const size_t Dimension = 4; + + T M[4][4]; + + enum NoInitType { NoInit }; + + // Construct with no memory initialization. + Matrix4(NoInitType) { } + + // By default, we construct identity matrix. + Matrix4() + { + M[0][0] = M[1][1] = M[2][2] = M[3][3] = T(1); + M[0][1] = M[1][0] = M[2][3] = M[3][1] = T(0); + M[0][2] = M[1][2] = M[2][0] = M[3][2] = T(0); + M[0][3] = M[1][3] = M[2][1] = M[3][0] = T(0); + } + + Matrix4(T m11, T m12, T m13, T m14, + T m21, T m22, T m23, T m24, + T m31, T m32, T m33, T m34, + T m41, T m42, T m43, T m44) + { + M[0][0] = m11; M[0][1] = m12; M[0][2] = m13; M[0][3] = m14; + M[1][0] = m21; M[1][1] = m22; M[1][2] = m23; M[1][3] = m24; + M[2][0] = m31; M[2][1] = m32; M[2][2] = m33; M[2][3] = m34; + M[3][0] = m41; M[3][1] = m42; M[3][2] = m43; M[3][3] = m44; + } + + Matrix4(T m11, T m12, T m13, + T m21, T m22, T m23, + T m31, T m32, T m33) + { + M[0][0] = m11; M[0][1] = m12; M[0][2] = m13; M[0][3] = T(0); + M[1][0] = m21; M[1][1] = m22; M[1][2] = m23; M[1][3] = T(0); + M[2][0] = m31; M[2][1] = m32; M[2][2] = m33; M[2][3] = T(0); + M[3][0] = T(0); M[3][1] = T(0); M[3][2] = T(0); M[3][3] = T(1); + } + + explicit Matrix4(const Matrix3& m) + { + M[0][0] = m.M[0][0]; M[0][1] = m.M[0][1]; M[0][2] = m.M[0][2]; M[0][3] = T(0); + M[1][0] = m.M[1][0]; M[1][1] = m.M[1][1]; M[1][2] = m.M[1][2]; M[1][3] = T(0); + M[2][0] = m.M[2][0]; M[2][1] = m.M[2][1]; M[2][2] = m.M[2][2]; M[2][3] = T(0); + M[3][0] = T(0); M[3][1] = T(0); M[3][2] = T(0); M[3][3] = T(1); + } + + explicit Matrix4(const Quat& q) + { + OVR_MATH_ASSERT(q.IsNormalized()); + T ww = q.w*q.w; + T xx = q.x*q.x; + T yy = q.y*q.y; + T zz = q.z*q.z; + + M[0][0] = ww + xx - yy - zz; M[0][1] = 2 * (q.x*q.y - q.w*q.z); M[0][2] = 2 * (q.x*q.z + q.w*q.y); M[0][3] = T(0); + M[1][0] = 2 * (q.x*q.y + q.w*q.z); M[1][1] = ww - xx + yy - zz; M[1][2] = 2 * (q.y*q.z - q.w*q.x); M[1][3] = T(0); + M[2][0] = 2 * (q.x*q.z - q.w*q.y); M[2][1] = 2 * (q.y*q.z + q.w*q.x); M[2][2] = ww - xx - yy + zz; M[2][3] = T(0); + M[3][0] = T(0); M[3][1] = T(0); M[3][2] = T(0); M[3][3] = T(1); + } + + explicit Matrix4(const Pose& p) + { + Matrix4 result(p.Rotation); + result.SetTranslation(p.Translation); + *this = result; + } + + + // C-interop support + explicit Matrix4(const Matrix4::OtherFloatType> &src) + { + for (int i = 0; i < 4; i++) + for (int j = 0; j < 4; j++) + M[i][j] = (T)src.M[i][j]; + } + + // C-interop support. + Matrix4(const typename CompatibleTypes >::Type& s) + { + OVR_MATH_STATIC_ASSERT(sizeof(s) == sizeof(Matrix4), "sizeof(s) == sizeof(Matrix4)"); + memcpy(M, s.M, sizeof(M)); + } + + operator typename CompatibleTypes >::Type () const + { + typename CompatibleTypes >::Type result; + OVR_MATH_STATIC_ASSERT(sizeof(result) == sizeof(Matrix4), "sizeof(result) == sizeof(Matrix4)"); + memcpy(result.M, M, sizeof(M)); + return result; + } + + void ToString(char* dest, size_t destsize) const + { + size_t pos = 0; + for (int r=0; r<4; r++) + { + for (int c=0; c<4; c++) + { + pos += OVRMath_sprintf(dest+pos, destsize-pos, "%g ", M[r][c]); + } + } + } + + static Matrix4 FromString(const char* src) + { + Matrix4 result; + if (src) + { + for (int r = 0; r < 4; r++) + { + for (int c = 0; c < 4; c++) + { + result.M[r][c] = (T)atof(src); + while (*src && *src != ' ') + { + src++; + } + while (*src && *src == ' ') + { + src++; + } + } + } + } + return result; + } + + static Matrix4 Identity() { return Matrix4(); } + + void SetIdentity() + { + M[0][0] = M[1][1] = M[2][2] = M[3][3] = T(1); + M[0][1] = M[1][0] = M[2][3] = M[3][1] = T(0); + M[0][2] = M[1][2] = M[2][0] = M[3][2] = T(0); + M[0][3] = M[1][3] = M[2][1] = M[3][0] = T(0); + } + + void SetXBasis(const Vector3& v) + { + M[0][0] = v.x; + M[1][0] = v.y; + M[2][0] = v.z; + } + Vector3 GetXBasis() const + { + return Vector3(M[0][0], M[1][0], M[2][0]); + } + + void SetYBasis(const Vector3 & v) + { + M[0][1] = v.x; + M[1][1] = v.y; + M[2][1] = v.z; + } + Vector3 GetYBasis() const + { + return Vector3(M[0][1], M[1][1], M[2][1]); + } + + void SetZBasis(const Vector3 & v) + { + M[0][2] = v.x; + M[1][2] = v.y; + M[2][2] = v.z; + } + Vector3 GetZBasis() const + { + return Vector3(M[0][2], M[1][2], M[2][2]); + } + + bool operator== (const Matrix4& b) const + { + bool isEqual = true; + for (int i = 0; i < 4; i++) + for (int j = 0; j < 4; j++) + isEqual &= (M[i][j] == b.M[i][j]); + + return isEqual; + } + + Matrix4 operator+ (const Matrix4& b) const + { + Matrix4 result(*this); + result += b; + return result; + } + + Matrix4& operator+= (const Matrix4& b) + { + for (int i = 0; i < 4; i++) + for (int j = 0; j < 4; j++) + M[i][j] += b.M[i][j]; + return *this; + } + + Matrix4 operator- (const Matrix4& b) const + { + Matrix4 result(*this); + result -= b; + return result; + } + + Matrix4& operator-= (const Matrix4& b) + { + for (int i = 0; i < 4; i++) + for (int j = 0; j < 4; j++) + M[i][j] -= b.M[i][j]; + return *this; + } + + // Multiplies two matrices into destination with minimum copying. + static Matrix4& Multiply(Matrix4* d, const Matrix4& a, const Matrix4& b) + { + OVR_MATH_ASSERT((d != &a) && (d != &b)); + int i = 0; + do { + d->M[i][0] = a.M[i][0] * b.M[0][0] + a.M[i][1] * b.M[1][0] + a.M[i][2] * b.M[2][0] + a.M[i][3] * b.M[3][0]; + d->M[i][1] = a.M[i][0] * b.M[0][1] + a.M[i][1] * b.M[1][1] + a.M[i][2] * b.M[2][1] + a.M[i][3] * b.M[3][1]; + d->M[i][2] = a.M[i][0] * b.M[0][2] + a.M[i][1] * b.M[1][2] + a.M[i][2] * b.M[2][2] + a.M[i][3] * b.M[3][2]; + d->M[i][3] = a.M[i][0] * b.M[0][3] + a.M[i][1] * b.M[1][3] + a.M[i][2] * b.M[2][3] + a.M[i][3] * b.M[3][3]; + } while((++i) < 4); + + return *d; + } + + Matrix4 operator* (const Matrix4& b) const + { + Matrix4 result(Matrix4::NoInit); + Multiply(&result, *this, b); + return result; + } + + Matrix4& operator*= (const Matrix4& b) + { + return Multiply(this, Matrix4(*this), b); + } + + Matrix4 operator* (T s) const + { + Matrix4 result(*this); + result *= s; + return result; + } + + Matrix4& operator*= (T s) + { + for (int i = 0; i < 4; i++) + for (int j = 0; j < 4; j++) + M[i][j] *= s; + return *this; + } + + + Matrix4 operator/ (T s) const + { + Matrix4 result(*this); + result /= s; + return result; + } + + Matrix4& operator/= (T s) + { + for (int i = 0; i < 4; i++) + for (int j = 0; j < 4; j++) + M[i][j] /= s; + return *this; + } + + Vector3 Transform(const Vector3& v) const + { + const T rcpW = T(1) / (M[3][0] * v.x + M[3][1] * v.y + M[3][2] * v.z + M[3][3]); + return Vector3((M[0][0] * v.x + M[0][1] * v.y + M[0][2] * v.z + M[0][3]) * rcpW, + (M[1][0] * v.x + M[1][1] * v.y + M[1][2] * v.z + M[1][3]) * rcpW, + (M[2][0] * v.x + M[2][1] * v.y + M[2][2] * v.z + M[2][3]) * rcpW); + } + + Vector4 Transform(const Vector4& v) const + { + return Vector4(M[0][0] * v.x + M[0][1] * v.y + M[0][2] * v.z + M[0][3] * v.w, + M[1][0] * v.x + M[1][1] * v.y + M[1][2] * v.z + M[1][3] * v.w, + M[2][0] * v.x + M[2][1] * v.y + M[2][2] * v.z + M[2][3] * v.w, + M[3][0] * v.x + M[3][1] * v.y + M[3][2] * v.z + M[3][3] * v.w); + } + + Matrix4 Transposed() const + { + return Matrix4(M[0][0], M[1][0], M[2][0], M[3][0], + M[0][1], M[1][1], M[2][1], M[3][1], + M[0][2], M[1][2], M[2][2], M[3][2], + M[0][3], M[1][3], M[2][3], M[3][3]); + } + + void Transpose() + { + *this = Transposed(); + } + + + T SubDet (const size_t* rows, const size_t* cols) const + { + return M[rows[0]][cols[0]] * (M[rows[1]][cols[1]] * M[rows[2]][cols[2]] - M[rows[1]][cols[2]] * M[rows[2]][cols[1]]) + - M[rows[0]][cols[1]] * (M[rows[1]][cols[0]] * M[rows[2]][cols[2]] - M[rows[1]][cols[2]] * M[rows[2]][cols[0]]) + + M[rows[0]][cols[2]] * (M[rows[1]][cols[0]] * M[rows[2]][cols[1]] - M[rows[1]][cols[1]] * M[rows[2]][cols[0]]); + } + + T Cofactor(size_t I, size_t J) const + { + const size_t indices[4][3] = {{1,2,3},{0,2,3},{0,1,3},{0,1,2}}; + return ((I+J)&1) ? -SubDet(indices[I],indices[J]) : SubDet(indices[I],indices[J]); + } + + T Determinant() const + { + return M[0][0] * Cofactor(0,0) + M[0][1] * Cofactor(0,1) + M[0][2] * Cofactor(0,2) + M[0][3] * Cofactor(0,3); + } + + Matrix4 Adjugated() const + { + return Matrix4(Cofactor(0,0), Cofactor(1,0), Cofactor(2,0), Cofactor(3,0), + Cofactor(0,1), Cofactor(1,1), Cofactor(2,1), Cofactor(3,1), + Cofactor(0,2), Cofactor(1,2), Cofactor(2,2), Cofactor(3,2), + Cofactor(0,3), Cofactor(1,3), Cofactor(2,3), Cofactor(3,3)); + } + + Matrix4 Inverted() const + { + T det = Determinant(); + OVR_MATH_ASSERT(det != 0); + return Adjugated() * (T(1)/det); + } + + void Invert() + { + *this = Inverted(); + } + + // This is more efficient than general inverse, but ONLY works + // correctly if it is a homogeneous transform matrix (rot + trans) + Matrix4 InvertedHomogeneousTransform() const + { + // Make the inverse rotation matrix + Matrix4 rinv = this->Transposed(); + rinv.M[3][0] = rinv.M[3][1] = rinv.M[3][2] = T(0); + // Make the inverse translation matrix + Vector3 tvinv(-M[0][3],-M[1][3],-M[2][3]); + Matrix4 tinv = Matrix4::Translation(tvinv); + return rinv * tinv; // "untranslate", then "unrotate" + } + + // This is more efficient than general inverse, but ONLY works + // correctly if it is a homogeneous transform matrix (rot + trans) + void InvertHomogeneousTransform() + { + *this = InvertedHomogeneousTransform(); + } + + // Matrix to Euler Angles conversion + // a,b,c, are the YawPitchRoll angles to be returned + // rotation a around axis A1 + // is followed by rotation b around axis A2 + // is followed by rotation c around axis A3 + // rotations are CCW or CW (D) in LH or RH coordinate system (S) + template + void ToEulerAngles(T *a, T *b, T *c) const + { + OVR_MATH_STATIC_ASSERT((A1 != A2) && (A2 != A3) && (A1 != A3), "(A1 != A2) && (A2 != A3) && (A1 != A3)"); + + T psign = T(-1); + if (((A1 + 1) % 3 == A2) && ((A2 + 1) % 3 == A3)) // Determine whether even permutation + psign = T(1); + + T pm = psign*M[A1][A3]; + T singularityRadius = Math::SingularityRadius(); + if (pm < T(-1) + singularityRadius) + { // South pole singularity + *a = T(0); + *b = -S*D*((T)MATH_DOUBLE_PIOVER2); + *c = S*D*atan2( psign*M[A2][A1], M[A2][A2] ); + } + else if (pm > T(1) - singularityRadius) + { // North pole singularity + *a = T(0); + *b = S*D*((T)MATH_DOUBLE_PIOVER2); + *c = S*D*atan2( psign*M[A2][A1], M[A2][A2] ); + } + else + { // Normal case (nonsingular) + *a = S*D*atan2( -psign*M[A2][A3], M[A3][A3] ); + *b = S*D*asin(pm); + *c = S*D*atan2( -psign*M[A1][A2], M[A1][A1] ); + } + } + + // Matrix to Euler Angles conversion + // a,b,c, are the YawPitchRoll angles to be returned + // rotation a around axis A1 + // is followed by rotation b around axis A2 + // is followed by rotation c around axis A1 + // rotations are CCW or CW (D) in LH or RH coordinate system (S) + template + void ToEulerAnglesABA(T *a, T *b, T *c) const + { + OVR_MATH_STATIC_ASSERT(A1 != A2, "A1 != A2"); + + // Determine the axis that was not supplied + int m = 3 - A1 - A2; + + T psign = T(-1); + if ((A1 + 1) % 3 == A2) // Determine whether even permutation + psign = T(1); + + T c2 = M[A1][A1]; + T singularityRadius = Math::SingularityRadius(); + if (c2 < T(-1) + singularityRadius) + { // South pole singularity + *a = T(0); + *b = S*D*((T)MATH_DOUBLE_PI); + *c = S*D*atan2( -psign*M[A2][m],M[A2][A2]); + } + else if (c2 > T(1) - singularityRadius) + { // North pole singularity + *a = T(0); + *b = T(0); + *c = S*D*atan2( -psign*M[A2][m],M[A2][A2]); + } + else + { // Normal case (nonsingular) + *a = S*D*atan2( M[A2][A1],-psign*M[m][A1]); + *b = S*D*acos(c2); + *c = S*D*atan2( M[A1][A2],psign*M[A1][m]); + } + } + + // Creates a matrix that converts the vertices from one coordinate system + // to another. + static Matrix4 AxisConversion(const WorldAxes& to, const WorldAxes& from) + { + // Holds axis values from the 'to' structure + int toArray[3] = { to.XAxis, to.YAxis, to.ZAxis }; + + // The inverse of the toArray + int inv[4]; + inv[0] = inv[abs(to.XAxis)] = 0; + inv[abs(to.YAxis)] = 1; + inv[abs(to.ZAxis)] = 2; + + Matrix4 m(0, 0, 0, + 0, 0, 0, + 0, 0, 0); + + // Only three values in the matrix need to be changed to 1 or -1. + m.M[inv[abs(from.XAxis)]][0] = T(from.XAxis/toArray[inv[abs(from.XAxis)]]); + m.M[inv[abs(from.YAxis)]][1] = T(from.YAxis/toArray[inv[abs(from.YAxis)]]); + m.M[inv[abs(from.ZAxis)]][2] = T(from.ZAxis/toArray[inv[abs(from.ZAxis)]]); + return m; + } + + + // Creates a matrix for translation by vector + static Matrix4 Translation(const Vector3& v) + { + Matrix4 t; + t.M[0][3] = v.x; + t.M[1][3] = v.y; + t.M[2][3] = v.z; + return t; + } + + // Creates a matrix for translation by vector + static Matrix4 Translation(T x, T y, T z = T(0)) + { + Matrix4 t; + t.M[0][3] = x; + t.M[1][3] = y; + t.M[2][3] = z; + return t; + } + + // Sets the translation part + void SetTranslation(const Vector3& v) + { + M[0][3] = v.x; + M[1][3] = v.y; + M[2][3] = v.z; + } + + Vector3 GetTranslation() const + { + return Vector3( M[0][3], M[1][3], M[2][3] ); + } + + // Creates a matrix for scaling by vector + static Matrix4 Scaling(const Vector3& v) + { + Matrix4 t; + t.M[0][0] = v.x; + t.M[1][1] = v.y; + t.M[2][2] = v.z; + return t; + } + + // Creates a matrix for scaling by vector + static Matrix4 Scaling(T x, T y, T z) + { + Matrix4 t; + t.M[0][0] = x; + t.M[1][1] = y; + t.M[2][2] = z; + return t; + } + + // Creates a matrix for scaling by constant + static Matrix4 Scaling(T s) + { + Matrix4 t; + t.M[0][0] = s; + t.M[1][1] = s; + t.M[2][2] = s; + return t; + } + + // Simple L1 distance in R^12 + T Distance(const Matrix4& m2) const + { + T d = fabs(M[0][0] - m2.M[0][0]) + fabs(M[0][1] - m2.M[0][1]); + d += fabs(M[0][2] - m2.M[0][2]) + fabs(M[0][3] - m2.M[0][3]); + d += fabs(M[1][0] - m2.M[1][0]) + fabs(M[1][1] - m2.M[1][1]); + d += fabs(M[1][2] - m2.M[1][2]) + fabs(M[1][3] - m2.M[1][3]); + d += fabs(M[2][0] - m2.M[2][0]) + fabs(M[2][1] - m2.M[2][1]); + d += fabs(M[2][2] - m2.M[2][2]) + fabs(M[2][3] - m2.M[2][3]); + d += fabs(M[3][0] - m2.M[3][0]) + fabs(M[3][1] - m2.M[3][1]); + d += fabs(M[3][2] - m2.M[3][2]) + fabs(M[3][3] - m2.M[3][3]); + return d; + } + + // Creates a rotation matrix rotating around the X axis by 'angle' radians. + // Just for quick testing. Not for final API. Need to remove case. + static Matrix4 RotationAxis(Axis A, T angle, RotateDirection d, HandedSystem s) + { + T sina = s * d *sin(angle); + T cosa = cos(angle); + + switch(A) + { + case Axis_X: + return Matrix4(1, 0, 0, + 0, cosa, -sina, + 0, sina, cosa); + case Axis_Y: + return Matrix4(cosa, 0, sina, + 0, 1, 0, + -sina, 0, cosa); + case Axis_Z: + return Matrix4(cosa, -sina, 0, + sina, cosa, 0, + 0, 0, 1); + default: + return Matrix4(); + } + } + + + // Creates a rotation matrix rotating around the X axis by 'angle' radians. + // Rotation direction is depends on the coordinate system: + // RHS (Oculus default): Positive angle values rotate Counter-clockwise (CCW), + // while looking in the negative axis direction. This is the + // same as looking down from positive axis values towards origin. + // LHS: Positive angle values rotate clock-wise (CW), while looking in the + // negative axis direction. + static Matrix4 RotationX(T angle) + { + T sina = sin(angle); + T cosa = cos(angle); + return Matrix4(1, 0, 0, + 0, cosa, -sina, + 0, sina, cosa); + } + + // Creates a rotation matrix rotating around the Y axis by 'angle' radians. + // Rotation direction is depends on the coordinate system: + // RHS (Oculus default): Positive angle values rotate Counter-clockwise (CCW), + // while looking in the negative axis direction. This is the + // same as looking down from positive axis values towards origin. + // LHS: Positive angle values rotate clock-wise (CW), while looking in the + // negative axis direction. + static Matrix4 RotationY(T angle) + { + T sina = sin(angle); + T cosa = cos(angle); + return Matrix4(cosa, 0, sina, + 0, 1, 0, + -sina, 0, cosa); + } + + // Creates a rotation matrix rotating around the Z axis by 'angle' radians. + // Rotation direction is depends on the coordinate system: + // RHS (Oculus default): Positive angle values rotate Counter-clockwise (CCW), + // while looking in the negative axis direction. This is the + // same as looking down from positive axis values towards origin. + // LHS: Positive angle values rotate clock-wise (CW), while looking in the + // negative axis direction. + static Matrix4 RotationZ(T angle) + { + T sina = sin(angle); + T cosa = cos(angle); + return Matrix4(cosa, -sina, 0, + sina, cosa, 0, + 0, 0, 1); + } + + // LookAtRH creates a View transformation matrix for right-handed coordinate system. + // The resulting matrix points camera from 'eye' towards 'at' direction, with 'up' + // specifying the up vector. The resulting matrix should be used with PerspectiveRH + // projection. + static Matrix4 LookAtRH(const Vector3& eye, const Vector3& at, const Vector3& up) + { + Vector3 z = (eye - at).Normalized(); // Forward + Vector3 x = up.Cross(z).Normalized(); // Right + Vector3 y = z.Cross(x); + + Matrix4 m(x.x, x.y, x.z, -(x.Dot(eye)), + y.x, y.y, y.z, -(y.Dot(eye)), + z.x, z.y, z.z, -(z.Dot(eye)), + 0, 0, 0, 1 ); + return m; + } + + // LookAtLH creates a View transformation matrix for left-handed coordinate system. + // The resulting matrix points camera from 'eye' towards 'at' direction, with 'up' + // specifying the up vector. + static Matrix4 LookAtLH(const Vector3& eye, const Vector3& at, const Vector3& up) + { + Vector3 z = (at - eye).Normalized(); // Forward + Vector3 x = up.Cross(z).Normalized(); // Right + Vector3 y = z.Cross(x); + + Matrix4 m(x.x, x.y, x.z, -(x.Dot(eye)), + y.x, y.y, y.z, -(y.Dot(eye)), + z.x, z.y, z.z, -(z.Dot(eye)), + 0, 0, 0, 1 ); + return m; + } + + // PerspectiveRH creates a right-handed perspective projection matrix that can be + // used with the Oculus sample renderer. + // yfov - Specifies vertical field of view in radians. + // aspect - Screen aspect ration, which is usually width/height for square pixels. + // Note that xfov = yfov * aspect. + // znear - Absolute value of near Z clipping clipping range. + // zfar - Absolute value of far Z clipping clipping range (larger then near). + // Even though RHS usually looks in the direction of negative Z, positive values + // are expected for znear and zfar. + static Matrix4 PerspectiveRH(T yfov, T aspect, T znear, T zfar) + { + Matrix4 m; + T tanHalfFov = tan(yfov * T(0.5)); + + m.M[0][0] = T(1) / (aspect * tanHalfFov); + m.M[1][1] = T(1) / tanHalfFov; + m.M[2][2] = zfar / (znear - zfar); + m.M[3][2] = T(-1); + m.M[2][3] = (zfar * znear) / (znear - zfar); + m.M[3][3] = T(0); + + // Note: Post-projection matrix result assumes Left-Handed coordinate system, + // with Y up, X right and Z forward. This supports positive z-buffer values. + // This is the case even for RHS coordinate input. + return m; + } + + // PerspectiveLH creates a left-handed perspective projection matrix that can be + // used with the Oculus sample renderer. + // yfov - Specifies vertical field of view in radians. + // aspect - Screen aspect ration, which is usually width/height for square pixels. + // Note that xfov = yfov * aspect. + // znear - Absolute value of near Z clipping clipping range. + // zfar - Absolute value of far Z clipping clipping range (larger then near). + static Matrix4 PerspectiveLH(T yfov, T aspect, T znear, T zfar) + { + Matrix4 m; + T tanHalfFov = tan(yfov * T(0.5)); + + m.M[0][0] = T(1) / (aspect * tanHalfFov); + m.M[1][1] = T(1) / tanHalfFov; + //m.M[2][2] = zfar / (znear - zfar); + m.M[2][2] = zfar / (zfar - znear); + m.M[3][2] = T(-1); + m.M[2][3] = (zfar * znear) / (znear - zfar); + m.M[3][3] = T(0); + + // Note: Post-projection matrix result assumes Left-Handed coordinate system, + // with Y up, X right and Z forward. This supports positive z-buffer values. + // This is the case even for RHS coordinate input. + return m; + } + + static Matrix4 Ortho2D(T w, T h) + { + Matrix4 m; + m.M[0][0] = T(2.0)/w; + m.M[1][1] = T(-2.0)/h; + m.M[0][3] = T(-1.0); + m.M[1][3] = T(1.0); + m.M[2][2] = T(0); + return m; + } +}; + +typedef Matrix4 Matrix4f; +typedef Matrix4 Matrix4d; + +//------------------------------------------------------------------------------------- +// ***** Matrix3 +// +// Matrix3 is a 3x3 matrix used for representing a rotation matrix. +// The matrix is stored in row-major order in memory, meaning that values +// of the first row are stored before the next one. +// +// The arrangement of the matrix is chosen to be in Right-Handed +// coordinate system and counterclockwise rotations when looking down +// the axis +// +// Transformation Order: +// - Transformations are applied from right to left, so the expression +// M1 * M2 * M3 * V means that the vector V is transformed by M3 first, +// followed by M2 and M1. +// +// Coordinate system: Right Handed +// +// Rotations: Counterclockwise when looking down the axis. All angles are in radians. + +template +class Matrix3 +{ +public: + typedef T ElementType; + static const size_t Dimension = 3; + + T M[3][3]; + + enum NoInitType { NoInit }; + + // Construct with no memory initialization. + Matrix3(NoInitType) { } + + // By default, we construct identity matrix. + Matrix3() + { + M[0][0] = M[1][1] = M[2][2] = T(1); + M[0][1] = M[1][0] = M[2][0] = T(0); + M[0][2] = M[1][2] = M[2][1] = T(0); + } + + Matrix3(T m11, T m12, T m13, + T m21, T m22, T m23, + T m31, T m32, T m33) + { + M[0][0] = m11; M[0][1] = m12; M[0][2] = m13; + M[1][0] = m21; M[1][1] = m22; M[1][2] = m23; + M[2][0] = m31; M[2][1] = m32; M[2][2] = m33; + } + + // Construction from X, Y, Z basis vectors + Matrix3(const Vector3& xBasis, const Vector3& yBasis, const Vector3& zBasis) + { + M[0][0] = xBasis.x; M[0][1] = yBasis.x; M[0][2] = zBasis.x; + M[1][0] = xBasis.y; M[1][1] = yBasis.y; M[1][2] = zBasis.y; + M[2][0] = xBasis.z; M[2][1] = yBasis.z; M[2][2] = zBasis.z; + } + + explicit Matrix3(const Quat& q) + { + OVR_MATH_ASSERT(q.IsNormalized()); + const T tx = q.x+q.x, ty = q.y+q.y, tz = q.z+q.z; + const T twx = q.w*tx, twy = q.w*ty, twz = q.w*tz; + const T txx = q.x*tx, txy = q.x*ty, txz = q.x*tz; + const T tyy = q.y*ty, tyz = q.y*tz, tzz = q.z*tz; + M[0][0] = T(1) - (tyy + tzz); M[0][1] = txy - twz; M[0][2] = txz + twy; + M[1][0] = txy + twz; M[1][1] = T(1) - (txx + tzz); M[1][2] = tyz - twx; + M[2][0] = txz - twy; M[2][1] = tyz + twx; M[2][2] = T(1) - (txx + tyy); + } + + inline explicit Matrix3(T s) + { + M[0][0] = M[1][1] = M[2][2] = s; + M[0][1] = M[0][2] = M[1][0] = M[1][2] = M[2][0] = M[2][1] = T(0); + } + + Matrix3(T m11, T m22, T m33) + { + M[0][0] = m11; M[0][1] = T(0); M[0][2] = T(0); + M[1][0] = T(0); M[1][1] = m22; M[1][2] = T(0); + M[2][0] = T(0); M[2][1] = T(0); M[2][2] = m33; + } + + explicit Matrix3(const Matrix3::OtherFloatType> &src) + { + for (int i = 0; i < 3; i++) + for (int j = 0; j < 3; j++) + M[i][j] = (T)src.M[i][j]; + } + + // C-interop support. + Matrix3(const typename CompatibleTypes >::Type& s) + { + OVR_MATH_STATIC_ASSERT(sizeof(s) == sizeof(Matrix3), "sizeof(s) == sizeof(Matrix3)"); + memcpy(M, s.M, sizeof(M)); + } + + operator const typename CompatibleTypes >::Type () const + { + typename CompatibleTypes >::Type result; + OVR_MATH_STATIC_ASSERT(sizeof(result) == sizeof(Matrix3), "sizeof(result) == sizeof(Matrix3)"); + memcpy(result.M, M, sizeof(M)); + return result; + } + + T operator()(int i, int j) const { return M[i][j]; } + T& operator()(int i, int j) { return M[i][j]; } + + void ToString(char* dest, size_t destsize) const + { + size_t pos = 0; + for (int r=0; r<3; r++) + { + for (int c=0; c<3; c++) + pos += OVRMath_sprintf(dest+pos, destsize-pos, "%g ", M[r][c]); + } + } + + static Matrix3 FromString(const char* src) + { + Matrix3 result; + if (src) + { + for (int r=0; r<3; r++) + { + for (int c=0; c<3; c++) + { + result.M[r][c] = (T)atof(src); + while (*src && *src != ' ') + src++; + while (*src && *src == ' ') + src++; + } + } + } + return result; + } + + static Matrix3 Identity() { return Matrix3(); } + + void SetIdentity() + { + M[0][0] = M[1][1] = M[2][2] = T(1); + M[0][1] = M[1][0] = M[2][0] = T(0); + M[0][2] = M[1][2] = M[2][1] = T(0); + } + + static Matrix3 Diagonal(T m00, T m11, T m22) + { + return Matrix3(m00, 0, 0, + 0, m11, 0, + 0, 0, m22); + } + static Matrix3 Diagonal(const Vector3& v) { return Diagonal(v.x, v.y, v.z); } + + T Trace() const { return M[0][0] + M[1][1] + M[2][2]; } + + bool operator== (const Matrix3& b) const + { + bool isEqual = true; + for (int i = 0; i < 3; i++) + { + for (int j = 0; j < 3; j++) + isEqual &= (M[i][j] == b.M[i][j]); + } + + return isEqual; + } + + Matrix3 operator+ (const Matrix3& b) const + { + Matrix3 result(*this); + result += b; + return result; + } + + Matrix3& operator+= (const Matrix3& b) + { + for (int i = 0; i < 3; i++) + for (int j = 0; j < 3; j++) + M[i][j] += b.M[i][j]; + return *this; + } + + void operator= (const Matrix3& b) + { + for (int i = 0; i < 3; i++) + for (int j = 0; j < 3; j++) + M[i][j] = b.M[i][j]; + } + + Matrix3 operator- (const Matrix3& b) const + { + Matrix3 result(*this); + result -= b; + return result; + } + + Matrix3& operator-= (const Matrix3& b) + { + for (int i = 0; i < 3; i++) + { + for (int j = 0; j < 3; j++) + M[i][j] -= b.M[i][j]; + } + + return *this; + } + + // Multiplies two matrices into destination with minimum copying. + static Matrix3& Multiply(Matrix3* d, const Matrix3& a, const Matrix3& b) + { + OVR_MATH_ASSERT((d != &a) && (d != &b)); + int i = 0; + do { + d->M[i][0] = a.M[i][0] * b.M[0][0] + a.M[i][1] * b.M[1][0] + a.M[i][2] * b.M[2][0]; + d->M[i][1] = a.M[i][0] * b.M[0][1] + a.M[i][1] * b.M[1][1] + a.M[i][2] * b.M[2][1]; + d->M[i][2] = a.M[i][0] * b.M[0][2] + a.M[i][1] * b.M[1][2] + a.M[i][2] * b.M[2][2]; + } while((++i) < 3); + + return *d; + } + + Matrix3 operator* (const Matrix3& b) const + { + Matrix3 result(Matrix3::NoInit); + Multiply(&result, *this, b); + return result; + } + + Matrix3& operator*= (const Matrix3& b) + { + return Multiply(this, Matrix3(*this), b); + } + + Matrix3 operator* (T s) const + { + Matrix3 result(*this); + result *= s; + return result; + } + + Matrix3& operator*= (T s) + { + for (int i = 0; i < 3; i++) + { + for (int j = 0; j < 3; j++) + M[i][j] *= s; + } + + return *this; + } + + Vector3 operator* (const Vector3 &b) const + { + Vector3 result; + result.x = M[0][0]*b.x + M[0][1]*b.y + M[0][2]*b.z; + result.y = M[1][0]*b.x + M[1][1]*b.y + M[1][2]*b.z; + result.z = M[2][0]*b.x + M[2][1]*b.y + M[2][2]*b.z; + + return result; + } + + Matrix3 operator/ (T s) const + { + Matrix3 result(*this); + result /= s; + return result; + } + + Matrix3& operator/= (T s) + { + for (int i = 0; i < 3; i++) + { + for (int j = 0; j < 3; j++) + M[i][j] /= s; + } + + return *this; + } + + Vector2 Transform(const Vector2& v) const + { + const T rcpZ = T(1) / (M[2][0] * v.x + M[2][1] * v.y + M[2][2]); + return Vector2((M[0][0] * v.x + M[0][1] * v.y + M[0][2]) * rcpZ, + (M[1][0] * v.x + M[1][1] * v.y + M[1][2]) * rcpZ); + } + + Vector3 Transform(const Vector3& v) const + { + return Vector3(M[0][0] * v.x + M[0][1] * v.y + M[0][2] * v.z, + M[1][0] * v.x + M[1][1] * v.y + M[1][2] * v.z, + M[2][0] * v.x + M[2][1] * v.y + M[2][2] * v.z); + } + + Matrix3 Transposed() const + { + return Matrix3(M[0][0], M[1][0], M[2][0], + M[0][1], M[1][1], M[2][1], + M[0][2], M[1][2], M[2][2]); + } + + void Transpose() + { + *this = Transposed(); + } + + + T SubDet (const size_t* rows, const size_t* cols) const + { + return M[rows[0]][cols[0]] * (M[rows[1]][cols[1]] * M[rows[2]][cols[2]] - M[rows[1]][cols[2]] * M[rows[2]][cols[1]]) + - M[rows[0]][cols[1]] * (M[rows[1]][cols[0]] * M[rows[2]][cols[2]] - M[rows[1]][cols[2]] * M[rows[2]][cols[0]]) + + M[rows[0]][cols[2]] * (M[rows[1]][cols[0]] * M[rows[2]][cols[1]] - M[rows[1]][cols[1]] * M[rows[2]][cols[0]]); + } + + + // M += a*b.t() + inline void Rank1Add(const Vector3 &a, const Vector3 &b) + { + M[0][0] += a.x*b.x; M[0][1] += a.x*b.y; M[0][2] += a.x*b.z; + M[1][0] += a.y*b.x; M[1][1] += a.y*b.y; M[1][2] += a.y*b.z; + M[2][0] += a.z*b.x; M[2][1] += a.z*b.y; M[2][2] += a.z*b.z; + } + + // M -= a*b.t() + inline void Rank1Sub(const Vector3 &a, const Vector3 &b) + { + M[0][0] -= a.x*b.x; M[0][1] -= a.x*b.y; M[0][2] -= a.x*b.z; + M[1][0] -= a.y*b.x; M[1][1] -= a.y*b.y; M[1][2] -= a.y*b.z; + M[2][0] -= a.z*b.x; M[2][1] -= a.z*b.y; M[2][2] -= a.z*b.z; + } + + inline Vector3 Col(int c) const + { + return Vector3(M[0][c], M[1][c], M[2][c]); + } + + inline Vector3 Row(int r) const + { + return Vector3(M[r][0], M[r][1], M[r][2]); + } + + inline Vector3 GetColumn(int c) const + { + return Vector3(M[0][c], M[1][c], M[2][c]); + } + + inline Vector3 GetRow(int r) const + { + return Vector3(M[r][0], M[r][1], M[r][2]); + } + + inline void SetColumn(int c, const Vector3& v) + { + M[0][c] = v.x; + M[1][c] = v.y; + M[2][c] = v.z; + } + + inline void SetRow(int r, const Vector3& v) + { + M[r][0] = v.x; + M[r][1] = v.y; + M[r][2] = v.z; + } + + inline T Determinant() const + { + const Matrix3& m = *this; + T d; + + d = m.M[0][0] * (m.M[1][1]*m.M[2][2] - m.M[1][2] * m.M[2][1]); + d -= m.M[0][1] * (m.M[1][0]*m.M[2][2] - m.M[1][2] * m.M[2][0]); + d += m.M[0][2] * (m.M[1][0]*m.M[2][1] - m.M[1][1] * m.M[2][0]); + + return d; + } + + inline Matrix3 Inverse() const + { + Matrix3 a; + const Matrix3& m = *this; + T d = Determinant(); + + OVR_MATH_ASSERT(d != 0); + T s = T(1)/d; + + a.M[0][0] = s * (m.M[1][1] * m.M[2][2] - m.M[1][2] * m.M[2][1]); + a.M[1][0] = s * (m.M[1][2] * m.M[2][0] - m.M[1][0] * m.M[2][2]); + a.M[2][0] = s * (m.M[1][0] * m.M[2][1] - m.M[1][1] * m.M[2][0]); + + a.M[0][1] = s * (m.M[0][2] * m.M[2][1] - m.M[0][1] * m.M[2][2]); + a.M[1][1] = s * (m.M[0][0] * m.M[2][2] - m.M[0][2] * m.M[2][0]); + a.M[2][1] = s * (m.M[0][1] * m.M[2][0] - m.M[0][0] * m.M[2][1]); + + a.M[0][2] = s * (m.M[0][1] * m.M[1][2] - m.M[0][2] * m.M[1][1]); + a.M[1][2] = s * (m.M[0][2] * m.M[1][0] - m.M[0][0] * m.M[1][2]); + a.M[2][2] = s * (m.M[0][0] * m.M[1][1] - m.M[0][1] * m.M[1][0]); + + return a; + } + + // Outer Product of two column vectors: a * b.Transpose() + static Matrix3 OuterProduct(const Vector3& a, const Vector3& b) + { + return Matrix3(a.x*b.x, a.x*b.y, a.x*b.z, + a.y*b.x, a.y*b.y, a.y*b.z, + a.z*b.x, a.z*b.y, a.z*b.z); + } + + // Vector cross product as a premultiply matrix: + // L.Cross(R) = LeftCrossAsMatrix(L) * R + static Matrix3 LeftCrossAsMatrix(const Vector3& L) + { + return Matrix3( + T(0), -L.z, +L.y, + +L.z, T(0), -L.x, + -L.y, +L.x, T(0)); + } + + // Vector cross product as a premultiply matrix: + // L.Cross(R) = RightCrossAsMatrix(R) * L + static Matrix3 RightCrossAsMatrix(const Vector3& R) + { + return Matrix3( + T(0), +R.z, -R.y, + -R.z, T(0), +R.x, + +R.y, -R.x, T(0)); + } + + // Angle in radians of a rotation matrix + // Uses identity trace(a) = 2*cos(theta) + 1 + T Angle() const + { + return Acos((Trace() - T(1)) * T(0.5)); + } + + // Angle in radians between two rotation matrices + T Angle(const Matrix3& b) const + { + // Compute trace of (this->Transposed() * b) + // This works out to sum of products of elements. + T trace = T(0); + for (int i = 0; i < 3; i++) + { + for (int j = 0; j < 3; j++) + { + trace += M[i][j] * b.M[i][j]; + } + } + return Acos((trace - T(1)) * T(0.5)); + } +}; + +typedef Matrix3 Matrix3f; +typedef Matrix3 Matrix3d; + +//------------------------------------------------------------------------------------- +// ***** Matrix2 + +template +class Matrix2 +{ +public: + typedef T ElementType; + static const size_t Dimension = 2; + + T M[2][2]; + + enum NoInitType { NoInit }; + + // Construct with no memory initialization. + Matrix2(NoInitType) { } + + // By default, we construct identity matrix. + Matrix2() + { + M[0][0] = M[1][1] = T(1); + M[0][1] = M[1][0] = T(0); + } + + Matrix2(T m11, T m12, + T m21, T m22) + { + M[0][0] = m11; M[0][1] = m12; + M[1][0] = m21; M[1][1] = m22; + } + + // Construction from X, Y basis vectors + Matrix2(const Vector2& xBasis, const Vector2& yBasis) + { + M[0][0] = xBasis.x; M[0][1] = yBasis.x; + M[1][0] = xBasis.y; M[1][1] = yBasis.y; + } + + explicit Matrix2(T s) + { + M[0][0] = M[1][1] = s; + M[0][1] = M[1][0] = T(0); + } + + Matrix2(T m11, T m22) + { + M[0][0] = m11; M[0][1] = T(0); + M[1][0] = T(0); M[1][1] = m22; + } + + explicit Matrix2(const Matrix2::OtherFloatType> &src) + { + M[0][0] = T(src.M[0][0]); M[0][1] = T(src.M[0][1]); + M[1][0] = T(src.M[1][0]); M[1][1] = T(src.M[1][1]); + } + + // C-interop support + Matrix2(const typename CompatibleTypes >::Type& s) + { + OVR_MATH_STATIC_ASSERT(sizeof(s) == sizeof(Matrix2), "sizeof(s) == sizeof(Matrix2)"); + memcpy(M, s.M, sizeof(M)); + } + + operator const typename CompatibleTypes >::Type() const + { + typename CompatibleTypes >::Type result; + OVR_MATH_STATIC_ASSERT(sizeof(result) == sizeof(Matrix2), "sizeof(result) == sizeof(Matrix2)"); + memcpy(result.M, M, sizeof(M)); + return result; + } + + T operator()(int i, int j) const { return M[i][j]; } + T& operator()(int i, int j) { return M[i][j]; } + const T* operator[](int i) const { return M[i]; } + T* operator[](int i) { return M[i]; } + + static Matrix2 Identity() { return Matrix2(); } + + void SetIdentity() + { + M[0][0] = M[1][1] = T(1); + M[0][1] = M[1][0] = T(0); + } + + static Matrix2 Diagonal(T m00, T m11) + { + return Matrix2(m00, m11); + } + static Matrix2 Diagonal(const Vector2& v) { return Matrix2(v.x, v.y); } + + T Trace() const { return M[0][0] + M[1][1]; } + + bool operator== (const Matrix2& b) const + { + return M[0][0] == b.M[0][0] && M[0][1] == b.M[0][1] && + M[1][0] == b.M[1][0] && M[1][1] == b.M[1][1]; + } + + Matrix2 operator+ (const Matrix2& b) const + { + return Matrix2(M[0][0] + b.M[0][0], M[0][1] + b.M[0][1], + M[1][0] + b.M[1][0], M[1][1] + b.M[1][1]); + } + + Matrix2& operator+= (const Matrix2& b) + { + M[0][0] += b.M[0][0]; M[0][1] += b.M[0][1]; + M[1][0] += b.M[1][0]; M[1][1] += b.M[1][1]; + return *this; + } + + void operator= (const Matrix2& b) + { + M[0][0] = b.M[0][0]; M[0][1] = b.M[0][1]; + M[1][0] = b.M[1][0]; M[1][1] = b.M[1][1]; + } + + Matrix2 operator- (const Matrix2& b) const + { + return Matrix2(M[0][0] - b.M[0][0], M[0][1] - b.M[0][1], + M[1][0] - b.M[1][0], M[1][1] - b.M[1][1]); + } + + Matrix2& operator-= (const Matrix2& b) + { + M[0][0] -= b.M[0][0]; M[0][1] -= b.M[0][1]; + M[1][0] -= b.M[1][0]; M[1][1] -= b.M[1][1]; + return *this; + } + + Matrix2 operator* (const Matrix2& b) const + { + return Matrix2(M[0][0] * b.M[0][0] + M[0][1] * b.M[1][0], M[0][0] * b.M[0][1] + M[0][1] * b.M[1][1], + M[1][0] * b.M[0][0] + M[1][1] * b.M[1][0], M[1][0] * b.M[0][1] + M[1][1] * b.M[1][1]); + } + + Matrix2& operator*= (const Matrix2& b) + { + *this = *this * b; + return *this; + } + + Matrix2 operator* (T s) const + { + return Matrix2(M[0][0] * s, M[0][1] * s, + M[1][0] * s, M[1][1] * s); + } + + Matrix2& operator*= (T s) + { + M[0][0] *= s; M[0][1] *= s; + M[1][0] *= s; M[1][1] *= s; + return *this; + } + + Matrix2 operator/ (T s) const + { + return *this * (T(1) / s); + } + + Matrix2& operator/= (T s) + { + return *this *= (T(1) / s); + } + + Vector2 operator* (const Vector2 &b) const + { + return Vector2(M[0][0] * b.x + M[0][1] * b.y, + M[1][0] * b.x + M[1][1] * b.y); + } + + Vector2 Transform(const Vector2& v) const + { + return Vector2(M[0][0] * v.x + M[0][1] * v.y, + M[1][0] * v.x + M[1][1] * v.y); + } + + Matrix2 Transposed() const + { + return Matrix2(M[0][0], M[1][0], + M[0][1], M[1][1]); + } + + void Transpose() + { + OVRMath_Swap(M[1][0], M[0][1]); + } + + Vector2 GetColumn(int c) const + { + return Vector2(M[0][c], M[1][c]); + } + + Vector2 GetRow(int r) const + { + return Vector2(M[r][0], M[r][1]); + } + + void SetColumn(int c, const Vector2& v) + { + M[0][c] = v.x; + M[1][c] = v.y; + } + + void SetRow(int r, const Vector2& v) + { + M[r][0] = v.x; + M[r][1] = v.y; + } + + T Determinant() const + { + return M[0][0] * M[1][1] - M[0][1] * M[1][0]; + } + + Matrix2 Inverse() const + { + T rcpDet = T(1) / Determinant(); + return Matrix2( M[1][1] * rcpDet, -M[0][1] * rcpDet, + -M[1][0] * rcpDet, M[0][0] * rcpDet); + } + + // Outer Product of two column vectors: a * b.Transpose() + static Matrix2 OuterProduct(const Vector2& a, const Vector2& b) + { + return Matrix2(a.x*b.x, a.x*b.y, + a.y*b.x, a.y*b.y); + } + + // Angle in radians between two rotation matrices + T Angle(const Matrix2& b) const + { + const Matrix2& a = *this; + return Acos(a(0, 0)*b(0, 0) + a(1, 0)*b(1, 0)); + } +}; + +typedef Matrix2 Matrix2f; +typedef Matrix2 Matrix2d; + +//------------------------------------------------------------------------------------- + +template +class SymMat3 +{ +private: + typedef SymMat3 this_type; + +public: + typedef T Value_t; + // Upper symmetric + T v[6]; // _00 _01 _02 _11 _12 _22 + + inline SymMat3() {} + + inline explicit SymMat3(T s) + { + v[0] = v[3] = v[5] = s; + v[1] = v[2] = v[4] = T(0); + } + + inline explicit SymMat3(T a00, T a01, T a02, T a11, T a12, T a22) + { + v[0] = a00; v[1] = a01; v[2] = a02; + v[3] = a11; v[4] = a12; + v[5] = a22; + } + + // Cast to symmetric Matrix3 + operator Matrix3() const + { + return Matrix3(v[0], v[1], v[2], + v[1], v[3], v[4], + v[2], v[4], v[5]); + } + + static inline int Index(unsigned int i, unsigned int j) + { + return (i <= j) ? (3*i - i*(i+1)/2 + j) : (3*j - j*(j+1)/2 + i); + } + + inline T operator()(int i, int j) const { return v[Index(i,j)]; } + + inline T &operator()(int i, int j) { return v[Index(i,j)]; } + + inline this_type& operator+=(const this_type& b) + { + v[0]+=b.v[0]; + v[1]+=b.v[1]; + v[2]+=b.v[2]; + v[3]+=b.v[3]; + v[4]+=b.v[4]; + v[5]+=b.v[5]; + return *this; + } + + inline this_type& operator-=(const this_type& b) + { + v[0]-=b.v[0]; + v[1]-=b.v[1]; + v[2]-=b.v[2]; + v[3]-=b.v[3]; + v[4]-=b.v[4]; + v[5]-=b.v[5]; + + return *this; + } + + inline this_type& operator*=(T s) + { + v[0]*=s; + v[1]*=s; + v[2]*=s; + v[3]*=s; + v[4]*=s; + v[5]*=s; + + return *this; + } + + inline SymMat3 operator*(T s) const + { + SymMat3 d; + d.v[0] = v[0]*s; + d.v[1] = v[1]*s; + d.v[2] = v[2]*s; + d.v[3] = v[3]*s; + d.v[4] = v[4]*s; + d.v[5] = v[5]*s; + + return d; + } + + // Multiplies two matrices into destination with minimum copying. + static SymMat3& Multiply(SymMat3* d, const SymMat3& a, const SymMat3& b) + { + // _00 _01 _02 _11 _12 _22 + + d->v[0] = a.v[0] * b.v[0]; + d->v[1] = a.v[0] * b.v[1] + a.v[1] * b.v[3]; + d->v[2] = a.v[0] * b.v[2] + a.v[1] * b.v[4]; + + d->v[3] = a.v[3] * b.v[3]; + d->v[4] = a.v[3] * b.v[4] + a.v[4] * b.v[5]; + + d->v[5] = a.v[5] * b.v[5]; + + return *d; + } + + inline T Determinant() const + { + const this_type& m = *this; + T d; + + d = m(0,0) * (m(1,1)*m(2,2) - m(1,2) * m(2,1)); + d -= m(0,1) * (m(1,0)*m(2,2) - m(1,2) * m(2,0)); + d += m(0,2) * (m(1,0)*m(2,1) - m(1,1) * m(2,0)); + + return d; + } + + inline this_type Inverse() const + { + this_type a; + const this_type& m = *this; + T d = Determinant(); + + OVR_MATH_ASSERT(d != 0); + T s = T(1)/d; + + a(0,0) = s * (m(1,1) * m(2,2) - m(1,2) * m(2,1)); + + a(0,1) = s * (m(0,2) * m(2,1) - m(0,1) * m(2,2)); + a(1,1) = s * (m(0,0) * m(2,2) - m(0,2) * m(2,0)); + + a(0,2) = s * (m(0,1) * m(1,2) - m(0,2) * m(1,1)); + a(1,2) = s * (m(0,2) * m(1,0) - m(0,0) * m(1,2)); + a(2,2) = s * (m(0,0) * m(1,1) - m(0,1) * m(1,0)); + + return a; + } + + inline T Trace() const { return v[0] + v[3] + v[5]; } + + // M = a*a.t() + inline void Rank1(const Vector3 &a) + { + v[0] = a.x*a.x; v[1] = a.x*a.y; v[2] = a.x*a.z; + v[3] = a.y*a.y; v[4] = a.y*a.z; + v[5] = a.z*a.z; + } + + // M += a*a.t() + inline void Rank1Add(const Vector3 &a) + { + v[0] += a.x*a.x; v[1] += a.x*a.y; v[2] += a.x*a.z; + v[3] += a.y*a.y; v[4] += a.y*a.z; + v[5] += a.z*a.z; + } + + // M -= a*a.t() + inline void Rank1Sub(const Vector3 &a) + { + v[0] -= a.x*a.x; v[1] -= a.x*a.y; v[2] -= a.x*a.z; + v[3] -= a.y*a.y; v[4] -= a.y*a.z; + v[5] -= a.z*a.z; + } +}; + +typedef SymMat3 SymMat3f; +typedef SymMat3 SymMat3d; + +template +inline Matrix3 operator*(const SymMat3& a, const SymMat3& b) +{ + #define AJB_ARBC(r,c) (a(r,0)*b(0,c)+a(r,1)*b(1,c)+a(r,2)*b(2,c)) + return Matrix3( + AJB_ARBC(0,0), AJB_ARBC(0,1), AJB_ARBC(0,2), + AJB_ARBC(1,0), AJB_ARBC(1,1), AJB_ARBC(1,2), + AJB_ARBC(2,0), AJB_ARBC(2,1), AJB_ARBC(2,2)); + #undef AJB_ARBC +} + +template +inline Matrix3 operator*(const Matrix3& a, const SymMat3& b) +{ + #define AJB_ARBC(r,c) (a(r,0)*b(0,c)+a(r,1)*b(1,c)+a(r,2)*b(2,c)) + return Matrix3( + AJB_ARBC(0,0), AJB_ARBC(0,1), AJB_ARBC(0,2), + AJB_ARBC(1,0), AJB_ARBC(1,1), AJB_ARBC(1,2), + AJB_ARBC(2,0), AJB_ARBC(2,1), AJB_ARBC(2,2)); + #undef AJB_ARBC +} + +//------------------------------------------------------------------------------------- +// ***** Angle + +// Cleanly representing the algebra of 2D rotations. +// The operations maintain the angle between -Pi and Pi, the same range as atan2. + +template +class Angle +{ +public: + enum AngularUnits + { + Radians = 0, + Degrees = 1 + }; + + Angle() : a(0) {} + + // Fix the range to be between -Pi and Pi + Angle(T a_, AngularUnits u = Radians) : a((u == Radians) ? a_ : a_*((T)MATH_DOUBLE_DEGREETORADFACTOR)) { FixRange(); } + + T Get(AngularUnits u = Radians) const { return (u == Radians) ? a : a*((T)MATH_DOUBLE_RADTODEGREEFACTOR); } + void Set(const T& x, AngularUnits u = Radians) { a = (u == Radians) ? x : x*((T)MATH_DOUBLE_DEGREETORADFACTOR); FixRange(); } + int Sign() const { if (a == 0) return 0; else return (a > 0) ? 1 : -1; } + T Abs() const { return (a >= 0) ? a : -a; } + + bool operator== (const Angle& b) const { return a == b.a; } + bool operator!= (const Angle& b) const { return a != b.a; } +// bool operator< (const Angle& b) const { return a < a.b; } +// bool operator> (const Angle& b) const { return a > a.b; } +// bool operator<= (const Angle& b) const { return a <= a.b; } +// bool operator>= (const Angle& b) const { return a >= a.b; } +// bool operator= (const T& x) { a = x; FixRange(); } + + // These operations assume a is already between -Pi and Pi. + Angle& operator+= (const Angle& b) { a = a + b.a; FastFixRange(); return *this; } + Angle& operator+= (const T& x) { a = a + x; FixRange(); return *this; } + Angle operator+ (const Angle& b) const { Angle res = *this; res += b; return res; } + Angle operator+ (const T& x) const { Angle res = *this; res += x; return res; } + Angle& operator-= (const Angle& b) { a = a - b.a; FastFixRange(); return *this; } + Angle& operator-= (const T& x) { a = a - x; FixRange(); return *this; } + Angle operator- (const Angle& b) const { Angle res = *this; res -= b; return res; } + Angle operator- (const T& x) const { Angle res = *this; res -= x; return res; } + + T Distance(const Angle& b) { T c = fabs(a - b.a); return (c <= ((T)MATH_DOUBLE_PI)) ? c : ((T)MATH_DOUBLE_TWOPI) - c; } + +private: + + // The stored angle, which should be maintained between -Pi and Pi + T a; + + // Fixes the angle range to [-Pi,Pi], but assumes no more than 2Pi away on either side + inline void FastFixRange() + { + if (a < -((T)MATH_DOUBLE_PI)) + a += ((T)MATH_DOUBLE_TWOPI); + else if (a > ((T)MATH_DOUBLE_PI)) + a -= ((T)MATH_DOUBLE_TWOPI); + } + + // Fixes the angle range to [-Pi,Pi] for any given range, but slower then the fast method + inline void FixRange() + { + // do nothing if the value is already in the correct range, since fmod call is expensive + if (a >= -((T)MATH_DOUBLE_PI) && a <= ((T)MATH_DOUBLE_PI)) + return; + a = fmod(a,((T)MATH_DOUBLE_TWOPI)); + if (a < -((T)MATH_DOUBLE_PI)) + a += ((T)MATH_DOUBLE_TWOPI); + else if (a > ((T)MATH_DOUBLE_PI)) + a -= ((T)MATH_DOUBLE_TWOPI); + } +}; + + +typedef Angle Anglef; +typedef Angle Angled; + + +//------------------------------------------------------------------------------------- +// ***** Plane + +// Consists of a normal vector and distance from the origin where the plane is located. + +template +class Plane +{ +public: + Vector3 N; + T D; + + Plane() : D(0) {} + + // Normals must already be normalized + Plane(const Vector3& n, T d) : N(n), D(d) {} + Plane(T x, T y, T z, T d) : N(x,y,z), D(d) {} + + // construct from a point on the plane and the normal + Plane(const Vector3& p, const Vector3& n) : N(n), D(-(p * n)) {} + + // Find the point to plane distance. The sign indicates what side of the plane the point is on (0 = point on plane). + T TestSide(const Vector3& p) const + { + return (N.Dot(p)) + D; + } + + Plane Flipped() const + { + return Plane(-N, -D); + } + + void Flip() + { + N = -N; + D = -D; + } + + bool operator==(const Plane& rhs) const + { + return (this->D == rhs.D && this->N == rhs.N); + } +}; + +typedef Plane Planef; +typedef Plane Planed; + + + + +//----------------------------------------------------------------------------------- +// ***** ScaleAndOffset2D + +struct ScaleAndOffset2D +{ + Vector2f Scale; + Vector2f Offset; + + ScaleAndOffset2D(float sx = 0.0f, float sy = 0.0f, float ox = 0.0f, float oy = 0.0f) + : Scale(sx, sy), Offset(ox, oy) + { } +}; + + +//----------------------------------------------------------------------------------- +// ***** FovPort + +// FovPort describes Field Of View (FOV) of a viewport. +// This class has values for up, down, left and right, stored in +// tangent of the angle units to simplify calculations. +// +// As an example, for a standard 90 degree vertical FOV, we would +// have: { UpTan = tan(90 degrees / 2), DownTan = tan(90 degrees / 2) }. +// +// CreateFromRadians/Degrees helper functions can be used to +// access FOV in different units. + + +// ***** FovPort + +struct FovPort +{ + float UpTan; + float DownTan; + float LeftTan; + float RightTan; + + FovPort ( float sideTan = 0.0f ) : + UpTan(sideTan), DownTan(sideTan), LeftTan(sideTan), RightTan(sideTan) { } + FovPort ( float u, float d, float l, float r ) : + UpTan(u), DownTan(d), LeftTan(l), RightTan(r) { } + + // C-interop support: FovPort <-> ovrFovPort (implementation in OVR_CAPI.cpp). + FovPort(const ovrFovPort &src) + : UpTan(src.UpTan), DownTan(src.DownTan), LeftTan(src.LeftTan), RightTan(src.RightTan) + { } + + operator ovrFovPort () const + { + ovrFovPort result; + result.LeftTan = LeftTan; + result.RightTan = RightTan; + result.UpTan = UpTan; + result.DownTan = DownTan; + return result; + } + + static FovPort CreateFromRadians(float horizontalFov, float verticalFov) + { + FovPort result; + result.UpTan = tanf ( verticalFov * 0.5f ); + result.DownTan = tanf ( verticalFov * 0.5f ); + result.LeftTan = tanf ( horizontalFov * 0.5f ); + result.RightTan = tanf ( horizontalFov * 0.5f ); + return result; + } + + static FovPort CreateFromDegrees(float horizontalFovDegrees, + float verticalFovDegrees) + { + return CreateFromRadians(DegreeToRad(horizontalFovDegrees), + DegreeToRad(verticalFovDegrees)); + } + + // Get Horizontal/Vertical components of Fov in radians. + float GetVerticalFovRadians() const { return atanf(UpTan) + atanf(DownTan); } + float GetHorizontalFovRadians() const { return atanf(LeftTan) + atanf(RightTan); } + // Get Horizontal/Vertical components of Fov in degrees. + float GetVerticalFovDegrees() const { return RadToDegree(GetVerticalFovRadians()); } + float GetHorizontalFovDegrees() const { return RadToDegree(GetHorizontalFovRadians()); } + + // Compute maximum tangent value among all four sides. + float GetMaxSideTan() const + { + return OVRMath_Max(OVRMath_Max(UpTan, DownTan), OVRMath_Max(LeftTan, RightTan)); + } + + static ScaleAndOffset2D CreateNDCScaleAndOffsetFromFov ( FovPort tanHalfFov ) + { + float projXScale = 2.0f / ( tanHalfFov.LeftTan + tanHalfFov.RightTan ); + float projXOffset = ( tanHalfFov.LeftTan - tanHalfFov.RightTan ) * projXScale * 0.5f; + float projYScale = 2.0f / ( tanHalfFov.UpTan + tanHalfFov.DownTan ); + float projYOffset = ( tanHalfFov.UpTan - tanHalfFov.DownTan ) * projYScale * 0.5f; + + ScaleAndOffset2D result; + result.Scale = Vector2f(projXScale, projYScale); + result.Offset = Vector2f(projXOffset, projYOffset); + // Hey - why is that Y.Offset negated? + // It's because a projection matrix transforms from world coords with Y=up, + // whereas this is from NDC which is Y=down. + + return result; + } + + // Converts Fov Tan angle units to [-1,1] render target NDC space + Vector2f TanAngleToRendertargetNDC(Vector2f const &tanEyeAngle) + { + ScaleAndOffset2D eyeToSourceNDC = CreateNDCScaleAndOffsetFromFov(*this); + return tanEyeAngle * eyeToSourceNDC.Scale + eyeToSourceNDC.Offset; + } + + // Compute per-channel minimum and maximum of Fov. + static FovPort Min(const FovPort& a, const FovPort& b) + { + FovPort fov( OVRMath_Min( a.UpTan , b.UpTan ), + OVRMath_Min( a.DownTan , b.DownTan ), + OVRMath_Min( a.LeftTan , b.LeftTan ), + OVRMath_Min( a.RightTan, b.RightTan ) ); + return fov; + } + + static FovPort Max(const FovPort& a, const FovPort& b) + { + FovPort fov( OVRMath_Max( a.UpTan , b.UpTan ), + OVRMath_Max( a.DownTan , b.DownTan ), + OVRMath_Max( a.LeftTan , b.LeftTan ), + OVRMath_Max( a.RightTan, b.RightTan ) ); + return fov; + } +}; + + +} // Namespace OVR + + +#if defined(_MSC_VER) + #pragma warning(pop) +#endif + + +#endif diff --git a/extern/OculusSDK/LibOVR/Include/Extras/OVR_StereoProjection.h b/extern/OculusSDK/LibOVR/Include/Extras/OVR_StereoProjection.h new file mode 100644 index 0000000..962a821 --- /dev/null +++ b/extern/OculusSDK/LibOVR/Include/Extras/OVR_StereoProjection.h @@ -0,0 +1,70 @@ +/************************************************************************************ + +Filename : OVR_StereoProjection.h +Content : Stereo projection functions +Created : November 30, 2013 +Authors : Tom Fosyth + +Copyright : Copyright 2014 Oculus VR, LLC All Rights reserved. + +Licensed under the Oculus VR Rift SDK License Version 3.2 (the "License"); +you may not use the Oculus VR Rift SDK except in compliance with the License, +which is provided at the time of installation or download, or which +otherwise accompanies this software in either electronic or hard copy form. + +You may obtain a copy of the License at + +http://www.oculusvr.com/licenses/LICENSE-3.2 + +Unless required by applicable law or agreed to in writing, the Oculus VR SDK +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +*************************************************************************************/ + +#ifndef OVR_StereoProjection_h +#define OVR_StereoProjection_h + + +#include "Extras/OVR_Math.h" + + +namespace OVR { + + +//----------------------------------------------------------------------------------- +// ***** Stereo Enumerations + +// StereoEye specifies which eye we are rendering for; it is used to +// retrieve StereoEyeParams. +enum StereoEye +{ + StereoEye_Left, + StereoEye_Right, + StereoEye_Center +}; + + + +//----------------------------------------------------------------------------------- +// ***** Propjection functions + +Matrix4f CreateProjection ( bool rightHanded, bool isOpenGL, FovPort fov, StereoEye eye, + float zNear = 0.01f, float zFar = 10000.0f, + bool flipZ = false, bool farAtInfinity = false); + +Matrix4f CreateOrthoSubProjection ( bool rightHanded, StereoEye eyeType, + float tanHalfFovX, float tanHalfFovY, + float unitsX, float unitsY, float distanceFromCamera, + float interpupillaryDistance, Matrix4f const &projection, + float zNear = 0.0f, float zFar = 0.0f, + bool flipZ = false, bool farAtInfinity = false); + +ScaleAndOffset2D CreateNDCScaleAndOffsetFromFov ( FovPort fov ); + + +} //namespace OVR + +#endif // OVR_StereoProjection_h diff --git a/extern/OculusSDK/LibOVR/Include/OVR.h b/extern/OculusSDK/LibOVR/Include/OVR.h new file mode 100644 index 0000000..1c9d201 --- /dev/null +++ b/extern/OculusSDK/LibOVR/Include/OVR.h @@ -0,0 +1,21 @@ +/********************************************************************************//** +\file OVR.h +\brief The main public interface to Oculus for C++ Developers. +\copyright Copyright 2015 Oculus VR, LLC All Rights reserved. +*************************************************************************************/ + +#ifndef OVR_h +#define OVR_h + +#include "OVR_Version.h" +#include "OVR_CAPI.h" + +/* The following includes are deprecated from this location and will be removed from a future version of this library. */ +#include "Kernel/OVR_Types.h" +#include "Kernel/OVR_RefCount.h" +#include "Kernel/OVR_Std.h" +#include "Kernel/OVR_Alg.h" +#include "Extras/OVR_Math.h" + +#endif + diff --git a/extern/OculusSDK/LibOVR/Include/OVR_CAPI.h b/extern/OculusSDK/LibOVR/Include/OVR_CAPI.h new file mode 100644 index 0000000..848d182 --- /dev/null +++ b/extern/OculusSDK/LibOVR/Include/OVR_CAPI.h @@ -0,0 +1 @@ +#include "OVR_CAPI_0_8_0.h" diff --git a/extern/OculusSDK/LibOVR/Include/OVR_CAPI_0_8_0.h b/extern/OculusSDK/LibOVR/Include/OVR_CAPI_0_8_0.h new file mode 100644 index 0000000..49f0146 --- /dev/null +++ b/extern/OculusSDK/LibOVR/Include/OVR_CAPI_0_8_0.h @@ -0,0 +1,2009 @@ +/********************************************************************************//** +\file OVR_CAPI_0_8_0.h +\brief C Interface to the Oculus PC SDK tracking and rendering library. +\copyright Copyright 2014 Oculus VR, LLC All Rights reserved. +************************************************************************************/ + +#ifndef OVR_CAPI_h // We don't use version numbers within this name, as all versioned variations of this file are currently mutually exclusive. +#define OVR_CAPI_h ///< Header include guard + + +#include "OVR_CAPI_Keys.h" +#include "OVR_Version.h" +#include "OVR_ErrorCode.h" + + +#include + +#if defined(_MSC_VER) + #pragma warning(push) + #pragma warning(disable: 4324) // structure was padded due to __declspec(align()) + #pragma warning(disable: 4359) // The alignment specified for a type is less than the alignment of the type of one of its data members +#endif + + + +//----------------------------------------------------------------------------------- +// ***** OVR_OS +// +#if !defined(OVR_OS_WIN32) && defined(_WIN32) + #define OVR_OS_WIN32 +#endif + +#if !defined(OVR_OS_MAC) && defined(__APPLE__) + #define OVR_OS_MAC +#endif + +#if !defined(OVR_OS_LINUX) && defined(__linux__) + #define OVR_OS_LINUX +#endif + + + +//----------------------------------------------------------------------------------- +// ***** OVR_CPP +// +#if !defined(OVR_CPP) + #if defined(__cplusplus) + #define OVR_CPP(x) x + #else + #define OVR_CPP(x) /* Not C++ */ + #endif +#endif + + + +//----------------------------------------------------------------------------------- +// ***** OVR_CDECL +// +/// LibOVR calling convention for 32-bit Windows builds. +// +#if !defined(OVR_CDECL) + #if defined(_WIN32) + #define OVR_CDECL __cdecl + #else + #define OVR_CDECL + #endif +#endif + + + +//----------------------------------------------------------------------------------- +// ***** OVR_EXTERN_C +// +/// Defined as extern "C" when built from C++ code. +// +#if !defined(OVR_EXTERN_C) + #ifdef __cplusplus + #define OVR_EXTERN_C extern "C" + #else + #define OVR_EXTERN_C + #endif +#endif + + + +//----------------------------------------------------------------------------------- +// ***** OVR_PUBLIC_FUNCTION / OVR_PRIVATE_FUNCTION +// +// OVR_PUBLIC_FUNCTION - Functions that externally visible from a shared library. Corresponds to Microsoft __dllexport. +// OVR_PUBLIC_CLASS - C++ structs and classes that are externally visible from a shared library. Corresponds to Microsoft __dllexport. +// OVR_PRIVATE_FUNCTION - Functions that are not visible outside of a shared library. They are private to the shared library. +// OVR_PRIVATE_CLASS - C++ structs and classes that are not visible outside of a shared library. They are private to the shared library. +// +// OVR_DLL_BUILD - Used to indicate that the current compilation unit is of a shared library. +// OVR_DLL_IMPORT - Used to indicate that the current compilation unit is a user of the corresponding shared library. +// OVR_DLL_BUILD - used to indicate that the current compilation unit is not a shared library but rather statically linked code. +// +#if !defined(OVR_PUBLIC_FUNCTION) + #if defined(OVR_DLL_BUILD) + #if defined(_WIN32) + #define OVR_PUBLIC_FUNCTION(rval) OVR_EXTERN_C __declspec(dllexport) rval OVR_CDECL + #define OVR_PUBLIC_CLASS __declspec(dllexport) + #define OVR_PRIVATE_FUNCTION(rval) rval OVR_CDECL + #define OVR_PRIVATE_CLASS + #else + #define OVR_PUBLIC_FUNCTION(rval) OVR_EXTERN_C __attribute__((visibility("default"))) rval OVR_CDECL /* Requires GCC 4.0+ */ + #define OVR_PUBLIC_CLASS __attribute__((visibility("default"))) /* Requires GCC 4.0+ */ + #define OVR_PRIVATE_FUNCTION(rval) __attribute__((visibility("hidden"))) rval OVR_CDECL + #define OVR_PRIVATE_CLASS __attribute__((visibility("hidden"))) + #endif + #elif defined(OVR_DLL_IMPORT) + #if defined(_WIN32) + #define OVR_PUBLIC_FUNCTION(rval) OVR_EXTERN_C __declspec(dllimport) rval OVR_CDECL + #define OVR_PUBLIC_CLASS __declspec(dllimport) + #else + #define OVR_PUBLIC_FUNCTION(rval) OVR_EXTERN_C rval OVR_CDECL + #define OVR_PUBLIC_CLASS + #endif + #define OVR_PRIVATE_FUNCTION(rval) rval OVR_CDECL + #define OVR_PRIVATE_CLASS + #else // OVR_STATIC_BUILD + #define OVR_PUBLIC_FUNCTION(rval) OVR_EXTERN_C rval OVR_CDECL + #define OVR_PUBLIC_CLASS + #define OVR_PRIVATE_FUNCTION(rval) rval OVR_CDECL + #define OVR_PRIVATE_CLASS + #endif +#endif + + +//----------------------------------------------------------------------------------- +// ***** OVR_EXPORT +// +/// Provided for backward compatibility with older versions of this library. +// +#if !defined(OVR_EXPORT) + #ifdef OVR_OS_WIN32 + #define OVR_EXPORT __declspec(dllexport) + #else + #define OVR_EXPORT + #endif +#endif + + + +//----------------------------------------------------------------------------------- +// ***** OVR_ALIGNAS +// +#if !defined(OVR_ALIGNAS) + #if defined(__GNUC__) || defined(__clang__) + #define OVR_ALIGNAS(n) __attribute__((aligned(n))) + #elif defined(_MSC_VER) || defined(__INTEL_COMPILER) + #define OVR_ALIGNAS(n) __declspec(align(n)) + #elif defined(__CC_ARM) + #define OVR_ALIGNAS(n) __align(n) + #else + #error Need to define OVR_ALIGNAS + #endif +#endif + + +//----------------------------------------------------------------------------------- +// ***** OVR_CC_HAS_FEATURE +// +// This is a portable way to use compile-time feature identification available +// with some compilers in a clean way. Direct usage of __has_feature in preprocessing +// statements of non-supporting compilers results in a preprocessing error. +// +// Example usage: +// #if OVR_CC_HAS_FEATURE(is_pod) +// if(__is_pod(T)) // If the type is plain data then we can safely memcpy it. +// memcpy(&destObject, &srcObject, sizeof(object)); +// #endif +// +#if !defined(OVR_CC_HAS_FEATURE) + #if defined(__clang__) // http://clang.llvm.org/docs/LanguageExtensions.html#id2 + #define OVR_CC_HAS_FEATURE(x) __has_feature(x) + #else + #define OVR_CC_HAS_FEATURE(x) 0 + #endif +#endif + + +// ------------------------------------------------------------------------ +// ***** OVR_STATIC_ASSERT +// +// Portable support for C++11 static_assert(). +// Acts as if the following were declared: +// void OVR_STATIC_ASSERT(bool const_expression, const char* msg); +// +// Example usage: +// OVR_STATIC_ASSERT(sizeof(int32_t) == 4, "int32_t expected to be 4 bytes."); + +#if !defined(OVR_STATIC_ASSERT) + #if !(defined(__cplusplus) && (__cplusplus >= 201103L)) /* Other */ && \ + !(defined(__GXX_EXPERIMENTAL_CXX0X__)) /* GCC */ && \ + !(defined(__clang__) && defined(__cplusplus) && OVR_CC_HAS_FEATURE(cxx_static_assert)) /* clang */ && \ + !(defined(_MSC_VER) && (_MSC_VER >= 1600) && defined(__cplusplus)) /* VS2010+ */ + + #if !defined(OVR_SA_UNUSED) + #if defined(OVR_CC_GNU) || defined(OVR_CC_CLANG) + #define OVR_SA_UNUSED __attribute__((unused)) + #else + #define OVR_SA_UNUSED + #endif + #define OVR_SA_PASTE(a,b) a##b + #define OVR_SA_HELP(a,b) OVR_SA_PASTE(a,b) + #endif + + #if defined(__COUNTER__) + #define OVR_STATIC_ASSERT(expression, msg) typedef char OVR_SA_HELP(compileTimeAssert, __COUNTER__) [((expression) != 0) ? 1 : -1] OVR_SA_UNUSED + #else + #define OVR_STATIC_ASSERT(expression, msg) typedef char OVR_SA_HELP(compileTimeAssert, __LINE__) [((expression) != 0) ? 1 : -1] OVR_SA_UNUSED + #endif + + #else + #define OVR_STATIC_ASSERT(expression, msg) static_assert(expression, msg) + #endif +#endif + + +//----------------------------------------------------------------------------------- +// ***** Padding +// +/// Defines explicitly unused space for a struct. +/// When used correcly, usage of this macro should not change the size of the struct. +/// Compile-time and runtime behavior with and without this defined should be identical. +/// +#if !defined(OVR_UNUSED_STRUCT_PAD) + #define OVR_UNUSED_STRUCT_PAD(padName, size) char padName[size]; +#endif + + +//----------------------------------------------------------------------------------- +// ***** Word Size +// +/// Specifies the size of a pointer on the given platform. +/// +#if !defined(OVR_PTR_SIZE) + #if defined(__WORDSIZE) + #define OVR_PTR_SIZE ((__WORDSIZE) / 8) + #elif defined(_WIN64) || defined(__LP64__) || defined(_LP64) || defined(_M_IA64) || defined(__ia64__) || defined(__arch64__) || defined(__64BIT__) || defined(__Ptr_Is_64) + #define OVR_PTR_SIZE 8 + #elif defined(__CC_ARM) && (__sizeof_ptr == 8) + #define OVR_PTR_SIZE 8 + #else + #define OVR_PTR_SIZE 4 + #endif +#endif + + +//----------------------------------------------------------------------------------- +// ***** OVR_ON32 / OVR_ON64 +// +#if OVR_PTR_SIZE == 8 + #define OVR_ON32(x) + #define OVR_ON64(x) x +#else + #define OVR_ON32(x) x + #define OVR_ON64(x) +#endif + + +//----------------------------------------------------------------------------------- +// ***** ovrBool + +typedef char ovrBool; ///< Boolean type +#define ovrFalse 0 ///< ovrBool value of false. +#define ovrTrue 1 ///< ovrBool value of true. + + +//----------------------------------------------------------------------------------- +// ***** Simple Math Structures + +/// A 2D vector with integer components. +typedef struct OVR_ALIGNAS(4) ovrVector2i_ +{ + int x, y; +} ovrVector2i; + +/// A 2D size with integer components. +typedef struct OVR_ALIGNAS(4) ovrSizei_ +{ + int w, h; +} ovrSizei; + +/// A 2D rectangle with a position and size. +/// All components are integers. +typedef struct OVR_ALIGNAS(4) ovrRecti_ +{ + ovrVector2i Pos; + ovrSizei Size; +} ovrRecti; + +/// A quaternion rotation. +typedef struct OVR_ALIGNAS(4) ovrQuatf_ +{ + float x, y, z, w; +} ovrQuatf; + +/// A 2D vector with float components. +typedef struct OVR_ALIGNAS(4) ovrVector2f_ +{ + float x, y; +} ovrVector2f; + +/// A 3D vector with float components. +typedef struct OVR_ALIGNAS(4) ovrVector3f_ +{ + float x, y, z; +} ovrVector3f; + +/// A 4x4 matrix with float elements. +typedef struct OVR_ALIGNAS(4) ovrMatrix4f_ +{ + float M[4][4]; +} ovrMatrix4f; + + +/// Position and orientation together. +typedef struct OVR_ALIGNAS(4) ovrPosef_ +{ + ovrQuatf Orientation; + ovrVector3f Position; +} ovrPosef; + +/// A full pose (rigid body) configuration with first and second derivatives. +/// +/// Body refers to any object for which ovrPoseStatef is providing data. +/// It can be the HMD, Touch controller, camera or something else. The context +/// depends on the usage of the struct. +typedef struct OVR_ALIGNAS(8) ovrPoseStatef_ +{ + ovrPosef ThePose; ///< Position and orientation. + ovrVector3f AngularVelocity; ///< Angular velocity in radians per second. + ovrVector3f LinearVelocity; ///< Velocity in meters per second. + ovrVector3f AngularAcceleration; ///< Angular acceleration in radians per second per second. + ovrVector3f LinearAcceleration; ///< Acceleration in meters per second per second. + OVR_UNUSED_STRUCT_PAD(pad0, 4) ///< \internal struct pad. + double TimeInSeconds; ///< Absolute time of this state sample. +} ovrPoseStatef; + +/// Describes the up, down, left, and right angles of the field of view. +/// +/// Field Of View (FOV) tangent of the angle units. +/// \note For a standard 90 degree vertical FOV, we would +/// have: { UpTan = tan(90 degrees / 2), DownTan = tan(90 degrees / 2) }. +typedef struct OVR_ALIGNAS(4) ovrFovPort_ +{ + float UpTan; ///< The tangent of the angle between the viewing vector and the top edge of the field of view. + float DownTan; ///< The tangent of the angle between the viewing vector and the bottom edge of the field of view. + float LeftTan; ///< The tangent of the angle between the viewing vector and the left edge of the field of view. + float RightTan; ///< The tangent of the angle between the viewing vector and the right edge of the field of view. +} ovrFovPort; + + +//----------------------------------------------------------------------------------- +// ***** HMD Types + +/// Enumerates all HMD types that we support. +/// +/// The currently released developer kits are ovrHmd_DK1 and ovrHmd_DK2. The other enumerations are for internal use only. +typedef enum ovrHmdType_ +{ + ovrHmd_None = 0, + ovrHmd_DK1 = 3, + ovrHmd_DKHD = 4, + ovrHmd_DK2 = 6, + ovrHmd_CB = 8, + ovrHmd_Other = 9, + ovrHmd_E3_2015 = 10, + ovrHmd_ES06 = 11, + ovrHmd_ES09 = 12, + ovrHmd_EnumSize = 0x7fffffff ///< \internal Force type int32_t. +} ovrHmdType; + + +/// HMD capability bits reported by device. +/// +/// Set (read/write) flags through ovr_SetEnabledCaps() +typedef enum ovrHmdCaps_ +{ + // Read-only flags. + ovrHmdCap_DebugDevice = 0x0010, ///< (read only) Specifies that the HMD is a virtual debug device. + + + /// Indicates to the developer what caps they can and cannot modify. These are processed by the client. + ovrHmdCap_Writable_Mask = 0x0000, + + ovrHmdCap_Service_Mask = 0x0000, + + ovrHmdCap_EnumSize = 0x7fffffff ///< \internal Force type int32_t. +} ovrHmdCaps; + + +/// Tracking capability bits reported by the device. +/// Used with ovr_ConfigureTracking. +typedef enum ovrTrackingCaps_ +{ + ovrTrackingCap_Orientation = 0x0010, ///< Supports orientation tracking (IMU). + ovrTrackingCap_MagYawCorrection = 0x0020, ///< Supports yaw drift correction via a magnetometer or other means. + ovrTrackingCap_Position = 0x0040, ///< Supports positional tracking. + ovrTrackingCap_EnumSize = 0x7fffffff ///< \internal Force type int32_t. +} ovrTrackingCaps; + + +/// Specifies which eye is being used for rendering. +/// This type explicitly does not include a third "NoStereo" monoscopic option, as such is +/// not required for an HMD-centered API. +typedef enum ovrEyeType_ +{ + ovrEye_Left = 0, ///< The left eye, from the viewer's perspective. + ovrEye_Right = 1, ///< The right eye, from the viewer's perspective. + ovrEye_Count = 2, ///< \internal Count of enumerated elements. + ovrEye_EnumSize = 0x7fffffff ///< \internal Force type int32_t. +} ovrEyeType; + + +typedef struct OVR_ALIGNAS(OVR_PTR_SIZE) ovrGraphicsLuid_ +{ + // Public definition reserves space for graphics API-specific implementation + char Reserved[8]; +} ovrGraphicsLuid; + + +/// This is a complete descriptor of the HMD. +typedef struct OVR_ALIGNAS(OVR_PTR_SIZE) ovrHmdDesc_ +{ + ovrHmdType Type; ///< The type of HMD. + OVR_ON64(OVR_UNUSED_STRUCT_PAD(pad0, 4)) ///< \internal struct paddding. + char ProductName[64]; ///< UTF8-encoded product identification string (e.g. "Oculus Rift DK1"). + char Manufacturer[64]; ///< UTF8-encoded HMD manufacturer identification string. + short VendorId; ///< HID (USB) vendor identifier of the device. + short ProductId; ///< HID (USB) product identifier of the device. + char SerialNumber[24]; ///< Sensor (and display) serial number. + short FirmwareMajor; ///< Sensor firmware major version. + short FirmwareMinor; ///< Sensor firmware minor version. + float CameraFrustumHFovInRadians; ///< External tracking camera frustum horizontal field-of-view (if present). + float CameraFrustumVFovInRadians; ///< External tracking camera frustum vertical field-of-view (if present). + float CameraFrustumNearZInMeters; ///< External tracking camera frustum near Z (if present). + float CameraFrustumFarZInMeters; ///< External tracking camera frustum far Z (if present). + unsigned int AvailableHmdCaps; ///< Capability bits described by ovrHmdCaps which the HMD currently supports. + unsigned int DefaultHmdCaps; ///< Capability bits described by ovrHmdCaps which are default for the current Hmd. + unsigned int AvailableTrackingCaps; ///< Capability bits described by ovrTrackingCaps which the system currently supports. + unsigned int DefaultTrackingCaps; ///< Capability bits described by ovrTrackingCaps which are default for the current system. + ovrFovPort DefaultEyeFov[ovrEye_Count]; ///< Defines the recommended FOVs for the HMD. + ovrFovPort MaxEyeFov[ovrEye_Count]; ///< Defines the maximum FOVs for the HMD. + ovrSizei Resolution; ///< Resolution of the full HMD screen (both eyes) in pixels. + float DisplayRefreshRate; ///< Nominal refresh rate of the display in cycles per second at the time of HMD creation. + OVR_ON64(OVR_UNUSED_STRUCT_PAD(pad1, 4)) ///< \internal struct paddding. +} ovrHmdDesc; + + +/// Used as an opaque pointer to an OVR session. +typedef struct ovrHmdStruct* ovrSession; + +/// Deprecated synonym for ovrSession, to be removed in a future SDK. +typedef struct ovrHmdStruct* ovrHmd; + + + +/// Bit flags describing the current status of sensor tracking. +/// The values must be the same as in enum StatusBits +/// +/// \see ovrTrackingState +/// +typedef enum ovrStatusBits_ +{ + ovrStatus_OrientationTracked = 0x0001, ///< Orientation is currently tracked (connected and in use). + ovrStatus_PositionTracked = 0x0002, ///< Position is currently tracked (false if out of range). + ovrStatus_CameraPoseTracked = 0x0004, ///< Camera pose is currently tracked. + ovrStatus_PositionConnected = 0x0020, ///< Position tracking hardware is connected. + ovrStatus_HmdConnected = 0x0080, ///< HMD Display is available and connected. + ovrStatus_EnumSize = 0x7fffffff ///< \internal Force type int32_t. +} ovrStatusBits; + + +/// Specifies a reading we can query from the sensor. +/// +/// \see ovrTrackingState +/// +typedef struct OVR_ALIGNAS(4) ovrSensorData_ +{ + ovrVector3f Accelerometer; ///< Acceleration reading in meters/second^2. + ovrVector3f Gyro; ///< Rotation rate in radians/second. + ovrVector3f Magnetometer; ///< Magnetic field in Gauss. + float Temperature; ///< Temperature of the sensor in degrees Celsius. + float TimeInSeconds; ///< Time when the reported IMU reading took place in seconds. \see ovr_GetTimeInSeconds +} ovrSensorData; + + +/// Tracking state at a given absolute time (describes predicted HMD pose, etc.). +/// Returned by ovr_GetTrackingState. +/// +/// \see ovr_GetTrackingState +/// +typedef struct OVR_ALIGNAS(8) ovrTrackingState_ +{ + /// Predicted head pose (and derivatives) at the requested absolute time. + /// The look-ahead interval is equal to (HeadPose.TimeInSeconds - RawSensorData.TimeInSeconds). + ovrPoseStatef HeadPose; + + /// Current pose of the external camera (if present). + /// This pose includes camera tilt (roll and pitch). For a leveled coordinate + /// system use LeveledCameraPose. + ovrPosef CameraPose; + + /// Camera frame aligned with gravity. + /// This value includes position and yaw of the camera, but not roll and pitch. + /// It can be used as a reference point to render real-world objects in the correct location. + ovrPosef LeveledCameraPose; + + /// The most recent calculated pose for each hand when hand controller tracking is present. + /// HandPoses[ovrHand_Left] refers to the left hand and HandPoses[ovrHand_Right] to the right hand. + /// These values can be combined with ovrInputState for complete hand controller information. + ovrPoseStatef HandPoses[2]; + + /// The most recent sensor data received from the HMD. + ovrSensorData RawSensorData; + + /// Tracking status described by ovrStatusBits. + unsigned int StatusFlags; + + /// Hand status flags described by ovrStatusBits. + /// Only ovrStatus_OrientationTracked and ovrStatus_PositionTracked are reported. + unsigned int HandStatusFlags[2]; + + /// Tags the vision processing results to a certain frame counter number. + uint32_t LastCameraFrameCounter; + + OVR_UNUSED_STRUCT_PAD(pad0, 4) ///< \internal struct padding + +} ovrTrackingState; + + +/// Rendering information for each eye. Computed by ovr_GetRenderDesc() based on the +/// specified FOV. Note that the rendering viewport is not included +/// here as it can be specified separately and modified per frame by +/// passing different Viewport values in the layer structure. +/// +/// \see ovr_GetRenderDesc +/// +typedef struct OVR_ALIGNAS(4) ovrEyeRenderDesc_ +{ + ovrEyeType Eye; ///< The eye index to which this instance corresponds. + ovrFovPort Fov; ///< The field of view. + ovrRecti DistortedViewport; ///< Distortion viewport. + ovrVector2f PixelsPerTanAngleAtCenter; ///< How many display pixels will fit in tan(angle) = 1. + ovrVector3f HmdToEyeViewOffset; ///< Translation of each eye. +} ovrEyeRenderDesc; + + +/// Projection information for ovrLayerEyeFovDepth. +/// +/// Use the utility function ovrTimewarpProjectionDesc_FromProjection to +/// generate this structure from the application's projection matrix. +/// +/// \see ovrLayerEyeFovDepth, ovrTimewarpProjectionDesc_FromProjection +/// +typedef struct OVR_ALIGNAS(4) ovrTimewarpProjectionDesc_ +{ + float Projection22; ///< Projection matrix element [2][2]. + float Projection23; ///< Projection matrix element [2][3]. + float Projection32; ///< Projection matrix element [3][2]. +} ovrTimewarpProjectionDesc; + + +/// Contains the data necessary to properly calculate position info for various layer types. +/// - HmdToEyeViewOffset is the same value pair provided in ovrEyeRenderDesc. +/// - HmdSpaceToWorldScaleInMeters is used to scale player motion into in-application units. +/// In other words, it is how big an in-application unit is in the player's physical meters. +/// For example, if the application uses inches as its units then HmdSpaceToWorldScaleInMeters would be 0.0254. +/// Note that if you are scaling the player in size, this must also scale. So if your application +/// units are inches, but you're shrinking the player to half their normal size, then +/// HmdSpaceToWorldScaleInMeters would be 0.0254*2.0. +/// +/// \see ovrEyeRenderDesc, ovr_SubmitFrame +/// +typedef struct OVR_ALIGNAS(4) ovrViewScaleDesc_ +{ + ovrVector3f HmdToEyeViewOffset[ovrEye_Count]; ///< Translation of each eye. + float HmdSpaceToWorldScaleInMeters; ///< Ratio of viewer units to meter units. +} ovrViewScaleDesc; + + +//----------------------------------------------------------------------------------- +// ***** Platform-independent Rendering Configuration + +/// These types are used to hide platform-specific details when passing +/// render device, OS, and texture data to the API. +/// +/// The benefit of having these wrappers versus platform-specific API functions is +/// that they allow application glue code to be portable. A typical example is an +/// engine that has multiple back ends, such as GL and D3D. Portable code that calls +/// these back ends can also use LibOVR. To do this, back ends can be modified +/// to return portable types such as ovrTexture and ovrRenderAPIConfig. +typedef enum ovrRenderAPIType_ +{ + ovrRenderAPI_None = 0, ///< No API + ovrRenderAPI_OpenGL = 1, ///< OpenGL + ovrRenderAPI_Android_GLES = 2, ///< OpenGL ES + ovrRenderAPI_D3D11 = 5, ///< DirectX 11. + ovrRenderAPI_Count = 4, ///< \internal Count of enumerated elements. + ovrRenderAPI_EnumSize = 0x7fffffff ///< \internal Force type int32_t. +} ovrRenderAPIType; + + +/// API-independent part of a texture descriptor. +/// +/// ovrTextureHeader is a common struct present in all ovrTexture struct types. +/// +typedef struct OVR_ALIGNAS(4) ovrTextureHeader_ +{ + ovrRenderAPIType API; ///< The API type to which this texture belongs. + ovrSizei TextureSize; ///< Size of this texture in pixels. +} ovrTextureHeader; + + +/// Contains platform-specific information about a texture. +/// Aliases to one of ovrD3D11Texture or ovrGLTexture. +/// +/// \see ovrD3D11Texture, ovrGLTexture. +/// +typedef struct OVR_ALIGNAS(OVR_PTR_SIZE) ovrTexture_ +{ + ovrTextureHeader Header; ///< API-independent header. + OVR_ON64(OVR_UNUSED_STRUCT_PAD(pad0, 4)) ///< \internal struct padding + uintptr_t PlatformData[8]; ///< Specialized in ovrGLTextureData, ovrD3D11TextureData etc. +} ovrTexture; + + +/// Describes a set of textures that act as a rendered flip chain. +/// +/// An ovrSwapTextureSet per layer is passed to ovr_SubmitFrame via one of the ovrLayer types. +/// The TextureCount refers to the flip chain count and not an eye count. +/// See the layer structs and functions for information about how to use ovrSwapTextureSet. +/// +/// ovrSwapTextureSets must be created by either the ovr_CreateSwapTextureSetD3D11 or +/// ovr_CreateSwapTextureSetGL factory function, and must be destroyed by ovr_DestroySwapTextureSet. +/// +/// \see ovr_CreateSwapTextureSetD3D11, ovr_CreateSwapTextureSetGL, ovr_DestroySwapTextureSet. +/// +typedef struct OVR_ALIGNAS(OVR_PTR_SIZE) ovrSwapTextureSet_ +{ + ovrTexture* Textures; ///< Points to an array of ovrTextures. + int TextureCount; ///< The number of textures referenced by the Textures array. + + /// CurrentIndex specifies which of the Textures will be used by the ovr_SubmitFrame call. + /// This is manually incremented by the application, typically in a round-robin manner. + /// + /// Before selecting a Texture as a rendertarget, the application should increment CurrentIndex by + /// 1 and wrap it back to 0 if CurrentIndex == TextureCount, so that it gets a fresh rendertarget, + /// one that is not currently being used for display. It can then render to Textures[CurrentIndex]. + /// + /// After rendering, the application calls ovr_SubmitFrame using that same CurrentIndex value + /// to display the new rendertarget. + /// + /// The application can submit multiple frames with the same ovrSwapTextureSet and CurrentIndex + /// value if the rendertarget does not need to be updated, for example when displaying an + /// information display whose text has not changed since the previous frame. + /// + /// Multiple layers can use the same ovrSwapTextureSet at the same time - there is no need to + /// create a unique ovrSwapTextureSet for each layer. However, all the layers using a particular + /// ovrSwapTextureSet will share the same value of CurrentIndex, so they cannot use different + /// textures within the ovrSwapTextureSet. + /// + /// Once a particular Textures[CurrentIndex] has been sent to ovr_SubmitFrame, that texture + /// should not be rendered to until a subsequent ovr_SubmitFrame is made (either with a + /// different CurrentIndex value, or with a different ovrSwapTextureSet, or disabling the layer). + int CurrentIndex; +} ovrSwapTextureSet; + + + +//----------------------------------------------------------------------------------- + +/// Describes button input types. +/// Button inputs are combined; that is they will be reported as pressed if they are +/// pressed on either one of the two devices. +/// The ovrButton_Up/Down/Left/Right map to both XBox D-Pad and directional buttons. +/// The ovrButton_Enter and ovrButton_Return map to Start and Back controller buttons, respectively. +typedef enum ovrButton_ +{ + ovrButton_A = 0x00000001, + ovrButton_B = 0x00000002, + ovrButton_RThumb = 0x00000004, + ovrButton_RShoulder = 0x00000008, + ovrButton_X = 0x00000100, + ovrButton_Y = 0x00000200, + ovrButton_LThumb = 0x00000400, + ovrButton_LShoulder = 0x00000800, + + // Navigation through DPad. + ovrButton_Up = 0x00010000, + ovrButton_Down = 0x00020000, + ovrButton_Left = 0x00040000, + ovrButton_Right = 0x00080000, + ovrButton_Enter = 0x00100000, // Start on XBox controller. + ovrButton_Back = 0x00200000, // Back on Xbox controller. + + ovrButton_Private = 0x00400000 | 0x00800000 | 0x01000000, + + ovrButton_EnumSize = 0x7fffffff ///< \internal Force type int32_t. +} ovrButton; + +/// Describes touch input types. +/// These values map to capacitive touch values reported ovrInputState::Touch. +/// Some of these values are mapped to button bits for consistency. +typedef enum ovrTouch_ +{ + ovrTouch_A = ovrButton_A, + ovrTouch_B = ovrButton_B, + ovrTouch_RThumb = ovrButton_RThumb, + ovrTouch_RIndexTrigger = 0x00000010, + ovrTouch_X = ovrButton_X, + ovrTouch_Y = ovrButton_Y, + ovrTouch_LThumb = ovrButton_LThumb, + ovrTouch_LIndexTrigger = 0x00001000, + + // Finger pose state + // Derived internally based on distance, proximity to sensors and filtering. + ovrTouch_RIndexPointing = 0x00000020, + ovrTouch_RThumbUp = 0x00000040, + ovrTouch_LIndexPointing = 0x00002000, + ovrTouch_LThumbUp = 0x00004000, + + ovrTouch_EnumSize = 0x7fffffff ///< \internal Force type int32_t. +} ovrTouch; + +/// Specifies which controller is connected; multiple can be connected at once. +typedef enum ovrControllerType_ +{ + ovrControllerType_None = 0x00, + ovrControllerType_LTouch = 0x01, + ovrControllerType_RTouch = 0x02, + ovrControllerType_Touch = 0x03, + ovrControllerType_XBox = 0x10, + + ovrControllerType_All = 0xff, + + ovrControllerType_EnumSize = 0x7fffffff ///< \internal Force type int32_t. +} ovrControllerType; + + +/// Provides names for the left and right hand array indexes. +/// +/// \see ovrInputState, ovrTrackingState +/// +typedef enum ovrHandType_ +{ + ovrHand_Left = 0, + ovrHand_Right = 1, + + ovrHand_EnumSize = 0x7fffffff ///< \internal Force type int32_t. +} ovrHandType; + + + +/// ovrInputState describes the complete controller input state, including Oculus Touch, +/// and XBox gamepad. If multiple inputs are connected and used at the same time, +/// their inputs are combined. +typedef struct ovrInputState_ +{ + // System type when the controller state was last updated. + double TimeInSeconds; + + // Described by ovrControllerType. Indicates which ControllerTypes are present. + unsigned int ConnectedControllerTypes; + + // Values for buttons described by ovrButton. + unsigned int Buttons; + + // Touch values for buttons and sensors as described by ovrTouch. + unsigned int Touches; + + // Left and right finger trigger values (ovrHand_Left and ovrHand_Right), in the range 0.0 to 1.0f. + float IndexTrigger[2]; + + // Left and right hand trigger values (ovrHand_Left and ovrHand_Right), in the range 0.0 to 1.0f. + float HandTrigger[2]; + + // Horizontal and vertical thumbstick axis values (ovrHand_Left and ovrHand_Right), in the range -1.0f to 1.0f. + ovrVector2f Thumbstick[2]; + +} ovrInputState; + + + +//----------------------------------------------------------------------------------- +// ***** Initialize structures + +/// Initialization flags. +/// +/// \see ovrInitParams, ovr_Initialize +/// +typedef enum ovrInitFlags_ +{ + /// When a debug library is requested, a slower debugging version of the library will + /// run which can be used to help solve problems in the library and debug application code. + ovrInit_Debug = 0x00000001, + + /// When a version is requested, the LibOVR runtime respects the RequestedMinorVersion + /// field and verifies that the RequestedMinorVersion is supported. + ovrInit_RequestVersion = 0x00000004, + + // These bits are writable by user code. + ovrinit_WritableBits = 0x00ffffff, + + ovrInit_EnumSize = 0x7fffffff ///< \internal Force type int32_t. +} ovrInitFlags; + + +/// Logging levels +/// +/// \see ovrInitParams, ovrLogCallback +/// +typedef enum ovrLogLevel_ +{ + ovrLogLevel_Debug = 0, ///< Debug-level log event. + ovrLogLevel_Info = 1, ///< Info-level log event. + ovrLogLevel_Error = 2, ///< Error-level log event. + + ovrLogLevel_EnumSize = 0x7fffffff ///< \internal Force type int32_t. +} ovrLogLevel; + + +/// Signature of the logging callback function pointer type. +/// +/// \param[in] userData is an arbitrary value specified by the user of ovrInitParams. +/// \param[in] level is one of the ovrLogLevel constants. +/// \param[in] message is a UTF8-encoded null-terminated string. +/// \see ovrInitParams, ovrLogLevel, ovr_Initialize +/// +typedef void (OVR_CDECL* ovrLogCallback)(uintptr_t userData, int level, const char* message); + + +/// Parameters for ovr_Initialize. +/// +/// \see ovr_Initialize +/// +typedef struct OVR_ALIGNAS(8) ovrInitParams_ +{ + /// Flags from ovrInitFlags to override default behavior. + /// Use 0 for the defaults. + uint32_t Flags; + + /// Requests a specific minimum minor version of the LibOVR runtime. + /// Flags must include ovrInit_RequestVersion or this will be ignored + /// and OVR_MINOR_VERSION will be used. + uint32_t RequestedMinorVersion; + + /// User-supplied log callback function, which may be called at any time + /// asynchronously from multiple threads until ovr_Shutdown completes. + /// Use NULL to specify no log callback. + ovrLogCallback LogCallback; + + /// User-supplied data which is passed as-is to LogCallback. Typically this + /// is used to store an application-specific pointer which is read in the + /// callback function. + uintptr_t UserData; + + /// Relative number of milliseconds to wait for a connection to the server + /// before failing. Use 0 for the default timeout. + uint32_t ConnectionTimeoutMS; + + OVR_ON64(OVR_UNUSED_STRUCT_PAD(pad0, 4)) ///< \internal + +} ovrInitParams; + + +#ifdef __cplusplus +extern "C" { +#endif + + +// ----------------------------------------------------------------------------------- +// ***** API Interfaces + +// Overview of the API +// +// Setup: +// - ovr_Initialize(). +// - ovr_Create(&hmd, &graphicsId). +// - Call ovr_ConfigureTracking() to configure and initialize tracking. +// - Use hmd members and ovr_GetFovTextureSize() to determine graphics configuration +// and ovr_GetRenderDesc() to get per-eye rendering parameters. +// - Allocate render target texture sets with ovr_CreateSwapTextureSetD3D11() or +// ovr_CreateSwapTextureSetGL(). +// +// Application Loop: +// - Call ovr_GetPredictedDisplayTime() to get the current frame timing information. +// - Call ovr_GetTrackingState() and ovr_CalcEyePoses() to obtain the predicted +// rendering pose for each eye based on timing. +// - Increment ovrTextureSet::CurrentIndex for each layer you will be rendering to +// in the next step. +// - Render the scene content into ovrTextureSet::CurrentIndex for each eye and layer +// you plan to update this frame. +// - Call ovr_SubmitFrame() to render the distorted layers to the back buffer +// and present them on the HMD. If ovr_SubmitFrame returns ovrSuccess_NotVisible, +// there is no need to render the scene for the next loop iteration. Instead, +// just call ovr_SubmitFrame again until it returns ovrSuccess. ovrTextureSet::CurrentIndex +// for each layer should refer to the texure you want to display. +// +// Shutdown: +// - ovr_Destroy(). +// - ovr_Shutdown(). + + +/// Initializes LibOVR +/// +/// Initialize LibOVR for application usage. This includes finding and loading the LibOVRRT +/// shared library. No LibOVR API functions, other than ovr_GetLastErrorInfo, can be called +/// unless ovr_Initialize succeeds. A successful call to ovr_Initialize must be eventually +/// followed by a call to ovr_Shutdown. ovr_Initialize calls are idempotent. +/// Calling ovr_Initialize twice does not require two matching calls to ovr_Shutdown. +/// If already initialized, the return value is ovr_Success. +/// +/// LibOVRRT shared library search order: +/// -# Current working directory (often the same as the application directory). +/// -# Module directory (usually the same as the application directory, +/// but not if the module is a separate shared library). +/// -# Application directory +/// -# Development directory (only if OVR_ENABLE_DEVELOPER_SEARCH is enabled, +/// which is off by default). +/// -# Standard OS shared library search location(s) (OS-specific). +/// +/// \param params Specifies custom initialization options. May be NULL to indicate default options. +/// \return Returns an ovrResult indicating success or failure. In the case of failure, use +/// ovr_GetLastErrorInfo to get more information. Example failed results include: +/// - ovrError_Initialize: Generic initialization error. +/// - ovrError_LibLoad: Couldn't load LibOVRRT. +/// - ovrError_LibVersion: LibOVRRT version incompatibility. +/// - ovrError_ServiceConnection: Couldn't connect to the OVR Service. +/// - ovrError_ServiceVersion: OVR Service version incompatibility. +/// - ovrError_IncompatibleOS: The operating system version is incompatible. +/// - ovrError_DisplayInit: Unable to initialize the HMD display. +/// - ovrError_ServerStart: Unable to start the server. Is it already running? +/// - ovrError_Reinitialization: Attempted to re-initialize with a different version. +/// +/// Example code +/// \code{.cpp} +/// ovrResult result = ovr_Initialize(NULL); +/// if(OVR_FAILURE(result)) { +/// ovrErrorInfo errorInfo; +/// ovr_GetLastErrorInfo(&errorInfo); +/// DebugLog("ovr_Initialize failed: %s", errorInfo.ErrorString); +/// return false; +/// } +/// [...] +/// \endcode +/// +/// \see ovr_Shutdown +/// +OVR_PUBLIC_FUNCTION(ovrResult) ovr_Initialize(const ovrInitParams* params); + + +/// Shuts down LibOVR +/// +/// A successful call to ovr_Initialize must be eventually matched by a call to ovr_Shutdown. +/// After calling ovr_Shutdown, no LibOVR functions can be called except ovr_GetLastErrorInfo +/// or another ovr_Initialize. ovr_Shutdown invalidates all pointers, references, and created objects +/// previously returned by LibOVR functions. The LibOVRRT shared library can be unloaded by +/// ovr_Shutdown. +/// +/// \see ovr_Initialize +/// +OVR_PUBLIC_FUNCTION(void) ovr_Shutdown(); + + +/// Provides information about the last error. +/// \see ovr_GetLastErrorInfo +typedef struct ovrErrorInfo_ +{ + ovrResult Result; ///< The result from the last API call that generated an error ovrResult. + char ErrorString[512]; ///< A UTF8-encoded null-terminated English string describing the problem. The format of this string is subject to change in future versions. +} ovrErrorInfo; + + +/// Returns information about the most recent failed return value by the +/// current thread for this library. +/// +/// This function itself can never generate an error. +/// The last error is never cleared by LibOVR, but will be overwritten by new errors. +/// Do not use this call to determine if there was an error in the last API +/// call as successful API calls don't clear the last ovrErrorInfo. +/// To avoid any inconsistency, ovr_GetLastErrorInfo should be called immediately +/// after an API function that returned a failed ovrResult, with no other API +/// functions called in the interim. +/// +/// \param[out] errorInfo The last ovrErrorInfo for the current thread. +/// +/// \see ovrErrorInfo +/// +OVR_PUBLIC_FUNCTION(void) ovr_GetLastErrorInfo(ovrErrorInfo* errorInfo); + + +/// Returns the version string representing the LibOVRRT version. +/// +/// The returned string pointer is valid until the next call to ovr_Shutdown. +/// +/// Note that the returned version string doesn't necessarily match the current +/// OVR_MAJOR_VERSION, etc., as the returned string refers to the LibOVRRT shared +/// library version and not the locally compiled interface version. +/// +/// The format of this string is subject to change in future versions and its contents +/// should not be interpreted. +/// +/// \return Returns a UTF8-encoded null-terminated version string. +/// +OVR_PUBLIC_FUNCTION(const char*) ovr_GetVersionString(); + + +/// Writes a message string to the LibOVR tracing mechanism (if enabled). +/// +/// This message will be passed back to the application via the ovrLogCallback if +/// it was registered. +/// +/// \param[in] level One of the ovrLogLevel constants. +/// \param[in] message A UTF8-encoded null-terminated string. +/// \return returns the strlen of the message or a negative value if the message is too large. +/// +/// \see ovrLogLevel, ovrLogCallback +/// +OVR_PUBLIC_FUNCTION(int) ovr_TraceMessage(int level, const char* message); + + +//------------------------------------------------------------------------------------- +/// @name HMD Management +/// +/// Handles the enumeration, creation, destruction, and properties of an HMD (head-mounted display). +///@{ + + +/// Returns information about the current HMD. +/// +/// ovr_Initialize must have first been called in order for this to succeed, otherwise ovrHmdDesc::Type +/// will be reported as ovrHmd_None. +/// +/// \param[in] session Specifies an ovrSession previously returned by ovr_Create, else NULL in which +/// case this function detects whether an HMD is present and returns its info if so. +/// +/// \return Returns an ovrHmdDesc. If the hmd is NULL and ovrHmdDesc::Type is ovrHmd_None then +/// no HMD is present. +/// +OVR_PUBLIC_FUNCTION(ovrHmdDesc) ovr_GetHmdDesc(ovrSession session); + + +/// Creates a handle to a VR session. +/// +/// Upon success the returned ovrSession must be eventually freed with ovr_Destroy when it is no longer needed. +/// A second call to ovr_Create will result in an error return value if the previous Hmd has not been destroyed. +/// +/// \param[out] pSession Provides a pointer to an ovrSession which will be written to upon success. +/// \param[out] luid Provides a system specific graphics adapter identifier that locates which +/// graphics adapter has the HMD attached. This must match the adapter used by the application +/// or no rendering output will be possible. This is important for stability on multi-adapter systems. An +/// application that simply chooses the default adapter will not run reliably on multi-adapter systems. +/// \return Returns an ovrResult indicating success or failure. Upon failure +/// the returned pHmd will be NULL. +/// +/// Example code +/// \code{.cpp} +/// ovrSession session; +/// ovrGraphicsLuid luid; +/// ovrResult result = ovr_Create(&session, &luid); +/// if(OVR_FAILURE(result)) +/// ... +/// \endcode +/// +/// \see ovr_Destroy +/// +OVR_PUBLIC_FUNCTION(ovrResult) ovr_Create(ovrSession* pSession, ovrGraphicsLuid* pLuid); + + +/// Destroys the HMD. +/// +/// \param[in] session Specifies an ovrSession previously returned by ovr_Create. +/// \see ovr_Create +/// +OVR_PUBLIC_FUNCTION(void) ovr_Destroy(ovrSession session); + + +/// Specifies status information for the current session. +/// +/// \see ovr_GetSessionStatus +/// +typedef struct ovrSessionStatus_ +{ + ovrBool HasVrFocus; ///< True if the process has VR focus and thus is visible in the HMD. + ovrBool HmdPresent; ///< True if an HMD is present. +}ovrSessionStatus; + + +/// Returns status information for the application. +/// +/// \param[in] session Specifies an ovrSession previously returned by ovr_Create. +/// \param[out] sessionStatus Provides an ovrSessionStatus that is filled in. +/// +/// \return Returns an ovrResult indicating success or failure. In the case of +/// failure, use ovr_GetLastErrorInfo to get more information. +/// +OVR_PUBLIC_FUNCTION(ovrResult) ovr_GetSessionStatus(ovrSession session, ovrSessionStatus* sessionStatus); + + +/// Returns ovrHmdCaps bits that are currently enabled. +/// +/// Note that this value is different from ovrHmdDesc::AvailableHmdCaps, which describes what +/// capabilities are available for that HMD. +/// +/// \return Returns a combination of zero or more ovrHmdCaps. +/// \see ovrHmdCaps +/// +OVR_PUBLIC_FUNCTION(unsigned int) ovr_GetEnabledCaps(ovrSession session); + + +/// Modifies capability bits described by ovrHmdCaps that can be modified, +/// such as ovrHmdCap_LowPersistance. +/// +/// \param[in] session Specifies an ovrSession previously returned by ovr_Create. +/// \param[in] hmdCaps A combination of 0 or more ovrHmdCaps. +/// +/// \see ovrHmdCaps +/// +OVR_PUBLIC_FUNCTION(void) ovr_SetEnabledCaps(ovrSession session, unsigned int hmdCaps); + +//@} + + + +//------------------------------------------------------------------------------------- +/// @name Tracking +/// +/// Tracking functions handle the position, orientation, and movement of the HMD in space. +/// +/// All tracking interface functions are thread-safe, allowing tracking state to be sampled +/// from different threads. +/// +///@{ + +/// Returns the current tracking caps +/// +/// \param[in] session Specifies an ovrSession previously returned by ovr_Create. +/// +/// \return Returns caps from ovrTrackingCaps. +/// +/// \see ovrTrackingCaps +/// +OVR_PUBLIC_FUNCTION(unsigned int) ovr_GetTrackingCaps(ovrSession session); + + +/// Starts sensor sampling, enabling specified capabilities, described by ovrTrackingCaps. +/// +/// Use 0 for both requestedTrackingCaps and requiredTrackingCaps to disable tracking. +/// ovr_ConfigureTracking can be called multiple times with the same or different values +/// for a given ovrSession. +/// +/// ovr_Create automatically enables full tracking supported by the given device. This function +/// is not needed unless the disabling of tracking features is required. +/// +/// \param[in] session Specifies an ovrSession previously returned by ovr_Create. +/// +/// \param[in] requestedTrackingCaps specifies support that is requested. The function will succeed +/// even if these caps are not available (i.e. sensor or camera is unplugged). Support +/// will automatically be enabled if the device is plugged in later. Software should +/// check ovrTrackingState.StatusFlags for real-time status. +/// +/// \param[in] requiredTrackingCaps Specifies sensor capabilities required at the time of the call. +/// If they are not available, the function will fail. Pass 0 if only specifying +/// requestedTrackingCaps. +/// +/// \return Returns an ovrResult indicating success or failure. In the case of failure, use +/// ovr_GetLastErrorInfo to get more information. +/// +/// \see ovrTrackingCaps, ovr_Create +/// +OVR_PUBLIC_FUNCTION(ovrResult) ovr_ConfigureTracking(ovrSession session, unsigned int requestedTrackingCaps, + unsigned int requiredTrackingCaps); + + +/// Re-centers the sensor position and orientation. +/// +/// This resets the (x,y,z) positional components and the yaw orientation component. +/// The Roll and pitch orientation components are always determined by gravity and cannot +/// be redefined. All future tracking will report values relative to this new reference position. +/// +/// \param[in] session Specifies an ovrSession previously returned by ovr_Create. +/// +OVR_PUBLIC_FUNCTION(void) ovr_RecenterPose(ovrSession session); + + +/// Returns tracking state reading based on the specified absolute system time. +/// +/// Pass an absTime value of 0.0 to request the most recent sensor reading. In this case +/// both PredictedPose and SamplePose will have the same value. +/// +/// This may also be used for more refined timing of front buffer rendering logic, and so on. +/// This may be called by multiple threads. +/// +/// \param[in] session Specifies an ovrSession previously returned by ovr_Create. +/// \param[in] absTime Specifies the absolute future time to predict the return +/// ovrTrackingState value. Use 0 to request the most recent tracking state. +/// \param[in] latencyMarker Specifies that this call is the point in time where +/// the "App-to-Mid-Photon" latency timer starts from. If a given ovrLayer +/// provides "SensorSampleTimestamp", that will override the value stored here. +/// \return Returns the ovrTrackingState that is predicted for the given absTime. +/// +/// \see ovrTrackingState, ovr_GetEyePoses, ovr_GetTimeInSeconds +/// +OVR_PUBLIC_FUNCTION(ovrTrackingState) ovr_GetTrackingState(ovrSession session, double absTime, ovrBool latencyMarker); + + +/// Returns the most recent input state for controllers, without positional tracking info. +/// Developers can tell whether the same state was returned by checking the PacketNumber. +/// +/// \param[out] inputState Input state that will be filled in. +/// \param[in] controllerTypeMask Specifies which controllers the input will be returned for. +/// Described by ovrControllerType. +/// \return Returns ovrSuccess if the new state was successfully obtained. +/// +/// \see ovrControllerType +/// +OVR_PUBLIC_FUNCTION(ovrResult) ovr_GetInputState(ovrSession session, unsigned int controllerTypeMask, ovrInputState* inputState); + + +/// Turns on vibration of the given controller. +/// +/// To disable vibration, call ovr_SetControllerVibration with an amplitude of 0. +/// Vibration automatically stops after a nominal amount of time, so if you want vibration +/// to be continuous over multiple seconds then you need to call this function periodically. +/// +/// \param[in] session Specifies an ovrSession previously returned by ovr_Create. +/// \param[in] controllerTypeMask Specifies controllers to apply the vibration to. +/// \param[in] frequency Specifies a vibration frequency in the range of 0.0 to 1.0. +/// Currently the only valid values are 0.0, 0.5, and 1.0 and other values will +/// be clamped to one of these. +/// \param[in] amplitude Specifies a vibration amplitude in the range of 0.0 to 1.0. +/// +/// \return Returns ovrSuccess upon success. +/// +/// \see ovrControllerType +/// +OVR_PUBLIC_FUNCTION(ovrResult) ovr_SetControllerVibration(ovrSession session, unsigned int controllerTypeMask, + float frequency, float amplitude); + +///@} + + +//------------------------------------------------------------------------------------- +// @name Layers +// +///@{ + + +/// Specifies the maximum number of layers supported by ovr_SubmitFrame. +/// +/// /see ovr_SubmitFrame +/// +enum { + ovrMaxLayerCount = 32 +}; + +/// Describes layer types that can be passed to ovr_SubmitFrame. +/// Each layer type has an associated struct, such as ovrLayerEyeFov. +/// +/// \see ovrLayerHeader +/// +typedef enum ovrLayerType_ +{ + ovrLayerType_Disabled = 0, ///< Layer is disabled. + ovrLayerType_EyeFov = 1, ///< Described by ovrLayerEyeFov. + ovrLayerType_EyeFovDepth = 2, ///< Described by ovrLayerEyeFovDepth. + ovrLayerType_Quad = 3, ///< Described by ovrLayerQuad. Was called ovrLayerType_QuadInWorld. + /// enum 4 used to be ovrLayerType_QuadHeadLocked. Instead, use ovrLayerType_Quad with ovrLayerFlag_HeadLocked. + ovrLayerType_EyeMatrix = 5, ///< Described by ovrLayerEyeMatrix. + ovrLayerType_Direct = 6, ///< Described by ovrLayerDirect. Passthrough for debugging and custom rendering. + ovrLayerType_EnumSize = 0x7fffffff ///< Force type int32_t. +} ovrLayerType; + + +/// Identifies flags used by ovrLayerHeader and which are passed to ovr_SubmitFrame. +/// +/// \see ovrLayerHeader +/// +typedef enum ovrLayerFlags_ +{ + /// ovrLayerFlag_HighQuality mode costs performance, but looks better. + ovrLayerFlag_HighQuality = 0x01, + + /// ovrLayerFlag_TextureOriginAtBottomLeft: the opposite is TopLeft. + /// Generally this is false for D3D, true for OpenGL. + ovrLayerFlag_TextureOriginAtBottomLeft = 0x02, + + /// Mark this surface as "headlocked", which means it is specified + /// relative to the HMD and moves with it, rather than being specified + /// relative to sensor/torso space and remaining still while the head moves. + /// ovrLayerType_QuadHeadLocked is now ovrLayerType_Quad plus this flag. + /// However the flag can be applied to any layer type except ovrLayerType_Direct + /// to achieve a similar effect. + ovrLayerFlag_HeadLocked = 0x04 + +} ovrLayerFlags; + + +/// Defines properties shared by all ovrLayer structs, such as ovrLayerEyeFov. +/// +/// ovrLayerHeader is used as a base member in these larger structs. +/// This struct cannot be used by itself except for the case that Type is ovrLayerType_Disabled. +/// +/// \see ovrLayerType, ovrLayerFlags +/// +typedef struct OVR_ALIGNAS(OVR_PTR_SIZE) ovrLayerHeader_ +{ + ovrLayerType Type; ///< Described by ovrLayerType. + unsigned Flags; ///< Described by ovrLayerFlags. +} ovrLayerHeader; + + +/// Describes a layer that specifies a monoscopic or stereoscopic view. +/// This is the kind of layer that's typically used as layer 0 to ovr_SubmitFrame, +/// as it is the kind of layer used to render a 3D stereoscopic view. +/// +/// Three options exist with respect to mono/stereo texture usage: +/// - ColorTexture[0] and ColorTexture[1] contain the left and right stereo renderings, respectively. +/// Viewport[0] and Viewport[1] refer to ColorTexture[0] and ColorTexture[1], respectively. +/// - ColorTexture[0] contains both the left and right renderings, ColorTexture[1] is NULL, +/// and Viewport[0] and Viewport[1] refer to sub-rects with ColorTexture[0]. +/// - ColorTexture[0] contains a single monoscopic rendering, and Viewport[0] and +/// Viewport[1] both refer to that rendering. +/// +/// \see ovrSwapTextureSet, ovr_SubmitFrame +/// +typedef struct OVR_ALIGNAS(OVR_PTR_SIZE) ovrLayerEyeFov_ +{ + /// Header.Type must be ovrLayerType_EyeFov. + ovrLayerHeader Header; + + /// ovrSwapTextureSets for the left and right eye respectively. + /// The second one of which can be NULL for cases described above. + ovrSwapTextureSet* ColorTexture[ovrEye_Count]; + + /// Specifies the ColorTexture sub-rect UV coordinates. + /// Both Viewport[0] and Viewport[1] must be valid. + ovrRecti Viewport[ovrEye_Count]; + + /// The viewport field of view. + ovrFovPort Fov[ovrEye_Count]; + + /// Specifies the position and orientation of each eye view, with the position specified in meters. + /// RenderPose will typically be the value returned from ovr_CalcEyePoses, + /// but can be different in special cases if a different head pose is used for rendering. + ovrPosef RenderPose[ovrEye_Count]; + + /// Specifies the timestamp when the source ovrPosef (used in calculating RenderPose) + /// was sampled from the SDK. Typically retrieved by calling ovr_GetTimeInSeconds + /// around the instant the application calls ovr_GetTrackingState + /// The main purpose for this is to accurately track app tracking latency. + double SensorSampleTime; + +} ovrLayerEyeFov; + + +/// Describes a layer that specifies a monoscopic or stereoscopic view, +/// with depth textures in addition to color textures. This is typically used to support +/// positional time warp. This struct is the same as ovrLayerEyeFov, but with the addition +/// of DepthTexture and ProjectionDesc. +/// +/// ProjectionDesc can be created using ovrTimewarpProjectionDesc_FromProjection. +/// +/// Three options exist with respect to mono/stereo texture usage: +/// - ColorTexture[0] and ColorTexture[1] contain the left and right stereo renderings, respectively. +/// Viewport[0] and Viewport[1] refer to ColorTexture[0] and ColorTexture[1], respectively. +/// - ColorTexture[0] contains both the left and right renderings, ColorTexture[1] is NULL, +/// and Viewport[0] and Viewport[1] refer to sub-rects with ColorTexture[0]. +/// - ColorTexture[0] contains a single monoscopic rendering, and Viewport[0] and +/// Viewport[1] both refer to that rendering. +/// +/// \see ovrSwapTextureSet, ovr_SubmitFrame +/// +typedef struct OVR_ALIGNAS(OVR_PTR_SIZE) ovrLayerEyeFovDepth_ +{ + /// Header.Type must be ovrLayerType_EyeFovDepth. + ovrLayerHeader Header; + + /// ovrSwapTextureSets for the left and right eye respectively. + /// The second one of which can be NULL for cases described above. + ovrSwapTextureSet* ColorTexture[ovrEye_Count]; + + /// Specifies the ColorTexture sub-rect UV coordinates. + /// Both Viewport[0] and Viewport[1] must be valid. + ovrRecti Viewport[ovrEye_Count]; + + /// The viewport field of view. + ovrFovPort Fov[ovrEye_Count]; + + /// Specifies the position and orientation of each eye view, with the position specified in meters. + /// RenderPose will typically be the value returned from ovr_CalcEyePoses, + /// but can be different in special cases if a different head pose is used for rendering. + ovrPosef RenderPose[ovrEye_Count]; + + /// Specifies the timestamp when the source ovrPosef (used in calculating RenderPose) + /// was sampled from the SDK. Typically retrieved by calling ovr_GetTimeInSeconds + /// around the instant the application calls ovr_GetTrackingState + /// The main purpose for this is to accurately track app tracking latency. + double SensorSampleTime; + + /// Depth texture for positional timewarp. + /// Must map 1:1 to the ColorTexture. + ovrSwapTextureSet* DepthTexture[ovrEye_Count]; + + /// Specifies how to convert DepthTexture information into meters. + /// \see ovrTimewarpProjectionDesc_FromProjection + ovrTimewarpProjectionDesc ProjectionDesc; + +} ovrLayerEyeFovDepth; + + +/// Describes a layer that specifies a monoscopic or stereoscopic view. +/// This uses a direct 3x4 matrix to map from view space to the UV coordinates. +/// It is essentially the same thing as ovrLayerEyeFov but using a much +/// lower level. This is mainly to provide compatibility with specific apps. +/// Unless the application really requires this flexibility, it is usually better +/// to use ovrLayerEyeFov. +/// +/// Three options exist with respect to mono/stereo texture usage: +/// - ColorTexture[0] and ColorTexture[1] contain the left and right stereo renderings, respectively. +/// Viewport[0] and Viewport[1] refer to ColorTexture[0] and ColorTexture[1], respectively. +/// - ColorTexture[0] contains both the left and right renderings, ColorTexture[1] is NULL, +/// and Viewport[0] and Viewport[1] refer to sub-rects with ColorTexture[0]. +/// - ColorTexture[0] contains a single monoscopic rendering, and Viewport[0] and +/// Viewport[1] both refer to that rendering. +/// +/// \see ovrSwapTextureSet, ovr_SubmitFrame +/// +typedef struct OVR_ALIGNAS(OVR_PTR_SIZE) ovrLayerEyeMatrix_ +{ + /// Header.Type must be ovrLayerType_EyeMatrix. + ovrLayerHeader Header; + + /// ovrSwapTextureSets for the left and right eye respectively. + /// The second one of which can be NULL for cases described above. + ovrSwapTextureSet* ColorTexture[ovrEye_Count]; + + /// Specifies the ColorTexture sub-rect UV coordinates. + /// Both Viewport[0] and Viewport[1] must be valid. + ovrRecti Viewport[ovrEye_Count]; + + /// Specifies the position and orientation of each eye view, with the position specified in meters. + /// RenderPose will typically be the value returned from ovr_CalcEyePoses, + /// but can be different in special cases if a different head pose is used for rendering. + ovrPosef RenderPose[ovrEye_Count]; + + /// Specifies the mapping from a view-space vector + /// to a UV coordinate on the textures given above. + /// P = (x,y,z,1)*Matrix + /// TexU = P.x/P.z + /// TexV = P.y/P.z + ovrMatrix4f Matrix[ovrEye_Count]; + + /// Specifies the timestamp when the source ovrPosef (used in calculating RenderPose) + /// was sampled from the SDK. Typically retrieved by calling ovr_GetTimeInSeconds + /// around the instant the application calls ovr_GetTrackingState + /// The main purpose for this is to accurately track app tracking latency. + double SensorSampleTime; + +} ovrLayerEyeMatrix; + + + + + +/// Describes a layer of Quad type, which is a single quad in world or viewer space. +/// It is used for both ovrLayerType_Quad. This type of layer represents a single +/// object placed in the world and not a stereo view of the world itself. +/// +/// A typical use of ovrLayerType_Quad is to draw a television screen in a room +/// that for some reason is more convenient to draw as a layer than as part of the main +/// view in layer 0. For example, it could implement a 3D popup GUI that is drawn at a +/// higher resolution than layer 0 to improve fidelity of the GUI. +/// +/// Quad layers are visible from both sides; they are not back-face culled. +/// +/// \see ovrSwapTextureSet, ovr_SubmitFrame +/// +typedef struct OVR_ALIGNAS(OVR_PTR_SIZE) ovrLayerQuad_ +{ + /// Header.Type must be ovrLayerType_Quad. + ovrLayerHeader Header; + + /// Contains a single image, never with any stereo view. + ovrSwapTextureSet* ColorTexture; + + /// Specifies the ColorTexture sub-rect UV coordinates. + ovrRecti Viewport; + + /// Position and orientation of the center of the quad. Position is specified in meters. + ovrPosef QuadPoseCenter; + + /// Width and height (respectively) of the quad in meters. + ovrVector2f QuadSize; + +} ovrLayerQuad; + + +/// Describes a layer which is copied to the HMD as-is. Neither distortion, time warp, +/// nor vignetting is applied to ColorTexture before it's copied to the HMD. The application +/// can, however implement these kinds of effects itself before submitting the layer. +/// This layer can be used for application-based distortion rendering and can also be +/// used for implementing a debug HUD that's viewed on the mirror texture. +/// +/// \see ovrSwapTextureSet, ovr_SubmitFrame +/// +typedef struct OVR_ALIGNAS(OVR_PTR_SIZE) ovrLayerDirect_ +{ + /// Header.Type must be ovrLayerType_EyeDirect. + ovrLayerHeader Header; + + /// ovrSwapTextureSets for the left and right eye respectively. + /// The second one of which can be NULL for cases described above. + ovrSwapTextureSet* ColorTexture[ovrEye_Count]; + + /// Specifies the ColorTexture sub-rect UV coordinates. + /// Both Viewport[0] and Viewport[1] must be valid. + ovrRecti Viewport[ovrEye_Count]; + +} ovrLayerDirect; + + +/// Union that combines ovrLayer types in a way that allows them +/// to be used in a polymorphic way. +typedef union ovrLayer_Union_ +{ + ovrLayerHeader Header; + ovrLayerEyeFov EyeFov; + ovrLayerEyeFovDepth EyeFovDepth; + ovrLayerQuad Quad; + ovrLayerDirect Direct; + +} ovrLayer_Union; + + +//@} + + + +/// @name SDK Distortion Rendering +/// +/// All of rendering functions including the configure and frame functions +/// are not thread safe. It is OK to use ConfigureRendering on one thread and handle +/// frames on another thread, but explicit synchronization must be done since +/// functions that depend on configured state are not reentrant. +/// +/// These functions support rendering of distortion by the SDK. +/// +//@{ + +// TextureSet creation is rendering API-specific, so the ovr_CreateSwapTextureSetXX +// methods can be found in the rendering API-specific headers, such as OVR_CAPI_D3D.h and OVR_CAPI_GL.h + + +/// Destroys an ovrSwapTextureSet and frees all the resources associated with it. +/// +/// \param[in] session Specifies an ovrSession previously returned by ovr_Create. +/// \param[in] textureSet Specifies the ovrSwapTextureSet to destroy. If it is NULL then this function has no effect. +/// +/// \see ovr_CreateSwapTextureSetD3D11, ovr_CreateSwapTextureSetGL +/// +OVR_PUBLIC_FUNCTION(void) ovr_DestroySwapTextureSet(ovrSession session, ovrSwapTextureSet* textureSet); + + +/// Destroys a mirror texture previously created by one of the mirror texture creation functions. +/// +/// \param[in] session Specifies an ovrSession previously returned by ovr_Create. +/// \param[in] mirrorTexture Specifies the ovrTexture to destroy. If it is NULL then this function has no effect. +/// +/// \see ovr_CreateMirrorTextureD3D11, ovr_CreateMirrorTextureGL +/// +OVR_PUBLIC_FUNCTION(void) ovr_DestroyMirrorTexture(ovrSession session, ovrTexture* mirrorTexture); + + +/// Calculates the recommended viewport size for rendering a given eye within the HMD +/// with a given FOV cone. +/// +/// Higher FOV will generally require larger textures to maintain quality. +/// Apps packing multiple eye views together on the same texture should ensure there are +/// at least 8 pixels of padding between them to prevent texture filtering and chromatic +/// aberration causing images to leak between the two eye views. +/// +/// \param[in] session Specifies an ovrSession previously returned by ovr_Create. +/// \param[in] eye Specifies which eye (left or right) to calculate for. +/// \param[in] fov Specifies the ovrFovPort to use. +/// \param[in] pixelsPerDisplayPixel Specifies the ratio of the number of render target pixels +/// to display pixels at the center of distortion. 1.0 is the default value. Lower +/// values can improve performance, higher values give improved quality. +/// \return Returns the texture width and height size. +/// +OVR_PUBLIC_FUNCTION(ovrSizei) ovr_GetFovTextureSize(ovrSession session, ovrEyeType eye, ovrFovPort fov, + float pixelsPerDisplayPixel); + +/// Computes the distortion viewport, view adjust, and other rendering parameters for +/// the specified eye. +/// +/// \param[in] session Specifies an ovrSession previously returned by ovr_Create. +/// \param[in] eyeType Specifies which eye (left or right) for which to perform calculations. +/// \param[in] fov Specifies the ovrFovPort to use. +/// \return Returns the computed ovrEyeRenderDesc for the given eyeType and field of view. +/// +/// \see ovrEyeRenderDesc +/// +OVR_PUBLIC_FUNCTION(ovrEyeRenderDesc) ovr_GetRenderDesc(ovrSession session, + ovrEyeType eyeType, ovrFovPort fov); + +/// Submits layers for distortion and display. +/// +/// ovr_SubmitFrame triggers distortion and processing which might happen asynchronously. +/// The function will return when there is room in the submission queue and surfaces +/// are available. Distortion might or might not have completed. +/// +/// \param[in] session Specifies an ovrSession previously returned by ovr_Create. +/// +/// \param[in] frameIndex Specifies the targeted application frame index, or 0 to refer to one frame +/// after the last time ovr_SubmitFrame was called. +/// +/// \param[in] viewScaleDesc Provides additional information needed only if layerPtrList contains +/// a ovrLayerType_Quad. If NULL, a default version is used based on the current configuration and a 1.0 world scale. +/// +/// \param[in] layerPtrList Specifies a list of ovrLayer pointers, which can include NULL entries to +/// indicate that any previously shown layer at that index is to not be displayed. +/// Each layer header must be a part of a layer structure such as ovrLayerEyeFov or ovrLayerQuad, +/// with Header.Type identifying its type. A NULL layerPtrList entry in the array indicates the +// absence of the given layer. +/// +/// \param[in] layerCount Indicates the number of valid elements in layerPtrList. The maximum +/// supported layerCount is not currently specified, but may be specified in a future version. +/// +/// - Layers are drawn in the order they are specified in the array, regardless of the layer type. +/// +/// - Layers are not remembered between successive calls to ovr_SubmitFrame. A layer must be +/// specified in every call to ovr_SubmitFrame or it won't be displayed. +/// +/// - If a layerPtrList entry that was specified in a previous call to ovr_SubmitFrame is +/// passed as NULL or is of type ovrLayerType_Disabled, that layer is no longer displayed. +/// +/// - A layerPtrList entry can be of any layer type and multiple entries of the same layer type +/// are allowed. No layerPtrList entry may be duplicated (i.e. the same pointer as an earlier entry). +/// +/// Example code +/// \code{.cpp} +/// ovrLayerEyeFov layer0; +/// ovrLayerQuad layer1; +/// ... +/// ovrLayerHeader* layers[2] = { &layer0.Header, &layer1.Header }; +/// ovrResult result = ovr_SubmitFrame(hmd, frameIndex, nullptr, layers, 2); +/// \endcode +/// +/// \return Returns an ovrResult for which OVR_SUCCESS(result) is false upon error and true +/// upon one of the possible success values: +/// - ovrSuccess: rendering completed successfully. +/// - ovrSuccess_NotVisible: rendering completed successfully but was not displayed on the HMD, +/// usually because another application currently has ownership of the HMD. Applications receiving +/// this result should stop rendering new content, but continue to call ovr_SubmitFrame periodically +/// until it returns a value other than ovrSuccess_NotVisible. +/// - ovrError_DisplayLost: The session has become invalid (such as due to a device removal) +/// and the shared resources need to be released (ovr_DestroySwapTextureSet), the session needs to +/// destroyed (ovr_Destroy) and recreated (ovr_Create), and new resources need to be created +/// (ovr_CreateSwapTextureSetXXX). The application's existing private graphics resources do not +/// need to be recreated unless the new ovr_Create call returns a different GraphicsLuid. +/// +/// \see ovr_GetPredictedDisplayTime, ovrViewScaleDesc, ovrLayerHeader +/// +OVR_PUBLIC_FUNCTION(ovrResult) ovr_SubmitFrame(ovrSession session, long long frameIndex, + const ovrViewScaleDesc* viewScaleDesc, + ovrLayerHeader const * const * layerPtrList, unsigned int layerCount); +///@} + + + +//------------------------------------------------------------------------------------- +/// @name Frame Timing +/// +//@{ + + +/// Gets the time of the specified frame midpoint. +/// +/// Predicts the time at which the given frame will be displayed. The predicted time +/// is the middle of the time period during which the corresponding eye images will +/// be displayed. +/// +/// The application should increment frameIndex for each successively targeted frame, +/// and pass that index to any relevent OVR functions that need to apply to the frame +/// identified by that index. +/// +/// This function is thread-safe and allows for multiple application threads to target +/// their processing to the same displayed frame. +/// +/// \param[in] session Specifies an ovrSession previously returned by ovr_Create. +/// \param[in] frameIndex Identifies the frame the caller wishes to target. +/// A value of zero returns the next frame index. +/// \return Returns the absolute frame midpoint time for the given frameIndex. +/// \see ovr_GetTimeInSeconds +/// +OVR_PUBLIC_FUNCTION(double) ovr_GetPredictedDisplayTime(ovrSession session, long long frameIndex); + + +/// Returns global, absolute high-resolution time in seconds. +/// +/// The time frame of reference for this function is not specified and should not be +/// depended upon. +/// +/// \return Returns seconds as a floating point value. +/// \see ovrPoseStatef, ovrSensorData, ovrFrameTiming +/// +OVR_PUBLIC_FUNCTION(double) ovr_GetTimeInSeconds(); + + +/// Performance HUD enables the HMD user to see information critical to +/// the real-time operation of the VR application such as latency timing, +/// and CPU & GPU performance metrics +/// +/// App can toggle performance HUD modes as such: +/// \code{.cpp} +/// ovrPerfHudMode PerfHudMode = ovrPerfHud_LatencyTiming; +/// ovr_SetInt(Hmd, OVR_PERF_HUD_MODE, (int)PerfHudMode); +/// \endcode +/// +typedef enum ovrPerfHudMode_ +{ + ovrPerfHud_Off = 0, ///< Turns off the performance HUD + ovrPerfHud_LatencyTiming = 1, ///< Shows latency related timing info + ovrPerfHud_RenderTiming = 2, ///< Shows CPU & GPU timing info + ovrPerfHud_PerfHeadroom = 3, ///< Shows available performance headroom in a "consumer-friendly" way + ovrPerfHud_VersionInfo = 4, ///< Shows SDK Version Info + ovrPerfHud_Count, ///< \internal Count of enumerated elements. + ovrPerfHud_EnumSize = 0x7fffffff ///< \internal Force type int32_t. +} ovrPerfHudMode; + +/// Layer HUD enables the HMD user to see information about a layer +/// +/// App can toggle layer HUD modes as such: +/// \code{.cpp} +/// ovrLayerHudMode LayerHudMode = ovrLayerHud_Info; +/// ovr_SetInt(Hmd, OVR_LAYER_HUD_MODE, (int)LayerHudMode); +/// \endcode +/// +typedef enum ovrLayerHudMode_ +{ + ovrLayerHud_Off = 0, ///< Turns off the layer HUD + ovrLayerHud_Info = 1, ///< Shows info about a specific layer + ovrLayerHud_EnumSize = 0x7fffffff +} ovrLayerHudMode; + +///@} + +/// Debug HUD is provided to help developers gauge and debug the fidelity of their app's +/// stereo rendering characteristics. Using the provided quad and crosshair guides, +/// the developer can verify various aspects such as VR tracking units (e.g. meters), +/// stereo camera-parallax properties (e.g. making sure objects at infinity are rendered +/// with the proper separation), measuring VR geometry sizes and distances and more. +/// +/// App can toggle the debug HUD modes as such: +/// \code{.cpp} +/// ovrDebugHudStereoMode DebugHudMode = ovrDebugHudStereo_QuadWithCrosshair; +/// ovr_SetInt(Hmd, OVR_DEBUG_HUD_STEREO_MODE, (int)DebugHudMode); +/// \endcode +/// +/// The app can modify the visual properties of the stereo guide (i.e. quad, crosshair) +/// using the ovr_SetFloatArray function. For a list of tweakable properties, +/// see the OVR_DEBUG_HUD_STEREO_GUIDE_* keys in the OVR_CAPI_Keys.h header file. +typedef enum ovrDebugHudStereoMode_ +{ + ovrDebugHudStereo_Off = 0, ///< Turns off the Stereo Debug HUD + ovrDebugHudStereo_Quad = 1, ///< Renders Quad in world for Stereo Debugging + ovrDebugHudStereo_QuadWithCrosshair = 2, ///< Renders Quad+crosshair in world for Stereo Debugging + ovrDebugHudStereo_CrosshairAtInfinity = 3, ///< Renders screen-space crosshair at infinity for Stereo Debugging + ovrDebugHudStereo_Count, ///< \internal Count of enumerated elements + + ovrDebugHudStereo_EnumSize = 0x7fffffff ///< \internal Force type int32_t +} ovrDebugHudStereoMode; + + + + +/// Should be called when the headset is placed on a new user. +/// Previously named ovrHmd_ResetOnlyBackOfHeadTrackingForConnectConf. +/// +/// This may be removed in a future SDK version. +/// +OVR_PUBLIC_FUNCTION(void) ovr_ResetBackOfHeadTracking(ovrSession session); + + +/// Should be called when a tracking camera is moved. +/// +/// This may be removed in a future SDK version. +/// +OVR_PUBLIC_FUNCTION(void) ovr_ResetMulticameraTracking(ovrSession session); + + + +// ----------------------------------------------------------------------------------- +/// @name Property Access +/// +/// These functions read and write OVR properties. Supported properties +/// are defined in OVR_CAPI_Keys.h +/// +//@{ + +/// Reads a boolean property. +/// +/// \param[in] session Specifies an ovrSession previously returned by ovr_Create. +/// \param[in] propertyName The name of the property, which needs to be valid for only the call. +/// \param[in] defaultVal specifes the value to return if the property couldn't be read. +/// \return Returns the property interpreted as a boolean value. Returns defaultVal if +/// the property doesn't exist. +OVR_PUBLIC_FUNCTION(ovrBool) ovr_GetBool(ovrSession session, const char* propertyName, ovrBool defaultVal); + +/// Writes or creates a boolean property. +/// If the property wasn't previously a boolean property, it is changed to a boolean property. +/// +/// \param[in] session Specifies an ovrSession previously returned by ovr_Create. +/// \param[in] propertyName The name of the property, which needs to be valid only for the call. +/// \param[in] value The value to write. +/// \return Returns true if successful, otherwise false. A false result should only occur if the property +/// name is empty or if the property is read-only. +OVR_PUBLIC_FUNCTION(ovrBool) ovr_SetBool(ovrSession session, const char* propertyName, ovrBool value); + + +/// Reads an integer property. +/// +/// \param[in] session Specifies an ovrSession previously returned by ovr_Create. +/// \param[in] propertyName The name of the property, which needs to be valid only for the call. +/// \param[in] defaultVal Specifes the value to return if the property couldn't be read. +/// \return Returns the property interpreted as an integer value. Returns defaultVal if +/// the property doesn't exist. +OVR_PUBLIC_FUNCTION(int) ovr_GetInt(ovrSession session, const char* propertyName, int defaultVal); + +/// Writes or creates an integer property. +/// +/// If the property wasn't previously a boolean property, it is changed to an integer property. +/// +/// \param[in] session Specifies an ovrSession previously returned by ovr_Create. +/// \param[in] propertyName The name of the property, which needs to be valid only for the call. +/// \param[in] value The value to write. +/// \return Returns true if successful, otherwise false. A false result should only occur if the property +/// name is empty or if the property is read-only. +OVR_PUBLIC_FUNCTION(ovrBool) ovr_SetInt(ovrSession session, const char* propertyName, int value); + + +/// Reads a float property. +/// +/// \param[in] session Specifies an ovrSession previously returned by ovr_Create. +/// \param[in] propertyName The name of the property, which needs to be valid only for the call. +/// \param[in] defaultVal specifes the value to return if the property couldn't be read. +/// \return Returns the property interpreted as an float value. Returns defaultVal if +/// the property doesn't exist. +OVR_PUBLIC_FUNCTION(float) ovr_GetFloat(ovrSession session, const char* propertyName, float defaultVal); + +/// Writes or creates a float property. +/// If the property wasn't previously a float property, it's changed to a float property. +/// +/// \param[in] session Specifies an ovrSession previously returned by ovr_Create. +/// \param[in] propertyName The name of the property, which needs to be valid only for the call. +/// \param[in] value The value to write. +/// \return Returns true if successful, otherwise false. A false result should only occur if the property +/// name is empty or if the property is read-only. +OVR_PUBLIC_FUNCTION(ovrBool) ovr_SetFloat(ovrSession session, const char* propertyName, float value); + + +/// Reads a float array property. +/// +/// \param[in] session Specifies an ovrSession previously returned by ovr_Create. +/// \param[in] propertyName The name of the property, which needs to be valid only for the call. +/// \param[in] values An array of float to write to. +/// \param[in] valuesCapacity Specifies the maximum number of elements to write to the values array. +/// \return Returns the number of elements read, or 0 if property doesn't exist or is empty. +OVR_PUBLIC_FUNCTION(unsigned int) ovr_GetFloatArray(ovrSession session, const char* propertyName, + float values[], unsigned int valuesCapacity); + +/// Writes or creates a float array property. +/// +/// \param[in] session Specifies an ovrSession previously returned by ovr_Create. +/// \param[in] propertyName The name of the property, which needs to be valid only for the call. +/// \param[in] values An array of float to write from. +/// \param[in] valuesSize Specifies the number of elements to write. +/// \return Returns true if successful, otherwise false. A false result should only occur if the property +/// name is empty or if the property is read-only. +OVR_PUBLIC_FUNCTION(ovrBool) ovr_SetFloatArray(ovrSession session, const char* propertyName, + const float values[], unsigned int valuesSize); + + +/// Reads a string property. +/// Strings are UTF8-encoded and null-terminated. +/// +/// \param[in] session Specifies an ovrSession previously returned by ovr_Create. +/// \param[in] propertyName The name of the property, which needs to be valid only for the call. +/// \param[in] defaultVal Specifes the value to return if the property couldn't be read. +/// \return Returns the string property if it exists. Otherwise returns defaultVal, which can be specified as NULL. +/// The return memory is guaranteed to be valid until next call to ovr_GetString or +/// until the HMD is destroyed, whichever occurs first. +OVR_PUBLIC_FUNCTION(const char*) ovr_GetString(ovrSession session, const char* propertyName, + const char* defaultVal); + +/// Writes or creates a string property. +/// Strings are UTF8-encoded and null-terminated. +/// +/// \param[in] session Specifies an ovrSession previously returned by ovr_Create. +/// \param[in] propertyName The name of the property, which needs to be valid only for the call. +/// \param[in] value The string property, which only needs to be valid for the duration of the call. +/// \return Returns true if successful, otherwise false. A false result should only occur if the property +/// name is empty or if the property is read-only. +OVR_PUBLIC_FUNCTION(ovrBool) ovr_SetString(ovrSession session, const char* propertyName, + const char* value); + +///@} + + + +#ifdef __cplusplus +} // extern "C" +#endif + + +#if defined(_MSC_VER) + #pragma warning(pop) +#endif + +/// @cond DoxygenIgnore +//----------------------------------------------------------------------------- +// ***** Compiler packing validation +// +// These checks ensure that the compiler settings being used will be compatible +// with with pre-built dynamic library provided with the runtime. + +OVR_STATIC_ASSERT(sizeof(ovrBool) == 1, "ovrBool size mismatch"); +OVR_STATIC_ASSERT(sizeof(ovrVector2i) == 4 * 2, "ovrVector2i size mismatch"); +OVR_STATIC_ASSERT(sizeof(ovrSizei) == 4 * 2, "ovrSizei size mismatch"); +OVR_STATIC_ASSERT(sizeof(ovrRecti) == sizeof(ovrVector2i) + sizeof(ovrSizei), "ovrRecti size mismatch"); +OVR_STATIC_ASSERT(sizeof(ovrQuatf) == 4 * 4, "ovrQuatf size mismatch"); +OVR_STATIC_ASSERT(sizeof(ovrVector2f) == 4 * 2, "ovrVector2f size mismatch"); +OVR_STATIC_ASSERT(sizeof(ovrVector3f) == 4 * 3, "ovrVector3f size mismatch"); +OVR_STATIC_ASSERT(sizeof(ovrMatrix4f) == 4 * 16, "ovrMatrix4f size mismatch"); + +OVR_STATIC_ASSERT(sizeof(ovrPosef) == (7 * 4), "ovrPosef size mismatch"); +OVR_STATIC_ASSERT(sizeof(ovrPoseStatef) == (22 * 4), "ovrPoseStatef size mismatch"); +OVR_STATIC_ASSERT(sizeof(ovrFovPort) == (4 * 4), "ovrFovPort size mismatch"); + +OVR_STATIC_ASSERT(sizeof(ovrHmdCaps) == 4, "ovrHmdCaps size mismatch"); +OVR_STATIC_ASSERT(sizeof(ovrTrackingCaps) == 4, "ovrTrackingCaps size mismatch"); +OVR_STATIC_ASSERT(sizeof(ovrEyeType) == 4, "ovrEyeType size mismatch"); +OVR_STATIC_ASSERT(sizeof(ovrHmdType) == 4, "ovrHmdType size mismatch"); + +OVR_STATIC_ASSERT(sizeof(ovrSensorData) == (11 * 4), "ovrSensorData size mismatch"); +OVR_STATIC_ASSERT(sizeof(ovrTrackingState) == + sizeof(ovrPoseStatef) * 3 + 4 + 2 * sizeof(ovrPosef) + sizeof(ovrSensorData) + 4 * 4, + "ovrTrackingState size mismatch"); + +OVR_STATIC_ASSERT(sizeof(ovrRenderAPIType) == 4, "ovrRenderAPIType size mismatch"); + +OVR_STATIC_ASSERT(sizeof(ovrTextureHeader) == sizeof(ovrRenderAPIType) + sizeof(ovrSizei), + "ovrTextureHeader size mismatch"); +OVR_STATIC_ASSERT(sizeof(ovrTexture) == sizeof(ovrTextureHeader) OVR_ON64(+4) + sizeof(uintptr_t) * 8, + "ovrTexture size mismatch"); + +OVR_STATIC_ASSERT(sizeof(ovrStatusBits) == 4, "ovrStatusBits size mismatch"); + +OVR_STATIC_ASSERT(sizeof(ovrSessionStatus) == 2, "ovrSessionStatus size mismatch"); + +OVR_STATIC_ASSERT(sizeof(ovrEyeRenderDesc) == sizeof(ovrEyeType) + sizeof(ovrFovPort) + sizeof(ovrRecti) + + sizeof(ovrVector2f) + sizeof(ovrVector3f), + "ovrEyeRenderDesc size mismatch"); +OVR_STATIC_ASSERT(sizeof(ovrTimewarpProjectionDesc) == 4 * 3, "ovrTimewarpProjectionDesc size mismatch"); + +OVR_STATIC_ASSERT(sizeof(ovrInitFlags) == 4, "ovrInitFlags size mismatch"); +OVR_STATIC_ASSERT(sizeof(ovrLogLevel) == 4, "ovrLogLevel size mismatch"); + +OVR_STATIC_ASSERT(sizeof(ovrInitParams) == 4 + 4 + sizeof(ovrLogCallback) + sizeof(uintptr_t) + 4 + 4, + "ovrInitParams size mismatch"); + +OVR_STATIC_ASSERT(sizeof(ovrHmdDesc) == + + sizeof(ovrHmdType) // Type + OVR_ON64(+ 4) // pad0 + + 64 // ProductName + + 64 // Manufacturer + + 2 // VendorId + + 2 // ProductId + + 24 // SerialNumber + + 2 // FirmwareMajor + + 2 // FirmwareMinor + + 4 * 4 // CameraFrustumHFovInRadians - CameraFrustumFarZInMeters + + 4 * 4 // AvailableHmdCaps - DefaultTrackingCaps + + sizeof(ovrFovPort) * 2 // DefaultEyeFov + + sizeof(ovrFovPort) * 2 // MaxEyeFov + + sizeof(ovrSizei) // Resolution + + 4 // DisplayRefreshRate + OVR_ON64(+ 4) // pad1 + , "ovrHmdDesc size mismatch"); + + +// ----------------------------------------------------------------------------------- +// ***** Backward compatibility #includes +// +// This is at the bottom of this file because the following is dependent on the +// declarations above. + +#if !defined(OVR_CAPI_NO_UTILS) + #include "Extras/OVR_CAPI_Util.h" +#endif + +/// @endcond + +#endif // OVR_CAPI_h diff --git a/extern/OculusSDK/LibOVR/Include/OVR_CAPI_Audio.h b/extern/OculusSDK/LibOVR/Include/OVR_CAPI_Audio.h new file mode 100644 index 0000000..052fa4d --- /dev/null +++ b/extern/OculusSDK/LibOVR/Include/OVR_CAPI_Audio.h @@ -0,0 +1,48 @@ +/********************************************************************************//** +\file OVR_CAPI_Audio.h +\brief CAPI audio functions. +\copyright Copyright 2015 Oculus VR, LLC. All Rights reserved. +************************************************************************************/ + + +#ifndef OVR_CAPI_Audio_h +#define OVR_CAPI_Audio_h + +#include "OVR_CAPI.h" +#include + +#define OVR_AUDIO_MAX_DEVICE_STR_SIZE 128 + +/// Gets the ID of the preferred VR audio device. +/// +/// Multiple calls to ovr_CreateSwapTextureSetD3D11 for the same ovrHmd is supported, but applications +/// cannot rely on switching between ovrSwapTextureSets at runtime without a performance penalty. +/// +/// \param[out] deviceOutId The ID of the user's preferred VR audio device to use, which will be valid upon a successful return value, else it will be NULL. +/// +/// \return Returns an ovrResult indicating success or failure. In the case of failure, use +/// ovr_GetLastErrorInfo to get more information. +/// +OVR_PUBLIC_FUNCTION(ovrResult) ovr_GetAudioDeviceOutWaveId(UINT* deviceOutId); + + +/// Gets the GUID of the preferred VR audio device as a string. +/// +/// \param[out] deviceOutStrBuffer A buffer where the GUID string for the device will copied to. +/// +/// \return Returns an ovrResult indicating success or failure. In the case of failure, use +/// ovr_GetLastErrorInfo to get more information. +/// +OVR_PUBLIC_FUNCTION(ovrResult) ovr_GetAudioDeviceOutGuidStr(WCHAR deviceOutStrBuffer[OVR_AUDIO_MAX_DEVICE_STR_SIZE]); + + +/// Gets the GUID of the preferred VR audio device. +/// +/// \param[out] deviceOutGuid The GUID of the user's preferred VR audio device to use, which will be valid upon a successful return value, else it will be NULL. +/// +/// \return Returns an ovrResult indicating success or failure. In the case of failure, use +/// ovr_GetLastErrorInfo to get more information. +/// +OVR_PUBLIC_FUNCTION(ovrResult) ovr_GetAudioDeviceOutGuid(GUID* deviceOutGuid); + +#endif // OVR_CAPI_Audio_h diff --git a/extern/OculusSDK/LibOVR/Include/OVR_CAPI_D3D.h b/extern/OculusSDK/LibOVR/Include/OVR_CAPI_D3D.h new file mode 100644 index 0000000..3a03a47 --- /dev/null +++ b/extern/OculusSDK/LibOVR/Include/OVR_CAPI_D3D.h @@ -0,0 +1,128 @@ +/********************************************************************************//** +\file OVR_CAPI_D3D.h +\brief D3D specific structures used by the CAPI interface. +\copyright Copyright 2014 Oculus VR, LLC All Rights reserved. +************************************************************************************/ + +#ifndef OVR_CAPI_D3D_h +#define OVR_CAPI_D3D_h + +#include "OVR_CAPI.h" + +#if defined(_MSC_VER) + #pragma warning(push) + #pragma warning(disable: 4324) // structure was padded due to __declspec(align()) +#endif + +//----------------------------------------------------------------------------------- +// ***** D3D11 Specific +#if defined(_MSC_VER) + #pragma warning(push, 0) +#endif +#include +#if defined(_MSC_VER) + #pragma warning(pop) +#endif + +/// Used to pass D3D11 eye texture data to ovr_EndFrame. +typedef struct OVR_ALIGNAS(OVR_PTR_SIZE) ovrD3D11TextureData_ +{ + ovrTextureHeader Header; ///< General device settings. + OVR_ON64(OVR_UNUSED_STRUCT_PAD(pad0, 4)) ///< \internal struct padding. + ID3D11Texture2D* pTexture; ///< The D3D11 texture containing the undistorted eye image. + ID3D11ShaderResourceView* pSRView; ///< The D3D11 shader resource view for this texture. +} ovrD3D11TextureData; + +OVR_STATIC_ASSERT(sizeof(ovrTexture) >= sizeof(ovrD3D11TextureData), "Insufficient size."); +OVR_STATIC_ASSERT(sizeof(ovrD3D11TextureData) == sizeof(ovrTextureHeader) OVR_ON64(+4) + 2 * OVR_PTR_SIZE, "size mismatch"); + + +/// Contains D3D11-specific texture information. +union ovrD3D11Texture +{ + ovrTexture Texture; ///< General device settings. + ovrD3D11TextureData D3D11; ///< D3D11-specific settings. +}; + + +#if defined(_MSC_VER) + #pragma warning(pop) +#endif + +/// Flags used when creating a swap texture set for a D3D11 renderer +typedef enum ovrSwapTextureSetD3D11Flags_ +{ + ovrSwapTextureSetD3D11_Typeless = 0x0001, ///< Forces creation of a DXGI_*_TYPELESS texture. ShaderResourceView still uses specified format. + + ovrSwapTextureSetD3D11_EnumSize = 0x7fffffff ///< \internal Force type int32_t. +} ovrSwapTextureSetD3D11Flags; + +/// Create Texture Set suitable for use with D3D11. +/// +/// Multiple calls to ovr_CreateSwapTextureSetD3D11 for the same ovrHmd are supported, but applications +/// cannot rely on switching between ovrSwapTextureSets at runtime without a performance penalty. +/// +/// \param[in] session Specifies an ovrSession previously returned by ovr_Create. +/// \param[in] device Specifies the associated ID3D11Device, which must be the one that the textures will be used with in the application's process. +/// \param[in] desc Specifies requested texture properties. See notes for more info about texture format. +/// \param[in] miscFlags Specifies misc bit flags of type \a ovrSwapTextureSetD3D11Flags used when creating the swap textures +/// \param[out] outTextureSet Specifies the created ovrSwapTextureSet, which will be valid upon a successful return value, else it will be NULL. +/// This texture set must be eventually destroyed via ovr_DestroySwapTextureSet before destroying the HMD with ovr_Destroy. +/// +/// \return Returns an ovrResult indicating success or failure. In the case of failure, use +/// ovr_GetLastErrorInfo to get more information. +/// +/// \note The texture format provided in \a desc should be thought of as the format the distortion-compositor will use for the +/// ShaderResourceView when reading the contents of the texture. To that end, it is highly recommended that the application +/// requests swap-texture-set formats that are in sRGB-space (e.g. DXGI_FORMAT_R8G8B8A8_UNORM_SRGB) as the compositor +/// does sRGB-correct rendering. As such, the compositor relies on the GPU's hardware sampler to do the sRGB-to-linear +/// conversion. If the application still prefers to render to a linear format (e.g. DXGI_FORMAT_R8G8B8A8_UNORM) while handling the +/// linear-to-gamma conversion via HLSL code, then the application must still request the corresponding sRGB format and also use +/// the \a ovrSwapTextureSetD3D11_Typeless flag. This will allow the application to create a RenderTargetView that is the desired +/// linear format while the compositor continues to treat it as sRGB. Failure to do so will cause the compositor to apply +/// unexpected gamma conversions leading to gamma-curve artifacts. The \a ovrSwapTextureSetD3D11_Typeless flag for depth buffer +/// formats (e.g. DXGI_FORMAT_D32) are ignored as they are always converted to be typeless. +/// +/// \see ovr_DestroySwapTextureSet +/// +OVR_PUBLIC_FUNCTION(ovrResult) ovr_CreateSwapTextureSetD3D11(ovrSession session, + ID3D11Device* device, + const D3D11_TEXTURE2D_DESC* desc, + unsigned int miscFlags, + ovrSwapTextureSet** outTextureSet); + +/// Create Mirror Texture which is auto-refreshed to mirror Rift contents produced by this application. +/// +/// A second call to ovr_CreateMirrorTextureD3D11 for a given ovrHmd before destroying the first one +/// is not supported and will result in an error return. +/// +/// \param[in] session Specifies an ovrSession previously returned by ovr_Create. +/// \param[in] device Specifies the associated ID3D11Device, which must be the one that the textures will be used with in the application's process. +/// \param[in] desc Specifies requested texture properties. See notes for info about texture format. +/// \param[in] miscFlags Specifies misc bit flags of type \a ovrSwapTextureSetD3D11Flags used when creating the swap textures +/// \param[out] outMirrorTexture Specifies the created ovrTexture, which will be valid upon a successful return value, else it will be NULL. +/// This texture must be eventually destroyed via ovr_DestroyMirrorTexture before destroying the HMD with ovr_Destroy. +/// +/// \return Returns an ovrResult indicating success or failure. In the case of failure, use +/// ovr_GetLastErrorInfo to get more information. +/// +/// \note The texture format provided in \a desc should be thought of as the format the compositor will use for the RenderTargetView when +/// writing into mirror texture. To that end, it is highly recommended that the application requests a mirror texture format that is +/// in sRGB-space (e.g. DXGI_FORMAT_R8G8B8A8_UNORM_SRGB) as the compositor does sRGB-correct rendering. If however the application wants +/// to still read the mirror texture as a linear format (e.g. DXGI_FORMAT_R8G8B8A8_UNORM) and handle the sRGB-to-linear conversion in +/// HLSL code, then it is recommended the application still requests an sRGB format and also use the \a ovrSwapTextureSetD3D11_Typeless +/// flag. This will allow the application to bind a ShaderResourceView that is a linear format while the compositor continues +/// to treat is as sRGB. Failure to do so will cause the compositor to apply unexpected gamma conversions leading to +/// gamma-curve artifacts. +/// +/// \see ovr_DestroyMirrorTexture +/// +OVR_PUBLIC_FUNCTION(ovrResult) ovr_CreateMirrorTextureD3D11(ovrSession session, + ID3D11Device* device, + const D3D11_TEXTURE2D_DESC* desc, + unsigned int miscFlags, + ovrTexture** outMirrorTexture); + + + +#endif // OVR_CAPI_D3D_h diff --git a/extern/OculusSDK/LibOVR/Include/OVR_CAPI_GL.h b/extern/OculusSDK/LibOVR/Include/OVR_CAPI_GL.h new file mode 100644 index 0000000..b4ed399 --- /dev/null +++ b/extern/OculusSDK/LibOVR/Include/OVR_CAPI_GL.h @@ -0,0 +1,103 @@ +/********************************************************************************//** +\file OVR_CAPI_GL.h +\brief OpenGL-specific structures used by the CAPI interface. +\copyright Copyright 2013 Oculus VR, LLC. All Rights reserved. +************************************************************************************/ + +#ifndef OVR_CAPI_GL_h +#define OVR_CAPI_GL_h + +#include "OVR_CAPI.h" + +// We avoid gl.h #includes here which interferes with some users' use of alternatives and typedef GLuint manually. +typedef unsigned int GLuint; + + +#if defined(_MSC_VER) + #pragma warning(push) + #pragma warning(disable: 4324) // structure was padded due to __declspec(align()) +#endif + +/// Used to pass GL eye texture data to ovr_EndFrame. +typedef struct ovrGLTextureData_s +{ + ovrTextureHeader Header; ///< General device settings. + GLuint TexId; ///< The OpenGL name for this texture. +} ovrGLTextureData; + +OVR_STATIC_ASSERT(sizeof(ovrTexture) >= sizeof(ovrGLTextureData), "Insufficient size."); +OVR_STATIC_ASSERT(sizeof(ovrGLTextureData) == sizeof(ovrTextureHeader) + 4, "size mismatch"); + +/// Contains OpenGL-specific texture information. +typedef union ovrGLTexture_s +{ + ovrTexture Texture; ///< General device settings. + ovrGLTextureData OGL; ///< OpenGL-specific settings. +} ovrGLTexture; + + +#if defined(_MSC_VER) + #pragma warning(pop) +#endif + + + +/// Creates a Texture Set suitable for use with OpenGL. +/// +/// Multiple calls to ovr_CreateSwapTextureSetD3D11 for the same ovrHmd are supported, but applications +/// cannot rely on switching between ovrSwapTextureSets at runtime without a performance penalty. +/// +/// \param[in] session Specifies an ovrSession previously returned by ovr_Create. +/// \param[in] format Specifies the texture format. +/// \param[in] width Specifies the requested texture width. +/// \param[in] height Specifies the requested texture height. +/// \param[out] outTextureSet Specifies the created ovrSwapTextureSet, which will be valid upon a successful return value, else it will be NULL. +/// This texture set must be eventually destroyed via ovr_DestroySwapTextureSet before destroying the HMD with ovr_Destroy. +/// +/// \return Returns an ovrResult indicating success or failure. In the case of failure, use +/// ovr_GetLastErrorInfo to get more information. +/// +/// \note The \a format provided should be thought of as the format the distortion compositor will use when reading the contents of the +/// texture. To that end, it is highly recommended that the application requests swap-texture-set formats that are in sRGB-space (e.g. GL_SRGB_ALPHA8) +/// as the distortion compositor does sRGB-correct rendering. Furthermore, the app should then make sure "glEnable(GL_FRAMEBUFFER_SRGB);" +/// is called before rendering into these textures. Even though it is not recommended, if the application would like to treat the +/// texture as a linear format and do linear-to-gamma conversion in GLSL, then the application can avoid calling "glEnable(GL_FRAMEBUFFER_SRGB);", +/// but should still pass in GL_SRGB_ALPHA8 (not GL_RGBA) for the \a format. Failure to do so will cause the distortion compositor +/// to apply incorrect gamma conversions leading to gamma-curve artifacts. +/// +/// \see ovr_DestroySwapTextureSet +/// +OVR_PUBLIC_FUNCTION(ovrResult) ovr_CreateSwapTextureSetGL(ovrSession session, GLuint format, + int width, int height, + ovrSwapTextureSet** outTextureSet); + + +/// Creates a Mirror Texture which is auto-refreshed to mirror Rift contents produced by this application. +/// +/// A second call to ovr_CreateMirrorTextureGL for a given ovrHmd before destroying the first one +/// is not supported and will result in an error return. +/// +/// \param[in] session Specifies an ovrSession previously returned by ovr_Create. +/// \param[in] format Specifies the texture format. +/// \param[in] width Specifies the requested texture width. +/// \param[in] height Specifies the requested texture height. +/// \param[out] outMirrorTexture Specifies the created ovrSwapTexture, which will be valid upon a successful return value, else it will be NULL. +/// This texture must be eventually destroyed via ovr_DestroyMirrorTexture before destroying the HMD with ovr_Destroy. +/// +/// \return Returns an ovrResult indicating success or failure. In the case of failure, use +/// ovr_GetLastErrorInfo to get more information. +/// +/// \note The \a format provided should be thought of as the format the distortion compositor will use when writing into the mirror +/// texture. It is highly recommended that mirror textures are requested as GL_SRGB_ALPHA8 because the distortion compositor +/// does sRGB-correct rendering. If the application requests a non-sRGB format (e.g. GL_RGBA) as the mirror texture, +/// then the application might have to apply a manual linear-to-gamma conversion when reading from the mirror texture. +/// Failure to do so can result in incorrect gamma conversions leading to gamma-curve artifacts and color banding. +/// +/// \see ovr_DestroyMirrorTexture +/// +OVR_PUBLIC_FUNCTION(ovrResult) ovr_CreateMirrorTextureGL(ovrSession session, GLuint format, + int width, int height, + ovrTexture** outMirrorTexture); + + +#endif // OVR_CAPI_GL_h diff --git a/extern/OculusSDK/LibOVR/Include/OVR_CAPI_Keys.h b/extern/OculusSDK/LibOVR/Include/OVR_CAPI_Keys.h new file mode 100644 index 0000000..0e62893 --- /dev/null +++ b/extern/OculusSDK/LibOVR/Include/OVR_CAPI_Keys.h @@ -0,0 +1,61 @@ +/********************************************************************************//** +\file OVR_CAPI.h +\brief Keys for CAPI calls +\copyright Copyright 2014 Oculus VR, LLC All Rights reserved. +************************************************************************************/ + +#ifndef OVR_CAPI_Keys_h +#define OVR_CAPI_Keys_h + +#include "OVR_Version.h" + + +#define OVR_KEY_USER "User" // string +#define OVR_KEY_NAME "Name" // string +#define OVR_KEY_GENDER "Gender" // string "Male", "Female", or "Unknown" +#define OVR_KEY_PLAYER_HEIGHT "PlayerHeight" // float meters +#define OVR_KEY_EYE_HEIGHT "EyeHeight" // float meters +#define OVR_KEY_IPD "IPD" // float meters +#define OVR_KEY_NECK_TO_EYE_DISTANCE "NeckEyeDistance" // float[2] meters +#define OVR_KEY_EYE_RELIEF_DIAL "EyeReliefDial" // int in range of 0-10 +#define OVR_KEY_EYE_TO_NOSE_DISTANCE "EyeToNoseDist" // float[2] meters +#define OVR_KEY_MAX_EYE_TO_PLATE_DISTANCE "MaxEyeToPlateDist" // float[2] meters +#define OVR_KEY_EYE_CUP "EyeCup" // char[16] "A", "B", or "C" +#define OVR_KEY_CUSTOM_EYE_RENDER "CustomEyeRender" // bool +//Legacy profile value tied to the device and serial +#define OVR_KEY_CAMERA_POSITION_1 "CenteredFromWorld" // double[7] ovrPosef quat rotation x, y, z, w, translation x, y, z +//New value that now only ties to the device so that swapping headsets retains the offset from the tracker +#define OVR_KEY_CAMERA_POSITION_2 "CenteredFromWorld2" // double[7] ovrPosef quat rotation x, y, z, w, translation x, y, z +#define OVR_KEY_CAMERA_POSITION OVR_KEY_CAMERA_POSITION_2 + + +// Default measurements empirically determined at Oculus to make us happy +// The neck model numbers were derived as an average of the male and female averages from ANSUR-88 +// NECK_TO_EYE_HORIZONTAL = H22 - H43 = INFRAORBITALE_BACK_OF_HEAD - TRAGION_BACK_OF_HEAD +// NECK_TO_EYE_VERTICAL = H21 - H15 = GONION_TOP_OF_HEAD - ECTOORBITALE_TOP_OF_HEAD +// These were determined to be the best in a small user study, clearly beating out the previous default values +#define OVR_DEFAULT_GENDER "Unknown" +#define OVR_DEFAULT_PLAYER_HEIGHT 1.778f +#define OVR_DEFAULT_EYE_HEIGHT 1.675f +#define OVR_DEFAULT_IPD 0.064f +#define OVR_DEFAULT_NECK_TO_EYE_HORIZONTAL 0.0805f +#define OVR_DEFAULT_NECK_TO_EYE_VERTICAL 0.075f +#define OVR_DEFAULT_EYE_RELIEF_DIAL 3 +#define OVR_DEFAULT_CAMERA_POSITION {0,0,0,1,0,0,0} + +#define OVR_PERF_HUD_MODE "PerfHudMode" // allowed values are defined in enum ovrPerfHudMode + +#define OVR_LAYER_HUD_MODE "LayerHudMode" // allowed values are defined in enum ovrLayerHudMode +#define OVR_LAYER_HUD_CURRENT_LAYER "LayerHudCurrentLayer" // The layer to show +#define OVR_LAYER_HUD_SHOW_ALL_LAYERS "LayerHudShowAll" // Hide other layers when the hud is enabled + +#define OVR_DEBUG_HUD_STEREO_MODE "DebugHudStereoMode" // allowed values are defined in enum ovrDebugHudStereoMode +#define OVR_DEBUG_HUD_STEREO_GUIDE_INFO_ENABLE "DebugHudStereoGuideInfoEnable" // bool +#define OVR_DEBUG_HUD_STEREO_GUIDE_SIZE "DebugHudStereoGuideSize2f" // float[2] +#define OVR_DEBUG_HUD_STEREO_GUIDE_POSITION "DebugHudStereoGuidePosition3f" // float[3] +#define OVR_DEBUG_HUD_STEREO_GUIDE_YAWPITCHROLL "DebugHudStereoGuideYawPitchRoll3f" // float[3] +#define OVR_DEBUG_HUD_STEREO_GUIDE_COLOR "DebugHudStereoGuideColor4f" // float[4] + + + +#endif // OVR_CAPI_Keys_h diff --git a/extern/OculusSDK/LibOVR/Include/OVR_ErrorCode.h b/extern/OculusSDK/LibOVR/Include/OVR_ErrorCode.h new file mode 100644 index 0000000..8f44878 --- /dev/null +++ b/extern/OculusSDK/LibOVR/Include/OVR_ErrorCode.h @@ -0,0 +1,145 @@ +/********************************************************************************//** +\file OVR_ErrorCode.h +\brief This header provides LibOVR error code declarations. +\copyright Copyright 2015 Oculus VR, LLC All Rights reserved. +*************************************************************************************/ + +#ifndef OVR_ErrorCode_h +#define OVR_ErrorCode_h + + +#include "OVR_Version.h" +#include + + + + + + + +#ifndef OVR_RESULT_DEFINED +#define OVR_RESULT_DEFINED ///< Allows ovrResult to be independently defined. +/// API call results are represented at the highest level by a single ovrResult. +typedef int32_t ovrResult; +#endif + + +/// \brief Indicates if an ovrResult indicates success. +/// +/// Some functions return additional successful values other than ovrSucces and +/// require usage of this macro to indicate successs. +/// +#if !defined(OVR_SUCCESS) + #define OVR_SUCCESS(result) (result >= 0) +#endif + + +/// \brief Indicates if an ovrResult indicates an unqualified success. +/// +/// This is useful for indicating that the code intentionally wants to +/// check for result == ovrSuccess as opposed to OVR_SUCCESS(), which +/// checks for result >= ovrSuccess. +/// +#if !defined(OVR_UNQUALIFIED_SUCCESS) + #define OVR_UNQUALIFIED_SUCCESS(result) (result == ovrSuccess) +#endif + + +/// \brief Indicates if an ovrResult indicates failure. +/// +#if !defined(OVR_FAILURE) + #define OVR_FAILURE(result) (!OVR_SUCCESS(result)) +#endif + + +// Success is a value greater or equal to 0, while all error types are negative values. +#ifndef OVR_SUCCESS_DEFINED +#define OVR_SUCCESS_DEFINED ///< Allows ovrResult to be independently defined. +typedef enum ovrSuccessType_ +{ + /// This is a general success result. Use OVR_SUCCESS to test for success. + ovrSuccess = 0, + + /// Returned from a call to SubmitFrame. The call succeeded, but what the app + /// rendered will not be visible on the HMD. Ideally the app should continue + /// calling SubmitFrame, but not do any rendering. When the result becomes + /// ovrSuccess, rendering should continue as usual. + ovrSuccess_NotVisible = 1000, + + ovrSuccess_HMDFirmwareMismatch = 4100, ///< The HMD Firmware is out of date but is acceptable. + ovrSuccess_TrackerFirmwareMismatch = 4101, ///< The Tracker Firmware is out of date but is acceptable. + ovrSuccess_ControllerFirmwareMismatch = 4104, ///< The controller firmware is out of date but is acceptable. + +} ovrSuccessType; +#endif + + +typedef enum ovrErrorType_ +{ + /* General errors */ + ovrError_MemoryAllocationFailure = -1000, ///< Failure to allocate memory. + ovrError_SocketCreationFailure = -1001, ///< Failure to create a socket. + ovrError_InvalidSession = -1002, ///< Invalid ovrSession parameter provided. + ovrError_Timeout = -1003, ///< The operation timed out. + ovrError_NotInitialized = -1004, ///< The system or component has not been initialized. + ovrError_InvalidParameter = -1005, ///< Invalid parameter provided. See error info or log for details. + ovrError_ServiceError = -1006, ///< Generic service error. See error info or log for details. + ovrError_NoHmd = -1007, ///< The given HMD doesn't exist. + + /* Audio error range, reserved for Audio errors. */ + ovrError_AudioReservedBegin = -2000, ///< First Audio error. + ovrError_AudioDeviceNotFound = -2001, ///< Failure to find the specified audio device. + ovrError_AudioComError = -2002, ///< Generic COM error. + ovrError_AudioReservedEnd = -2999, ///< Last Audio error. + + /* Initialization errors. */ + ovrError_Initialize = -3000, ///< Generic initialization error. + ovrError_LibLoad = -3001, ///< Couldn't load LibOVRRT. + ovrError_LibVersion = -3002, ///< LibOVRRT version incompatibility. + ovrError_ServiceConnection = -3003, ///< Couldn't connect to the OVR Service. + ovrError_ServiceVersion = -3004, ///< OVR Service version incompatibility. + ovrError_IncompatibleOS = -3005, ///< The operating system version is incompatible. + ovrError_DisplayInit = -3006, ///< Unable to initialize the HMD display. + ovrError_ServerStart = -3007, ///< Unable to start the server. Is it already running? + ovrError_Reinitialization = -3008, ///< Attempting to re-initialize with a different version. + ovrError_MismatchedAdapters = -3009, ///< Chosen rendering adapters between client and service do not match + ovrError_LeakingResources = -3010, ///< Calling application has leaked resources + ovrError_ClientVersion = -3011, ///< Client version too old to connect to service + ovrError_OutOfDateOS = -3012, ///< The operating system is out of date. + ovrError_OutOfDateGfxDriver = -3013, ///< The graphics driver is out of date. + ovrError_IncompatibleGPU = -3014, ///< The graphics hardware is not supported + ovrError_NoValidVRDisplaySystem = -3015, ///< No valid VR display system found. + + /* Hardware errors */ + ovrError_InvalidBundleAdjustment = -4000, ///< Headset has no bundle adjustment data. + ovrError_USBBandwidth = -4001, ///< The USB hub cannot handle the camera frame bandwidth. + ovrError_USBEnumeratedSpeed = -4002, ///< The USB camera is not enumerating at the correct device speed. + ovrError_ImageSensorCommError = -4003, ///< Unable to communicate with the image sensor. + ovrError_GeneralTrackerFailure = -4004, ///< We use this to report various tracker issues that don't fit in an easily classifiable bucket. + ovrError_ExcessiveFrameTruncation = -4005, ///< A more than acceptable number of frames are coming back truncated. + ovrError_ExcessiveFrameSkipping = -4006, ///< A more than acceptable number of frames have been skipped. + ovrError_SyncDisconnected = -4007, ///< The tracker is not receiving the sync signal (cable disconnected?) + ovrError_TrackerMemoryReadFailure = -4008, ///< Failed to read memory from the tracker + ovrError_TrackerMemoryWriteFailure = -4009, ///< Failed to write memory from the tracker + ovrError_TrackerFrameTimeout = -4010, ///< Timed out waiting for a camera frame + ovrError_TrackerTruncatedFrame = -4011, ///< Truncated frame returned from tracker + ovrError_HMDFirmwareMismatch = -4100, ///< The HMD Firmware is out of date and is unacceptable. + ovrError_TrackerFirmwareMismatch = -4101, ///< The Tracker Firmware is out of date and is unacceptable. + ovrError_BootloaderDeviceDetected = -4102, ///< A bootloader HMD is detected by the service + ovrError_TrackerCalibrationError = -4103, ///< The tracker calibration is missing or incorrect + ovrError_ControllerFirmwareMismatch = -4104, ///< The controller firmware is out of date and is unacceptable + + /* Synchronization errors */ + ovrError_Incomplete = -5000, /// + + + + + + + echo static const char* OVR_FORCE_REBUILD_PRE = __TIMESTAMP__; /* DO NOT SOURCE CONTROL THIS FILE */ > "$(ProjectDir)OVR_ForceRebuildNoCheckin.h" + + + + + Force a rebuild. Please do not check in the ForceRebuildNoCheckin.h file. + + + echo static const char* OVR_FORCE_REBUILD_POST = __TIMESTAMP__; /* DO NOT SOURCE CONTROL THIS FILE */ > "$(ProjectDir)OVR_ForceRebuildNoCheckin.h" + + + Force a rebuild. Please do not check in the ForceRebuildNoCheckin.h file. + + + "$(ProjectDir)OVR_ForceRebuildNoCheckin.h" + + + + \ No newline at end of file diff --git a/extern/OculusSDK/LibOVR/Projects/Windows/LibOVR.props b/extern/OculusSDK/LibOVR/Projects/Windows/LibOVR.props new file mode 100644 index 0000000..64aa882 --- /dev/null +++ b/extern/OculusSDK/LibOVR/Projects/Windows/LibOVR.props @@ -0,0 +1,30 @@ + + + + + 0 + 8 + 0 + 0 + 0 + + + + + + $(OVR_PRODUCT_VERSION) + + + $(OVR_MAJOR_VERSION) + + + $(OVR_MINOR_VERSION) + + + $(OVR_PATCH_VERSION) + + + $(OVR_BUILD_VERSION) + + + diff --git a/extern/OculusSDK/LibOVR/Projects/Windows/OVRRootPath.props b/extern/OculusSDK/LibOVR/Projects/Windows/OVRRootPath.props new file mode 100644 index 0000000..21e3266 --- /dev/null +++ b/extern/OculusSDK/LibOVR/Projects/Windows/OVRRootPath.props @@ -0,0 +1,15 @@ + + + + + $(ProjectDir)../../../../ + + + + + + $(OVRSDKROOT) + true + + + \ No newline at end of file diff --git a/extern/OculusSDK/LibOVR/Projects/Windows/VS2010/LibOVR.vcxproj b/extern/OculusSDK/LibOVR/Projects/Windows/VS2010/LibOVR.vcxproj new file mode 100644 index 0000000..55d5cd2 --- /dev/null +++ b/extern/OculusSDK/LibOVR/Projects/Windows/VS2010/LibOVR.vcxproj @@ -0,0 +1,235 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + + + + + + + + + + + {EA50E705-5113-49E5-B105-2512EDC8DDC6} + Win32Proj + LibOVR + LibOVR + + + + StaticLibrary + true + Unicode + v100 + + + StaticLibrary + true + Unicode + v100 + + + StaticLibrary + false + true + Unicode + v100 + + + StaticLibrary + false + true + Unicode + v100 + + + + + + + + + + + + + + + + + + + ../../../Lib/Windows/$(Platform)/$(Configuration)/VS2010/ + + + ../../../Lib/Windows/$(Platform)/$(Configuration)/VS2010/ + + + ../../../Obj/Windows/$(Platform)/$(Configuration)/VS2010/ + + + ../../../Obj/Windows/$(Platform)/$(Configuration)/VS2010/ + + + LibOVR + + + LibOVR + + + ../../../Lib/Windows/$(Platform)/$(Configuration)/VS2010/ + + + ../../../Lib/Windows/$(Platform)/$(Configuration)/VS2010/ + + + ../../../Obj/Windows/$(Platform)/$(Configuration)/VS2010/ + + + ../../../Obj/Windows/$(Platform)/$(Configuration)/VS2010/ + + + LibOVR + + + LibOVR + + + + NotUsing + Level4 + Disabled + OVR_BUILD_DEBUG;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + OldStyle + true + false + true + MultiThreadedDebug + %(AdditionalIncludeDirectories);../../../Include + false + /FC %(AdditionalOptions) + false + false + + + Windows + true + + + + + + + + + NotUsing + Level4 + Disabled + OVR_BUILD_DEBUG;_WIN64;_DEBUG;_LIB;%(PreprocessorDefinitions) + OldStyle + true + false + true + MultiThreadedDebug + %(AdditionalIncludeDirectories);../../../Include + false + false + /FC %(AdditionalOptions) + false + false + + + Windows + true + + + + + + + + + Level4 + NotUsing + MaxSpeed + true + true + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + MultiThreaded + true + true + OldStyle + %(AdditionalIncludeDirectories);../../../Include + false + /FC /d2Zi+ %(AdditionalOptions) + false + false + + + Windows + true + true + true + + + + + + + + + Level4 + NotUsing + MaxSpeed + true + true + _WIN64;NDEBUG;_LIB;%(PreprocessorDefinitions) + MultiThreaded + true + true + OldStyle + %(AdditionalIncludeDirectories);../../../Include + false + /FC /d2Zi+ %(AdditionalOptions) + false + false + + + Windows + true + true + true + + + + + + + + + + \ No newline at end of file diff --git a/extern/OculusSDK/LibOVR/Projects/Windows/VS2010/LibOVR.vcxproj.filters b/extern/OculusSDK/LibOVR/Projects/Windows/VS2010/LibOVR.vcxproj.filters new file mode 100644 index 0000000..1e52d70 --- /dev/null +++ b/extern/OculusSDK/LibOVR/Projects/Windows/VS2010/LibOVR.vcxproj.filters @@ -0,0 +1,37 @@ + + + + + {19aff241-4a7e-4895-92de-c834a9ebc8f1} + + + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + + + + + + + \ No newline at end of file diff --git a/extern/OculusSDK/LibOVR/Projects/Windows/VS2012/LibOVR.vcxproj b/extern/OculusSDK/LibOVR/Projects/Windows/VS2012/LibOVR.vcxproj new file mode 100644 index 0000000..84f0343 --- /dev/null +++ b/extern/OculusSDK/LibOVR/Projects/Windows/VS2012/LibOVR.vcxproj @@ -0,0 +1,234 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + + + + + + + + + + + {EA50E705-5113-49E5-B105-2512EDC8DDC6} + Win32Proj + LibOVR + LibOVR + + + + StaticLibrary + true + Unicode + v110 + + + StaticLibrary + true + Unicode + v110 + + + StaticLibrary + false + true + Unicode + v110 + + + StaticLibrary + false + true + Unicode + v110 + + + + + + + + + + + + + + + + + + + ../../../Lib/Windows/$(Platform)/$(Configuration)/VS2012/ + + + ../../../Lib/Windows/$(Platform)/$(Configuration)/VS2012/ + + + ../../../Obj/Windows/$(Platform)/$(Configuration)/VS2012/ + + + ../../../Obj/Windows/$(Platform)/$(Configuration)/VS2012/ + + + LibOVR + + + LibOVR + + + ../../../Lib/Windows/$(Platform)/$(Configuration)/VS2012/ + + + ../../../Lib/Windows/$(Platform)/$(Configuration)/VS2012/ + + + ../../../Obj/Windows/$(Platform)/$(Configuration)/VS2012/ + + + ../../../Obj/Windows/$(Platform)/$(Configuration)/VS2012/ + + + LibOVR + + + LibOVR + + + + NotUsing + Level4 + Disabled + OVR_BUILD_DEBUG;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + OldStyle + true + false + true + MultiThreadedDebug + %(AdditionalIncludeDirectories);../../../Include + false + /FC %(AdditionalOptions) + false + false + + + Windows + true + + + + + + + + + NotUsing + Level4 + Disabled + OVR_BUILD_DEBUG;_WIN64;_DEBUG;_LIB;%(PreprocessorDefinitions) + OldStyle + true + false + true + MultiThreadedDebug + %(AdditionalIncludeDirectories);../../../Include + false + false + false + false + + + Windows + true + + + + + + + + + Level4 + NotUsing + MaxSpeed + true + true + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + MultiThreaded + true + true + OldStyle + %(AdditionalIncludeDirectories);../../../Include + false + /d2Zi+ %(AdditionalOptions) + false + false + + + Windows + true + true + true + + + + + + + + + Level4 + NotUsing + MaxSpeed + true + true + _WIN64;NDEBUG;_LIB;%(PreprocessorDefinitions) + MultiThreaded + true + true + OldStyle + %(AdditionalIncludeDirectories);../../../Include + false + /d2Zi+ %(AdditionalOptions) + false + false + + + Windows + true + true + true + + + + + + + + + + \ No newline at end of file diff --git a/extern/OculusSDK/LibOVR/Projects/Windows/VS2012/LibOVR.vcxproj.filters b/extern/OculusSDK/LibOVR/Projects/Windows/VS2012/LibOVR.vcxproj.filters new file mode 100644 index 0000000..1e52d70 --- /dev/null +++ b/extern/OculusSDK/LibOVR/Projects/Windows/VS2012/LibOVR.vcxproj.filters @@ -0,0 +1,37 @@ + + + + + {19aff241-4a7e-4895-92de-c834a9ebc8f1} + + + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + + + + + + + \ No newline at end of file diff --git a/extern/OculusSDK/LibOVR/Projects/Windows/VS2013/LibOVR.vcxproj b/extern/OculusSDK/LibOVR/Projects/Windows/VS2013/LibOVR.vcxproj new file mode 100644 index 0000000..84db957 --- /dev/null +++ b/extern/OculusSDK/LibOVR/Projects/Windows/VS2013/LibOVR.vcxproj @@ -0,0 +1,453 @@ + + + + + DebugSingleProcess + Win32 + + + DebugSingleProcess + x64 + + + Debug + Win32 + + + Debug + x64 + + + ReleaseSingleProcess + Win32 + + + ReleaseSingleProcess + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + + + + + + + + + + + {EA50E705-5113-49E5-B105-2512EDC8DDC6} + Win32Proj + LibOVR + LibOVR + + + + StaticLibrary + true + Unicode + v120 + + + StaticLibrary + true + Unicode + v120 + + + StaticLibrary + true + Unicode + v120 + + + StaticLibrary + true + Unicode + v120 + + + StaticLibrary + false + true + Unicode + v120 + + + StaticLibrary + false + true + Unicode + v120 + + + StaticLibrary + false + true + Unicode + v120 + + + StaticLibrary + false + true + Unicode + v120 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + $(ProjectDir)../../../Lib/Windows/$(Platform)/$(Configuration)/VS2013/ + + + $(ProjectDir)../../../Lib/Windows/$(Platform)/Debug/VS2013/ + + + $(ProjectDir)../../../Lib/Windows/$(Platform)/$(Configuration)/VS2013/ + + + $(ProjectDir)../../../Lib/Windows/$(Platform)/Debug/VS2013/ + + + $(ProjectDir)../../../Obj/$(ProjectName)/Windows/$(Platform)/$(Configuration)/VS2013/ + + + $(ProjectDir)../../../Obj/$(ProjectName)/Windows/$(Platform)/$(Configuration)/VS2013/ + + + $(ProjectDir)../../../Obj/$(ProjectName)/Windows/$(Platform)/$(Configuration)/VS2013/ + + + $(ProjectDir)../../../Obj/$(ProjectName)/Windows/$(Platform)/$(Configuration)/VS2013/ + + + LibOVR + + + LibOVR + + + LibOVR + + + LibOVR + + + $(ProjectDir)../../../Lib/Windows/$(Platform)/$(Configuration)/VS2013/ + + + $(ProjectDir)../../../Lib/Windows/$(Platform)/Release/VS2013/ + + + $(ProjectDir)../../../Lib/Windows/$(Platform)/$(Configuration)/VS2013/ + + + $(ProjectDir)../../../Lib/Windows/$(Platform)/Release/VS2013/ + + + $(ProjectDir)../../../Obj/$(ProjectName)/Windows/$(Platform)/$(Configuration)/VS2013/ + + + $(ProjectDir)../../../Obj/$(ProjectName)/Windows/$(Platform)/$(Configuration)/VS2013/ + + + $(ProjectDir)../../../Obj/$(ProjectName)/Windows/$(Platform)/$(Configuration)/VS2013/ + + + $(ProjectDir)../../../Obj/$(ProjectName)/Windows/$(Platform)/$(Configuration)/VS2013/ + + + LibOVR + + + LibOVR + + + LibOVR + + + LibOVR + + + + + + Level4 + Disabled + WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + OldStyle + true + false + true + MultiThreadedDebug + %(AdditionalIncludeDirectories);../../../Include + false + /FC %(AdditionalOptions) + false + false + + + + Windows + true + + + + + + + + + + + Level4 + Disabled + OVR_SINGLE_PROCESS;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + OldStyle + true + false + true + MultiThreadedDebug + %(AdditionalIncludeDirectories);../../../Include + false + /FC %(AdditionalOptions) + false + false + + + Windows + true + + + + + + + + + + + Level4 + Disabled + _WIN64;_DEBUG;_LIB;%(PreprocessorDefinitions) + OldStyle + true + false + true + MultiThreadedDebug + %(AdditionalIncludeDirectories);../../../Include + false + false + /FC %(AdditionalOptions) + false + false + + + Windows + true + + + + + + + + + + + Level4 + Disabled + OVR_SINGLE_PROCESS;_WIN64;_DEBUG;_LIB;%(PreprocessorDefinitions) + OldStyle + true + false + true + MultiThreadedDebug + %(AdditionalIncludeDirectories);../../../Include + false + false + /FC %(AdditionalOptions) + false + false + + + Windows + true + + + + + + + + + Level4 + + + MaxSpeed + true + true + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + MultiThreaded + true + true + OldStyle + %(AdditionalIncludeDirectories);../../../Include + false + /FC /d2Zi+ %(AdditionalOptions) + false + false + + + Windows + true + true + true + + + + + + + + + Level4 + + + MaxSpeed + true + true + OVR_SINGLE_PROCESS;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + MultiThreaded + true + true + OldStyle + %(AdditionalIncludeDirectories);../../../Include + false + /FC /d2Zi+ %(AdditionalOptions) + false + false + + + Windows + true + true + true + + + + + + + + + Level4 + + + MaxSpeed + true + true + _WIN64;NDEBUG;_LIB;%(PreprocessorDefinitions) + MultiThreaded + true + true + OldStyle + %(AdditionalIncludeDirectories);../../../Include + false + /FC /d2Zi+ %(AdditionalOptions) + false + false + + + Windows + true + true + true + + + + + + + + + Level4 + + + MaxSpeed + true + true + OVR_SINGLE_PROCESS;_WIN64;NDEBUG;_LIB;%(PreprocessorDefinitions) + MultiThreaded + true + true + OldStyle + %(AdditionalIncludeDirectories);../../../Include + false + /FC /d2Zi+ %(AdditionalOptions) + false + false + + + Windows + true + true + true + + + + + + + + + + \ No newline at end of file diff --git a/extern/OculusSDK/LibOVR/Projects/Windows/VS2013/LibOVR.vcxproj.filters b/extern/OculusSDK/LibOVR/Projects/Windows/VS2013/LibOVR.vcxproj.filters new file mode 100644 index 0000000..b623497 --- /dev/null +++ b/extern/OculusSDK/LibOVR/Projects/Windows/VS2013/LibOVR.vcxproj.filters @@ -0,0 +1,39 @@ + + + + + {19aff241-4a7e-4895-92de-c834a9ebc8f1} + + + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + + + + + + \ No newline at end of file diff --git a/extern/OculusSDK/LibOVR/Projects/Windows/VS2015/LibOVR.vcxproj b/extern/OculusSDK/LibOVR/Projects/Windows/VS2015/LibOVR.vcxproj new file mode 100644 index 0000000..86298a5 --- /dev/null +++ b/extern/OculusSDK/LibOVR/Projects/Windows/VS2015/LibOVR.vcxproj @@ -0,0 +1,453 @@ + + + + + DebugSingleProcess + Win32 + + + DebugSingleProcess + x64 + + + Debug + Win32 + + + Debug + x64 + + + ReleaseSingleProcess + Win32 + + + ReleaseSingleProcess + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + + + + + + + + + + + {EA50E705-5113-49E5-B105-2512EDC8DDC6} + Win32Proj + LibOVR + LibOVR + + + + StaticLibrary + true + Unicode + v140 + + + StaticLibrary + true + Unicode + v140 + + + StaticLibrary + true + Unicode + v140 + + + StaticLibrary + true + Unicode + v140 + + + StaticLibrary + false + true + Unicode + v140 + + + StaticLibrary + false + true + Unicode + v140 + + + StaticLibrary + false + true + Unicode + v140 + + + StaticLibrary + false + true + Unicode + v140 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + $(ProjectDir)../../../Lib/Windows/$(Platform)/$(Configuration)/VS2015/ + + + $(ProjectDir)../../../Lib/Windows/$(Platform)/Debug/VS2015/ + + + $(ProjectDir)../../../Lib/Windows/$(Platform)/$(Configuration)/VS2015/ + + + $(ProjectDir)../../../Lib/Windows/$(Platform)/Debug/VS2015/ + + + $(ProjectDir)../../../Obj/$(ProjectName)/Windows/$(Platform)/$(Configuration)/VS2015/ + + + $(ProjectDir)../../../Obj/$(ProjectName)/Windows/$(Platform)/$(Configuration)/VS2015/ + + + $(ProjectDir)../../../Obj/$(ProjectName)/Windows/$(Platform)/$(Configuration)/VS2015/ + + + $(ProjectDir)../../../Obj/$(ProjectName)/Windows/$(Platform)/$(Configuration)/VS2015/ + + + LibOVR + + + LibOVR + + + LibOVR + + + LibOVR + + + $(ProjectDir)../../../Lib/Windows/$(Platform)/$(Configuration)/VS2015/ + + + $(ProjectDir)../../../Lib/Windows/$(Platform)/Release/VS2015/ + + + $(ProjectDir)../../../Lib/Windows/$(Platform)/$(Configuration)/VS2015/ + + + $(ProjectDir)../../../Lib/Windows/$(Platform)/Release/VS2015/ + + + $(ProjectDir)../../../Obj/$(ProjectName)/Windows/$(Platform)/$(Configuration)/VS2015/ + + + $(ProjectDir)../../../Obj/$(ProjectName)/Windows/$(Platform)/$(Configuration)/VS2015/ + + + $(ProjectDir)../../../Obj/$(ProjectName)/Windows/$(Platform)/$(Configuration)/VS2015/ + + + $(ProjectDir)../../../Obj/$(ProjectName)/Windows/$(Platform)/$(Configuration)/VS2015/ + + + LibOVR + + + LibOVR + + + LibOVR + + + LibOVR + + + + + + Level4 + Disabled + WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + OldStyle + true + false + true + MultiThreadedDebug + %(AdditionalIncludeDirectories);../../../Include + false + /FC %(AdditionalOptions) + false + false + + + + Windows + true + + + + + + + + + + + Level4 + Disabled + OVR_SINGLE_PROCESS;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + OldStyle + true + false + true + MultiThreadedDebug + %(AdditionalIncludeDirectories);../../../Include + false + /FC %(AdditionalOptions) + false + false + + + Windows + true + + + + + + + + + + + Level4 + Disabled + _WIN64;_DEBUG;_LIB;%(PreprocessorDefinitions) + OldStyle + true + false + true + MultiThreadedDebug + %(AdditionalIncludeDirectories);../../../Include + false + false + /FC %(AdditionalOptions) + false + false + + + Windows + true + + + + + + + + + + + Level4 + Disabled + OVR_SINGLE_PROCESS;_WIN64;_DEBUG;_LIB;%(PreprocessorDefinitions) + OldStyle + true + false + true + MultiThreadedDebug + %(AdditionalIncludeDirectories);../../../Include + false + false + /FC %(AdditionalOptions) + false + false + + + Windows + true + + + + + + + + + Level4 + + + MaxSpeed + true + true + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + MultiThreaded + true + true + OldStyle + %(AdditionalIncludeDirectories);../../../Include + false + /FC /d2Zi+ %(AdditionalOptions) + false + false + + + Windows + true + true + true + + + + + + + + + Level4 + + + MaxSpeed + true + true + OVR_SINGLE_PROCESS;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + MultiThreaded + true + true + OldStyle + %(AdditionalIncludeDirectories);../../../Include + false + /FC /d2Zi+ %(AdditionalOptions) + false + false + + + Windows + true + true + true + + + + + + + + + Level4 + + + MaxSpeed + true + true + _WIN64;NDEBUG;_LIB;%(PreprocessorDefinitions) + MultiThreaded + true + true + OldStyle + %(AdditionalIncludeDirectories);../../../Include + false + /FC /d2Zi+ %(AdditionalOptions) + false + false + + + Windows + true + true + true + + + + + + + + + Level4 + + + MaxSpeed + true + true + OVR_SINGLE_PROCESS;_WIN64;NDEBUG;_LIB;%(PreprocessorDefinitions) + MultiThreaded + true + true + OldStyle + %(AdditionalIncludeDirectories);../../../Include + false + /FC /d2Zi+ %(AdditionalOptions) + false + false + + + Windows + true + true + true + + + + + + + + + + \ No newline at end of file diff --git a/extern/OculusSDK/LibOVR/Projects/Windows/VS2015/LibOVR.vcxproj.filters b/extern/OculusSDK/LibOVR/Projects/Windows/VS2015/LibOVR.vcxproj.filters new file mode 100644 index 0000000..b623497 --- /dev/null +++ b/extern/OculusSDK/LibOVR/Projects/Windows/VS2015/LibOVR.vcxproj.filters @@ -0,0 +1,39 @@ + + + + + {19aff241-4a7e-4895-92de-c834a9ebc8f1} + + + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + Include + + + + + + + + \ No newline at end of file diff --git a/extern/OculusSDK/LibOVR/Src/OVR_CAPIShim.c b/extern/OculusSDK/LibOVR/Src/OVR_CAPIShim.c new file mode 100644 index 0000000..61114c1 --- /dev/null +++ b/extern/OculusSDK/LibOVR/Src/OVR_CAPIShim.c @@ -0,0 +1,1424 @@ +/************************************************************************************ + +Filename : OVR_CAPIShim.c +Content : CAPI DLL user library +Created : November 20, 2014 +Copyright : Copyright 2014 Oculus VR, LLC All Rights reserved. + +Licensed under the Oculus VR Rift SDK License Version 3.2 (the "License"); +you may not use the Oculus VR Rift SDK except in compliance with the License, +which is provided at the time of installation or download, or which +otherwise accompanies this software in either electronic or hard copy form. + +You may obtain a copy of the License at + +http://www.oculusvr.com/licenses/LICENSE-3.2 + +Unless required by applicable law or agreed to in writing, the Oculus VR SDK +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +************************************************************************************/ + + +#include "OVR_CAPI.h" +#include "OVR_Version.h" +#include "OVR_ErrorCode.h" +#include +#include +#include +#include +#include +#include +#include + +#if defined(_WIN32) + #if defined(_MSC_VER) + #pragma warning(push, 0) + #endif + #include + #if defined(_MSC_VER) + #pragma warning(pop) + #endif + + #include "../Include/OVR_CAPI_D3D.h" +#else + #if defined(__APPLE__) + #include + #include + #include + #include + #include + #endif + #include + #include + #include +#endif +#include "../Include/OVR_CAPI_GL.h" + + +#if defined(_MSC_VER) + #pragma warning(push) + #pragma warning(disable: 4996) // 'getenv': This function or variable may be unsafe. +#endif + +// SHA-256 of string 'OculusSDK0.8' +static const uint8_t VersionSHA256[] = { + 0x47, 0x38, 0x2c, 0xfe, 0x10, 0xc6, 0x96, 0x98, 0xdc, 0x90, 0x32, 0xe0, 0x55, 0x2a, 0xe6, 0x0f, + 0x33, 0x2e, 0x27, 0xb0, 0xa8, 0x07, 0xfe, 0xff, 0xb6, 0x7e, 0x79, 0x70, 0xa6, 0xb2, 0x89, 0xcc}; + +static const uint8_t VersionXOR = 0xc9; + +// ----------------------------------------------------------------------------------- +// ***** OVR_ENABLE_DEVELOPER_SEARCH +// +// If defined then our shared library loading code searches for developer build +// directories. +// +#if !defined(OVR_ENABLE_DEVELOPER_SEARCH) +#endif + + +// ----------------------------------------------------------------------------------- +// ***** OVR_BUILD_DEBUG +// +// Defines OVR_BUILD_DEBUG when the compiler default debug preprocessor is set. +// +// If you want to control the behavior of these flags, then explicitly define +// either -DOVR_BUILD_RELEASE or -DOVR_BUILD_DEBUG in the compiler arguments. + +#if !defined(OVR_BUILD_DEBUG) && !defined(OVR_BUILD_RELEASE) + #if defined(_MSC_VER) + #if defined(_DEBUG) + #define OVR_BUILD_DEBUG + #endif + #else + #if defined(DEBUG) + #define OVR_BUILD_DEBUG + #endif + #endif +#endif + + +//----------------------------------------------------------------------------------- +// ***** FilePathCharType, ModuleHandleType, ModuleFunctionType +// +#if defined(_WIN32) // We need to use wchar_t on Microsoft platforms, as that's the native file system character type. + #define FilePathCharType wchar_t // #define instead of typedef because debuggers (VC++, XCode) don't recognize typedef'd types as a string type. + typedef HMODULE ModuleHandleType; + typedef FARPROC ModuleFunctionType; +#else + #define FilePathCharType char + typedef void* ModuleHandleType; + typedef void* ModuleFunctionType; +#endif + +#define ModuleHandleTypeNull ((ModuleHandleType)NULL) +#define ModuleFunctionTypeNull ((ModuleFunctionType)NULL) + + +//----------------------------------------------------------------------------------- +// ***** OVR_MAX_PATH +// +#if !defined(OVR_MAX_PATH) + #if defined(_WIN32) + #define OVR_MAX_PATH _MAX_PATH + #elif defined(__APPLE__) + #define OVR_MAX_PATH PATH_MAX + #else + #define OVR_MAX_PATH 1024 + #endif +#endif + + + +//----------------------------------------------------------------------------------- +// ***** OVR_DECLARE_IMPORT +// +// Creates typedef and pointer declaration for a function of a given signature. +// The typedef is Type, and the pointer is Ptr. +// +// Example usage: +// int MultiplyValues(float x, float y); // Assume this function exists in an external shared library. We don't actually need to redeclare it. +// OVR_DECLARE_IMPORT(int, MultiplyValues, (float x, float y)) // This creates a local typedef and pointer for it. + +#define OVR_DECLARE_IMPORT(ReturnValue, FunctionName, Arguments) \ + typedef ReturnValue (OVR_CDECL *FunctionName##Type)Arguments; \ + FunctionName##Type FunctionName##Ptr = NULL; + + + +//----------------------------------------------------------------------------------- +// ***** OVR_GETFUNCTION +// +// Loads Ptr from hLibOVR if not already loaded. +// Assumes a variable named Ptr of type Type exists which is called in LibOVR. +// +// Example usage: +// OVR_GETFUNCTION(MultiplyValues) // Normally this would be done on library init and not before every usage. +// int result = MultiplyValuesPtr(3.f, 4.f); + +#if !defined(OVR_DLSYM) + #if defined(_WIN32) + #define OVR_DLSYM(dlImage, name) GetProcAddress(dlImage, name) + #else + #define OVR_DLSYM(dlImage, name) dlsym(dlImage, name) + #endif +#endif + +#define OVR_GETFUNCTION(f) \ + if(!f##Ptr) \ + { \ + union \ + { \ + f##Type p1; \ + ModuleFunctionType p2; \ + } u; \ + u.p2 = OVR_DLSYM(hLibOVR, #f); \ + f##Ptr = u.p1; \ + } + + +static size_t OVR_strlcpy(char* dest, const char* src, size_t destsize) +{ + const char* s = src; + size_t n = destsize; + + if(n && --n) + { + do{ + if((*dest++ = *s++) == 0) + break; + } while(--n); + } + + if(!n) + { + if(destsize) + *dest = 0; + while(*s++) + { } + } + + return (size_t)((s - src) - 1); +} + + +static size_t OVR_strlcat(char* dest, const char* src, size_t destsize) +{ + const size_t d = destsize ? strlen(dest) : 0; + const size_t s = strlen(src); + const size_t t = s + d; + + if(t < destsize) + memcpy(dest + d, src, (s + 1) * sizeof(*src)); + else + { + if(destsize) + { + memcpy(dest + d, src, ((destsize - d) - 1) * sizeof(*src)); + dest[destsize - 1] = 0; + } + } + + return t; +} + + +#if defined(__APPLE__) + static ovrBool OVR_strend(const char* pStr, const char* pFind, size_t strLength, size_t findLength) + { + if(strLength == (size_t)-1) + strLength = strlen(pStr); + if(findLength == (size_t)-1) + findLength = strlen(pFind); + if(strLength >= findLength) + return (strcmp(pStr + strLength - findLength, pFind) == 0); + return ovrFalse; + } + + static ovrBool OVR_isBundleFolder(const char* filePath) + { + static const char* extensionArray[] = { ".app", ".bundle", ".framework", ".plugin", ".kext" }; + size_t i; + + for(i = 0; i < sizeof(extensionArray)/sizeof(extensionArray[0]); i++) + { + if(OVR_strend(filePath, extensionArray[i], (size_t)-1, (size_t)-1)) + return ovrTrue; + } + + return ovrFalse; + } +#endif + + +#if defined(OVR_ENABLE_DEVELOPER_SEARCH) + +// Returns true if the path begins with the given prefix. +// Doesn't support non-ASCII paths, else the return value may be incorrect. +static int OVR_PathStartsWith(const FilePathCharType* path, const char* prefix) +{ + while(*prefix) + { + if(tolower((unsigned char)*path++) != tolower((unsigned char)*prefix++)) + return ovrFalse; + } + + return ovrTrue; +} + +#endif + + +static ovrBool OVR_GetCurrentWorkingDirectory(FilePathCharType* directoryPath, size_t directoryPathCapacity) +{ + #if defined(_WIN32) + DWORD dwSize = GetCurrentDirectoryW((DWORD)directoryPathCapacity, directoryPath); + + if((dwSize > 0) && (directoryPathCapacity > 1)) // Test > 1 so we have room to possibly append a \ char. + { + size_t length = wcslen(directoryPath); + + if((length == 0) || ((directoryPath[length - 1] != L'\\') && (directoryPath[length - 1] != L'/'))) + { + directoryPath[length++] = L'\\'; + directoryPath[length] = L'\0'; + } + + return ovrTrue; + } + + #else + char* cwd = getcwd(directoryPath, directoryPathCapacity); + + if(cwd && directoryPath[0] && (directoryPathCapacity > 1)) // Test > 1 so we have room to possibly append a / char. + { + size_t length = strlen(directoryPath); + + if((length == 0) || (directoryPath[length - 1] != '/')) + { + directoryPath[length++] = '/'; + directoryPath[length] = '\0'; + } + + return ovrTrue; + } + #endif + + if(directoryPathCapacity > 0) + directoryPath[0] = '\0'; + + return ovrFalse; +} + + +// The appContainer argument is specific currently to only Macintosh. If true and the application is a .app bundle then it returns the +// location of the bundle and not the path to the executable within the bundle. Else return the path to the executable binary itself. +// The moduleHandle refers to the relevant dynamic (a.k.a. shared) library. The main executable is the main module, and each of the shared +// libraries is a module. This way you can specify that you want to know the directory of the given shared library, which may be different +// from the main executable. If the moduleHandle is NULL then the current application module is used. +static ovrBool OVR_GetCurrentApplicationDirectory(FilePathCharType* directoryPath, size_t directoryPathCapacity, ovrBool appContainer, ModuleHandleType moduleHandle) +{ + #if defined(_WIN32) + DWORD length = GetModuleFileNameW(moduleHandle, directoryPath, (DWORD)directoryPathCapacity); + DWORD pos; + + if((length != 0) && (length < (DWORD)directoryPathCapacity)) // If there wasn't an error and there was enough capacity... + { + for(pos = length; (pos > 0) && (directoryPath[pos] != '\\') && (directoryPath[pos] != '/'); --pos) + { + if((directoryPath[pos - 1] != '\\') && (directoryPath[pos - 1] != '/')) + directoryPath[pos - 1] = 0; + } + + return ovrTrue; + } + + (void)appContainer; // Not used on this platform. + + #elif defined(__APPLE__) + uint32_t directoryPathCapacity32 = (uint32_t)directoryPathCapacity; + int result = _NSGetExecutablePath(directoryPath, &directoryPathCapacity32); + + if(result == 0) // If success... + { + char realPath[OVR_MAX_PATH]; + + if(realpath(directoryPath, realPath)) // realpath returns the canonicalized absolute file path. + { + size_t length = 0; + + if(appContainer) // If the caller wants the path to the containing bundle... + { + char containerPath[OVR_MAX_PATH]; + ovrBool pathIsContainer; + + OVR_strlcpy(containerPath, realPath, sizeof(containerPath)); + pathIsContainer = OVR_isBundleFolder(containerPath); + + while(!pathIsContainer && strncmp(containerPath, ".", OVR_MAX_PATH) && strncmp(containerPath, "/", OVR_MAX_PATH)) // While the container we're looking for is not found and while the path doesn't start with a . or / + { + OVR_strlcpy(containerPath, dirname(containerPath), sizeof(containerPath)); + pathIsContainer = OVR_isBundleFolder(containerPath); + } + + if(pathIsContainer) + length = OVR_strlcpy(directoryPath, containerPath, directoryPathCapacity); + } + + if(length == 0) // If not set above in the appContainer block... + length = OVR_strlcpy(directoryPath, realPath, directoryPathCapacity); + + while(length-- && (directoryPath[length] != '/')) + directoryPath[length] = '\0'; // Strip the file name from the file path, leaving a trailing / char. + + return ovrTrue; + } + } + + (void)moduleHandle; // Not used on this platform. + + #else + ssize_t length = readlink("/proc/self/exe", directoryPath, directoryPathCapacity); + ssize_t pos; + + if(length > 0) + { + for(pos = length; (pos > 0) && (directoryPath[pos] != '/'); --pos) + { + if(directoryPath[pos - 1] != '/') + directoryPath[pos - 1] = '\0'; + } + + return ovrTrue; + } + + (void)appContainer; // Not used on this platform. + (void)moduleHandle; + #endif + + if(directoryPathCapacity > 0) + directoryPath[0] = '\0'; + + return ovrFalse; +} + + +#if defined(_WIN32) || defined(OVR_ENABLE_DEVELOPER_SEARCH) // Used only in these cases + +// Get the file path to the current module's (DLL or EXE) directory within the current process. +// Will be different from the process module handle if the current module is a DLL and is in a different directory than the EXE module. +// If successful then directoryPath will be valid and ovrTrue is returned, else directoryPath will be empty and ovrFalse is returned. +static ovrBool OVR_GetCurrentModuleDirectory(FilePathCharType* directoryPath, size_t directoryPathCapacity, ovrBool appContainer) +{ + #if defined(_WIN32) + HMODULE hModule; + BOOL result = GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, (LPCWSTR)(uintptr_t)OVR_GetCurrentModuleDirectory, &hModule); + if(result) + OVR_GetCurrentApplicationDirectory(directoryPath, directoryPathCapacity, ovrTrue, hModule); + else + directoryPath[0] = 0; + + (void)appContainer; + + return directoryPath[0] ? ovrTrue : ovrFalse; + #else + return OVR_GetCurrentApplicationDirectory(directoryPath, directoryPathCapacity, appContainer, NULL); + #endif +} + +#endif + + +static ModuleHandleType OVR_OpenLibrary(const FilePathCharType* libraryPath) +{ + #if defined(_WIN32) + return LoadLibraryW(libraryPath); + #else + // Don't bother trying to dlopen() a file that is not even there. + if (access(libraryPath, X_OK | R_OK ) != 0) + { + return NULL; + } + + dlerror(); // Clear any previous dlopen() errors + + // Use RTLD_NOW because we don't want unexpected stalls at runtime, and the library isn't very large. + // Use RTLD_LOCAL to avoid unilaterally exporting resolved symbols to the rest of this process. + void *lib = dlopen(libraryPath, RTLD_NOW | RTLD_LOCAL); + + if (!lib) + { + #if defined(__APPLE__) + // TODO: Output the error in whatever logging system OSX uses (jhughes) + #else // __APPLE__ + fprintf(stderr, "ERROR: Can't load '%s':\n%s\n", libraryPath, dlerror()); + #endif // __APPLE__ + } + + return lib; + #endif +} + + +static void OVR_CloseLibrary(ModuleHandleType hLibrary) +{ + if (hLibrary) + { + #if defined(_WIN32) + // We may need to consider what to do in the case that the library is in an exception state. + // In a Windows C++ DLL, all global objects (including static members of classes) will be constructed just + // before the calling of the DllMain with DLL_PROCESS_ATTACH and they will be destroyed just after + // the call of the DllMain with DLL_PROCESS_DETACH. We may need to intercept DLL_PROCESS_DETACH and + // have special handling for the case that the DLL is broken. + FreeLibrary(hLibrary); + #else + dlclose(hLibrary); + #endif + } +} + + +// Returns a valid ModuleHandleType (e.g. Windows HMODULE) or returns ModuleHandleTypeNull (e.g. NULL). +// The caller is required to eventually call OVR_CloseLibrary on a valid return handle. +// +static ModuleHandleType OVR_FindLibraryPath(int requestedProductVersion, int requestedMajorVersion, + FilePathCharType* libraryPath, size_t libraryPathCapacity) +{ + ModuleHandleType moduleHandle; + int printfResult; + FilePathCharType developerDir[OVR_MAX_PATH] = { '\0' }; + + #if defined(_MSC_VER) + #if defined(_WIN64) + const char* pBitDepth = "64"; + #else + const char* pBitDepth = "32"; + #endif + #elif defined(__APPLE__) + // For Apple platforms we are using a Universal Binary LibOVRRT dylib which has both 32 and 64 in it. + #else // Other Unix. + #if defined(__x86_64__) + const char* pBitDepth = "64"; + #else + const char* pBitDepth = "32"; + #endif + #endif + + moduleHandle = ModuleHandleTypeNull; + if(libraryPathCapacity) + libraryPath[0] = '\0'; + + // Note: OVR_ENABLE_DEVELOPER_SEARCH is deprecated in favor of the simpler LIBOVR_DLL_DIR, as the edge + // case uses of the former created some complications that may be best solved by simply using a LIBOVR_DLL_DIR + // environment variable which the user can set in their debugger or system environment variables. + #if (defined(_MSC_VER) || defined(_WIN32)) && !defined(OVR_FILE_PATH_SEPARATOR) + #define OVR_FILE_PATH_SEPARATOR "\\" + #else + #define OVR_FILE_PATH_SEPARATOR "/" + #endif + + { + const char* pLibOvrDllDir = getenv("LIBOVR_DLL_DIR"); // Example value: /dev/OculusSDK/Main/LibOVR/Mac/Debug/ + + if(pLibOvrDllDir) + { + char developerDir8[OVR_MAX_PATH]; + size_t length = OVR_strlcpy(developerDir8, pLibOvrDllDir, sizeof(developerDir8)); // If missing a trailing path separator then append one. + + if((length > 0) && (length < sizeof(developerDir8)) && (developerDir8[length - 1] != OVR_FILE_PATH_SEPARATOR[0])) + { + length = OVR_strlcat(developerDir8, OVR_FILE_PATH_SEPARATOR, sizeof(developerDir8)); + + if(length < sizeof(developerDir8)) + { + #if defined(_WIN32) + size_t i; + for(i = 0; i <= length; ++i) // ASCII conversion of 8 to 16 bit text. + developerDir[i] = (FilePathCharType)(uint8_t)developerDir8[i]; + #else + OVR_strlcpy(developerDir, developerDir8, sizeof(developerDir)); + #endif + } + } + } + } + + // Support checking for a developer library location override via the OVR_SDK_ROOT environment variable. + // This pathway is deprecated in favor of using LIBOVR_DLL_DIR instead. + #if defined(OVR_ENABLE_DEVELOPER_SEARCH) + if (!developerDir[0]) // If not already set by LIBOVR_DLL_PATH... + { + // __FILE__ maps to /LibOVR/Src/OVR_CAPIShim.c + char sdkRoot[OVR_MAX_PATH]; + char* pLibOVR; + size_t i; + + // We assume that __FILE__ returns a full path, which isn't the case for some compilers. + // Need to compile with /FC under VC++ for __FILE__ to expand to the full file path. + // clang expands __FILE__ to a full path by default. + OVR_strlcpy(sdkRoot, __FILE__, sizeof(sdkRoot)); + for(i = 0; sdkRoot[i]; ++i) + sdkRoot[i] = (char)tolower(sdkRoot[i]); // Microsoft doesn't maintain case. + pLibOVR = strstr(sdkRoot, "libovr"); + if(pLibOVR && (pLibOVR > sdkRoot)) + pLibOVR[-1] = '\0'; + else + sdkRoot[0] = '\0'; + + if(sdkRoot[0]) + { + // We want to use a developer version of the library only if the application is also being executed from + // a developer location. Ideally we would do this by checking that the relative path from the executable to + // the shared library is the same at runtime as it was when the executable was first built, but we don't have + // an easy way to do that from here and it would require some runtime help from the application code. + // Instead we verify that the application is simply in the same developer tree that was was when built. + // We could put in some additional logic to make it very likely to know if the EXE is in its original location. + FilePathCharType modulePath[OVR_MAX_PATH]; + const ovrBool pathMatch = OVR_GetCurrentModuleDirectory(modulePath, OVR_MAX_PATH, ovrTrue) && + (OVR_PathStartsWith(modulePath, sdkRoot) == ovrTrue); + if(pathMatch == ovrFalse) + { + sdkRoot[0] = '\0'; // The application module is not in the developer tree, so don't try to use the developer shared library. + } + } + + if(sdkRoot[0]) + { + #if defined(OVR_BUILD_DEBUG) + const char* pConfigDirName = "Debug"; + #else + const char* pConfigDirName = "Release"; + #endif + + #if defined(_MSC_VER) + #if defined(_WIN64) + const char* pArchDirName = "x64"; + #else + const char* pArchDirName = "Win32"; + #endif + #else + #if defined(__x86_64__) + const char* pArchDirName = "x86_64"; + #else + const char* pArchDirName = "i386"; + #endif + #endif + + #if defined(_MSC_VER) && (_MSC_VER == 1600) + const char* pCompilerVersion = "VS2010"; + #elif defined(_MSC_VER) && (_MSC_VER == 1700) + const char* pCompilerVersion = "VS2012"; + #elif defined(_MSC_VER) && (_MSC_VER == 1800) + const char* pCompilerVersion = "VS2013"; + #elif defined(_MSC_VER) && (_MSC_VER == 1900) + const char* pCompilerVersion = "VS2014"; + #endif + + #if defined(_WIN32) + int count = swprintf_s(developerDir, OVR_MAX_PATH, L"%hs\\LibOVR\\Lib\\Windows\\%hs\\%hs\\%hs\\", + sdkRoot, pArchDirName, pConfigDirName, pCompilerVersion); + #elif defined(__APPLE__) + // Apple/XCode doesn't let you specify an arch in build paths, which is OK if we build a universal binary. + (void)pArchDirName; + int count = snprintf(developerDir, OVR_MAX_PATH, "%s/LibOVR/Lib/Mac/%s/", + sdkRoot, pConfigDirName); + #else + int count = snprintf(developerDir, OVR_MAX_PATH, "%s/LibOVR/Lib/Linux/%s/%s/", + sdkRoot, pArchDirName, pConfigDirName); + #endif + + if((count < 0) || (count >= (int)OVR_MAX_PATH)) // If there was an error or capacity overflow... clear the string. + { + developerDir[0] = '\0'; + } + } + } + #endif // OVR_ENABLE_DEVELOPER_SEARCH + + { + FilePathCharType cwDir[OVR_MAX_PATH]; // Will be filled in below. + FilePathCharType appDir[OVR_MAX_PATH]; + size_t i; + + #if defined(_WIN32) + FilePathCharType moduleDir[OVR_MAX_PATH]; + const FilePathCharType* directoryArray[5]; + directoryArray[0] = cwDir; + directoryArray[1] = moduleDir; + directoryArray[2] = appDir; + directoryArray[3] = developerDir; // Developer directory. + directoryArray[4] = L""; // No directory, which causes Windows to use the standard search strategy to find the DLL. + + OVR_GetCurrentModuleDirectory(moduleDir, sizeof(moduleDir)/sizeof(moduleDir[0]), ovrTrue); + + #elif defined(__APPLE__) + // https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/dyld.1.html + + FilePathCharType homeDir[OVR_MAX_PATH]; + FilePathCharType homeFrameworkDir[OVR_MAX_PATH]; + const FilePathCharType* directoryArray[5]; + size_t homeDirLength = 0; + + const char* pHome = getenv("HOME"); // Try getting the HOME environment variable. + + if (pHome) + { + homeDirLength = OVR_strlcpy(homeDir, pHome, sizeof(homeDir)); + } + else + { + // https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man3/getpwuid_r.3.html + const long pwBufferSize = sysconf(_SC_GETPW_R_SIZE_MAX); + + if (pwBufferSize != -1) + { + char pwBuffer[pwBufferSize]; + struct passwd pw; + struct passwd* pwResult = NULL; + + if ((getpwuid_r(getuid(), &pw, pwBuffer, pwBufferSize, &pwResult) == 0) && pwResult) + homeDirLength = OVR_strlcpy(homeDir, pw.pw_dir, sizeof(homeDir)); + } + } + + if (homeDirLength) + { + if (homeDir[homeDirLength - 1] == '/') + homeDir[homeDirLength - 1] = '\0'; + OVR_strlcpy(homeFrameworkDir, homeDir, sizeof(homeFrameworkDir)); + OVR_strlcat(homeFrameworkDir, "/Library/Frameworks/", sizeof(homeFrameworkDir)); + } + else + { + homeFrameworkDir[0] = '\0'; + } + + directoryArray[0] = cwDir; + directoryArray[1] = appDir; + directoryArray[2] = homeFrameworkDir; // ~/Library/Frameworks/ + directoryArray[3] = "/Library/Frameworks/"; // DYLD_FALLBACK_FRAMEWORK_PATH + directoryArray[4] = developerDir; // Developer directory. + + #else + #define STR1(x) #x + #define STR(x) STR1(x) + #ifdef LIBDIR + #define TEST_LIB_DIR STR(LIBDIR) "/" + #else + #define TEST_LIB_DIR appDir + #endif + + const FilePathCharType* directoryArray[5]; + directoryArray[0] = cwDir; + directoryArray[1] = TEST_LIB_DIR; // Directory specified by LIBDIR if defined. + directoryArray[2] = developerDir; // Developer directory. + directoryArray[3] = "/usr/local/lib/"; + directoryArray[4] = "/usr/lib/"; + #endif + + OVR_GetCurrentWorkingDirectory(cwDir, sizeof(cwDir) / sizeof(cwDir[0])); + OVR_GetCurrentApplicationDirectory(appDir, sizeof(appDir) / sizeof(appDir[0]), ovrTrue, NULL); + + // Versioned file expectations. + // Windows: LibOVRRT__.dll // Example: LibOVRRT64_1_1.dll -- LibOVRRT 64 bit, product 1, major version 1, minor/patch/build numbers unspecified in the name. + // Mac: LibOVRRT_.framework/Versions//LibOVRRT_ // We are not presently using the .framework bundle's Current directory to hold the version number. This may change. + // Linux: libOVRRT_.so. // The file on disk may contain a minor version number, but a symlink is used to map this major-only version to it. + + // Since we are manually loading the LibOVR dynamic library, we need to look in various locations for a file + // that matches our requirements. The functionality required is somewhat similar to the operating system's + // dynamic loader functionality. Each OS has some differences in how this is handled. + // Future versions of this may iterate over all libOVRRT.so.* files in the directory and use the one that matches our requirements. + // + // We need to look for a library that matches the product version and major version of the caller's request, + // and that library needs to support a minor version that is >= the requested minor version. Currently we + // don't test the minor version here, as the library is named based only on the product and major version. + // Currently the minor version test is handled via the initialization of the library and the initialization + // fails if minor version cannot be supported by the library. The reason this is done during initialization + // is that the library can at runtime support multiple minor versions based on the user's request. To the + // external user, all that matters it that they call ovr_Initialize with a requested version and it succeeds + // or fails. + // + // The product version is something that is at a higher level than the major version, and is not something that's + // always seen in libraries (an example is the well-known LibXml2 library, in which the 2 is essentially the product version). + + for(i = 0; i < sizeof(directoryArray)/sizeof(directoryArray[0]); ++i) + { + #if defined(_WIN32) + printfResult = swprintf(libraryPath, libraryPathCapacity, L"%lsLibOVRRT%hs_%d_%d.dll", directoryArray[i], pBitDepth, requestedProductVersion, requestedMajorVersion); + + #elif defined(__APPLE__) + // https://developer.apple.com/library/mac/documentation/MacOSX/Conceptual/BPFrameworks/Concepts/VersionInformation.html + // Macintosh application bundles have the option of embedding dependent frameworks within the application + // bundle itself. A problem with that is that it doesn't support vendor-supplied updates to the framework. + printfResult = snprintf(libraryPath, libraryPathCapacity, "%sLibOVRRT_%d.framework/Versions/%d/LibOVRRT_%d", directoryArray[i], requestedProductVersion, requestedMajorVersion, requestedProductVersion); + + #else // Unix + // Applications that depend on the OS (e.g. ld-linux / ldd) can rely on the library being in a common location + // such as /usr/lib or can rely on the -rpath linker option to embed a path for the OS to check for the library, + // or can rely on the LD_LIBRARY_PATH environment variable being set. It's generally not recommended that applications + // depend on LD_LIBRARY_PATH be globally modified, partly due to potentialy security issues. + // Currently we check the current application directory, current working directory, and then /usr/lib and possibly others. + printfResult = snprintf(libraryPath, libraryPathCapacity, "%slibOVRRT%s_%d.so.%d", directoryArray[i], pBitDepth, requestedProductVersion, requestedMajorVersion); + #endif + + if((printfResult >= 0) && (printfResult < (int)libraryPathCapacity)) + { + moduleHandle = OVR_OpenLibrary(libraryPath); + if(moduleHandle != ModuleHandleTypeNull) + return moduleHandle; + } + } + } + + return moduleHandle; +} + + + +//----------------------------------------------------------------------------------- +// ***** hLibOVR +// +// global handle to the LivOVR shared library. +// +static ModuleHandleType hLibOVR = NULL; + +// This function is currently unsupported. +ModuleHandleType ovr_GetLibOVRRTHandle() +{ + return hLibOVR; +} + + + +//----------------------------------------------------------------------------------- +// ***** Function declarations +// +// To consider: Move OVR_DECLARE_IMPORT and the declarations below to OVR_CAPI.h +// +OVR_DECLARE_IMPORT(ovrBool, ovr_InitializeRenderingShimVersion, (int requestedMinorVersion)) +OVR_DECLARE_IMPORT(ovrResult, ovr_Initialize, (const ovrInitParams* params)) +OVR_DECLARE_IMPORT(ovrBool, ovr_Shutdown, ()) +OVR_DECLARE_IMPORT(const char*, ovr_GetVersionString, ()) +OVR_DECLARE_IMPORT(void, ovr_GetLastErrorInfo, (ovrErrorInfo* errorInfo)) +OVR_DECLARE_IMPORT(ovrHmdDesc, ovr_GetHmdDesc, (ovrSession session)) +OVR_DECLARE_IMPORT(ovrResult, ovr_Create, (ovrSession* pSession, ovrGraphicsLuid* pLuid)) +OVR_DECLARE_IMPORT(void, ovr_Destroy, (ovrSession session)) +OVR_DECLARE_IMPORT(ovrResult, ovr_GetSessionStatus, (ovrSession session, ovrSessionStatus* sessionStatus)) +OVR_DECLARE_IMPORT(unsigned int, ovr_GetEnabledCaps, (ovrSession session)) +OVR_DECLARE_IMPORT(void, ovr_SetEnabledCaps, (ovrSession session, unsigned int hmdCaps)) +OVR_DECLARE_IMPORT(unsigned int, ovr_GetTrackingCaps, (ovrSession session)) +OVR_DECLARE_IMPORT(ovrResult, ovr_ConfigureTracking, (ovrSession session, unsigned int requestedTrackingCaps, unsigned int requiredTrackingCaps)) +OVR_DECLARE_IMPORT(void, ovr_RecenterPose, (ovrSession session)) +OVR_DECLARE_IMPORT(ovrTrackingState, ovr_GetTrackingState, (ovrSession session, double absTime, ovrBool latencyMarker)) +OVR_DECLARE_IMPORT(ovrResult, ovr_GetInputState, (ovrSession session, unsigned int controllerMask, ovrInputState*)) +OVR_DECLARE_IMPORT(ovrResult, ovr_SetControllerVibration, (ovrSession session, unsigned int controllerTypeMask, float frequency, float amplitude)) +OVR_DECLARE_IMPORT(ovrSizei, ovr_GetFovTextureSize, (ovrSession session, ovrEyeType eye, ovrFovPort fov, float pixelsPerDisplayPixel)) +OVR_DECLARE_IMPORT(ovrResult, ovr_SubmitFrame, (ovrSession session, long long frameIndex, const ovrViewScaleDesc* viewScaleDesc, ovrLayerHeader const * const * layerPtrList, unsigned int layerCount)) +OVR_DECLARE_IMPORT(ovrEyeRenderDesc, ovr_GetRenderDesc, (ovrSession session, ovrEyeType eyeType, ovrFovPort fov)) +OVR_DECLARE_IMPORT(double, ovr_GetPredictedDisplayTime, (ovrSession session, long long frameIndex)) +OVR_DECLARE_IMPORT(double, ovr_GetTimeInSeconds, ()) +OVR_DECLARE_IMPORT(void, ovr_ResetBackOfHeadTracking, (ovrSession session)) +OVR_DECLARE_IMPORT(void, ovr_ResetMulticameraTracking, (ovrSession session)) +OVR_DECLARE_IMPORT(ovrBool, ovr_GetBool, (ovrSession session, const char* propertyName, ovrBool defaultVal)) +OVR_DECLARE_IMPORT(ovrBool, ovr_SetBool, (ovrSession session, const char* propertyName, ovrBool value)) +OVR_DECLARE_IMPORT(int, ovr_GetInt, (ovrSession session, const char* propertyName, int defaultVal)) +OVR_DECLARE_IMPORT(ovrBool, ovr_SetInt, (ovrSession session, const char* propertyName, int value)) +OVR_DECLARE_IMPORT(float, ovr_GetFloat, (ovrSession session, const char* propertyName, float defaultVal)) +OVR_DECLARE_IMPORT(ovrBool, ovr_SetFloat, (ovrSession session, const char* propertyName, float value)) +OVR_DECLARE_IMPORT(unsigned int, ovr_GetFloatArray, (ovrSession session, const char* propertyName, float values[], unsigned int arraySize)) +OVR_DECLARE_IMPORT(ovrBool, ovr_SetFloatArray, (ovrSession session, const char* propertyName, const float values[], unsigned int arraySize)) +OVR_DECLARE_IMPORT(const char*, ovr_GetString, (ovrSession session, const char* propertyName, const char* defaultVal)) +OVR_DECLARE_IMPORT(ovrBool, ovr_SetString, (ovrSession session, const char* propertyName, const char* value)) +OVR_DECLARE_IMPORT(int, ovr_TraceMessage, (int level, const char* message)) + +#if defined (_WIN32) +OVR_DECLARE_IMPORT(ovrResult, ovr_CreateSwapTextureSetD3D11, (ovrSession session, ID3D11Device* device, const D3D11_TEXTURE2D_DESC* desc, unsigned int miscFlags, ovrSwapTextureSet** outTextureSet)) +OVR_DECLARE_IMPORT(ovrResult, ovr_CreateMirrorTextureD3D11, (ovrSession session, ID3D11Device* device, const D3D11_TEXTURE2D_DESC* desc, unsigned int miscFlags, ovrTexture** outMirrorTexture)) +#endif + +OVR_DECLARE_IMPORT(ovrResult, ovr_CreateSwapTextureSetGL, (ovrSession session, GLuint format, int width, int height, ovrSwapTextureSet** outTextureSet)) +OVR_DECLARE_IMPORT(ovrResult, ovr_CreateMirrorTextureGL, (ovrSession session, GLuint format, int width, int height, ovrTexture** outMirrorTexture)) + +OVR_DECLARE_IMPORT(void, ovr_DestroySwapTextureSet, (ovrSession session, ovrSwapTextureSet* textureSet)) +OVR_DECLARE_IMPORT(void, ovr_DestroyMirrorTexture, (ovrSession session, ovrTexture* textureSet)) +OVR_DECLARE_IMPORT(ovrResult, ovr_SetQueueAheadFraction, (ovrSession session, float queueAheadFraction)) + +OVR_DECLARE_IMPORT(ovrResult, ovr_Lookup, (const char* name, void** data)); + +static ovrResult OVR_LoadSharedLibrary(int requestedProductVersion, int requestedMajorVersion) +{ + FilePathCharType filePath[OVR_MAX_PATH]; + + if(hLibOVR) + return ovrSuccess; + + hLibOVR = OVR_FindLibraryPath(requestedProductVersion, requestedMajorVersion, + filePath, sizeof(filePath) / sizeof(filePath[0])); + if(!hLibOVR) + return ovrError_LibLoad; + + OVR_GETFUNCTION(ovr_InitializeRenderingShimVersion) + OVR_GETFUNCTION(ovr_Initialize) + OVR_GETFUNCTION(ovr_Shutdown) + OVR_GETFUNCTION(ovr_GetVersionString) + OVR_GETFUNCTION(ovr_GetLastErrorInfo) + OVR_GETFUNCTION(ovr_GetHmdDesc) + OVR_GETFUNCTION(ovr_Create) + OVR_GETFUNCTION(ovr_Destroy) + OVR_GETFUNCTION(ovr_GetSessionStatus) + OVR_GETFUNCTION(ovr_GetEnabledCaps) + OVR_GETFUNCTION(ovr_SetEnabledCaps) + OVR_GETFUNCTION(ovr_GetTrackingCaps) + OVR_GETFUNCTION(ovr_ConfigureTracking) + OVR_GETFUNCTION(ovr_RecenterPose) + OVR_GETFUNCTION(ovr_GetTrackingState) + OVR_GETFUNCTION(ovr_GetInputState) + OVR_GETFUNCTION(ovr_SetControllerVibration) + OVR_GETFUNCTION(ovr_GetFovTextureSize) + OVR_GETFUNCTION(ovr_SubmitFrame) + OVR_GETFUNCTION(ovr_GetRenderDesc) + OVR_GETFUNCTION(ovr_GetPredictedDisplayTime) + OVR_GETFUNCTION(ovr_GetTimeInSeconds) + OVR_GETFUNCTION(ovr_ResetBackOfHeadTracking) + OVR_GETFUNCTION(ovr_ResetMulticameraTracking) + OVR_GETFUNCTION(ovr_GetBool) + OVR_GETFUNCTION(ovr_SetBool) + OVR_GETFUNCTION(ovr_GetInt) + OVR_GETFUNCTION(ovr_SetInt) + OVR_GETFUNCTION(ovr_GetFloat) + OVR_GETFUNCTION(ovr_SetFloat) + OVR_GETFUNCTION(ovr_GetFloatArray) + OVR_GETFUNCTION(ovr_SetFloatArray) + OVR_GETFUNCTION(ovr_GetString) + OVR_GETFUNCTION(ovr_SetString) + OVR_GETFUNCTION(ovr_TraceMessage) +#if defined (_WIN32) + OVR_GETFUNCTION(ovr_CreateSwapTextureSetD3D11) + OVR_GETFUNCTION(ovr_CreateMirrorTextureD3D11) +#endif + OVR_GETFUNCTION(ovr_CreateSwapTextureSetGL) + OVR_GETFUNCTION(ovr_CreateMirrorTextureGL) + OVR_GETFUNCTION(ovr_DestroySwapTextureSet) + OVR_GETFUNCTION(ovr_DestroyMirrorTexture) + OVR_GETFUNCTION(ovr_SetQueueAheadFraction) + OVR_GETFUNCTION(ovr_Lookup) + + return ovrSuccess; +} + +static void OVR_UnloadSharedLibrary() +{ + // To consider: Make all pointers be part of a struct and memset the struct to 0 here. + ovr_InitializeRenderingShimVersionPtr = NULL; + ovr_InitializePtr = NULL; + ovr_ShutdownPtr = NULL; + ovr_GetVersionStringPtr = NULL; + ovr_GetLastErrorInfoPtr = NULL; + ovr_GetHmdDescPtr = NULL; + ovr_CreatePtr = NULL; + ovr_DestroyPtr = NULL; + ovr_GetSessionStatusPtr = NULL; + ovr_GetEnabledCapsPtr = NULL; + ovr_SetEnabledCapsPtr = NULL; + ovr_GetTrackingCapsPtr = NULL; + ovr_ConfigureTrackingPtr = NULL; + ovr_RecenterPosePtr = NULL; + ovr_GetTrackingStatePtr = NULL; + ovr_GetInputStatePtr = NULL; + ovr_SetControllerVibrationPtr = NULL; + ovr_GetFovTextureSizePtr = NULL; + ovr_SubmitFramePtr = NULL; + ovr_GetRenderDescPtr = NULL; + ovr_GetPredictedDisplayTimePtr = NULL; + ovr_GetTimeInSecondsPtr = NULL; + ovr_ResetBackOfHeadTrackingPtr = NULL; + ovr_ResetMulticameraTrackingPtr = NULL; + ovr_GetBoolPtr = NULL; + ovr_SetBoolPtr = NULL; + ovr_GetIntPtr = NULL; + ovr_SetIntPtr = NULL; + ovr_GetFloatPtr = NULL; + ovr_SetFloatPtr = NULL; + ovr_GetFloatArrayPtr = NULL; + ovr_SetFloatArrayPtr = NULL; + ovr_GetStringPtr = NULL; + ovr_SetStringPtr = NULL; + ovr_TraceMessagePtr = NULL; + #if defined (_WIN32) + ovr_CreateSwapTextureSetD3D11Ptr = NULL; + ovr_CreateMirrorTextureD3D11Ptr = NULL; + #endif + ovr_CreateSwapTextureSetGLPtr = NULL; + ovr_CreateMirrorTextureGLPtr = NULL; + ovr_DestroySwapTextureSetPtr = NULL; + ovr_DestroyMirrorTexturePtr = NULL; + ovr_SetQueueAheadFractionPtr = NULL; + ovr_LookupPtr = NULL; + + OVR_CloseLibrary(hLibOVR); + hLibOVR = NULL; +} + + +OVR_PUBLIC_FUNCTION(ovrBool) ovr_InitializeRenderingShim() +{ +#if 1 + return ovrTrue; +#else + return ovr_InitializeRenderingShimVersion(OVR_MINOR_VERSION); +#endif +} + + +OVR_PUBLIC_FUNCTION(ovrBool) ovr_InitializeRenderingShimVersion(int requestedMinorVersion) +{ + // By design we ignore the build version in the library search. + ovrBool initializeResult; + ovrResult result = OVR_LoadSharedLibrary(OVR_PRODUCT_VERSION, OVR_MAJOR_VERSION); + + if (result != ovrSuccess) + return ovrFalse; + + initializeResult = ovr_InitializeRenderingShimVersionPtr(requestedMinorVersion); + + if (initializeResult == ovrFalse) + OVR_UnloadSharedLibrary(); + + return initializeResult; +} + + +// These defaults are also in CAPI.cpp +static const ovrInitParams DefaultParams = { + ovrInit_RequestVersion, // Flags + OVR_MINOR_VERSION, // RequestedMinorVersion + 0, // LogCallback + 0, // UserData + 0, // ConnectionTimeoutSeconds + OVR_ON64("") // pad0 +}; + +OVR_PUBLIC_FUNCTION(ovrResult) ovr_Initialize(const ovrInitParams* inputParams) +{ + ovrResult result; + ovrInitParams params; + + // Do something with our version signature hash to prevent + // it from being optimized out. In this case, compute + // a cheap CRC. + uint8_t crc = 0; + size_t i; + + for (i = 0; i < sizeof(VersionSHA256); ++i) + { + crc ^= VersionSHA256[i]; + } + + assert(crc == VersionXOR); + if (crc != VersionXOR) + { + return ovrError_Initialize; + } + + if (!inputParams) + { + params = DefaultParams; + } + else + { + params = *inputParams; + + // If not requesting a particular minor version, + if (!(params.Flags & ovrInit_RequestVersion)) + { + // Enable requesting the default minor version. + params.Flags |= ovrInit_RequestVersion; + params.RequestedMinorVersion = OVR_MINOR_VERSION; + } + } + + // Clear non-writable bits provided by client code. + params.Flags &= ovrinit_WritableBits; + + + + // By design we ignore the build version in the library search. + result = OVR_LoadSharedLibrary(OVR_PRODUCT_VERSION, OVR_MAJOR_VERSION); + if (result != ovrSuccess) + return result; + + result = ovr_InitializePtr(¶ms); + if (result != ovrSuccess) + OVR_UnloadSharedLibrary(); + + return result; +} + +OVR_PUBLIC_FUNCTION(void) ovr_Shutdown() +{ + if (!ovr_ShutdownPtr) + return; + ovr_ShutdownPtr(); + OVR_UnloadSharedLibrary(); +} + +OVR_PUBLIC_FUNCTION(const char*) ovr_GetVersionString() +{ + // We don't directly return the value of the DLL ovr_GetVersionStringPtr call, + // because that call returns a pointer to memory within the DLL. If the DLL goes + // away then that pointer becomes invalid while the process may still be holding + // onto it. So we save a local copy of it which is always valid. + static char dllVersionStringLocal[32]; + const char* dllVersionString; + + if (!ovr_GetVersionStringPtr) + return "(Unable to load LibOVR)"; + + dllVersionString = ovr_GetVersionStringPtr(); // Guaranteed to always be valid. + assert(dllVersionString != NULL); + OVR_strlcpy(dllVersionStringLocal, dllVersionString, sizeof(dllVersionStringLocal)); + + return dllVersionStringLocal; +} + +OVR_PUBLIC_FUNCTION(void) ovr_GetLastErrorInfo(ovrErrorInfo* errorInfo) +{ + if (!ovr_GetLastErrorInfoPtr) + { + memset(errorInfo, 0, sizeof(ovrErrorInfo)); + errorInfo->Result = ovrError_LibLoad; + } + else + ovr_GetLastErrorInfoPtr(errorInfo); +} + +OVR_PUBLIC_FUNCTION(ovrHmdDesc) ovr_GetHmdDesc(ovrSession session) +{ + if (!ovr_GetHmdDescPtr) + { + ovrHmdDesc hmdDesc; + memset(&hmdDesc, 0, sizeof(hmdDesc)); + hmdDesc.Type = ovrHmd_None; + return hmdDesc; + } + + return ovr_GetHmdDescPtr(session); +} + +OVR_PUBLIC_FUNCTION(ovrResult) ovr_Create(ovrSession* pSession, ovrGraphicsLuid* pLuid) +{ + if (!ovr_CreatePtr) + return ovrError_NotInitialized; + return ovr_CreatePtr(pSession, pLuid); +} + +OVR_PUBLIC_FUNCTION(void) ovr_Destroy(ovrSession session) +{ + if (!ovr_DestroyPtr) + return; + ovr_DestroyPtr(session); +} + +OVR_PUBLIC_FUNCTION(ovrResult) ovr_GetSessionStatus(ovrSession session, ovrSessionStatus* sessionStatus) +{ + if (!ovr_GetSessionStatusPtr) + return ovrError_NotInitialized; + return ovr_GetSessionStatusPtr(session, sessionStatus); +} + +OVR_PUBLIC_FUNCTION(unsigned int) ovr_GetEnabledCaps(ovrSession session) +{ + if (!ovr_GetEnabledCapsPtr) + return 0; + return ovr_GetEnabledCapsPtr(session); +} + +OVR_PUBLIC_FUNCTION(void) ovr_SetEnabledCaps(ovrSession session, unsigned int hmdCaps) +{ + if (!ovr_SetEnabledCapsPtr) + return; + ovr_SetEnabledCapsPtr(session, hmdCaps); +} + +OVR_PUBLIC_FUNCTION(unsigned int) ovr_GetTrackingCaps(ovrSession session) +{ + if (!ovr_GetTrackingCapsPtr) + return 0; + return ovr_GetTrackingCapsPtr(session); +} + +OVR_PUBLIC_FUNCTION(ovrResult) ovr_ConfigureTracking(ovrSession session, unsigned int requestedTrackingCaps, + unsigned int requiredTrackingCaps) +{ + if (!ovr_ConfigureTrackingPtr) + return ovrError_NotInitialized; + return ovr_ConfigureTrackingPtr(session, requestedTrackingCaps, requiredTrackingCaps); +} + +OVR_PUBLIC_FUNCTION(void) ovr_RecenterPose(ovrSession session) +{ + if (!ovr_RecenterPosePtr) + return; + ovr_RecenterPosePtr(session); +} + +OVR_PUBLIC_FUNCTION(ovrTrackingState) ovr_GetTrackingState(ovrSession session, double absTime, ovrBool latencyMarker) +{ + if (!ovr_GetTrackingStatePtr) + { + ovrTrackingState nullTrackingState; + memset(&nullTrackingState, 0, sizeof(nullTrackingState)); + return nullTrackingState; + } + + return ovr_GetTrackingStatePtr(session, absTime, latencyMarker); +} + +OVR_PUBLIC_FUNCTION(ovrResult) ovr_GetInputState(ovrSession session, unsigned int controllerMask, ovrInputState* inputState) +{ + if (!ovr_GetInputStatePtr) + { + if (inputState) + memset(inputState, 0, sizeof(ovrInputState)); + return ovrError_NotInitialized; + } + return ovr_GetInputStatePtr(session, controllerMask, inputState); +} + +OVR_PUBLIC_FUNCTION(ovrResult) ovr_SetControllerVibration(ovrSession session, unsigned int controllerTypeMask, float frequency, float amplitude) +{ + if (!ovr_SetControllerVibrationPtr) + { + return ovrError_NotInitialized; + } + return ovr_SetControllerVibrationPtr(session, controllerTypeMask, frequency, amplitude); +} + +OVR_PUBLIC_FUNCTION(ovrSizei) ovr_GetFovTextureSize(ovrSession session, ovrEyeType eye, ovrFovPort fov, + float pixelsPerDisplayPixel) +{ + if (!ovr_GetFovTextureSizePtr) + { + ovrSizei nullSize; + memset(&nullSize, 0, sizeof(nullSize)); + return nullSize; + } + + return ovr_GetFovTextureSizePtr(session, eye, fov, pixelsPerDisplayPixel); +} + +#if defined (_WIN32) +OVR_PUBLIC_FUNCTION(ovrResult) ovr_CreateSwapTextureSetD3D11(ovrSession session, + ID3D11Device* device, + const D3D11_TEXTURE2D_DESC* desc, + unsigned int miscFlags, + ovrSwapTextureSet** outTextureSet) +{ + if (!ovr_CreateSwapTextureSetD3D11Ptr) + return ovrError_NotInitialized; + + return ovr_CreateSwapTextureSetD3D11Ptr(session, device, desc, miscFlags, outTextureSet); +} + +OVR_PUBLIC_FUNCTION(ovrResult) ovr_CreateMirrorTextureD3D11(ovrSession session, + ID3D11Device* device, + const D3D11_TEXTURE2D_DESC* desc, + unsigned int miscFlags, + ovrTexture** outMirrorTexture) +{ + if (!ovr_CreateMirrorTextureD3D11Ptr) + return ovrError_NotInitialized; + + return ovr_CreateMirrorTextureD3D11Ptr(session, device, desc, miscFlags, outMirrorTexture); +} +#endif + +OVR_PUBLIC_FUNCTION(ovrResult) ovr_CreateSwapTextureSetGL(ovrSession session, GLuint format, + int width, int height, + ovrSwapTextureSet** outTextureSet) +{ + if (!ovr_CreateSwapTextureSetGLPtr) + return ovrError_NotInitialized; + + return ovr_CreateSwapTextureSetGLPtr(session, format, width, height, outTextureSet); +} + +OVR_PUBLIC_FUNCTION(ovrResult) ovr_CreateMirrorTextureGL(ovrSession session, GLuint format, + int width, int height, + ovrTexture** outMirrorTexture) +{ + if (!ovr_CreateMirrorTextureGLPtr) + return ovrError_NotInitialized; + + return ovr_CreateMirrorTextureGLPtr(session, format, width, height, outMirrorTexture); +} + +OVR_PUBLIC_FUNCTION(void) ovr_DestroySwapTextureSet(ovrSession session, ovrSwapTextureSet* textureSet) +{ + if (!ovr_DestroySwapTextureSetPtr) + return; + + ovr_DestroySwapTextureSetPtr(session, textureSet); +} + +OVR_PUBLIC_FUNCTION(void) ovr_DestroyMirrorTexture(ovrSession session, ovrTexture* mirrorTexture) +{ + if (!ovr_DestroyMirrorTexturePtr) + return; + + ovr_DestroyMirrorTexturePtr(session, mirrorTexture); +} + +OVR_PUBLIC_FUNCTION(ovrResult) ovr_SetQueueAheadFraction(ovrSession session, float queueAheadFraction) +{ + if (!ovr_SetQueueAheadFractionPtr) + return ovrError_NotInitialized; + + return ovr_SetQueueAheadFractionPtr(session, queueAheadFraction); +} + +OVR_PUBLIC_FUNCTION(ovrResult) ovr_SubmitFrame(ovrSession session, long long frameIndex, const ovrViewScaleDesc* viewScaleDesc, ovrLayerHeader const * const * layerPtrList, unsigned int layerCount) +{ + if (!ovr_SubmitFramePtr) + return ovrError_NotInitialized; + + return ovr_SubmitFramePtr(session, frameIndex, viewScaleDesc, layerPtrList, layerCount); +} + +OVR_PUBLIC_FUNCTION(ovrEyeRenderDesc) ovr_GetRenderDesc(ovrSession session, ovrEyeType eyeType, ovrFovPort fov) +{ + if (!ovr_GetRenderDescPtr) + { + ovrEyeRenderDesc nullEyeRenderDesc; + memset(&nullEyeRenderDesc, 0, sizeof(nullEyeRenderDesc)); + return nullEyeRenderDesc; + } + return ovr_GetRenderDescPtr(session, eyeType, fov); +} + +OVR_PUBLIC_FUNCTION(double) ovr_GetPredictedDisplayTime(ovrSession session, long long frameIndex) +{ + if (!ovr_GetPredictedDisplayTimePtr) + return 0.0; + + return ovr_GetPredictedDisplayTimePtr(session, frameIndex); +} + +OVR_PUBLIC_FUNCTION(double) ovr_GetTimeInSeconds() +{ + if (!ovr_GetTimeInSecondsPtr) + return 0.; + return ovr_GetTimeInSecondsPtr(); +} + +OVR_PUBLIC_FUNCTION(void) ovr_ResetBackOfHeadTracking(ovrSession session) +{ + if (!ovr_ResetBackOfHeadTrackingPtr) + return; + ovr_ResetBackOfHeadTrackingPtr(session); +} + +OVR_PUBLIC_FUNCTION(void) ovr_ResetMulticameraTracking(ovrSession session) +{ + if (!ovr_ResetMulticameraTrackingPtr) + return; + ovr_ResetMulticameraTrackingPtr(session); +} + +OVR_PUBLIC_FUNCTION(ovrBool) ovr_GetBool(ovrSession session, const char* propertyName, ovrBool defaultVal) +{ + if (!ovr_GetBoolPtr) + return ovrFalse; + return ovr_GetBoolPtr(session, propertyName, defaultVal); +} + +OVR_PUBLIC_FUNCTION(ovrBool) ovr_SetBool(ovrSession session, const char* propertyName, ovrBool value) +{ + if (!ovr_SetBoolPtr) + return ovrFalse; + return ovr_SetBoolPtr(session, propertyName, value); +} + +OVR_PUBLIC_FUNCTION(int) ovr_GetInt(ovrSession session, const char* propertyName, int defaultVal) +{ + if (!ovr_GetIntPtr) + return 0; + return ovr_GetIntPtr(session, propertyName, defaultVal); +} + +OVR_PUBLIC_FUNCTION(ovrBool) ovr_SetInt(ovrSession session, const char* propertyName, int value) +{ + if (!ovr_SetIntPtr) + return ovrFalse; + return ovr_SetIntPtr(session, propertyName, value); +} + +OVR_PUBLIC_FUNCTION(float) ovr_GetFloat(ovrSession session, const char* propertyName, float defaultVal) +{ + if (!ovr_GetFloatPtr) + return 0.f; + return ovr_GetFloatPtr(session, propertyName, defaultVal); +} + +OVR_PUBLIC_FUNCTION(ovrBool) ovr_SetFloat(ovrSession session, const char* propertyName, float value) +{ + if (!ovr_SetFloatPtr) + return ovrFalse; + return ovr_SetFloatPtr(session, propertyName, value); +} + +OVR_PUBLIC_FUNCTION(unsigned int) ovr_GetFloatArray(ovrSession session, const char* propertyName, + float values[], unsigned int arraySize) +{ + if (!ovr_GetFloatArrayPtr) + return 0; + return ovr_GetFloatArrayPtr(session, propertyName, values, arraySize); +} + +OVR_PUBLIC_FUNCTION(ovrBool) ovr_SetFloatArray(ovrSession session, const char* propertyName, + const float values[], unsigned int arraySize) +{ + if (!ovr_SetFloatArrayPtr) + return ovrFalse; + return ovr_SetFloatArrayPtr(session, propertyName, values, arraySize); +} + +OVR_PUBLIC_FUNCTION(const char*) ovr_GetString(ovrSession session, const char* propertyName, + const char* defaultVal) +{ + if (!ovr_GetStringPtr) + return "(Unable to load LibOVR)"; + return ovr_GetStringPtr(session, propertyName, defaultVal); +} + +OVR_PUBLIC_FUNCTION(ovrBool) ovr_SetString(ovrSession session, const char* propertyName, + const char* value) +{ + if (!ovr_SetStringPtr) + return ovrFalse; + return ovr_SetStringPtr(session, propertyName, value); +} + +OVR_PUBLIC_FUNCTION(int) ovr_TraceMessage(int level, const char* message) +{ + if (!ovr_TraceMessagePtr) + return -1; + + return ovr_TraceMessagePtr(level, message); +} + +OVR_PUBLIC_FUNCTION(ovrResult) ovr_Lookup(const char* name, void** data) +{ + if (!ovr_LookupPtr) + return ovrError_NotInitialized; + return ovr_LookupPtr(name, data); +} + +#if defined(_MSC_VER) + #pragma warning(pop) +#endif + diff --git a/extern/OculusSDK/LibOVR/Src/OVR_CAPI_Util.cpp b/extern/OculusSDK/LibOVR/Src/OVR_CAPI_Util.cpp new file mode 100644 index 0000000..098b03e --- /dev/null +++ b/extern/OculusSDK/LibOVR/Src/OVR_CAPI_Util.cpp @@ -0,0 +1,211 @@ +/************************************************************************************ + +PublicHeader: OVR_CAPI_Util.c +Copyright : Copyright 2014 Oculus VR, LLC All Rights reserved. + +Licensed under the Oculus VR Rift SDK License Version 3.2 (the "License"); +you may not use the Oculus VR Rift SDK except in compliance with the License, +which is provided at the time of installation or download, or which +otherwise accompanies this software in either electronic or hard copy form. + +You may obtain a copy of the License at + +http://www.oculusvr.com/licenses/LICENSE-3.2 + +Unless required by applicable law or agreed to in writing, the Oculus VR SDK +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +*************************************************************************************/ + + +#include +#include + + +#if defined(_MSC_VER) + #include + #pragma intrinsic(_mm_pause) +#endif + +#if defined(_WIN32) + #include +#endif + + + +// Used to generate projection from ovrEyeDesc::Fov +OVR_PUBLIC_FUNCTION(ovrMatrix4f) ovrMatrix4f_Projection( + ovrFovPort fov, float znear, float zfar, unsigned int projectionModFlags) +{ + bool rightHanded = (projectionModFlags & ovrProjection_RightHanded) > 0; + bool flipZ = (projectionModFlags & ovrProjection_FarLessThanNear) > 0; + bool farAtInfinity = (projectionModFlags & ovrProjection_FarClipAtInfinity) > 0; + bool isOpenGL = (projectionModFlags & ovrProjection_ClipRangeOpenGL) > 0; + + // TODO: Pass in correct eye to CreateProjection if we want to support canted displays from CAPI + return OVR::CreateProjection(rightHanded , isOpenGL, fov, OVR::StereoEye_Center, znear, zfar, flipZ, farAtInfinity); +} + +OVR_PUBLIC_FUNCTION(ovrTimewarpProjectionDesc) ovrTimewarpProjectionDesc_FromProjection( + ovrMatrix4f Projection, unsigned int projectionModFlags) +{ + ovrTimewarpProjectionDesc res; + res.Projection22 = Projection.M[2][2]; + res.Projection23 = Projection.M[2][3]; + res.Projection32 = Projection.M[3][2]; + + if ((res.Projection32 != 1.0f) && (res.Projection32 != -1.0f)) + { + // This is a very strange projection matrix, and probably won't work. + // If you need it to work, please contact Oculus and let us know your usage scenario. + } + + if ( ( projectionModFlags & ovrProjection_ClipRangeOpenGL ) != 0 ) + { + // Internally we use the D3D range of [0,+w] not the OGL one of [-w,+w], so we need to convert one to the other. + // Note that the values in the depth buffer, and the actual linear depth we want is the same for both APIs, + // the difference is purely in the values inside the projection matrix. + + // D3D does this: + // depthBuffer = ( ProjD3D.M[2][2] * linearDepth + ProjD3D.M[2][3] ) / ( linearDepth * ProjD3D.M[3][2] ); + // OGL does this: + // depthBuffer = 0.5 + 0.5 * ( ProjOGL.M[2][2] * linearDepth + ProjOGL.M[2][3] ) / ( linearDepth * ProjOGL.M[3][2] ); + + // Therefore: + // ProjD3D.M[2][2] = 0.5 * ( ProjOGL.M[2][2] + ProjOGL.M[3][2] ); + // ProjD3D.M[2][3] = 0.5 * ProjOGL.M[2][3]; + // ProjD3D.M[3][2] = ProjOGL.M[3][2]; + + res.Projection22 = 0.5f * ( Projection.M[2][2] + Projection.M[3][2] ); + res.Projection23 = 0.5f * Projection.M[2][3]; + res.Projection32 = Projection.M[3][2]; + } + return res; +} + +OVR_PUBLIC_FUNCTION(ovrMatrix4f) ovrMatrix4f_OrthoSubProjection( + ovrMatrix4f projection, ovrVector2f orthoScale, + float orthoDistance, float hmdToEyeViewOffsetX) +{ + ovrMatrix4f ortho; + // Negative sign is correct! + // If the eye is offset to the left, then the ortho view needs to be offset to the right relative to the camera. + float orthoHorizontalOffset = -hmdToEyeViewOffsetX / orthoDistance; + + /* + // Current projection maps real-world vector (x,y,1) to the RT. + // We want to find the projection that maps the range [-FovPixels/2,FovPixels/2] to + // the physical [-orthoHalfFov,orthoHalfFov] + // Note moving the offset from M[0][2]+M[1][2] to M[0][3]+M[1][3] - this means + // we don't have to feed in Z=1 all the time. + // The horizontal offset math is a little hinky because the destination is + // actually [-orthoHalfFov+orthoHorizontalOffset,orthoHalfFov+orthoHorizontalOffset] + // So we need to first map [-FovPixels/2,FovPixels/2] to + // [-orthoHalfFov+orthoHorizontalOffset,orthoHalfFov+orthoHorizontalOffset]: + // x1 = x0 * orthoHalfFov/(FovPixels/2) + orthoHorizontalOffset; + // = x0 * 2*orthoHalfFov/FovPixels + orthoHorizontalOffset; + // But then we need the same mapping as the existing projection matrix, i.e. + // x2 = x1 * Projection.M[0][0] + Projection.M[0][2]; + // = x0 * (2*orthoHalfFov/FovPixels + orthoHorizontalOffset) * Projection.M[0][0] + Projection.M[0][2]; + // = x0 * Projection.M[0][0]*2*orthoHalfFov/FovPixels + + // orthoHorizontalOffset*Projection.M[0][0] + Projection.M[0][2]; + // So in the new projection matrix we need to scale by Projection.M[0][0]*2*orthoHalfFov/FovPixels and + // offset by orthoHorizontalOffset*Projection.M[0][0] + Projection.M[0][2]. + */ + + ortho.M[0][0] = projection.M[0][0] * orthoScale.x; + ortho.M[0][1] = 0.0f; + ortho.M[0][2] = 0.0f; + ortho.M[0][3] = -projection.M[0][2] + ( orthoHorizontalOffset * projection.M[0][0] ); + + ortho.M[1][0] = 0.0f; + ortho.M[1][1] = -projection.M[1][1] * orthoScale.y; /* Note sign flip (text rendering uses Y=down). */ + ortho.M[1][2] = 0.0f; + ortho.M[1][3] = -projection.M[1][2]; + + ortho.M[2][0] = 0.0f; + ortho.M[2][1] = 0.0f; + ortho.M[2][2] = 0.0f; + ortho.M[2][3] = 0.0f; + + /* No perspective correction for ortho. */ + ortho.M[3][0] = 0.0f; + ortho.M[3][1] = 0.0f; + ortho.M[3][2] = 0.0f; + ortho.M[3][3] = 1.0f; + + return ortho; +} + + +OVR_PUBLIC_FUNCTION(void) ovr_CalcEyePoses(ovrPosef headPose, + const ovrVector3f hmdToEyeViewOffset[2], + ovrPosef outEyePoses[2]) +{ + if (!hmdToEyeViewOffset || !outEyePoses) + { + return; + } + + using OVR::Posef; + using OVR::Vector3f; + + // Currently HmdToEyeViewOffset is only a 3D vector + outEyePoses[0] = Posef(headPose.Orientation, ((Posef)headPose).Apply((Vector3f)hmdToEyeViewOffset[0])); + outEyePoses[1] = Posef(headPose.Orientation, ((Posef)headPose).Apply((Vector3f)hmdToEyeViewOffset[1])); +} + + +OVR_PUBLIC_FUNCTION(void) ovr_GetEyePoses(ovrSession session, long long frameIndex, ovrBool latencyMarker, + const ovrVector3f hmdToEyeViewOffset[2], + ovrPosef outEyePoses[2], + ovrTrackingState* outHmdTrackingState) +{ + double frameTime = ovr_GetPredictedDisplayTime(session, frameIndex); + ovrTrackingState trackingState = ovr_GetTrackingState(session, frameTime, latencyMarker); + ovr_CalcEyePoses(trackingState.HeadPose.ThePose, hmdToEyeViewOffset, outEyePoses); + + if ( outHmdTrackingState != nullptr ) + { + *outHmdTrackingState = trackingState; + } +} + + +OVR_PUBLIC_FUNCTION(ovrDetectResult) ovr_Detect(int timeoutMsec) +{ + // Initially we assume everything is not running. + ovrDetectResult result; + result.IsOculusHMDConnected = ovrFalse; + result.IsOculusServiceRunning = ovrFalse; + +#if defined(_WIN32) + // Attempt to open the named event. + HANDLE hServiceEvent = ::OpenEventW(SYNCHRONIZE, FALSE, OVR_HMD_CONNECTED_EVENT_NAME); + + // If event exists, + if (hServiceEvent != nullptr) + { + // This indicates that the Oculus Runtime is installed and running. + result.IsOculusServiceRunning = ovrTrue; + + // Poll for event state. + DWORD objectResult = ::WaitForSingleObject(hServiceEvent, timeoutMsec); + + // If the event is signaled, + if (objectResult == WAIT_OBJECT_0) + { + // This indicates that the Oculus HMD is connected. + result.IsOculusHMDConnected = ovrTrue; + } + + ::CloseHandle(hServiceEvent); + } +#endif // _WIN32 + + + return result; +} diff --git a/extern/OculusSDK/LibOVR/Src/OVR_StereoProjection.cpp b/extern/OculusSDK/LibOVR/Src/OVR_StereoProjection.cpp new file mode 100644 index 0000000..4f4ba2d --- /dev/null +++ b/extern/OculusSDK/LibOVR/Src/OVR_StereoProjection.cpp @@ -0,0 +1,227 @@ +/************************************************************************************ + +Filename : OVR_StereoProjection.cpp +Content : Stereo rendering functions +Created : November 30, 2013 +Authors : Tom Fosyth + +Copyright : Copyright 2014 Oculus VR, LLC All Rights reserved. + +Licensed under the Oculus VR Rift SDK License Version 3.2 (the "License"); +you may not use the Oculus VR Rift SDK except in compliance with the License, +which is provided at the time of installation or download, or which +otherwise accompanies this software in either electronic or hard copy form. + +You may obtain a copy of the License at + +http://www.oculusvr.com/licenses/LICENSE-3.2 + +Unless required by applicable law or agreed to in writing, the Oculus VR SDK +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +*************************************************************************************/ + +#include + + +namespace OVR { + + +ScaleAndOffset2D CreateNDCScaleAndOffsetFromFov ( FovPort tanHalfFov ) +{ + float projXScale = 2.0f / ( tanHalfFov.LeftTan + tanHalfFov.RightTan ); + float projXOffset = ( tanHalfFov.LeftTan - tanHalfFov.RightTan ) * projXScale * 0.5f; + float projYScale = 2.0f / ( tanHalfFov.UpTan + tanHalfFov.DownTan ); + float projYOffset = ( tanHalfFov.UpTan - tanHalfFov.DownTan ) * projYScale * 0.5f; + + ScaleAndOffset2D result; + result.Scale = Vector2f(projXScale, projYScale); + result.Offset = Vector2f(projXOffset, projYOffset); + // Hey - why is that Y.Offset negated? + // It's because a projection matrix transforms from world coords with Y=up, + // whereas this is from NDC which is Y=down. + + return result; +} + + + +Matrix4f CreateProjection( bool rightHanded, bool isOpenGL, FovPort tanHalfFov, StereoEye /*eye*/, + float zNear /*= 0.01f*/, float zFar /*= 10000.0f*/, + bool flipZ /*= false*/, bool farAtInfinity /*= false*/) +{ + if(!flipZ && farAtInfinity) + { + //OVR_ASSERT_M(false, "Cannot push Far Clip to Infinity when Z-order is not flipped"); Assertion disabled because this code no longer has access to LibOVRKernel assertion functionality. + farAtInfinity = false; + } + + // A projection matrix is very like a scaling from NDC, so we can start with that. + ScaleAndOffset2D scaleAndOffset = CreateNDCScaleAndOffsetFromFov ( tanHalfFov ); + + float handednessScale = rightHanded ? -1.0f : 1.0f; + + Matrix4f projection; + // Produces X result, mapping clip edges to [-w,+w] + projection.M[0][0] = scaleAndOffset.Scale.x; + projection.M[0][1] = 0.0f; + projection.M[0][2] = handednessScale * scaleAndOffset.Offset.x; + projection.M[0][3] = 0.0f; + + // Produces Y result, mapping clip edges to [-w,+w] + // Hey - why is that YOffset negated? + // It's because a projection matrix transforms from world coords with Y=up, + // whereas this is derived from an NDC scaling, which is Y=down. + projection.M[1][0] = 0.0f; + projection.M[1][1] = scaleAndOffset.Scale.y; + projection.M[1][2] = handednessScale * -scaleAndOffset.Offset.y; + projection.M[1][3] = 0.0f; + + // Produces Z-buffer result - app needs to fill this in with whatever Z range it wants. + // We'll just use some defaults for now. + projection.M[2][0] = 0.0f; + projection.M[2][1] = 0.0f; + + if (farAtInfinity) + { + if (isOpenGL) + { + // It's not clear this makes sense for OpenGL - you don't get the same precision benefits you do in D3D. + projection.M[2][2] = -handednessScale; + projection.M[2][3] = 2.0f * zNear; + } + else + { + projection.M[2][2] = 0.0f; + projection.M[2][3] = zNear; + } + } + else + { + if (isOpenGL) + { + // Clip range is [-w,+w], so 0 is at the middle of the range. + projection.M[2][2] = -handednessScale * (flipZ ? -1.0f : 1.0f) * (zNear + zFar) / (zNear - zFar); + projection.M[2][3] = 2.0f * ((flipZ ? -zFar : zFar) * zNear) / (zNear - zFar); + } + else + { + // Clip range is [0,+w], so 0 is at the start of the range. + projection.M[2][2] = -handednessScale * (flipZ ? -zNear : zFar) / (zNear - zFar); + projection.M[2][3] = ((flipZ ? -zFar : zFar) * zNear) / (zNear - zFar); + } + } + + // Produces W result (= Z in) + projection.M[3][0] = 0.0f; + projection.M[3][1] = 0.0f; + projection.M[3][2] = handednessScale; + projection.M[3][3] = 0.0f; + + return projection; +} + + +Matrix4f CreateOrthoSubProjection ( bool /*rightHanded*/, StereoEye eyeType, + float tanHalfFovX, float tanHalfFovY, + float unitsX, float unitsY, + float distanceFromCamera, float interpupillaryDistance, + Matrix4f const &projection, + float zNear /*= 0.0f*/, float zFar /*= 0.0f*/, + bool flipZ /*= false*/, bool farAtInfinity /*= false*/) +{ + if(!flipZ && farAtInfinity) + { + //OVR_ASSERT_M(false, "Cannot push Far Clip to Infinity when Z-order is not flipped"); Assertion disabled because this code no longer has access to LibOVRKernel assertion functionality. + farAtInfinity = false; + } + + float orthoHorizontalOffset = interpupillaryDistance * 0.5f / distanceFromCamera; + switch ( eyeType ) + { + case StereoEye_Left: + break; + case StereoEye_Right: + orthoHorizontalOffset = -orthoHorizontalOffset; + break; + case StereoEye_Center: + orthoHorizontalOffset = 0.0f; + break; + default: + break; + } + + // Current projection maps real-world vector (x,y,1) to the RT. + // We want to find the projection that maps the range [-FovPixels/2,FovPixels/2] to + // the physical [-orthoHalfFov,orthoHalfFov] + // Note moving the offset from M[0][2]+M[1][2] to M[0][3]+M[1][3] - this means + // we don't have to feed in Z=1 all the time. + // The horizontal offset math is a little hinky because the destination is + // actually [-orthoHalfFov+orthoHorizontalOffset,orthoHalfFov+orthoHorizontalOffset] + // So we need to first map [-FovPixels/2,FovPixels/2] to + // [-orthoHalfFov+orthoHorizontalOffset,orthoHalfFov+orthoHorizontalOffset]: + // x1 = x0 * orthoHalfFov/(FovPixels/2) + orthoHorizontalOffset; + // = x0 * 2*orthoHalfFov/FovPixels + orthoHorizontalOffset; + // But then we need the sam mapping as the existing projection matrix, i.e. + // x2 = x1 * Projection.M[0][0] + Projection.M[0][2]; + // = x0 * (2*orthoHalfFov/FovPixels + orthoHorizontalOffset) * Projection.M[0][0] + Projection.M[0][2]; + // = x0 * Projection.M[0][0]*2*orthoHalfFov/FovPixels + + // orthoHorizontalOffset*Projection.M[0][0] + Projection.M[0][2]; + // So in the new projection matrix we need to scale by Projection.M[0][0]*2*orthoHalfFov/FovPixels and + // offset by orthoHorizontalOffset*Projection.M[0][0] + Projection.M[0][2]. + + float orthoScaleX = 2.0f * tanHalfFovX / unitsX; + float orthoScaleY = 2.0f * tanHalfFovY / unitsY; + Matrix4f ortho; + ortho.M[0][0] = projection.M[0][0] * orthoScaleX; + ortho.M[0][1] = 0.0f; + ortho.M[0][2] = 0.0f; + ortho.M[0][3] = -projection.M[0][2] + ( orthoHorizontalOffset * projection.M[0][0] ); + + ortho.M[1][0] = 0.0f; + ortho.M[1][1] = -projection.M[1][1] * orthoScaleY; // Note sign flip (text rendering uses Y=down). + ortho.M[1][2] = 0.0f; + ortho.M[1][3] = -projection.M[1][2]; + + const float zDiff = zNear - zFar; + if (fabsf(zDiff) < 0.001f) + { + ortho.M[2][0] = 0.0f; + ortho.M[2][1] = 0.0f; + ortho.M[2][2] = 0.0f; + ortho.M[2][3] = flipZ ? zNear : zFar; + } + else + { + ortho.M[2][0] = 0.0f; + ortho.M[2][1] = 0.0f; + + if(farAtInfinity) + { + ortho.M[2][2] = 0.0f; + ortho.M[2][3] = zNear; + } + else if (zDiff != 0.0f) + { + ortho.M[2][2] = (flipZ ? zNear : zFar) / zDiff; + ortho.M[2][3] = ((flipZ ? -zFar : zFar) * zNear) / zDiff; + } + } + + // No perspective correction for ortho. + ortho.M[3][0] = 0.0f; + ortho.M[3][1] = 0.0f; + ortho.M[3][2] = 0.0f; + ortho.M[3][3] = 1.0f; + + return ortho; +} + + + +} //namespace OVR + + diff --git a/extern/OculusSDK/LibOVR/Src/Resources/Windows/LibOVR.rc b/extern/OculusSDK/LibOVR/Src/Resources/Windows/LibOVR.rc new file mode 100644 index 0000000000000000000000000000000000000000..2dea11d64b772e188890ee57f507ed8f724cfa74 GIT binary patch literal 4838 zcmd6rUvC;$5XI-YQoqC2Q5C03`QxOO9jOm?FfKJV$Y8AY1%X){RBSB3aU0gQxEtnv(UpJbLmm zpg82I?-qOZ@f+Co5~<&~su8nSPCh|a$7;L-u0eVm|6e25=Q+u*-Y;VzlaME0syTl0 zq2`?@YmT2x@b3jje}Pl#@?u03GVJ1<4|{BoVKqB)sO=M{u2s3NlmDkwzzJvNe%nc% zBA4wUzgn|DkbD@2bt`pZ+h1UOhUPBV2XC6#X^=7JivV>V&-tp{B!az^_Y?iaS~Y!gKD6&##d6U1Sb^TJhaPok8fU<*jyaityiL;QG%slXZrrpy#&DDVXC{SIRAMzYga9MSYoOs|z@@U5O7`eX7rYRFlk<3!Y zh54=MvS4O^Vr7DzB3ajC*SpLvC3|ao_B{yflI_3nQMT<;zgpYly2r{bxs^>lf#D9w zwFWGy?ArpzEcdI}ALC&SFNWCk^H28NIxMogd9CuVgdaNh`HnSZ&-|ChAf@cA6C1^K z3%@<5iX%S}r5gc2+@fEsa0MsNmlk9{zLS8s=E=8s zke?#Gefgyc^gZW&G>b*fmRiLw;%ZgW)bZAU*sVuvz0VQ|Oq0mH{mtWQNT?on|Z#l>y1$xq6fWa9q(oH&liLQOg;92sVYP+ePOtL7uU zulbnw!7Bx&cdWFj6U|Cu4&}Leu`pFn_0x}XQ@O4QM_C`u+03o`8Amf*iWSWR+N0i_C84*jFmY+7TlG#% zs?IMvL+6bow5D0(C6*F&jo|5&+I`5kp=QE4uALUun$jIc&ZBjhe|ZLZZdA_tSu=~< zIvsk)sw_IF_wC_I+$%cxI9=AqQ@TXF_cq#u{0#h*b9v6vT;zL*7_{s-wzR?9%x~?} z=cm^#Tzv+5mi6=CB?u{g`ad9XIyIN+{qmgik?S0k3pG3eJ20EN&Y&| zb;nqlVqKF`kv=;m%0;R~dk%gT=?vNX=%MQXK6YJZ#1_7k7DpMIdRGvqYnSrl0#7?= h?D9E8zKJ%y0r^gu_bY#$xA;6CgVh3Dp*KG7*}pgOs5Afo literal 0 HcmV?d00001 diff --git a/extern/OculusSDK/LibOVR/Src/Resources/Windows/Oculus.ico b/extern/OculusSDK/LibOVR/Src/Resources/Windows/Oculus.ico new file mode 100644 index 0000000000000000000000000000000000000000..8641a785ba299f17edbcf260149127d22cfbee42 GIT binary patch literal 105425 zcmeI52Rv8Z|G=-2QREx4vdc&kO~n&YXrn@9CiPUb6NPw4gJ_V3QAR_FRFstnp{XJ( zN)wqSQSSeIJipuDqeaL%=jHf*@BQ9;&gb*~e9pY*-b)a41QS7{5$KbT_?v+sRuKON zIzp5%=Ou`{XrH4a{4PpJv(OO=!w5oE^?%!H1hIHH9U(9O@Aer9f^f1xM~eP$8>Kta zjgF8;NusYP1=!Dr{-c1>Z5_zI64Fvrmz$gGEn3v-5A8%hwbC*)G*n1X@F#!hfR?9> zl9Bnz!RRM+z}MqZcK;rXvi`dB>ld{1-(SB<)!yS#Qtgrl9p7Gk(J4r(w)6a|U9bDn zx;(UZdyn=!P4QMoo<P2NY_h*^!QI^G zkLuez934+G=H#vX>pH*2uFNVasj^)1N?qQXLHBBvX$KCo8tH1xk~}2O#-PT+B4)}L=TIoalsI>z zAhSn_p~9`82h#KWrtFN0nrL`+{gBb4NAFH6*{uuZRCJc>0=tN zJc-&ja)FF#{zMlV-^BAQGiETT)YR7M=;$~-2+}mWeMI4ivhCPevu0)On0R!KIE_V= z#-jC^x8Ac#`Q9NTmkh(4on+D4W$7UGHSZr*9YULVHV2Vq@4doj!dzC;DG)Be-bMBIz+>(&B7u z<+s<#7TA9*B$$$J%ClLs7CF+iGP+vbNW*e*IoFhbW#yziu6r!F3K~x+(=i$w_4^LM=cOw() z-sL|iD)LN9O4=-?S~}b4lleuy$V- z{Ss66-7_yq6?k7)7Z?#ii?UL$9phQaDrS02a@j?`jhi-ITwA#0{L+srS*qWy3?FAj ze()$k?P-9D=i_tw!vzPMKRk6^oyDo3z|i1u%8dXzWD$$Sx9;58NuxhL@r%&2^?c{_ z!&5)izNWKlj6X5_-4w@1h7lnl1J>kRn4z9*#?8x{94VU{@_<8{k1g=hC9X>=?o6LM zmt96i=CYyGeMthPN25QW#fVZtmf#vVaNy;6JLu`1h?tld?L~|B=$qIN4bs>*Ye)DS zRkx9j7K>?W#novdY4z1yRi9q3qz&FRxt`UdL{xBaN$tIRrq6HAtp8Fe;!IOJ?jaw< zAo{q#GQV!3D~E{3U)$>fuU!Cq~LL z($f{}Am?v*b(`O6$rJ$r|JP>EZ|->#UCE&6;cO}|9UGi4Zm#6`v4|v6QX~|&RtPey z6pj~Tyz8g5>-lreII@X3GV_|%*iZ(o!W{eZi{uTZ$~foq=VfyxbeOb8aN4{%xvMH` zHtDlrJM&mcLN@asGrl8J?U|leD_Z6sHsZ9PJsf`^Aiy(7^Z2uvwW)Jh$BJiI=BK8( z4RIf~RVpSnc5?lyTe(sDDk|2(4mo4@<+nc`sboluvKl{Of?3|>RVyg1n@{Itk=@#nKM+=Hbkt^A1%DSTw(djm9-N^W}}R+lc}1;u|$OIAWcukNFT~K(eg<7#@$&7pI!~~o$~mf1H&~NWEkzZh_lIxl~>ILBO@cP z7HiHLq9%GktN2{_-Nw@Ox$(kEKKn83#BNlpet8~9-p*MZ(C{Ta_0Tp{Pdu2AAZiP=?^J9eZ_ z`lzijkdeOrfoDZ(Y-PfzSg-LC^og~~o2{*v6g9pw6R~IDYQ? z_wPjo_C3E4TaonW>;fGGfUj1O=^a#F0~bqMzou`uYln=xH)% z%CkL*V$Y9?u*{t$Ym&hBv2bhA(Cbo1=g>PwHr`ltaNA%;Lha=Jq1WqB&1IhE;b&8O zXOii$X-7`I%~aBuJbAKBS(w$4N$dQ}bsrs}=jP^asIlFVwn1A@&y{_c|Ba-bgC45* ztp2j z&o|w~WK5K0uKTN3lD7j?RKBcnQgw7DC(_gm749QTc%uE5xsm+#_VEc*_V5y@E!ptm z){wW+aUn$mP?I&o!6Bi1ER)1z|9JsZ*?r`UlKvSmh)CR8WOr2b!vvEEQ#v`L7#Gw! z87bIn8#y>kUA<pU#ur-r5^PIWSLHm4bJP@GEDT4oj^0 zoyS@}kw>;ODfMGpMTa^i0s;c4;!o8xVFH09FU~Ao zA$r!$G0js%e+m@WQQ>h1pWae$Ixt7FI%8D0bbMlYjGTvvirf{Zv%{R`jN7dfq>y3C(hYVG$2dZ;+geN3SRepb8H)N@%fM9-9^?mi(4{~y(V!hU6q^D1tJ=@KA zf#V}*q0qIt>j9jo4ko<+qP}XeKyYZe?8OQan39gZZ@V3b>+Mn zOpYarsGi+##KcaADlG#8(JyCX%TRG!dCx)2YKrVTPF|KXwp)g(nU+6Mh|D}8HqpAA z&w`iU!ehV$&6CsBSls!?=~?rSznSXJf6kJ)b+frQUM%DP`eazxBKRRM??vGn{iBzO z^@079q6LHMD}()UuU&96I6u1~ zT`6a{OQH*FNr=^CpD3>T8w4#FprcXsjEPB=3DMcbac+Bs3yt2ReZBR+dFg^K&ik({dBO z1Z1o&i;^7_r0JPmHYd^P&O~!>c4SOcLp*x?c;wRI_9~f?+WPv;57}g5iN6=~qBovfWzO5X4yKQ=u6(*rYeZmqF|V5G z=lW{hHTwmKj|H1Nv*s5ZJ+)`Tnr!JEF|zjh(%ebMCam!?zBPf30e&tJSpFpiwO^s3 zx^IapWsYa-g%6KjDjCZiGc)t>Xmv&3)8z#sd@PQkp|j2o^2*W(pwVAiakkOdde+#Z zH=iYIMyz@$nHzFn)GF^X>n;uv9f#8FhYy_>Us^HKkE!;tsdJ*f^CxB#cI!>S)&!w# zY<%JUc!KZD1SKWrH91Xt{2Y@eTIIbseq$XUQ$}Vco$Bf^T}}TIMT3~jOWy80=CzPT zxv|{jqTQ#Bgmyy8qiLn%3=-@n``g!rC-8kvOr)>P3VED0U*@30+pr54G?ayXj8adq zh>5x+J_t&ax2s?OC?|)3m^5hS{)S^YIXUL_RnHW+y*Fs6t#-Ci_9!h~jq1`u7B5|G z?cGU9YPl8#<6G6mEBRd4B@FqJRI7aT!f}Vt@Cz3Pm*uGJ1kQ&XCULr@+XOn-yJg;pvX* z)=k9Oa>;;U3Uj&Kct$6YO_eIkeZ*Cuig99KuBuADu2VNd%o#P4tB$>S`*zxRffS>y zg*(qKI30NYJoh1~`KSSt9zA-7qTmV^!(Fd!;h62)mC%?19YWi4x#Z>^uKJqHF**wu zx~x}Z%a8I-xK7%m$_4d`%_<76W#wECW>%fGY85}~h1q?%VLXrJfd9bYij5-<@fhmg zDLK2yjE~Mmje(awXUoH|9g_AYBRE+vM{6$kp;yh?PIuvzt#J1F#m>=14oc=ck92qW z8_xZ()W61--+pV#__^l|uj!V?lbNW&xAEU~_wGFC((ZM0v+z;hoR2yW&p&_KBrPYW zCr)@>6=W6D*40Jr&#T6bGkpG*N2QfV_K4@fgPamfDkrqiOr4t(GD1kXg4y)w(C}~$ z*mzVZCvl4KIj#^iP)Nwf&UX8*H`|y7AK~|S^-3c*#Bkct!364pYs|e+)IvpbghA5Ao9)sb*swhrHAvmIt2zU6I9BUjrFS34rL&ivgxC&wsT!H@F~~b z?K)jHd#6?Y(}k-m0s;-8gHThmQFd|7rnj-dyVrWJI%W|0;x!sB>en{=_PNVE4gVslYPi4;B^{ ziZ)eTxgiDnv*?OrimbdQq64T1$5(yqEsQFIxrUV6eaJYkBbs%Y`? z(@P%vpD>i9v8b{*p>D?XAf4QoG$S#AeSz1mv8u5Yu{k7a(h+R8!!MNX{|WKaWL9^3#vFlQ^oRp&GeuP-JA* zR%ekaGi3gUP8OLCdyX9wc>l4M7}D@8glPvFXC5Bi7!sb>l=*4Jkg9EU6@_j^pI=3z zVfZ1VfvbW~pJon^uaj}8b~Cvp_wsQ4R8+1s7A)Z68RI~+wOxIk!~gSq7AG{+Du4P# zSZ35HZ@Z+*73e5OC)(BZ&%|HdJ_;kdwLF3O;(To4XmnD1!n7=4Fx>O}`LcPeZ?1E)F+Ir5-81Q_4Fkv2 zs|IKQHzSn^4Uf_A?<(08@cj1CaT&t5R9B<17njt$n+f(Ji5q;~V@gfr%uf;ev*)r- z{Tv}YY@(&AiAm*F<4JQjUqK#{kYH^2B!W)F!60D6X!7yci3AZG-oT;qd5vMrW>z0XuV`H^ zT@k-kZpxG?rpHd{i6pFbp~=tX5)u-+`tj*C_!Uf#4yJQFyg=RR6p>RBBgdBP_?m9m zq^X|!hON1upYMk1`X^C$!cwOC2)svq>TB1o8APugogLOV&ZWNYQqIvjy8X{>g$2`` z(2SIQ!+2x6YLO=i_DWFh3=CLuwtTvv7Jz2CT+Kvz+{BcWhK)j6Whc1ht3H4A3mv~{asVPX7{ zzqa#)o;#;w6wk;dIfq#Pa^|ND&2}GcNukTcQfqnb--MV*A zQ%{da?IaD=)x|Mux0UYSc86d7zQfYsyns9X|4T<=xNi1R7>@D=0?b#fU zdrk3uUo&?G0;#yAlshjkZ~e2R8J90#78Uj!F0fA=jjoQb3q<_`G<!83udepy3I-+1MZ(Fn6%gZa6v>bc%{bMuVP*Z}< z>CsS?2@=H~$@#;N&N;QTX`!ZSv@4xzu!4s4fmA+Xx_~)BTjdTrmOaK$W1TXOaK$W1TXOaK$W1TXeSh5Y>aGuhbKNH#PyG{;Y$K9M~sQgVTeAS=j>L;DE;H(=Q^ zyng+f%*@Cjqpn;bgMxy{z`#IqpSwHh>EY2MBFF+Vfovcn$O4Frl+ zU#SbA?~C5ALduLBiS7QA{tWm5FalPs$3VT=7hpUD^&IqrTKhiU{%`*l7y&C_))zwP z*|W|1U_1ZU&cEUTK5*vDnO^Mze!jlsP;PD#y}A#V`=8YN-}41v2JC=gZwt_WxpMh3 zwtYKo-r5f+9{`rUrB4X`mV$x;l9NWm<-UXV2Y&z`0G7bCr}qh|@hdM6PrsPUX4X!^OpMd*2CVzokC`Q()Uu1Jq67;o;5KXj;mRzqha7|1(~2 zZ3!6n)OG;ssGrG?f9tp}Q0+iZst2HNy3@r4*ZZAZ=YOxfKsx}ed)jyau5Er#Uc9g4 zWxh2-VBJ#!tan1Ma>8@Ff1vDBegJdCz#Q23gaGSsy7JmRqz&~RjD=xs4HqY8^ZFWC zW7AV2$ON*1j38@Q^8n`E9iR=$LF*SlcgiN7BC0)-PsR-xd^-M+qQRO@N=jxo^{5dUaL4&|d@HI%@Zp=L35Plr6eS z_V1+&b=}RIH%UHT-cHjA*1s4U8h$UkKCusU107r1up{4rJ=g$j@uvgKL3$&f?o54X zJ!o9pRXjn*j@Z2AxxgN5&|UMv>(;LAH2Z@t_I7rCdL1J z&HGT}nZCRZ9(3!>@iNQ;zw_sI7Z`{Vlm_w3(S>VMq-YoGo5TK^A^ z|JrZ=zB2y9^FQsgJ#}@v>%SCHxg{lkUPwPKG-_D%RZao(U^INcn3a|hAb`3Fgy##E~-2t!v%YG(pRMb%&fM;4>%YMd@ckcu&IfwZ{U2a^XoK+mUw_8_(6;o% z`@g^s@co}%?*l#Y{!g$y%m?H9zq{7{J^lV~@B{q(hpzDfsP}vF^B=(W)SNKXQJt~A zr8E1?y*VvlN!9xlW8mEr1GEG9`A?l!2lS@rKT-Y&;{p8qw~qS&*dCq%*qfgJM)?4I z;^#m9z7J5g?~TuYZ0Q5=3{!ZPX>V?SyF+$h2G7pz3jsg>x$X5pUwi&D_%HMc@$=t* z?E`Q>S6_VoJNN)~of5zQ;afidyANh(@3ZfJ0Q*w`#;^GOFaP=g*d5w=c>hazS=rb5 z6N*(|{iN>k#P5IVfA4>4>C;r3fZzYtl1l&k4s8PE3;6wy{m=d_HHNkU#tSV2_ymk0 z@%vv}Qt3b6!6%@8fVF1e8xVWayPrW8N-mHQWTpBz{l`jJQ%nF8zyvS>OaK$W1TXOaK$W1TXOaK$W z1TXOaK$W1TXY%(pVKmM-=G@QS=`LwSPZa{zrX_`~5tALHhUS_&eQ8d=4gn319-4 z049J5U;>x`CV&ZG0+>KQB>>OGhG%4V<@2%sL>}!mALtAL-hC4m7Dn!Ha3IZ>Eh85$ zSkU}l-&yD#Fdd2TZeU0Y(uA}j56BAwm3Q;TAO1(>ec0QZ95r%e^Lviq-G=Z!V|f1! zyzi_tBcuswLmu!>CCC%kClFBY=?w}BBDv5zen7|WcqcOC33-DIAPWRawyxqp zy~{&gO^p;rcIb}xCw@0iBn!v{fs(Pa8Bovu7e_ugV)*c$qr1?*@0e*##;yoZ2lqs~x8@Bpf~=htpl*$eizE4Xd3&7Cx7MB723bMo z&T1FHuezg-r}Sy>C&&sicQgRMYgez5!vqA{Yb~i*#me+4qOMAkSaP1+xEcfc&04d)B6R zTtk1fvZCUf_gnpL-ak7J-bVy^L7uZLd^7HZiG#~KA#RdlLO}@j& zL!Q4X2O#_JwgaGlXlQ8jc;jcBp-%Gh^7s0 zKdP+t*Y=Onzd!eXpbqTs{a^5d{yP2v-N6U?`}h|)^w;?h(47kXdH(C`{3q(~_QZLx z=J`)F=K=keuA2X(((P&U-_XzR>iKV~3{ck?`s4KviUE95W2*jk{i`K|mK^%q_0QHE zpxyzW_?@|y)@l7{`%mQYqrCBcOaK$W1TXdt+g(637bo0YQX&K?H{l>rjL=sPrIh z$OH1~j6kiaNJ>f~g^-+Z|4v)(Z}{1|^q>6(X+s{67vu?nlA*o&Q0KvY$=qCA&1=&C z#Jy6G2dsaGJR$Fn=#Y_-(Y(g7E1Cbu9*`%juLK#|8=y{udjWKGbVvby{-55b0lYdA zeB4fOSYcyA=-pLW}~lL-k4&GjDCeeI2KE~G(~ukUe!x(Q@~K*{zq z`Kh)9?hyk2Yn>+4m$0Vp>C>mp$x!Vuq}|>K=R$zAAWcZSb$%cN$O3_qt$E`o|FW~Q zziU^pC-|hlpI`IYATQXoBavbXX+qkNM@tu?0PrbGN?CtFrlyR^@Z|y&{tfP8s z{|$7Y`Wn5t|4ix78^lkM^RA3u83{9G^(4-c}f(bw0Pg!9@EeyD$1YAUI>Xi@Vs z)!>;0zY`}bDw0>xa~*#YzMDVwEVtju^LyuP+_2$CB7BoS$osuCI=T;R_nq*c{Hv?0 z$x$*gU6Mb@Us6)iT7>`P|1<933vG=*(!p`Zj-Tcac52NT(rTkGe@z=WYHDhJlNRi2 z75=0D_x$|_c59W)x0^rmqgF@usQj0kn}5UXPx9|>|LgAZ2fpzmziC}A+PnP&KmL#Z zQNH;zJG3`nIKDmgFC{~Fwm*~%@Y!AMZ%Y}v@cVb|--Y?LP8#Rmn#iBs#{B;*@Bif1 KYC7PLZ~h + + + + $(ProjectDir)../../../../ + + + + + + $(OVRSDKROOT) + true + + + \ No newline at end of file diff --git a/extern/OculusSDK/LibOVRKernel/Projects/Windows/VS2010/LibOVRKernel.vcxproj b/extern/OculusSDK/LibOVRKernel/Projects/Windows/VS2010/LibOVRKernel.vcxproj new file mode 100644 index 0000000..a8f328a --- /dev/null +++ b/extern/OculusSDK/LibOVRKernel/Projects/Windows/VS2010/LibOVRKernel.vcxproj @@ -0,0 +1,521 @@ + + + + + DebugStatic + Win32 + + + DebugStatic + x64 + + + Debug + Win32 + + + Debug + x64 + + + ReleaseStatic + Win32 + + + ReleaseStatic + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {29FA0962-DDC6-4F72-9D12-E150DF29E279} + Win32Proj + LibOVR + LibOVRKernel + + + + StaticLibrary + true + MultiByte + v100 + + + StaticLibrary + true + MultiByte + v100 + + + StaticLibrary + true + MultiByte + v100 + + + StaticLibrary + true + MultiByte + v100 + + + StaticLibrary + false + true + Unicode + v100 + + + StaticLibrary + false + true + Unicode + v100 + + + StaticLibrary + false + true + Unicode + v100 + + + StaticLibrary + false + true + Unicode + v100 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ../../../Lib/Windows/$(Platform)/$(Configuration)/VS2010/ + + + ../../../Lib/Windows/$(Platform)/$(Configuration)/VS2010/ + + + ../../../Lib/Windows/$(Platform)/$(Configuration)/VS2010/ + + + ../../../Lib/Windows/$(Platform)/$(Configuration)/VS2010/ + + + ../../../Obj/Windows/$(Platform)/$(Configuration)/VS2010/ + + + ../../../Obj/Windows/$(Platform)/$(Configuration)/VS2010/ + + + ../../../Obj/Windows/$(Platform)/$(Configuration)/VS2010/ + + + ../../../Obj/Windows/$(Platform)/$(Configuration)/VS2010/ + + + LibOVRKernel + + + LibOVRKernel + + + LibOVRKernel + AllRules.ruleset + false + + + LibOVRKernel + AllRules.ruleset + false + + + ../../../Lib/Windows/$(Platform)/$(Configuration)/VS2010/ + + + ../../../Lib/Windows/$(Platform)/$(Configuration)/VS2010/ + + + ../../../Lib/Windows/$(Platform)/$(Configuration)/VS2010/ + + + ../../../Lib/Windows/$(Platform)/$(Configuration)/VS2010/ + + + ../../../Obj/Windows/$(Platform)/$(Configuration)/VS2010/ + + + ../../../Obj/Windows/$(Platform)/$(Configuration)/VS2010/ + + + ../../../Obj/Windows/$(Platform)/$(Configuration)/VS2010/ + + + ../../../Obj/Windows/$(Platform)/$(Configuration)/VS2010/ + + + LibOVRKernel + + + LibOVRKernel + + + LibOVRKernel + + + LibOVRKernel + + + + NotUsing + Level4 + Disabled + OVR_BUILD_DEBUG;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions); + OldStyle + true + false + true + MultiThreadedDebug + %(AdditionalIncludeDirectories);../../../Src;$(DXSDK_DIR)/Include + true + false + true + false + + + Windows + true + + + Setupapi.lib + + + + + NotUsing + Level4 + Disabled + OVR_BUILD_DEBUG;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions); + OldStyle + true + false + true + MultiThreadedDebug + %(AdditionalIncludeDirectories);../../../Src;$(DXSDK_DIR)/Include + true + false + true + false + + + Windows + true + + + Setupapi.lib + + + + + NotUsing + Level4 + Disabled + OVR_BUILD_DEBUG;_WIN64;_DEBUG;_LIB;%(PreprocessorDefinitions); + OldStyle + true + false + true + MultiThreadedDebug + %(AdditionalIncludeDirectories);../../../Src;$(DXSDK_DIR)/Include + false + false + true + false + true + false + + + Windows + true + + + Setupapi.lib + + + + + NotUsing + Level4 + Disabled + OVR_BUILD_DEBUG;_WIN64;_DEBUG;_LIB;%(PreprocessorDefinitions); + OldStyle + true + false + true + MultiThreadedDebug + %(AdditionalIncludeDirectories);../../../Src;$(DXSDK_DIR)/Include + false + false + true + false + true + false + + + Windows + true + + + Setupapi.lib + + + + + Level4 + NotUsing + Full + true + true + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions); + MultiThreaded + true + true + OldStyle + %(AdditionalIncludeDirectories);../../../Src;$(DXSDK_DIR)/Include + false + /d2Zi+ %(AdditionalOptions) + false + false + false + StreamingSIMDExtensions2 + true + AnySuitable + false + + + Windows + true + true + true + + + Setupapi.lib + + + + + Level4 + NotUsing + Full + true + true + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions); + MultiThreaded + true + true + OldStyle + %(AdditionalIncludeDirectories);../../../Src;$(DXSDK_DIR)/Include + false + /d2Zi+ %(AdditionalOptions) + false + false + false + StreamingSIMDExtensions2 + true + AnySuitable + false + + + Windows + true + true + true + + + Setupapi.lib + + + + + Level4 + NotUsing + Full + true + true + _WIN64;NDEBUG;_LIB;%(PreprocessorDefinitions); + MultiThreaded + true + true + OldStyle + %(AdditionalIncludeDirectories);../../../Src;$(DXSDK_DIR)/Include + false + /d2Zi+ %(AdditionalOptions) + false + false + false + NotSet + true + AnySuitable + false + false + + + Windows + true + true + true + + + Setupapi.lib + + + + + Level4 + NotUsing + Full + true + true + _WIN64;NDEBUG;_LIB;%(PreprocessorDefinitions); + MultiThreaded + true + true + OldStyle + %(AdditionalIncludeDirectories);../../../Src;$(DXSDK_DIR)/Include + false + /d2Zi+ %(AdditionalOptions) + false + false + false + NotSet + true + AnySuitable + false + false + + + Windows + true + true + true + + + Setupapi.lib + + + + + + diff --git a/extern/OculusSDK/LibOVRKernel/Projects/Windows/VS2010/LibOVRKernel.vcxproj.filters b/extern/OculusSDK/LibOVRKernel/Projects/Windows/VS2010/LibOVRKernel.vcxproj.filters new file mode 100644 index 0000000..4339360 --- /dev/null +++ b/extern/OculusSDK/LibOVRKernel/Projects/Windows/VS2010/LibOVRKernel.vcxproj.filters @@ -0,0 +1,246 @@ + + + + + {cbd5aacf-597b-4418-bb2d-5cc31c56d320} + + + {9c8f8b78-8c98-4daa-a0be-885ce14ec526} + + + {adfe2ad5-b3f5-4afd-98da-b3ca76652ced} + + + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + GL + + + GL + + + Util + + + Util + + + Util + + + Util + + + Util + + + Util + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + GL + + + Util + + + Util + + + Util + + + Util + + + Util + + + Util + + + Kernel + + + Kernel + + + diff --git a/extern/OculusSDK/LibOVRKernel/Projects/Windows/VS2012/LibOVRKernel.vcxproj b/extern/OculusSDK/LibOVRKernel/Projects/Windows/VS2012/LibOVRKernel.vcxproj new file mode 100644 index 0000000..635f7c7 --- /dev/null +++ b/extern/OculusSDK/LibOVRKernel/Projects/Windows/VS2012/LibOVRKernel.vcxproj @@ -0,0 +1,526 @@ + + + + + DebugStatic + Win32 + + + DebugStatic + x64 + + + Debug + Win32 + + + Debug + x64 + + + ReleaseStatic + Win32 + + + ReleaseStatic + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {29FA0962-DDC6-4F72-9D12-E150DF29E279} + Win32Proj + LibOVR + LibOVRKernel + + + + StaticLibrary + true + MultiByte + v110 + + + StaticLibrary + true + MultiByte + v110 + + + StaticLibrary + true + MultiByte + v110 + + + StaticLibrary + true + MultiByte + v110 + + + StaticLibrary + false + true + Unicode + v110 + + + StaticLibrary + false + true + Unicode + v110 + + + StaticLibrary + false + true + Unicode + v110 + + + StaticLibrary + false + true + Unicode + v110 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ../../../Lib/Windows/$(Platform)/$(Configuration)/VS2012/ + + + ../../../Lib/Windows/$(Platform)/$(Configuration)/VS2012/ + + + ../../../Lib/Windows/$(Platform)/$(Configuration)/VS2012/ + + + ../../../Lib/Windows/$(Platform)/$(Configuration)/VS2012/ + + + ../../../Obj/Windows/$(Platform)/$(Configuration)/VS2012/ + + + ../../../Obj/Windows/$(Platform)/$(Configuration)/VS2012/ + + + ../../../Obj/Windows/$(Platform)/$(Configuration)/VS2012/ + + + ../../../Obj/Windows/$(Platform)/$(Configuration)/VS2012/ + + + LibOVRKernel + + + LibOVRKernel + + + LibOVRKernel + AllRules.ruleset + false + + + LibOVRKernel + AllRules.ruleset + false + + + ../../../Lib/Windows/$(Platform)/$(Configuration)/VS2012/ + + + ../../../Lib/Windows/$(Platform)/$(Configuration)/VS2012/ + + + ../../../Lib/Windows/$(Platform)/$(Configuration)/VS2012/ + + + ../../../Lib/Windows/$(Platform)/$(Configuration)/VS2012/ + + + ../../../Obj/Windows/$(Platform)/$(Configuration)/VS2012/ + + + ../../../Obj/Windows/$(Platform)/$(Configuration)/VS2012/ + + + ../../../Obj/Windows/$(Platform)/$(Configuration)/VS2012/ + + + ../../../Obj/Windows/$(Platform)/$(Configuration)/VS2012/ + + + LibOVRKernel + + + LibOVRKernel + + + LibOVRKernel + + + LibOVRKernel + + + + + + Level4 + Disabled + OVR_BUILD_DEBUG;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions); + OldStyle + true + false + true + MultiThreadedDebug + %(AdditionalIncludeDirectories);../../../Src + true + false + true + false + + + Windows + true + + + Setupapi.lib + + + + + + + Level4 + Disabled + OVR_BUILD_DEBUG;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions); + OldStyle + true + false + true + MultiThreadedDebug + %(AdditionalIncludeDirectories);../../../Src + true + false + true + false + + + Windows + true + + + Setupapi.lib + + + + + + + Level4 + Disabled + OVR_BUILD_DEBUG;_WIN64;_DEBUG;_LIB;%(PreprocessorDefinitions); + OldStyle + true + false + true + MultiThreadedDebug + %(AdditionalIncludeDirectories);../../../Src + false + false + true + false + true + false + + + Windows + true + + + Setupapi.lib + + + + + + + Level4 + Disabled + OVR_BUILD_DEBUG;_WIN64;_DEBUG;_LIB;%(PreprocessorDefinitions); + OldStyle + true + false + true + MultiThreadedDebug + %(AdditionalIncludeDirectories);../../../Src + false + false + true + false + true + false + + + Windows + true + + + Setupapi.lib + + + + + Level4 + + + Full + true + true + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions); + MultiThreaded + true + true + OldStyle + %(AdditionalIncludeDirectories);../../../Src + false + /d2Zi+ %(AdditionalOptions) + false + false + false + StreamingSIMDExtensions2 + true + AnySuitable + false + + + Windows + true + true + true + + + Setupapi.lib + + + + + Level4 + + + Full + true + true + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions); + MultiThreaded + true + true + OldStyle + %(AdditionalIncludeDirectories);../../../Src + false + /d2Zi+ %(AdditionalOptions) + false + false + false + StreamingSIMDExtensions2 + true + AnySuitable + false + + + Windows + true + true + true + + + Setupapi.lib + + + + + Level4 + + + Full + true + true + _WIN64;NDEBUG;_LIB;%(PreprocessorDefinitions); + MultiThreaded + true + true + OldStyle + %(AdditionalIncludeDirectories);../../../Src + false + /d2Zi+ %(AdditionalOptions) + false + false + false + NotSet + true + AnySuitable + false + false + + + Windows + true + true + true + + + Setupapi.lib + + + + + Level4 + + + Full + true + true + _WIN64;NDEBUG;_LIB;%(PreprocessorDefinitions); + MultiThreaded + true + true + OldStyle + %(AdditionalIncludeDirectories);../../../Src + false + /d2Zi+ %(AdditionalOptions) + false + false + false + NotSet + true + AnySuitable + false + false + + + Windows + true + true + true + + + Setupapi.lib + + + + + + diff --git a/extern/OculusSDK/LibOVRKernel/Projects/Windows/VS2012/LibOVRKernel.vcxproj.filters b/extern/OculusSDK/LibOVRKernel/Projects/Windows/VS2012/LibOVRKernel.vcxproj.filters new file mode 100644 index 0000000..7640fe3 --- /dev/null +++ b/extern/OculusSDK/LibOVRKernel/Projects/Windows/VS2012/LibOVRKernel.vcxproj.filters @@ -0,0 +1,237 @@ + + + + + {cbd5aacf-597b-4418-bb2d-5cc31c56d320} + + + {9c8f8b78-8c98-4daa-a0be-885ce14ec526} + + + {adfe2ad5-b3f5-4afd-98da-b3ca76652ced} + + + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + GL + + + GL + + + Util + + + Util + + + Util + + + Util + + + Util + + + Util + + + Kernel + + + Kernel + + + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + GL + + + Util + + + Util + + + Util + + + Util + + + Util + + + Util + + + Kernel + + + diff --git a/extern/OculusSDK/LibOVRKernel/Projects/Windows/VS2013/LibOVRKernel.sln b/extern/OculusSDK/LibOVRKernel/Projects/Windows/VS2013/LibOVRKernel.sln new file mode 100644 index 0000000..fc1c467 --- /dev/null +++ b/extern/OculusSDK/LibOVRKernel/Projects/Windows/VS2013/LibOVRKernel.sln @@ -0,0 +1,28 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2013 +VisualStudioVersion = 12.0.31101.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LibOVRKernel", "LibOVRKernel.vcxproj", "{29FA0962-DDC6-4F72-9D12-E150DF29E279}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {29FA0962-DDC6-4F72-9D12-E150DF29E279}.Debug|Win32.ActiveCfg = Debug|Win32 + {29FA0962-DDC6-4F72-9D12-E150DF29E279}.Debug|Win32.Build.0 = Debug|Win32 + {29FA0962-DDC6-4F72-9D12-E150DF29E279}.Debug|x64.ActiveCfg = Debug|x64 + {29FA0962-DDC6-4F72-9D12-E150DF29E279}.Debug|x64.Build.0 = Debug|x64 + {29FA0962-DDC6-4F72-9D12-E150DF29E279}.Release|Win32.ActiveCfg = Release|Win32 + {29FA0962-DDC6-4F72-9D12-E150DF29E279}.Release|Win32.Build.0 = Release|Win32 + {29FA0962-DDC6-4F72-9D12-E150DF29E279}.Release|x64.ActiveCfg = Release|x64 + {29FA0962-DDC6-4F72-9D12-E150DF29E279}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/extern/OculusSDK/LibOVRKernel/Projects/Windows/VS2013/LibOVRKernel.vcxproj b/extern/OculusSDK/LibOVRKernel/Projects/Windows/VS2013/LibOVRKernel.vcxproj new file mode 100644 index 0000000..3de5974 --- /dev/null +++ b/extern/OculusSDK/LibOVRKernel/Projects/Windows/VS2013/LibOVRKernel.vcxproj @@ -0,0 +1,638 @@ + + + + + DebugStatic + Win32 + + + DebugStatic + x64 + + + Debug + Win32 + + + Debug + x64 + + + ReleaseStatic + Win32 + + + ReleaseStatic + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + %(Filename) + %(RelativeDir)%(Filename).h + + + %(Filename) + %(RelativeDir)%(Filename).h + + + %(Filename) + %(RelativeDir)%(Filename).h + + + %(Filename) + %(RelativeDir)%(Filename).h + + + %(Filename) + %(RelativeDir)%(Filename).h + + + %(Filename) + %(RelativeDir)%(Filename).h + + + %(Filename) + %(RelativeDir)%(Filename).h + + + %(Filename) + %(RelativeDir)%(Filename).h + + + Pixel + Pixel + Pixel + Pixel + Pixel + Pixel + Pixel + Pixel + + + %(Filename) + %(RelativeDir)%(Filename).h + + + %(Filename) + %(RelativeDir)%(Filename).h + + + %(Filename) + %(RelativeDir)%(Filename).h + + + %(Filename) + %(RelativeDir)%(Filename).h + + + %(Filename) + %(RelativeDir)%(Filename).h + + + %(Filename) + %(RelativeDir)%(Filename).h + + + %(Filename) + %(RelativeDir)%(Filename).h + + + %(Filename) + %(RelativeDir)%(Filename).h + + + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + Vertex + Vertex + Vertex + Vertex + Vertex + Vertex + Vertex + Vertex + + + + {29FA0962-DDC6-4F72-9D12-E150DF29E279} + Win32Proj + LibOVR + LibOVRKernel + + + + StaticLibrary + true + MultiByte + v120 + + + StaticLibrary + true + MultiByte + v120 + + + StaticLibrary + true + MultiByte + v120 + + + StaticLibrary + true + MultiByte + v120 + + + StaticLibrary + false + true + Unicode + v120 + + + StaticLibrary + false + true + Unicode + v120 + + + StaticLibrary + false + true + Unicode + v120 + + + StaticLibrary + false + true + Unicode + v120 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + $(ProjectDir)../../../Lib/Windows/$(Platform)/$(Configuration)/VS2013/ + + + $(ProjectDir)../../../Lib/Windows/$(Platform)/$(Configuration)/VS2013/ + + + $(ProjectDir)../../../Lib/Windows/$(Platform)/$(Configuration)/VS2013/ + + + $(ProjectDir)../../../Lib/Windows/$(Platform)/$(Configuration)/VS2013/ + + + $(ProjectDir)../../../Obj/$(ProjectName)/Windows/$(Platform)/$(Configuration)/VS2013/ + + + $(ProjectDir)../../../Obj/$(ProjectName)/Windows/$(Platform)/$(Configuration)/VS2013/ + + + $(ProjectDir)../../../Obj/$(ProjectName)/Windows/$(Platform)/$(Configuration)/VS2013/ + + + $(ProjectDir)../../../Obj/$(ProjectName)/Windows/$(Platform)/$(Configuration)/VS2013/ + + + LibOVRKernel + + + LibOVRKernel + + + LibOVRKernel + AllRules.ruleset + false + + + LibOVRKernel + AllRules.ruleset + false + + + $(ProjectDir)../../../Lib/Windows/$(Platform)/$(Configuration)/VS2013/ + + + $(ProjectDir)../../../Lib/Windows/$(Platform)/$(Configuration)/VS2013/ + + + $(ProjectDir)../../../Lib/Windows/$(Platform)/$(Configuration)/VS2013/ + + + $(ProjectDir)../../../Lib/Windows/$(Platform)/$(Configuration)/VS2013/ + + + $(ProjectDir)../../../Obj/$(ProjectName)/Windows/$(Platform)/$(Configuration)/VS2013/ + + + $(ProjectDir)../../../Obj/$(ProjectName)/Windows/$(Platform)/$(Configuration)/VS2013/ + + + $(ProjectDir)../../../Obj/$(ProjectName)/Windows/$(Platform)/$(Configuration)/VS2013/ + + + $(ProjectDir)../../../Obj/$(ProjectName)/Windows/$(Platform)/$(Configuration)/VS2013/ + + + LibOVRKernel + + + LibOVRKernel + + + LibOVRKernel + + + LibOVRKernel + + + + + + Level4 + Disabled + WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions); + OldStyle + true + false + true + MultiThreadedDebug + true + SyncCThrow + true + false + $(OVRSDKROOT)LibOVRKernel/Src/;%(AdditionalIncludeDirectories) + /d2Zi+ /we4263 /we4264 /we4265 /we4266 /we4062 %(AdditionalOptions) + + + Windows + true + + + + + + + + Level4 + Disabled + WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions); + OldStyle + true + false + true + MultiThreadedDebug + true + SyncCThrow + true + false + $(OVRSDKROOT)LibOVRKernel/Src/;%(AdditionalIncludeDirectories) + /d2Zi+ /we4263 /we4264 /we4265 /we4266 /we4062 %(AdditionalOptions) + + + Windows + true + + + + + + + + Level4 + Disabled + _WIN64;_DEBUG;_LIB;%(PreprocessorDefinitions); + OldStyle + true + false + true + MultiThreadedDebug + false + false + true + SyncCThrow + true + false + $(OVRSDKROOT)LibOVRKernel/Src/;%(AdditionalIncludeDirectories) + /d2Zi+ /we4263 /we4264 /we4265 /we4266 /we4062 %(AdditionalOptions) + + + Windows + true + + + + + + + + Level4 + Disabled + _WIN64;_DEBUG;_LIB;%(PreprocessorDefinitions); + OldStyle + true + false + true + MultiThreadedDebug + false + false + true + SyncCThrow + true + false + $(OVRSDKROOT)LibOVRKernel/Src/;%(AdditionalIncludeDirectories) + /d2Zi+ /we4263 /we4264 /we4265 /we4266 /we4062 %(AdditionalOptions) + + + Windows + true + + + + + + Level4 + + + Full + true + true + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions); + MultiThreaded + true + true + OldStyle + false + /d2Zi+ /we4263 /we4264 /we4265 /we4266 /we4062 %(AdditionalOptions) + false + false + SyncCThrow + StreamingSIMDExtensions2 + true + AnySuitable + false + $(OVRSDKROOT)LibOVRKernel/Src/;%(AdditionalIncludeDirectories) + + + Windows + true + true + true + + + + + + Level4 + + + Full + true + true + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions); + MultiThreaded + true + true + OldStyle + false + /d2Zi+ /we4263 /we4264 /we4265 /we4266 /we4062 %(AdditionalOptions) + false + false + SyncCThrow + StreamingSIMDExtensions2 + true + AnySuitable + false + $(OVRSDKROOT)LibOVRKernel/Src/;%(AdditionalIncludeDirectories) + + + Windows + true + true + true + + + + + + Level4 + + + Full + true + true + _WIN64;NDEBUG;_LIB;%(PreprocessorDefinitions); + MultiThreaded + true + true + OldStyle + false + /d2Zi+ /we4263 /we4264 /we4265 /we4266 /we4062 %(AdditionalOptions) + false + false + SyncCThrow + NotSet + true + AnySuitable + false + false + $(OVRSDKROOT)LibOVRKernel/Src/;%(AdditionalIncludeDirectories) + + + Windows + true + true + true + + + + + + Level4 + + + Full + true + true + _WIN64;NDEBUG;_LIB;%(PreprocessorDefinitions); + MultiThreaded + true + true + OldStyle + false + /d2Zi+ /we4263 /we4264 /we4265 /we4266 /we4062 %(AdditionalOptions) + false + false + false + NotSet + true + AnySuitable + false + false + $(OVRSDKROOT)LibOVRKernel/Src/;%(AdditionalIncludeDirectories) + + + Windows + true + true + true + + + + + + + \ No newline at end of file diff --git a/extern/OculusSDK/LibOVRKernel/Projects/Windows/VS2013/LibOVRKernel.vcxproj.filters b/extern/OculusSDK/LibOVRKernel/Projects/Windows/VS2013/LibOVRKernel.vcxproj.filters new file mode 100644 index 0000000..f619d3d --- /dev/null +++ b/extern/OculusSDK/LibOVRKernel/Projects/Windows/VS2013/LibOVRKernel.vcxproj.filters @@ -0,0 +1,289 @@ + + + + + {cbd5aacf-597b-4418-bb2d-5cc31c56d320} + + + {9c8f8b78-8c98-4daa-a0be-885ce14ec526} + + + {adfe2ad5-b3f5-4afd-98da-b3ca76652ced} + + + {af8a116e-e692-4597-ba74-77fd10a5276c} + + + {fc456049-35b9-44d7-b53d-a761c67053e8} + + + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + GL + + + GL + + + Util + + + Util + + + Util + + + Util + + + Util + + + Util + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Tracing + + + Tracing + + + Util + + + Util + + + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + GL + + + Util + + + Util + + + Util + + + Util + + + Util + + + Util + + + Kernel + + + Kernel + + + Util + + + Util + + + + + Tracing + + + Tracing + + + Kernel + + + + + Util\Shaders + + + Util\Shaders + + + \ No newline at end of file diff --git a/extern/OculusSDK/LibOVRKernel/Projects/Windows/VS2015/LibOVRKernel.sln b/extern/OculusSDK/LibOVRKernel/Projects/Windows/VS2015/LibOVRKernel.sln new file mode 100644 index 0000000..fc1c467 --- /dev/null +++ b/extern/OculusSDK/LibOVRKernel/Projects/Windows/VS2015/LibOVRKernel.sln @@ -0,0 +1,28 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2013 +VisualStudioVersion = 12.0.31101.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LibOVRKernel", "LibOVRKernel.vcxproj", "{29FA0962-DDC6-4F72-9D12-E150DF29E279}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {29FA0962-DDC6-4F72-9D12-E150DF29E279}.Debug|Win32.ActiveCfg = Debug|Win32 + {29FA0962-DDC6-4F72-9D12-E150DF29E279}.Debug|Win32.Build.0 = Debug|Win32 + {29FA0962-DDC6-4F72-9D12-E150DF29E279}.Debug|x64.ActiveCfg = Debug|x64 + {29FA0962-DDC6-4F72-9D12-E150DF29E279}.Debug|x64.Build.0 = Debug|x64 + {29FA0962-DDC6-4F72-9D12-E150DF29E279}.Release|Win32.ActiveCfg = Release|Win32 + {29FA0962-DDC6-4F72-9D12-E150DF29E279}.Release|Win32.Build.0 = Release|Win32 + {29FA0962-DDC6-4F72-9D12-E150DF29E279}.Release|x64.ActiveCfg = Release|x64 + {29FA0962-DDC6-4F72-9D12-E150DF29E279}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/extern/OculusSDK/LibOVRKernel/Projects/Windows/VS2015/LibOVRKernel.vcxproj b/extern/OculusSDK/LibOVRKernel/Projects/Windows/VS2015/LibOVRKernel.vcxproj new file mode 100644 index 0000000..8530646 --- /dev/null +++ b/extern/OculusSDK/LibOVRKernel/Projects/Windows/VS2015/LibOVRKernel.vcxproj @@ -0,0 +1,638 @@ + + + + + DebugStatic + Win32 + + + DebugStatic + x64 + + + Debug + Win32 + + + Debug + x64 + + + ReleaseStatic + Win32 + + + ReleaseStatic + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + %(Filename) + %(RelativeDir)%(Filename).h + + + %(Filename) + %(RelativeDir)%(Filename).h + + + %(Filename) + %(RelativeDir)%(Filename).h + + + %(Filename) + %(RelativeDir)%(Filename).h + + + %(Filename) + %(RelativeDir)%(Filename).h + + + %(Filename) + %(RelativeDir)%(Filename).h + + + %(Filename) + %(RelativeDir)%(Filename).h + + + %(Filename) + %(RelativeDir)%(Filename).h + + + Pixel + Pixel + Pixel + Pixel + Pixel + Pixel + Pixel + Pixel + + + %(Filename) + %(RelativeDir)%(Filename).h + + + %(Filename) + %(RelativeDir)%(Filename).h + + + %(Filename) + %(RelativeDir)%(Filename).h + + + %(Filename) + %(RelativeDir)%(Filename).h + + + %(Filename) + %(RelativeDir)%(Filename).h + + + %(Filename) + %(RelativeDir)%(Filename).h + + + %(Filename) + %(RelativeDir)%(Filename).h + + + %(Filename) + %(RelativeDir)%(Filename).h + + + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + 4.0 + Vertex + Vertex + Vertex + Vertex + Vertex + Vertex + Vertex + Vertex + + + + {29FA0962-DDC6-4F72-9D12-E150DF29E279} + Win32Proj + LibOVR + LibOVRKernel + + + + StaticLibrary + true + MultiByte + v140 + + + StaticLibrary + true + MultiByte + v140 + + + StaticLibrary + true + MultiByte + v140 + + + StaticLibrary + true + MultiByte + v140 + + + StaticLibrary + false + true + Unicode + v140 + + + StaticLibrary + false + true + Unicode + v140 + + + StaticLibrary + false + true + Unicode + v140 + + + StaticLibrary + false + true + Unicode + v140 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + $(ProjectDir)../../../Lib/Windows/$(Platform)/$(Configuration)/VS2015/ + + + $(ProjectDir)../../../Lib/Windows/$(Platform)/$(Configuration)/VS2015/ + + + $(ProjectDir)../../../Lib/Windows/$(Platform)/$(Configuration)/VS2015/ + + + $(ProjectDir)../../../Lib/Windows/$(Platform)/$(Configuration)/VS2015/ + + + $(ProjectDir)../../../Obj/$(ProjectName)/Windows/$(Platform)/$(Configuration)/VS2015/ + + + $(ProjectDir)../../../Obj/$(ProjectName)/Windows/$(Platform)/$(Configuration)/VS2015/ + + + $(ProjectDir)../../../Obj/$(ProjectName)/Windows/$(Platform)/$(Configuration)/VS2015/ + + + $(ProjectDir)../../../Obj/$(ProjectName)/Windows/$(Platform)/$(Configuration)/VS2015/ + + + LibOVRKernel + + + LibOVRKernel + + + LibOVRKernel + AllRules.ruleset + false + + + LibOVRKernel + AllRules.ruleset + false + + + $(ProjectDir)../../../Lib/Windows/$(Platform)/$(Configuration)/VS2015/ + + + $(ProjectDir)../../../Lib/Windows/$(Platform)/$(Configuration)/VS2015/ + + + $(ProjectDir)../../../Lib/Windows/$(Platform)/$(Configuration)/VS2015/ + + + $(ProjectDir)../../../Lib/Windows/$(Platform)/$(Configuration)/VS2015/ + + + $(ProjectDir)../../../Obj/$(ProjectName)/Windows/$(Platform)/$(Configuration)/VS2015/ + + + $(ProjectDir)../../../Obj/$(ProjectName)/Windows/$(Platform)/$(Configuration)/VS2015/ + + + $(ProjectDir)../../../Obj/$(ProjectName)/Windows/$(Platform)/$(Configuration)/VS2015/ + + + $(ProjectDir)../../../Obj/$(ProjectName)/Windows/$(Platform)/$(Configuration)/VS2015/ + + + LibOVRKernel + + + LibOVRKernel + + + LibOVRKernel + + + LibOVRKernel + + + + + + Level4 + Disabled + WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions); + OldStyle + true + false + true + MultiThreadedDebug + true + SyncCThrow + true + false + $(OVRSDKROOT)LibOVRKernel/Src/;%(AdditionalIncludeDirectories) + /d2Zi+ /we4263 /we4264 /we4265 /we4266 /we4062 %(AdditionalOptions) + + + Windows + true + + + + + + + + Level4 + Disabled + WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions); + OldStyle + true + false + true + MultiThreadedDebug + true + SyncCThrow + true + false + $(OVRSDKROOT)LibOVRKernel/Src/;%(AdditionalIncludeDirectories) + /d2Zi+ /we4263 /we4264 /we4265 /we4266 /we4062 %(AdditionalOptions) + + + Windows + true + + + + + + + + Level4 + Disabled + _WIN64;_DEBUG;_LIB;%(PreprocessorDefinitions); + OldStyle + true + false + true + MultiThreadedDebug + false + false + true + SyncCThrow + true + false + $(OVRSDKROOT)LibOVRKernel/Src/;%(AdditionalIncludeDirectories) + /d2Zi+ /we4263 /we4264 /we4265 /we4266 /we4062 %(AdditionalOptions) + + + Windows + true + + + + + + + + Level4 + Disabled + _WIN64;_DEBUG;_LIB;%(PreprocessorDefinitions); + OldStyle + true + false + true + MultiThreadedDebug + false + false + true + SyncCThrow + true + false + $(OVRSDKROOT)LibOVRKernel/Src/;%(AdditionalIncludeDirectories) + /d2Zi+ /we4263 /we4264 /we4265 /we4266 /we4062 %(AdditionalOptions) + + + Windows + true + + + + + + Level4 + + + Full + true + true + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions); + MultiThreaded + true + true + OldStyle + false + /d2Zi+ /we4263 /we4264 /we4265 /we4266 /we4062 %(AdditionalOptions) + false + false + SyncCThrow + StreamingSIMDExtensions2 + true + AnySuitable + false + $(OVRSDKROOT)LibOVRKernel/Src/;%(AdditionalIncludeDirectories) + + + Windows + true + true + true + + + + + + Level4 + + + Full + true + true + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions); + MultiThreaded + true + true + OldStyle + false + /d2Zi+ /we4263 /we4264 /we4265 /we4266 /we4062 %(AdditionalOptions) + false + false + SyncCThrow + StreamingSIMDExtensions2 + true + AnySuitable + false + $(OVRSDKROOT)LibOVRKernel/Src/;%(AdditionalIncludeDirectories) + + + Windows + true + true + true + + + + + + Level4 + + + Full + true + true + _WIN64;NDEBUG;_LIB;%(PreprocessorDefinitions); + MultiThreaded + true + true + OldStyle + false + /d2Zi+ /we4263 /we4264 /we4265 /we4266 /we4062 %(AdditionalOptions) + false + false + SyncCThrow + NotSet + true + AnySuitable + false + false + $(OVRSDKROOT)LibOVRKernel/Src/;%(AdditionalIncludeDirectories) + + + Windows + true + true + true + + + + + + Level4 + + + Full + true + true + _WIN64;NDEBUG;_LIB;%(PreprocessorDefinitions); + MultiThreaded + true + true + OldStyle + false + /d2Zi+ /we4263 /we4264 /we4265 /we4266 /we4062 %(AdditionalOptions) + false + false + false + NotSet + true + AnySuitable + false + false + $(OVRSDKROOT)LibOVRKernel/Src/;%(AdditionalIncludeDirectories) + + + Windows + true + true + true + + + + + + + \ No newline at end of file diff --git a/extern/OculusSDK/LibOVRKernel/Projects/Windows/VS2015/LibOVRKernel.vcxproj.filters b/extern/OculusSDK/LibOVRKernel/Projects/Windows/VS2015/LibOVRKernel.vcxproj.filters new file mode 100644 index 0000000..f619d3d --- /dev/null +++ b/extern/OculusSDK/LibOVRKernel/Projects/Windows/VS2015/LibOVRKernel.vcxproj.filters @@ -0,0 +1,289 @@ + + + + + {cbd5aacf-597b-4418-bb2d-5cc31c56d320} + + + {9c8f8b78-8c98-4daa-a0be-885ce14ec526} + + + {adfe2ad5-b3f5-4afd-98da-b3ca76652ced} + + + {af8a116e-e692-4597-ba74-77fd10a5276c} + + + {fc456049-35b9-44d7-b53d-a761c67053e8} + + + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + GL + + + GL + + + Util + + + Util + + + Util + + + Util + + + Util + + + Util + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Tracing + + + Tracing + + + Util + + + Util + + + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + Kernel + + + GL + + + Util + + + Util + + + Util + + + Util + + + Util + + + Util + + + Kernel + + + Kernel + + + Util + + + Util + + + + + Tracing + + + Tracing + + + Kernel + + + + + Util\Shaders + + + Util\Shaders + + + \ No newline at end of file diff --git a/extern/OculusSDK/LibOVRKernel/Src/GL/CAPI_GLE.cpp b/extern/OculusSDK/LibOVRKernel/Src/GL/CAPI_GLE.cpp new file mode 100644 index 0000000..9a36b26 --- /dev/null +++ b/extern/OculusSDK/LibOVRKernel/Src/GL/CAPI_GLE.cpp @@ -0,0 +1,7988 @@ +/************************************************************************************ + +Filename : Render_GLE.cpp +Content : OpenGL Extensions support. Implements a stripped down glew-like + interface with some additional functionality. +Copyright : Copyright 2014 Oculus VR, LLC All Rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +************************************************************************************/ + +#include "CAPI_GLE.h" +#include "Kernel/OVR_Log.h" +#if defined(OVR_OS_WIN32) + #include "Kernel/OVR_Win32_IncludeWindows.h" +#endif // OVR_OS_WIN32 +#include + +#ifdef OVR_BUILD_DEBUG + #include "Kernel/OVR_String.h" +#endif // OVR_BUILD_DEBUG + +#if defined(_WIN32) + #pragma comment(lib, "opengl32.lib") +#elif defined(__APPLE__) + #include + #include + #include + #include +#endif + + + +//namespace OVR +//{ + // OVRTypeof + // Acts the same as the C++11 decltype expression, though with reduced requirements. + #if !defined(OVRTypeof) + #if defined(_MSC_VER) + #define OVRTypeof(x) decltype(x) // VS2010+ unilaterally supports decltype + #else + #define OVRTypeof(x) __typeof__(x) // Other compilers support decltype, but usually not unless C++11 support is present and explicitly enabled. + #endif + #endif + + + // GLELoadProc + // Macro which implements dynamically looking up and assigning an OpenGL function. + // + // Example usage: + // GLELoadProc(glCopyTexSubImage3D, glCopyTexSubImage3D); + // Expands to: + // gleCopyTexSubImage3D = (OVRTypeof(gleCopyTexSubImage3D)) GLEGetProcAddress("glCopyTexSubImage3D"); + + #define GLELoadProc(var, name) var = (OVRTypeof(var))GLEGetProcAddress(#name) + + + // Disable some #defines, as we need to call these functions directly. + #if defined(GLE_HOOKING_ENABLED) + #if defined(_WIN32) + #undef wglGetProcAddress + extern "C" { GLAPI PROC GLAPIENTRY wglGetProcAddress(LPCSTR lpszProc); } + #endif + + #undef glGetString + extern "C" { GLAPI const GLubyte * GLAPIENTRY glGetString(GLenum name); } + #endif + + + // Generic OpenGL GetProcAddress function interface. Maps to platform-specific functionality + // internally. On Windows this is equivalent to wglGetProcAddress as opposed to global GetProcAddress. + void* OVR::GLEGetProcAddress(const char* name) + { + #if defined(_WIN32) + return wglGetProcAddress(name); + + #elif defined(__APPLE__) + // Requires the OS 10.3 SDK or later. + static void* dlImage = NULL; + void* addr = nullptr; + + if(!dlImage) + dlImage = dlopen("/System/Library/Frameworks/OpenGL.framework/Versions/Current/OpenGL", RTLD_LAZY); + + if(dlImage) + addr = dlsym(dlImage, name); + + return addr; + + #elif defined(__ANDROID__) + return eglGetProcAddress(name); + + #else + // This was glXGetProcAddressARB in GLX versions prior to v1.4, but that was ten years ago. + return (void*)glXGetProcAddress((const GLubyte*)name); + #endif + } + + + + // Current context functionality + static OVR::GLEContext* GLECurrentContext = NULL; + + OVR::GLEContext* OVR::GLEContext::GetCurrentContext() + { + return GLECurrentContext; + } + + void OVR::GLEContext::SetCurrentContext(OVR::GLEContext* p) + { + GLECurrentContext = p; + } + + + + OVR::GLEContext::GLEContext() + : MajorVersion(0) + , MinorVersion(0) + , WholeVersion(0) + , IsGLES(false) + , IsCoreProfile(false) + , EnableHookGetError(true) + , PlatformMajorVersion(0) + , PlatformMinorVersion(0) + , PlatformWholeVersion(0) + { + // The following sequence is not thread-safe. Two threads could set the context to this at the same time. + if(GetCurrentContext() == NULL) + SetCurrentContext(this); + } + + + OVR::GLEContext::~GLEContext() + { + // Currently empty + } + + + void OVR::GLEContext::Init() + { + PlatformInit(); + + if(!IsInitialized()) + { + InitVersion(); + InitExtensionLoad(); + InitExtensionSupport(); + } + } + + + bool OVR::GLEContext::IsInitialized() const + { + return (MajorVersion != 0); + } + + + void OVR::GLEContext::Shutdown() + { + // This memset is valid only if this class has no virtual functions (similar to concept of POD). + // We cannot assert this because restrictions prevent us from using C++11 type traits here. + memset(this, 0, sizeof(GLEContext)); + } + + + void OVR::GLEContext::PlatformInit() + { + if(!IsPlatformInitialized()) + { + InitPlatformExtensionLoad(); + InitPlatformExtensionSupport(); + InitPlatformVersion(); + } + } + + + bool OVR::GLEContext::IsPlatformInitialized() const + { + return (PlatformMajorVersion != 0); + } + + + void OVR::GLEContext::InitVersion() + { + const char* version = (const char*)glGetString(GL_VERSION); + int fields = 0, major = 0, minor = 0; + bool isGLES = false; + + OVR_ASSERT(version); + if (version) + { + OVR_DEBUG_LOG(("GL_VERSION: %s", (const char*)version)); + + // Skip all leading non-digits before reading %d. + // Example GL_VERSION strings: + // "1.5 ATI-1.4.18" + // "OpenGL ES-CM 3.2" + OVR_DISABLE_MSVC_WARNING(4996) // "scanf may be unsafe" + fields = sscanf(version, isdigit(*version) ? "%d.%d" : "%*[^0-9]%d.%d", &major, &minor); + isGLES = (strstr(version, "OpenGL ES") != NULL); + OVR_RESTORE_MSVC_WARNING() + } + else + { + LogText("Warning: GL_VERSION was NULL\n"); + } + + // If two fields were not found, + if (fields != 2) + { + static_assert(sizeof(major) == sizeof(GLint), "type mis-match"); + + glGetIntegerv(GL_MAJOR_VERSION, &major); + glGetIntegerv(GL_MINOR_VERSION, &minor); + } + + // Write version data + MajorVersion = major; + MinorVersion = minor; + WholeVersion = (major * 100) + minor; + + GLint profileMask = 0; + if(WholeVersion >= 302) + { + // Older NVidia drivers have a bug with this on at least Windows. + // https://www.opengl.org/discussion_boards/showthread.php/171380-NVIDIA-drivers-not-returning-the-right-profile-mas + // A workaround could be to check for the GL_ARB_compatibility extension, which indicates if OpenGL is in compatibility mode, + // and if not then we are in core profile mode. On Apple another solution would be to use NSOpeNGLPixelFormat + // NSOpenGLView::pixelFormat to get the core profile attribute. + glGetIntegerv(GL_CONTEXT_PROFILE_MASK, &profileMask); + } + IsCoreProfile = (profileMask == GL_CONTEXT_CORE_PROFILE_BIT); // There's also GL_CONTEXT_COMPATIBILITY_PROFILE_BIT + IsGLES = isGLES; + } + + + void OVR::GLEContext::InitExtensionLoad() + { + // GL_VERSION_1_1 + // We don't load these but rather link to them directly. + + // GL_VERSION_1_2 + GLELoadProc(glCopyTexSubImage3D_Impl, glCopyTexSubImage3D); // This expands to a get proc address call (e.g. wglGetProcAddress on Windows). + GLELoadProc(glDrawRangeElements_Impl, glDrawRangeElements); + GLELoadProc(glTexImage3D_Impl, glTexImage3D); + GLELoadProc(glTexSubImage3D_Impl, glTexSubImage3D); + + // GL_VERSION_1_3 + GLELoadProc(glActiveTexture_Impl, glActiveTexture); + GLELoadProc(glClientActiveTexture_Impl, glClientActiveTexture); + GLELoadProc(glCompressedTexImage1D_Impl, glCompressedTexImage1D); + GLELoadProc(glCompressedTexImage2D_Impl, glCompressedTexImage2D); + GLELoadProc(glCompressedTexImage3D_Impl, glCompressedTexImage3D); + GLELoadProc(glCompressedTexSubImage1D_Impl, glCompressedTexSubImage1D); + GLELoadProc(glCompressedTexSubImage2D_Impl, glCompressedTexSubImage2D); + GLELoadProc(glCompressedTexSubImage3D_Impl, glCompressedTexSubImage3D); + GLELoadProc(glGetCompressedTexImage_Impl, glGetCompressedTexImage); + GLELoadProc(glLoadTransposeMatrixd_Impl, glLoadTransposeMatrixd); + GLELoadProc(glLoadTransposeMatrixf_Impl, glLoadTransposeMatrixf); + GLELoadProc(glMultTransposeMatrixd_Impl, glMultTransposeMatrixd); + GLELoadProc(glMultTransposeMatrixf_Impl, glMultTransposeMatrixf); + GLELoadProc(glMultiTexCoord1d_Impl, glMultiTexCoord1d); + GLELoadProc(glMultiTexCoord1dv_Impl, glMultiTexCoord1dv); + GLELoadProc(glMultiTexCoord1f_Impl, glMultiTexCoord1f); + GLELoadProc(glMultiTexCoord1fv_Impl, glMultiTexCoord1fv); + GLELoadProc(glMultiTexCoord1i_Impl, glMultiTexCoord1i); + GLELoadProc(glMultiTexCoord1iv_Impl, glMultiTexCoord1iv); + GLELoadProc(glMultiTexCoord1s_Impl, glMultiTexCoord1s); + GLELoadProc(glMultiTexCoord1sv_Impl, glMultiTexCoord1sv); + GLELoadProc(glMultiTexCoord2d_Impl, glMultiTexCoord2d); + GLELoadProc(glMultiTexCoord2dv_Impl, glMultiTexCoord2dv); + GLELoadProc(glMultiTexCoord2f_Impl, glMultiTexCoord2f); + GLELoadProc(glMultiTexCoord2fv_Impl, glMultiTexCoord2fv); + GLELoadProc(glMultiTexCoord2i_Impl, glMultiTexCoord2i); + GLELoadProc(glMultiTexCoord2iv_Impl, glMultiTexCoord2iv); + GLELoadProc(glMultiTexCoord2s_Impl, glMultiTexCoord2s); + GLELoadProc(glMultiTexCoord2sv_Impl, glMultiTexCoord2sv); + GLELoadProc(glMultiTexCoord3d_Impl, glMultiTexCoord3d); + GLELoadProc(glMultiTexCoord3dv_Impl, glMultiTexCoord3dv); + GLELoadProc(glMultiTexCoord3f_Impl, glMultiTexCoord3f); + GLELoadProc(glMultiTexCoord3fv_Impl, glMultiTexCoord3fv); + GLELoadProc(glMultiTexCoord3i_Impl, glMultiTexCoord3i); + GLELoadProc(glMultiTexCoord3iv_Impl, glMultiTexCoord3iv); + GLELoadProc(glMultiTexCoord3s_Impl, glMultiTexCoord3s); + GLELoadProc(glMultiTexCoord3sv_Impl, glMultiTexCoord3sv); + GLELoadProc(glMultiTexCoord4d_Impl, glMultiTexCoord4d); + GLELoadProc(glMultiTexCoord4dv_Impl, glMultiTexCoord4dv); + GLELoadProc(glMultiTexCoord4f_Impl, glMultiTexCoord4f); + GLELoadProc(glMultiTexCoord4fv_Impl, glMultiTexCoord4fv); + GLELoadProc(glMultiTexCoord4i_Impl, glMultiTexCoord4i); + GLELoadProc(glMultiTexCoord4iv_Impl, glMultiTexCoord4iv); + GLELoadProc(glMultiTexCoord4s_Impl, glMultiTexCoord4s); + GLELoadProc(glMultiTexCoord4sv_Impl, glMultiTexCoord4sv); + GLELoadProc(glSampleCoverage_Impl, glSampleCoverage); + + // GL_VERSION_1_4 + GLELoadProc(glBlendColor_Impl, glBlendColor); + GLELoadProc(glBlendEquation_Impl, glBlendEquation); + GLELoadProc(glBlendFuncSeparate_Impl, glBlendFuncSeparate); + GLELoadProc(glFogCoordPointer_Impl, glFogCoordPointer); + GLELoadProc(glFogCoordd_Impl, glFogCoordd); + GLELoadProc(glFogCoorddv_Impl, glFogCoorddv); + GLELoadProc(glFogCoordf_Impl, glFogCoordf); + GLELoadProc(glFogCoordfv_Impl, glFogCoordfv); + GLELoadProc(glMultiDrawArrays_Impl, glMultiDrawArrays); + GLELoadProc(glMultiDrawElements_Impl, glMultiDrawElements); + GLELoadProc(glPointParameterf_Impl, glPointParameterf); + GLELoadProc(glPointParameterfv_Impl, glPointParameterfv); + GLELoadProc(glPointParameteri_Impl, glPointParameteri); + GLELoadProc(glPointParameteriv_Impl, glPointParameteriv); + GLELoadProc(glSecondaryColor3b_Impl, glSecondaryColor3b); + GLELoadProc(glSecondaryColor3bv_Impl, glSecondaryColor3bv); + GLELoadProc(glSecondaryColor3d_Impl, glSecondaryColor3d); + GLELoadProc(glSecondaryColor3dv_Impl, glSecondaryColor3dv); + GLELoadProc(glSecondaryColor3f_Impl, glSecondaryColor3f); + GLELoadProc(glSecondaryColor3fv_Impl, glSecondaryColor3fv); + GLELoadProc(glSecondaryColor3i_Impl, glSecondaryColor3i); + GLELoadProc(glSecondaryColor3iv_Impl, glSecondaryColor3iv); + GLELoadProc(glSecondaryColor3s_Impl, glSecondaryColor3s); + GLELoadProc(glSecondaryColor3sv_Impl, glSecondaryColor3sv); + GLELoadProc(glSecondaryColor3ub_Impl, glSecondaryColor3ub); + GLELoadProc(glSecondaryColor3ubv_Impl, glSecondaryColor3ubv); + GLELoadProc(glSecondaryColor3ui_Impl, glSecondaryColor3ui); + GLELoadProc(glSecondaryColor3uiv_Impl, glSecondaryColor3uiv); + GLELoadProc(glSecondaryColor3us_Impl, glSecondaryColor3us); + GLELoadProc(glSecondaryColor3usv_Impl, glSecondaryColor3usv); + GLELoadProc(glSecondaryColorPointer_Impl, glSecondaryColorPointer); + GLELoadProc(glWindowPos2d_Impl, glWindowPos2d); + GLELoadProc(glWindowPos2dv_Impl, glWindowPos2dv); + GLELoadProc(glWindowPos2f_Impl, glWindowPos2f); + GLELoadProc(glWindowPos2fv_Impl, glWindowPos2fv); + GLELoadProc(glWindowPos2i_Impl, glWindowPos2i); + GLELoadProc(glWindowPos2iv_Impl, glWindowPos2iv); + GLELoadProc(glWindowPos2s_Impl, glWindowPos2s); + GLELoadProc(glWindowPos2sv_Impl, glWindowPos2sv); + GLELoadProc(glWindowPos3d_Impl, glWindowPos3d); + GLELoadProc(glWindowPos3dv_Impl, glWindowPos3dv); + GLELoadProc(glWindowPos3f_Impl, glWindowPos3f); + GLELoadProc(glWindowPos3fv_Impl, glWindowPos3fv); + GLELoadProc(glWindowPos3i_Impl, glWindowPos3i); + GLELoadProc(glWindowPos3iv_Impl, glWindowPos3iv); + GLELoadProc(glWindowPos3s_Impl, glWindowPos3s); + GLELoadProc(glWindowPos3sv_Impl, glWindowPos3sv); + + // GL_VERSION_1_5 + GLELoadProc(glBeginQuery_Impl, glBeginQuery); + GLELoadProc(glBindBuffer_Impl, glBindBuffer); + GLELoadProc(glBufferData_Impl, glBufferData); + GLELoadProc(glBufferSubData_Impl, glBufferSubData); + GLELoadProc(glDeleteBuffers_Impl, glDeleteBuffers); + GLELoadProc(glDeleteQueries_Impl, glDeleteQueries); + GLELoadProc(glEndQuery_Impl, glEndQuery); + GLELoadProc(glGenBuffers_Impl, glGenBuffers); + GLELoadProc(glGenQueries_Impl, glGenQueries); + GLELoadProc(glGetBufferParameteriv_Impl, glGetBufferParameteriv); + GLELoadProc(glGetBufferPointerv_Impl, glGetBufferPointerv); + GLELoadProc(glGetBufferSubData_Impl, glGetBufferSubData); + GLELoadProc(glGetQueryObjectiv_Impl, glGetQueryObjectiv); + GLELoadProc(glGetQueryObjectuiv_Impl, glGetQueryObjectuiv); + GLELoadProc(glGetQueryiv_Impl, glGetQueryiv); + GLELoadProc(glIsBuffer_Impl, glIsBuffer); + GLELoadProc(glIsQuery_Impl, glIsQuery); + GLELoadProc(glMapBuffer_Impl, glMapBuffer); + GLELoadProc(glUnmapBuffer_Impl, glUnmapBuffer); + + // GL_VERSION_2_0 + GLELoadProc(glAttachShader_Impl, glAttachShader); + GLELoadProc(glBindAttribLocation_Impl, glBindAttribLocation); + GLELoadProc(glBlendEquationSeparate_Impl, glBlendEquationSeparate); + GLELoadProc(glCompileShader_Impl, glCompileShader); + GLELoadProc(glCreateProgram_Impl, glCreateProgram); + GLELoadProc(glCreateShader_Impl, glCreateShader); + GLELoadProc(glDeleteProgram_Impl, glDeleteProgram); + GLELoadProc(glDeleteShader_Impl, glDeleteShader); + GLELoadProc(glDetachShader_Impl, glDetachShader); + GLELoadProc(glDisableVertexAttribArray_Impl, glDisableVertexAttribArray); + GLELoadProc(glDrawBuffers_Impl, glDrawBuffers); + GLELoadProc(glEnableVertexAttribArray_Impl, glEnableVertexAttribArray); + GLELoadProc(glGetActiveAttrib_Impl, glGetActiveAttrib); + GLELoadProc(glGetActiveUniform_Impl, glGetActiveUniform); + GLELoadProc(glGetAttachedShaders_Impl, glGetAttachedShaders); + GLELoadProc(glGetAttribLocation_Impl, glGetAttribLocation); + GLELoadProc(glGetProgramInfoLog_Impl, glGetProgramInfoLog); + GLELoadProc(glGetProgramiv_Impl, glGetProgramiv); + GLELoadProc(glGetShaderInfoLog_Impl, glGetShaderInfoLog); + GLELoadProc(glGetShaderSource_Impl, glGetShaderSource); + GLELoadProc(glGetShaderiv_Impl, glGetShaderiv); + GLELoadProc(glGetUniformLocation_Impl, glGetUniformLocation); + GLELoadProc(glGetUniformfv_Impl, glGetUniformfv); + GLELoadProc(glGetUniformiv_Impl, glGetUniformiv); + GLELoadProc(glGetVertexAttribPointerv_Impl, glGetVertexAttribPointerv); + GLELoadProc(glGetVertexAttribdv_Impl, glGetVertexAttribdv); + GLELoadProc(glGetVertexAttribfv_Impl, glGetVertexAttribfv); + GLELoadProc(glGetVertexAttribiv_Impl, glGetVertexAttribiv); + GLELoadProc(glIsProgram_Impl, glIsProgram); + GLELoadProc(glIsShader_Impl, glIsShader); + GLELoadProc(glLinkProgram_Impl, glLinkProgram); + GLELoadProc(glShaderSource_Impl, glShaderSource); + GLELoadProc(glStencilFuncSeparate_Impl, glStencilFuncSeparate); + GLELoadProc(glStencilMaskSeparate_Impl, glStencilMaskSeparate); + GLELoadProc(glStencilOpSeparate_Impl, glStencilOpSeparate); + GLELoadProc(glUniform1f_Impl, glUniform1f); + GLELoadProc(glUniform1fv_Impl, glUniform1fv); + GLELoadProc(glUniform1i_Impl, glUniform1i); + GLELoadProc(glUniform1iv_Impl, glUniform1iv); + GLELoadProc(glUniform2f_Impl, glUniform2f); + GLELoadProc(glUniform2fv_Impl, glUniform2fv); + GLELoadProc(glUniform2i_Impl, glUniform2i); + GLELoadProc(glUniform2iv_Impl, glUniform2iv); + GLELoadProc(glUniform3f_Impl, glUniform3f); + GLELoadProc(glUniform3fv_Impl, glUniform3fv); + GLELoadProc(glUniform3i_Impl, glUniform3i); + GLELoadProc(glUniform3iv_Impl, glUniform3iv); + GLELoadProc(glUniform4f_Impl, glUniform4f); + GLELoadProc(glUniform4fv_Impl, glUniform4fv); + GLELoadProc(glUniform4i_Impl, glUniform4i); + GLELoadProc(glUniform4iv_Impl, glUniform4iv); + GLELoadProc(glUniformMatrix2fv_Impl, glUniformMatrix2fv); + GLELoadProc(glUniformMatrix3fv_Impl, glUniformMatrix3fv); + GLELoadProc(glUniformMatrix4fv_Impl, glUniformMatrix4fv); + GLELoadProc(glUseProgram_Impl, glUseProgram); + GLELoadProc(glValidateProgram_Impl, glValidateProgram); + GLELoadProc(glVertexAttrib1d_Impl, glVertexAttrib1d); + GLELoadProc(glVertexAttrib1dv_Impl, glVertexAttrib1dv); + GLELoadProc(glVertexAttrib1f_Impl, glVertexAttrib1f); + GLELoadProc(glVertexAttrib1fv_Impl, glVertexAttrib1fv); + GLELoadProc(glVertexAttrib1s_Impl, glVertexAttrib1s); + GLELoadProc(glVertexAttrib1sv_Impl, glVertexAttrib1sv); + GLELoadProc(glVertexAttrib2d_Impl, glVertexAttrib2d); + GLELoadProc(glVertexAttrib2dv_Impl, glVertexAttrib2dv); + GLELoadProc(glVertexAttrib2f_Impl, glVertexAttrib2f); + GLELoadProc(glVertexAttrib2fv_Impl, glVertexAttrib2fv); + GLELoadProc(glVertexAttrib2s_Impl, glVertexAttrib2s); + GLELoadProc(glVertexAttrib2sv_Impl, glVertexAttrib2sv); + GLELoadProc(glVertexAttrib3d_Impl, glVertexAttrib3d); + GLELoadProc(glVertexAttrib3dv_Impl, glVertexAttrib3dv); + GLELoadProc(glVertexAttrib3f_Impl, glVertexAttrib3f); + GLELoadProc(glVertexAttrib3fv_Impl, glVertexAttrib3fv); + GLELoadProc(glVertexAttrib3s_Impl, glVertexAttrib3s); + GLELoadProc(glVertexAttrib3sv_Impl, glVertexAttrib3sv); + GLELoadProc(glVertexAttrib4Nbv_Impl, glVertexAttrib4Nbv); + GLELoadProc(glVertexAttrib4Niv_Impl, glVertexAttrib4Niv); + GLELoadProc(glVertexAttrib4Nsv_Impl, glVertexAttrib4Nsv); + GLELoadProc(glVertexAttrib4Nub_Impl, glVertexAttrib4Nub); + GLELoadProc(glVertexAttrib4Nubv_Impl, glVertexAttrib4Nubv); + GLELoadProc(glVertexAttrib4Nuiv_Impl, glVertexAttrib4Nuiv); + GLELoadProc(glVertexAttrib4Nusv_Impl, glVertexAttrib4Nusv); + GLELoadProc(glVertexAttrib4bv_Impl, glVertexAttrib4bv); + GLELoadProc(glVertexAttrib4d_Impl, glVertexAttrib4d); + GLELoadProc(glVertexAttrib4dv_Impl, glVertexAttrib4dv); + GLELoadProc(glVertexAttrib4f_Impl, glVertexAttrib4f); + GLELoadProc(glVertexAttrib4fv_Impl, glVertexAttrib4fv); + GLELoadProc(glVertexAttrib4iv_Impl, glVertexAttrib4iv); + GLELoadProc(glVertexAttrib4s_Impl, glVertexAttrib4s); + GLELoadProc(glVertexAttrib4sv_Impl, glVertexAttrib4sv); + GLELoadProc(glVertexAttrib4ubv_Impl, glVertexAttrib4ubv); + GLELoadProc(glVertexAttrib4uiv_Impl, glVertexAttrib4uiv); + GLELoadProc(glVertexAttrib4usv_Impl, glVertexAttrib4usv); + GLELoadProc(glVertexAttribPointer_Impl, glVertexAttribPointer); + + // GL_VERSION_2_1 + GLELoadProc(glUniformMatrix2x3fv_Impl, glUniformMatrix2x3fv); + GLELoadProc(glUniformMatrix2x4fv_Impl, glUniformMatrix2x4fv); + GLELoadProc(glUniformMatrix3x2fv_Impl, glUniformMatrix3x2fv); + GLELoadProc(glUniformMatrix3x4fv_Impl, glUniformMatrix3x4fv); + GLELoadProc(glUniformMatrix4x2fv_Impl, glUniformMatrix4x2fv); + GLELoadProc(glUniformMatrix4x3fv_Impl, glUniformMatrix4x3fv); + + // GL_VERSION_3_0 + GLELoadProc(glBeginConditionalRender_Impl, glBeginConditionalRender); + GLELoadProc(glBeginTransformFeedback_Impl, glBeginTransformFeedback); + GLELoadProc(glBindFragDataLocation_Impl, glBindFragDataLocation); + GLELoadProc(glClampColor_Impl, glClampColor); + GLELoadProc(glClearBufferfi_Impl, glClearBufferfi); + GLELoadProc(glClearBufferfv_Impl, glClearBufferfv); + GLELoadProc(glClearBufferiv_Impl, glClearBufferiv); + GLELoadProc(glClearBufferuiv_Impl, glClearBufferuiv); + GLELoadProc(glColorMaski_Impl, glColorMaski); + GLELoadProc(glDisablei_Impl, glDisablei); + GLELoadProc(glEnablei_Impl, glEnablei); + GLELoadProc(glEndConditionalRender_Impl, glEndConditionalRender); + GLELoadProc(glEndTransformFeedback_Impl, glEndTransformFeedback); + GLELoadProc(glBindBufferRange_Impl, glBindBufferRange); + GLELoadProc(glBindBufferBase_Impl, glBindBufferBase); + GLELoadProc(glGetBooleani_v_Impl, glGetBooleani_v); + GLELoadProc(glGetIntegeri_v_Impl, glGetIntegeri_v); + GLELoadProc(glGetFragDataLocation_Impl, glGetFragDataLocation); + GLELoadProc(glGetStringi_Impl, glGetStringi); + GLELoadProc(glGetTexParameterIiv_Impl, glGetTexParameterIiv); + GLELoadProc(glGetTexParameterIuiv_Impl, glGetTexParameterIuiv); + GLELoadProc(glGetTransformFeedbackVarying_Impl, glGetTransformFeedbackVarying); + GLELoadProc(glGetUniformuiv_Impl, glGetUniformuiv); + GLELoadProc(glGetVertexAttribIiv_Impl, glGetVertexAttribIiv); + GLELoadProc(glGetVertexAttribIuiv_Impl, glGetVertexAttribIuiv); + GLELoadProc(glIsEnabledi_Impl, glIsEnabledi); + GLELoadProc(glTexParameterIiv_Impl, glTexParameterIiv); + GLELoadProc(glTexParameterIuiv_Impl, glTexParameterIuiv); + GLELoadProc(glTransformFeedbackVaryings_Impl, glTransformFeedbackVaryings); + GLELoadProc(glUniform1ui_Impl, glUniform1ui); + GLELoadProc(glUniform1uiv_Impl, glUniform1uiv); + GLELoadProc(glUniform2ui_Impl, glUniform2ui); + GLELoadProc(glUniform2uiv_Impl, glUniform2uiv); + GLELoadProc(glUniform3ui_Impl, glUniform3ui); + GLELoadProc(glUniform3uiv_Impl, glUniform3uiv); + GLELoadProc(glUniform4ui_Impl, glUniform4ui); + GLELoadProc(glUniform4uiv_Impl, glUniform4uiv); + GLELoadProc(glVertexAttribI1i_Impl, glVertexAttribI1i); + GLELoadProc(glVertexAttribI1iv_Impl, glVertexAttribI1iv); + GLELoadProc(glVertexAttribI1ui_Impl, glVertexAttribI1ui); + GLELoadProc(glVertexAttribI1uiv_Impl, glVertexAttribI1uiv); + GLELoadProc(glVertexAttribI2i_Impl, glVertexAttribI2i); + GLELoadProc(glVertexAttribI2iv_Impl, glVertexAttribI2iv); + GLELoadProc(glVertexAttribI2ui_Impl, glVertexAttribI2ui); + GLELoadProc(glVertexAttribI2uiv_Impl, glVertexAttribI2uiv); + GLELoadProc(glVertexAttribI3i_Impl, glVertexAttribI3i); + GLELoadProc(glVertexAttribI3iv_Impl, glVertexAttribI3iv); + GLELoadProc(glVertexAttribI3ui_Impl, glVertexAttribI3ui); + GLELoadProc(glVertexAttribI3uiv_Impl, glVertexAttribI3uiv); + GLELoadProc(glVertexAttribI4bv_Impl, glVertexAttribI4bv); + GLELoadProc(glVertexAttribI4i_Impl, glVertexAttribI4i); + GLELoadProc(glVertexAttribI4iv_Impl, glVertexAttribI4iv); + GLELoadProc(glVertexAttribI4sv_Impl, glVertexAttribI4sv); + GLELoadProc(glVertexAttribI4ubv_Impl, glVertexAttribI4ubv); + GLELoadProc(glVertexAttribI4ui_Impl, glVertexAttribI4ui); + GLELoadProc(glVertexAttribI4uiv_Impl, glVertexAttribI4uiv); + GLELoadProc(glVertexAttribI4usv_Impl, glVertexAttribI4usv); + GLELoadProc(glVertexAttribIPointer_Impl, glVertexAttribIPointer); + + // GL_VERSION_3_1 + GLELoadProc(glDrawArraysInstanced_Impl, glDrawArraysInstanced); + GLELoadProc(glDrawElementsInstanced_Impl, glDrawElementsInstanced); + GLELoadProc(glPrimitiveRestartIndex_Impl, glPrimitiveRestartIndex); + GLELoadProc(glTexBuffer_Impl, glTexBuffer); + + // GL_VERSION_3_2 + GLELoadProc(glFramebufferTexture_Impl, glFramebufferTexture); + GLELoadProc(glGetBufferParameteri64v_Impl, glGetBufferParameteri64v); + GLELoadProc(glGetInteger64i_v_Impl, glGetInteger64i_v); + + // GL_VERSION_3_3 + GLELoadProc(glVertexAttribDivisor_Impl, glVertexAttribDivisor); + + // GL_VERSION_4_0 + GLELoadProc(glBlendEquationSeparatei_Impl, glBlendEquationSeparatei); + GLELoadProc(glBlendEquationi_Impl, glBlendEquationi); + GLELoadProc(glBlendFuncSeparatei_Impl, glBlendFuncSeparatei); + GLELoadProc(glBlendFunci_Impl, glBlendFunci); + GLELoadProc(glMinSampleShading_Impl, glMinSampleShading); + + // GL_AMD_debug_output + GLELoadProc(glDebugMessageCallbackAMD_Impl, glDebugMessageCallbackAMD); + GLELoadProc(glDebugMessageEnableAMD_Impl, glDebugMessageEnableAMD); + GLELoadProc(glDebugMessageInsertAMD_Impl, glDebugMessageInsertAMD); + GLELoadProc(glGetDebugMessageLogAMD_Impl, glGetDebugMessageLogAMD); + + #if defined(GLE_CGL_ENABLED) + // GL_APPLE_element_array + GLELoadProc(glDrawElementArrayAPPLE_Impl, glDrawElementArrayAPPLE); + GLELoadProc(glDrawRangeElementArrayAPPLE_Impl, glDrawRangeElementArrayAPPLE); + GLELoadProc(glElementPointerAPPLE_Impl, glElementPointerAPPLE); + GLELoadProc(glMultiDrawElementArrayAPPLE_Impl, glMultiDrawElementArrayAPPLE); + GLELoadProc(glMultiDrawRangeElementArrayAPPLE_Impl, glMultiDrawRangeElementArrayAPPLE); + + // GL_APPLE_fence + GLELoadProc(glDeleteFencesAPPLE_Impl, glDeleteFencesAPPLE); + GLELoadProc(glFinishFenceAPPLE_Impl, glFinishFenceAPPLE); + GLELoadProc(glFinishObjectAPPLE_Impl, glFinishObjectAPPLE); + GLELoadProc(glGenFencesAPPLE_Impl, glGenFencesAPPLE); + GLELoadProc(glIsFenceAPPLE_Impl, glIsFenceAPPLE); + GLELoadProc(glSetFenceAPPLE_Impl, glSetFenceAPPLE); + GLELoadProc(glTestFenceAPPLE_Impl, glTestFenceAPPLE); + GLELoadProc(glTestObjectAPPLE_Impl, glTestObjectAPPLE); + + // GL_APPLE_flush_buffer_range + GLELoadProc(glBufferParameteriAPPLE_Impl, glMultiDrawRangeElementArrayAPPLE); + GLELoadProc(glFlushMappedBufferRangeAPPLE_Impl, glFlushMappedBufferRangeAPPLE); + + // GL_APPLE_object_purgeable + GLELoadProc(glGetObjectParameterivAPPLE_Impl, glGetObjectParameterivAPPLE); + GLELoadProc(glObjectPurgeableAPPLE_Impl, glObjectPurgeableAPPLE); + GLELoadProc(glObjectUnpurgeableAPPLE_Impl, glObjectUnpurgeableAPPLE); + + // GL_APPLE_texture_range + GLELoadProc(glGetTexParameterPointervAPPLE_Impl, glGetTexParameterPointervAPPLE); + GLELoadProc(glTextureRangeAPPLE_Impl, glTextureRangeAPPLE); + + // GL_APPLE_vertex_array_object + GLELoadProc(glBindVertexArrayAPPLE_Impl, glBindVertexArrayAPPLE); + GLELoadProc(glDeleteVertexArraysAPPLE_Impl, glDeleteVertexArraysAPPLE); + GLELoadProc(glGenVertexArraysAPPLE_Impl, glGenVertexArraysAPPLE); + GLELoadProc(glIsVertexArrayAPPLE_Impl, glIsVertexArrayAPPLE); + + // GL_APPLE_vertex_array_range + GLELoadProc(glFlushVertexArrayRangeAPPLE_Impl, glFlushVertexArrayRangeAPPLE); + GLELoadProc(glVertexArrayParameteriAPPLE_Impl, glVertexArrayParameteriAPPLE); + GLELoadProc(glVertexArrayRangeAPPLE_Impl, glVertexArrayRangeAPPLE); + + // GL_APPLE_vertex_program_evaluators + GLELoadProc(glDisableVertexAttribAPPLE_Impl, glDisableVertexAttribAPPLE); + GLELoadProc(glEnableVertexAttribAPPLE_Impl, glEnableVertexAttribAPPLE); + GLELoadProc(glIsVertexAttribEnabledAPPLE_Impl, glIsVertexAttribEnabledAPPLE); + GLELoadProc(glMapVertexAttrib1dAPPLE_Impl, glMapVertexAttrib1dAPPLE); + GLELoadProc(glMapVertexAttrib1fAPPLE_Impl, glMapVertexAttrib1fAPPLE); + GLELoadProc(glMapVertexAttrib2dAPPLE_Impl, glMapVertexAttrib2dAPPLE); + GLELoadProc(glMapVertexAttrib2fAPPLE_Impl, glMapVertexAttrib2fAPPLE); + + #endif // GLE_CGL_ENABLED + + // GL_ARB_copy_buffer + GLELoadProc(glCopyBufferSubData_Impl, glCopyBufferSubData); + + // GL_ARB_debug_output + GLELoadProc(glDebugMessageCallbackARB_Impl, glDebugMessageCallbackARB); + GLELoadProc(glDebugMessageControlARB_Impl, glDebugMessageControlARB); + GLELoadProc(glDebugMessageInsertARB_Impl, glDebugMessageInsertARB); + GLELoadProc(glGetDebugMessageLogARB_Impl, glGetDebugMessageLogARB); + + // GL_ARB_ES2_compatibility + GLELoadProc(glClearDepthf_Impl, glClearDepthf); + GLELoadProc(glDepthRangef_Impl, glDepthRangef); + GLELoadProc(glGetShaderPrecisionFormat_Impl, glGetShaderPrecisionFormat); + GLELoadProc(glReleaseShaderCompiler_Impl, glReleaseShaderCompiler); + GLELoadProc(glShaderBinary_Impl, glShaderBinary); + + // GL_ARB_framebuffer_object + GLELoadProc(glBindFramebuffer_Impl, glBindFramebuffer); + GLELoadProc(glBindRenderbuffer_Impl, glBindRenderbuffer); + GLELoadProc(glBlitFramebuffer_Impl, glBlitFramebuffer); + GLELoadProc(glCheckFramebufferStatus_Impl, glCheckFramebufferStatus); + GLELoadProc(glDeleteFramebuffers_Impl, glDeleteFramebuffers); + GLELoadProc(glDeleteRenderbuffers_Impl, glDeleteRenderbuffers); + GLELoadProc(glFramebufferRenderbuffer_Impl, glFramebufferRenderbuffer); + GLELoadProc(glFramebufferTexture1D_Impl, glFramebufferTexture1D); + GLELoadProc(glFramebufferTexture2D_Impl, glFramebufferTexture2D); + GLELoadProc(glFramebufferTexture3D_Impl, glFramebufferTexture3D); + GLELoadProc(glFramebufferTextureLayer_Impl, glFramebufferTextureLayer); + GLELoadProc(glGenFramebuffers_Impl, glGenFramebuffers); + GLELoadProc(glGenRenderbuffers_Impl, glGenRenderbuffers); + GLELoadProc(glGenerateMipmap_Impl, glGenerateMipmap); + GLELoadProc(glGetFramebufferAttachmentParameteriv_Impl, glGetFramebufferAttachmentParameteriv); + GLELoadProc(glGetRenderbufferParameteriv_Impl, glGetRenderbufferParameteriv); + GLELoadProc(glIsFramebuffer_Impl, glIsFramebuffer); + GLELoadProc(glIsRenderbuffer_Impl, glIsRenderbuffer); + GLELoadProc(glRenderbufferStorage_Impl, glRenderbufferStorage); + GLELoadProc(glRenderbufferStorageMultisample_Impl, glRenderbufferStorageMultisample); + + if(!glBindFramebuffer_Impl) // This will rarely if ever be the case in practice with modern computers and drivers. + { + // See if we can map GL_EXT_framebuffer_object to GL_ARB_framebuffer_object. The former is basically a subset of the latter, but we use only that subset. + GLELoadProc(glBindFramebuffer_Impl, glBindFramebufferEXT); + GLELoadProc(glBindRenderbuffer_Impl, glBindRenderbufferEXT); + //GLELoadProc(glBlitFramebuffer_Impl, glBlitFramebufferEXT (nonexistent)); + GLELoadProc(glCheckFramebufferStatus_Impl, glCheckFramebufferStatusEXT); + GLELoadProc(glDeleteFramebuffers_Impl, glDeleteFramebuffersEXT); + GLELoadProc(glDeleteRenderbuffers_Impl, glDeleteRenderbuffersEXT); + GLELoadProc(glFramebufferRenderbuffer_Impl, glFramebufferRenderbufferEXT); + GLELoadProc(glFramebufferTexture1D_Impl, glFramebufferTexture1DEXT); + GLELoadProc(glFramebufferTexture2D_Impl, glFramebufferTexture2DEXT); + GLELoadProc(glFramebufferTexture3D_Impl, glFramebufferTexture3DEXT); + //GLELoadProc(glFramebufferTextureLayer_Impl, glFramebufferTextureLayerEXT (nonexistent)); + GLELoadProc(glGenFramebuffers_Impl, glGenFramebuffersEXT); + GLELoadProc(glGenRenderbuffers_Impl, glGenRenderbuffersEXT); + GLELoadProc(glGenerateMipmap_Impl, glGenerateMipmapEXT); + GLELoadProc(glGetFramebufferAttachmentParameteriv_Impl, glGetFramebufferAttachmentParameterivEXT); + GLELoadProc(glGetRenderbufferParameteriv_Impl, glGetRenderbufferParameterivEXT); + GLELoadProc(glIsFramebuffer_Impl, glIsFramebufferEXT); + GLELoadProc(glIsRenderbuffer_Impl, glIsRenderbufferEXT); + GLELoadProc(glRenderbufferStorage_Impl, glRenderbufferStorageEXT); + //GLELoadProc(glRenderbufferStorageMultisample_Impl, glRenderbufferStorageMultisampleEXT (nonexistent)); + } + + // GL_ARB_texture_multisample + GLELoadProc(glGetMultisamplefv_Impl, glGetMultisamplefv); + GLELoadProc(glSampleMaski_Impl, glSampleMaski); + GLELoadProc(glTexImage2DMultisample_Impl, glTexImage2DMultisample); + GLELoadProc(glTexImage3DMultisample_Impl, glTexImage3DMultisample); + + // GL_ARB_texture_storage + GLELoadProc(glTexStorage1D_Impl, glTexStorage1D); + GLELoadProc(glTexStorage2D_Impl, glTexStorage2D); + GLELoadProc(glTexStorage3D_Impl, glTexStorage3D); + GLELoadProc(glTextureStorage1DEXT_Impl, glTextureStorage1DEXT); + GLELoadProc(glTextureStorage2DEXT_Impl, glTextureStorage2DEXT); + GLELoadProc(glTextureStorage3DEXT_Impl, glTextureStorage3DEXT); + + // GL_ARB_texture_storage_multisample + GLELoadProc(glTexStorage2DMultisample_Impl, glTexStorage2DMultisample); + GLELoadProc(glTexStorage3DMultisample_Impl, glTexStorage3DMultisample); + GLELoadProc(glTextureStorage2DMultisampleEXT_Impl, glTextureStorage2DMultisampleEXT); + GLELoadProc(glTextureStorage3DMultisampleEXT_Impl, glTextureStorage3DMultisampleEXT); + + // GL_ARB_timer_query + GLELoadProc(glGetQueryObjecti64v_Impl, glGetQueryObjecti64v); + GLELoadProc(glGetQueryObjectui64v_Impl, glGetQueryObjectui64v); + GLELoadProc(glQueryCounter_Impl, glQueryCounter); + + // GL_ARB_vertex_array_object + GLELoadProc(glBindVertexArray_Impl, glBindVertexArray); + GLELoadProc(glDeleteVertexArrays_Impl, glDeleteVertexArrays); + GLELoadProc(glGenVertexArrays_Impl, glGenVertexArrays); + GLELoadProc(glIsVertexArray_Impl, glIsVertexArray); + + #if defined(GLE_CGL_ENABLED) // Apple OpenGL... + if(WholeVersion < 302) // It turns out that Apple OpenGL versions prior to 3.2 have glBindVertexArray, etc. but they silently fail by default. So always use the APPLE version. + { + glBindVertexArray_Impl = glBindVertexArrayAPPLE_Impl; + glDeleteVertexArrays_Impl = glDeleteVertexArraysAPPLE_Impl; + glGenVertexArrays_Impl = (OVRTypeof(glGenVertexArrays_Impl)) glGenVertexArraysAPPLE_Impl; // There is a const cast of the arrays argument here due to a slight difference in the Apple behavior. For our purposes it should be OK. + glIsVertexArray_Impl = glIsVertexArrayAPPLE_Impl; + + if(glBindVertexArray_Impl) + gle_ARB_vertex_array_object = true; // We are routing the APPLE version through our version, with the assumption that we use the ARB version the same as we would use the APPLE version. + } + #endif + + // GL_EXT_draw_buffers2 + GLELoadProc(glColorMaskIndexedEXT_Impl, glColorMaskIndexedEXT); + GLELoadProc(glDisableIndexedEXT_Impl, glDisableIndexedEXT); + GLELoadProc(glEnableIndexedEXT_Impl, glEnableIndexedEXT); + GLELoadProc(glGetBooleanIndexedvEXT_Impl, glGetBooleanIndexedvEXT); + GLELoadProc(glGetIntegerIndexedvEXT_Impl, glGetIntegerIndexedvEXT); + GLELoadProc(glIsEnabledIndexedEXT_Impl, glIsEnabledIndexedEXT); + + // GL_KHR_debug + GLELoadProc(glDebugMessageCallback_Impl, glDebugMessageCallback); + GLELoadProc(glDebugMessageControl_Impl, glDebugMessageControl); + GLELoadProc(glDebugMessageInsert_Impl, glDebugMessageInsert); + GLELoadProc(glGetDebugMessageLog_Impl, glGetDebugMessageLog); + GLELoadProc(glGetObjectLabel_Impl, glGetObjectLabel); + GLELoadProc(glGetObjectPtrLabel_Impl, glGetObjectPtrLabel); + GLELoadProc(glObjectLabel_Impl, glObjectLabel); + GLELoadProc(glObjectPtrLabel_Impl, glObjectPtrLabel); + GLELoadProc(glPopDebugGroup_Impl, glPopDebugGroup); + GLELoadProc(glPushDebugGroup_Impl, glPushDebugGroup); + + // GL_WIN_swap_hint + GLELoadProc(glAddSwapHintRectWIN_Impl, glAddSwapHintRectWIN); + } + + + + OVR_DISABLE_MSVC_WARNING(4510 4512 4610) // default constructor could not be generated, + struct ValueStringPair + { + bool& IsPresent; + const char* ExtensionName; + }; + + + // Helper function for InitExtensionSupport. + static void CheckExtensions(ValueStringPair* pValueStringPairArray, size_t arrayCount, const char* extensions) + { + // We search the extesion list string for each of the individual extensions we are interested in. + // We do this by walking over the string and comparing each entry in turn to our array of entries of interest. + // Example string (with patholigical extra spaces): " ext1 ext2 ext3 " + + char extension[64]; + const char* p = extensions; // p points to the beginning of the current word + const char* pEnd; // pEnd points to one-past the last character of the current word. It is where the trailing '\0' of the string would be. + + while(*p) + { + while(*p == ' ') // Find the next word begin. + ++p; + + pEnd = p; + + while((*pEnd != '\0') && (*pEnd != ' ')) // Find the next word end. + ++pEnd; + + if(((pEnd - p) > 0) && ((size_t)(pEnd - p) < OVR_ARRAY_COUNT(extension))) + { + memcpy(extension, p, pEnd - p); // To consider: Revise this code to directly read from p/pEnd instead of doing a memcpy. + extension[pEnd - p] = '\0'; + + for(size_t i = 0; i < arrayCount; i++) // For each extension we are interested in... + { + ValueStringPair& vsp = pValueStringPairArray[i]; + + if(strcmp(extension, vsp.ExtensionName) == 0) // case-sensitive compare + pValueStringPairArray[i].IsPresent = true; + } + } + + p = pEnd; + } + } + + + void OVR::GLEContext::InitExtensionSupport() + { + // It may be better in the long run to use a member STL map. + // It would make this loading code cleaner, though it would make lookups slower. + + ValueStringPair vspArray[] = + { + { gle_AMD_debug_output, "GL_AMD_debug_output" }, + #if defined(GLE_CGL_ENABLED) + { gle_APPLE_aux_depth_stencil, "GL_APPLE_aux_depth_stencil" }, + { gle_APPLE_client_storage, "GL_APPLE_client_storage" }, + { gle_APPLE_element_array, "GL_APPLE_element_array" }, + { gle_APPLE_fence, "GL_APPLE_fence" }, + { gle_APPLE_float_pixels, "GL_APPLE_float_pixels" }, + { gle_APPLE_flush_buffer_range, "GL_APPLE_flush_buffer_range" }, + { gle_APPLE_object_purgeable, "GL_APPLE_object_purgeable" }, + { gle_APPLE_pixel_buffer, "GL_APPLE_pixel_buffer" }, + { gle_APPLE_rgb_422, "GL_APPLE_rgb_422" }, + { gle_APPLE_row_bytes, "GL_APPLE_row_bytes" }, + { gle_APPLE_specular_vector, "GL_APPLE_specular_vector" }, + { gle_APPLE_texture_range, "GL_APPLE_texture_range" }, + { gle_APPLE_transform_hint, "GL_APPLE_transform_hint" }, + { gle_APPLE_vertex_array_object, "GL_APPLE_vertex_array_object" }, + { gle_APPLE_vertex_array_range, "GL_APPLE_vertex_array_range" }, + { gle_APPLE_vertex_program_evaluators, "GL_APPLE_vertex_program_evaluators" }, + { gle_APPLE_ycbcr_422, "GL_APPLE_ycbcr_422" }, + #endif + { gle_ARB_copy_buffer, "GL_ARB_copy_buffer" }, + { gle_ARB_debug_output, "GL_ARB_debug_output" }, + { gle_ARB_depth_buffer_float, "GL_ARB_depth_buffer_float" }, + { gle_ARB_ES2_compatibility, "GL_ARB_ES2_compatibility" }, + { gle_ARB_framebuffer_object, "GL_ARB_framebuffer_object" }, + { gle_ARB_framebuffer_object, "GL_EXT_framebuffer_object" }, // We map glBindFramebuffer, etc. to glBindFramebufferEXT, etc. if necessary + { gle_ARB_framebuffer_sRGB, "GL_ARB_framebuffer_sRGB" }, + { gle_ARB_texture_multisample, "GL_ARB_texture_multisample" }, + { gle_ARB_texture_non_power_of_two, "GL_ARB_texture_non_power_of_two" }, + { gle_ARB_texture_rectangle, "GL_ARB_texture_rectangle" }, + { gle_ARB_texture_rectangle, "GL_EXT_texture_rectangle" }, // We also check for GL_EXT_texture_rectangle and GL_NV_texture_rectangle. + { gle_ARB_texture_rectangle, "GL_NV_texture_rectangle" }, + { gle_ARB_texture_storage, "GL_ARB_texture_storage" }, + { gle_ARB_texture_storage_multisample, "GL_ARB_texture_storage_multisample" }, + { gle_ARB_timer_query, "GL_ARB_timer_query" }, + { gle_ARB_vertex_array_object, "GL_ARB_vertex_array_object" }, + { gle_EXT_draw_buffers2, "GL_EXT_draw_buffers2" }, + { gle_EXT_texture_compression_s3tc, "GL_EXT_texture_compression_s3tc" }, + { gle_EXT_texture_filter_anisotropic, "GL_EXT_texture_filter_anisotropic" }, + { gle_EXT_texture_sRGB, "GL_EXT_texture_sRGB" }, + { gle_KHR_debug, "GL_KHR_debug" }, + { gle_WIN_swap_hint, "GL_WIN_swap_hint" } + // Windows WGL, Unix GLX, and Apple CGL extensions are handled below, as they require different calls from glGetString(GL_EXTENSIONS). + }; + + // We cannot use glGetString(GL_EXTENSIONS) when an OpenGL core profile is active, + // as it's deprecated in favor of using OpenGL 3+ glGetStringi. + const char* extensions = (MajorVersion < 3) ? (const char*)glGetString(GL_EXTENSIONS) : ""; + + if (extensions && *extensions) // If we have a space-delimited extension string to search for individual extensions... + { + OVR_DEBUG_LOG(("GL_EXTENSIONS: %s", (const char*)extensions)); + CheckExtensions(vspArray, OVR_ARRAY_COUNT(vspArray), extensions); // Call our shared helper function for this. + } + else + { + if(MajorVersion >= 3) // If glGetIntegerv(GL_NUM_EXTENSIONS, ...) is supported... + { + // In this case we need to match an array of individual extensions against an array of + // externsions provided by glGetStringi. This is an O(n^2) operation, but at least we + // are doing this only once on startup. There are a few tricks we can employ to speed + // up the logic below, but they may not be worth much. + + GLint extensionCount = 0; + glGetIntegerv(GL_NUM_EXTENSIONS, &extensionCount); + GLenum err = glGetError(); + + if(err == 0) + { + #ifdef OVR_BUILD_DEBUG + OVR::StringBuffer extensionsStr; + #endif + + for(GLint e = 0; e != extensionCount; ++e) // For each extension supported... + { + const char* extension = (const char*)glGetStringi(GL_EXTENSIONS, (GLuint)e); + + if(extension) // glGetStringi returns NULL upon error. + { + #ifdef OVR_BUILD_DEBUG + extensionsStr.AppendFormat(" %s", extension); + #endif + + for(size_t i = 0; i < OVR_ARRAY_COUNT(vspArray); i++) // For each extension we are interested in... + { + ValueStringPair& vsp = vspArray[i]; + + if(strcmp(extension, vsp.ExtensionName) == 0) // case-sensitive compare + vspArray[i].IsPresent = true; + } + } + else + break; + } + + OVR_DEBUG_LOG(("GL_EXTENSIONS: %s", extensionsStr.ToCStr())); + } + } + // Else we have a problem: no means to read the extensions was successful. + } + + #if defined(GLE_CGL_ENABLED) + // The following are built into Apple OpenGL 3.2+ (declared in ) and not identified as extensions. + // On other platforms (e.g. Windows) these are identified as extensions and are detected above. + if(WholeVersion >= 302) + { + gle_ARB_copy_buffer = true; + gle_ARB_depth_buffer_float = true; + gle_ARB_framebuffer_object = true; + gle_ARB_framebuffer_sRGB = true; + gle_ARB_texture_multisample = true; + gle_ARB_texture_non_power_of_two = true; + gle_ARB_texture_rectangle = true; + gle_ARB_vertex_array_object = true; + } + #endif + + } // GLEContext::InitExtensionSupport() + + + void OVR::GLEContext::InitPlatformVersion() + { + #if defined(GLE_GLX_ENABLED) + const char* pGLXVersion = glXGetClientString(glXGetCurrentDisplay(), GLX_VERSION); // To do: Use a better mechanism to get the desired display. + sscanf(pGLXVersion, "%d.%d", &PlatformMajorVersion, &PlatformMinorVersion); + + #elif defined(GLE_EGL_ENABLED) + const char* pEGLVersion = eglQueryString(eglGetDisplay(EGL_DEFAULT_DISPLAY), EGL_VERSION); + sscanf(pEGLVersion, "%d.%d", &PlatformMajorVersion, &PlatformMinorVersion); + + #else + PlatformMajorVersion = 1; + PlatformMinorVersion = 0; + PlatformWholeVersion = 100; + #endif + } + + + void OVR::GLEContext::InitPlatformExtensionLoad() + { + #if defined(GLE_WGL_ENABLED) + // WGL + // We don't load these as function pointers but rather statically link to them. + // These need to be loaded via LoadLibrary instead of wglLoadLibrary. + + #if 0 + HINSTANCE hOpenGL = LoadLibraryW(L"Opengl32.dll"); + if(hOpenGL) + { + wglCopyContext_Impl = (OVRTypeof(wglCopyContext_Impl)) GetProcAddress(hOpenGL, "wglCopyContext"); + wglCreateContext_Impl = (OVRTypeof(wglCreateContext_Impl)) GetProcAddress(hOpenGL, "wglCreateContext"); + wglCreateLayerContext_Impl = (OVRTypeof(wglCreateLayerContext_Impl)) GetProcAddress(hOpenGL, "wglCreateLayerContext"); + wglDeleteContext_Impl = (OVRTypeof(wglDeleteContext_Impl)) GetProcAddress(hOpenGL, "wglDeleteContext"); + wglGetCurrentContext_Impl = (OVRTypeof(wglGetCurrentContext_Impl)) GetProcAddress(hOpenGL, "wglGetCurrentContext"); + wglGetCurrentDC_Impl = (OVRTypeof(wglGetCurrentDC_Impl)) GetProcAddress(hOpenGL, "wglGetCurrentDC"); + wglGetProcAddress_Impl = (OVRTypeof(wglGetProcAddress_Impl)) GetProcAddress(hOpenGL, "wglGetProcAddress"); + wglMakeCurrent_Impl = (OVRTypeof(wglMakeCurrent_Impl)) GetProcAddress(hOpenGL, "wglMakeCurrent"); + wglShareLists_Impl = (OVRTypeof(wglShareLists_Impl)) GetProcAddress(hOpenGL, "wglShareLists"); + wglUseFontBitmapsA_Impl = (OVRTypeof(wglUseFontBitmapsA_Impl)) GetProcAddress(hOpenGL, "wglUseFontBitmapsA"); + wglUseFontBitmapsW_Impl = (OVRTypeof(wglUseFontBitmapsW_Impl)) GetProcAddress(hOpenGL, "wglUseFontBitmapsW"); + wglUseFontOutlinesA_Impl = (OVRTypeof(wglUseFontOutlinesA_Impl)) GetProcAddress(hOpenGL, "wglUseFontOutlinesA"); + wglUseFontOutlinesW_Impl = (OVRTypeof(wglUseFontOutlinesW_Impl)) GetProcAddress(hOpenGL, "wglUseFontOutlinesW"); + wglDescribeLayerPlane_Impl = (OVRTypeof(wglDescribeLayerPlane_Impl)) GetProcAddress(hOpenGL, "wglDescribeLayerPlane"); + wglSetLayerPaletteEntries_Impl = (OVRTypeof(wglSetLayerPaletteEntries_Impl)) GetProcAddress(hOpenGL, "wglSetLayerPaletteEntries"); + wglGetLayerPaletteEntries_Impl = (OVRTypeof(wglGetLayerPaletteEntries_Impl)) GetProcAddress(hOpenGL, "wglGetLayerPaletteEntries"); + wglRealizeLayerPalette_Impl = (OVRTypeof(wglRealizeLayerPalette_Impl)) GetProcAddress(hOpenGL, "wglRealizeLayerPalette"); + wglSwapLayerBuffers_Impl = (OVRTypeof(wglSwapLayerBuffers_Impl)) GetProcAddress(hOpenGL, "wglSwapLayerBuffers"); + wglSwapMultipleBuffers_Impl = (OVRTypeof(wglSwapMultipleBuffers_Impl)) GetProcAddress(hOpenGL, "wglSwapMultipleBuffers"); + FreeLibrary(hOpenGL); + } + #endif + + // WGL_ARB_buffer_region + GLELoadProc(wglCreateBufferRegionARB_Impl, wglCreateBufferRegionARB); + GLELoadProc(wglDeleteBufferRegionARB_Impl, wglDeleteBufferRegionARB); + GLELoadProc(wglSaveBufferRegionARB_Impl, wglSaveBufferRegionARB); + GLELoadProc(wglRestoreBufferRegionARB_Impl, wglRestoreBufferRegionARB); + + // WGL_ARB_extensions_string + GLELoadProc(wglGetExtensionsStringARB_Impl, wglGetExtensionsStringARB); + + // WGL_ARB_pixel_format + GLELoadProc(wglGetPixelFormatAttribivARB_Impl, wglGetPixelFormatAttribivARB); + GLELoadProc(wglGetPixelFormatAttribfvARB_Impl, wglGetPixelFormatAttribfvARB); + GLELoadProc(wglChoosePixelFormatARB_Impl, wglChoosePixelFormatARB); + + // WGL_ARB_make_current_read + GLELoadProc(wglMakeContextCurrentARB_Impl, wglMakeContextCurrentARB); + GLELoadProc(wglGetCurrentReadDCARB_Impl, wglGetCurrentReadDCARB); + + // WGL_ARB_pbuffer + GLELoadProc(wglCreatePbufferARB_Impl, wglCreatePbufferARB); + GLELoadProc(wglGetPbufferDCARB_Impl, wglGetPbufferDCARB); + GLELoadProc(wglReleasePbufferDCARB_Impl, wglReleasePbufferDCARB); + GLELoadProc(wglDestroyPbufferARB_Impl, wglDestroyPbufferARB); + GLELoadProc(wglQueryPbufferARB_Impl, wglQueryPbufferARB); + + // WGL_ARB_render_texture + GLELoadProc(wglBindTexImageARB_Impl, wglBindTexImageARB); + GLELoadProc(wglReleaseTexImageARB_Impl, wglReleaseTexImageARB); + GLELoadProc(wglSetPbufferAttribARB_Impl, wglSetPbufferAttribARB); + + // WGL_NV_present_video + GLELoadProc(wglEnumerateVideoDevicesNV_Impl, wglEnumerateVideoDevicesNV); + GLELoadProc(wglBindVideoDeviceNV_Impl, wglBindVideoDeviceNV); + GLELoadProc(wglQueryCurrentContextNV_Impl, wglQueryCurrentContextNV); + + // WGL_ARB_create_context + GLELoadProc(wglCreateContextAttribsARB_Impl, wglCreateContextAttribsARB); + + // WGL_EXT_extensions_string + GLELoadProc(wglGetExtensionsStringEXT_Impl, wglGetExtensionsStringEXT); + + // WGL_EXT_swap_control + GLELoadProc(wglGetSwapIntervalEXT_Impl, wglGetSwapIntervalEXT); + GLELoadProc(wglSwapIntervalEXT_Impl, wglSwapIntervalEXT); + + // WGL_OML_sync_control + GLELoadProc(wglGetSyncValuesOML_Impl, wglGetSyncValuesOML); + GLELoadProc(wglGetMscRateOML_Impl, wglGetMscRateOML); + GLELoadProc(wglSwapBuffersMscOML_Impl, wglSwapBuffersMscOML); + GLELoadProc(wglSwapLayerBuffersMscOML_Impl, wglSwapLayerBuffersMscOML); + GLELoadProc(wglWaitForMscOML_Impl, wglWaitForMscOML); + GLELoadProc(wglWaitForSbcOML_Impl, wglWaitForSbcOML); + + // WGL_NV_video_output + GLELoadProc(wglGetVideoDeviceNV_Impl, wglGetVideoDeviceNV); + GLELoadProc(wglReleaseVideoDeviceNV_Impl, wglReleaseVideoDeviceNV); + GLELoadProc(wglBindVideoImageNV_Impl, wglBindVideoImageNV); + GLELoadProc(wglReleaseVideoImageNV_Impl, wglReleaseVideoImageNV); + GLELoadProc(wglSendPbufferToVideoNV_Impl, wglSendPbufferToVideoNV); + GLELoadProc(wglGetVideoInfoNV_Impl, wglGetVideoInfoNV); + + // WGL_NV_swap_group + GLELoadProc(wglJoinSwapGroupNV_Impl, wglJoinSwapGroupNV); + GLELoadProc(wglBindSwapBarrierNV_Impl, wglBindSwapBarrierNV); + GLELoadProc(wglQuerySwapGroupNV_Impl, wglQuerySwapGroupNV); + GLELoadProc(wglQueryMaxSwapGroupsNV_Impl, wglQueryMaxSwapGroupsNV); + GLELoadProc(wglQueryFrameCountNV_Impl, wglQueryFrameCountNV); + GLELoadProc(wglResetFrameCountNV_Impl, wglResetFrameCountNV); + + // WGL_NV_video_capture + GLELoadProc(wglBindVideoCaptureDeviceNV_Impl, wglBindVideoCaptureDeviceNV); + GLELoadProc(wglEnumerateVideoCaptureDevicesNV_Impl, wglEnumerateVideoCaptureDevicesNV); + GLELoadProc(wglLockVideoCaptureDeviceNV_Impl, wglLockVideoCaptureDeviceNV); + GLELoadProc(wglQueryVideoCaptureDeviceNV_Impl, wglQueryVideoCaptureDeviceNV); + GLELoadProc(wglReleaseVideoCaptureDeviceNV_Impl, wglReleaseVideoCaptureDeviceNV); + + // WGL_NV_copy_image + GLELoadProc(wglCopyImageSubDataNV_Impl, wglCopyImageSubDataNV); + + // WGL_NV_DX_interop + GLELoadProc(wglDXCloseDeviceNV_Impl, wglDXCloseDeviceNV); + GLELoadProc(wglDXLockObjectsNV_Impl, wglDXLockObjectsNV); + GLELoadProc(wglDXObjectAccessNV_Impl, wglDXObjectAccessNV); + GLELoadProc(wglDXOpenDeviceNV_Impl, wglDXOpenDeviceNV); + GLELoadProc(wglDXRegisterObjectNV_Impl, wglDXRegisterObjectNV); + GLELoadProc(wglDXSetResourceShareHandleNV_Impl, wglDXSetResourceShareHandleNV); + GLELoadProc(wglDXUnlockObjectsNV_Impl, wglDXUnlockObjectsNV); + GLELoadProc(wglDXUnregisterObjectNV_Impl, wglDXUnregisterObjectNV); + + #elif defined(GLE_GLX_ENABLED) + // GLX_VERSION_1_1 + // We don't create any pointers_Impl, because we assume these functions are always present. + + // GLX_VERSION_1_2 + GLELoadProc(glXGetCurrentDisplay_Impl, glXGetCurrentDisplay); + + // GLX_VERSION_1_3 + GLELoadProc(glXChooseFBConfig_Impl, glXChooseFBConfig); + GLELoadProc(glXCreateNewContext_Impl, glXCreateNewContext); + GLELoadProc(glXCreatePbuffer_Impl, glXCreatePbuffer); + GLELoadProc(glXCreatePixmap_Impl, glXCreatePixmap); + GLELoadProc(glXCreateWindow_Impl, glXCreateWindow); + GLELoadProc(glXDestroyPbuffer_Impl, glXDestroyPbuffer); + GLELoadProc(glXDestroyPixmap_Impl, glXDestroyPixmap); + GLELoadProc(glXDestroyWindow_Impl, glXDestroyWindow); + GLELoadProc(glXGetCurrentReadDrawable_Impl, glXGetCurrentReadDrawable); + GLELoadProc(glXGetFBConfigAttrib_Impl, glXGetFBConfigAttrib); + GLELoadProc(glXGetFBConfigs_Impl, glXGetFBConfigs); + GLELoadProc(glXGetSelectedEvent_Impl, glXGetSelectedEvent); + GLELoadProc(glXGetVisualFromFBConfig_Impl, glXGetVisualFromFBConfig); + GLELoadProc(glXMakeContextCurrent_Impl, glXMakeContextCurrent); + GLELoadProc(glXQueryContext_Impl, glXQueryContext); + GLELoadProc(glXQueryDrawable_Impl, glXQueryDrawable); + GLELoadProc(glXSelectEvent_Impl, glXSelectEvent); + + // GLX_VERSION_1_4 + // Nothing to declare + + // GLX_ARB_create_context + GLELoadProc(glXCreateContextAttribsARB_Impl, glXCreateContextAttribsARB); + + // GLX_EXT_swap_control + GLELoadProc(glXSwapIntervalEXT_Impl, glXSwapIntervalEXT); + + // GLX_OML_sync_control + GLELoadProc(glXGetMscRateOML_Impl, glXGetMscRateOML); + GLELoadProc(glXGetSyncValuesOML_Impl, glXGetSyncValuesOML); + GLELoadProc(glXGetSyncValuesOML_Impl, glXSwapBuffersMscOML); + GLELoadProc(glXSwapBuffersMscOML_Impl, glXSwapBuffersMscOML); + GLELoadProc(glXWaitForSbcOML_Impl, glXWaitForSbcOML); + + // GLX_MESA_swap_control + GLELoadProc(glXGetSwapIntervalMESA_Impl, glXGetSwapIntervalMESA); + GLELoadProc(glXSwapIntervalMESA_Impl, glXSwapIntervalMESA); + #endif + } + + + void OVR::GLEContext::InitPlatformExtensionSupport() + { + #if defined(GLE_WGL_ENABLED) + // We need to use wglGetExtensionsStringARB or wglGetExtensionsStringEXT as opposed to above with glGetString(GL_EXTENSIONS). + ValueStringPair vspWGLArray[] = + { + { gle_WGL_ARB_buffer_region, "WGL_ARB_buffer_region" } + ,{ gle_WGL_ARB_create_context, "WGL_ARB_create_context" } + ,{ gle_WGL_ARB_create_context_profile, "WGL_ARB_create_context_profile" } + ,{ gle_WGL_ARB_create_context_robustness, "WGL_ARB_create_context_robustness" } + ,{ gle_WGL_ARB_extensions_string, "WGL_ARB_extensions_string" } + ,{ gle_WGL_ARB_framebuffer_sRGB, "WGL_ARB_framebuffer_sRGB" } + ,{ gle_WGL_ARB_framebuffer_sRGB, "WGL_EXT_framebuffer_sRGB" } // We map the EXT to the ARB. + ,{ gle_WGL_ARB_make_current_read, "WGL_ARB_make_current_read" } + ,{ gle_WGL_ARB_pbuffer, "WGL_ARB_pbuffer" } + ,{ gle_WGL_ARB_pixel_format, "WGL_ARB_pixel_format" } + ,{ gle_WGL_ARB_pixel_format_float, "WGL_ARB_pixel_format_float" } + ,{ gle_WGL_ARB_render_texture, "WGL_ARB_render_texture" } + ,{ gle_WGL_ATI_render_texture_rectangle, "WGL_ATI_render_texture_rectangle" } + ,{ gle_WGL_EXT_extensions_string, "WGL_EXT_extensions_string" } + ,{ gle_WGL_EXT_swap_control, "WGL_EXT_swap_control" } + ,{ gle_WGL_NV_copy_image, "WGL_NV_copy_image" } + ,{ gle_WGL_NV_DX_interop, "WGL_NV_DX_interop" } + ,{ gle_WGL_NV_DX_interop2, "WGL_NV_DX_interop2" } + ,{ gle_WGL_NV_present_video, "WGL_NV_present_video" } + ,{ gle_WGL_NV_render_texture_rectangle, "WGL_NV_render_texture_rectangle" } + ,{ gle_WGL_NV_swap_group, "WGL_NV_swap_group" } + ,{ gle_WGL_NV_video_capture, "WGL_NV_video_capture" } + ,{ gle_WGL_NV_video_output, "WGL_NV_video_output" } + ,{ gle_WGL_OML_sync_control, "WGL_OML_sync_control" } + }; + + const char* extensions = NULL; + + if(wglGetExtensionsStringARB_Impl) + extensions = wglGetExtensionsStringARB_Impl(wglGetCurrentDC()); // To do: Use a better mechanism to get the desired HDC. + else if(wglGetExtensionsStringEXT_Impl) + extensions = wglGetExtensionsStringEXT_Impl(); + + if (extensions && *extensions) + { + OVR_DEBUG_LOG(("WGL_EXTENSIONS: %s", (const char*)extensions)); + CheckExtensions(vspWGLArray, OVR_ARRAY_COUNT(vspWGLArray), extensions); + } + + #elif defined(GLE_GLX_ENABLED) + ValueStringPair vspGLXArray[] = + { + { gle_GLX_ARB_create_context, "GLX_ARB_create_context" } + ,{ gle_GLX_ARB_create_context_profile, "GLX_ARB_create_context_profile" } + ,{ gle_GLX_ARB_create_context_robustness, "GLX_ARB_create_context_robustness" } + ,{ gle_GLX_EXT_swap_control, "GLX_EXT_swap_control" } + ,{ gle_GLX_OML_sync_control, "GLX_OML_sync_control" } + ,{ gle_MESA_swap_control, "GLX_MESA_swap_control" } + }; + + const char* extensions = glXGetClientString(glXGetCurrentDisplay(), GLX_EXTENSIONS); // To do: Use a better mechanism to get the desired display. + + if (extensions && *extensions) + { + OVR_DEBUG_LOG(("GLX_EXTENSIONS: %s", (const char*)extensions)); + CheckExtensions(vspGLXArray, OVR_ARRAY_COUNT(vspGLXArray), extensions); + } + #endif + } + + + #if defined(GLE_HOOKING_ENABLED) + + #undef glGetError + extern "C" { GLAPI GLenum GLAPIENTRY glGetError(); } + + // Disabled until such time as it might be useful to enable for debug purposes. + //void OVR::GLEContext::PreHook(const char* functionName) + //{ + // if(EnableHookGetError) + // { + // int err = glGetError(); + // + // for(int i = 0; (i < 6) && (err != GL_NO_ERROR); i++) // 6 is an arbitrary cap to prevent infinite looping which would occur if the current GL context is invalid. + // { + // OVR_DEBUG_LOG(("GL Error prior to hook: %d (%#x) from %s", err, err, functionName ? functionName : "OpenGL")); OVR_UNUSED(functionName); + // err = glGetError(); + // } + // } + //} + + void OVR::GLEContext::PostHook(const char* functionName) + { + if(EnableHookGetError) + { + // OpenGL Standard regarding error state: To allow for distributed implementations, there may be several error flags. If any single error flag has recorded an error, the value of that flag + // is returned and that flag is reset to GL_NO_ERROR when glGetError is called. If more than one flag has recorded an error, glGetError returns and + // clears an arbitrary error flag value. Thus, glGetError should always be called in a loop, until it returns GL_NO_ERROR, if all error flags are to be reset. + int err = glGetError(); + + for(int i = 0; (i < 6) && (err != GL_NO_ERROR); i++) // 6 is an arbitrary cap to prevent infinite looping which would occur if the current GL context is invalid. + { + OVR_DEBUG_LOG(("GL Error: %d (%#x) from %s", err, err, functionName ? functionName : "OpenGL")); OVR_UNUSED(functionName); + err = glGetError(); + } + } + } + + + // OpenGL 1.1 link-based functions + #undef glAccum // Undefine the macro from our header so that we can directly call the real version of this function. + extern "C" { GLAPI void GLAPIENTRY glAccum(GLenum op, GLfloat value); } + void OVR::GLEContext::glAccum_Hook(GLenum op, GLfloat value) + { + glAccum(op, value); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glAlphaFunc + extern "C" { GLAPI void GLAPIENTRY glAlphaFunc(GLenum func, GLclampf ref); } + void OVR::GLEContext::glAlphaFunc_Hook(GLenum func, GLclampf ref) + { + glAlphaFunc(func, ref); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glAreTexturesResident + extern "C" { GLAPI GLboolean GLAPIENTRY glAreTexturesResident(GLsizei n, const GLuint *textures, GLboolean *residences); } + GLboolean OVR::GLEContext::glAreTexturesResident_Hook(GLsizei n, const GLuint *textures, GLboolean *residences) + { + GLboolean b = glAreTexturesResident(n, textures, residences); + PostHook(GLE_CURRENT_FUNCTION); + return b; + } + + #undef glArrayElement + extern "C" { GLAPI void GLAPIENTRY glArrayElement(GLint i); } + void OVR::GLEContext::glArrayElement_Hook(GLint i) + { + glArrayElement(i); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glBegin + extern "C" { GLAPI void GLAPIENTRY glBegin(GLenum mode); } + void OVR::GLEContext::glBegin_Hook(GLenum mode) + { + glBegin(mode); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glBindTexture + extern "C" { GLAPI void GLAPIENTRY glBindTexture(GLenum target, GLuint texture); } + void OVR::GLEContext::glBindTexture_Hook(GLenum target, GLuint texture) + { + glBindTexture(target, texture); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glBitmap + extern "C" { GLAPI void GLAPIENTRY glBitmap(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap); } + void OVR::GLEContext::glBitmap_Hook(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap) + { + glBitmap(width, height, xorig, yorig, xmove, ymove, bitmap); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glBlendFunc + extern "C" { GLAPI void GLAPIENTRY glBlendFunc(GLenum sfactor, GLenum dfactor); } + void OVR::GLEContext::glBlendFunc_Hook(GLenum sfactor, GLenum dfactor) + { + glBlendFunc(sfactor, dfactor); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glCallList + extern "C" { GLAPI void GLAPIENTRY glCallList(GLuint list); } + void OVR::GLEContext::glCallList_Hook(GLuint list) + { + glCallList(list); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glCallLists + extern "C" { GLAPI void GLAPIENTRY glCallLists(GLsizei n, GLenum type, const void *lists); } + void OVR::GLEContext::glCallLists_Hook(GLsizei n, GLenum type, const void *lists) + { + glCallLists(n, type, lists); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glClear + extern "C" { GLAPI void GLAPIENTRY glClear(GLbitfield mask); } + void OVR::GLEContext::glClear_Hook(GLbitfield mask) + { + glClear(mask); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glClearAccum + extern "C" { GLAPI void GLAPIENTRY glClearAccum(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); } + void OVR::GLEContext::glClearAccum_Hook(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) + { + glClearAccum(red, green, blue, alpha); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glClearColor + extern "C" { GLAPI void GLAPIENTRY glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); } + void OVR::GLEContext::glClearColor_Hook(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) + { + glClearColor(red, green, blue, alpha); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glClearDepth + extern "C" { GLAPI void GLAPIENTRY glClearDepth(GLclampd depth); } + void OVR::GLEContext::glClearDepth_Hook(GLclampd depth) + { + glClearDepth(depth); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glClearIndex + extern "C" { GLAPI void GLAPIENTRY glClearIndex(GLfloat c); } + void OVR::GLEContext::glClearIndex_Hook(GLfloat c) + { + glClearIndex(c); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glClearStencil + extern "C" { GLAPI void GLAPIENTRY glClearStencil(GLint s); } + void OVR::GLEContext::glClearStencil_Hook(GLint s) + { + glClearStencil(s); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glClipPlane + extern "C" { GLAPI void GLAPIENTRY glClipPlane(GLenum plane, const GLdouble *equation); } + void OVR::GLEContext::glClipPlane_Hook(GLenum plane, const GLdouble *equation) + { + glClipPlane(plane, equation); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glColor3b + extern "C" { GLAPI void GLAPIENTRY glColor3b(GLbyte red, GLbyte green, GLbyte blue); } + void OVR::GLEContext::glColor3b_Hook(GLbyte red, GLbyte green, GLbyte blue) + { + glColor3b(red, green, blue); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glColor3bv + extern "C" { GLAPI void GLAPIENTRY glColor3bv(const GLbyte *v); } + void OVR::GLEContext::glColor3bv_Hook(const GLbyte *v) + { + glColor3bv(v); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glColor3d + extern "C" { GLAPI void GLAPIENTRY glColor3d(GLdouble red, GLdouble green, GLdouble blue); } + void OVR::GLEContext::glColor3d_Hook(GLdouble red, GLdouble green, GLdouble blue) + { + glColor3d(red, green, blue); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glColor3dv + extern "C" { GLAPI void GLAPIENTRY glColor3dv(const GLdouble *v); } + void OVR::GLEContext::glColor3dv_Hook(const GLdouble *v) + { + glColor3dv(v); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glColor3f + extern "C" { GLAPI void GLAPIENTRY glColor3f(GLfloat red, GLfloat green, GLfloat blue); } + void OVR::GLEContext::glColor3f_Hook(GLfloat red, GLfloat green, GLfloat blue) + { + glColor3f(red, green, blue); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glColor3fv + extern "C" { GLAPI void GLAPIENTRY glColor3fv(const GLfloat *v); } + void OVR::GLEContext::glColor3fv_Hook(const GLfloat *v) + { + glColor3fv(v); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glColor3i + extern "C" { GLAPI void GLAPIENTRY glColor3i(GLint red, GLint green, GLint blue); } + void OVR::GLEContext::glColor3i_Hook(GLint red, GLint green, GLint blue) + { + glColor3i(red, green, blue); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glColor3iv + extern "C" { GLAPI void GLAPIENTRY glColor3iv(const GLint *v); } + void OVR::GLEContext::glColor3iv_Hook(const GLint *v) + { + glColor3iv(v); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glColor3s + extern "C" { GLAPI void GLAPIENTRY glColor3s(GLshort red, GLshort green, GLshort blue); } + void OVR::GLEContext::glColor3s_Hook(GLshort red, GLshort green, GLshort blue) + { + glColor3s(red, green, blue); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glColor3sv + extern "C" { GLAPI void GLAPIENTRY glColor3sv(const GLshort *v); } + void OVR::GLEContext::glColor3sv_Hook(const GLshort *v) + { + glColor3sv(v); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glColor3ub + extern "C" { GLAPI void GLAPIENTRY glColor3ub(GLubyte red, GLubyte green, GLubyte blue); } + void OVR::GLEContext::glColor3ub_Hook(GLubyte red, GLubyte green, GLubyte blue) + { + glColor3ub(red, green, blue); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glColor3ubv + extern "C" { GLAPI void GLAPIENTRY glColor3ubv(const GLubyte *v); } + void OVR::GLEContext::glColor3ubv_Hook(const GLubyte *v) + { + glColor3ubv(v); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glColor3ui + extern "C" { GLAPI void GLAPIENTRY glColor3ui(GLuint red, GLuint green, GLuint blue); } + void OVR::GLEContext::glColor3ui_Hook(GLuint red, GLuint green, GLuint blue) + { + glColor3ui(red, green, blue); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glColor3uiv + extern "C" { GLAPI void GLAPIENTRY glColor3uiv(const GLuint *v); } + void OVR::GLEContext::glColor3uiv_Hook(const GLuint *v) + { + glColor3uiv(v); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glColor3us + extern "C" { GLAPI void GLAPIENTRY glColor3us(GLushort red, GLushort green, GLushort blue); } + void OVR::GLEContext::glColor3us_Hook(GLushort red, GLushort green, GLushort blue) + { + glColor3us(red, green, blue); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glColor3usv + extern "C" { GLAPI void GLAPIENTRY glColor3usv(const GLushort *v); } + void OVR::GLEContext::glColor3usv_Hook(const GLushort *v) + { + glColor3usv(v); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glColor4b + extern "C" { GLAPI void GLAPIENTRY glColor4b(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha); } + void OVR::GLEContext::glColor4b_Hook(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha) + { + glColor4b(red, green, blue, alpha); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glColor4bv + extern "C" { GLAPI void GLAPIENTRY glColor4bv(const GLbyte *v); } + void OVR::GLEContext::glColor4bv_Hook(const GLbyte *v) + { + glColor4bv(v); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glColor4d + extern "C" { GLAPI void GLAPIENTRY glColor4d(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha); } + void OVR::GLEContext::glColor4d_Hook(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha) + { + glColor4d(red, green, blue, alpha); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glColor4dv + extern "C" { GLAPI void GLAPIENTRY glColor4dv(const GLdouble *v); } + void OVR::GLEContext::glColor4dv_Hook(const GLdouble *v) + { + glColor4dv(v); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glColor4f + extern "C" { GLAPI void GLAPIENTRY glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); } + void OVR::GLEContext::glColor4f_Hook(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) + { + glColor4f(red, green, blue, alpha); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glColor4fv + extern "C" { GLAPI void GLAPIENTRY glColor4fv(const GLfloat *v); } + void OVR::GLEContext::glColor4fv_Hook(const GLfloat *v) + { + glColor4fv(v); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glColor4i + extern "C" { GLAPI void GLAPIENTRY glColor4i(GLint red, GLint green, GLint blue, GLint alpha); } + void OVR::GLEContext::glColor4i_Hook(GLint red, GLint green, GLint blue, GLint alpha) + { + glColor4i(red, green, blue, alpha); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glColor4iv + extern "C" { GLAPI void GLAPIENTRY glColor4iv(const GLint *v); } + void OVR::GLEContext::glColor4iv_Hook(const GLint *v) + { + glColor4iv(v); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glColor4s + extern "C" { GLAPI void GLAPIENTRY glColor4s(GLshort red, GLshort green, GLshort blue, GLshort alpha); } + void OVR::GLEContext::glColor4s_Hook(GLshort red, GLshort green, GLshort blue, GLshort alpha) + { + glColor4s(red, green, blue, alpha); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glColor4sv + extern "C" { GLAPI void GLAPIENTRY glColor4sv(const GLshort *v); } + void OVR::GLEContext::glColor4sv_Hook(const GLshort *v) + { + glColor4sv(v); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glColor4ub + extern "C" { GLAPI void GLAPIENTRY glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha); } + void OVR::GLEContext::glColor4ub_Hook(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha) + { + glColor4ub(red, green, blue, alpha); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glColor4ubv + extern "C" { GLAPI void GLAPIENTRY glColor4ubv(const GLubyte *v); } + void OVR::GLEContext::glColor4ubv_Hook(const GLubyte *v) + { + glColor4ubv(v); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glColor4ui + extern "C" { GLAPI void GLAPIENTRY glColor4ui(GLuint red, GLuint green, GLuint blue, GLuint alpha); } + void OVR::GLEContext::glColor4ui_Hook(GLuint red, GLuint green, GLuint blue, GLuint alpha) + { + glColor4ui(red, green, blue, alpha); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glColor4uiv + extern "C" { GLAPI void GLAPIENTRY glColor4uiv(const GLuint *v); } + void OVR::GLEContext::glColor4uiv_Hook(const GLuint *v) + { + glColor4uiv(v); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glColor4us + extern "C" { GLAPI void GLAPIENTRY glColor4us(GLushort red, GLushort green, GLushort blue, GLushort alpha); } + void OVR::GLEContext::glColor4us_Hook(GLushort red, GLushort green, GLushort blue, GLushort alpha) + { + glColor4us(red, green, blue, alpha); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glColor4usv + extern "C" { GLAPI void GLAPIENTRY glColor4usv(const GLushort *v); } + void OVR::GLEContext::glColor4usv_Hook(const GLushort *v) + { + glColor4usv(v); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glColorMask + extern "C" { GLAPI void GLAPIENTRY glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); } + void OVR::GLEContext::glColorMask_Hook(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) + { + glColorMask(red, green, blue, alpha); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glColorMaterial + extern "C" { GLAPI void GLAPIENTRY glColorMaterial(GLenum face, GLenum mode); } + void OVR::GLEContext::glColorMaterial_Hook(GLenum face, GLenum mode) + { + glColorMaterial(face, mode); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glColorPointer + extern "C" { GLAPI void GLAPIENTRY glColorPointer(GLint size, GLenum type, GLsizei stride, const void *pointer); } + void OVR::GLEContext::glColorPointer_Hook(GLint size, GLenum type, GLsizei stride, const void *pointer) + { + glColorPointer(size, type, stride, pointer); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glCopyPixels + extern "C" { GLAPI void GLAPIENTRY glCopyPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type); } + void OVR::GLEContext::glCopyPixels_Hook(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type) + { + glCopyPixels(x, y, width, height, type); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glCopyTexImage1D + extern "C" { GLAPI void GLAPIENTRY glCopyTexImage1D(GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLint border); } + void OVR::GLEContext::glCopyTexImage1D_Hook(GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLint border) + { + glCopyTexImage1D(target, level, internalFormat, x, y, width, border); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glCopyTexImage2D + extern "C" { GLAPI void GLAPIENTRY glCopyTexImage2D(GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); } + void OVR::GLEContext::glCopyTexImage2D_Hook(GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) + { + glCopyTexImage2D(target, level, internalFormat, x, y, width, height, border); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glCopyTexSubImage1D + extern "C" { GLAPI void GLAPIENTRY glCopyTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); } + void OVR::GLEContext::glCopyTexSubImage1D_Hook(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width) + { + glCopyTexSubImage1D(target, level, xoffset, x, y, width); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glCopyTexSubImage2D + extern "C" { GLAPI void GLAPIENTRY glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); } + void OVR::GLEContext::glCopyTexSubImage2D_Hook(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) + { + glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glCullFace + extern "C" { GLAPI void GLAPIENTRY glCullFace(GLenum mode); } + void OVR::GLEContext::glCullFace_Hook(GLenum mode) + { + glCullFace(mode); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glDeleteLists + extern "C" { GLAPI void GLAPIENTRY glDeleteLists(GLuint list, GLsizei range); } + void OVR::GLEContext::glDeleteLists_Hook(GLuint list, GLsizei range) + { + glDeleteLists(list, range); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glDeleteTextures + extern "C" { GLAPI void GLAPIENTRY glDeleteTextures(GLsizei n, const GLuint *textures); } + void OVR::GLEContext::glDeleteTextures_Hook(GLsizei n, const GLuint *textures) + { + glDeleteTextures(n, textures); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glDepthFunc + extern "C" { GLAPI void GLAPIENTRY glDepthFunc(GLenum func); } + void OVR::GLEContext::glDepthFunc_Hook(GLenum func) + { + glDepthFunc(func); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glDepthMask + extern "C" { GLAPI void GLAPIENTRY glDepthMask(GLboolean flag); } + void OVR::GLEContext::glDepthMask_Hook(GLboolean flag) + { + glDepthMask(flag); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glDepthRange + extern "C" { GLAPI void GLAPIENTRY glDepthRange(GLclampd zNear, GLclampd zFar); } + void OVR::GLEContext::glDepthRange_Hook(GLclampd zNear, GLclampd zFar) + { + glDepthRange(zNear, zFar); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glDisable + extern "C" { GLAPI void GLAPIENTRY glDisable(GLenum cap); } + void OVR::GLEContext::glDisable_Hook(GLenum cap) + { + glDisable(cap); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glDisableClientState + extern "C" { GLAPI void GLAPIENTRY glDisableClientState(GLenum array); } + void OVR::GLEContext::glDisableClientState_Hook(GLenum array) + { + glDisableClientState(array); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glDrawArrays + extern "C" { GLAPI void GLAPIENTRY glDrawArrays(GLenum mode, GLint first, GLsizei count); } + void OVR::GLEContext::glDrawArrays_Hook(GLenum mode, GLint first, GLsizei count) + { + glDrawArrays(mode, first, count); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glDrawBuffer + extern "C" { GLAPI void GLAPIENTRY glDrawBuffer(GLenum mode); } + void OVR::GLEContext::glDrawBuffer_Hook(GLenum mode) + { + glDrawBuffer(mode); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glDrawElements + extern "C" { GLAPI void GLAPIENTRY glDrawElements(GLenum mode, GLsizei count, GLenum type, const void *indices); } + void OVR::GLEContext::glDrawElements_Hook(GLenum mode, GLsizei count, GLenum type, const void *indices) + { + glDrawElements(mode, count, type, indices); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glDrawPixels + extern "C" { GLAPI void GLAPIENTRY glDrawPixels(GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels); } + void OVR::GLEContext::glDrawPixels_Hook(GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels) + { + glDrawPixels(width, height, format, type, pixels); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glEdgeFlag + extern "C" { GLAPI void GLAPIENTRY glEdgeFlag(GLboolean flag); } + void OVR::GLEContext::glEdgeFlag_Hook(GLboolean flag) + { + glEdgeFlag(flag); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glEdgeFlagPointer + extern "C" { GLAPI void GLAPIENTRY glEdgeFlagPointer(GLsizei stride, const void *pointer); } + void OVR::GLEContext::glEdgeFlagPointer_Hook(GLsizei stride, const void *pointer) + { + glEdgeFlagPointer(stride, pointer); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glEdgeFlagv + extern "C" { GLAPI void GLAPIENTRY glEdgeFlagv(const GLboolean *flag); } + void OVR::GLEContext::glEdgeFlagv_Hook(const GLboolean *flag) + { + glEdgeFlagv(flag); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glEnable + extern "C" { GLAPI void GLAPIENTRY glEnable(GLenum cap); } + namespace OVR { + void GLEContext::glEnable_Hook(GLenum cap) + { + glEnable(cap); + PostHook(GLE_CURRENT_FUNCTION); + } + } + + #undef glEnableClientState + extern "C" { GLAPI void GLAPIENTRY glEnableClientState(GLenum array); } + void OVR::GLEContext::glEnableClientState_Hook(GLenum array) + { + glEnableClientState(array); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glEnd + extern "C" { GLAPI void GLAPIENTRY glEnd(); } + void OVR::GLEContext::glEnd_Hook() + { + glEnd(); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glEndList + extern "C" { GLAPI void GLAPIENTRY glEndList(); } + void OVR::GLEContext::glEndList_Hook() + { + glEndList(); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glEvalCoord1d + extern "C" { GLAPI void GLAPIENTRY glEvalCoord1d(GLdouble u); } + void OVR::GLEContext::glEvalCoord1d_Hook(GLdouble u) + { + glEvalCoord1d(u); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glEvalCoord1dv + extern "C" { GLAPI void GLAPIENTRY glEvalCoord1dv(const GLdouble *u); } + void OVR::GLEContext::glEvalCoord1dv_Hook(const GLdouble *u) + { + glEvalCoord1dv(u); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glEvalCoord1f + extern "C" { GLAPI void GLAPIENTRY glEvalCoord1f(GLfloat u); } + void OVR::GLEContext::glEvalCoord1f_Hook(GLfloat u) + { + glEvalCoord1f(u); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glEvalCoord1fv + extern "C" { GLAPI void GLAPIENTRY glEvalCoord1fv(const GLfloat *u); } + void OVR::GLEContext::glEvalCoord1fv_Hook(const GLfloat *u) + { + glEvalCoord1fv(u); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glEvalCoord2d + extern "C" { GLAPI void GLAPIENTRY glEvalCoord2d(GLdouble u, GLdouble v); } + void OVR::GLEContext::glEvalCoord2d_Hook(GLdouble u, GLdouble v) + { + glEvalCoord2d(u, v); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glEvalCoord2dv + extern "C" { GLAPI void GLAPIENTRY glEvalCoord2dv(const GLdouble *u); } + void OVR::GLEContext::glEvalCoord2dv_Hook(const GLdouble *u) + { + glEvalCoord2dv(u); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glEvalCoord2f + extern "C" { GLAPI void GLAPIENTRY glEvalCoord2f(GLfloat u, GLfloat v); } + void OVR::GLEContext::glEvalCoord2f_Hook(GLfloat u, GLfloat v) + { + glEvalCoord2f(u, v); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glEvalCoord2fv + extern "C" { GLAPI void GLAPIENTRY glEvalCoord2fv(const GLfloat *u); } + void OVR::GLEContext::glEvalCoord2fv_Hook(const GLfloat *u) + { + glEvalCoord2fv(u); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glEvalMesh1 + extern "C" { GLAPI void GLAPIENTRY glEvalMesh1(GLenum mode, GLint i1, GLint i2); } + void OVR::GLEContext::glEvalMesh1_Hook(GLenum mode, GLint i1, GLint i2) + { + glEvalMesh1(mode, i1, i2); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glEvalMesh2 + extern "C" { GLAPI void GLAPIENTRY glEvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2); } + void OVR::GLEContext::glEvalMesh2_Hook(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2) + { + glEvalMesh2(mode, i1, i2, j1, j2); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glEvalPoint1 + extern "C" { GLAPI void GLAPIENTRY glEvalPoint1(GLint i); } + void OVR::GLEContext::glEvalPoint1_Hook(GLint i) + { + glEvalPoint1(i); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glEvalPoint2 + extern "C" { GLAPI void GLAPIENTRY glEvalPoint2(GLint i, GLint j); } + void OVR::GLEContext::glEvalPoint2_Hook(GLint i, GLint j) + { + glEvalPoint2(i, j); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glFeedbackBuffer + extern "C" { GLAPI void GLAPIENTRY glFeedbackBuffer(GLsizei size, GLenum type, GLfloat *buffer); } + void OVR::GLEContext::glFeedbackBuffer_Hook(GLsizei size, GLenum type, GLfloat *buffer) + { + glFeedbackBuffer(size, type, buffer); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glFinish + extern "C" { GLAPI void GLAPIENTRY glFinish(); } + void OVR::GLEContext::glFinish_Hook() + { + glFinish(); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glFlush + extern "C" { GLAPI void GLAPIENTRY glFlush(); } + void OVR::GLEContext::glFlush_Hook() + { + glFlush(); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glFogf + extern "C" { GLAPI void GLAPIENTRY glFogf(GLenum pname, GLfloat param); } + void OVR::GLEContext::glFogf_Hook(GLenum pname, GLfloat param) + { + glFogf(pname, param); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glFogfv + extern "C" { GLAPI void GLAPIENTRY glFogfv(GLenum pname, const GLfloat *params); } + void OVR::GLEContext::glFogfv_Hook(GLenum pname, const GLfloat *params) + { + glFogfv(pname, params); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glFogi + extern "C" { GLAPI void GLAPIENTRY glFogi(GLenum pname, GLint param); } + void OVR::GLEContext::glFogi_Hook(GLenum pname, GLint param) + { + glFogi(pname, param); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glFogiv + extern "C" { GLAPI void GLAPIENTRY glFogiv(GLenum pname, const GLint *params); } + void OVR::GLEContext::glFogiv_Hook(GLenum pname, const GLint *params) + { + glFogiv(pname, params); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glFrontFace + extern "C" { GLAPI void GLAPIENTRY glFrontFace(GLenum mode); } + void OVR::GLEContext::glFrontFace_Hook(GLenum mode) + { + glFrontFace(mode); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glFrustum + extern "C" { GLAPI void GLAPIENTRY glFrustum(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); } + void OVR::GLEContext::glFrustum_Hook(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar) + { + glFrustum(left, right, bottom, top, zNear, zFar); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glGenLists + extern "C" { GLAPI GLuint GLAPIENTRY glGenLists(GLsizei range); } + GLuint OVR::GLEContext::glGenLists_Hook(GLsizei range) + { + GLuint u = glGenLists(range); + PostHook(GLE_CURRENT_FUNCTION); + return u; + } + + #undef glGenTextures + extern "C" { GLAPI void GLAPIENTRY glGenTextures(GLsizei n, GLuint *textures); } + void OVR::GLEContext::glGenTextures_Hook(GLsizei n, GLuint *textures) + { + glGenTextures(n, textures); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glGetBooleanv + extern "C" { GLAPI void GLAPIENTRY glGetBooleanv(GLenum pname, GLboolean *params); } + void OVR::GLEContext::glGetBooleanv_Hook(GLenum pname, GLboolean *params) + { + glGetBooleanv(pname, params); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glGetClipPlane + extern "C" { GLAPI void GLAPIENTRY glGetClipPlane(GLenum plane, GLdouble *equation); } + void OVR::GLEContext::glGetClipPlane_Hook(GLenum plane, GLdouble *equation) + { + glGetClipPlane(plane, equation); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glGetDoublev + extern "C" { GLAPI void GLAPIENTRY glGetDoublev(GLenum pname, GLdouble *params); } + void OVR::GLEContext::glGetDoublev_Hook(GLenum pname, GLdouble *params) + { + glGetDoublev(pname, params); + PostHook(GLE_CURRENT_FUNCTION); + } + + //#undef glGetError Not needed because we happen to do this above already. + //extern "C" { GLAPI GLenum GLAPIENTRY glGetError(); } + GLenum OVR::GLEContext::glGetError_Hook() + { + GLenum e = glGetError(); + PostHook(GLE_CURRENT_FUNCTION); + return e; + } + + #undef glGetFloatv + extern "C" { GLAPI void GLAPIENTRY glGetFloatv(GLenum pname, GLfloat *params); } + void OVR::GLEContext::glGetFloatv_Hook(GLenum pname, GLfloat *params) + { + glGetFloatv(pname, params); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glGetIntegerv + extern "C" { GLAPI void GLAPIENTRY glGetIntegerv(GLenum pname, GLint *params); } + void OVR::GLEContext::glGetIntegerv_Hook(GLenum pname, GLint *params) + { + glGetIntegerv(pname, params); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glGetLightfv + extern "C" { GLAPI void GLAPIENTRY glGetLightfv(GLenum light, GLenum pname, GLfloat *params); } + void OVR::GLEContext::glGetLightfv_Hook(GLenum light, GLenum pname, GLfloat *params) + { + glGetLightfv(light, pname, params); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glGetLightiv + extern "C" { GLAPI void GLAPIENTRY glGetLightiv(GLenum light, GLenum pname, GLint *params); } + void OVR::GLEContext::glGetLightiv_Hook(GLenum light, GLenum pname, GLint *params) + { + glGetLightiv(light, pname, params); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glGetMapdv + extern "C" { GLAPI void GLAPIENTRY glGetMapdv(GLenum target, GLenum query, GLdouble *v); } + void OVR::GLEContext::glGetMapdv_Hook(GLenum target, GLenum query, GLdouble *v) + { + glGetMapdv(target, query, v); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glGetMapfv + extern "C" { GLAPI void GLAPIENTRY glGetMapfv(GLenum target, GLenum query, GLfloat *v); } + void OVR::GLEContext::glGetMapfv_Hook(GLenum target, GLenum query, GLfloat *v) + { + glGetMapfv(target, query, v); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glGetMapiv + extern "C" { GLAPI void GLAPIENTRY glGetMapiv(GLenum target, GLenum query, GLint *v); } + void OVR::GLEContext::glGetMapiv_Hook(GLenum target, GLenum query, GLint *v) + { + glGetMapiv(target, query, v); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glGetMaterialfv + extern "C" { GLAPI void GLAPIENTRY glGetMaterialfv(GLenum face, GLenum pname, GLfloat *params); } + void OVR::GLEContext::glGetMaterialfv_Hook(GLenum face, GLenum pname, GLfloat *params) + { + glGetMaterialfv(face, pname, params); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glGetMaterialiv + extern "C" { GLAPI void GLAPIENTRY glGetMaterialiv(GLenum face, GLenum pname, GLint *params); } + void OVR::GLEContext::glGetMaterialiv_Hook(GLenum face, GLenum pname, GLint *params) + { + glGetMaterialiv(face, pname, params); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glGetPixelMapfv + extern "C" { GLAPI void GLAPIENTRY glGetPixelMapfv(GLenum map, GLfloat *values); } + void OVR::GLEContext::glGetPixelMapfv_Hook(GLenum map, GLfloat *values) + { + glGetPixelMapfv(map, values); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glGetPixelMapuiv + extern "C" { GLAPI void GLAPIENTRY glGetPixelMapuiv(GLenum map, GLuint *values); } + void OVR::GLEContext::glGetPixelMapuiv_Hook(GLenum map, GLuint *values) + { + glGetPixelMapuiv(map, values); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glGetPixelMapusv + extern "C" { GLAPI void GLAPIENTRY glGetPixelMapusv(GLenum map, GLushort *values); } + void OVR::GLEContext::glGetPixelMapusv_Hook(GLenum map, GLushort *values) + { + glGetPixelMapusv(map, values); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glGetPointerv + extern "C" { GLAPI void GLAPIENTRY glGetPointerv(GLenum pname, void* *params); } + void OVR::GLEContext::glGetPointerv_Hook(GLenum pname, void* *params) + { + glGetPointerv(pname, params); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glGetPolygonStipple + extern "C" { GLAPI void GLAPIENTRY glGetPolygonStipple(GLubyte *mask); } + void OVR::GLEContext::glGetPolygonStipple_Hook(GLubyte *mask) + { + glGetPolygonStipple(mask); + PostHook(GLE_CURRENT_FUNCTION); + } + + // #undef glGetString // This was already disabled above. + // extern "C" { GLAPI const GLubyte * GLAPIENTRY glGetString(GLenum name); } + const GLubyte * OVR::GLEContext::glGetString_Hook(GLenum name) + { + const GLubyte * p = glGetString(name); + PostHook(GLE_CURRENT_FUNCTION); + return p; + } + + #undef glGetTexEnvfv + extern "C" { GLAPI void GLAPIENTRY glGetTexEnvfv(GLenum target, GLenum pname, GLfloat *params); } + void OVR::GLEContext::glGetTexEnvfv_Hook(GLenum target, GLenum pname, GLfloat *params) + { + glGetTexEnvfv(target, pname, params); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glGetTexEnviv + extern "C" { GLAPI void GLAPIENTRY glGetTexEnviv(GLenum target, GLenum pname, GLint *params); } + void OVR::GLEContext::glGetTexEnviv_Hook(GLenum target, GLenum pname, GLint *params) + { + glGetTexEnviv(target, pname, params); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glGetTexGendv + extern "C" { GLAPI void GLAPIENTRY glGetTexGendv(GLenum coord, GLenum pname, GLdouble *params); } + void OVR::GLEContext::glGetTexGendv_Hook(GLenum coord, GLenum pname, GLdouble *params) + { + glGetTexGendv(coord, pname, params); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glGetTexGenfv + extern "C" { GLAPI void GLAPIENTRY glGetTexGenfv(GLenum coord, GLenum pname, GLfloat *params); } + void OVR::GLEContext::glGetTexGenfv_Hook(GLenum coord, GLenum pname, GLfloat *params) + { + glGetTexGenfv(coord, pname, params); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glGetTexGeniv + extern "C" { GLAPI void GLAPIENTRY glGetTexGeniv(GLenum coord, GLenum pname, GLint *params); } + void OVR::GLEContext::glGetTexGeniv_Hook(GLenum coord, GLenum pname, GLint *params) + { + glGetTexGeniv(coord, pname, params); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glGetTexImage + extern "C" { GLAPI void GLAPIENTRY glGetTexImage(GLenum target, GLint level, GLenum format, GLenum type, void *pixels); } + void OVR::GLEContext::glGetTexImage_Hook(GLenum target, GLint level, GLenum format, GLenum type, void *pixels) + { + glGetTexImage(target, level, format, type, pixels); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glGetTexLevelParameterfv + extern "C" { GLAPI void GLAPIENTRY glGetTexLevelParameterfv(GLenum target, GLint level, GLenum pname, GLfloat *params); } + void OVR::GLEContext::glGetTexLevelParameterfv_Hook(GLenum target, GLint level, GLenum pname, GLfloat *params) + { + glGetTexLevelParameterfv(target, level, pname, params); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glGetTexLevelParameteriv + extern "C" { GLAPI void GLAPIENTRY glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params); } + void OVR::GLEContext::glGetTexLevelParameteriv_Hook(GLenum target, GLint level, GLenum pname, GLint *params) + { + glGetTexLevelParameteriv(target, level, pname, params); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glGetTexParameterfv + extern "C" { GLAPI void GLAPIENTRY glGetTexParameterfv(GLenum target, GLenum pname, GLfloat *params); } + void OVR::GLEContext::glGetTexParameterfv_Hook(GLenum target, GLenum pname, GLfloat *params) + { + glGetTexParameterfv(target, pname, params); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glGetTexParameteriv + extern "C" { GLAPI void GLAPIENTRY glGetTexParameteriv(GLenum target, GLenum pname, GLint *params); } + void OVR::GLEContext::glGetTexParameteriv_Hook(GLenum target, GLenum pname, GLint *params) + { + glGetTexParameteriv(target, pname, params); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glHint + extern "C" { GLAPI void GLAPIENTRY glHint(GLenum target, GLenum mode); } + void OVR::GLEContext::glHint_Hook(GLenum target, GLenum mode) + { + glHint(target, mode); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glIndexMask + extern "C" { GLAPI void GLAPIENTRY glIndexMask(GLuint mask); } + void OVR::GLEContext::glIndexMask_Hook(GLuint mask) + { + glIndexMask(mask); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glIndexPointer + extern "C" { GLAPI void GLAPIENTRY glIndexPointer(GLenum type, GLsizei stride, const void *pointer); } + void OVR::GLEContext::glIndexPointer_Hook(GLenum type, GLsizei stride, const void *pointer) + { + glIndexPointer(type, stride, pointer); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glIndexd + extern "C" { GLAPI void GLAPIENTRY glIndexd(GLdouble c); } + void OVR::GLEContext::glIndexd_Hook(GLdouble c) + { + glIndexd(c); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glIndexdv + extern "C" { GLAPI void GLAPIENTRY glIndexdv(const GLdouble *c); } + void OVR::GLEContext::glIndexdv_Hook(const GLdouble *c) + { + glIndexdv(c); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glIndexf + extern "C" { GLAPI void GLAPIENTRY glIndexf(GLfloat c); } + void OVR::GLEContext::glIndexf_Hook(GLfloat c) + { + glIndexf(c); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glIndexfv + extern "C" { GLAPI void GLAPIENTRY glIndexfv(const GLfloat *c); } + void OVR::GLEContext::glIndexfv_Hook(const GLfloat *c) + { + glIndexfv(c); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glIndexi + extern "C" { GLAPI void GLAPIENTRY glIndexi(GLint c); } + void OVR::GLEContext::glIndexi_Hook(GLint c) + { + glIndexi(c); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glIndexiv + extern "C" { GLAPI void GLAPIENTRY glIndexiv(const GLint *c); } + void OVR::GLEContext::glIndexiv_Hook(const GLint *c) + { + glIndexiv(c); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glIndexs + extern "C" { GLAPI void GLAPIENTRY glIndexs(GLshort c); } + void OVR::GLEContext::glIndexs_Hook(GLshort c) + { + glIndexs(c); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glIndexsv + extern "C" { GLAPI void GLAPIENTRY glIndexsv(const GLshort *c); } + void OVR::GLEContext::glIndexsv_Hook(const GLshort *c) + { + glIndexsv(c); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glIndexub + extern "C" { GLAPI void GLAPIENTRY glIndexub(GLubyte c); } + void OVR::GLEContext::glIndexub_Hook(GLubyte c) + { + glIndexub(c); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glIndexubv + extern "C" { GLAPI void GLAPIENTRY glIndexubv(const GLubyte *c); } + void OVR::GLEContext::glIndexubv_Hook(const GLubyte *c) + { + glIndexubv(c); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glInitNames + extern "C" { GLAPI void GLAPIENTRY glInitNames(); } + void OVR::GLEContext::glInitNames_Hook() + { + glInitNames(); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glInterleavedArrays + extern "C" { GLAPI void GLAPIENTRY glInterleavedArrays(GLenum format, GLsizei stride, const void *pointer); } + void OVR::GLEContext::glInterleavedArrays_Hook(GLenum format, GLsizei stride, const void *pointer) + { + glInterleavedArrays(format, stride, pointer); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glIsEnabled + extern "C" { GLAPI GLboolean GLAPIENTRY glIsEnabled(GLenum cap); } + GLboolean OVR::GLEContext::glIsEnabled_Hook(GLenum cap) + { + GLboolean b = glIsEnabled(cap); + PostHook(GLE_CURRENT_FUNCTION); + return b; + } + + #undef glIsList + extern "C" { GLAPI GLboolean GLAPIENTRY glIsList(GLuint list); } + GLboolean OVR::GLEContext::glIsList_Hook(GLuint list) + { + GLboolean b = glIsList(list); + PostHook(GLE_CURRENT_FUNCTION); + return b; + } + + #undef glIsTexture + extern "C" { GLAPI GLboolean GLAPIENTRY glIsTexture(GLuint texture); } + GLboolean OVR::GLEContext::glIsTexture_Hook(GLuint texture) + { + GLboolean b = glIsTexture(texture); + PostHook(GLE_CURRENT_FUNCTION); + return b; + } + + #undef glLightModelf + extern "C" { GLAPI void GLAPIENTRY glLightModelf(GLenum pname, GLfloat param); } + void OVR::GLEContext::glLightModelf_Hook(GLenum pname, GLfloat param) + { + glLightModelf(pname, param); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glLightModelfv + extern "C" { GLAPI void GLAPIENTRY glLightModelfv(GLenum pname, const GLfloat *params); } + void OVR::GLEContext::glLightModelfv_Hook(GLenum pname, const GLfloat *params) + { + glLightModelfv(pname, params); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glLightModeli + extern "C" { GLAPI void GLAPIENTRY glLightModeli(GLenum pname, GLint param); } + void OVR::GLEContext::glLightModeli_Hook(GLenum pname, GLint param) + { + glLightModeli(pname, param); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glLightModeliv + extern "C" { GLAPI void GLAPIENTRY glLightModeliv(GLenum pname, const GLint *params); } + void OVR::GLEContext::glLightModeliv_Hook(GLenum pname, const GLint *params) + { + glLightModeliv(pname, params); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glLightf + extern "C" { GLAPI void GLAPIENTRY glLightf(GLenum light, GLenum pname, GLfloat param); } + void OVR::GLEContext::glLightf_Hook(GLenum light, GLenum pname, GLfloat param) + { + glLightf(light, pname, param); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glLightfv + extern "C" { GLAPI void GLAPIENTRY glLightfv(GLenum light, GLenum pname, const GLfloat *params); } + void OVR::GLEContext::glLightfv_Hook(GLenum light, GLenum pname, const GLfloat *params) + { + glLightfv(light, pname, params); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glLighti + extern "C" { GLAPI void GLAPIENTRY glLighti(GLenum light, GLenum pname, GLint param); } + void OVR::GLEContext::glLighti_Hook(GLenum light, GLenum pname, GLint param) + { + glLighti(light, pname, param); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glLightiv + extern "C" { GLAPI void GLAPIENTRY glLightiv(GLenum light, GLenum pname, const GLint *params); } + void OVR::GLEContext::glLightiv_Hook(GLenum light, GLenum pname, const GLint *params) + { + glLightiv(light, pname, params); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glLineStipple + extern "C" { GLAPI void GLAPIENTRY glLineStipple(GLint factor, GLushort pattern); } + void OVR::GLEContext::glLineStipple_Hook(GLint factor, GLushort pattern) + { + glLineStipple(factor, pattern); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glLineWidth + extern "C" { GLAPI void GLAPIENTRY glLineWidth(GLfloat width); } + void OVR::GLEContext::glLineWidth_Hook(GLfloat width) + { + glLineWidth(width); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glListBase + extern "C" { GLAPI void GLAPIENTRY glListBase(GLuint base); } + void OVR::GLEContext::glListBase_Hook(GLuint base) + { + glListBase(base); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glLoadIdentity + extern "C" { GLAPI void GLAPIENTRY glLoadIdentity(); } + void OVR::GLEContext::glLoadIdentity_Hook() + { + glLoadIdentity(); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glLoadMatrixd + extern "C" { GLAPI void GLAPIENTRY glLoadMatrixd(const GLdouble *m); } + void OVR::GLEContext::glLoadMatrixd_Hook(const GLdouble *m) + { + glLoadMatrixd(m); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glLoadMatrixf + extern "C" { GLAPI void GLAPIENTRY glLoadMatrixf(const GLfloat *m); } + void OVR::GLEContext::glLoadMatrixf_Hook(const GLfloat *m) + { + glLoadMatrixf(m); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glLoadName + extern "C" { GLAPI void GLAPIENTRY glLoadName(GLuint name); } + void OVR::GLEContext::glLoadName_Hook(GLuint name) + { + glLoadName(name); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glLogicOp + extern "C" { GLAPI void GLAPIENTRY glLogicOp(GLenum opcode); } + void OVR::GLEContext::glLogicOp_Hook(GLenum opcode) + { + glLogicOp(opcode); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glMap1d + extern "C" { GLAPI void GLAPIENTRY glMap1d(GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points); } + void OVR::GLEContext::glMap1d_Hook(GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points) + { + glMap1d(target, u1, u2, stride, order, points); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glMap1f + extern "C" { GLAPI void GLAPIENTRY glMap1f(GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points); } + void OVR::GLEContext::glMap1f_Hook(GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points) + { + glMap1f(target, u1, u2, stride, order, points); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glMap2d + extern "C" { GLAPI void GLAPIENTRY glMap2d(GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points); } + void OVR::GLEContext::glMap2d_Hook(GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points) + { + glMap2d(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glMap2f + extern "C" { GLAPI void GLAPIENTRY glMap2f(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points); } + void OVR::GLEContext::glMap2f_Hook(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points) + { + glMap2f(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glMapGrid1d + extern "C" { GLAPI void GLAPIENTRY glMapGrid1d(GLint un, GLdouble u1, GLdouble u2); } + void OVR::GLEContext::glMapGrid1d_Hook(GLint un, GLdouble u1, GLdouble u2) + { + glMapGrid1d(un, u1, u2); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glMapGrid1f + extern "C" { GLAPI void GLAPIENTRY glMapGrid1f(GLint un, GLfloat u1, GLfloat u2); } + void OVR::GLEContext::glMapGrid1f_Hook(GLint un, GLfloat u1, GLfloat u2) + { + glMapGrid1f(un, u1, u2); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glMapGrid2d + extern "C" { GLAPI void GLAPIENTRY glMapGrid2d(GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2); } + void OVR::GLEContext::glMapGrid2d_Hook(GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2) + { + glMapGrid2d(un, u1, u2, vn, v1, v2); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glMapGrid2f + extern "C" { GLAPI void GLAPIENTRY glMapGrid2f(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2); } + void OVR::GLEContext::glMapGrid2f_Hook(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2) + { + glMapGrid2f(un, u1, u2, vn, v1, v2); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glMaterialf + extern "C" { GLAPI void GLAPIENTRY glMaterialf(GLenum face, GLenum pname, GLfloat param); } + void OVR::GLEContext::glMaterialf_Hook(GLenum face, GLenum pname, GLfloat param) + { + glMaterialf(face, pname, param); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glMaterialfv + extern "C" { GLAPI void GLAPIENTRY glMaterialfv(GLenum face, GLenum pname, const GLfloat *params); } + void OVR::GLEContext::glMaterialfv_Hook(GLenum face, GLenum pname, const GLfloat *params) + { + glMaterialfv(face, pname, params); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glMateriali + extern "C" { GLAPI void GLAPIENTRY glMateriali(GLenum face, GLenum pname, GLint param); } + void OVR::GLEContext::glMateriali_Hook(GLenum face, GLenum pname, GLint param) + { + glMateriali(face, pname, param); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glMaterialiv + extern "C" { GLAPI void GLAPIENTRY glMaterialiv(GLenum face, GLenum pname, const GLint *params); } + void OVR::GLEContext::glMaterialiv_Hook(GLenum face, GLenum pname, const GLint *params) + { + glMaterialiv(face, pname, params); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glMatrixMode + extern "C" { GLAPI void GLAPIENTRY glMatrixMode(GLenum mode); } + void OVR::GLEContext::glMatrixMode_Hook(GLenum mode) + { + glMatrixMode(mode); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glMultMatrixd + extern "C" { GLAPI void GLAPIENTRY glMultMatrixd(const GLdouble *m); } + void OVR::GLEContext::glMultMatrixd_Hook(const GLdouble *m) + { + glMultMatrixd(m); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glMultMatrixf + extern "C" { GLAPI void GLAPIENTRY glMultMatrixf(const GLfloat *m); } + void OVR::GLEContext::glMultMatrixf_Hook(const GLfloat *m) + { + glMultMatrixf(m); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glNewList + extern "C" { GLAPI void GLAPIENTRY glNewList(GLuint list, GLenum mode); } + void OVR::GLEContext::glNewList_Hook(GLuint list, GLenum mode) + { + glNewList(list, mode); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glNormal3b + extern "C" { GLAPI void GLAPIENTRY glNormal3b(GLbyte nx, GLbyte ny, GLbyte nz); } + void OVR::GLEContext::glNormal3b_Hook(GLbyte nx, GLbyte ny, GLbyte nz) + { + glNormal3b(nx, ny, nz); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glNormal3bv + extern "C" { GLAPI void GLAPIENTRY glNormal3bv(const GLbyte *v); } + void OVR::GLEContext::glNormal3bv_Hook(const GLbyte *v) + { + glNormal3bv(v); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glNormal3d + extern "C" { GLAPI void GLAPIENTRY glNormal3d(GLdouble nx, GLdouble ny, GLdouble nz); } + void OVR::GLEContext::glNormal3d_Hook(GLdouble nx, GLdouble ny, GLdouble nz) + { + glNormal3d(nx, ny, nz); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glNormal3dv + extern "C" { GLAPI void GLAPIENTRY glNormal3dv(const GLdouble *v); } + void OVR::GLEContext::glNormal3dv_Hook(const GLdouble *v) + { + glNormal3dv(v); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glNormal3f + extern "C" { GLAPI void GLAPIENTRY glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz); } + void OVR::GLEContext::glNormal3f_Hook(GLfloat nx, GLfloat ny, GLfloat nz) + { + glNormal3f(nx, ny, nz); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glNormal3fv + extern "C" { GLAPI void GLAPIENTRY glNormal3fv(const GLfloat *v); } + void OVR::GLEContext::glNormal3fv_Hook(const GLfloat *v) + { + glNormal3fv(v); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glNormal3i + extern "C" { GLAPI void GLAPIENTRY glNormal3i(GLint nx, GLint ny, GLint nz); } + void OVR::GLEContext::glNormal3i_Hook(GLint nx, GLint ny, GLint nz) + { + glNormal3i(nx, ny, nz); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glNormal3iv + extern "C" { GLAPI void GLAPIENTRY glNormal3iv(const GLint *v); } + void OVR::GLEContext::glNormal3iv_Hook(const GLint *v) + { + glNormal3iv(v); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glNormal3s + extern "C" { GLAPI void GLAPIENTRY glNormal3s(GLshort nx, GLshort ny, GLshort nz); } + void OVR::GLEContext::glNormal3s_Hook(GLshort nx, GLshort ny, GLshort nz) + { + glNormal3s(nx, ny, nz); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glNormal3sv + extern "C" { GLAPI void GLAPIENTRY glNormal3sv(const GLshort *v); } + void OVR::GLEContext::glNormal3sv_Hook(const GLshort *v) + { + glNormal3sv(v); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glNormalPointer + extern "C" { GLAPI void GLAPIENTRY glNormalPointer(GLenum type, GLsizei stride, const void *pointer); } + void OVR::GLEContext::glNormalPointer_Hook(GLenum type, GLsizei stride, const void *pointer) + { + glNormalPointer(type, stride, pointer); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glOrtho + extern "C" { GLAPI void GLAPIENTRY glOrtho(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); } + void OVR::GLEContext::glOrtho_Hook(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar) + { + glOrtho(left, right, bottom, top, zNear, zFar); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glPassThrough + extern "C" { GLAPI void GLAPIENTRY glPassThrough(GLfloat token); } + void OVR::GLEContext::glPassThrough_Hook(GLfloat token) + { + glPassThrough(token); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glPixelMapfv + extern "C" { GLAPI void GLAPIENTRY glPixelMapfv(GLenum map, GLsizei mapsize, const GLfloat *values); } + void OVR::GLEContext::glPixelMapfv_Hook(GLenum map, GLsizei mapsize, const GLfloat *values) + { + glPixelMapfv(map, mapsize, values); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glPixelMapuiv + extern "C" { GLAPI void GLAPIENTRY glPixelMapuiv(GLenum map, GLsizei mapsize, const GLuint *values); } + void OVR::GLEContext::glPixelMapuiv_Hook(GLenum map, GLsizei mapsize, const GLuint *values) + { + glPixelMapuiv(map, mapsize, values); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glPixelMapusv + extern "C" { GLAPI void GLAPIENTRY glPixelMapusv(GLenum map, GLsizei mapsize, const GLushort *values); } + void OVR::GLEContext::glPixelMapusv_Hook(GLenum map, GLsizei mapsize, const GLushort *values) + { + glPixelMapusv(map, mapsize, values); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glPixelStoref + extern "C" { GLAPI void GLAPIENTRY glPixelStoref(GLenum pname, GLfloat param); } + void OVR::GLEContext::glPixelStoref_Hook(GLenum pname, GLfloat param) + { + glPixelStoref(pname, param); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glPixelStorei + extern "C" { GLAPI void GLAPIENTRY glPixelStorei(GLenum pname, GLint param); } + void OVR::GLEContext::glPixelStorei_Hook(GLenum pname, GLint param) + { + glPixelStorei(pname, param); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glPixelTransferf + extern "C" { GLAPI void GLAPIENTRY glPixelTransferf(GLenum pname, GLfloat param); } + void OVR::GLEContext::glPixelTransferf_Hook(GLenum pname, GLfloat param) + { + glPixelTransferf(pname, param); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glPixelTransferi + extern "C" { GLAPI void GLAPIENTRY glPixelTransferi(GLenum pname, GLint param); } + void OVR::GLEContext::glPixelTransferi_Hook(GLenum pname, GLint param) + { + glPixelTransferi(pname, param); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glPixelZoom + extern "C" { GLAPI void GLAPIENTRY glPixelZoom(GLfloat xfactor, GLfloat yfactor); } + void OVR::GLEContext::glPixelZoom_Hook(GLfloat xfactor, GLfloat yfactor) + { + glPixelZoom(xfactor, yfactor); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glPointSize + extern "C" { GLAPI void GLAPIENTRY glPointSize(GLfloat size); } + void OVR::GLEContext::glPointSize_Hook(GLfloat size) + { + glPointSize(size); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glPolygonMode + extern "C" { GLAPI void GLAPIENTRY glPolygonMode(GLenum face, GLenum mode); } + void OVR::GLEContext::glPolygonMode_Hook(GLenum face, GLenum mode) + { + glPolygonMode(face, mode); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glPolygonOffset + extern "C" { GLAPI void GLAPIENTRY glPolygonOffset(GLfloat factor, GLfloat units); } + void OVR::GLEContext::glPolygonOffset_Hook(GLfloat factor, GLfloat units) + { + glPolygonOffset(factor, units); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glPolygonStipple + extern "C" { GLAPI void GLAPIENTRY glPolygonStipple(const GLubyte *mask); } + void OVR::GLEContext::glPolygonStipple_Hook(const GLubyte *mask) + { + glPolygonStipple(mask); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glPopAttrib + extern "C" { GLAPI void GLAPIENTRY glPopAttrib(); } + void OVR::GLEContext::glPopAttrib_Hook() + { + glPopAttrib(); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glPopClientAttrib + extern "C" { GLAPI void GLAPIENTRY glPopClientAttrib(); } + void OVR::GLEContext::glPopClientAttrib_Hook() + { + glPopClientAttrib(); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glPopMatrix + extern "C" { GLAPI void GLAPIENTRY glPopMatrix(); } + void OVR::GLEContext::glPopMatrix_Hook() + { + glPopMatrix(); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glPopName + extern "C" { GLAPI void GLAPIENTRY glPopName(); } + void OVR::GLEContext::glPopName_Hook() + { + glPopName(); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glPrioritizeTextures + extern "C" { GLAPI void GLAPIENTRY glPrioritizeTextures(GLsizei n, const GLuint *textures, const GLclampf *priorities); } + void OVR::GLEContext::glPrioritizeTextures_Hook(GLsizei n, const GLuint *textures, const GLclampf *priorities) + { + glPrioritizeTextures(n, textures, priorities); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glPushAttrib + extern "C" { GLAPI void GLAPIENTRY glPushAttrib(GLbitfield mask); } + void OVR::GLEContext::glPushAttrib_Hook(GLbitfield mask) + { + glPushAttrib(mask); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glPushClientAttrib + extern "C" { GLAPI void GLAPIENTRY glPushClientAttrib(GLbitfield mask); } + void OVR::GLEContext::glPushClientAttrib_Hook(GLbitfield mask) + { + glPushClientAttrib(mask); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glPushMatrix + extern "C" { GLAPI void GLAPIENTRY glPushMatrix(); } + void OVR::GLEContext::glPushMatrix_Hook() + { + glPushMatrix(); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glPushName + extern "C" { GLAPI void GLAPIENTRY glPushName(GLuint name); } + void OVR::GLEContext::glPushName_Hook(GLuint name) + { + glPushName(name); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glRasterPos2d + extern "C" { GLAPI void GLAPIENTRY glRasterPos2d(GLdouble x, GLdouble y); } + void OVR::GLEContext::glRasterPos2d_Hook(GLdouble x, GLdouble y) + { + glRasterPos2d(x, y); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glRasterPos2dv + extern "C" { GLAPI void GLAPIENTRY glRasterPos2dv(const GLdouble *v); } + void OVR::GLEContext::glRasterPos2dv_Hook(const GLdouble *v) + { + glRasterPos2dv(v); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glRasterPos2f + extern "C" { GLAPI void GLAPIENTRY glRasterPos2f(GLfloat x, GLfloat y); } + void OVR::GLEContext::glRasterPos2f_Hook(GLfloat x, GLfloat y) + { + glRasterPos2f(x, y); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glRasterPos2fv + extern "C" { GLAPI void GLAPIENTRY glRasterPos2fv(const GLfloat *v); } + void OVR::GLEContext::glRasterPos2fv_Hook(const GLfloat *v) + { + glRasterPos2fv(v); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glRasterPos2i + extern "C" { GLAPI void GLAPIENTRY glRasterPos2i(GLint x, GLint y); } + void OVR::GLEContext::glRasterPos2i_Hook(GLint x, GLint y) + { + glRasterPos2i(x, y); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glRasterPos2iv + extern "C" { GLAPI void GLAPIENTRY glRasterPos2iv(const GLint *v); } + void OVR::GLEContext::glRasterPos2iv_Hook(const GLint *v) + { + glRasterPos2iv(v); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glRasterPos2s + extern "C" { GLAPI void GLAPIENTRY glRasterPos2s(GLshort x, GLshort y); } + void OVR::GLEContext::glRasterPos2s_Hook(GLshort x, GLshort y) + { + glRasterPos2s(x, y); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glRasterPos2sv + extern "C" { GLAPI void GLAPIENTRY glRasterPos2sv(const GLshort *v); } + void OVR::GLEContext::glRasterPos2sv_Hook(const GLshort *v) + { + glRasterPos2sv(v); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glRasterPos3d + extern "C" { GLAPI void GLAPIENTRY glRasterPos3d(GLdouble x, GLdouble y, GLdouble z); } + void OVR::GLEContext::glRasterPos3d_Hook(GLdouble x, GLdouble y, GLdouble z) + { + glRasterPos3d(x, y, z); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glRasterPos3dv + extern "C" { GLAPI void GLAPIENTRY glRasterPos3dv(const GLdouble *v); } + void OVR::GLEContext::glRasterPos3dv_Hook(const GLdouble *v) + { + glRasterPos3dv(v); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glRasterPos3f + extern "C" { GLAPI void GLAPIENTRY glRasterPos3f(GLfloat x, GLfloat y, GLfloat z); } + void OVR::GLEContext::glRasterPos3f_Hook(GLfloat x, GLfloat y, GLfloat z) + { + glRasterPos3f(x, y, z); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glRasterPos3fv + extern "C" { GLAPI void GLAPIENTRY glRasterPos3fv(const GLfloat *v); } + void OVR::GLEContext::glRasterPos3fv_Hook(const GLfloat *v) + { + glRasterPos3fv(v); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glRasterPos3i + extern "C" { GLAPI void GLAPIENTRY glRasterPos3i(GLint x, GLint y, GLint z); } + void OVR::GLEContext::glRasterPos3i_Hook(GLint x, GLint y, GLint z) + { + glRasterPos3i(x, y, z); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glRasterPos3iv + extern "C" { GLAPI void GLAPIENTRY glRasterPos3iv(const GLint *v); } + void OVR::GLEContext::glRasterPos3iv_Hook(const GLint *v) + { + glRasterPos3iv(v); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glRasterPos3s + extern "C" { GLAPI void GLAPIENTRY glRasterPos3s(GLshort x, GLshort y, GLshort z); } + void OVR::GLEContext::glRasterPos3s_Hook(GLshort x, GLshort y, GLshort z) + { + glRasterPos3s(x, y, z); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glRasterPos3sv + extern "C" { GLAPI void GLAPIENTRY glRasterPos3sv(const GLshort *v); } + void OVR::GLEContext::glRasterPos3sv_Hook(const GLshort *v) + { + glRasterPos3sv(v); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glRasterPos4d + extern "C" { GLAPI void GLAPIENTRY glRasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w); } + void OVR::GLEContext::glRasterPos4d_Hook(GLdouble x, GLdouble y, GLdouble z, GLdouble w) + { + glRasterPos4d(x, y, z, w); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glRasterPos4dv + extern "C" { GLAPI void GLAPIENTRY glRasterPos4dv(const GLdouble *v); } + void OVR::GLEContext::glRasterPos4dv_Hook(const GLdouble *v) + { + glRasterPos4dv(v); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glRasterPos4f + extern "C" { GLAPI void GLAPIENTRY glRasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w); } + void OVR::GLEContext::glRasterPos4f_Hook(GLfloat x, GLfloat y, GLfloat z, GLfloat w) + { + glRasterPos4f(x, y, z, w); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glRasterPos4fv + extern "C" { GLAPI void GLAPIENTRY glRasterPos4fv(const GLfloat *v); } + void OVR::GLEContext::glRasterPos4fv_Hook(const GLfloat *v) + { + glRasterPos4fv(v); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glRasterPos4i + extern "C" { GLAPI void GLAPIENTRY glRasterPos4i(GLint x, GLint y, GLint z, GLint w); } + void OVR::GLEContext::glRasterPos4i_Hook(GLint x, GLint y, GLint z, GLint w) + { + glRasterPos4i(x, y, z, w); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glRasterPos4iv + extern "C" { GLAPI void GLAPIENTRY glRasterPos4iv(const GLint *v); } + void OVR::GLEContext::glRasterPos4iv_Hook(const GLint *v) + { + glRasterPos4iv(v); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glRasterPos4s + extern "C" { GLAPI void GLAPIENTRY glRasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w); } + void OVR::GLEContext::glRasterPos4s_Hook(GLshort x, GLshort y, GLshort z, GLshort w) + { + glRasterPos4s(x, y, z, w); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glRasterPos4sv + extern "C" { GLAPI void GLAPIENTRY glRasterPos4sv(const GLshort *v); } + void OVR::GLEContext::glRasterPos4sv_Hook(const GLshort *v) + { + glRasterPos4sv(v); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glReadBuffer + extern "C" { GLAPI void GLAPIENTRY glReadBuffer(GLenum mode); } + void OVR::GLEContext::glReadBuffer_Hook(GLenum mode) + { + glReadBuffer(mode); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glReadPixels + extern "C" { GLAPI void GLAPIENTRY glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels); } + void OVR::GLEContext::glReadPixels_Hook(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels) + { + glReadPixels(x, y, width, height, format, type, pixels); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glRectd + extern "C" { GLAPI void GLAPIENTRY glRectd(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2); } + void OVR::GLEContext::glRectd_Hook(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2) + { + glRectd(x1, y1, x2, y2); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glRectdv + extern "C" { GLAPI void GLAPIENTRY glRectdv(const GLdouble *v1, const GLdouble *v2); } + void OVR::GLEContext::glRectdv_Hook(const GLdouble *v1, const GLdouble *v2) + { + glRectdv(v1, v2); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glRectf + extern "C" { GLAPI void GLAPIENTRY glRectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2); } + void OVR::GLEContext::glRectf_Hook(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2) + { + glRectf(x1, y1, x2, y2); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glRectfv + extern "C" { GLAPI void GLAPIENTRY glRectfv(const GLfloat *v1, const GLfloat *v2); } + void OVR::GLEContext::glRectfv_Hook(const GLfloat *v1, const GLfloat *v2) + { + glRectfv(v1, v2); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glRecti + extern "C" { GLAPI void GLAPIENTRY glRecti(GLint x1, GLint y1, GLint x2, GLint y2); } + void OVR::GLEContext::glRecti_Hook(GLint x1, GLint y1, GLint x2, GLint y2) + { + glRecti(x1, y1, x2, y2); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glRectiv + extern "C" { GLAPI void GLAPIENTRY glRectiv(const GLint *v1, const GLint *v2); } + void OVR::GLEContext::glRectiv_Hook(const GLint *v1, const GLint *v2) + { + glRectiv(v1, v2); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glRects + extern "C" { GLAPI void GLAPIENTRY glRects(GLshort x1, GLshort y1, GLshort x2, GLshort y2); } + void OVR::GLEContext::glRects_Hook(GLshort x1, GLshort y1, GLshort x2, GLshort y2) + { + glRects(x1, y1, x2, y2); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glRectsv + extern "C" { GLAPI void GLAPIENTRY glRectsv(const GLshort *v1, const GLshort *v2); } + void OVR::GLEContext::glRectsv_Hook(const GLshort *v1, const GLshort *v2) + { + glRectsv(v1, v2); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glRenderMode + extern "C" { GLAPI GLint GLAPIENTRY glRenderMode(GLenum mode); } + GLint OVR::GLEContext::glRenderMode_Hook(GLenum mode) + { + GLint i = glRenderMode(mode); + PostHook(GLE_CURRENT_FUNCTION); + return i; + } + + #undef glRotated + extern "C" { GLAPI void GLAPIENTRY glRotated(GLdouble angle, GLdouble x, GLdouble y, GLdouble z); } + void OVR::GLEContext::glRotated_Hook(GLdouble angle, GLdouble x, GLdouble y, GLdouble z) + { + glRotated(angle, x, y, z); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glRotatef + extern "C" { GLAPI void GLAPIENTRY glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z); } + void OVR::GLEContext::glRotatef_Hook(GLfloat angle, GLfloat x, GLfloat y, GLfloat z) + { + glRotatef(angle, x, y, z); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glScaled + extern "C" { GLAPI void GLAPIENTRY glScaled(GLdouble x, GLdouble y, GLdouble z); } + void OVR::GLEContext::glScaled_Hook(GLdouble x, GLdouble y, GLdouble z) + { + glScaled(x, y, z); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glScalef + extern "C" { GLAPI void GLAPIENTRY glScalef(GLfloat x, GLfloat y, GLfloat z); } + void OVR::GLEContext::glScalef_Hook(GLfloat x, GLfloat y, GLfloat z) + { + glScalef(x, y, z); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glScissor + extern "C" { GLAPI void GLAPIENTRY glScissor(GLint x, GLint y, GLsizei width, GLsizei height); } + void OVR::GLEContext::glScissor_Hook(GLint x, GLint y, GLsizei width, GLsizei height) + { + glScissor(x, y, width, height); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glSelectBuffer + extern "C" { GLAPI void GLAPIENTRY glSelectBuffer(GLsizei size, GLuint *buffer); } + void OVR::GLEContext::glSelectBuffer_Hook(GLsizei size, GLuint *buffer) + { + glSelectBuffer(size, buffer); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glShadeModel + extern "C" { GLAPI void GLAPIENTRY glShadeModel(GLenum mode); } + void OVR::GLEContext::glShadeModel_Hook(GLenum mode) + { + glShadeModel(mode); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glStencilFunc + extern "C" { GLAPI void GLAPIENTRY glStencilFunc(GLenum func, GLint ref, GLuint mask); } + void OVR::GLEContext::glStencilFunc_Hook(GLenum func, GLint ref, GLuint mask) + { + glStencilFunc(func, ref, mask); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glStencilMask + extern "C" { GLAPI void GLAPIENTRY glStencilMask(GLuint mask); } + void OVR::GLEContext::glStencilMask_Hook(GLuint mask) + { + glStencilMask(mask); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glStencilOp + extern "C" { GLAPI void GLAPIENTRY glStencilOp(GLenum fail, GLenum zfail, GLenum zpass); } + void OVR::GLEContext::glStencilOp_Hook(GLenum fail, GLenum zfail, GLenum zpass) + { + glStencilOp(fail, zfail, zpass); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glTexCoord1d + extern "C" { GLAPI void GLAPIENTRY glTexCoord1d(GLdouble s); } + void OVR::GLEContext::glTexCoord1d_Hook(GLdouble s) + { + glTexCoord1d(s); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glTexCoord1dv + extern "C" { GLAPI void GLAPIENTRY glTexCoord1dv(const GLdouble *v); } + void OVR::GLEContext::glTexCoord1dv_Hook(const GLdouble *v) + { + glTexCoord1dv(v); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glTexCoord1f + extern "C" { GLAPI void GLAPIENTRY glTexCoord1f(GLfloat s); } + void OVR::GLEContext::glTexCoord1f_Hook(GLfloat s) + { + glTexCoord1f(s); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glTexCoord1fv + extern "C" { GLAPI void GLAPIENTRY glTexCoord1fv(const GLfloat *v); } + void OVR::GLEContext::glTexCoord1fv_Hook(const GLfloat *v) + { + glTexCoord1fv(v); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glTexCoord1i + extern "C" { GLAPI void GLAPIENTRY glTexCoord1i(GLint s); } + void OVR::GLEContext::glTexCoord1i_Hook(GLint s) + { + glTexCoord1i(s); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glTexCoord1iv + extern "C" { GLAPI void GLAPIENTRY glTexCoord1iv(const GLint *v); } + void OVR::GLEContext::glTexCoord1iv_Hook(const GLint *v) + { + glTexCoord1iv(v); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glTexCoord1s + extern "C" { GLAPI void GLAPIENTRY glTexCoord1s(GLshort s); } + void OVR::GLEContext::glTexCoord1s_Hook(GLshort s) + { + glTexCoord1s(s); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glTexCoord1sv + extern "C" { GLAPI void GLAPIENTRY glTexCoord1sv(const GLshort *v); } + void OVR::GLEContext::glTexCoord1sv_Hook(const GLshort *v) + { + glTexCoord1sv(v); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glTexCoord2d + extern "C" { GLAPI void GLAPIENTRY glTexCoord2d(GLdouble s, GLdouble t); } + void OVR::GLEContext::glTexCoord2d_Hook(GLdouble s, GLdouble t) + { + glTexCoord2d(s, t); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glTexCoord2dv + extern "C" { GLAPI void GLAPIENTRY glTexCoord2dv(const GLdouble *v); } + void OVR::GLEContext::glTexCoord2dv_Hook(const GLdouble *v) + { + glTexCoord2dv(v); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glTexCoord2f + extern "C" { GLAPI void GLAPIENTRY glTexCoord2f(GLfloat s, GLfloat t); } + void OVR::GLEContext::glTexCoord2f_Hook(GLfloat s, GLfloat t) + { + glTexCoord2f(s, t); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glTexCoord2fv + extern "C" { GLAPI void GLAPIENTRY glTexCoord2fv(const GLfloat *v); } + void OVR::GLEContext::glTexCoord2fv_Hook(const GLfloat *v) + { + glTexCoord2fv(v); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glTexCoord2i + extern "C" { GLAPI void GLAPIENTRY glTexCoord2i(GLint s, GLint t); } + void OVR::GLEContext::glTexCoord2i_Hook(GLint s, GLint t) + { + glTexCoord2i(s, t); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glTexCoord2iv + extern "C" { GLAPI void GLAPIENTRY glTexCoord2iv(const GLint *v); } + void OVR::GLEContext::glTexCoord2iv_Hook(const GLint *v) + { + glTexCoord2iv(v); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glTexCoord2s + extern "C" { GLAPI void GLAPIENTRY glTexCoord2s(GLshort s, GLshort t); } + void OVR::GLEContext::glTexCoord2s_Hook(GLshort s, GLshort t) + { + glTexCoord2s(s, t); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glTexCoord2sv + extern "C" { GLAPI void GLAPIENTRY glTexCoord2sv(const GLshort *v); } + void OVR::GLEContext::glTexCoord2sv_Hook(const GLshort *v) + { + glTexCoord2sv(v); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glTexCoord3d + extern "C" { GLAPI void GLAPIENTRY glTexCoord3d(GLdouble s, GLdouble t, GLdouble r); } + void OVR::GLEContext::glTexCoord3d_Hook(GLdouble s, GLdouble t, GLdouble r) + { + glTexCoord3d(s, t, r); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glTexCoord3dv + extern "C" { GLAPI void GLAPIENTRY glTexCoord3dv(const GLdouble *v); } + void OVR::GLEContext::glTexCoord3dv_Hook(const GLdouble *v) + { + glTexCoord3dv(v); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glTexCoord3f + extern "C" { GLAPI void GLAPIENTRY glTexCoord3f(GLfloat s, GLfloat t, GLfloat r); } + void OVR::GLEContext::glTexCoord3f_Hook(GLfloat s, GLfloat t, GLfloat r) + { + glTexCoord3f(s, t, r); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glTexCoord3fv + extern "C" { GLAPI void GLAPIENTRY glTexCoord3fv(const GLfloat *v); } + void OVR::GLEContext::glTexCoord3fv_Hook(const GLfloat *v) + { + glTexCoord3fv(v); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glTexCoord3i + extern "C" { GLAPI void GLAPIENTRY glTexCoord3i(GLint s, GLint t, GLint r); } + void OVR::GLEContext::glTexCoord3i_Hook(GLint s, GLint t, GLint r) + { + glTexCoord3i(s, t, r); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glTexCoord3iv + extern "C" { GLAPI void GLAPIENTRY glTexCoord3iv(const GLint *v); } + void OVR::GLEContext::glTexCoord3iv_Hook(const GLint *v) + { + glTexCoord3iv(v); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glTexCoord3s + extern "C" { GLAPI void GLAPIENTRY glTexCoord3s(GLshort s, GLshort t, GLshort r); } + void OVR::GLEContext::glTexCoord3s_Hook(GLshort s, GLshort t, GLshort r) + { + glTexCoord3s(s, t, r); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glTexCoord3sv + extern "C" { GLAPI void GLAPIENTRY glTexCoord3sv(const GLshort *v); } + void OVR::GLEContext::glTexCoord3sv_Hook(const GLshort *v) + { + glTexCoord3sv(v); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glTexCoord4d + extern "C" { GLAPI void GLAPIENTRY glTexCoord4d(GLdouble s, GLdouble t, GLdouble r, GLdouble q); } + void OVR::GLEContext::glTexCoord4d_Hook(GLdouble s, GLdouble t, GLdouble r, GLdouble q) + { + glTexCoord4d(s, t, r, q); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glTexCoord4dv + extern "C" { GLAPI void GLAPIENTRY glTexCoord4dv(const GLdouble *v); } + void OVR::GLEContext::glTexCoord4dv_Hook(const GLdouble *v) + { + glTexCoord4dv(v); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glTexCoord4f + extern "C" { GLAPI void GLAPIENTRY glTexCoord4f(GLfloat s, GLfloat t, GLfloat r, GLfloat q); } + void OVR::GLEContext::glTexCoord4f_Hook(GLfloat s, GLfloat t, GLfloat r, GLfloat q) + { + glTexCoord4f(s, t, r, q); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glTexCoord4fv + extern "C" { GLAPI void GLAPIENTRY glTexCoord4fv(const GLfloat *v); } + void OVR::GLEContext::glTexCoord4fv_Hook(const GLfloat *v) + { + glTexCoord4fv(v); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glTexCoord4i + extern "C" { GLAPI void GLAPIENTRY glTexCoord4i(GLint s, GLint t, GLint r, GLint q); } + void OVR::GLEContext::glTexCoord4i_Hook(GLint s, GLint t, GLint r, GLint q) + { + glTexCoord4i(s, t, r, q); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glTexCoord4iv + extern "C" { GLAPI void GLAPIENTRY glTexCoord4iv(const GLint *v); } + void OVR::GLEContext::glTexCoord4iv_Hook(const GLint *v) + { + glTexCoord4iv(v); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glTexCoord4s + extern "C" { GLAPI void GLAPIENTRY glTexCoord4s(GLshort s, GLshort t, GLshort r, GLshort q); } + void OVR::GLEContext::glTexCoord4s_Hook(GLshort s, GLshort t, GLshort r, GLshort q) + { + glTexCoord4s(s, t, r, q); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glTexCoord4sv + extern "C" { GLAPI void GLAPIENTRY glTexCoord4sv(const GLshort *v); } + void OVR::GLEContext::glTexCoord4sv_Hook(const GLshort *v) + { + glTexCoord4sv(v); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glTexCoordPointer + extern "C" { GLAPI void GLAPIENTRY glTexCoordPointer(GLint size, GLenum type, GLsizei stride, const void *pointer); } + void OVR::GLEContext::glTexCoordPointer_Hook(GLint size, GLenum type, GLsizei stride, const void *pointer) + { + glTexCoordPointer(size, type, stride, pointer); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glTexEnvf + extern "C" { GLAPI void GLAPIENTRY glTexEnvf(GLenum target, GLenum pname, GLfloat param); } + void OVR::GLEContext::glTexEnvf_Hook(GLenum target, GLenum pname, GLfloat param) + { + glTexEnvf(target, pname, param); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glTexEnvfv + extern "C" { GLAPI void GLAPIENTRY glTexEnvfv(GLenum target, GLenum pname, const GLfloat *params); } + void OVR::GLEContext::glTexEnvfv_Hook(GLenum target, GLenum pname, const GLfloat *params) + { + glTexEnvfv(target, pname, params); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glTexEnvi + extern "C" { GLAPI void GLAPIENTRY glTexEnvi(GLenum target, GLenum pname, GLint param); } + void OVR::GLEContext::glTexEnvi_Hook(GLenum target, GLenum pname, GLint param) + { + glTexEnvi(target, pname, param); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glTexEnviv + extern "C" { GLAPI void GLAPIENTRY glTexEnviv(GLenum target, GLenum pname, const GLint *params); } + void OVR::GLEContext::glTexEnviv_Hook(GLenum target, GLenum pname, const GLint *params) + { + glTexEnviv(target, pname, params); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glTexGend + extern "C" { GLAPI void GLAPIENTRY glTexGend(GLenum coord, GLenum pname, GLdouble param); } + void OVR::GLEContext::glTexGend_Hook(GLenum coord, GLenum pname, GLdouble param) + { + glTexGend(coord, pname, param); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glTexGendv + extern "C" { GLAPI void GLAPIENTRY glTexGendv(GLenum coord, GLenum pname, const GLdouble *params); } + void OVR::GLEContext::glTexGendv_Hook(GLenum coord, GLenum pname, const GLdouble *params) + { + glTexGendv(coord, pname, params); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glTexGenf + extern "C" { GLAPI void GLAPIENTRY glTexGenf(GLenum coord, GLenum pname, GLfloat param); } + void OVR::GLEContext::glTexGenf_Hook(GLenum coord, GLenum pname, GLfloat param) + { + glTexGenf(coord, pname, param); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glTexGenfv + extern "C" { GLAPI void GLAPIENTRY glTexGenfv(GLenum coord, GLenum pname, const GLfloat *params); } + void OVR::GLEContext::glTexGenfv_Hook(GLenum coord, GLenum pname, const GLfloat *params) + { + glTexGenfv(coord, pname, params); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glTexGeni + extern "C" { GLAPI void GLAPIENTRY glTexGeni(GLenum coord, GLenum pname, GLint param); } + void OVR::GLEContext::glTexGeni_Hook(GLenum coord, GLenum pname, GLint param) + { + glTexGeni(coord, pname, param); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glTexGeniv + extern "C" { GLAPI void GLAPIENTRY glTexGeniv(GLenum coord, GLenum pname, const GLint *params); } + void OVR::GLEContext::glTexGeniv_Hook(GLenum coord, GLenum pname, const GLint *params) + { + glTexGeniv(coord, pname, params); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glTexImage1D + extern "C" { GLAPI void GLAPIENTRY glTexImage1D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const void *pixels); } + void OVR::GLEContext::glTexImage1D_Hook(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const void *pixels) + { + glTexImage1D(target, level, internalformat, width, border, format, type, pixels); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glTexImage2D + extern "C" { GLAPI void GLAPIENTRY glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels); } + void OVR::GLEContext::glTexImage2D_Hook(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels) + { + glTexImage2D(target, level, internalformat, width, height, border, format, type, pixels); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glTexParameterf + extern "C" { GLAPI void GLAPIENTRY glTexParameterf(GLenum target, GLenum pname, GLfloat param); } + void OVR::GLEContext::glTexParameterf_Hook(GLenum target, GLenum pname, GLfloat param) + { + glTexParameterf(target, pname, param); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glTexParameterfv + extern "C" { GLAPI void GLAPIENTRY glTexParameterfv(GLenum target, GLenum pname, const GLfloat *params); } + void OVR::GLEContext::glTexParameterfv_Hook(GLenum target, GLenum pname, const GLfloat *params) + { + glTexParameterfv(target, pname, params); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glTexParameteri + extern "C" { GLAPI void GLAPIENTRY glTexParameteri(GLenum target, GLenum pname, GLint param); } + void OVR::GLEContext::glTexParameteri_Hook(GLenum target, GLenum pname, GLint param) + { + glTexParameteri(target, pname, param); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glTexParameteriv + extern "C" { GLAPI void GLAPIENTRY glTexParameteriv(GLenum target, GLenum pname, const GLint *params); } + void OVR::GLEContext::glTexParameteriv_Hook(GLenum target, GLenum pname, const GLint *params) + { + glTexParameteriv(target, pname, params); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glTexSubImage1D + extern "C" { GLAPI void GLAPIENTRY glTexSubImage1D(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels); } + void OVR::GLEContext::glTexSubImage1D_Hook(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels) + { + glTexSubImage1D(target, level, xoffset, width, format, type, pixels); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glTexSubImage2D + extern "C" { GLAPI void GLAPIENTRY glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels); } + void OVR::GLEContext::glTexSubImage2D_Hook(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels) + { + glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glTranslated + extern "C" { GLAPI void GLAPIENTRY glTranslated(GLdouble x, GLdouble y, GLdouble z); } + void OVR::GLEContext::glTranslated_Hook(GLdouble x, GLdouble y, GLdouble z) + { + glTranslated(x, y, z); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glTranslatef + extern "C" { GLAPI void GLAPIENTRY glTranslatef(GLfloat x, GLfloat y, GLfloat z); } + void OVR::GLEContext::glTranslatef_Hook(GLfloat x, GLfloat y, GLfloat z) + { + glTranslatef(x, y, z); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glVertex2d + extern "C" { GLAPI void GLAPIENTRY glVertex2d(GLdouble x, GLdouble y); } + void OVR::GLEContext::glVertex2d_Hook(GLdouble x, GLdouble y) + { + glVertex2d(x, y); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glVertex2dv + extern "C" { GLAPI void GLAPIENTRY glVertex2dv(const GLdouble *v); } + void OVR::GLEContext::glVertex2dv_Hook(const GLdouble *v) + { + glVertex2dv(v); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glVertex2f + extern "C" { GLAPI void GLAPIENTRY glVertex2f(GLfloat x, GLfloat y); } + void OVR::GLEContext::glVertex2f_Hook(GLfloat x, GLfloat y) + { + glVertex2f(x, y); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glVertex2fv + extern "C" { GLAPI void GLAPIENTRY glVertex2fv(const GLfloat *v); } + void OVR::GLEContext::glVertex2fv_Hook(const GLfloat *v) + { + glVertex2fv(v); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glVertex2i + extern "C" { GLAPI void GLAPIENTRY glVertex2i(GLint x, GLint y); } + void OVR::GLEContext::glVertex2i_Hook(GLint x, GLint y) + { + glVertex2i(x, y); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glVertex2iv + extern "C" { GLAPI void GLAPIENTRY glVertex2iv(const GLint *v); } + void OVR::GLEContext::glVertex2iv_Hook(const GLint *v) + { + glVertex2iv(v); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glVertex2s + extern "C" { GLAPI void GLAPIENTRY glVertex2s(GLshort x, GLshort y); } + void OVR::GLEContext::glVertex2s_Hook(GLshort x, GLshort y) + { + glVertex2s(x, y); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glVertex2sv + extern "C" { GLAPI void GLAPIENTRY glVertex2sv(const GLshort *v); } + void OVR::GLEContext::glVertex2sv_Hook(const GLshort *v) + { + glVertex2sv(v); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glVertex3d + extern "C" { GLAPI void GLAPIENTRY glVertex3d(GLdouble x, GLdouble y, GLdouble z); } + void OVR::GLEContext::glVertex3d_Hook(GLdouble x, GLdouble y, GLdouble z) + { + glVertex3d(x, y, z); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glVertex3dv + extern "C" { GLAPI void GLAPIENTRY glVertex3dv(const GLdouble *v); } + void OVR::GLEContext::glVertex3dv_Hook(const GLdouble *v) + { + glVertex3dv(v); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glVertex3f + extern "C" { GLAPI void GLAPIENTRY glVertex3f(GLfloat x, GLfloat y, GLfloat z); } + void OVR::GLEContext::glVertex3f_Hook(GLfloat x, GLfloat y, GLfloat z) + { + glVertex3f(x, y, z); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glVertex3fv + extern "C" { GLAPI void GLAPIENTRY glVertex3fv(const GLfloat *v); } + void OVR::GLEContext::glVertex3fv_Hook(const GLfloat *v) + { + glVertex3fv(v); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glVertex3i + extern "C" { GLAPI void GLAPIENTRY glVertex3i(GLint x, GLint y, GLint z); } + void OVR::GLEContext::glVertex3i_Hook(GLint x, GLint y, GLint z) + { + glVertex3i(x, y, z); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glVertex3iv + extern "C" { GLAPI void GLAPIENTRY glVertex3iv(const GLint *v); } + void OVR::GLEContext::glVertex3iv_Hook(const GLint *v) + { + glVertex3iv(v); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glVertex3s + extern "C" { GLAPI void GLAPIENTRY glVertex3s(GLshort x, GLshort y, GLshort z); } + void OVR::GLEContext::glVertex3s_Hook(GLshort x, GLshort y, GLshort z) + { + glVertex3s(x, y, z); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glVertex3sv + extern "C" { GLAPI void GLAPIENTRY glVertex3sv(const GLshort *v); } + void OVR::GLEContext::glVertex3sv_Hook(const GLshort *v) + { + glVertex3sv(v); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glVertex4d + extern "C" { GLAPI void GLAPIENTRY glVertex4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w); } + void OVR::GLEContext::glVertex4d_Hook(GLdouble x, GLdouble y, GLdouble z, GLdouble w) + { + glVertex4d(x, y, z, w); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glVertex4dv + extern "C" { GLAPI void GLAPIENTRY glVertex4dv(const GLdouble *v); } + void OVR::GLEContext::glVertex4dv_Hook(const GLdouble *v) + { + glVertex4dv(v); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glVertex4f + extern "C" { GLAPI void GLAPIENTRY glVertex4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w); } + void OVR::GLEContext::glVertex4f_Hook(GLfloat x, GLfloat y, GLfloat z, GLfloat w) + { + glVertex4f(x, y, z, w); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glVertex4fv + extern "C" { GLAPI void GLAPIENTRY glVertex4fv(const GLfloat *v); } + void OVR::GLEContext::glVertex4fv_Hook(const GLfloat *v) + { + glVertex4fv(v); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glVertex4i + extern "C" { GLAPI void GLAPIENTRY glVertex4i(GLint x, GLint y, GLint z, GLint w); } + void OVR::GLEContext::glVertex4i_Hook(GLint x, GLint y, GLint z, GLint w) + { + glVertex4i(x, y, z, w); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glVertex4iv + extern "C" { GLAPI void GLAPIENTRY glVertex4iv(const GLint *v); } + void OVR::GLEContext::glVertex4iv_Hook(const GLint *v) + { + glVertex4iv(v); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glVertex4s + extern "C" { GLAPI void GLAPIENTRY glVertex4s(GLshort x, GLshort y, GLshort z, GLshort w); } + void OVR::GLEContext::glVertex4s_Hook(GLshort x, GLshort y, GLshort z, GLshort w) + { + glVertex4s(x, y, z, w); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glVertex4sv + extern "C" { GLAPI void GLAPIENTRY glVertex4sv(const GLshort *v); } + void OVR::GLEContext::glVertex4sv_Hook(const GLshort *v) + { + glVertex4sv(v); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glVertexPointer + extern "C" { GLAPI void GLAPIENTRY glVertexPointer(GLint size, GLenum type, GLsizei stride, const void *pointer); } + void OVR::GLEContext::glVertexPointer_Hook(GLint size, GLenum type, GLsizei stride, const void *pointer) + { + glVertexPointer(size, type, stride, pointer); + PostHook(GLE_CURRENT_FUNCTION); + } + + #undef glViewport + extern "C" { GLAPI void GLAPIENTRY glViewport(GLint x, GLint y, GLsizei width, GLsizei height); } + void OVR::GLEContext::glViewport_Hook(GLint x, GLint y, GLsizei width, GLsizei height) + { + glViewport(x, y, width, height); + PostHook(GLE_CURRENT_FUNCTION); + } + + + + // Pointer-based functions + void OVR::GLEContext::glBlendColor_Hook(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) + { + if(glBlendColor_Impl) + glBlendColor_Impl(red, green, blue, alpha); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glBlendEquation_Hook(GLenum mode) + { + if(glBlendEquation_Impl) + glBlendEquation_Impl(mode); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glDrawRangeElements_Hook(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices) + { + if(glDrawRangeElements_Impl) + glDrawRangeElements_Impl(mode, start, end, count, type, indices); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glTexImage3D_Hook(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels) + { + if(glTexImage3D_Impl) + glTexImage3D_Impl(target, level, internalformat, width, height, depth, border, format, type, pixels); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glTexSubImage3D_Hook(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels) + { + if(glTexSubImage3D_Impl) + glTexSubImage3D_Impl(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels); + PostHook(GLE_CURRENT_FUNCTION); + } + + + void OVR::GLEContext::glCopyTexSubImage3D_Hook(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height) + { + if(glCopyTexSubImage3D_Impl) + glCopyTexSubImage3D_Impl(target, level, xoffset, yoffset, zoffset, x, y, width, height); + PostHook(GLE_CURRENT_FUNCTION); + } + + // GL_VERSION_1_2 deprecated functions + /* Not currently supported + void OVR::GLEContext::glColorTable_Hook(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table) + { + if(glColorTable_Impl) + glColorTable_Impl(target, internalformat, width, format, type, table); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glColorTableParameterfv_Hook(GLenum target, GLenum pname, const GLfloat *params) + { + if(glColorTableParameterfv_Impl) + glColorTableParameterfv_Impl(target, pname, params); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glColorTableParameteriv_Hook(GLenum target, GLenum pname, const GLint *params) + { + if(glColorTableParameteriv_Impl) + glColorTableParameteriv_Impl(target, pname, params); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glCopyColorTable_Hook(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width) + { + if(glCopyColorTable_Impl) + glCopyColorTable_Impl(target, internalformat, x, y, width); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glGetColorTable_Hook(GLenum target, GLenum format, GLenum type, GLvoid *table) + { + if(glGetColorTable_Impl) + glGetColorTable_Impl(target, format, type, table); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glGetColorTableParameterfv_Hook(GLenum target, GLenum pname, GLfloat *params) + { + if(glGetColorTableParameterfv_Impl) + glGetColorTableParameterfv_Impl(target, pname, params); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glGetColorTableParameteriv_Hook(GLenum target, GLenum pname, GLint *params) + { + if(glGetColorTableParameteriv_Impl) + glGetColorTableParameteriv_Impl(target, pname, params); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glColorSubTable_Hook(GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data) + { + if(glColorSubTable_Impl) + glColorSubTable_Impl(target, start, count, format, type, data); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glCopyColorSubTable_Hook(GLenum target, GLsizei start, GLint x, GLint y, GLsizei width) + { + if(glCopyColorSubTable_Impl) + glCopyColorSubTable_Impl(target, start, x, y, width); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glConvolutionFilter1D_Hook(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image) + { + if(glConvolutionFilter1D_Impl) + glConvolutionFilter1D_Impl(target, internalformat, width, format, type, image); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glConvolutionFilter2D_Hook(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image) + { + if(glConvolutionFilter2D_Impl) + glConvolutionFilter2D_Impl(target, internalformat, width, height, format, type, image); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glConvolutionParameterf_Hook(GLenum target, GLenum pname, GLfloat params) + { + if(glConvolutionParameterf_Impl) + glConvolutionParameterf_Impl(target, pname, params); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glConvolutionParameterfv_Hook(GLenum target, GLenum pname, const GLfloat *params) + { + if(glConvolutionParameterfv_Impl) + glConvolutionParameterfv_Impl(target, pname, params); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glConvolutionParameteri_Hook(GLenum target, GLenum pname, GLint params) + { + if(glConvolutionParameteri_Impl) + glConvolutionParameteri_Impl(target, pname, params); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glConvolutionParameteriv_Hook(GLenum target, GLenum pname, const GLint *params) + { + if(glConvolutionParameteriv_Impl) + glConvolutionParameteriv_Impl(target, pname, params); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glCopyConvolutionFilter1D_Hook(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width) + { + if(glCopyConvolutionFilter1D_Impl) + glCopyConvolutionFilter1D_Impl(target, internalformat, x, y, width); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glCopyConvolutionFilter2D_Hook(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height) + { + if(glCopyConvolutionFilter2D_Impl) + glCopyConvolutionFilter2D_Impl(target, internalformat, x, y, width, height); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glGetConvolutionFilter_Hook(GLenum target, GLenum format, GLenum type, GLvoid *image) + { + if(glGetConvolutionFilter_Impl) + glGetConvolutionFilter_Impl(target, format, type, image); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glGetConvolutionParameterfv_Hook(GLenum target, GLenum pname, GLfloat *params) + { + if(glGetConvolutionParameterfv_Impl) + glGetConvolutionParameterfv_Impl(target, pname, params); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glGetConvolutionParameteriv_Hook(GLenum target, GLenum pname, GLint *params) + { + if(glGetConvolutionParameteriv_Impl) + glGetConvolutionParameteriv_Impl(target, pname, params); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glGetSeparableFilter_Hook(GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span) + { + if(glGetSeparableFilter_Impl) + glGetSeparableFilter_Impl(target, format, type, row, column, span); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glSeparableFilter2D_Hook(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column) + { + if(glSeparableFilter2D_Impl) + glSeparableFilter2D_Impl(target, internalformat, width, height, format, type, row, column); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glGetHistogram_Hook(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values) + { + if(glGetHistogram_Impl) + glGetHistogram_Impl(target, reset, format, type, values); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glGetHistogramParameterfv_Hook(GLenum target, GLenum pname, GLfloat *params) + { + if(glGetHistogramParameterfv_Impl) + glGetHistogramParameterfv_Impl(target, pname, params); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glGetHistogramParameteriv_Hook(GLenum target, GLenum pname, GLint *params) + { + if(glGetHistogramParameteriv_Impl) + glGetHistogramParameteriv_Impl(target, pname, params); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glGetMinmax_Hook(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values) + { + if(glGetMinmax_Impl) + glGetMinmax_Impl(target, reset, format, type, values); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glGetMinmaxParameterfv_Hook(GLenum target, GLenum pname, GLfloat *params) + { + if(glGetMinmaxParameterfv_Impl) + glGetMinmaxParameterfv_Impl(target, pname, params); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glGetMinmaxParameteriv_Hook(GLenum target, GLenum pname, GLint *params) + { + if(glGetMinmaxParameteriv_Impl) + glGetMinmaxParameteriv_Impl(target, pname, params); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glHistogram_Hook(GLenum target, GLsizei width, GLenum internalformat, GLboolean sink) + { + if(glHistogram_Impl) + glHistogram_Impl(target, width, internalformat, sink); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glMinmax_Hook(GLenum target, GLenum internalformat, GLboolean sink) + { + if(glMinmax_Impl) + glMinmax_Impl(target, internalformat, sink); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glResetHistogram_Hook(GLenum target) + { + if(glResetHistogram_Impl) + glResetHistogram_Impl(target); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glResetMinmax_Hook(GLenum target) + { + if(glResetMinmax_Impl) + glResetMinmax_Impl(target); + PostHook(GLE_CURRENT_FUNCTION); + } + */ + + // GL_VERSION_1_3 + void OVR::GLEContext::glActiveTexture_Hook(GLenum texture) + { + if(glActiveTexture_Impl) + glActiveTexture_Impl(texture); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glSampleCoverage_Hook(GLclampf value, GLboolean invert) + { + if(glSampleCoverage_Impl) + glSampleCoverage_Impl(value, invert); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glCompressedTexImage3D_Hook(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data) + { + if(glCompressedTexImage3D_Impl) + glCompressedTexImage3D_Impl(target, level, internalformat, width, height, depth, border, imageSize, data); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glCompressedTexImage2D_Hook(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data) + { + if(glCompressedTexImage2D_Impl) + glCompressedTexImage2D_Impl(target, level, internalformat, width, height, border, imageSize, data); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glCompressedTexImage1D_Hook(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data) + { + if(glCompressedTexImage1D_Impl) + glCompressedTexImage1D_Impl(target, level, internalformat, width, border, imageSize, data); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glCompressedTexSubImage3D_Hook(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data) + { + if(glCompressedTexSubImage3D_Impl) + glCompressedTexSubImage3D_Impl(target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glCompressedTexSubImage2D_Hook(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data) + { + if(glCompressedTexSubImage2D_Impl) + glCompressedTexSubImage2D_Impl(target, level, xoffset, yoffset, width, height, format, imageSize, data); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glCompressedTexSubImage1D_Hook(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data) + { + if(glCompressedTexSubImage1D_Impl) + glCompressedTexSubImage1D_Impl(target, level, xoffset, width, format, imageSize, data); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glGetCompressedTexImage_Hook(GLenum target, GLint level, GLvoid *img) + { + if(glGetCompressedTexImage_Impl) + glGetCompressedTexImage_Impl(target, level, img); + PostHook(GLE_CURRENT_FUNCTION); + } + + + // GL_VERSION_1_3 deprecated functions + void OVR::GLEContext::glClientActiveTexture_Hook(GLenum texture) + { + if(glClientActiveTexture_Impl) + glClientActiveTexture_Impl(texture); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glMultiTexCoord1d_Hook(GLenum target, GLdouble s) + { + if(glMultiTexCoord1d_Impl) + glMultiTexCoord1d_Impl(target, s); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glMultiTexCoord1dv_Hook(GLenum target, const GLdouble *v) + { + if(glMultiTexCoord1dv_Impl) + glMultiTexCoord1dv_Impl(target, v); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glMultiTexCoord1f_Hook(GLenum target, GLfloat s) + { + if(glMultiTexCoord1f_Impl) + glMultiTexCoord1f_Impl(target, s); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glMultiTexCoord1fv_Hook(GLenum target, const GLfloat *v) + { + if(glMultiTexCoord1fv_Impl) + glMultiTexCoord1fv_Impl(target, v); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glMultiTexCoord1i_Hook(GLenum target, GLint s) + { + if(glMultiTexCoord1i_Impl) + glMultiTexCoord1i_Impl(target, s); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glMultiTexCoord1iv_Hook(GLenum target, const GLint *v) + { + if(glMultiTexCoord1iv_Impl) + glMultiTexCoord1iv_Impl(target, v); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glMultiTexCoord1s_Hook(GLenum target, GLshort s) + { + if(glMultiTexCoord1s_Impl) + glMultiTexCoord1s_Impl(target, s); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glMultiTexCoord1sv_Hook(GLenum target, const GLshort *v) + { + if(glMultiTexCoord1sv_Impl) + glMultiTexCoord1sv_Impl(target, v); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glMultiTexCoord2d_Hook(GLenum target, GLdouble s, GLdouble t) + { + if(glMultiTexCoord2d_Impl) + glMultiTexCoord2d_Impl(target, s, t); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glMultiTexCoord2dv_Hook(GLenum target, const GLdouble *v) + { + if(glMultiTexCoord2dv_Impl) + glMultiTexCoord2dv_Impl(target, v); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glMultiTexCoord2f_Hook(GLenum target, GLfloat s, GLfloat t) + { + if(glMultiTexCoord2f_Impl) + glMultiTexCoord2f_Impl(target, s, t); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glMultiTexCoord2fv_Hook(GLenum target, const GLfloat *v) + { + if(glMultiTexCoord2fv_Impl) + glMultiTexCoord2fv_Impl(target, v); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glMultiTexCoord2i_Hook(GLenum target, GLint s, GLint t) + { + if(glMultiTexCoord2i_Impl) + glMultiTexCoord2i_Impl(target, s, t); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glMultiTexCoord2iv_Hook(GLenum target, const GLint *v) + { + if(glMultiTexCoord2iv_Impl) + glMultiTexCoord2iv_Impl(target, v); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glMultiTexCoord2s_Hook(GLenum target, GLshort s, GLshort t) + { + if(glMultiTexCoord2s_Impl) + glMultiTexCoord2s_Impl(target, s, t); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glMultiTexCoord2sv_Hook(GLenum target, const GLshort *v) + { + if(glMultiTexCoord2sv_Impl) + glMultiTexCoord2sv_Impl(target, v); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glMultiTexCoord3d_Hook(GLenum target, GLdouble s, GLdouble t, GLdouble r) + { + if(glMultiTexCoord3d_Impl) + glMultiTexCoord3d_Impl(target, s, t, r); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glMultiTexCoord3dv_Hook(GLenum target, const GLdouble *v) + { + if(glMultiTexCoord3dv_Impl) + glMultiTexCoord3dv_Impl(target, v); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glMultiTexCoord3f_Hook(GLenum target, GLfloat s, GLfloat t, GLfloat r) + { + if(glMultiTexCoord3f_Impl) + glMultiTexCoord3f_Impl(target, s, t, r); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glMultiTexCoord3fv_Hook(GLenum target, const GLfloat *v) + { + if(glMultiTexCoord3fv_Impl) + glMultiTexCoord3fv_Impl(target, v); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glMultiTexCoord3i_Hook(GLenum target, GLint s, GLint t, GLint r) + { + if(glMultiTexCoord3i_Impl) + glMultiTexCoord3i_Impl(target, s, t, r); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glMultiTexCoord3iv_Hook(GLenum target, const GLint *v) + { + if(glMultiTexCoord3iv_Impl) + glMultiTexCoord3iv_Impl(target, v); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glMultiTexCoord3s_Hook(GLenum target, GLshort s, GLshort t, GLshort r) + { + if(glMultiTexCoord3s_Impl) + glMultiTexCoord3s_Impl(target, s, t, r); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glMultiTexCoord3sv_Hook(GLenum target, const GLshort *v) + { + if(glMultiTexCoord3sv_Impl) + glMultiTexCoord3sv_Impl(target, v); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glMultiTexCoord4d_Hook(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q) + { + if(glMultiTexCoord4d_Impl) + glMultiTexCoord4d_Impl(target, s, t, r, q); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glMultiTexCoord4dv_Hook(GLenum target, const GLdouble *v) + { + if(glMultiTexCoord4dv_Impl) + glMultiTexCoord4dv_Impl(target, v); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glMultiTexCoord4f_Hook(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q) + { + if(glMultiTexCoord4f_Impl) + glMultiTexCoord4f_Impl(target, s, t, r, q); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glMultiTexCoord4fv_Hook(GLenum target, const GLfloat *v) + { + if(glMultiTexCoord4fv_Impl) + glMultiTexCoord4fv_Impl(target, v); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glMultiTexCoord4i_Hook(GLenum target, GLint s, GLint t, GLint r, GLint q) + { + if(glMultiTexCoord4i_Impl) + glMultiTexCoord4i_Impl(target, s, t, r, q); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glMultiTexCoord4iv_Hook(GLenum target, const GLint *v) + { + if(glMultiTexCoord4iv_Impl) + glMultiTexCoord4iv_Impl(target, v); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glMultiTexCoord4s_Hook(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q) + { + if(glMultiTexCoord4s_Impl) + glMultiTexCoord4s_Impl(target, s, t, r, q); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glMultiTexCoord4sv_Hook(GLenum target, const GLshort *v) + { + if(glMultiTexCoord4sv_Impl) + glMultiTexCoord4sv_Impl(target, v); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glLoadTransposeMatrixf_Hook(const GLfloat *m) + { + if(glLoadTransposeMatrixf_Impl) + glLoadTransposeMatrixf_Impl(m); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glLoadTransposeMatrixd_Hook(const GLdouble *m) + { + if(glLoadTransposeMatrixd_Impl) + glLoadTransposeMatrixd_Impl(m); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glMultTransposeMatrixf_Hook(const GLfloat *m) + { + if(glMultTransposeMatrixf_Impl) + glMultTransposeMatrixf_Impl(m); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glMultTransposeMatrixd_Hook(const GLdouble *m) + { + if(glMultTransposeMatrixd_Impl) + glMultTransposeMatrixd_Impl(m); + PostHook(GLE_CURRENT_FUNCTION); + } + + + // GL_VERSION_1_4 + void OVR::GLEContext::glBlendFuncSeparate_Hook(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha) + { + if(glBlendFuncSeparate_Impl) + glBlendFuncSeparate_Impl(sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glMultiDrawArrays_Hook(GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount) + { + if(glMultiDrawArrays_Impl) + glMultiDrawArrays_Impl(mode, first, count, primcount); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glMultiDrawElements_Hook(GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount) + { + if(glMultiDrawElements_Impl) + glMultiDrawElements_Impl(mode, count, type, indices, primcount); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glPointParameterf_Hook(GLenum pname, GLfloat param) + { + if(glPointParameterf_Impl) + glPointParameterf_Impl(pname, param); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glPointParameterfv_Hook(GLenum pname, const GLfloat *params) + { + if(glPointParameterfv_Impl) + glPointParameterfv_Impl(pname, params); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glPointParameteri_Hook(GLenum pname, GLint param) + { + if(glPointParameteri_Impl) + glPointParameteri_Impl(pname, param); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glPointParameteriv_Hook(GLenum pname, const GLint *params) + { + if(glPointParameteriv_Impl) + glPointParameteriv_Impl(pname, params); + PostHook(GLE_CURRENT_FUNCTION); + } + + + // GL_VERSION_1_4 deprecated functions + void OVR::GLEContext::glFogCoordf_Hook(GLfloat coord) + { + if(glFogCoordf_Impl) + glFogCoordf_Impl(coord); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glFogCoordfv_Hook(const GLfloat *coord) + { + if(glFogCoordfv_Impl) + glFogCoordfv_Impl(coord); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glFogCoordd_Hook(GLdouble coord) + { + if(glFogCoordd_Impl) + glFogCoordd_Impl(coord); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glFogCoorddv_Hook(const GLdouble *coord) + { + if(glFogCoorddv_Impl) + glFogCoorddv_Impl(coord); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glFogCoordPointer_Hook(GLenum type, GLsizei stride, const GLvoid *pointer) + { + if(glFogCoordPointer_Impl) + glFogCoordPointer_Impl(type, stride, pointer); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glSecondaryColor3b_Hook(GLbyte red, GLbyte green, GLbyte blue) + { + if(glSecondaryColor3b_Impl) + glSecondaryColor3b_Impl(red, green, blue); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glSecondaryColor3bv_Hook(const GLbyte *v) + { + if(glSecondaryColor3bv_Impl) + glSecondaryColor3bv_Impl(v); + PostHook(GLE_CURRENT_FUNCTION); + } + + void OVR::GLEContext::glSecondaryColor3d_Hook(GLdouble red, GLdouble green, GLdouble blue) + { + if(glSecondaryColor3d_Impl) +