From ca79271759ff7eecd22ec5c4db438370fe51d687 Mon Sep 17 00:00:00 2001 From: Brad Davis Date: Fri, 23 May 2014 02:01:10 -0700 Subject: Adding 0.3.2 OSX files --- .gitignore | 2 +- .../Mac/Xcode/LibOVR.xcodeproj/project.pbxproj | 731 ++++++++++++++++ .../project.xcworkspace/contents.xcworkspacedata | 7 + LibOVR/Src/OVR_OSX_DeviceManager.cpp | 360 ++++++++ LibOVR/Src/OVR_OSX_DeviceManager.h | 128 +++ LibOVR/Src/OVR_OSX_HIDDevice.cpp | 924 +++++++++++++++++++++ LibOVR/Src/OVR_OSX_HIDDevice.h | 160 ++++ LibOVR/Src/OVR_OSX_HMDDevice.cpp | 264 ++++++ LibOVR/Src/OVR_OSX_HMDDevice.h | 153 ++++ LibOVR/Src/OVR_OSX_SensorDevice.cpp | 58 ++ Samples/CommonSrc/Platform/OSX_Gamepad.cpp | 430 ++++++++++ Samples/CommonSrc/Platform/OSX_Gamepad.h | 66 ++ Samples/CommonSrc/Platform/OSX_Platform.h | 113 +++ Samples/CommonSrc/Platform/OSX_Platform.mm | 553 ++++++++++++ Samples/CommonSrc/Platform/OSX_PlatformObjc.h | 53 ++ Samples/CommonSrc/Platform/OSX_WavPlayer.cpp | 250 ++++++ Samples/CommonSrc/Platform/OSX_WavPlayer.h | 72 ++ .../contents.xcworkspacedata | 10 + .../xcshareddata/xcschemes/LibOVR.xcscheme | 59 ++ .../xcschemes/OculusWorldDemo.xcscheme | 86 ++ .../Projects/Mac/Xcode/OculusWorldDemo-Info.plist | 34 + .../OculusWorldDemo.xcodeproj/project.pbxproj | 458 ++++++++++ 22 files changed, 4970 insertions(+), 1 deletion(-) create mode 100644 LibOVR/Projects/Mac/Xcode/LibOVR.xcodeproj/project.pbxproj create mode 100644 LibOVR/Projects/Mac/Xcode/LibOVR.xcodeproj/project.xcworkspace/contents.xcworkspacedata create mode 100644 LibOVR/Src/OVR_OSX_DeviceManager.cpp create mode 100644 LibOVR/Src/OVR_OSX_DeviceManager.h create mode 100644 LibOVR/Src/OVR_OSX_HIDDevice.cpp create mode 100644 LibOVR/Src/OVR_OSX_HIDDevice.h create mode 100644 LibOVR/Src/OVR_OSX_HMDDevice.cpp create mode 100644 LibOVR/Src/OVR_OSX_HMDDevice.h create mode 100644 LibOVR/Src/OVR_OSX_SensorDevice.cpp create mode 100644 Samples/CommonSrc/Platform/OSX_Gamepad.cpp create mode 100644 Samples/CommonSrc/Platform/OSX_Gamepad.h create mode 100644 Samples/CommonSrc/Platform/OSX_Platform.h create mode 100644 Samples/CommonSrc/Platform/OSX_Platform.mm create mode 100644 Samples/CommonSrc/Platform/OSX_PlatformObjc.h create mode 100644 Samples/CommonSrc/Platform/OSX_WavPlayer.cpp create mode 100644 Samples/CommonSrc/Platform/OSX_WavPlayer.h create mode 100644 Samples/LibOVR_With_Samples.xcworkspace/contents.xcworkspacedata create mode 100644 Samples/LibOVR_With_Samples.xcworkspace/xcshareddata/xcschemes/LibOVR.xcscheme create mode 100644 Samples/LibOVR_With_Samples.xcworkspace/xcshareddata/xcschemes/OculusWorldDemo.xcscheme create mode 100644 Samples/OculusWorldDemo/Projects/Mac/Xcode/OculusWorldDemo-Info.plist create mode 100644 Samples/OculusWorldDemo/Projects/Mac/Xcode/OculusWorldDemo.xcodeproj/project.pbxproj diff --git a/.gitignore b/.gitignore index c5937a5..2eff445 100644 --- a/.gitignore +++ b/.gitignore @@ -15,7 +15,7 @@ Doc LibOVR/Lib LibOVR/Obj Mac_OculusWorldDemo.app/Contents/Resources -OculusWorldDemo.app +*.app Samples/**/Obj Samples/**/Release Samples/**/Debug diff --git a/LibOVR/Projects/Mac/Xcode/LibOVR.xcodeproj/project.pbxproj b/LibOVR/Projects/Mac/Xcode/LibOVR.xcodeproj/project.pbxproj new file mode 100644 index 0000000..962c1cf --- /dev/null +++ b/LibOVR/Projects/Mac/Xcode/LibOVR.xcodeproj/project.pbxproj @@ -0,0 +1,731 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + E8754F81190F1B71005FD401 /* OVR_Recording.h in Headers */ = {isa = PBXBuildFile; fileRef = E8754F7F190F1B71005FD401 /* OVR_Recording.h */; }; + E886FE9E190737FA00D5DB45 /* OVR_CAPI_GL.h in Headers */ = {isa = PBXBuildFile; fileRef = E886FE9B190737FA00D5DB45 /* OVR_CAPI_GL.h */; }; + E886FE9F190737FA00D5DB45 /* OVR_CAPI.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E886FE9C190737FA00D5DB45 /* OVR_CAPI.cpp */; }; + E886FEA0190737FA00D5DB45 /* OVR_CAPI.h in Headers */ = {isa = PBXBuildFile; fileRef = E886FE9D190737FA00D5DB45 /* OVR_CAPI.h */; }; + E886FEA21907528C00D5DB45 /* CAPI_DistortionRenderer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E886FEA11907528C00D5DB45 /* CAPI_DistortionRenderer.cpp */; }; + E8AA40D11907221900D5F144 /* OVR_Alg.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E8AA40A61907221900D5F144 /* OVR_Alg.cpp */; }; + E8AA40D21907221900D5F144 /* OVR_Alg.h in Headers */ = {isa = PBXBuildFile; fileRef = E8AA40A71907221900D5F144 /* OVR_Alg.h */; }; + E8AA40D31907221900D5F144 /* OVR_Allocator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E8AA40A81907221900D5F144 /* OVR_Allocator.cpp */; }; + E8AA40D41907221900D5F144 /* OVR_Allocator.h in Headers */ = {isa = PBXBuildFile; fileRef = E8AA40A91907221900D5F144 /* OVR_Allocator.h */; }; + E8AA40D51907221900D5F144 /* OVR_Array.h in Headers */ = {isa = PBXBuildFile; fileRef = E8AA40AA1907221900D5F144 /* OVR_Array.h */; }; + E8AA40D61907221900D5F144 /* OVR_Atomic.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E8AA40AB1907221900D5F144 /* OVR_Atomic.cpp */; }; + E8AA40D71907221900D5F144 /* OVR_Atomic.h in Headers */ = {isa = PBXBuildFile; fileRef = E8AA40AC1907221900D5F144 /* OVR_Atomic.h */; }; + E8AA40D81907221900D5F144 /* OVR_Color.h in Headers */ = {isa = PBXBuildFile; fileRef = E8AA40AD1907221900D5F144 /* OVR_Color.h */; }; + E8AA40D91907221900D5F144 /* OVR_ContainerAllocator.h in Headers */ = {isa = PBXBuildFile; fileRef = E8AA40AE1907221900D5F144 /* OVR_ContainerAllocator.h */; }; + E8AA40DA1907221900D5F144 /* OVR_Deque.h in Headers */ = {isa = PBXBuildFile; fileRef = E8AA40AF1907221900D5F144 /* OVR_Deque.h */; }; + E8AA40DB1907221900D5F144 /* OVR_File.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E8AA40B01907221900D5F144 /* OVR_File.cpp */; }; + E8AA40DC1907221900D5F144 /* OVR_File.h in Headers */ = {isa = PBXBuildFile; fileRef = E8AA40B11907221900D5F144 /* OVR_File.h */; }; + E8AA40DD1907221900D5F144 /* OVR_FileFILE.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E8AA40B21907221900D5F144 /* OVR_FileFILE.cpp */; }; + E8AA40DE1907221900D5F144 /* OVR_Hash.h in Headers */ = {isa = PBXBuildFile; fileRef = E8AA40B31907221900D5F144 /* OVR_Hash.h */; }; + E8AA40DF1907221900D5F144 /* OVR_KeyCodes.h in Headers */ = {isa = PBXBuildFile; fileRef = E8AA40B41907221900D5F144 /* OVR_KeyCodes.h */; }; + E8AA40E01907221900D5F144 /* OVR_List.h in Headers */ = {isa = PBXBuildFile; fileRef = E8AA40B51907221900D5F144 /* OVR_List.h */; }; + E8AA40E11907221900D5F144 /* OVR_Lockless.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E8AA40B61907221900D5F144 /* OVR_Lockless.cpp */; }; + E8AA40E21907221900D5F144 /* OVR_Lockless.h in Headers */ = {isa = PBXBuildFile; fileRef = E8AA40B71907221900D5F144 /* OVR_Lockless.h */; }; + E8AA40E31907221900D5F144 /* OVR_Log.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E8AA40B81907221900D5F144 /* OVR_Log.cpp */; }; + E8AA40E41907221900D5F144 /* OVR_Log.h in Headers */ = {isa = PBXBuildFile; fileRef = E8AA40B91907221900D5F144 /* OVR_Log.h */; }; + E8AA40E51907221900D5F144 /* OVR_Math.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E8AA40BA1907221900D5F144 /* OVR_Math.cpp */; }; + E8AA40E61907221900D5F144 /* OVR_Math.h in Headers */ = {isa = PBXBuildFile; fileRef = E8AA40BB1907221900D5F144 /* OVR_Math.h */; }; + E8AA40E71907221900D5F144 /* OVR_RefCount.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E8AA40BC1907221900D5F144 /* OVR_RefCount.cpp */; }; + E8AA40E81907221900D5F144 /* OVR_RefCount.h in Headers */ = {isa = PBXBuildFile; fileRef = E8AA40BD1907221900D5F144 /* OVR_RefCount.h */; }; + E8AA40E91907221900D5F144 /* OVR_Std.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E8AA40BE1907221900D5F144 /* OVR_Std.cpp */; }; + E8AA40EA1907221900D5F144 /* OVR_Std.h in Headers */ = {isa = PBXBuildFile; fileRef = E8AA40BF1907221900D5F144 /* OVR_Std.h */; }; + E8AA40EB1907221900D5F144 /* OVR_String.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E8AA40C01907221900D5F144 /* OVR_String.cpp */; }; + E8AA40EC1907221900D5F144 /* OVR_String.h in Headers */ = {isa = PBXBuildFile; fileRef = E8AA40C11907221900D5F144 /* OVR_String.h */; }; + E8AA40ED1907221900D5F144 /* OVR_String_FormatUtil.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E8AA40C21907221900D5F144 /* OVR_String_FormatUtil.cpp */; }; + E8AA40EE1907221900D5F144 /* OVR_String_PathUtil.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E8AA40C31907221900D5F144 /* OVR_String_PathUtil.cpp */; }; + E8AA40EF1907221900D5F144 /* OVR_StringHash.h in Headers */ = {isa = PBXBuildFile; fileRef = E8AA40C41907221900D5F144 /* OVR_StringHash.h */; }; + E8AA40F01907221900D5F144 /* OVR_SysFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E8AA40C51907221900D5F144 /* OVR_SysFile.cpp */; }; + E8AA40F11907221900D5F144 /* OVR_SysFile.h in Headers */ = {isa = PBXBuildFile; fileRef = E8AA40C61907221900D5F144 /* OVR_SysFile.h */; }; + E8AA40F21907221900D5F144 /* OVR_System.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E8AA40C71907221900D5F144 /* OVR_System.cpp */; }; + E8AA40F31907221900D5F144 /* OVR_System.h in Headers */ = {isa = PBXBuildFile; fileRef = E8AA40C81907221900D5F144 /* OVR_System.h */; }; + E8AA40F41907221900D5F144 /* OVR_Threads.h in Headers */ = {isa = PBXBuildFile; fileRef = E8AA40C91907221900D5F144 /* OVR_Threads.h */; }; + E8AA40F51907221900D5F144 /* OVR_ThreadsPthread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E8AA40CA1907221900D5F144 /* OVR_ThreadsPthread.cpp */; }; + E8AA40F71907221900D5F144 /* OVR_Timer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E8AA40CC1907221900D5F144 /* OVR_Timer.cpp */; }; + E8AA40F81907221900D5F144 /* OVR_Timer.h in Headers */ = {isa = PBXBuildFile; fileRef = E8AA40CD1907221900D5F144 /* OVR_Timer.h */; }; + E8AA40F91907221900D5F144 /* OVR_Types.h in Headers */ = {isa = PBXBuildFile; fileRef = E8AA40CE1907221900D5F144 /* OVR_Types.h */; }; + E8AA40FA1907221900D5F144 /* OVR_UTF8Util.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E8AA40CF1907221900D5F144 /* OVR_UTF8Util.cpp */; }; + E8AA40FB1907221900D5F144 /* OVR_UTF8Util.h in Headers */ = {isa = PBXBuildFile; fileRef = E8AA40D01907221900D5F144 /* OVR_UTF8Util.h */; }; + E8AA410D1907224700D5F144 /* Util_Interface.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E8AA41011907224700D5F144 /* Util_Interface.cpp */; }; + E8AA410E1907224700D5F144 /* Util_Interface.h in Headers */ = {isa = PBXBuildFile; fileRef = E8AA41021907224700D5F144 /* Util_Interface.h */; }; + E8AA410F1907224700D5F144 /* Util_LatencyTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E8AA41031907224700D5F144 /* Util_LatencyTest.cpp */; }; + E8AA41101907224700D5F144 /* Util_LatencyTest.h in Headers */ = {isa = PBXBuildFile; fileRef = E8AA41041907224700D5F144 /* Util_LatencyTest.h */; }; + E8AA41111907224700D5F144 /* Util_LatencyTest2.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E8AA41051907224700D5F144 /* Util_LatencyTest2.cpp */; }; + E8AA41121907224700D5F144 /* Util_LatencyTest2.h in Headers */ = {isa = PBXBuildFile; fileRef = E8AA41061907224700D5F144 /* Util_LatencyTest2.h */; }; + E8AA41131907224700D5F144 /* Util_Render_Stereo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E8AA41071907224700D5F144 /* Util_Render_Stereo.cpp */; }; + E8AA41141907224700D5F144 /* Util_Render_Stereo.h in Headers */ = {isa = PBXBuildFile; fileRef = E8AA41081907224700D5F144 /* Util_Render_Stereo.h */; }; + E8AA4169190722BB00D5F144 /* OVR_Device.h in Headers */ = {isa = PBXBuildFile; fileRef = E8AA4121190722BB00D5F144 /* OVR_Device.h */; }; + E8AA416A190722BB00D5F144 /* OVR_DeviceConstants.h in Headers */ = {isa = PBXBuildFile; fileRef = E8AA4122190722BB00D5F144 /* OVR_DeviceConstants.h */; }; + E8AA416B190722BB00D5F144 /* OVR_DeviceHandle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E8AA4123190722BB00D5F144 /* OVR_DeviceHandle.cpp */; }; + E8AA416C190722BB00D5F144 /* OVR_DeviceHandle.h in Headers */ = {isa = PBXBuildFile; fileRef = E8AA4124190722BB00D5F144 /* OVR_DeviceHandle.h */; }; + E8AA416D190722BB00D5F144 /* OVR_DeviceImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E8AA4125190722BB00D5F144 /* OVR_DeviceImpl.cpp */; }; + E8AA416E190722BB00D5F144 /* OVR_DeviceImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = E8AA4126190722BB00D5F144 /* OVR_DeviceImpl.h */; }; + E8AA416F190722BB00D5F144 /* OVR_DeviceMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = E8AA4127190722BB00D5F144 /* OVR_DeviceMessages.h */; }; + E8AA4170190722BB00D5F144 /* OVR_HIDDevice.h in Headers */ = {isa = PBXBuildFile; fileRef = E8AA4128190722BB00D5F144 /* OVR_HIDDevice.h */; }; + E8AA4171190722BB00D5F144 /* OVR_HIDDeviceBase.h in Headers */ = {isa = PBXBuildFile; fileRef = E8AA4129190722BB00D5F144 /* OVR_HIDDeviceBase.h */; }; + E8AA4172190722BB00D5F144 /* OVR_HIDDeviceImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = E8AA412A190722BB00D5F144 /* OVR_HIDDeviceImpl.h */; }; + E8AA4173190722BB00D5F144 /* OVR_JSON.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E8AA412B190722BB00D5F144 /* OVR_JSON.cpp */; }; + E8AA4174190722BB00D5F144 /* OVR_JSON.h in Headers */ = {isa = PBXBuildFile; fileRef = E8AA412C190722BB00D5F144 /* OVR_JSON.h */; }; + E8AA4175190722BB00D5F144 /* OVR_LatencyTestImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E8AA412D190722BB00D5F144 /* OVR_LatencyTestImpl.cpp */; }; + E8AA4176190722BB00D5F144 /* OVR_LatencyTestImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = E8AA412E190722BB00D5F144 /* OVR_LatencyTestImpl.h */; }; + E8AA417E190722BB00D5F144 /* OVR_OSX_DeviceManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E8AA4136190722BB00D5F144 /* OVR_OSX_DeviceManager.cpp */; }; + E8AA417F190722BB00D5F144 /* OVR_OSX_DeviceManager.h in Headers */ = {isa = PBXBuildFile; fileRef = E8AA4137190722BB00D5F144 /* OVR_OSX_DeviceManager.h */; }; + E8AA4180190722BB00D5F144 /* OVR_OSX_HIDDevice.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E8AA4138190722BB00D5F144 /* OVR_OSX_HIDDevice.cpp */; }; + E8AA4181190722BB00D5F144 /* OVR_OSX_HIDDevice.h in Headers */ = {isa = PBXBuildFile; fileRef = E8AA4139190722BB00D5F144 /* OVR_OSX_HIDDevice.h */; }; + E8AA4182190722BB00D5F144 /* OVR_OSX_HMDDevice.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E8AA413A190722BB00D5F144 /* OVR_OSX_HMDDevice.cpp */; }; + E8AA4183190722BB00D5F144 /* OVR_OSX_HMDDevice.h in Headers */ = {isa = PBXBuildFile; fileRef = E8AA413B190722BB00D5F144 /* OVR_OSX_HMDDevice.h */; }; + E8AA4184190722BB00D5F144 /* OVR_OSX_SensorDevice.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E8AA413C190722BB00D5F144 /* OVR_OSX_SensorDevice.cpp */; }; + E8AA4185190722BB00D5F144 /* OVR_Profile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E8AA413D190722BB00D5F144 /* OVR_Profile.cpp */; }; + E8AA4186190722BB00D5F144 /* OVR_Profile.h in Headers */ = {isa = PBXBuildFile; fileRef = E8AA413E190722BB00D5F144 /* OVR_Profile.h */; }; + E8AA4187190722BB00D5F144 /* OVR_Sensor2Impl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E8AA413F190722BB00D5F144 /* OVR_Sensor2Impl.cpp */; }; + E8AA4188190722BB00D5F144 /* OVR_Sensor2Impl.h in Headers */ = {isa = PBXBuildFile; fileRef = E8AA4140190722BB00D5F144 /* OVR_Sensor2Impl.h */; }; + E8AA4189190722BB00D5F144 /* OVR_Sensor2ImplUtil.h in Headers */ = {isa = PBXBuildFile; fileRef = E8AA4141190722BB00D5F144 /* OVR_Sensor2ImplUtil.h */; }; + E8AA418A190722BB00D5F144 /* OVR_SensorCalibration.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E8AA4142190722BB00D5F144 /* OVR_SensorCalibration.cpp */; }; + E8AA418B190722BB00D5F144 /* OVR_SensorCalibration.h in Headers */ = {isa = PBXBuildFile; fileRef = E8AA4143190722BB00D5F144 /* OVR_SensorCalibration.h */; }; + E8AA418C190722BB00D5F144 /* OVR_SensorFilter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E8AA4144190722BB00D5F144 /* OVR_SensorFilter.cpp */; }; + E8AA418D190722BB00D5F144 /* OVR_SensorFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = E8AA4145190722BB00D5F144 /* OVR_SensorFilter.h */; }; + E8AA418E190722BB00D5F144 /* OVR_SensorFusion.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E8AA4146190722BB00D5F144 /* OVR_SensorFusion.cpp */; }; + E8AA418F190722BB00D5F144 /* OVR_SensorFusion.h in Headers */ = {isa = PBXBuildFile; fileRef = E8AA4147190722BB00D5F144 /* OVR_SensorFusion.h */; }; + E8AA4190190722BB00D5F144 /* OVR_SensorFusionDebug.h in Headers */ = {isa = PBXBuildFile; fileRef = E8AA4148190722BB00D5F144 /* OVR_SensorFusionDebug.h */; }; + E8AA4191190722BB00D5F144 /* OVR_SensorImpl_Common.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E8AA4149190722BB00D5F144 /* OVR_SensorImpl_Common.cpp */; }; + E8AA4192190722BB00D5F144 /* OVR_SensorImpl_Common.h in Headers */ = {isa = PBXBuildFile; fileRef = E8AA414A190722BB00D5F144 /* OVR_SensorImpl_Common.h */; }; + E8AA4193190722BB00D5F144 /* OVR_SensorImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E8AA414B190722BB00D5F144 /* OVR_SensorImpl.cpp */; }; + E8AA4194190722BB00D5F144 /* OVR_SensorImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = E8AA414C190722BB00D5F144 /* OVR_SensorImpl.h */; }; + E8AA4195190722BB00D5F144 /* OVR_SensorTimeFilter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E8AA414D190722BB00D5F144 /* OVR_SensorTimeFilter.cpp */; }; + E8AA4196190722BB00D5F144 /* OVR_SensorTimeFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = E8AA414E190722BB00D5F144 /* OVR_SensorTimeFilter.h */; }; + E8AA4197190722BB00D5F144 /* OVR_Stereo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E8AA414F190722BB00D5F144 /* OVR_Stereo.cpp */; }; + E8AA4198190722BB00D5F144 /* OVR_Stereo.h in Headers */ = {isa = PBXBuildFile; fileRef = E8AA4150190722BB00D5F144 /* OVR_Stereo.h */; }; + E8AA4199190722BB00D5F144 /* OVR_ThreadCommandQueue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E8AA4151190722BB00D5F144 /* OVR_ThreadCommandQueue.cpp */; }; + E8AA419A190722BB00D5F144 /* OVR_ThreadCommandQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = E8AA4152190722BB00D5F144 /* OVR_ThreadCommandQueue.h */; }; + E8AA41E2190724E600D5F144 /* CAPI_DistortionRenderer.h in Headers */ = {isa = PBXBuildFile; fileRef = E8AA41BA190724E600D5F144 /* CAPI_DistortionRenderer.h */; }; + E8AA41E3190724E600D5F144 /* CAPI_FrameTimeManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E8AA41BB190724E600D5F144 /* CAPI_FrameTimeManager.cpp */; }; + E8AA41E4190724E600D5F144 /* CAPI_FrameTimeManager.h in Headers */ = {isa = PBXBuildFile; fileRef = E8AA41BC190724E600D5F144 /* CAPI_FrameTimeManager.h */; }; + E8AA41E5190724E600D5F144 /* CAPI_GlobalState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E8AA41BD190724E600D5F144 /* CAPI_GlobalState.cpp */; }; + E8AA41E6190724E600D5F144 /* CAPI_GlobalState.h in Headers */ = {isa = PBXBuildFile; fileRef = E8AA41BE190724E600D5F144 /* CAPI_GlobalState.h */; }; + E8AA41E7190724E600D5F144 /* CAPI_HMDRenderState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E8AA41BF190724E600D5F144 /* CAPI_HMDRenderState.cpp */; }; + E8AA41E8190724E600D5F144 /* CAPI_HMDRenderState.h in Headers */ = {isa = PBXBuildFile; fileRef = E8AA41C0190724E600D5F144 /* CAPI_HMDRenderState.h */; }; + E8AA41E9190724E600D5F144 /* CAPI_HMDState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E8AA41C1190724E600D5F144 /* CAPI_HMDState.cpp */; }; + E8AA41EA190724E600D5F144 /* CAPI_HMDState.h in Headers */ = {isa = PBXBuildFile; fileRef = E8AA41C2190724E600D5F144 /* CAPI_HMDState.h */; }; + E8AA41F6190724E600D5F144 /* CAPI_GL_DistortionRenderer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E8AA41D0190724E600D5F144 /* CAPI_GL_DistortionRenderer.cpp */; }; + E8AA41F7190724E600D5F144 /* CAPI_GL_DistortionRenderer.h in Headers */ = {isa = PBXBuildFile; fileRef = E8AA41D1190724E600D5F144 /* CAPI_GL_DistortionRenderer.h */; }; + E8AA41F8190724E600D5F144 /* CAPI_GL_Util.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E8AA41D2190724E600D5F144 /* CAPI_GL_Util.cpp */; }; + E8AA41F9190724E600D5F144 /* CAPI_GL_Util.h in Headers */ = {isa = PBXBuildFile; fileRef = E8AA41D3190724E600D5F144 /* CAPI_GL_Util.h */; }; + E8F1F13E1921911D000EC969 /* OVR_Recording.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E8F1F13D1921911D000EC969 /* OVR_Recording.cpp */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + E82D4CD31906FE640070CB3F /* libovr.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libovr.a; sourceTree = BUILT_PRODUCTS_DIR; }; + E8754F7F190F1B71005FD401 /* OVR_Recording.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OVR_Recording.h; path = ../../../Src/OVR_Recording.h; sourceTree = ""; }; + E886FE9B190737FA00D5DB45 /* OVR_CAPI_GL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OVR_CAPI_GL.h; path = ../../../Src/OVR_CAPI_GL.h; sourceTree = ""; }; + E886FE9C190737FA00D5DB45 /* OVR_CAPI.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = OVR_CAPI.cpp; path = ../../../Src/OVR_CAPI.cpp; sourceTree = ""; }; + E886FE9D190737FA00D5DB45 /* OVR_CAPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OVR_CAPI.h; path = ../../../Src/OVR_CAPI.h; sourceTree = ""; }; + E886FEA11907528C00D5DB45 /* CAPI_DistortionRenderer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CAPI_DistortionRenderer.cpp; sourceTree = ""; }; + E8AA40A61907221900D5F144 /* OVR_Alg.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OVR_Alg.cpp; sourceTree = ""; }; + E8AA40A71907221900D5F144 /* OVR_Alg.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OVR_Alg.h; sourceTree = ""; }; + E8AA40A81907221900D5F144 /* OVR_Allocator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OVR_Allocator.cpp; sourceTree = ""; }; + E8AA40A91907221900D5F144 /* OVR_Allocator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OVR_Allocator.h; sourceTree = ""; }; + E8AA40AA1907221900D5F144 /* OVR_Array.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OVR_Array.h; sourceTree = ""; }; + E8AA40AB1907221900D5F144 /* OVR_Atomic.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OVR_Atomic.cpp; sourceTree = ""; }; + E8AA40AC1907221900D5F144 /* OVR_Atomic.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OVR_Atomic.h; sourceTree = ""; }; + E8AA40AD1907221900D5F144 /* OVR_Color.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OVR_Color.h; sourceTree = ""; }; + E8AA40AE1907221900D5F144 /* OVR_ContainerAllocator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OVR_ContainerAllocator.h; sourceTree = ""; }; + E8AA40AF1907221900D5F144 /* OVR_Deque.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OVR_Deque.h; sourceTree = ""; }; + E8AA40B01907221900D5F144 /* OVR_File.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OVR_File.cpp; sourceTree = ""; }; + E8AA40B11907221900D5F144 /* OVR_File.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OVR_File.h; sourceTree = ""; }; + E8AA40B21907221900D5F144 /* OVR_FileFILE.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OVR_FileFILE.cpp; sourceTree = ""; }; + E8AA40B31907221900D5F144 /* OVR_Hash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OVR_Hash.h; sourceTree = ""; }; + E8AA40B41907221900D5F144 /* OVR_KeyCodes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OVR_KeyCodes.h; sourceTree = ""; }; + E8AA40B51907221900D5F144 /* OVR_List.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OVR_List.h; sourceTree = ""; }; + E8AA40B61907221900D5F144 /* OVR_Lockless.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OVR_Lockless.cpp; sourceTree = ""; }; + E8AA40B71907221900D5F144 /* OVR_Lockless.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OVR_Lockless.h; sourceTree = ""; }; + E8AA40B81907221900D5F144 /* OVR_Log.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OVR_Log.cpp; sourceTree = ""; }; + E8AA40B91907221900D5F144 /* OVR_Log.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OVR_Log.h; sourceTree = ""; }; + E8AA40BA1907221900D5F144 /* OVR_Math.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OVR_Math.cpp; sourceTree = ""; }; + E8AA40BB1907221900D5F144 /* OVR_Math.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OVR_Math.h; sourceTree = ""; }; + E8AA40BC1907221900D5F144 /* OVR_RefCount.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OVR_RefCount.cpp; sourceTree = ""; }; + E8AA40BD1907221900D5F144 /* OVR_RefCount.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OVR_RefCount.h; sourceTree = ""; }; + E8AA40BE1907221900D5F144 /* OVR_Std.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OVR_Std.cpp; sourceTree = ""; }; + E8AA40BF1907221900D5F144 /* OVR_Std.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OVR_Std.h; sourceTree = ""; }; + E8AA40C01907221900D5F144 /* OVR_String.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OVR_String.cpp; sourceTree = ""; }; + E8AA40C11907221900D5F144 /* OVR_String.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OVR_String.h; sourceTree = ""; }; + E8AA40C21907221900D5F144 /* OVR_String_FormatUtil.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OVR_String_FormatUtil.cpp; sourceTree = ""; }; + E8AA40C31907221900D5F144 /* OVR_String_PathUtil.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OVR_String_PathUtil.cpp; sourceTree = ""; }; + E8AA40C41907221900D5F144 /* OVR_StringHash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OVR_StringHash.h; sourceTree = ""; }; + E8AA40C51907221900D5F144 /* OVR_SysFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OVR_SysFile.cpp; sourceTree = ""; }; + E8AA40C61907221900D5F144 /* OVR_SysFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OVR_SysFile.h; sourceTree = ""; }; + E8AA40C71907221900D5F144 /* OVR_System.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OVR_System.cpp; sourceTree = ""; }; + E8AA40C81907221900D5F144 /* OVR_System.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OVR_System.h; sourceTree = ""; }; + E8AA40C91907221900D5F144 /* OVR_Threads.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OVR_Threads.h; sourceTree = ""; }; + E8AA40CA1907221900D5F144 /* OVR_ThreadsPthread.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OVR_ThreadsPthread.cpp; sourceTree = ""; }; + E8AA40CC1907221900D5F144 /* OVR_Timer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OVR_Timer.cpp; sourceTree = ""; }; + E8AA40CD1907221900D5F144 /* OVR_Timer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OVR_Timer.h; sourceTree = ""; }; + E8AA40CE1907221900D5F144 /* OVR_Types.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OVR_Types.h; sourceTree = ""; }; + E8AA40CF1907221900D5F144 /* OVR_UTF8Util.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OVR_UTF8Util.cpp; sourceTree = ""; }; + E8AA40D01907221900D5F144 /* OVR_UTF8Util.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OVR_UTF8Util.h; sourceTree = ""; }; + E8AA41011907224700D5F144 /* Util_Interface.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Util_Interface.cpp; sourceTree = ""; }; + E8AA41021907224700D5F144 /* Util_Interface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Util_Interface.h; sourceTree = ""; }; + E8AA41031907224700D5F144 /* Util_LatencyTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Util_LatencyTest.cpp; sourceTree = ""; }; + E8AA41041907224700D5F144 /* Util_LatencyTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Util_LatencyTest.h; sourceTree = ""; }; + E8AA41051907224700D5F144 /* Util_LatencyTest2.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Util_LatencyTest2.cpp; sourceTree = ""; }; + E8AA41061907224700D5F144 /* Util_LatencyTest2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Util_LatencyTest2.h; sourceTree = ""; }; + E8AA41071907224700D5F144 /* Util_Render_Stereo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Util_Render_Stereo.cpp; sourceTree = ""; }; + E8AA41081907224700D5F144 /* Util_Render_Stereo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Util_Render_Stereo.h; sourceTree = ""; }; + E8AA4121190722BB00D5F144 /* OVR_Device.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OVR_Device.h; path = ../../../Src/OVR_Device.h; sourceTree = ""; }; + E8AA4122190722BB00D5F144 /* OVR_DeviceConstants.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OVR_DeviceConstants.h; path = ../../../Src/OVR_DeviceConstants.h; sourceTree = ""; }; + E8AA4123190722BB00D5F144 /* OVR_DeviceHandle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = OVR_DeviceHandle.cpp; path = ../../../Src/OVR_DeviceHandle.cpp; sourceTree = ""; }; + E8AA4124190722BB00D5F144 /* OVR_DeviceHandle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OVR_DeviceHandle.h; path = ../../../Src/OVR_DeviceHandle.h; sourceTree = ""; }; + E8AA4125190722BB00D5F144 /* OVR_DeviceImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = OVR_DeviceImpl.cpp; path = ../../../Src/OVR_DeviceImpl.cpp; sourceTree = ""; }; + E8AA4126190722BB00D5F144 /* OVR_DeviceImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OVR_DeviceImpl.h; path = ../../../Src/OVR_DeviceImpl.h; sourceTree = ""; }; + E8AA4127190722BB00D5F144 /* OVR_DeviceMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OVR_DeviceMessages.h; path = ../../../Src/OVR_DeviceMessages.h; sourceTree = ""; }; + E8AA4128190722BB00D5F144 /* OVR_HIDDevice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OVR_HIDDevice.h; path = ../../../Src/OVR_HIDDevice.h; sourceTree = ""; }; + E8AA4129190722BB00D5F144 /* OVR_HIDDeviceBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OVR_HIDDeviceBase.h; path = ../../../Src/OVR_HIDDeviceBase.h; sourceTree = ""; }; + E8AA412A190722BB00D5F144 /* OVR_HIDDeviceImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OVR_HIDDeviceImpl.h; path = ../../../Src/OVR_HIDDeviceImpl.h; sourceTree = ""; }; + E8AA412B190722BB00D5F144 /* OVR_JSON.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = OVR_JSON.cpp; path = ../../../Src/OVR_JSON.cpp; sourceTree = ""; }; + E8AA412C190722BB00D5F144 /* OVR_JSON.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OVR_JSON.h; path = ../../../Src/OVR_JSON.h; sourceTree = ""; }; + E8AA412D190722BB00D5F144 /* OVR_LatencyTestImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = OVR_LatencyTestImpl.cpp; path = ../../../Src/OVR_LatencyTestImpl.cpp; sourceTree = ""; }; + E8AA412E190722BB00D5F144 /* OVR_LatencyTestImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OVR_LatencyTestImpl.h; path = ../../../Src/OVR_LatencyTestImpl.h; sourceTree = ""; }; + E8AA4136190722BB00D5F144 /* OVR_OSX_DeviceManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = OVR_OSX_DeviceManager.cpp; path = ../../../Src/OVR_OSX_DeviceManager.cpp; sourceTree = ""; }; + E8AA4137190722BB00D5F144 /* OVR_OSX_DeviceManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OVR_OSX_DeviceManager.h; path = ../../../Src/OVR_OSX_DeviceManager.h; sourceTree = ""; }; + E8AA4138190722BB00D5F144 /* OVR_OSX_HIDDevice.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = OVR_OSX_HIDDevice.cpp; path = ../../../Src/OVR_OSX_HIDDevice.cpp; sourceTree = ""; }; + E8AA4139190722BB00D5F144 /* OVR_OSX_HIDDevice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OVR_OSX_HIDDevice.h; path = ../../../Src/OVR_OSX_HIDDevice.h; sourceTree = ""; }; + E8AA413A190722BB00D5F144 /* OVR_OSX_HMDDevice.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = OVR_OSX_HMDDevice.cpp; path = ../../../Src/OVR_OSX_HMDDevice.cpp; sourceTree = ""; }; + E8AA413B190722BB00D5F144 /* OVR_OSX_HMDDevice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OVR_OSX_HMDDevice.h; path = ../../../Src/OVR_OSX_HMDDevice.h; sourceTree = ""; }; + E8AA413C190722BB00D5F144 /* OVR_OSX_SensorDevice.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = OVR_OSX_SensorDevice.cpp; path = ../../../Src/OVR_OSX_SensorDevice.cpp; sourceTree = ""; }; + E8AA413D190722BB00D5F144 /* OVR_Profile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = OVR_Profile.cpp; path = ../../../Src/OVR_Profile.cpp; sourceTree = ""; }; + E8AA413E190722BB00D5F144 /* OVR_Profile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OVR_Profile.h; path = ../../../Src/OVR_Profile.h; sourceTree = ""; }; + E8AA413F190722BB00D5F144 /* OVR_Sensor2Impl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = OVR_Sensor2Impl.cpp; path = ../../../Src/OVR_Sensor2Impl.cpp; sourceTree = ""; }; + E8AA4140190722BB00D5F144 /* OVR_Sensor2Impl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OVR_Sensor2Impl.h; path = ../../../Src/OVR_Sensor2Impl.h; sourceTree = ""; }; + E8AA4141190722BB00D5F144 /* OVR_Sensor2ImplUtil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OVR_Sensor2ImplUtil.h; path = ../../../Src/OVR_Sensor2ImplUtil.h; sourceTree = ""; }; + E8AA4142190722BB00D5F144 /* OVR_SensorCalibration.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = OVR_SensorCalibration.cpp; path = ../../../Src/OVR_SensorCalibration.cpp; sourceTree = ""; }; + E8AA4143190722BB00D5F144 /* OVR_SensorCalibration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OVR_SensorCalibration.h; path = ../../../Src/OVR_SensorCalibration.h; sourceTree = ""; }; + E8AA4144190722BB00D5F144 /* OVR_SensorFilter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = OVR_SensorFilter.cpp; path = ../../../Src/OVR_SensorFilter.cpp; sourceTree = ""; }; + E8AA4145190722BB00D5F144 /* OVR_SensorFilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OVR_SensorFilter.h; path = ../../../Src/OVR_SensorFilter.h; sourceTree = ""; }; + E8AA4146190722BB00D5F144 /* OVR_SensorFusion.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = OVR_SensorFusion.cpp; path = ../../../Src/OVR_SensorFusion.cpp; sourceTree = ""; }; + E8AA4147190722BB00D5F144 /* OVR_SensorFusion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OVR_SensorFusion.h; path = ../../../Src/OVR_SensorFusion.h; sourceTree = ""; }; + E8AA4148190722BB00D5F144 /* OVR_SensorFusionDebug.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OVR_SensorFusionDebug.h; path = ../../../Src/OVR_SensorFusionDebug.h; sourceTree = ""; }; + E8AA4149190722BB00D5F144 /* OVR_SensorImpl_Common.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = OVR_SensorImpl_Common.cpp; path = ../../../Src/OVR_SensorImpl_Common.cpp; sourceTree = ""; }; + E8AA414A190722BB00D5F144 /* OVR_SensorImpl_Common.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OVR_SensorImpl_Common.h; path = ../../../Src/OVR_SensorImpl_Common.h; sourceTree = ""; }; + E8AA414B190722BB00D5F144 /* OVR_SensorImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = OVR_SensorImpl.cpp; path = ../../../Src/OVR_SensorImpl.cpp; sourceTree = ""; }; + E8AA414C190722BB00D5F144 /* OVR_SensorImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OVR_SensorImpl.h; path = ../../../Src/OVR_SensorImpl.h; sourceTree = ""; }; + E8AA414D190722BB00D5F144 /* OVR_SensorTimeFilter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = OVR_SensorTimeFilter.cpp; path = ../../../Src/OVR_SensorTimeFilter.cpp; sourceTree = ""; }; + E8AA414E190722BB00D5F144 /* OVR_SensorTimeFilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OVR_SensorTimeFilter.h; path = ../../../Src/OVR_SensorTimeFilter.h; sourceTree = ""; }; + E8AA414F190722BB00D5F144 /* OVR_Stereo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = OVR_Stereo.cpp; path = ../../../Src/OVR_Stereo.cpp; sourceTree = ""; }; + E8AA4150190722BB00D5F144 /* OVR_Stereo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OVR_Stereo.h; path = ../../../Src/OVR_Stereo.h; sourceTree = ""; }; + E8AA4151190722BB00D5F144 /* OVR_ThreadCommandQueue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = OVR_ThreadCommandQueue.cpp; path = ../../../Src/OVR_ThreadCommandQueue.cpp; sourceTree = ""; }; + E8AA4152190722BB00D5F144 /* OVR_ThreadCommandQueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OVR_ThreadCommandQueue.h; path = ../../../Src/OVR_ThreadCommandQueue.h; sourceTree = ""; }; + E8AA41BA190724E600D5F144 /* CAPI_DistortionRenderer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CAPI_DistortionRenderer.h; sourceTree = ""; }; + E8AA41BB190724E600D5F144 /* CAPI_FrameTimeManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CAPI_FrameTimeManager.cpp; sourceTree = ""; }; + E8AA41BC190724E600D5F144 /* CAPI_FrameTimeManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CAPI_FrameTimeManager.h; sourceTree = ""; }; + E8AA41BD190724E600D5F144 /* CAPI_GlobalState.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CAPI_GlobalState.cpp; sourceTree = ""; }; + E8AA41BE190724E600D5F144 /* CAPI_GlobalState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CAPI_GlobalState.h; sourceTree = ""; }; + E8AA41BF190724E600D5F144 /* CAPI_HMDRenderState.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CAPI_HMDRenderState.cpp; sourceTree = ""; }; + E8AA41C0190724E600D5F144 /* CAPI_HMDRenderState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CAPI_HMDRenderState.h; sourceTree = ""; }; + E8AA41C1190724E600D5F144 /* CAPI_HMDState.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CAPI_HMDState.cpp; sourceTree = ""; }; + E8AA41C2190724E600D5F144 /* CAPI_HMDState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CAPI_HMDState.h; sourceTree = ""; }; + E8AA41D0190724E600D5F144 /* CAPI_GL_DistortionRenderer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CAPI_GL_DistortionRenderer.cpp; sourceTree = ""; }; + E8AA41D1190724E600D5F144 /* CAPI_GL_DistortionRenderer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CAPI_GL_DistortionRenderer.h; sourceTree = ""; }; + E8AA41D2190724E600D5F144 /* CAPI_GL_Util.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CAPI_GL_Util.cpp; sourceTree = ""; }; + E8AA41D3190724E600D5F144 /* CAPI_GL_Util.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CAPI_GL_Util.h; sourceTree = ""; }; + E8F1F13D1921911D000EC969 /* OVR_Recording.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = OVR_Recording.cpp; path = ../../../Src/OVR_Recording.cpp; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + E82D4CD01906FE640070CB3F /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + E82D4CCA1906FE640070CB3F = { + isa = PBXGroup; + children = ( + E8AA41B8190724E600D5F144 /* CAPI */, + E8AA40A51907221900D5F144 /* Kernel */, + E8AA40FC1907224700D5F144 /* Util */, + E886FE9B190737FA00D5DB45 /* OVR_CAPI_GL.h */, + E886FE9C190737FA00D5DB45 /* OVR_CAPI.cpp */, + E886FE9D190737FA00D5DB45 /* OVR_CAPI.h */, + E8AA4121190722BB00D5F144 /* OVR_Device.h */, + E8AA4122190722BB00D5F144 /* OVR_DeviceConstants.h */, + E8AA4123190722BB00D5F144 /* OVR_DeviceHandle.cpp */, + E8AA4124190722BB00D5F144 /* OVR_DeviceHandle.h */, + E8AA4125190722BB00D5F144 /* OVR_DeviceImpl.cpp */, + E8AA4126190722BB00D5F144 /* OVR_DeviceImpl.h */, + E8AA4127190722BB00D5F144 /* OVR_DeviceMessages.h */, + E8AA4128190722BB00D5F144 /* OVR_HIDDevice.h */, + E8AA4129190722BB00D5F144 /* OVR_HIDDeviceBase.h */, + E8AA412A190722BB00D5F144 /* OVR_HIDDeviceImpl.h */, + E8AA412B190722BB00D5F144 /* OVR_JSON.cpp */, + E8AA412C190722BB00D5F144 /* OVR_JSON.h */, + E8AA412D190722BB00D5F144 /* OVR_LatencyTestImpl.cpp */, + E8AA412E190722BB00D5F144 /* OVR_LatencyTestImpl.h */, + E8AA4136190722BB00D5F144 /* OVR_OSX_DeviceManager.cpp */, + E8AA4137190722BB00D5F144 /* OVR_OSX_DeviceManager.h */, + E8AA4138190722BB00D5F144 /* OVR_OSX_HIDDevice.cpp */, + E8AA4139190722BB00D5F144 /* OVR_OSX_HIDDevice.h */, + E8AA413A190722BB00D5F144 /* OVR_OSX_HMDDevice.cpp */, + E8AA413B190722BB00D5F144 /* OVR_OSX_HMDDevice.h */, + E8AA413C190722BB00D5F144 /* OVR_OSX_SensorDevice.cpp */, + E8AA413D190722BB00D5F144 /* OVR_Profile.cpp */, + E8AA413E190722BB00D5F144 /* OVR_Profile.h */, + E8F1F13D1921911D000EC969 /* OVR_Recording.cpp */, + E8754F7F190F1B71005FD401 /* OVR_Recording.h */, + E8AA413F190722BB00D5F144 /* OVR_Sensor2Impl.cpp */, + E8AA4140190722BB00D5F144 /* OVR_Sensor2Impl.h */, + E8AA4141190722BB00D5F144 /* OVR_Sensor2ImplUtil.h */, + E8AA4142190722BB00D5F144 /* OVR_SensorCalibration.cpp */, + E8AA4143190722BB00D5F144 /* OVR_SensorCalibration.h */, + E8AA4144190722BB00D5F144 /* OVR_SensorFilter.cpp */, + E8AA4145190722BB00D5F144 /* OVR_SensorFilter.h */, + E8AA4146190722BB00D5F144 /* OVR_SensorFusion.cpp */, + E8AA4147190722BB00D5F144 /* OVR_SensorFusion.h */, + E8AA4148190722BB00D5F144 /* OVR_SensorFusionDebug.h */, + E8AA4149190722BB00D5F144 /* OVR_SensorImpl_Common.cpp */, + E8AA414A190722BB00D5F144 /* OVR_SensorImpl_Common.h */, + E8AA414B190722BB00D5F144 /* OVR_SensorImpl.cpp */, + E8AA414C190722BB00D5F144 /* OVR_SensorImpl.h */, + E8AA414D190722BB00D5F144 /* OVR_SensorTimeFilter.cpp */, + E8AA414E190722BB00D5F144 /* OVR_SensorTimeFilter.h */, + E8AA414F190722BB00D5F144 /* OVR_Stereo.cpp */, + E8AA4150190722BB00D5F144 /* OVR_Stereo.h */, + E8AA4151190722BB00D5F144 /* OVR_ThreadCommandQueue.cpp */, + E8AA4152190722BB00D5F144 /* OVR_ThreadCommandQueue.h */, + E82D4CD41906FE640070CB3F /* Products */, + ); + sourceTree = ""; + }; + E82D4CD41906FE640070CB3F /* Products */ = { + isa = PBXGroup; + children = ( + E82D4CD31906FE640070CB3F /* libovr.a */, + ); + name = Products; + sourceTree = ""; + }; + E8AA40A51907221900D5F144 /* Kernel */ = { + isa = PBXGroup; + children = ( + E8AA40A61907221900D5F144 /* OVR_Alg.cpp */, + E8AA40A71907221900D5F144 /* OVR_Alg.h */, + E8AA40A81907221900D5F144 /* OVR_Allocator.cpp */, + E8AA40A91907221900D5F144 /* OVR_Allocator.h */, + E8AA40AA1907221900D5F144 /* OVR_Array.h */, + E8AA40AB1907221900D5F144 /* OVR_Atomic.cpp */, + E8AA40AC1907221900D5F144 /* OVR_Atomic.h */, + E8AA40AD1907221900D5F144 /* OVR_Color.h */, + E8AA40AE1907221900D5F144 /* OVR_ContainerAllocator.h */, + E8AA40AF1907221900D5F144 /* OVR_Deque.h */, + E8AA40B01907221900D5F144 /* OVR_File.cpp */, + E8AA40B11907221900D5F144 /* OVR_File.h */, + E8AA40B21907221900D5F144 /* OVR_FileFILE.cpp */, + E8AA40B31907221900D5F144 /* OVR_Hash.h */, + E8AA40B41907221900D5F144 /* OVR_KeyCodes.h */, + E8AA40B51907221900D5F144 /* OVR_List.h */, + E8AA40B61907221900D5F144 /* OVR_Lockless.cpp */, + E8AA40B71907221900D5F144 /* OVR_Lockless.h */, + E8AA40B81907221900D5F144 /* OVR_Log.cpp */, + E8AA40B91907221900D5F144 /* OVR_Log.h */, + E8AA40BA1907221900D5F144 /* OVR_Math.cpp */, + E8AA40BB1907221900D5F144 /* OVR_Math.h */, + E8AA40BC1907221900D5F144 /* OVR_RefCount.cpp */, + E8AA40BD1907221900D5F144 /* OVR_RefCount.h */, + E8AA40BE1907221900D5F144 /* OVR_Std.cpp */, + E8AA40BF1907221900D5F144 /* OVR_Std.h */, + E8AA40C01907221900D5F144 /* OVR_String.cpp */, + E8AA40C11907221900D5F144 /* OVR_String.h */, + E8AA40C21907221900D5F144 /* OVR_String_FormatUtil.cpp */, + E8AA40C31907221900D5F144 /* OVR_String_PathUtil.cpp */, + E8AA40C41907221900D5F144 /* OVR_StringHash.h */, + E8AA40C51907221900D5F144 /* OVR_SysFile.cpp */, + E8AA40C61907221900D5F144 /* OVR_SysFile.h */, + E8AA40C71907221900D5F144 /* OVR_System.cpp */, + E8AA40C81907221900D5F144 /* OVR_System.h */, + E8AA40C91907221900D5F144 /* OVR_Threads.h */, + E8AA40CA1907221900D5F144 /* OVR_ThreadsPthread.cpp */, + E8AA40CC1907221900D5F144 /* OVR_Timer.cpp */, + E8AA40CD1907221900D5F144 /* OVR_Timer.h */, + E8AA40CE1907221900D5F144 /* OVR_Types.h */, + E8AA40CF1907221900D5F144 /* OVR_UTF8Util.cpp */, + E8AA40D01907221900D5F144 /* OVR_UTF8Util.h */, + ); + name = Kernel; + path = ../../../Src/Kernel; + sourceTree = ""; + }; + E8AA40FC1907224700D5F144 /* Util */ = { + isa = PBXGroup; + children = ( + E8AA41011907224700D5F144 /* Util_Interface.cpp */, + E8AA41021907224700D5F144 /* Util_Interface.h */, + E8AA41031907224700D5F144 /* Util_LatencyTest.cpp */, + E8AA41041907224700D5F144 /* Util_LatencyTest.h */, + E8AA41051907224700D5F144 /* Util_LatencyTest2.cpp */, + E8AA41061907224700D5F144 /* Util_LatencyTest2.h */, + E8AA41071907224700D5F144 /* Util_Render_Stereo.cpp */, + E8AA41081907224700D5F144 /* Util_Render_Stereo.h */, + ); + name = Util; + path = ../../../Src/Util; + sourceTree = ""; + }; + E8AA41B8190724E600D5F144 /* CAPI */ = { + isa = PBXGroup; + children = ( + E886FEA11907528C00D5DB45 /* CAPI_DistortionRenderer.cpp */, + E8AA41BA190724E600D5F144 /* CAPI_DistortionRenderer.h */, + E8AA41BB190724E600D5F144 /* CAPI_FrameTimeManager.cpp */, + E8AA41BC190724E600D5F144 /* CAPI_FrameTimeManager.h */, + E8AA41BD190724E600D5F144 /* CAPI_GlobalState.cpp */, + E8AA41BE190724E600D5F144 /* CAPI_GlobalState.h */, + E8AA41BF190724E600D5F144 /* CAPI_HMDRenderState.cpp */, + E8AA41C0190724E600D5F144 /* CAPI_HMDRenderState.h */, + E8AA41C1190724E600D5F144 /* CAPI_HMDState.cpp */, + E8AA41C2190724E600D5F144 /* CAPI_HMDState.h */, + E8AA41CF190724E600D5F144 /* GL */, + ); + name = CAPI; + path = ../../../Src/CAPI; + sourceTree = ""; + }; + E8AA41CF190724E600D5F144 /* GL */ = { + isa = PBXGroup; + children = ( + E8AA41D0190724E600D5F144 /* CAPI_GL_DistortionRenderer.cpp */, + E8AA41D1190724E600D5F144 /* CAPI_GL_DistortionRenderer.h */, + E8AA41D2190724E600D5F144 /* CAPI_GL_Util.cpp */, + E8AA41D3190724E600D5F144 /* CAPI_GL_Util.h */, + ); + path = GL; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXHeadersBuildPhase section */ + E82D4CD11906FE640070CB3F /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + E8AA4198190722BB00D5F144 /* OVR_Stereo.h in Headers */, + E8AA41E2190724E600D5F144 /* CAPI_DistortionRenderer.h in Headers */, + E8AA41101907224700D5F144 /* Util_LatencyTest.h in Headers */, + E8AA40DF1907221900D5F144 /* OVR_KeyCodes.h in Headers */, + E8AA40D51907221900D5F144 /* OVR_Array.h in Headers */, + E8AA41F7190724E600D5F144 /* CAPI_GL_DistortionRenderer.h in Headers */, + E8AA416F190722BB00D5F144 /* OVR_DeviceMessages.h in Headers */, + E8AA40DC1907221900D5F144 /* OVR_File.h in Headers */, + E8AA40D41907221900D5F144 /* OVR_Allocator.h in Headers */, + E8AA410E1907224700D5F144 /* Util_Interface.h in Headers */, + E8AA418B190722BB00D5F144 /* OVR_SensorCalibration.h in Headers */, + E886FEA0190737FA00D5DB45 /* OVR_CAPI.h in Headers */, + E8AA417F190722BB00D5F144 /* OVR_OSX_DeviceManager.h in Headers */, + E8AA4170190722BB00D5F144 /* OVR_HIDDevice.h in Headers */, + E8AA419A190722BB00D5F144 /* OVR_ThreadCommandQueue.h in Headers */, + E8AA41F9190724E600D5F144 /* CAPI_GL_Util.h in Headers */, + E8AA40E21907221900D5F144 /* OVR_Lockless.h in Headers */, + E8AA40F31907221900D5F144 /* OVR_System.h in Headers */, + E8AA41E8190724E600D5F144 /* CAPI_HMDRenderState.h in Headers */, + E8AA41141907224700D5F144 /* Util_Render_Stereo.h in Headers */, + E8AA40E61907221900D5F144 /* OVR_Math.h in Headers */, + E8AA418D190722BB00D5F144 /* OVR_SensorFilter.h in Headers */, + E8AA40F91907221900D5F144 /* OVR_Types.h in Headers */, + E8AA40D91907221900D5F144 /* OVR_ContainerAllocator.h in Headers */, + E8754F81190F1B71005FD401 /* OVR_Recording.h in Headers */, + E8AA40D71907221900D5F144 /* OVR_Atomic.h in Headers */, + E8AA41E4190724E600D5F144 /* CAPI_FrameTimeManager.h in Headers */, + E8AA41E6190724E600D5F144 /* CAPI_GlobalState.h in Headers */, + E8AA416E190722BB00D5F144 /* OVR_DeviceImpl.h in Headers */, + E8AA40D21907221900D5F144 /* OVR_Alg.h in Headers */, + E8AA40E01907221900D5F144 /* OVR_List.h in Headers */, + E8AA4194190722BB00D5F144 /* OVR_SensorImpl.h in Headers */, + E8AA40EF1907221900D5F144 /* OVR_StringHash.h in Headers */, + E886FE9E190737FA00D5DB45 /* OVR_CAPI_GL.h in Headers */, + E8AA41EA190724E600D5F144 /* CAPI_HMDState.h in Headers */, + E8AA40D81907221900D5F144 /* OVR_Color.h in Headers */, + E8AA4172190722BB00D5F144 /* OVR_HIDDeviceImpl.h in Headers */, + E8AA416C190722BB00D5F144 /* OVR_DeviceHandle.h in Headers */, + E8AA4196190722BB00D5F144 /* OVR_SensorTimeFilter.h in Headers */, + E8AA418F190722BB00D5F144 /* OVR_SensorFusion.h in Headers */, + E8AA4181190722BB00D5F144 /* OVR_OSX_HIDDevice.h in Headers */, + E8AA4174190722BB00D5F144 /* OVR_JSON.h in Headers */, + E8AA4183190722BB00D5F144 /* OVR_OSX_HMDDevice.h in Headers */, + E8AA4171190722BB00D5F144 /* OVR_HIDDeviceBase.h in Headers */, + E8AA4190190722BB00D5F144 /* OVR_SensorFusionDebug.h in Headers */, + E8AA4176190722BB00D5F144 /* OVR_LatencyTestImpl.h in Headers */, + E8AA40F11907221900D5F144 /* OVR_SysFile.h in Headers */, + E8AA40DE1907221900D5F144 /* OVR_Hash.h in Headers */, + E8AA4189190722BB00D5F144 /* OVR_Sensor2ImplUtil.h in Headers */, + E8AA40EC1907221900D5F144 /* OVR_String.h in Headers */, + E8AA4169190722BB00D5F144 /* OVR_Device.h in Headers */, + E8AA4186190722BB00D5F144 /* OVR_Profile.h in Headers */, + E8AA4188190722BB00D5F144 /* OVR_Sensor2Impl.h in Headers */, + E8AA40EA1907221900D5F144 /* OVR_Std.h in Headers */, + E8AA41121907224700D5F144 /* Util_LatencyTest2.h in Headers */, + E8AA40E81907221900D5F144 /* OVR_RefCount.h in Headers */, + E8AA40DA1907221900D5F144 /* OVR_Deque.h in Headers */, + E8AA416A190722BB00D5F144 /* OVR_DeviceConstants.h in Headers */, + E8AA40FB1907221900D5F144 /* OVR_UTF8Util.h in Headers */, + E8AA4192190722BB00D5F144 /* OVR_SensorImpl_Common.h in Headers */, + E8AA40F41907221900D5F144 /* OVR_Threads.h in Headers */, + E8AA40F81907221900D5F144 /* OVR_Timer.h in Headers */, + E8AA40E41907221900D5F144 /* OVR_Log.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + +/* Begin PBXNativeTarget section */ + E82D4CD21906FE640070CB3F /* LibOVR */ = { + isa = PBXNativeTarget; + buildConfigurationList = E82D4CD71906FE640070CB3F /* Build configuration list for PBXNativeTarget "LibOVR" */; + buildPhases = ( + E82D4CCF1906FE640070CB3F /* Sources */, + E82D4CD01906FE640070CB3F /* Frameworks */, + E82D4CD11906FE640070CB3F /* Headers */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = LibOVR; + productName = LibOVR; + productReference = E82D4CD31906FE640070CB3F /* libovr.a */; + productType = "com.apple.product-type.library.static"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + E82D4CCB1906FE640070CB3F /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0510; + ORGANIZATIONNAME = "Oculus VR Inc."; + }; + buildConfigurationList = E82D4CCE1906FE640070CB3F /* Build configuration list for PBXProject "LibOVR" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = E82D4CCA1906FE640070CB3F; + productRefGroup = E82D4CD41906FE640070CB3F /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + E82D4CD21906FE640070CB3F /* LibOVR */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXSourcesBuildPhase section */ + E82D4CCF1906FE640070CB3F /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + E8AA4175190722BB00D5F144 /* OVR_LatencyTestImpl.cpp in Sources */, + E8AA41E3190724E600D5F144 /* CAPI_FrameTimeManager.cpp in Sources */, + E8AA4199190722BB00D5F144 /* OVR_ThreadCommandQueue.cpp in Sources */, + E8AA417E190722BB00D5F144 /* OVR_OSX_DeviceManager.cpp in Sources */, + E8AA41131907224700D5F144 /* Util_Render_Stereo.cpp in Sources */, + E8AA4182190722BB00D5F144 /* OVR_OSX_HMDDevice.cpp in Sources */, + E8AA4185190722BB00D5F144 /* OVR_Profile.cpp in Sources */, + E8AA40F01907221900D5F144 /* OVR_SysFile.cpp in Sources */, + E8AA40DB1907221900D5F144 /* OVR_File.cpp in Sources */, + E8AA40ED1907221900D5F144 /* OVR_String_FormatUtil.cpp in Sources */, + E8F1F13E1921911D000EC969 /* OVR_Recording.cpp in Sources */, + E8AA41111907224700D5F144 /* Util_LatencyTest2.cpp in Sources */, + E8AA4173190722BB00D5F144 /* OVR_JSON.cpp in Sources */, + E8AA40D61907221900D5F144 /* OVR_Atomic.cpp in Sources */, + E8AA40E31907221900D5F144 /* OVR_Log.cpp in Sources */, + E8AA40E91907221900D5F144 /* OVR_Std.cpp in Sources */, + E8AA4193190722BB00D5F144 /* OVR_SensorImpl.cpp in Sources */, + E8AA41F6190724E600D5F144 /* CAPI_GL_DistortionRenderer.cpp in Sources */, + E8AA40DD1907221900D5F144 /* OVR_FileFILE.cpp in Sources */, + E8AA410F1907224700D5F144 /* Util_LatencyTest.cpp in Sources */, + E8AA40E51907221900D5F144 /* OVR_Math.cpp in Sources */, + E8AA4180190722BB00D5F144 /* OVR_OSX_HIDDevice.cpp in Sources */, + E8AA40D31907221900D5F144 /* OVR_Allocator.cpp in Sources */, + E8AA41E9190724E600D5F144 /* CAPI_HMDState.cpp in Sources */, + E8AA40FA1907221900D5F144 /* OVR_UTF8Util.cpp in Sources */, + E8AA410D1907224700D5F144 /* Util_Interface.cpp in Sources */, + E8AA40F71907221900D5F144 /* OVR_Timer.cpp in Sources */, + E8AA40D11907221900D5F144 /* OVR_Alg.cpp in Sources */, + E8AA4197190722BB00D5F144 /* OVR_Stereo.cpp in Sources */, + E8AA40F21907221900D5F144 /* OVR_System.cpp in Sources */, + E8AA40EB1907221900D5F144 /* OVR_String.cpp in Sources */, + E8AA416B190722BB00D5F144 /* OVR_DeviceHandle.cpp in Sources */, + E8AA418C190722BB00D5F144 /* OVR_SensorFilter.cpp in Sources */, + E886FE9F190737FA00D5DB45 /* OVR_CAPI.cpp in Sources */, + E8AA40E71907221900D5F144 /* OVR_RefCount.cpp in Sources */, + E8AA416D190722BB00D5F144 /* OVR_DeviceImpl.cpp in Sources */, + E8AA41E5190724E600D5F144 /* CAPI_GlobalState.cpp in Sources */, + E8AA418A190722BB00D5F144 /* OVR_SensorCalibration.cpp in Sources */, + E8AA418E190722BB00D5F144 /* OVR_SensorFusion.cpp in Sources */, + E8AA4184190722BB00D5F144 /* OVR_OSX_SensorDevice.cpp in Sources */, + E8AA40E11907221900D5F144 /* OVR_Lockless.cpp in Sources */, + E8AA41E7190724E600D5F144 /* CAPI_HMDRenderState.cpp in Sources */, + E8AA4187190722BB00D5F144 /* OVR_Sensor2Impl.cpp in Sources */, + E8AA41F8190724E600D5F144 /* CAPI_GL_Util.cpp in Sources */, + E8AA4191190722BB00D5F144 /* OVR_SensorImpl_Common.cpp in Sources */, + E8AA40EE1907221900D5F144 /* OVR_String_PathUtil.cpp in Sources */, + E8AA4195190722BB00D5F144 /* OVR_SensorTimeFilter.cpp in Sources */, + E886FEA21907528C00D5DB45 /* CAPI_DistortionRenderer.cpp in Sources */, + E8AA40F51907221900D5F144 /* OVR_ThreadsPthread.cpp in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + E82D4CD51906FE640070CB3F /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = NO; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CONFIGURATION_BUILD_DIR = "$(SRCROOT)/../../../Lib/Mac/Xcode/$(CONFIGURATION)"; + CONFIGURATION_TEMP_DIR = "$(SRCROOT)/../../../Lib/Mac/Xcode/$(CONFIGURATION)"; + COPY_PHASE_STRIP = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.7; + OBJROOT = "$(SRCROOT)/../../../Lib/Mac/Xcode/$(CONFIGURATION)"; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + SYMROOT = "$(SRCROOT)/../../../Lib/Mac/Xcode/$(CONFIGURATION)"; + }; + name = Debug; + }; + E82D4CD61906FE640070CB3F /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = NO; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CONFIGURATION_BUILD_DIR = "$(SRCROOT)/../../../Lib/Mac/Xcode/$(CONFIGURATION)"; + CONFIGURATION_TEMP_DIR = "$(SRCROOT)/../../../Lib/Mac/Xcode/$(CONFIGURATION)"; + COPY_PHASE_STRIP = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.7; + OBJROOT = "$(SRCROOT)/../../../Lib/Mac/Xcode/$(CONFIGURATION)"; + SDKROOT = macosx; + SYMROOT = "$(SRCROOT)/../../../Lib/Mac/Xcode/$(CONFIGURATION)"; + }; + name = Release; + }; + E82D4CD81906FE640070CB3F /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; + CONFIGURATION_BUILD_DIR = "$(SRCROOT)/../../../Lib/Mac/Xcode/$(CONFIGURATION)"; + CONFIGURATION_TEMP_DIR = "$(SRCROOT)/../../../Lib/Mac/Xcode/$(CONFIGURATION)"; + EXECUTABLE_PREFIX = ""; + GCC_INLINES_ARE_PRIVATE_EXTERN = YES; + GCC_PREPROCESSOR_DEFINITIONS = ( + OVR_BUILD_DEBUG, + "$(inherited)", + ); + MACOSX_DEPLOYMENT_TARGET = 10.7; + OBJROOT = "$(SRCROOT)/../../../Lib/Mac/Xcode/$(CONFIGURATION)"; + ONLY_ACTIVE_ARCH = NO; + PRODUCT_NAME = libovr; + SYMROOT = "$(SRCROOT)/../../../Lib/Mac/Xcode/$(CONFIGURATION)"; + }; + name = Debug; + }; + E82D4CD91906FE640070CB3F /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; + CONFIGURATION_BUILD_DIR = "$(SRCROOT)/../../../Lib/Mac/Xcode/$(CONFIGURATION)"; + CONFIGURATION_TEMP_DIR = "$(SRCROOT)/../../../Lib/Mac/Xcode/$(CONFIGURATION)"; + EXECUTABLE_PREFIX = ""; + GCC_INLINES_ARE_PRIVATE_EXTERN = YES; + GCC_SYMBOLS_PRIVATE_EXTERN = YES; + MACOSX_DEPLOYMENT_TARGET = 10.7; + OBJROOT = "$(SRCROOT)/../../../Lib/Mac/Xcode/$(CONFIGURATION)"; + ONLY_ACTIVE_ARCH = NO; + PRODUCT_NAME = libovr; + SYMROOT = "$(SRCROOT)/../../../Lib/Mac/Xcode/$(CONFIGURATION)"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + E82D4CCE1906FE640070CB3F /* Build configuration list for PBXProject "LibOVR" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + E82D4CD51906FE640070CB3F /* Debug */, + E82D4CD61906FE640070CB3F /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + E82D4CD71906FE640070CB3F /* Build configuration list for PBXNativeTarget "LibOVR" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + E82D4CD81906FE640070CB3F /* Debug */, + E82D4CD91906FE640070CB3F /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = E82D4CCB1906FE640070CB3F /* Project object */; +} diff --git a/LibOVR/Projects/Mac/Xcode/LibOVR.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/LibOVR/Projects/Mac/Xcode/LibOVR.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..0be14ed --- /dev/null +++ b/LibOVR/Projects/Mac/Xcode/LibOVR.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/LibOVR/Src/OVR_OSX_DeviceManager.cpp b/LibOVR/Src/OVR_OSX_DeviceManager.cpp new file mode 100644 index 0000000..078936a --- /dev/null +++ b/LibOVR/Src/OVR_OSX_DeviceManager.cpp @@ -0,0 +1,360 @@ +/************************************************************************************ + +Filename : OVR_OSX_DeviceManager.cpp +Content : OSX specific DeviceManager implementation. +Created : March 14, 2013 +Authors : Lee Cooper + +Copyright : Copyright 2014 Oculus VR, Inc. All Rights reserved. + +Licensed under the Oculus VR Rift SDK License Version 3.1 (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.1 + +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_OSX_DeviceManager.h" + +// Sensor & HMD Factories +#include "OVR_LatencyTestImpl.h" +#include "OVR_SensorImpl.h" +#include "OVR_OSX_HMDDevice.h" +#include "OVR_OSX_HIDDevice.h" + +#include "Kernel/OVR_Timer.h" +#include "Kernel/OVR_Std.h" +#include "Kernel/OVR_Log.h" + +#include +#include + + +namespace OVR { namespace OSX { + +//------------------------------------------------------------------------------------- +// **** OSX::DeviceManager + +DeviceManager::DeviceManager() +{ +} + +DeviceManager::~DeviceManager() +{ + OVR_DEBUG_LOG(("OSX::DeviceManager::~DeviceManager was called")); +} + +bool DeviceManager::Initialize(DeviceBase*) +{ + if (!DeviceManagerImpl::Initialize(0)) + return false; + + // Start the background thread. + pThread = *new DeviceManagerThread(); + if (!pThread || !pThread->Start()) + return false; + + // Wait for the thread to be fully up and running. + pThread->StartupEvent.Wait(); + + // Do this now that we know the thread's run loop. + HidDeviceManager = *HIDDeviceManager::CreateInternal(this); + + CGDisplayRegisterReconfigurationCallback(displayReconfigurationCallBack, this); + + pCreateDesc->pDevice = this; + LogText("OVR::DeviceManager - initialized.\n"); + + return true; +} + +void DeviceManager::Shutdown() +{ + LogText("OVR::DeviceManager - shutting down.\n"); + + CGDisplayRemoveReconfigurationCallback(displayReconfigurationCallBack, this); + + // Set Manager shutdown marker variable; this prevents + // any existing DeviceHandle objects from accessing device. + pCreateDesc->pLock->pManager = 0; + + // Push for thread shutdown *WITH NO WAIT*. + // This will have the following effect: + // - Exit command will get enqueued, which will be executed later on the thread itself. + // - Beyond this point, this DeviceManager object may be deleted by our caller. + // - Other commands, such as CreateDevice, may execute before ExitCommand, but they will + // fail gracefully due to pLock->pManager == 0. Future commands can't be enqued + // after pManager is null. + // - Once ExitCommand executes, ThreadCommand::Run loop will exit and release the last + // reference to the thread object. + pThread->Shutdown(); + pThread.Clear(); + + DeviceManagerImpl::Shutdown(); +} + +ThreadCommandQueue* DeviceManager::GetThreadQueue() +{ + return pThread; +} + +ThreadId DeviceManager::GetThreadId() const +{ + return pThread->GetThreadId(); +} + +bool DeviceManager::GetDeviceInfo(DeviceInfo* info) const +{ + if ((info->InfoClassType != Device_Manager) && + (info->InfoClassType != Device_None)) + return false; + + info->Type = Device_Manager; + info->Version = 0; + info->ProductName = "DeviceManager"; + info->Manufacturer = "Oculus VR, Inc."; + return true; +} + +DeviceEnumerator<> DeviceManager::EnumerateDevicesEx(const DeviceEnumerationArgs& args) +{ + // TBD: Can this be avoided in the future, once proper device notification is in place? + pThread->PushCall((DeviceManagerImpl*)this, + &DeviceManager::EnumerateAllFactoryDevices, true); + + return DeviceManagerImpl::EnumerateDevicesEx(args); +} + +void DeviceManager::displayReconfigurationCallBack (CGDirectDisplayID display, + CGDisplayChangeSummaryFlags flags, + void *userInfo) +{ + DeviceManager* manager = reinterpret_cast(userInfo); + OVR_UNUSED(manager); + + if (flags & kCGDisplayAddFlag) + { + LogText("Display Added, id = %d\n", int(display)); + manager->EnumerateDevices(); + } + else if (flags & kCGDisplayRemoveFlag) + { + LogText("Display Removed, id = %d\n", int(display)); + manager->EnumerateDevices(); + } +} + +//------------------------------------------------------------------------------------- +// ***** DeviceManager Thread + +DeviceManagerThread::DeviceManagerThread() + : Thread(ThreadStackSize) +{ +} + +DeviceManagerThread::~DeviceManagerThread() +{ +} + +int DeviceManagerThread::Run() +{ + + SetThreadName("OVR::DeviceManagerThread"); + LogText("OVR::DeviceManagerThread - running (ThreadId=0x%p).\n", GetThreadId()); + + // Store out the run loop ref. + RunLoop = CFRunLoopGetCurrent(); + + // Create a 'source' to enable us to signal the run loop to process the command queue. + CFRunLoopSourceContext sourceContext; + memset(&sourceContext, 0, sizeof(sourceContext)); + sourceContext.version = 0; + sourceContext.info = this; + sourceContext.perform = &staticCommandQueueSourceCallback; + + CommandQueueSource = CFRunLoopSourceCreate(kCFAllocatorDefault, 0 , &sourceContext); + + CFRunLoopAddSource(RunLoop, CommandQueueSource, kCFRunLoopDefaultMode); + + + // Signal to the parent thread that initialization has finished. + StartupEvent.SetEvent(); + + + ThreadCommand::PopBuffer command; + + while(!IsExiting()) + { + // PopCommand will reset event on empty queue. + if (PopCommand(&command)) + { + command.Execute(); + } + else + { + SInt32 exitReason = 0; + do { + + UInt32 waitMs = INT_MAX; + + // If devices have time-dependent logic registered, get the longest wait + // allowed based on current ticks. + if (!TicksNotifiers.IsEmpty()) + { + double timeSeconds = Timer::GetSeconds(); + unsigned waitAllowed; + + for (UPInt j = 0; j < TicksNotifiers.GetSize(); j++) + { + waitAllowed = (unsigned)(TicksNotifiers[j]->OnTicks(timeSeconds) * Timer::MsPerSecond); + if (waitAllowed < (unsigned)waitMs) + waitMs = waitAllowed; + } + } + + // Enter blocking run loop. We may continue until we timeout in which + // case it's time to service the ticks. Or if commands arrive in the command + // queue then the source callback will call 'CFRunLoopStop' causing this + // to return. + CFTimeInterval blockInterval = 0.001 * (double) waitMs; + exitReason = CFRunLoopRunInMode(kCFRunLoopDefaultMode, blockInterval, false); + + if (exitReason == kCFRunLoopRunFinished) + { + // Maybe this will occur during shutdown? + break; + } + else if (exitReason == kCFRunLoopRunStopped ) + { + // Commands need processing or we're being shutdown. + break; + } + else if (exitReason == kCFRunLoopRunTimedOut) + { + // Timed out so that we can service our ticks callbacks. + continue; + } + else if (exitReason == kCFRunLoopRunHandledSource) + { + // Should never occur since the last param when we call + // 'CFRunLoopRunInMode' is false. + OVR_ASSERT(false); + break; + } + else + { + OVR_ASSERT_LOG(false, ("CFRunLoopRunInMode returned unexpected code")); + break; + } + } + while(true); + } + } + + + CFRunLoopRemoveSource(RunLoop, CommandQueueSource, kCFRunLoopDefaultMode); + CFRelease(CommandQueueSource); + + LogText("OVR::DeviceManagerThread - exiting (ThreadId=0x%p).\n", GetThreadId()); + + return 0; +} + +void DeviceManagerThread::staticCommandQueueSourceCallback(void* pContext) +{ + DeviceManagerThread* pThread = (DeviceManagerThread*) pContext; + pThread->commandQueueSourceCallback(); +} + +void DeviceManagerThread::commandQueueSourceCallback() +{ + CFRunLoopStop(RunLoop); +} + +bool DeviceManagerThread::AddTicksNotifier(Notifier* notify) +{ + TicksNotifiers.PushBack(notify); + return true; +} + +bool DeviceManagerThread::RemoveTicksNotifier(Notifier* notify) +{ + for (UPInt i = 0; i < TicksNotifiers.GetSize(); i++) + { + if (TicksNotifiers[i] == notify) + { + TicksNotifiers.RemoveAt(i); + return true; + } + } + return false; +} + +void DeviceManagerThread::Shutdown() +{ + // Push for thread shutdown *WITH NO WAIT*. + // This will have the following effect: + // - Exit command will get enqueued, which will be executed later on the thread itself. + // - Beyond this point, this DeviceManager object may be deleted by our caller. + // - Other commands, such as CreateDevice, may execute before ExitCommand, but they will + // fail gracefully due to pLock->pManager == 0. Future commands can't be enqued + // after pManager is null. + // - Once ExitCommand executes, ThreadCommand::Run loop will exit and release the last + // reference to the thread object. + PushExitCommand(false); + + // make sure CFRunLoopRunInMode is woken up + CFRunLoopSourceSignal(CommandQueueSource); + CFRunLoopWakeUp(RunLoop); +} + +} // namespace OSX + + +//------------------------------------------------------------------------------------- +// ***** Creation + +// Creates a new DeviceManager and initializes OVR. +DeviceManager* DeviceManager::Create() +{ + + if (!System::IsInitialized()) + { + // Use custom message, since Log is not yet installed. + OVR_DEBUG_STATEMENT(Log::GetDefaultLog()-> + LogMessage(Log_Debug, "DeviceManager::Create failed - OVR::System not initialized"); ); + return 0; + } + + Ptr manager = *new OSX::DeviceManager; + + if (manager) + { + if (manager->Initialize(0)) + { + manager->AddFactory(&LatencyTestDeviceFactory::GetInstance()); + manager->AddFactory(&SensorDeviceFactory::GetInstance()); + manager->AddFactory(&OSX::HMDDeviceFactory::GetInstance()); + + manager->AddRef(); + } + else + { + manager.Clear(); + } + } + + return manager.GetPtr(); +} + +} // namespace OVR diff --git a/LibOVR/Src/OVR_OSX_DeviceManager.h b/LibOVR/Src/OVR_OSX_DeviceManager.h new file mode 100644 index 0000000..61af848 --- /dev/null +++ b/LibOVR/Src/OVR_OSX_DeviceManager.h @@ -0,0 +1,128 @@ +/************************************************************************************ + +Filename : OVR_OSX_DeviceManager.h +Content : OSX specific DeviceManager header. +Created : March 14, 2013 +Authors : Lee Cooper + +Copyright : Copyright 2014 Oculus VR, Inc. All Rights reserved. + +Licensed under the Oculus VR Rift SDK License Version 3.1 (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.1 + +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_OSX_DeviceManager_h +#define OVR_OSX_DeviceManager_h + +#include "OVR_DeviceImpl.h" + +#include "Kernel/OVR_Timer.h" + +#include +#include + +namespace OVR { namespace OSX { + +class DeviceManagerThread; + +//------------------------------------------------------------------------------------- +// ***** OSX DeviceManager + +class DeviceManager : public DeviceManagerImpl +{ +public: + DeviceManager(); + ~DeviceManager(); + + // Initialize/Shutdown manager thread. + virtual bool Initialize(DeviceBase* parent); + virtual void Shutdown(); + + virtual ThreadCommandQueue* GetThreadQueue(); + virtual ThreadId GetThreadId() const; + + virtual DeviceEnumerator<> EnumerateDevicesEx(const DeviceEnumerationArgs& args); + + virtual bool GetDeviceInfo(DeviceInfo* info) const; + +protected: + static void displayReconfigurationCallBack (CGDirectDisplayID display, + CGDisplayChangeSummaryFlags flags, + void *userInfo); + +public: // data + Ptr pThread; +}; + +//------------------------------------------------------------------------------------- +// ***** Device Manager Background Thread + +class DeviceManagerThread : public Thread, public ThreadCommandQueue +{ + friend class DeviceManager; + enum { ThreadStackSize = 32 * 1024 }; +public: + DeviceManagerThread(); + ~DeviceManagerThread(); + + virtual int Run(); + + // ThreadCommandQueue notifications for CommandEvent handling. + virtual void OnPushNonEmpty_Locked() + { + CFRunLoopSourceSignal(CommandQueueSource); + CFRunLoopWakeUp(RunLoop); + } + + virtual void OnPopEmpty_Locked() {} + + + // Notifier used for different updates (EVENT or regular timing or messages). + class Notifier + { + public: + + // Called when timing ticks are updated. // Returns the largest number of microseconds + // this function can wait till next call. + virtual double OnTicks(double tickSeconds) + { OVR_UNUSED1(tickSeconds); return 1000.0; } + }; + + // Add notifier that will be called at regular intervals. + bool AddTicksNotifier(Notifier* notify); + bool RemoveTicksNotifier(Notifier* notify); + + CFRunLoopRef GetRunLoop() + { return RunLoop; } + + void Shutdown(); +private: + CFRunLoopRef RunLoop; + + CFRunLoopSourceRef CommandQueueSource; + + static void staticCommandQueueSourceCallback(void* pContext); + void commandQueueSourceCallback(); + + Event StartupEvent; + + // Ticks notifiers. Used for time-dependent events such as keep-alive. + Array TicksNotifiers; +}; + +}} // namespace OSX::OVR + +#endif // OVR_OSX_DeviceManager_h diff --git a/LibOVR/Src/OVR_OSX_HIDDevice.cpp b/LibOVR/Src/OVR_OSX_HIDDevice.cpp new file mode 100644 index 0000000..af840e0 --- /dev/null +++ b/LibOVR/Src/OVR_OSX_HIDDevice.cpp @@ -0,0 +1,924 @@ +/************************************************************************************ +Filename : OVR_OSX_HIDDevice.cpp +Content : OSX HID device implementation. +Created : February 26, 2013 +Authors : Lee Cooper + +Copyright : Copyright 2014 Oculus VR, Inc. All Rights reserved. + +Licensed under the Oculus VR Rift SDK License Version 3.1 (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.1 + +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_OSX_HIDDevice.h" + +#include + +namespace OVR { namespace OSX { + + +//------------------------------------------------------------------------------------- +// **** OSX::DeviceManager + +HIDDeviceManager::HIDDeviceManager(DeviceManager* manager) + : DevManager(manager) +{ + HIDManager = NULL; +} + +HIDDeviceManager::~HIDDeviceManager() +{ +} + +CFRunLoopRef HIDDeviceManager::getRunLoop() +{ + if (DevManager != NULL) + { + return DevManager->pThread->GetRunLoop(); + } + + return CFRunLoopGetCurrent(); +} + +bool HIDDeviceManager::initializeManager() +{ + if (HIDManager != NULL) + { + return true; + } + + HIDManager = IOHIDManagerCreate(kCFAllocatorDefault, kIOHIDOptionsTypeNone); + + if (!HIDManager) + { + return false; + } + + // Create a Matching Dictionary + CFMutableDictionaryRef matchDict = + CFDictionaryCreateMutable(kCFAllocatorDefault, + 2, + &kCFTypeDictionaryKeyCallBacks, + &kCFTypeDictionaryValueCallBacks); + + // Specify a device manufacturer in the Matching Dictionary + UInt32 vendorId = Oculus_VendorId; + CFNumberRef vendorIdRef = CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &vendorId); + CFDictionarySetValue(matchDict, + CFSTR(kIOHIDVendorIDKey), + vendorIdRef); + // Register the Matching Dictionary to the HID Manager + IOHIDManagerSetDeviceMatching(HIDManager, matchDict); + CFRelease(vendorIdRef); + CFRelease(matchDict); + + // Register a callback for USB device detection with the HID Manager + IOHIDManagerRegisterDeviceMatchingCallback(HIDManager, &staticDeviceMatchingCallback, this); + + IOHIDManagerScheduleWithRunLoop(HIDManager, getRunLoop(), kCFRunLoopDefaultMode); + + return true; +} + +bool HIDDeviceManager::Initialize() +{ + return initializeManager(); +} + +void HIDDeviceManager::Shutdown() +{ + OVR_ASSERT_LOG(HIDManager, ("Should have called 'Initialize' before 'Shutdown'.")); + CFRelease(HIDManager); + + LogText("OVR::OSX::HIDDeviceManager - shutting down.\n"); +} + +bool HIDDeviceManager::getIntProperty(IOHIDDeviceRef device, CFStringRef propertyName, SInt32* pResult) +{ + + CFTypeRef ref = IOHIDDeviceGetProperty(device, propertyName); + + if (!ref) + { + return false; + } + + if (CFGetTypeID(ref) != CFNumberGetTypeID()) + { + return false; + } + + CFNumberGetValue((CFNumberRef) ref, kCFNumberSInt32Type, pResult); + + return true; +} + +bool HIDDeviceManager::initVendorProductVersion(IOHIDDeviceRef device, HIDDeviceDesc* pDevDesc) +{ + + if (!getVendorId(device, &(pDevDesc->VendorId))) + { + return false; + } + + if (!getProductId(device, &(pDevDesc->ProductId))) + { + return false; + } + + SInt32 result; + if (!getIntProperty(device, CFSTR(kIOHIDVersionNumberKey), &result)) + { + return false; + } + pDevDesc->VersionNumber = result; + + return true; +} + +bool HIDDeviceManager::initUsage(IOHIDDeviceRef device, HIDDeviceDesc* pDevDesc) +{ + + SInt32 result; + + if (!getIntProperty(device, CFSTR(kIOHIDPrimaryUsagePageKey), &result)) + { + return false; + } + + pDevDesc->UsagePage = result; + + + if (!getIntProperty(device, CFSTR(kIOHIDPrimaryUsageKey), &result)) + { + return false; + } + + pDevDesc->Usage = result; + + return true; +} + +bool HIDDeviceManager::initSerialNumber(IOHIDDeviceRef device, HIDDeviceDesc* pDevDesc) +{ + return getSerialNumberString(device, &(pDevDesc->SerialNumber)); +} + +bool HIDDeviceManager::initStrings(IOHIDDeviceRef device, HIDDeviceDesc* pDevDesc) +{ + + // Regardless of whether they fail we'll try and get the remaining. + getStringProperty(device, CFSTR(kIOHIDManufacturerKey), &(pDevDesc->Manufacturer)); + getStringProperty(device, CFSTR(kIOHIDProductKey), &(pDevDesc->Product)); + + return true; +} + +bool HIDDeviceManager::getStringProperty(IOHIDDeviceRef device, + CFStringRef propertyName, + String* pResult) +{ + + CFStringRef str = (CFStringRef) IOHIDDeviceGetProperty(device, propertyName); + + if (!str) + { + return false; + } + + CFIndex length = CFStringGetLength(str); + CFRange range = CFRangeMake(0, length); + + // Test the conversion first to get required buffer size. + CFIndex bufferLength; + CFIndex numberOfChars = CFStringGetBytes(str, + range, + kCFStringEncodingUTF8, + (char) '?', + FALSE, + NULL, + 0, + &bufferLength); + + if (numberOfChars == 0) + { + return false; + } + + // Now allocate buffer. + char* buffer = new char[bufferLength+1]; + + numberOfChars = CFStringGetBytes(str, + range, + kCFStringEncodingUTF8, + (char) '?', + FALSE, + (UInt8*) buffer, + bufferLength, + NULL); + OVR_ASSERT_LOG(numberOfChars != 0, ("CFStringGetBytes failed.")); + + buffer[bufferLength] = '\0'; + *pResult = String(buffer); + + return true; +} + +bool HIDDeviceManager::getVendorId(IOHIDDeviceRef device, UInt16* pResult) +{ + SInt32 result; + + if (!getIntProperty(device, CFSTR(kIOHIDVendorIDKey), &result)) + { + return false; + } + + *pResult = result; + + return true; +} + +bool HIDDeviceManager::getProductId(IOHIDDeviceRef device, UInt16* pResult) +{ + SInt32 result; + + if (!getIntProperty(device, CFSTR(kIOHIDProductIDKey), &result)) + { + return false; + } + + *pResult = result; + + return true; +} + +bool HIDDeviceManager::getLocationId(IOHIDDeviceRef device, SInt32* pResult) +{ + SInt32 result; + + if (!getIntProperty(device, CFSTR(kIOHIDLocationIDKey), &result)) + { + return false; + } + + *pResult = result; + + return true; +} + +bool HIDDeviceManager::getSerialNumberString(IOHIDDeviceRef device, String* pResult) +{ + + if (!getStringProperty(device, CFSTR(kIOHIDSerialNumberKey), pResult)) + { + return false; + } + + return true; +} + +bool HIDDeviceManager::getPath(IOHIDDeviceRef device, String* pPath) +{ + + String transport; + if (!getStringProperty(device, CFSTR(kIOHIDTransportKey), &transport)) + { + return false; + } + + UInt16 vendorId; + if (!getVendorId(device, &vendorId)) + { + return false; + } + + UInt16 productId; + if (!getProductId(device, &productId)) + { + return false; + } + + String serialNumber; + if (!getSerialNumberString(device, &serialNumber)) + { + return false; + } + + + StringBuffer buffer; + buffer.AppendFormat("%s:vid=%04hx:pid=%04hx:ser=%s", + transport.ToCStr(), + vendorId, + productId, + serialNumber.ToCStr()); + + *pPath = String(buffer); + + return true; +} + +bool HIDDeviceManager::Enumerate(HIDEnumerateVisitor* enumVisitor) +{ + if (!initializeManager()) + { + return false; + } + + + CFSetRef deviceSet = IOHIDManagerCopyDevices(HIDManager); + if (!deviceSet) + return false; + + CFIndex deviceCount = CFSetGetCount(deviceSet); + + // Allocate a block of memory and read the set into it. + IOHIDDeviceRef* devices = (IOHIDDeviceRef*) OVR_ALLOC(sizeof(IOHIDDeviceRef) * deviceCount); + CFSetGetValues(deviceSet, (const void **) devices); + + + // Iterate over devices. + for (CFIndex deviceIndex = 0; deviceIndex < deviceCount; deviceIndex++) + { + IOHIDDeviceRef hidDev = devices[deviceIndex]; + + if (!hidDev) + { + continue; + } + + HIDDeviceDesc devDesc; + + if (getPath(hidDev, &(devDesc.Path)) && + initVendorProductVersion(hidDev, &devDesc) && + enumVisitor->MatchVendorProduct(devDesc.VendorId, devDesc.ProductId) && + initUsage(hidDev, &devDesc)) + { + initStrings(hidDev, &devDesc); + initSerialNumber(hidDev, &devDesc); + + // Look for the device to check if it is already opened. + Ptr existingDevice = DevManager->FindHIDDevice(devDesc, true); + // if device exists and it is opened then most likely the CreateHIDFile + // will fail; therefore, we just set Enumerated to 'true' and continue. + if (existingDevice && existingDevice->pDevice) + { + existingDevice->Enumerated = true; + continue; + } + + // Construct minimal device that the visitor callback can get feature reports from. + OSX::HIDDevice device(this, hidDev); + + enumVisitor->Visit(device, devDesc); + } + } + + OVR_FREE(devices); + CFRelease(deviceSet); + + return true; +} + +OVR::HIDDevice* HIDDeviceManager::Open(const String& path) +{ + + Ptr device = *new OSX::HIDDevice(this); + + if (!device->HIDInitialize(path)) + { + return NULL; + } + + device->AddRef(); + + return device; +} + +bool HIDDeviceManager::getFullDesc(IOHIDDeviceRef device, HIDDeviceDesc* desc) +{ + + if (!initVendorProductVersion(device, desc)) + { + return false; + } + + if (!initUsage(device, desc)) + { + return false; + } + + if (!initSerialNumber(device, desc)) + { + return false; + } + + initStrings(device, desc); + + return true; +} + +// New USB device specified in the matching dictionary has been added (callback function) +void HIDDeviceManager::staticDeviceMatchingCallback(void *inContext, + IOReturn inResult, + void *inSender, + IOHIDDeviceRef inIOHIDDeviceRef) +{ + OVR_UNUSED(inResult); + OVR_UNUSED(inSender); + HIDDeviceManager* hidMgr = static_cast(inContext); + HIDDeviceDesc hidDevDesc; + hidMgr->getPath(inIOHIDDeviceRef, &hidDevDesc.Path); + hidMgr->getFullDesc(inIOHIDDeviceRef, &hidDevDesc); + + hidMgr->DevManager->DetectHIDDevice(hidDevDesc); +} + +//------------------------------------------------------------------------------------- +// **** OSX::HIDDevice + +HIDDevice::HIDDevice(HIDDeviceManager* manager) + : InMinimalMode(false), HIDManager(manager) +{ + Device = NULL; + RepluggedNotificationPort = 0; +} + +// This is a minimal constructor used during enumeration for us to pass +// a HIDDevice to the visit function (so that it can query feature reports). +HIDDevice::HIDDevice(HIDDeviceManager* manager, IOHIDDeviceRef device) +: InMinimalMode(true), HIDManager(manager), Device(device) +{ + RepluggedNotificationPort = 0; +} + +HIDDevice::~HIDDevice() +{ + if (!InMinimalMode) + { + HIDShutdown(); + } +} + +bool HIDDevice::HIDInitialize(const String& path) +{ + + DevDesc.Path = path; + + if (!openDevice()) + { + LogText("OVR::OSX::HIDDevice - Failed to open HIDDevice: %s", path.ToCStr()); + return false; + } + + // Setup notification for when a device is unplugged and plugged back in. + if (!setupDevicePluggedInNotification()) + { + LogText("OVR::OSX::HIDDevice - Failed to setup notification for when device plugged back in."); + closeDevice(false); + return false; + } + + HIDManager->DevManager->pThread->AddTicksNotifier(this); + + + LogText("OVR::OSX::HIDDevice - Opened '%s'\n" + " Manufacturer:'%s' Product:'%s' Serial#:'%s'\n", + DevDesc.Path.ToCStr(), + DevDesc.Manufacturer.ToCStr(), DevDesc.Product.ToCStr(), + DevDesc.SerialNumber.ToCStr()); + + return true; +} + +bool HIDDevice::initInfo() +{ + // Device must have been successfully opened. + OVR_ASSERT(Device); + + + // Get report lengths. + SInt32 bufferLength; + bool getResult = HIDManager->getIntProperty(Device, CFSTR(kIOHIDMaxInputReportSizeKey), &bufferLength); + OVR_ASSERT(getResult); + InputReportBufferLength = (UInt16) bufferLength; + + getResult = HIDManager->getIntProperty(Device, CFSTR(kIOHIDMaxOutputReportSizeKey), &bufferLength); + OVR_ASSERT(getResult); + OutputReportBufferLength = (UInt16) bufferLength; + + getResult = HIDManager->getIntProperty(Device, CFSTR(kIOHIDMaxFeatureReportSizeKey), &bufferLength); + OVR_ASSERT(getResult); + FeatureReportBufferLength = (UInt16) bufferLength; + + + if (ReadBufferSize < InputReportBufferLength) + { + OVR_ASSERT_LOG(false, ("Input report buffer length is bigger than read buffer.")); + return false; + } + + // Get device desc. + if (!HIDManager->getFullDesc(Device, &DevDesc)) + { + OVR_ASSERT_LOG(false, ("Failed to get device desc while initializing device.")); + return false; + } + + return true; +} + +void HIDDevice::staticDeviceAddedCallback(void* pContext, io_iterator_t iterator) +{ + HIDDevice* pDevice = (HIDDevice*) pContext; + pDevice->deviceAddedCallback(iterator); +} + +void HIDDevice::deviceAddedCallback(io_iterator_t iterator) +{ + + if (Device == NULL) + { + if (openDevice()) + { + LogText("OVR::OSX::HIDDevice - Reopened device : %s", DevDesc.Path.ToCStr()); + + Ptr existingHIDDev = HIDManager->DevManager->FindHIDDevice(DevDesc, true); + if (existingHIDDev && existingHIDDev->pDevice) + { + HIDManager->DevManager->CallOnDeviceAdded(existingHIDDev); + } + } + } + + // Reset callback. + while (IOIteratorNext(iterator)) + ; +} + +bool HIDDevice::openDevice() +{ + + // Have to iterate through devices again to generate paths. + CFSetRef deviceSet = IOHIDManagerCopyDevices(HIDManager->HIDManager); + CFIndex deviceCount = CFSetGetCount(deviceSet); + + // Allocate a block of memory and read the set into it. + IOHIDDeviceRef* devices = (IOHIDDeviceRef*) OVR_ALLOC(sizeof(IOHIDDeviceRef) * deviceCount); + CFSetGetValues(deviceSet, (const void **) devices); + + + // Iterate over devices. + IOHIDDeviceRef device = NULL; + + for (CFIndex deviceIndex = 0; deviceIndex < deviceCount; deviceIndex++) + { + IOHIDDeviceRef tmpDevice = devices[deviceIndex]; + + if (!tmpDevice) + { + continue; + } + + String path; + if (!HIDManager->getPath(tmpDevice, &path)) + { + continue; + } + + if (path == DevDesc.Path) + { + device = tmpDevice; + break; + } + } + + + OVR_FREE(devices); + + if (!device) + { + CFRelease(deviceSet); + return false; + } + + // Attempt to open device. + if (IOHIDDeviceOpen(device, kIOHIDOptionsTypeSeizeDevice) + != kIOReturnSuccess) + { + CFRelease(deviceSet); + return false; + } + + // Retain the device before we release the set. + CFRetain(device); + CFRelease(deviceSet); + + + Device = device; + + + if (!initInfo()) + { + IOHIDDeviceClose(Device, kIOHIDOptionsTypeSeizeDevice); + CFRelease(Device); + Device = NULL; + return false; + } + + + // Setup the Run Loop and callbacks. + IOHIDDeviceScheduleWithRunLoop(Device, + HIDManager->getRunLoop(), + kCFRunLoopDefaultMode); + + IOHIDDeviceRegisterInputReportCallback(Device, + ReadBuffer, + ReadBufferSize, + staticHIDReportCallback, + this); + + IOHIDDeviceRegisterRemovalCallback(Device, + staticDeviceRemovedCallback, + this); + + return true; +} + +void HIDDevice::HIDShutdown() +{ + + HIDManager->DevManager->pThread->RemoveTicksNotifier(this); + + if (Device != NULL) // Device may already have been closed if unplugged. + { + closeDevice(false); + } + + IOObjectRelease(RepluggedNotification); + if (RepluggedNotificationPort) + IONotificationPortDestroy(RepluggedNotificationPort); + + LogText("OVR::OSX::HIDDevice - HIDShutdown '%s'\n", DevDesc.Path.ToCStr()); +} + +bool HIDDevice::setupDevicePluggedInNotification() +{ + + // Setup notification when devices are plugged in. + RepluggedNotificationPort = IONotificationPortCreate(kIOMasterPortDefault); + + CFRunLoopSourceRef notificationRunLoopSource = + IONotificationPortGetRunLoopSource(RepluggedNotificationPort); + + CFRunLoopAddSource(HIDManager->getRunLoop(), + notificationRunLoopSource, + kCFRunLoopDefaultMode); + + CFMutableDictionaryRef matchingDict = IOServiceMatching(kIOUSBDeviceClassName); + + // Have to specify vendorId and productId. Doesn't seem to accept additional + // things like serial number. + SInt32 vendorId = DevDesc.VendorId; + CFNumberRef numberRef = CFNumberCreate(kCFAllocatorDefault, + kCFNumberSInt32Type, + &vendorId); + CFDictionarySetValue(matchingDict, CFSTR(kUSBVendorID), numberRef); + CFRelease(numberRef); + + SInt32 deviceProductId = DevDesc.ProductId; + numberRef = CFNumberCreate(kCFAllocatorDefault, + kCFNumberSInt32Type, + &deviceProductId); + CFDictionarySetValue(matchingDict, CFSTR(kUSBProductID), numberRef); + CFRelease(numberRef); + + kern_return_t result = + IOServiceAddMatchingNotification(RepluggedNotificationPort, + kIOMatchedNotification, + matchingDict, + staticDeviceAddedCallback, + this, + &RepluggedNotification); + + if (result != KERN_SUCCESS) + { + CFRelease(RepluggedNotificationPort); + RepluggedNotificationPort = 0; + return false; + } + + // Iterate through to arm. + while (IOIteratorNext(RepluggedNotification)) + { + } + + return true; +} + +void HIDDevice::closeDevice(bool wasUnplugged) +{ + OVR_ASSERT(Device != NULL); + + if (!wasUnplugged) + { + // Clear the registered callbacks. + IOHIDDeviceRegisterInputReportCallback(Device, + ReadBuffer, + InputReportBufferLength, + NULL, + this); + + IOHIDDeviceRegisterRemovalCallback(Device, NULL, this); + + IOHIDDeviceUnscheduleFromRunLoop(Device, + HIDManager->getRunLoop(), + kCFRunLoopDefaultMode); + IOHIDDeviceClose(Device, kIOHIDOptionsTypeNone); + } + + CFRelease(Device); + Device = NULL; + + LogText("OVR::OSX::HIDDevice - HID Device Closed '%s'\n", DevDesc.Path.ToCStr()); +} + +void HIDDevice::staticHIDReportCallback(void* pContext, + IOReturn result, + void* pSender, + IOHIDReportType reportType, + uint32_t reportId, + uint8_t* pReport, + CFIndex reportLength) +{ + OVR_UNUSED(result); + OVR_UNUSED(pSender); + OVR_UNUSED(reportType); + OVR_UNUSED(reportId); + + HIDDevice* pDevice = (HIDDevice*) pContext; + return pDevice->hidReportCallback(pReport, (UInt32)reportLength); +} + +void HIDDevice::hidReportCallback(UByte* pData, UInt32 length) +{ + + // We got data. + if (Handler) + { + Handler->OnInputReport(pData, length); + } +} + +void HIDDevice::staticDeviceRemovedCallback(void* pContext, IOReturn result, void* pSender) +{ + OVR_UNUSED(result); + OVR_UNUSED(pSender); + HIDDevice* pDevice = (HIDDevice*) pContext; + pDevice->deviceRemovedCallback(); +} + +void HIDDevice::deviceRemovedCallback() +{ + Ptr _this(this); // prevent from release + + Ptr existingHIDDev = HIDManager->DevManager->FindHIDDevice(DevDesc, true); + if (existingHIDDev && existingHIDDev->pDevice) + { + HIDManager->DevManager->CallOnDeviceRemoved(existingHIDDev); + } + closeDevice(true); +} + +CFStringRef HIDDevice::generateRunLoopModeString(IOHIDDeviceRef device) +{ + const UInt32 safeBuffSize = 256; + char nameBuff[safeBuffSize]; + OVR_sprintf(nameBuff, safeBuffSize, "%016lX", device); + + return CFStringCreateWithCString(NULL, nameBuff, kCFStringEncodingASCII); +} + +bool HIDDevice::SetFeatureReport(UByte* data, UInt32 length) +{ + + if (!Device) + return false; + + UByte reportID = data[0]; + + if (reportID == 0) + { + // Not using reports so remove from data packet. + data++; + length--; + } + + IOReturn result = IOHIDDeviceSetReport( Device, + kIOHIDReportTypeFeature, + reportID, + data, + length); + + return (result == kIOReturnSuccess); +} + +bool HIDDevice::GetFeatureReport(UByte* data, UInt32 length) +{ + if (!Device) + return false; + + CFIndex bufferLength = length; + + // Report id is in first byte of the buffer. + IOReturn result = IOHIDDeviceGetReport(Device, kIOHIDReportTypeFeature, data[0], data, &bufferLength); + + return (result == kIOReturnSuccess); +} + +double HIDDevice::OnTicks(double tickSeconds) +{ + + if (Handler) + { + return Handler->OnTicks(tickSeconds); + } + + return DeviceManagerThread::Notifier::OnTicks(tickSeconds); +} + +HIDDeviceManager* HIDDeviceManager::CreateInternal(OSX::DeviceManager* devManager) +{ + + if (!System::IsInitialized()) + { + // Use custom message, since Log is not yet installed. + OVR_DEBUG_STATEMENT(Log::GetDefaultLog()-> + LogMessage(Log_Debug, "HIDDeviceManager::Create failed - OVR::System not initialized"); ); + return 0; + } + + Ptr manager = *new OSX::HIDDeviceManager(devManager); + + if (manager) + { + if (manager->Initialize()) + { + manager->AddRef(); + } + else + { + manager.Clear(); + } + } + + return manager.GetPtr(); +} + +} // namespace OSX + +//------------------------------------------------------------------------------------- +// ***** Creation + +// Creates a new HIDDeviceManager and initializes OVR. +HIDDeviceManager* HIDDeviceManager::Create(Ptr& deviceManager) +{ + + if (!System::IsInitialized()) + { + // Use custom message, since Log is not yet installed. + OVR_DEBUG_STATEMENT(Log::GetDefaultLog()-> + LogMessage(Log_Debug, "HIDDeviceManager::Create failed - OVR::System not initialized"); ); + return 0; + } + + Ptr deviceManagerOSX = *new OSX::DeviceManager; + + if (!deviceManagerOSX) + { + return NULL; + } + + if (!deviceManagerOSX->Initialize(NULL)) + { + return NULL; + } + + deviceManager = deviceManagerOSX; + + return deviceManagerOSX->GetHIDDeviceManager(); +} + +} // namespace OVR diff --git a/LibOVR/Src/OVR_OSX_HIDDevice.h b/LibOVR/Src/OVR_OSX_HIDDevice.h new file mode 100644 index 0000000..c6140cb --- /dev/null +++ b/LibOVR/Src/OVR_OSX_HIDDevice.h @@ -0,0 +1,160 @@ +/************************************************************************************ +Filename : OVR_OSX_HIDDevice.h +Content : OSX HID device implementation. +Created : February 26, 2013 +Authors : Lee Cooper + +Copyright : Copyright 2014 Oculus VR, Inc. All Rights reserved. + +Licensed under the Oculus VR Rift SDK License Version 3.1 (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.1 + +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_OSX_HIDDevice_h +#define OVR_OSX_HIDDevice_h + +#include "OVR_HIDDevice.h" + +#include "OVR_OSX_DeviceManager.h" + +#include + +namespace OVR { namespace OSX { + +class HIDDeviceManager; + +//------------------------------------------------------------------------------------- +// ***** OSX HIDDevice + +class HIDDevice : public OVR::HIDDevice, public DeviceManagerThread::Notifier +{ +private: + friend class HIDDeviceManager; + +public: + HIDDevice(HIDDeviceManager* manager); + + // This is a minimal constructor used during enumeration for us to pass + // a HIDDevice to the visit function (so that it can query feature reports). + HIDDevice(HIDDeviceManager* manager, IOHIDDeviceRef device); + + virtual ~HIDDevice(); + + bool HIDInitialize(const String& path); + void HIDShutdown(); + + virtual bool SetFeatureReport(UByte* data, UInt32 length); + virtual bool GetFeatureReport(UByte* data, UInt32 length); + + bool Write(UByte* data, UInt32 length); + + bool Read(UByte* pData, UInt32 length, UInt32 timeoutMilliS); + bool ReadBlocking(UByte* pData, UInt32 length); + + + // DeviceManagerThread::Notifier + double OnTicks(double tickSeconds); + +private: + bool initInfo(); + bool openDevice(); + void closeDevice(bool wasUnplugged); + bool setupDevicePluggedInNotification(); + CFStringRef generateRunLoopModeString(IOHIDDeviceRef device); + + static void staticHIDReportCallback(void* pContext, + IOReturn result, + void* pSender, + IOHIDReportType reportType, + uint32_t reportId, + uint8_t* pReport, + CFIndex reportLength); + void hidReportCallback(UByte* pData, UInt32 length); + + static void staticDeviceRemovedCallback(void* pContext, + IOReturn result, + void* pSender); + void deviceRemovedCallback(); + + static void staticDeviceAddedCallback(void* pContext, + io_iterator_t iterator); + void deviceAddedCallback(io_iterator_t iterator); + + bool InMinimalMode; + HIDDeviceManager* HIDManager; + IOHIDDeviceRef Device; + HIDDeviceDesc DevDesc; + + enum { ReadBufferSize = 96 }; + UByte ReadBuffer[ReadBufferSize]; + + UInt16 InputReportBufferLength; + UInt16 OutputReportBufferLength; + UInt16 FeatureReportBufferLength; + + IONotificationPortRef RepluggedNotificationPort; + io_iterator_t RepluggedNotification; +}; + + +//------------------------------------------------------------------------------------- +// ***** OSX HIDDeviceManager + +class HIDDeviceManager : public OVR::HIDDeviceManager +{ + friend class HIDDevice; + +public: + HIDDeviceManager(OSX::DeviceManager* Manager); + virtual ~HIDDeviceManager(); + + virtual bool Initialize(); + virtual void Shutdown(); + + virtual bool Enumerate(HIDEnumerateVisitor* enumVisitor); + virtual OVR::HIDDevice* Open(const String& path); + + static HIDDeviceManager* CreateInternal(DeviceManager* manager); + +private: + CFRunLoopRef getRunLoop(); + bool initializeManager(); + bool initVendorProductVersion(IOHIDDeviceRef device, HIDDeviceDesc* pDevDesc); + bool initUsage(IOHIDDeviceRef device, HIDDeviceDesc* pDevDesc); + bool initStrings(IOHIDDeviceRef device, HIDDeviceDesc* pDevDesc); + bool initSerialNumber(IOHIDDeviceRef device, HIDDeviceDesc* pDevDesc); + bool getVendorId(IOHIDDeviceRef device, UInt16* pResult); + bool getProductId(IOHIDDeviceRef device, UInt16* pResult); + bool getLocationId(IOHIDDeviceRef device, SInt32* pResult); + bool getSerialNumberString(IOHIDDeviceRef device, String* pResult); + bool getPath(IOHIDDeviceRef device, String* pPath); + bool getIntProperty(IOHIDDeviceRef device, CFStringRef key, int32_t* pResult); + bool getStringProperty(IOHIDDeviceRef device, CFStringRef propertyName, String* pResult); + bool getFullDesc(IOHIDDeviceRef device, HIDDeviceDesc* desc); + + static void staticDeviceMatchingCallback(void *inContext, + IOReturn inResult, + void *inSender, + IOHIDDeviceRef inIOHIDDeviceRef); + + DeviceManager* DevManager; + + IOHIDManagerRef HIDManager; +}; + +}} // namespace OVR::OSX + +#endif // OVR_OSX_HIDDevice_h diff --git a/LibOVR/Src/OVR_OSX_HMDDevice.cpp b/LibOVR/Src/OVR_OSX_HMDDevice.cpp new file mode 100644 index 0000000..e16de81 --- /dev/null +++ b/LibOVR/Src/OVR_OSX_HMDDevice.cpp @@ -0,0 +1,264 @@ +/************************************************************************************ + +Filename : OVR_OSX_HMDDevice.cpp +Content : OSX Interface to HMD - detects HMD display +Created : September 21, 2012 +Authors : Michael Antonov + +Copyright : Copyright 2014 Oculus VR, Inc. All Rights reserved. + +Licensed under the Oculus VR Rift SDK License Version 3.1 (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.1 + +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_OSX_HMDDevice.h" + +#include "OVR_OSX_DeviceManager.h" +#include "Util/Util_Render_Stereo.h" + +#include "OVR_OSX_HMDDevice.h" +#include +#include +#include +#include + +namespace OVR { namespace OSX { + +using namespace OVR::Util::Render; + +//------------------------------------------------------------------------------------- + +HMDDeviceCreateDesc::HMDDeviceCreateDesc(DeviceFactory* factory, + UInt32 vend, UInt32 prod, const String& displayDeviceName, int dispId) + : DeviceCreateDesc(factory, Device_HMD), + DisplayDeviceName(displayDeviceName), + Contents(0), + DisplayId(dispId) +{ + OVR_UNUSED(vend); + OVR_UNUSED(prod); + DeviceId = DisplayDeviceName; + + Desktop.X = 0; + Desktop.Y = 0; + ResolutionInPixels = Sizei(0); + ScreenSizeInMeters = Sizef(0.0f); + VCenterFromTopInMeters = 0.0f; + LensSeparationInMeters = 0.0f; +} + +HMDDeviceCreateDesc::HMDDeviceCreateDesc(const HMDDeviceCreateDesc& other) + : DeviceCreateDesc(other.pFactory, Device_HMD), + DeviceId(other.DeviceId), DisplayDeviceName(other.DisplayDeviceName), + Contents(other.Contents), + DisplayId(other.DisplayId) +{ + Desktop.X = other.Desktop.X; + Desktop.Y = other.Desktop.Y; + ResolutionInPixels = other.ResolutionInPixels; + ScreenSizeInMeters = other.ScreenSizeInMeters; + VCenterFromTopInMeters = other.VCenterFromTopInMeters; + LensSeparationInMeters = other.LensSeparationInMeters; +} + +HMDDeviceCreateDesc::MatchResult HMDDeviceCreateDesc::MatchDevice(const DeviceCreateDesc& other, + DeviceCreateDesc** pcandidate) const +{ + if ((other.Type != Device_HMD) || (other.pFactory != pFactory)) + return Match_None; + + // There are several reasons we can come in here: + // a) Matching this HMD Monitor created desc to OTHER HMD Monitor desc + // - Require exact device DeviceId/DeviceName match + // b) Matching SensorDisplayInfo created desc to OTHER HMD Monitor desc + // - This DeviceId is empty; becomes candidate + // c) Matching this HMD Monitor created desc to SensorDisplayInfo desc + // - This other.DeviceId is empty; becomes candidate + + const HMDDeviceCreateDesc& s2 = (const HMDDeviceCreateDesc&) other; + + if ((DeviceId == s2.DeviceId) && + (DisplayId == s2.DisplayId)) + { + // Non-null DeviceId may match while size is different if screen size was overwritten + // by SensorDisplayInfo in prior iteration. + if (!DeviceId.IsEmpty() || + (ScreenSizeInMeters == s2.ScreenSizeInMeters) ) + { + *pcandidate = 0; + return Match_Found; + } + } + + + // DisplayInfo takes precedence, although we try to match it first. + if ((ResolutionInPixels == s2.ResolutionInPixels) && + (ScreenSizeInMeters == s2.ScreenSizeInMeters)) + { + if (DeviceId.IsEmpty() && !s2.DeviceId.IsEmpty()) + { + *pcandidate = const_cast((const DeviceCreateDesc*)this); + return Match_Candidate; + } + + *pcandidate = 0; + return Match_Found; + } + + // SensorDisplayInfo may override resolution settings, so store as candidiate. + if (s2.DeviceId.IsEmpty() && s2.DisplayId == 0) + { + *pcandidate = const_cast((const DeviceCreateDesc*)this); + return Match_Candidate; + } + // OTHER HMD Monitor desc may initialize DeviceName/Id + else if (DeviceId.IsEmpty() && DisplayId == 0) + { + *pcandidate = const_cast((const DeviceCreateDesc*)this); + return Match_Candidate; + } + + return Match_None; +} + + +bool HMDDeviceCreateDesc::UpdateMatchedCandidate(const DeviceCreateDesc& other, bool* newDeviceFlag) +{ + // This candidate was the the "best fit" to apply sensor DisplayInfo to. + OVR_ASSERT(other.Type == Device_HMD); + + const HMDDeviceCreateDesc& s2 = (const HMDDeviceCreateDesc&) other; + + // Force screen size on resolution from SensorDisplayInfo. + // We do this because USB detection is more reliable as compared to HDMI EDID, + // which may be corrupted by splitter reporting wrong monitor + if (s2.DeviceId.IsEmpty() && s2.DisplayId == 0) + { + ScreenSizeInMeters = s2.ScreenSizeInMeters; + Contents |= Contents_Screen; + + if (s2.Contents & HMDDeviceCreateDesc::Contents_Distortion) + { + memcpy(DistortionK, s2.DistortionK, sizeof(float)*4); + // TODO: DistortionEqn + Contents |= Contents_Distortion; + } + DeviceId = s2.DeviceId; + DisplayId = s2.DisplayId; + DisplayDeviceName = s2.DisplayDeviceName; + Desktop.X = s2.Desktop.X; + Desktop.Y = s2.Desktop.Y; + if (newDeviceFlag) *newDeviceFlag = true; + } + else if (DeviceId.IsEmpty()) + { + // This branch is executed when 'fake' HMD descriptor is being replaced by + // the real one. + DeviceId = s2.DeviceId; + DisplayId = s2.DisplayId; + DisplayDeviceName = s2.DisplayDeviceName; + Desktop.X = s2.Desktop.X; + Desktop.Y = s2.Desktop.Y; + + // ScreenSize and Resolution are NOT assigned here, since they may have + // come from a sensor DisplayInfo (which has precedence over HDMI). + + if (newDeviceFlag) *newDeviceFlag = true; + } + else + { + if (newDeviceFlag) *newDeviceFlag = false; + } + + return true; +} + + +//------------------------------------------------------------------------------------- + + +//------------------------------------------------------------------------------------- +// ***** HMDDeviceFactory + +HMDDeviceFactory &HMDDeviceFactory::GetInstance() +{ + static HMDDeviceFactory instance; + return instance; +} + +void HMDDeviceFactory::EnumerateDevices(EnumerateVisitor& visitor) +{ + CGDirectDisplayID Displays[32]; + uint32_t NDisplays = 0; + CGGetOnlineDisplayList(32, Displays, &NDisplays); + + for (unsigned int i = 0; i < NDisplays; i++) + { + io_service_t port = CGDisplayIOServicePort(Displays[i]); + CFDictionaryRef DispInfo = IODisplayCreateInfoDictionary(port, kIODisplayMatchingInfo); + + uint32_t vendor = CGDisplayVendorNumber(Displays[i]); + uint32_t product = CGDisplayModelNumber(Displays[i]); + + CGRect desktop = CGDisplayBounds(Displays[i]); + + if (vendor == 16082 && ( (product == 1)||(product == 2) ) ) // 7" or HD + { + char idstring[9]; + idstring[0] = 'A'-1+((vendor>>10) & 31); + idstring[1] = 'A'-1+((vendor>>5) & 31); + idstring[2] = 'A'-1+((vendor>>0) & 31); + snprintf(idstring+3, 5, "%04d", product); + + HMDDeviceCreateDesc hmdCreateDesc(this, vendor, product, idstring, Displays[i]); + + // Hard-coded defaults in case the device doesn't have the data itself. + if (product == 3) + { // DK2 prototypes and variants (default to HmdType_DK2) + hmdCreateDesc.SetScreenParameters(desktop.origin.x, desktop.origin.y, + 1920, 1080, 0.12576f, 0.07074f, 0.12576f*0.5f, 0.0635f ); + } + else if (product == 2) + { // HD Prototypes (default to HmdType_DKHDProto) + hmdCreateDesc.SetScreenParameters(desktop.origin.x, desktop.origin.y, + 1920, 1080, 0.12096f, 0.06804f, 0.06804f*0.5f, 0.0635f); + } + else if (product == 1) + { // DK1 + hmdCreateDesc.SetScreenParameters(desktop.origin.x, desktop.origin.y, + 1280, 800, 0.14976f, 0.0936f, 0.0936f*0.5f, 0.0635f); + } + else + { // Future Oculus HMD devices (default to DK1 dimensions) + hmdCreateDesc.SetScreenParameters(desktop.origin.x, desktop.origin.y, + 1280, 800, 0.14976f, 0.0936f, 0.0936f*0.5f, 0.0635f); + } + + OVR_DEBUG_LOG_TEXT(("DeviceManager - HMD Found %x:%x\n", vendor, product)); + + // Notify caller about detected device. This will call EnumerateAddDevice + // if the this is the first time device was detected. + visitor.Visit(hmdCreateDesc); + } + CFRelease(DispInfo); + } +} + +#include "OVR_Common_HMDDevice.cpp" + +}} // namespace OVR::OSX + + diff --git a/LibOVR/Src/OVR_OSX_HMDDevice.h b/LibOVR/Src/OVR_OSX_HMDDevice.h new file mode 100644 index 0000000..dd5c0fe --- /dev/null +++ b/LibOVR/Src/OVR_OSX_HMDDevice.h @@ -0,0 +1,153 @@ +/************************************************************************************ + +Filename : OVR_OSX_HMDDevice.h +Content : OSX HMDDevice implementation +Created : September 21, 2012 +Authors : Michael Antonov + +Copyright : Copyright 2014 Oculus VR, Inc. All Rights reserved. + +Licensed under the Oculus VR Rift SDK License Version 3.1 (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.1 + +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_OSX_HMDDevice_h +#define OVR_OSX_HMDDevice_h + +#include "OVR_DeviceImpl.h" +#include "Kernel/OVR_String.h" +#include "OVR_Profile.h" + +namespace OVR { namespace OSX { + +class HMDDevice; + + +//------------------------------------------------------------------------------------- + +// HMDDeviceFactory enumerates attached Oculus HMD devices. +// +// This is currently done by matching monitor device strings. + +class HMDDeviceFactory : public DeviceFactory +{ +public: + static HMDDeviceFactory &GetInstance(); + + // Enumerates devices, creating and destroying relevant objects in manager. + virtual void EnumerateDevices(EnumerateVisitor& visitor); + +protected: + DeviceManager* getManager() const { return (DeviceManager*) pManager; } +}; + + +class HMDDeviceCreateDesc : public DeviceCreateDesc +{ + friend class HMDDevice; + +protected: + enum + { + Contents_Screen = 1, + Contents_Distortion = 2, + }; + String DeviceId; + String DisplayDeviceName; + struct + { + int X, Y; + } Desktop; + unsigned int Contents; + + Sizei ResolutionInPixels; + Sizef ScreenSizeInMeters; + float VCenterFromTopInMeters; + float LensSeparationInMeters; + + // TODO: update these to splines. + DistortionEqnType DistortionEqn; + float DistortionK[4]; + + int DisplayId; + +public: + HMDDeviceCreateDesc(DeviceFactory* factory, + UInt32 vendor, UInt32 product, const String& displayDeviceName, int dispId); + HMDDeviceCreateDesc(const HMDDeviceCreateDesc& other); + + virtual DeviceCreateDesc* Clone() const + { + return new HMDDeviceCreateDesc(*this); + } + + virtual DeviceBase* NewDeviceInstance(); + + virtual MatchResult MatchDevice(const DeviceCreateDesc& other, + DeviceCreateDesc**) const; + + virtual bool UpdateMatchedCandidate(const DeviceCreateDesc&, bool* newDeviceFlag = NULL); + + virtual bool GetDeviceInfo(DeviceInfo* info) const; + + void SetScreenParameters(int x, int y, + int hres, int vres, + float hsize, float vsize, + float vCenterFromTopInMeters, float lensSeparationInMeters); + void SetDistortion(const float* dks); + + HmdTypeEnum GetHmdType() const; +}; + + +//------------------------------------------------------------------------------------- + +// HMDDevice represents an Oculus HMD device unit. An instance of this class +// is typically created from the DeviceManager. +// After HMD device is created, we its sensor data can be obtained by +// first creating a Sensor object and then wrappig it in SensorFusion. + +class HMDDevice : public DeviceImpl +{ +public: + HMDDevice(HMDDeviceCreateDesc* createDesc); + ~HMDDevice(); + + virtual bool Initialize(DeviceBase* parent); + virtual void Shutdown(); + + // Requests the currently used default profile. This profile affects the + // settings reported by HMDInfo. + virtual Profile* GetProfile(); + virtual const char* GetProfileName(); + virtual bool SetProfileName(const char* name); + + // Query associated sensor. + virtual OVR::SensorDevice* GetSensor(); + +protected: + HMDDeviceCreateDesc* getDesc() const { return (HMDDeviceCreateDesc*)pCreateDesc.GetPtr(); } + + // User name for the profile used with this device. + String ProfileName; + mutable Ptr pCachedProfile; +}; + + +}} // namespace OVR::OSX + +#endif // OVR_OSX_HMDDevice_h + diff --git a/LibOVR/Src/OVR_OSX_SensorDevice.cpp b/LibOVR/Src/OVR_OSX_SensorDevice.cpp new file mode 100644 index 0000000..9b783c6 --- /dev/null +++ b/LibOVR/Src/OVR_OSX_SensorDevice.cpp @@ -0,0 +1,58 @@ +/************************************************************************************ + +Filename : OVR_OSX_SensorDevice.cpp +Content : OSX SensorDevice implementation +Created : March 14, 2013 +Authors : Lee Cooper + +Copyright : Copyright 2014 Oculus VR, Inc. All Rights reserved. + +Licensed under the Oculus VR Rift SDK License Version 3.1 (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.1 + +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_OSX_HMDDevice.h" +#include "OVR_SensorImpl.h" +#include "OVR_DeviceImpl.h" + +namespace OVR { namespace OSX { + +} // namespace OSX + +//------------------------------------------------------------------------------------- +void SensorDeviceImpl::EnumerateHMDFromSensorDisplayInfo(const SensorDisplayInfoImpl& displayInfo, + DeviceFactory::EnumerateVisitor& visitor) +{ + + OSX::HMDDeviceCreateDesc hmdCreateDesc(&OSX::HMDDeviceFactory::GetInstance(), 1, 1, "", 0); + + hmdCreateDesc.SetScreenParameters( 0, 0, + displayInfo.HResolution, displayInfo.VResolution, + displayInfo.HScreenSize, displayInfo.VScreenSize, + displayInfo.VCenter, displayInfo.LensSeparation); + + if ((displayInfo.DistortionType & SensorDisplayInfoImpl::Mask_BaseFmt) == SensorDisplayInfoImpl::Base_Distortion) + { + hmdCreateDesc.SetDistortion(displayInfo.DistortionK); + // TODO: add DistortionEqn + } + + visitor.Visit(hmdCreateDesc); +} + +} // namespace OVR + + diff --git a/Samples/CommonSrc/Platform/OSX_Gamepad.cpp b/Samples/CommonSrc/Platform/OSX_Gamepad.cpp new file mode 100644 index 0000000..36f8109 --- /dev/null +++ b/Samples/CommonSrc/Platform/OSX_Gamepad.cpp @@ -0,0 +1,430 @@ +/************************************************************************************ + +Filename : OSX_Gamepad.cpp +Content : OSX implementation of Gamepad functionality. +Created : May 6, 2013 +Authors : Lee Cooper + +Copyright : Copyright 2012 Oculus VR, Inc. 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 "OSX_Gamepad.h" + + +static const UInt32 Logitech_F710_VendorID = 0x046D; +//static const UInt32 Logitech_F710_ProductID = 0xC219; + +static const UInt32 Sony_DualShock3_VendorID = 0x054C; +//static const UInt32 Sony_DualShock3_ProductID = 0x0268; + + +namespace OVR { namespace Platform { namespace OSX { + + +GamepadManager::GamepadManager() + : bStateChanged(false) +{ + + HidManager = IOHIDManagerCreate(kCFAllocatorDefault, kIOHIDOptionsTypeNone); + IOHIDManagerOpen(HidManager, kIOHIDOptionsTypeNone); + IOHIDManagerScheduleWithRunLoop(HidManager, + CFRunLoopGetCurrent(), + kCFRunLoopDefaultMode); + + + // Setup device matching. + CFStringRef keys[] = { CFSTR(kIOHIDDeviceUsagePageKey), + CFSTR(kIOHIDDeviceUsageKey)}; + + int value; + CFNumberRef values[2]; + CFDictionaryRef dictionaries[2]; + + // Match joysticks. + value = kHIDPage_GenericDesktop; + values[0] = CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &value); + + value = kHIDUsage_GD_Joystick; + values[1] = CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &value); + + dictionaries[0] = CFDictionaryCreate(kCFAllocatorDefault, + (const void **) keys, + (const void **) values, + 2, + &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); + CFRelease(values[0]); + CFRelease(values[1]); + + // Match gamepads. + value = kHIDPage_GenericDesktop; + values[0] = CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &value); + + value = kHIDUsage_GD_GamePad; + values[1] = CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &value); + + dictionaries[1] = CFDictionaryCreate(kCFAllocatorDefault, + (const void **) keys, + (const void **) values, + 2, + &kCFTypeDictionaryKeyCallBacks, + &kCFTypeDictionaryValueCallBacks); + CFRelease(values[0]); + CFRelease(values[1]); + + CFArrayRef array = CFArrayCreate( kCFAllocatorDefault, + (const void **) dictionaries, + 2, + &kCFTypeArrayCallBacks); + CFRelease(dictionaries[0]); + CFRelease(dictionaries[1]); + + IOHIDManagerSetDeviceMatchingMultiple(HidManager, array); + + CFRelease(array); + + + IOHIDManagerRegisterDeviceMatchingCallback(HidManager, staticOnDeviceMatched, this); + IOHIDManagerRegisterDeviceRemovalCallback(HidManager, staticOnDeviceRemoved, this); + +} + +GamepadManager::~GamepadManager() +{ + CFRelease(HidManager); +} + +UInt32 GamepadManager::GetGamepadCount() +{ + return 1; +} + +bool GamepadManager::GetGamepadState(UInt32 index, GamepadState* pState) +{ + // For now we just support one gamepad. + OVR_UNUSED(index); + + if (!bStateChanged) + { + return false; + } + + bStateChanged = false; +// State.Debug(); + + *pState = State; + return true; +} + +int GamepadManager::getIntDeviceProperty(IOHIDDeviceRef device, CFStringRef key) +{ + CFTypeRef type = IOHIDDeviceGetProperty(device, key); + OVR_ASSERT(type != NULL && CFGetTypeID(type) == CFNumberGetTypeID()); + + int value; + CFNumberGetValue((CFNumberRef) type, kCFNumberSInt32Type, &value); + + return value; +} + +void GamepadManager::staticOnDeviceMatched(void* context, IOReturn result, void* sender, IOHIDDeviceRef device) +{ + OVR_UNUSED(result); + OVR_UNUSED(sender); + GamepadManager* pManager = (GamepadManager*) context; + pManager->onDeviceMatched(device); +} + +void GamepadManager::onDeviceMatched(IOHIDDeviceRef device) +{ + IOHIDDeviceRegisterInputValueCallback(device, staticOnDeviceValueChanged, this); +} + +void GamepadManager::staticOnDeviceRemoved(void* context, IOReturn result, void* sender, IOHIDDeviceRef device) +{ + OVR_UNUSED(result); + OVR_UNUSED(sender); + GamepadManager* pManager = (GamepadManager*) context; + pManager->onDeviceRemoved(device); +} + +void GamepadManager::onDeviceRemoved(IOHIDDeviceRef device) +{ + IOHIDDeviceRegisterInputValueCallback(device, NULL, NULL); +} + +void GamepadManager::staticOnDeviceValueChanged(void* context, IOReturn result, void* sender, IOHIDValueRef value) +{ + OVR_UNUSED(result); + OVR_UNUSED(sender); + GamepadManager* pManager = (GamepadManager*) context; + pManager->onDeviceValueChanged(value); +} + +float GamepadManager::mapAnalogAxis(IOHIDValueRef value, IOHIDElementRef element) +{ + + CFIndex val = IOHIDValueGetIntegerValue(value); + CFIndex min = IOHIDElementGetLogicalMin(element); + CFIndex max = IOHIDElementGetLogicalMax(element); + + float v = (float) (val - min) / (float) (max - min); + v = v * 2.0f - 1.0f; + + // Dead zone. + if (v < 0.1f && v > -0.1f) + { + v = 0.0f; + } + + return v; +} + +bool GamepadManager::setStateIfDifferent(float& state, float newState) +{ + if (state == newState) + return false; + + state = newState; + + return true; +} + +void GamepadManager::onDeviceValueChanged(IOHIDValueRef value) +{ + + IOHIDElementRef element = IOHIDValueGetElement(value); + IOHIDDeviceRef device = IOHIDElementGetDevice(element); + + unsigned int vendorID = (unsigned int)getIntDeviceProperty(device, CFSTR(kIOHIDVendorIDKey)); + unsigned int productID = (unsigned int)getIntDeviceProperty(device, CFSTR(kIOHIDProductIDKey)); + OVR_UNUSED(productID); + + uint32_t usagePage = IOHIDElementGetUsagePage(element); + uint32_t usage = IOHIDElementGetUsage(element); + + // The following controller mapping is based on the Logitech F710, however we use it for + // all Logitech devices on the assumption that they're likely to share the same mapping. + if (vendorID == Logitech_F710_VendorID) + { + // Logitech F710 mapping. + if (usagePage == kHIDPage_Button) + { + bool buttonState = IOHIDValueGetIntegerValue(value); + + switch(usage) + { + case kHIDUsage_Button_1: + manipulateBitField(State.Buttons, Gamepad_X, buttonState); + break; + case kHIDUsage_Button_2: + manipulateBitField(State.Buttons, Gamepad_A, buttonState); + break; + case kHIDUsage_Button_3: + manipulateBitField(State.Buttons, Gamepad_B, buttonState); + break; + case kHIDUsage_Button_4: + manipulateBitField(State.Buttons, Gamepad_Y, buttonState); + break; + case 0x05: + manipulateBitField(State.Buttons, Gamepad_L1, buttonState); + break; + case 0x06: + manipulateBitField(State.Buttons, Gamepad_R1, buttonState); + break; + case 0x07: + State.LT = buttonState ? 1.0f:0.0f; + break; + case 0x08: + State.RT = buttonState ? 1.0f:0.0f; + break; + case 0x09: + manipulateBitField(State.Buttons, Gamepad_Back, buttonState); + break; + case 0x0A: + manipulateBitField(State.Buttons, Gamepad_Start, buttonState); + break; + case 0x0B: + manipulateBitField(State.Buttons, Gamepad_LStick, buttonState); + break; + case 0x0C: + manipulateBitField(State.Buttons, Gamepad_RStick, buttonState); + break; + default: + return; + } + } + else if (usagePage == kHIDPage_GenericDesktop) + { + float v; + switch(usage) + { + case kHIDUsage_GD_X: + v = mapAnalogAxis(value, element); + if (!setStateIfDifferent(State.LX, v)) + return; + break; + case kHIDUsage_GD_Y: + v = mapAnalogAxis(value, element); + if (!setStateIfDifferent(State.LY, -v)) + return; + break; + case kHIDUsage_GD_Z: + v = mapAnalogAxis(value, element); + if (!setStateIfDifferent(State.RX, v)) + return; + break; + case kHIDUsage_GD_Rz: + v = mapAnalogAxis(value, element); + if (!setStateIfDifferent(State.RY, -v)) + return; + break; + case kHIDUsage_GD_Hatswitch: + { + CFIndex integerValue = IOHIDValueGetIntegerValue(value); + + manipulateBitField(State.Buttons, + Gamepad_Up, + integerValue == 7 || integerValue == 0 || integerValue == 1); + manipulateBitField(State.Buttons, + Gamepad_Down, + integerValue == 3 || integerValue == 4 || integerValue == 5); + manipulateBitField(State.Buttons, + Gamepad_Left, + integerValue == 5 || integerValue == 6 || integerValue == 7); + manipulateBitField(State.Buttons, + Gamepad_Right, + integerValue == 1 || integerValue == 2 || integerValue == 3); + } + break; + default: + return; + } + } + } + // The following controller mapping is based on the Sony DualShock3, however we use it for + // all Sony devices on the assumption that they're likely to share the same mapping. + else if (vendorID == Sony_DualShock3_VendorID) + { + // PS3 Controller. + if (usagePage == kHIDPage_Button) + { + bool buttonState = IOHIDValueGetIntegerValue(value); + + switch(usage) + { + case kHIDUsage_Button_1: + manipulateBitField(State.Buttons, Gamepad_Back, buttonState); + break; + case kHIDUsage_Button_2: + manipulateBitField(State.Buttons, Gamepad_LStick, buttonState); + break; + case kHIDUsage_Button_3: + manipulateBitField(State.Buttons, Gamepad_RStick, buttonState); + break; + case kHIDUsage_Button_4: + manipulateBitField(State.Buttons, Gamepad_Start, buttonState); + break; + case 0x05: + manipulateBitField(State.Buttons, Gamepad_Up, buttonState); + break; + case 0x06: + manipulateBitField(State.Buttons, Gamepad_Right, buttonState); + break; + case 0x07: + manipulateBitField(State.Buttons, Gamepad_Down, buttonState); + break; + case 0x08: + manipulateBitField(State.Buttons, Gamepad_Left, buttonState); + break; + case 0x09: + State.LT = buttonState ? 1.0f:0.0f; + break; + case 0x0A: + State.RT = buttonState ? 1.0f:0.0f; + break; + case 0x0B: + manipulateBitField(State.Buttons, Gamepad_L1, buttonState); + break; + case 0x0C: + manipulateBitField(State.Buttons, Gamepad_R1, buttonState); + break; + case 0x0D: + // PS3 Triangle. + manipulateBitField(State.Buttons, Gamepad_TRIANGLE, buttonState); + break; + case 0x0E: + // PS3 Circle + manipulateBitField(State.Buttons, Gamepad_CIRCLE, buttonState); + break; + case 0x0F: + // PS3 Cross + manipulateBitField(State.Buttons, Gamepad_CROSS, buttonState); + break; + case 0x10: + // PS3 Square + manipulateBitField(State.Buttons, Gamepad_SQUARE, buttonState); + break; + default: + return; + } + } + else if (usagePage == kHIDPage_GenericDesktop) + { + float v; + switch(usage) + { + case kHIDUsage_GD_X: + v = mapAnalogAxis(value, element); + if (!setStateIfDifferent(State.LX, v)) + return; + break; + case kHIDUsage_GD_Y: + v = mapAnalogAxis(value, element); + if (!setStateIfDifferent(State.LY, -v)) + return; + break; + case kHIDUsage_GD_Z: + v = mapAnalogAxis(value, element); + if (!setStateIfDifferent(State.RX, v)) + return; + break; + case kHIDUsage_GD_Rz: + v = mapAnalogAxis(value, element); + if (!setStateIfDifferent(State.RY, -v)) + return; + break; + default: + return; + } + } + } + + bStateChanged = true; +} + +void GamepadManager::manipulateBitField(unsigned int& bitfield, unsigned int mask, bool val) +{ + if (val) + { + bitfield |= mask; + } + else + { + bitfield &= ~mask; + } +} + +}}} // OVR::Platform::OSX diff --git a/Samples/CommonSrc/Platform/OSX_Gamepad.h b/Samples/CommonSrc/Platform/OSX_Gamepad.h new file mode 100644 index 0000000..27a0948 --- /dev/null +++ b/Samples/CommonSrc/Platform/OSX_Gamepad.h @@ -0,0 +1,66 @@ +/************************************************************************************ + +Filename : OSX_Gamepad.h +Content : OSX implementation of Gamepad functionality. +Created : May 6, 2013 +Authors : Lee Cooper + +Copyright : Copyright 2012 Oculus VR, Inc. 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. + +************************************************************************************/ + +#ifndef OVR_OSX_Gamepad_h +#define OVR_OSX_Gamepad_h + +#include +#include + +#include "Gamepad.h" + +namespace OVR { namespace Platform { namespace OSX { + + +class GamepadManager : public Platform::GamepadManager +{ +public: + GamepadManager(); + ~GamepadManager(); + + virtual UInt32 GetGamepadCount(); + virtual bool GetGamepadState(UInt32 index, GamepadState* pState); + +private: + static void staticOnDeviceMatched(void* context, IOReturn result, void* sender, IOHIDDeviceRef device); + void onDeviceMatched(IOHIDDeviceRef device); + + static void staticOnDeviceRemoved(void* context, IOReturn result, void* sender, IOHIDDeviceRef device); + void onDeviceRemoved(IOHIDDeviceRef device); + + static void staticOnDeviceValueChanged(void* context, IOReturn result, void* sender, IOHIDValueRef value); + void onDeviceValueChanged(IOHIDValueRef value); + + int getIntDeviceProperty(IOHIDDeviceRef device, CFStringRef key); + float mapAnalogAxis(IOHIDValueRef value, IOHIDElementRef element); + void manipulateBitField(unsigned int& bitfield, unsigned int mask, bool val); + bool setStateIfDifferent(float& state, float newState); + + IOHIDManagerRef HidManager; + GamepadState State; + bool bStateChanged; +}; + +}}} + +#endif // OVR_OSX_Gamepad_h diff --git a/Samples/CommonSrc/Platform/OSX_Platform.h b/Samples/CommonSrc/Platform/OSX_Platform.h new file mode 100644 index 0000000..5aa8ee1 --- /dev/null +++ b/Samples/CommonSrc/Platform/OSX_Platform.h @@ -0,0 +1,113 @@ +/************************************************************************************ + +Filename : OSX_Platform.h +Content : +Created : +Authors : + +Copyright : Copyright 2012 Oculus VR, Inc. 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 "../Platform/Platform.h" +#include "../Render/Render_GL_Device.h" + +namespace OVR { namespace Platform { namespace OSX { + +class PlatformCore : public Platform::PlatformCore +{ +public: + void* Win; + void* View; + void* NsApp; + bool Quit; + int ExitCode; + int Width, Height; + MouseMode MMode; + + void RunIdle(); + +public: + PlatformCore(Application* app, void* nsapp); + ~PlatformCore(); + + bool SetupWindow(int w, int h); + void Exit(int exitcode); + + RenderDevice* SetupGraphics(const SetupGraphicsDeviceSet& setupGraphicsDesc, + const char* gtype, const Render::RendererParams& rp); + + void SetMouseMode(MouseMode mm); + void GetWindowSize(int* w, int* h) const; + + void SetWindowTitle(const char*title); + + void ShowWindow(bool show); + void DestroyWindow(); + bool SetFullscreen(const Render::RendererParams& rp, int fullscreen); + int GetDisplayCount(); + Render::DisplayId GetDisplay(int screen); + + String GetContentDirectory() const; +}; + +}} +namespace Render { namespace GL { namespace OSX { + +class RenderDevice : public Render::GL::RenderDevice +{ +public: + void* Context; + + RenderDevice(const Render::RendererParams& p, void* context) + : GL::RenderDevice(p), Context(context) {} + + virtual void Shutdown(); + virtual void Present(bool useVsync); + + virtual bool SetFullscreen(DisplayMode fullscreen); + + virtual ovrRenderAPIConfig Get_ovrRenderAPIConfig() const; + + // oswnd = X11::PlatformCore* + static Render::RenderDevice* CreateDevice(const RendererParams& rp, void* oswnd); +}; + +}}}} + + +// OVR_PLATFORM_APP_ARGS specifies the Application class to use for startup, +// providing it with startup arguments. +#define OVR_PLATFORM_APP_ARGS_WITH_LOG(AppClass, LogClass, args) \ +OVR::Platform::Application* OVR::Platform::Application::CreateApplication() \ +{ static LogClass log; OVR::System::Init(&log); \ +return new AppClass args; } \ +void OVR::Platform::Application::DestroyApplication(OVR::Platform::Application* app) \ +{ OVR::Platform::PlatformCore* platform = app->pPlatform; \ +delete app; delete platform; OVR::System::Destroy(); }; + +#define OVR_PLATFORM_APP_ARGS(AppClass, args) \ + OVR::Platform::Application* OVR::Platform::Application::CreateApplication() \ +{ OVR::System::Init(OVR::Log::ConfigureDefaultLog(OVR::LogMask_All)); \ + return new AppClass args; } \ + void OVR::Platform::Application::DestroyApplication(OVR::Platform::Application* app) \ +{ OVR::Platform::PlatformCore* platform = app->pPlatform; \ + delete app; delete platform; OVR::System::Destroy(); }; + +// OVR_PLATFORM_APP_ARGS specifies the Application startup class with no args. +#define OVR_PLATFORM_APP(AppClass) OVR_PLATFORM_APP_ARGS(AppClass, ()) + +#define OVR_PLATFORM_APP_WITH_LOG(AppClass,LogClass) OVR_PLATFORM_APP_ARGS_WITH_LOG(AppClass,LogClass, ()) + diff --git a/Samples/CommonSrc/Platform/OSX_Platform.mm b/Samples/CommonSrc/Platform/OSX_Platform.mm new file mode 100644 index 0000000..1f9ea68 --- /dev/null +++ b/Samples/CommonSrc/Platform/OSX_Platform.mm @@ -0,0 +1,553 @@ +/************************************************************************************ + +Filename : OSX_Platform.mm +Content : +Created : +Authors : + +Copyright : Copyright 2012 Oculus, Inc. 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. + +************************************************************************************/ + +#import "../Platform/OSX_PlatformObjc.h" + +using namespace OVR; +using namespace OVR::Platform; + +@implementation OVRApp + +- (void)dealloc +{ + [super dealloc]; +} + +- (void)run +{ + NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; + _running = YES; + OVR::Platform::Application* app; + { + using namespace OVR; + using namespace OVR::Platform; + + // CreateApplication must be the first call since it does OVR::System::Initialize. + app = Application::CreateApplication(); + OSX::PlatformCore* platform = new OSX::PlatformCore(app, self); + // The platform attached to an app will be deleted by DestroyApplication. + app->SetPlatformCore(platform); + + [self setApp:app]; + [self setPlatform:platform]; + + const char* argv[] = {"OVRApp"}; + int exitCode = app->OnStartup(1, argv); + if (exitCode) + { + Application::DestroyApplication(app); + exit(exitCode); + } + } + [self finishLaunching]; + [pool drain]; + + while ([self isRunning]) + { + pool = [[NSAutoreleasePool alloc] init]; + NSEvent* event = [self nextEventMatchingMask:NSAnyEventMask untilDate:nil inMode:NSDefaultRunLoopMode dequeue:YES]; + if (event) + { + [self sendEvent:event]; + } + _App->OnIdle(); + [pool drain]; + } + OVR::Platform::Application::DestroyApplication(app); +} + +@end + +static int KeyMap[][2] = +{ + { NSDeleteFunctionKey, OVR::Key_Delete }, + { '\t', OVR::Key_Tab }, + { '\n', OVR::Key_Return }, + { NSPauseFunctionKey, OVR::Key_Pause }, + { 27, OVR::Key_Escape }, + { 127, OVR::Key_Backspace }, + { ' ', OVR::Key_Space }, + { NSPageUpFunctionKey, OVR::Key_PageUp }, + { NSPageDownFunctionKey, OVR::Key_PageDown }, + { NSNextFunctionKey, OVR::Key_PageDown }, + { NSEndFunctionKey, OVR::Key_End }, + { NSHomeFunctionKey, OVR::Key_Home }, + { NSLeftArrowFunctionKey, OVR::Key_Left }, + { NSUpArrowFunctionKey, OVR::Key_Up }, + { NSRightArrowFunctionKey, OVR::Key_Right }, + { NSDownArrowFunctionKey, OVR::Key_Down }, + { NSInsertFunctionKey, OVR::Key_Insert }, + { NSDeleteFunctionKey, OVR::Key_Delete }, + { NSHelpFunctionKey, OVR::Key_Insert }, +}; + + +static KeyCode MapToKeyCode(wchar_t vk) +{ + unsigned key = Key_None; + + if ((vk >= 'a') && (vk <= 'z')) + { + key = vk - 'a' + Key_A; + } + else if ((vk >= ' ') && (vk <= '~')) + { + key = vk; + } + else if ((vk >= '0') && (vk <= '9')) + { + key = vk - '0' + Key_Num0; + } + else if ((vk >= NSF1FunctionKey) && (vk <= NSF15FunctionKey)) + { + key = vk - NSF1FunctionKey + Key_F1; + } + else + { + for (unsigned i = 0; i< (sizeof(KeyMap) / sizeof(KeyMap[1])); i++) + { + if (vk == KeyMap[i][0]) + { + key = KeyMap[i][1]; + break; + } + } + } + + return (KeyCode)key; +} + +static int MapModifiers(unsigned long xmod) +{ + int mod = 0; + if (xmod & NSShiftKeyMask) + mod |= OVR::Platform::Mod_Shift; + if (xmod & NSCommandKeyMask) + mod |= OVR::Platform::Mod_Control; + if (xmod & NSAlternateKeyMask) + mod |= OVR::Platform::Mod_Alt; + if (xmod & NSControlKeyMask) + mod |= OVR::Platform::Mod_Meta; + return mod; +} + +@implementation OVRView + +-(BOOL) acceptsFirstResponder +{ + return YES; +} +-(BOOL) acceptsFirstMouse:(NSEvent *)ev +{ + return YES; +} + ++(CGDirectDisplayID) displayFromScreen:(NSScreen *)s +{ + NSNumber* didref = (NSNumber*)[[s deviceDescription] objectForKey:@"NSScreenNumber"]; + CGDirectDisplayID disp = (CGDirectDisplayID)[didref longValue]; + return disp; +} + +-(void) warpMouseToCenter +{ + NSPoint w; + w.x = _Platform->Width/2.0f; + w.y = _Platform->Height/2.0f; + w = [[self window] convertBaseToScreen:w]; + CGDirectDisplayID disp = [OVRView displayFromScreen:[[self window] screen]]; + CGPoint p = {w.x, CGDisplayPixelsHigh(disp)-w.y}; + CGDisplayMoveCursorToPoint(disp, p); +} + +static bool LookupKey(NSEvent* ev, wchar_t& ch, OVR::KeyCode& key, unsigned& mods) +{ + NSString* chars = [ev charactersIgnoringModifiers]; + if ([chars length] == 0) + return false; + ch = [chars characterAtIndex:0]; + mods = MapModifiers([ev modifierFlags]); + + // check for Cmd+Latin Letter + NSString* modchars = [ev characters]; + if ([modchars length]) + { + wchar_t modch = [modchars characterAtIndex:0]; + if (modch >= 'a' && modch <= 'z') + ch = modch; + } + key = MapToKeyCode(ch); + return true; +} + +-(void) keyDown:(NSEvent*)ev +{ + OVR::KeyCode key; + unsigned mods; + wchar_t ch; + if (!LookupKey(ev, ch, key, mods)) + return; + if (key == Key_Escape && _Platform->MMode == Mouse_Relative) + { + [self warpMouseToCenter]; + CGAssociateMouseAndMouseCursorPosition(true); + [NSCursor unhide]; + _Platform->MMode = Mouse_RelativeEscaped; + } + _App->OnKey(key, ch, true, mods); +} +-(void) keyUp:(NSEvent*)ev +{ + OVR::KeyCode key; + unsigned mods; + wchar_t ch; + if (LookupKey(ev, ch, key, mods)) + _App->OnKey(key, ch, false, mods); +} + +static const OVR::KeyCode ModifierKeys[] = {OVR::Key_None, OVR::Key_Shift, OVR::Key_Control, OVR::Key_Alt, OVR::Key_Meta}; + +-(void)flagsChanged:(NSEvent *)ev +{ + unsigned long cmods = [ev modifierFlags]; + if ((cmods & 0xffff0000) != _Modifiers) + { + uint32_t mods = MapModifiers(cmods); + for (int i = 1; i <= 4; i++) + { + unsigned long m = (1 << (16+i)); + if ((cmods & m) != (_Modifiers & m)) + { + if (cmods & m) + _App->OnKey(ModifierKeys[i], 0, true, mods); + else + _App->OnKey(ModifierKeys[i], 0, false, mods); + } + } + _Modifiers = cmods & 0xffff0000; + } +} + +-(void)ProcessMouse:(NSEvent*)ev +{ + switch ([ev type]) + { + case NSLeftMouseDragged: + case NSRightMouseDragged: + case NSOtherMouseDragged: + case NSMouseMoved: + { + if (_Platform->MMode == OVR::Platform::Mouse_Relative) + { + int dx = [ev deltaX]; + int dy = [ev deltaY]; + + if (dx != 0 || dy != 0) + { + _App->OnMouseMove(dx, dy, Mod_MouseRelative|MapModifiers([ev modifierFlags])); + [self warpMouseToCenter]; + } + } + else + { + NSPoint p = [ev locationInWindow]; + _App->OnMouseMove(p.x, p.y, MapModifiers([ev modifierFlags])); + } + } + break; + case NSLeftMouseDown: + case NSRightMouseDown: + case NSOtherMouseDown: + break; + } +} + +-(void) mouseMoved:(NSEvent*)ev +{ + [self ProcessMouse:ev]; +} +-(void) mouseDragged:(NSEvent*)ev +{ + [self ProcessMouse:ev]; +} +-(void) mouseDown:(NSEvent*)ev +{ + if (_Platform->MMode == Mouse_RelativeEscaped) + { + [self warpMouseToCenter]; + CGAssociateMouseAndMouseCursorPosition(false); + [NSCursor hide]; + _Platform->MMode = Mouse_Relative; + } +} + +//-(void) + +-(id) initWithFrame:(NSRect)frameRect +{ + NSOpenGLPixelFormatAttribute attr[] = + { +// NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion3_2Core, +// NSOpenGLPFAWindow, + NSOpenGLPFADoubleBuffer, + NSOpenGLPFADepthSize, 24, + nil + }; + + NSOpenGLPixelFormat *pf = [[[NSOpenGLPixelFormat alloc] initWithAttributes:attr] autorelease]; + + self = [super initWithFrame:frameRect pixelFormat:pf]; + GLint swap = 0; + [[self openGLContext] setValues:&swap forParameter:NSOpenGLCPSwapInterval]; + //[self setWantsBestResolutionOpenGLSurface:YES]; + return self; +} + +-(void) reshape +{ + NSRect bounds = [self bounds]; + _App->OnResize(bounds.size.width, bounds.size.height); + + _Platform->Width = bounds.size.width; + _Platform->Height = bounds.size.height; + + if (_Platform->GetRenderer()) + _Platform->GetRenderer()->SetWindowSize(bounds.size.width, bounds.size.height); +} + +-(BOOL)windowShouldClose:(id)sender +{ + if (_Platform) + _Platform->Exit(0); + else + exit(0); + return 1; +} + +@end + +namespace OVR { namespace Platform { namespace OSX { + +PlatformCore::PlatformCore(Application* app, void* nsapp) + : Platform::PlatformCore(app), NsApp(nsapp), Win(NULL), View(NULL), Quit(0), MMode(Mouse_Normal) +{ + pGamepadManager = *new OSX::GamepadManager(); +} +PlatformCore::~PlatformCore() +{ +} + +void PlatformCore::Exit(int exitcode) +{ + OVRApp* nsApp = (OVRApp*)NsApp; + [nsApp stop:nil]; +} + +String PlatformCore::GetContentDirectory() const +{ + NSBundle* bundle = [NSBundle mainBundle]; + if (bundle) + return String([[bundle bundlePath] UTF8String]) + "/Contents/Resources"; + else + return "."; +} + + +void PlatformCore::SetMouseMode(MouseMode mm) +{ + if (mm == MMode) + return; + + if (Win) + { + if (mm == Mouse_Relative) + { + [NSCursor hide]; + [(OVRView*)View warpMouseToCenter]; + CGAssociateMouseAndMouseCursorPosition(false); + } + else + { + if (MMode == Mouse_Relative) + { + CGAssociateMouseAndMouseCursorPosition(true); + [NSCursor unhide]; + [(OVRView*)View warpMouseToCenter]; + } + } + } + MMode = mm; +} + + +void PlatformCore::GetWindowSize(int* w, int* h) const +{ + *w = Width; + *h = Height; +} + +bool PlatformCore::SetupWindow(int w, int h) +{ + NSRect winrect; + winrect.origin.x = 0; + winrect.origin.y = 1000; + winrect.size.width = w; + winrect.size.height = h; + NSWindow* win = [[NSWindow alloc] initWithContentRect:winrect styleMask:NSTitledWindowMask|NSClosableWindowMask backing:NSBackingStoreBuffered defer:NO]; + + OVRView* view = [[OVRView alloc] initWithFrame:winrect]; + [view setPlatform:this]; + [win setContentView:view]; + [win setAcceptsMouseMovedEvents:YES]; + [win setDelegate:view]; + [view setApp:pApp]; + Win = win; + View = view; + return 1; +} + +void PlatformCore::SetWindowTitle(const char* title) +{ + [((NSWindow*)Win) setTitle:[[NSString alloc] initWithBytes:title length:strlen(title) encoding:NSUTF8StringEncoding]]; +} + +void PlatformCore::ShowWindow(bool show) +{ + if (show) + [((NSWindow*)Win) makeKeyAndOrderFront:nil]; + else + [((NSWindow*)Win) orderOut:nil]; +} + +void PlatformCore::DestroyWindow() +{ + [((NSWindow*)Win) close]; + Win = NULL; +} + +RenderDevice* PlatformCore::SetupGraphics(const SetupGraphicsDeviceSet& setupGraphicsDesc, + const char* type, const Render::RendererParams& rp) +{ + const SetupGraphicsDeviceSet* setupDesc = setupGraphicsDesc.PickSetupDevice(type); + OVR_ASSERT(setupDesc); + + pRender = *setupDesc->pCreateDevice(rp, this); + if (pRender) + pRender->SetWindowSize(Width, Height); + + return pRender.GetPtr(); +} + +int PlatformCore::GetDisplayCount() +{ + return (int)[[NSScreen screens] count]; +} + +Render::DisplayId PlatformCore::GetDisplay(int i) +{ + NSScreen* s = (NSScreen*)[[NSScreen screens] objectAtIndex:i]; + return Render::DisplayId([OVRView displayFromScreen:s]); +} + +bool PlatformCore::SetFullscreen(const Render::RendererParams& rp, int fullscreen) +{ + if (fullscreen == Render::Display_Window) + [(OVRView*)View exitFullScreenModeWithOptions:nil]; + else + { + NSScreen* usescreen = [NSScreen mainScreen]; + NSArray* screens = [NSScreen screens]; + for (int i = 0; i < [screens count]; i++) + { + NSScreen* s = (NSScreen*)[screens objectAtIndex:i]; + CGDirectDisplayID disp = [OVRView displayFromScreen:s]; + + if (disp == rp.Display.CgDisplayId) + usescreen = s; + } + + [(OVRView*)View enterFullScreenMode:usescreen withOptions:nil]; + [(NSWindow*)Win setInitialFirstResponder:(OVRView*)View]; + [(NSWindow*)Win makeFirstResponder:(OVRView*)View]; + } + + if (pRender) + pRender->SetFullscreen((Render::DisplayMode)fullscreen); + return 1; +} + +}} +// GL +namespace Render { namespace GL { namespace OSX { + +ovrRenderAPIConfig RenderDevice::Get_ovrRenderAPIConfig() const +{ + ovrRenderAPIConfig result = ovrRenderAPIConfig(); + result.Header.API = ovrRenderAPI_OpenGL; + result.Header.RTSize = Sizei(WindowWidth, WindowHeight); + result.Header.Multisample = Params.Multisample; + return result; +} + +Render::RenderDevice* RenderDevice::CreateDevice(const RendererParams& rp, void* oswnd) +{ + Platform::OSX::PlatformCore* PC = (Platform::OSX::PlatformCore*)oswnd; + + OVRView* view = (OVRView*)PC->View; + NSOpenGLContext *context = [view openGLContext]; + if (!context) + return NULL; + + [context makeCurrentContext]; + [((NSWindow*)PC->Win) makeKeyAndOrderFront:nil]; + + return new Render::GL::OSX::RenderDevice(rp, context); +} + +void RenderDevice::Present(bool useVsync) +{ + NSOpenGLContext *context = (NSOpenGLContext*)Context; + [context flushBuffer]; +} + +void RenderDevice::Shutdown() +{ + Context = NULL; +} + +bool RenderDevice::SetFullscreen(DisplayMode fullscreen) +{ + Params.Fullscreen = fullscreen; + return 1; +} + +}}}} + + +int main(int argc, char *argv[]) +{ + NSApplication* nsapp = [OVRApp sharedApplication]; + [nsapp run]; + return 0; +} + diff --git a/Samples/CommonSrc/Platform/OSX_PlatformObjc.h b/Samples/CommonSrc/Platform/OSX_PlatformObjc.h new file mode 100644 index 0000000..8ef1ba2 --- /dev/null +++ b/Samples/CommonSrc/Platform/OSX_PlatformObjc.h @@ -0,0 +1,53 @@ +/*********************************************************************** + +Filename : OSX_PlatformObjc.h +Content : +Created : +Authors : + +Copyright : Copyright 2012 Oculus VR, Inc. 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. + +************************************************************************/ + +#import +#import "OSX_Platform.h" +#import "OSX_Gamepad.h" + +#import +#import + +@interface OVRApp : NSApplication + +@property (assign) IBOutlet NSWindow* win; +@property (assign) OVR::Platform::OSX::PlatformCore* Platform; +@property (assign) OVR::Platform::Application* App; + +-(void) run; + +@end + +@interface OVRView : NSOpenGLView + +@property (assign) OVR::Platform::OSX::PlatformCore* Platform; +@property (assign) OVR::Platform::Application* App; +@property unsigned long Modifiers; + +-(void)ProcessMouse:(NSEvent*)event; +-(void)warpMouseToCenter; + ++(CGDirectDisplayID) displayFromScreen:(NSScreen*)s; + +@end + diff --git a/Samples/CommonSrc/Platform/OSX_WavPlayer.cpp b/Samples/CommonSrc/Platform/OSX_WavPlayer.cpp new file mode 100644 index 0000000..f85d4c4 --- /dev/null +++ b/Samples/CommonSrc/Platform/OSX_WavPlayer.cpp @@ -0,0 +1,250 @@ +/************************************************************************************ + +Filename : WavPlayer_OSX.cpp +Content : An Apple OSX audio handler. +Created : March 5, 2013 +Authors : Robotic Arm Software - Peter Hoff, Dan Goodman, Bryan Croteau + +Copyright : Copyright 2012 Oculus VR, Inc. 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 "OSX_WavPlayer.h" + +namespace OVR { namespace Platform { namespace OSX { + +WavPlayer::WavPlayer(const char* fileName) +{ + FileName = fileName; +} + +bool WavPlayer::isDataChunk(unsigned char* buffer, int index) +{ + unsigned char a = buffer[index]; + unsigned char b = buffer[index + 1]; + unsigned char c = buffer[index + 2]; + unsigned char d = buffer[index + 3]; + return (a == 'D' || a == 'd') && (b == 'A' || b == 'a') && + (c == 'T' || c == 't') && (d == 'A' || d == 'a'); +} + +int WavPlayer::getWord(unsigned char* buffer, int index) +{ + unsigned char a = buffer[index]; + unsigned char b = buffer[index + 1]; + unsigned char c = buffer[index + 2]; + unsigned char d = buffer[index + 3]; + int result = 0; + result |= a; + result |= b << 8; + result |= c << 16; + result |= d << 24; + return result; +} + +short WavPlayer::getHalf(unsigned char* buffer, int index) +{ + unsigned char a = buffer[index]; + unsigned char b = buffer[index + 1]; + short result = 0; + result |= a; + result |= b << 8; + return result; +} + +void *WavPlayer::LoadPCM(const char *filename, unsigned long *len) +{ + FILE *file; + struct stat s; + void *pcm; + + if(stat(filename, &s)) + { + return NULL; + } + *len = s.st_size; + pcm = (void *) malloc(s.st_size); + if(!pcm) + { + return NULL; + } + file = fopen(filename, "rb"); + if(!file) + { + free(pcm); + return NULL; + } + fread(pcm, s.st_size, 1, file); + fclose(file); + return pcm; +} + +int WavPlayer::PlayBuffer(void *pcmbuffer, unsigned long len) +{ + AQCallbackStruct aqc; + UInt32 err, bufferSize; + int i; + + aqc.DataFormat.mSampleRate = SampleRate; + aqc.DataFormat.mFormatID = kAudioFormatLinearPCM; + if(BitsPerSample == 16) + { + aqc.DataFormat.mFormatFlags = kLinearPCMFormatFlagIsSignedInteger + | kAudioFormatFlagIsPacked; + } + aqc.DataFormat.mBytesPerPacket = NumChannels * (BitsPerSample / 8); + aqc.DataFormat.mFramesPerPacket = 1; + aqc.DataFormat.mBytesPerFrame = NumChannels * (BitsPerSample / 8); + aqc.DataFormat.mChannelsPerFrame = NumChannels; + aqc.DataFormat.mBitsPerChannel = BitsPerSample; + aqc.FrameCount = SampleRate / 60; + aqc.SampleLen = (UInt32)(len); + aqc.PlayPtr = 0; + aqc.PCMBuffer = static_cast(pcmbuffer); + + err = AudioQueueNewOutput(&aqc.DataFormat, + aqBufferCallback, + &aqc, + NULL, + kCFRunLoopCommonModes, + 0, + &aqc.Queue); + if(err) + { + return err; + } + + aqc.FrameCount = SampleRate / 60; + bufferSize = aqc.FrameCount * aqc.DataFormat.mBytesPerPacket; + + for(i = 0; i < AUDIO_BUFFERS; i++) + { + err = AudioQueueAllocateBuffer(aqc.Queue, bufferSize, + &aqc.Buffers[i]); + if(err) + { + return err; + } + aqBufferCallback(&aqc, aqc.Queue, aqc.Buffers[i]); + } + + err = AudioQueueStart(aqc.Queue, NULL); + if(err) + { + return err; + } + + while(true) + { + } + sleep(1); + return 0; +} + +void WavPlayer::aqBufferCallback(void *in, AudioQueueRef inQ, AudioQueueBufferRef outQB) +{ + AQCallbackStruct *aqc; + unsigned char *coreAudioBuffer; + + aqc = (AQCallbackStruct *) in; + coreAudioBuffer = (unsigned char*) outQB->mAudioData; + + printf("Sync: %u / %u\n", aqc->PlayPtr, aqc->SampleLen); + + if(aqc->FrameCount > 0) + { + outQB->mAudioDataByteSize = aqc->DataFormat.mBytesPerFrame * aqc->FrameCount; + for(int i = 0; i < aqc->FrameCount * aqc->DataFormat.mBytesPerFrame; i++) + { + if(aqc->PlayPtr > aqc->SampleLen) + { + aqc->PlayPtr = 0; + i = 0; + } + coreAudioBuffer[i] = aqc->PCMBuffer[aqc->PlayPtr]; + aqc->PlayPtr++; + } + AudioQueueEnqueueBuffer(inQ, outQB, 0, NULL); + } +} + +int WavPlayer::PlayAudio() +{ + unsigned long len; + void *pcmbuffer; + int ret; + + pcmbuffer = LoadPCM(FileName, &len); + if(!pcmbuffer) + { + fprintf(stderr, "%s: %s\n", FileName, strerror(errno)); + exit(EXIT_FAILURE); + } + + unsigned char* bytes = (unsigned char*)pcmbuffer; + int index = 0; + + // 'RIFF' + getWord(bytes, index); + index += 4; + // int Length + getWord(bytes, index); + index += 4; + // 'WAVE' + getWord(bytes, index); + index += 4; + // 'fmt ' + getWord(bytes, index); + index += 4; + + // int Format Length + int fmtLen = getWord(bytes, index); + index += 4; + AudioFormat = getHalf(bytes, index); + index += 2; + NumChannels = getHalf(bytes, index); + index += 2; + SampleRate = getWord(bytes, index); + index += 4; + ByteRate = getWord(bytes, index); + index += 4; + BlockAlign = getHalf(bytes, index); + index += 2; + BitsPerSample = getHalf(bytes, index); + index += 2; + index += fmtLen - 16; + while(!isDataChunk(bytes, index)) + { + // Any Chunk + getWord(bytes, index); + index += 4; + // Any Chunk Length + int anyChunkLen = getWord(bytes, index); + index += 4 + anyChunkLen; + } + // 'data' + getWord(bytes, index); + index += 4; + // int Data Length + unsigned long dataLen = getWord(bytes, index); + index += 4; + unsigned char* target = &bytes[index]; + + ret = PlayBuffer((void *)target, dataLen); + free(pcmbuffer); + return ret; +} + +}}} diff --git a/Samples/CommonSrc/Platform/OSX_WavPlayer.h b/Samples/CommonSrc/Platform/OSX_WavPlayer.h new file mode 100644 index 0000000..8d4610f --- /dev/null +++ b/Samples/CommonSrc/Platform/OSX_WavPlayer.h @@ -0,0 +1,72 @@ +/************************************************************************************ + +Filename : WavPlayer_OSX.h +Content : An Apple OSX audio handler. +Created : March 5, 2013 +Authors : Robotic Arm Software - Peter Hoff, Dan Goodman, Bryan Croteau + +Copyright : Copyright 2012 Oculus VR, Inc. 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. + +************************************************************************************/ + +#ifndef OVR_WavPlayer_h +#define OVR_WavPlayer_h + +#include +#include +#include +#include +#include + +#define AUDIO_BUFFERS 4 + +namespace OVR { namespace Platform { namespace OSX { + +typedef struct AQCallbackStruct +{ + AudioQueueRef Queue; + UInt32 FrameCount; + AudioQueueBufferRef Buffers[AUDIO_BUFFERS]; + AudioStreamBasicDescription DataFormat; + UInt32 PlayPtr; + UInt32 SampleLen; + unsigned char* PCMBuffer; +} AQCallbackStruct; + +class WavPlayer +{ +public: + WavPlayer(const char* fileName); + int PlayAudio(); +private: + bool isDataChunk(unsigned char* buffer, int index); + int getWord(unsigned char* buffer, int index); + short getHalf(unsigned char* buffer, int index); + void *LoadPCM(const char *filename, unsigned long *len); + int PlayBuffer(void *pcm, unsigned long len); + static void aqBufferCallback(void *in, AudioQueueRef inQ, AudioQueueBufferRef outQB); + + short AudioFormat; + short NumChannels; + int SampleRate; + int ByteRate; + short BlockAlign; + short BitsPerSample; + const char* FileName; +}; + +}}} + +#endif diff --git a/Samples/LibOVR_With_Samples.xcworkspace/contents.xcworkspacedata b/Samples/LibOVR_With_Samples.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..9e0f5bb --- /dev/null +++ b/Samples/LibOVR_With_Samples.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,10 @@ + + + + + + + diff --git a/Samples/LibOVR_With_Samples.xcworkspace/xcshareddata/xcschemes/LibOVR.xcscheme b/Samples/LibOVR_With_Samples.xcworkspace/xcshareddata/xcschemes/LibOVR.xcscheme new file mode 100644 index 0000000..435de3a --- /dev/null +++ b/Samples/LibOVR_With_Samples.xcworkspace/xcshareddata/xcschemes/LibOVR.xcscheme @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Samples/LibOVR_With_Samples.xcworkspace/xcshareddata/xcschemes/OculusWorldDemo.xcscheme b/Samples/LibOVR_With_Samples.xcworkspace/xcshareddata/xcschemes/OculusWorldDemo.xcscheme new file mode 100644 index 0000000..a883442 --- /dev/null +++ b/Samples/LibOVR_With_Samples.xcworkspace/xcshareddata/xcschemes/OculusWorldDemo.xcscheme @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Samples/OculusWorldDemo/Projects/Mac/Xcode/OculusWorldDemo-Info.plist b/Samples/OculusWorldDemo/Projects/Mac/Xcode/OculusWorldDemo-Info.plist new file mode 100644 index 0000000..cc9e7a3 --- /dev/null +++ b/Samples/OculusWorldDemo/Projects/Mac/Xcode/OculusWorldDemo-Info.plist @@ -0,0 +1,34 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIconFile + Oculus + CFBundleIdentifier + com.oculusvr.${PRODUCT_NAME:rfc1034identifier} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + LSMinimumSystemVersion + ${MACOSX_DEPLOYMENT_TARGET} + NSHumanReadableCopyright + Copyright © 2014 Oculus VR Inc. All rights reserved. + NSMainNibFile + MainMenu + NSPrincipalClass + NSApplication + + diff --git a/Samples/OculusWorldDemo/Projects/Mac/Xcode/OculusWorldDemo.xcodeproj/project.pbxproj b/Samples/OculusWorldDemo/Projects/Mac/Xcode/OculusWorldDemo.xcodeproj/project.pbxproj new file mode 100644 index 0000000..014791b --- /dev/null +++ b/Samples/OculusWorldDemo/Projects/Mac/Xcode/OculusWorldDemo.xcodeproj/project.pbxproj @@ -0,0 +1,458 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + E83DE6F419197F6A00EC97E1 /* OptionMenu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E83DE6F019197F6A00EC97E1 /* OptionMenu.cpp */; }; + E83DE6F519197F6A00EC97E1 /* RenderProfiler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E83DE6F219197F6A00EC97E1 /* RenderProfiler.cpp */; }; + E879CFE9190866D1008CE996 /* Assets in Resources */ = {isa = PBXBuildFile; fileRef = E879CFE8190866D1008CE996 /* Assets */; }; + E8859041192DBE2E00D93D73 /* ../../../../Oculus.icns in Resources */ = {isa = PBXBuildFile; fileRef = E8859040192DBE2E00D93D73 /* ../../../../Oculus.icns */; }; + E8CC57CB1908266300EEEC84 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E8CC57CA1908266300EEEC84 /* Cocoa.framework */; }; + E8E0A56619085ED00077EB8E /* OSX_Gamepad.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E8E0A54219085ED00077EB8E /* OSX_Gamepad.cpp */; }; + E8E0A56719085ED00077EB8E /* OSX_Platform.mm in Sources */ = {isa = PBXBuildFile; fileRef = E8E0A54519085ED00077EB8E /* OSX_Platform.mm */; }; + E8E0A56819085ED00077EB8E /* OSX_WavPlayer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E8E0A54719085ED00077EB8E /* OSX_WavPlayer.cpp */; }; + E8E0A56919085ED00077EB8E /* Platform.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E8E0A54919085ED00077EB8E /* Platform.cpp */; }; + E8E0A56F19085ED00077EB8E /* Render_Device.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E8E0A55719085ED00077EB8E /* Render_Device.cpp */; }; + E8E0A57019085ED00077EB8E /* Render_GL_Device.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E8E0A55B19085ED00077EB8E /* Render_GL_Device.cpp */; }; + E8E0A57219085ED00077EB8E /* Render_LoadTextureDDS.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E8E0A55F19085ED00077EB8E /* Render_LoadTextureDDS.cpp */; }; + E8E0A57319085ED00077EB8E /* Render_LoadTextureTGA.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E8E0A56019085ED00077EB8E /* Render_LoadTextureTGA.cpp */; }; + E8E0A57419085ED00077EB8E /* Render_XmlSceneLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E8E0A56119085ED00077EB8E /* Render_XmlSceneLoader.cpp */; }; + E8E0A57619085FC60077EB8E /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E8E0A57519085FC60077EB8E /* AudioToolbox.framework */; }; + E8E0A57819085FE50077EB8E /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E8E0A57719085FE50077EB8E /* OpenGL.framework */; }; + E8E0A57A190860110077EB8E /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E8E0A579190860110077EB8E /* IOKit.framework */; }; + E8E0A584190861120077EB8E /* OculusWorldDemo_Scene.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E8E0A57B190861110077EB8E /* OculusWorldDemo_Scene.cpp */; }; + E8E0A585190861120077EB8E /* OculusWorldDemo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E8E0A57C190861110077EB8E /* OculusWorldDemo.cpp */; }; + E8E0A587190861120077EB8E /* Player.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E8E0A580190861110077EB8E /* Player.cpp */; }; + E8E0A58B190861220077EB8E /* tinyxml2.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E8E0A589190861220077EB8E /* tinyxml2.cpp */; }; + E8E0A58D1908619A0077EB8E /* libovr.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E8E0A58C1908619A0077EB8E /* libovr.a */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + E83DE6F019197F6A00EC97E1 /* OptionMenu.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = OptionMenu.cpp; path = ../../../../CommonSrc/Util/OptionMenu.cpp; sourceTree = ""; }; + E83DE6F119197F6A00EC97E1 /* OptionMenu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OptionMenu.h; path = ../../../../CommonSrc/Util/OptionMenu.h; sourceTree = ""; }; + E83DE6F219197F6A00EC97E1 /* RenderProfiler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RenderProfiler.cpp; path = ../../../../CommonSrc/Util/RenderProfiler.cpp; sourceTree = ""; }; + E83DE6F319197F6A00EC97E1 /* RenderProfiler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RenderProfiler.h; path = ../../../../CommonSrc/Util/RenderProfiler.h; sourceTree = ""; }; + E879CFE8190866D1008CE996 /* Assets */ = {isa = PBXFileReference; lastKnownFileType = folder; name = Assets; path = ../../../Assets; sourceTree = ""; }; + E8859040192DBE2E00D93D73 /* ../../../../Oculus.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = ../../../../Oculus.icns; sourceTree = ""; }; + E8CC57C71908266300EEEC84 /* OculusWorldDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = OculusWorldDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; + E8CC57CA1908266300EEEC84 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; }; + E8CC57CD1908266300EEEC84 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; }; + E8CC57CE1908266300EEEC84 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = System/Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; }; + E8CC57CF1908266300EEEC84 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; + E8E0A53D19085ED00077EB8E /* Gamepad.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Gamepad.h; sourceTree = ""; }; + E8E0A54219085ED00077EB8E /* OSX_Gamepad.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OSX_Gamepad.cpp; sourceTree = ""; }; + E8E0A54319085ED00077EB8E /* OSX_Gamepad.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OSX_Gamepad.h; sourceTree = ""; }; + E8E0A54419085ED00077EB8E /* OSX_Platform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OSX_Platform.h; sourceTree = ""; }; + E8E0A54519085ED00077EB8E /* OSX_Platform.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = OSX_Platform.mm; sourceTree = ""; }; + E8E0A54619085ED00077EB8E /* OSX_PlatformObjc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OSX_PlatformObjc.h; sourceTree = ""; }; + E8E0A54719085ED00077EB8E /* OSX_WavPlayer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OSX_WavPlayer.cpp; sourceTree = ""; }; + E8E0A54819085ED00077EB8E /* OSX_WavPlayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OSX_WavPlayer.h; sourceTree = ""; }; + E8E0A54919085ED00077EB8E /* Platform.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Platform.cpp; sourceTree = ""; }; + E8E0A54A19085ED00077EB8E /* Platform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Platform.h; sourceTree = ""; }; + E8E0A54B19085ED00077EB8E /* Platform_Default.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Platform_Default.h; sourceTree = ""; }; + E8E0A55719085ED00077EB8E /* Render_Device.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Render_Device.cpp; sourceTree = ""; }; + E8E0A55819085ED00077EB8E /* Render_Device.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Render_Device.h; sourceTree = ""; }; + E8E0A55919085ED00077EB8E /* Render_Font.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Render_Font.h; sourceTree = ""; }; + E8E0A55A19085ED00077EB8E /* Render_FontEmbed_DejaVu48.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Render_FontEmbed_DejaVu48.h; sourceTree = ""; }; + E8E0A55B19085ED00077EB8E /* Render_GL_Device.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Render_GL_Device.cpp; sourceTree = ""; }; + E8E0A55C19085ED00077EB8E /* Render_GL_Device.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Render_GL_Device.h; sourceTree = ""; }; + E8E0A55F19085ED00077EB8E /* Render_LoadTextureDDS.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Render_LoadTextureDDS.cpp; sourceTree = ""; }; + E8E0A56019085ED00077EB8E /* Render_LoadTextureTGA.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Render_LoadTextureTGA.cpp; sourceTree = ""; }; + E8E0A56119085ED00077EB8E /* Render_XmlSceneLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Render_XmlSceneLoader.cpp; sourceTree = ""; }; + E8E0A56219085ED00077EB8E /* Render_XmlSceneLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Render_XmlSceneLoader.h; sourceTree = ""; }; + E8E0A57519085FC60077EB8E /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; }; + E8E0A57719085FE50077EB8E /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = System/Library/Frameworks/OpenGL.framework; sourceTree = SDKROOT; }; + E8E0A579190860110077EB8E /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = System/Library/Frameworks/IOKit.framework; sourceTree = SDKROOT; }; + E8E0A57B190861110077EB8E /* OculusWorldDemo_Scene.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = OculusWorldDemo_Scene.cpp; path = ../../../OculusWorldDemo_Scene.cpp; sourceTree = ""; }; + E8E0A57C190861110077EB8E /* OculusWorldDemo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = OculusWorldDemo.cpp; path = ../../../OculusWorldDemo.cpp; sourceTree = ""; }; + E8E0A57D190861110077EB8E /* OculusWorldDemo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OculusWorldDemo.h; path = ../../../OculusWorldDemo.h; sourceTree = ""; }; + E8E0A580190861110077EB8E /* Player.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Player.cpp; path = ../../../Player.cpp; sourceTree = ""; }; + E8E0A581190861110077EB8E /* Player.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Player.h; path = ../../../Player.h; sourceTree = ""; }; + E8E0A589190861220077EB8E /* tinyxml2.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = tinyxml2.cpp; path = ../../../../../3rdParty/TinyXml/tinyxml2.cpp; sourceTree = ""; }; + E8E0A58A190861220077EB8E /* tinyxml2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = tinyxml2.h; path = ../../../../../3rdParty/TinyXml/tinyxml2.h; sourceTree = ""; }; + E8E0A58C1908619A0077EB8E /* libovr.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libovr.a; path = SRCROOT/../../../Lib/Mac/Xcode/CONFIGURATION/libovr.a; sourceTree = ""; }; + E8E0A58E190865DA0077EB8E /* OculusWorldDemo-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "OculusWorldDemo-Info.plist"; sourceTree = SOURCE_ROOT; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + E8CC57C41908266300EEEC84 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + E8E0A58D1908619A0077EB8E /* libovr.a in Frameworks */, + E8E0A57A190860110077EB8E /* IOKit.framework in Frameworks */, + E8E0A57819085FE50077EB8E /* OpenGL.framework in Frameworks */, + E8E0A57619085FC60077EB8E /* AudioToolbox.framework in Frameworks */, + E8CC57CB1908266300EEEC84 /* Cocoa.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + E83DE6F619197F6F00EC97E1 /* Util */ = { + isa = PBXGroup; + children = ( + E83DE6F019197F6A00EC97E1 /* OptionMenu.cpp */, + E83DE6F119197F6A00EC97E1 /* OptionMenu.h */, + E83DE6F219197F6A00EC97E1 /* RenderProfiler.cpp */, + E83DE6F319197F6A00EC97E1 /* RenderProfiler.h */, + ); + name = Util; + sourceTree = ""; + }; + E8CC57BE1908266300EEEC84 = { + isa = PBXGroup; + children = ( + E8E0A589190861220077EB8E /* tinyxml2.cpp */, + E8E0A58A190861220077EB8E /* tinyxml2.h */, + E8E0A57B190861110077EB8E /* OculusWorldDemo_Scene.cpp */, + E8E0A57C190861110077EB8E /* OculusWorldDemo.cpp */, + E8E0A57D190861110077EB8E /* OculusWorldDemo.h */, + E8E0A580190861110077EB8E /* Player.cpp */, + E8E0A581190861110077EB8E /* Player.h */, + E8859040192DBE2E00D93D73 /* ../../../../Oculus.icns */, + E879CFE8190866D1008CE996 /* Assets */, + E8E0A53919085E570077EB8E /* CommonSrc */, + E8CC57D11908266300EEEC84 /* Supporting Files */, + E8CC57C91908266300EEEC84 /* Frameworks */, + E8CC57C81908266300EEEC84 /* Products */, + ); + sourceTree = ""; + }; + E8CC57C81908266300EEEC84 /* Products */ = { + isa = PBXGroup; + children = ( + E8CC57C71908266300EEEC84 /* OculusWorldDemo.app */, + ); + name = Products; + sourceTree = ""; + }; + E8CC57C91908266300EEEC84 /* Frameworks */ = { + isa = PBXGroup; + children = ( + E8E0A58C1908619A0077EB8E /* libovr.a */, + E8E0A579190860110077EB8E /* IOKit.framework */, + E8E0A57719085FE50077EB8E /* OpenGL.framework */, + E8E0A57519085FC60077EB8E /* AudioToolbox.framework */, + E8CC57CA1908266300EEEC84 /* Cocoa.framework */, + E8CC57CC1908266300EEEC84 /* Other Frameworks */, + ); + name = Frameworks; + sourceTree = ""; + }; + E8CC57CC1908266300EEEC84 /* Other Frameworks */ = { + isa = PBXGroup; + children = ( + E8CC57CD1908266300EEEC84 /* AppKit.framework */, + E8CC57CE1908266300EEEC84 /* CoreData.framework */, + E8CC57CF1908266300EEEC84 /* Foundation.framework */, + ); + name = "Other Frameworks"; + sourceTree = ""; + }; + E8CC57D11908266300EEEC84 /* Supporting Files */ = { + isa = PBXGroup; + children = ( + E8E0A58E190865DA0077EB8E /* OculusWorldDemo-Info.plist */, + ); + name = "Supporting Files"; + path = OculusWorldDemo; + sourceTree = ""; + }; + E8E0A53919085E570077EB8E /* CommonSrc */ = { + isa = PBXGroup; + children = ( + E83DE6F619197F6F00EC97E1 /* Util */, + E8E0A53A19085ED00077EB8E /* Platform */, + E8E0A55019085ED00077EB8E /* Render */, + ); + name = CommonSrc; + sourceTree = ""; + }; + E8E0A53A19085ED00077EB8E /* Platform */ = { + isa = PBXGroup; + children = ( + E8E0A53D19085ED00077EB8E /* Gamepad.h */, + E8E0A54219085ED00077EB8E /* OSX_Gamepad.cpp */, + E8E0A54319085ED00077EB8E /* OSX_Gamepad.h */, + E8E0A54419085ED00077EB8E /* OSX_Platform.h */, + E8E0A54519085ED00077EB8E /* OSX_Platform.mm */, + E8E0A54619085ED00077EB8E /* OSX_PlatformObjc.h */, + E8E0A54719085ED00077EB8E /* OSX_WavPlayer.cpp */, + E8E0A54819085ED00077EB8E /* OSX_WavPlayer.h */, + E8E0A54919085ED00077EB8E /* Platform.cpp */, + E8E0A54A19085ED00077EB8E /* Platform.h */, + E8E0A54B19085ED00077EB8E /* Platform_Default.h */, + ); + name = Platform; + path = ../../../../CommonSrc/Platform; + sourceTree = ""; + }; + E8E0A55019085ED00077EB8E /* Render */ = { + isa = PBXGroup; + children = ( + E8E0A55719085ED00077EB8E /* Render_Device.cpp */, + E8E0A55819085ED00077EB8E /* Render_Device.h */, + E8E0A55919085ED00077EB8E /* Render_Font.h */, + E8E0A55A19085ED00077EB8E /* Render_FontEmbed_DejaVu48.h */, + E8E0A55B19085ED00077EB8E /* Render_GL_Device.cpp */, + E8E0A55C19085ED00077EB8E /* Render_GL_Device.h */, + E8E0A55F19085ED00077EB8E /* Render_LoadTextureDDS.cpp */, + E8E0A56019085ED00077EB8E /* Render_LoadTextureTGA.cpp */, + E8E0A56119085ED00077EB8E /* Render_XmlSceneLoader.cpp */, + E8E0A56219085ED00077EB8E /* Render_XmlSceneLoader.h */, + ); + name = Render; + path = ../../../../CommonSrc/Render; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + E8CC57C61908266300EEEC84 /* OculusWorldDemo */ = { + isa = PBXNativeTarget; + buildConfigurationList = E8CC57F81908266300EEEC84 /* Build configuration list for PBXNativeTarget "OculusWorldDemo" */; + buildPhases = ( + E8CC57C31908266300EEEC84 /* Sources */, + E8CC57C41908266300EEEC84 /* Frameworks */, + E8CC57C51908266300EEEC84 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = OculusWorldDemo; + productName = OculusWorldDemo; + productReference = E8CC57C71908266300EEEC84 /* OculusWorldDemo.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + E8CC57BF1908266300EEEC84 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0510; + ORGANIZATIONNAME = "Oculus VR Inc."; + }; + buildConfigurationList = E8CC57C21908266300EEEC84 /* Build configuration list for PBXProject "OculusWorldDemo" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = E8CC57BE1908266300EEEC84; + productRefGroup = E8CC57C81908266300EEEC84 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + E8CC57C61908266300EEEC84 /* OculusWorldDemo */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + E8CC57C51908266300EEEC84 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + E879CFE9190866D1008CE996 /* Assets in Resources */, + E8859041192DBE2E00D93D73 /* ../../../../Oculus.icns in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + E8CC57C31908266300EEEC84 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + E8E0A57019085ED00077EB8E /* Render_GL_Device.cpp in Sources */, + E8E0A585190861120077EB8E /* OculusWorldDemo.cpp in Sources */, + E8E0A584190861120077EB8E /* OculusWorldDemo_Scene.cpp in Sources */, + E83DE6F419197F6A00EC97E1 /* OptionMenu.cpp in Sources */, + E8E0A56919085ED00077EB8E /* Platform.cpp in Sources */, + E8E0A56619085ED00077EB8E /* OSX_Gamepad.cpp in Sources */, + E8E0A57419085ED00077EB8E /* Render_XmlSceneLoader.cpp in Sources */, + E8E0A57219085ED00077EB8E /* Render_LoadTextureDDS.cpp in Sources */, + E8E0A58B190861220077EB8E /* tinyxml2.cpp in Sources */, + E8E0A587190861120077EB8E /* Player.cpp in Sources */, + E8E0A56819085ED00077EB8E /* OSX_WavPlayer.cpp in Sources */, + E8E0A56F19085ED00077EB8E /* Render_Device.cpp in Sources */, + E8E0A57319085ED00077EB8E /* Render_LoadTextureTGA.cpp in Sources */, + E8E0A56719085ED00077EB8E /* OSX_Platform.mm in Sources */, + E83DE6F519197F6A00EC97E1 /* RenderProfiler.cpp in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + E8CC57F61908266300EEEC84 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = NO; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_CPP_RTTI = NO; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.7; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + }; + name = Debug; + }; + E8CC57F71908266300EEEC84 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = NO; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_ENABLE_CPP_RTTI = NO; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.7; + SDKROOT = macosx; + }; + name = Release; + }; + E8CC57F91908266300EEEC84 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_OBJC_ARC = NO; + COMBINE_HIDPI_IMAGES = YES; + CONFIGURATION_BUILD_DIR = "$(SRCROOT)/../../../Bin/Mac/Xcode/$(CONFIGURATION)"; + CONFIGURATION_TEMP_DIR = "$(SRCROOT)/../../../Bin/Mac/Xcode/$(CONFIGURATION)"; + GCC_ENABLE_CPP_RTTI = NO; + GCC_PRECOMPILE_PREFIX_HEADER = NO; + GCC_PREPROCESSOR_DEFINITIONS = OVR_BUILD_DEBUG; + HEADER_SEARCH_PATHS = ( + "$(inherited)", + /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, + "$(SRCROOT)/../../../../../LibOVR/Src/", + "$(SRCROOT)/../../../../../LibOVR/Include/", + "$(SRCROOT)/../../../../../3rdParty/TinyXml/", + ); + INFOPLIST_FILE = "OculusWorldDemo-Info.plist"; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(SRCROOT)/../../../../../LibOVR/Lib/Mac/Xcode/$(CONFIGURATION)", + ); + OBJROOT = "$(SRCROOT)/../../../Bin/Mac/Xcode/$(CONFIGURATION)"; + ONLY_ACTIVE_ARCH = YES; + OTHER_LDFLAGS = ""; + PRODUCT_NAME = "$(TARGET_NAME)"; + SYMROOT = "$(SRCROOT)/../../../Bin/Mac/Xcode/$(CONFIGURATION)"; + WRAPPER_EXTENSION = app; + }; + name = Debug; + }; + E8CC57FA1908266300EEEC84 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ENABLE_OBJC_ARC = NO; + COMBINE_HIDPI_IMAGES = YES; + CONFIGURATION_BUILD_DIR = "$(SRCROOT)/../../../Bin/Mac/Xcode/$(CONFIGURATION)"; + CONFIGURATION_TEMP_DIR = "$(SRCROOT)/../../../Bin/Mac/Xcode/$(CONFIGURATION)"; + GCC_ENABLE_CPP_RTTI = NO; + GCC_PRECOMPILE_PREFIX_HEADER = NO; + GCC_PREPROCESSOR_DEFINITIONS = ""; + GCC_SYMBOLS_PRIVATE_EXTERN = YES; + HEADER_SEARCH_PATHS = ( + "$(inherited)", + /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, + "$(SRCROOT)/../../../../../LibOVR/Src/", + "$(SRCROOT)/../../../../../LibOVR/Include/", + "$(SRCROOT)/../../../../../3rdParty/TinyXml/", + ); + INFOPLIST_FILE = "OculusWorldDemo-Info.plist"; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(SRCROOT)/../../../../../LibOVR/Lib/Mac/Xcode/$(CONFIGURATION)", + ); + OBJROOT = "$(SRCROOT)/../../../Bin/Mac/Xcode/$(CONFIGURATION)"; + ONLY_ACTIVE_ARCH = YES; + OTHER_LDFLAGS = ""; + PRODUCT_NAME = "$(TARGET_NAME)"; + SYMROOT = "$(SRCROOT)/../../../Bin/Mac/Xcode/$(CONFIGURATION)"; + WRAPPER_EXTENSION = app; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + E8CC57C21908266300EEEC84 /* Build configuration list for PBXProject "OculusWorldDemo" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + E8CC57F61908266300EEEC84 /* Debug */, + E8CC57F71908266300EEEC84 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + E8CC57F81908266300EEEC84 /* Build configuration list for PBXNativeTarget "OculusWorldDemo" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + E8CC57F91908266300EEEC84 /* Debug */, + E8CC57FA1908266300EEEC84 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = E8CC57BF1908266300EEEC84 /* Project object */; +} -- cgit v1.2.3