From 672cdd0ef5455cd62a0d7f7eb6b9889f3ea35f21 Mon Sep 17 00:00:00 2001 From: Brad Davis Date: Sun, 13 Oct 2013 20:28:58 -0700 Subject: Updating to cmake, glew, xrandr --- Samples/SensorBox/CMakeLists.txt | 26 +++++ Samples/SensorBox/SensorBoxTest.cpp | 68 +++++------ Samples/SensorBox/SensorBoxTest_Msvc2010.vcxproj | 126 --------------------- .../SensorBoxTest_Msvc2010.vcxproj.filters | 73 ------------ 4 files changed, 62 insertions(+), 231 deletions(-) create mode 100644 Samples/SensorBox/CMakeLists.txt delete mode 100644 Samples/SensorBox/SensorBoxTest_Msvc2010.vcxproj delete mode 100644 Samples/SensorBox/SensorBoxTest_Msvc2010.vcxproj.filters (limited to 'Samples/SensorBox') diff --git a/Samples/SensorBox/CMakeLists.txt b/Samples/SensorBox/CMakeLists.txt new file mode 100644 index 0000000..be2d98f --- /dev/null +++ b/Samples/SensorBox/CMakeLists.txt @@ -0,0 +1,26 @@ +project(SensorBoxTest) + +set(EXTRA_LIBS + OculusVR + CommonSrc +) + +set(SOURCE_FILES + SensorBoxTest.cpp +) + +if (WIN32) + + add_executable(SensorBoxTest WIN32 ${SOURCE_FILES}) + +elseif (APPLE) + + add_executable(SensorBoxTest MACOSX_BUNDLE ${SOURCE_FILES}) + +else() + + add_executable(SensorBoxTest ${SOURCE_FILES}) + +endif() + +target_link_libraries(SensorBoxTest ${EXTRA_LIBS}) diff --git a/Samples/SensorBox/SensorBoxTest.cpp b/Samples/SensorBox/SensorBoxTest.cpp index 7ca416f..bcf35ed 100644 --- a/Samples/SensorBox/SensorBoxTest.cpp +++ b/Samples/SensorBox/SensorBoxTest.cpp @@ -43,7 +43,7 @@ using namespace OVR::Render; // Y - Up (colored red) // Z - Back (Out from screen, colored blue) // X - Right (green) -// All cameras are looking at the origin. +// All cameras are looking at the origin. // Camera view types. enum ViewType @@ -64,11 +64,11 @@ class InputTestApp : public Application Ptr pManager; Ptr pHMD; Ptr pSensor; - Ptr pSensor2; + Ptr pSensor2; SensorFusion SFusion; SensorFusion SFusion2; - + double LastUpdate; ViewType CurrentView; @@ -89,11 +89,11 @@ public: InputTestApp(); ~InputTestApp(); - virtual int OnStartup(int argc, const char** argv); + virtual int OnStartup(int argc, char** argv); virtual void OnIdle(); virtual void OnMouseMove(int x, int y, int modifiers); - virtual void OnKey(KeyCode key, int chr, bool down, int modifiers); + virtual void OnKey(OVR::KeyCode key, int chr, bool down, int modifiers); }; InputTestApp::InputTestApp() @@ -116,7 +116,7 @@ void UseCase() Ptr pSensor = 0; SensorFusion FusionResult; - + // *** Initialization - Create the first available HMD Device pManager = *DeviceManager::Create(); pHMD = *pManager->EnumerateDevices().CreateDevice(); @@ -127,7 +127,7 @@ void UseCase() // Get DisplayDeviceName, ScreenWidth/Height, etc.. HMDInfo hmdInfo; pHMD->GetDeviceInfo(&hmdInfo); - + if (pSensor) FusionResult.AttachToSensor(pSensor); @@ -137,7 +137,7 @@ void UseCase() // Create a matrix from quaternion, // where elements [0][0] through [3][3] contain rotation. - Matrix4f bodyFrameMatrix(q); + Matrix4f bodyFrameMatrix(q); // Get Euler angles from quaternion, in specified axis rotation order. float yaw, pitch, roll; @@ -156,24 +156,24 @@ InputTestApp::~InputTestApp() { pSensor.Clear(); pManager.Clear(); - + } -int InputTestApp::OnStartup(int argc, const char** argv) +int InputTestApp::OnStartup(int argc, char** argv) { if (!pPlatform->SetupWindow(1200,800)) return 1; - + pManager = *DeviceManager::Create(); - + // This initialization logic supports running two sensors at the same time. - + DeviceEnumerator isensor = pManager->EnumerateDevices(); DeviceEnumerator oculusSensor; DeviceEnumerator oculusSensor2; - + while(isensor) { DeviceInfo di; @@ -210,13 +210,13 @@ int InputTestApp::OnStartup(int argc, const char** argv) oculusSensor.Clear(); oculusSensor2.Clear(); - - + + /* DeviceHandle hHMD = pManager->EnumerateDevices(); HMDInfo hmdInfo; if (hHMD) - { + { hHMD.GetDeviceInfo(&hmdInfo); } */ @@ -241,25 +241,29 @@ int InputTestApp::OnStartup(int argc, const char** argv) // Report relative mouse motion (not absolute position) // pPlatform->SetMouseMode(Mouse_Relative); +#ifdef OVR_OS_WIN32 const char* graphics = "d3d10"; +#else + const char* graphics = "GL"; +#endif for (int i = 1; i < argc; i++) if (!strcmp(argv[i], "-r") && i < argc-1) graphics = argv[i+1]; pRender = pPlatform->SetupGraphics(OVR_DEFAULT_RENDER_DEVICE_SET, graphics, RendererParams()); - + //WireframeFill = pRender->CreateSimpleFill(Fill::F_Wireframe); - + // *** Rotating Box - + pBox = *new Container; - pBox->Add(Ptr( + pBox->Add(Ptr( *Model::CreateAxisFaceColorBox(-2.0f, 2.0f, Color(0, 0xAA, 0), // x = green -1.0f, 1.0f, Color(0xAA,0, 0), // y = red - -1.0f, 1.0f, Color(0, 0, 0xAA)) )); // z = blue + -1.0f, 1.0f, Color(0, 0, 0xAA)) )); // z = blue // Drop-down line from box, to make it easier to see differences in angle. Ptr downLine = *new Model(Prim_Lines); downLine->AddLine(Vertex(0.0f,-4.5f, 0.0f, 0xFFE0B0B0), @@ -267,7 +271,7 @@ int InputTestApp::OnStartup(int argc, const char** argv) pBox->Add(downLine); Sc.World.Add(pBox); - + // Secondary rotating coordinate object, if we have two values. if (pSensor2) { @@ -302,7 +306,7 @@ int InputTestApp::OnStartup(int argc, const char** argv) Vertex( 0.0f, 8.0f, 0.0f, 0xFFFF4040)); // Y - arrow pAxes->AddLine(Vertex(-0.4f, 7.6f, 0.0f, 0xFFFF4040), Vertex( 0.0f, 8.0f, 0.0f, 0xFFFF4040)); // Y - + pAxes->AddLine(Vertex( 0.0f, 0.0f,-8.0f, 0xFF4040FF), Vertex( 0.0f, 0.0f, 8.0f, 0xFF4040FF)); // Z pAxes->AddLine(Vertex( 0.4f, 0.0f, 7.6f, 0xFF4040FF), @@ -310,7 +314,7 @@ int InputTestApp::OnStartup(int argc, const char** argv) pAxes->AddLine(Vertex(-0.4f, 0.0f, 7.6f, 0xFF4040FF), Vertex( 0.0f, 0.0f, 8.0f, 0xFF4040FF)); // Z - arrow Sc.World.Add(pAxes); - + SetView(CurrentView); @@ -339,7 +343,7 @@ void InputTestApp::SetView(ViewType type) View = Matrix4f::LookAtRH(Vector3f(0.0f,-10.0f, 0.0f), // eye Vector3f(0.0f, 0.0f, 0.0f), // at Vector3f(0.0f, 0.0f, 1.0f)); - + break; default: break; @@ -358,12 +362,12 @@ void InputTestApp::OnMouseMove(int x, int y, int modifiers) static float CalcDownAngleDegrees(Quatf q) { - Vector3f downVector(0.0f, -1.0f, 0.0f); + Vector3f downVector(0.0f, -1.0f, 0.0f); Vector3f val= q.Rotate(downVector); return RadToDegree(downVector.Angle(val)); } -void InputTestApp::OnKey(KeyCode key, int chr, bool down, int modifiers) +void InputTestApp::OnKey(OVR::KeyCode key, int chr, bool down, int modifiers) { OVR_UNUSED2(chr, modifiers); @@ -429,7 +433,7 @@ void InputTestApp::OnKey(KeyCode key, int chr, bool down, int modifiers) LogText("Angle: %2.3f Secondary Sensor Angle: %2.3f\n", CalcDownAngleDegrees(SFusion.GetOrientation()), CalcDownAngleDegrees(SFusion2.GetOrientation())); - } + } } break; @@ -451,7 +455,7 @@ void InputTestApp::OnIdle() double curtime = pPlatform->GetAppTime(); // float dt = float(LastUpdate - curtime); LastUpdate = curtime; - + if (pBox) { Quatf q = SFusion.GetOrientation(); @@ -461,7 +465,7 @@ void InputTestApp::OnIdle() // Vector3f euler; // SFusion.GetOrientation().GetEulerABC(&euler.y, &euler.x, &euler.z); // Matrix4f mat = Matrix4f::RotationY(euler.y) * Matrix4f::RotationX(euler.x) * Matrix4f::RotationZ(euler.z); - // pBox->SetMatrix(mat); + // pBox->SetMatrix(mat); // Update titlebar every 20th of a second. if ((curtime - LastTitleUpdate) > 0.05f) @@ -496,7 +500,7 @@ void InputTestApp::OnIdle() pRender->SetProjection(Proj); pRender->SetDepthMode(1,1); - + Sc.Render(pRender, View); pRender->Present(); diff --git a/Samples/SensorBox/SensorBoxTest_Msvc2010.vcxproj b/Samples/SensorBox/SensorBoxTest_Msvc2010.vcxproj deleted file mode 100644 index a0c06af..0000000 --- a/Samples/SensorBox/SensorBoxTest_Msvc2010.vcxproj +++ /dev/null @@ -1,126 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - {8051B837-2982-4F64-8C3B-FAF88B6D83AB} - Win32Proj - SensorBoxTest - SensorBoxTest - - - - Application - true - Unicode - - - Application - false - true - Unicode - - - - - - - - - - - - - true - $(Configuration)\Obj\ - $(ProjectDir)$(Configuration)\ - - - false - $(Configuration)\Obj\ - $(ProjectDir)$(Configuration)\ - - - - - - Level4 - Disabled - OVR_BUILD_DEBUG;WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) - ../../LibOVR/Include;../../LibOVR/Src;../../3rdParty/glext;$(DXSDK_DIR)/Include;%(AdditionalIncludeDirectories) - OldStyle - true - - - false - - - Windows - true - libovrd.lib;dxgi.lib;d3d10.lib;d3d11.lib;d3dcompiler.lib;opengl32.lib;winmm.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) - ../../LibOVR/Lib/Win32;$(DXSDK_DIR)/Lib/x86;%(AdditionalLibraryDirectories) - - - - - Level4 - - - MaxSpeed - true - true - WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) - ../../LibOVR/Include;../../LibOVR/Src;../../3rdParty/glext;$(DXSDK_DIR)/Include;%(AdditionalIncludeDirectories) - MultiThreaded - true - OldStyle - - - Windows - true - true - true - ../../LibOVR/Lib/Win32;$(DXSDK_DIR)/Lib/x86;%(AdditionalLibraryDirectories) - libovr.lib;dxgi.lib;d3d10.lib;d3d11.lib;d3dcompiler.lib;opengl32.lib;winmm.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) - - - - - - - - - - - true - true - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Samples/SensorBox/SensorBoxTest_Msvc2010.vcxproj.filters b/Samples/SensorBox/SensorBoxTest_Msvc2010.vcxproj.filters deleted file mode 100644 index 5c2ee68..0000000 --- a/Samples/SensorBox/SensorBoxTest_Msvc2010.vcxproj.filters +++ /dev/null @@ -1,73 +0,0 @@ - - - - - {ba673e50-0655-4f12-a166-6d3ab6015925} - - - {16e20aab-eff7-45ff-be85-0203ad399e97} - - - {1b6db3ae-a405-4f65-be93-41a62db4fa21} - - - - - CommonSrc\Platform - - - CommonSrc\Platform - - - CommonSrc\Render - - - CommonSrc\Render - - - CommonSrc\Render - - - CommonSrc\Render - - - - CommonSrc\Platform - - - - - CommonSrc\Platform - - - CommonSrc\Platform - - - CommonSrc\Platform - - - CommonSrc\Render - - - CommonSrc\Render - - - CommonSrc\Render - - - CommonSrc\Render - - - CommonSrc\Render - - - CommonSrc\Platform - - - CommonSrc\Platform - - - - - - \ No newline at end of file -- cgit v1.2.3