aboutsummaryrefslogtreecommitdiffstats
path: root/Samples
diff options
context:
space:
mode:
Diffstat (limited to 'Samples')
-rw-r--r--Samples/CommonSrc/Platform/Linux_Gamepad.cpp415
-rw-r--r--Samples/CommonSrc/Platform/Linux_Gamepad.h48
-rw-r--r--Samples/OculusRoomTiny/OculusRoomTiny_Msvc2010.vcxproj2
-rw-r--r--Samples/OculusRoomTiny/OculusRoomTiny_Msvc2010.vcxproj.filters2
-rw-r--r--Samples/OculusWorldDemo/OculusWorldDemo.cpp42
-rw-r--r--Samples/OculusWorldDemo/OculusWorldDemo_Msvc2010.vcxproj2
-rw-r--r--Samples/OculusWorldDemo/OculusWorldDemo_Msvc2010.vcxproj.filters2
-rw-r--r--Samples/OculusWorldDemo/Player.cpp6
-rw-r--r--Samples/OculusWorldDemo/Player.h4
-rw-r--r--Samples/SensorBox/SensorBoxTest_Msvc2010.vcxproj2
-rw-r--r--Samples/SensorBox/SensorBoxTest_Msvc2010.vcxproj.filters2
11 files changed, 484 insertions, 43 deletions
diff --git a/Samples/CommonSrc/Platform/Linux_Gamepad.cpp b/Samples/CommonSrc/Platform/Linux_Gamepad.cpp
index 9370120..7bca5c5 100644
--- a/Samples/CommonSrc/Platform/Linux_Gamepad.cpp
+++ b/Samples/CommonSrc/Platform/Linux_Gamepad.cpp
@@ -3,7 +3,7 @@
Filename : Linux_Gamepad.cpp
Content : Linux implementation of Platform app infrastructure
Created : May 6, 2013
-Authors : Lee Cooper
+Authors : Lee Cooper, Simon Hallam
Copyright : Copyright 2013 Oculus VR, Inc. All Rights reserved.
@@ -21,18 +21,34 @@ limitations under the License.
************************************************************************************/
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <glob.h>
+#include <linux/joystick.h>
#include "Linux_Gamepad.h"
+
namespace OVR { namespace Platform { namespace Linux {
-GamepadManager::GamepadManager()
-{
+const char* pNameXbox360Wireless = "Xbox 360";
+const char* pNameXbox360Wired = "Microsoft X-Box 360";
+
+GamepadManager::GamepadManager() :
+ pDevice(NULL)
+{
}
GamepadManager::~GamepadManager()
{
-
+ // if we have an open device, close it
+ if (pDevice)
+ {
+ pDevice->Close();
+ pDevice = NULL;
+ }
}
UInt32 GamepadManager::GetGamepadCount()
@@ -40,9 +56,398 @@ UInt32 GamepadManager::GetGamepadCount()
return 1;
}
-bool GamepadManager::GetGamepadState(UInt32 index, GamepadState* pState)
+bool GamepadManager::GetGamepadState(UInt32 index, GamepadState *pState)
+{
+ if (!pDevice)
+ {
+ // get a list of paths to all the connected joystick devices
+ glob_t joystickGlobBuffer;
+ glob("/dev/input/js*", 0, NULL, &joystickGlobBuffer);
+
+ // open each joystick device, until we find one that will work for our needs
+ for (UInt32 i = 0; i < joystickGlobBuffer.gl_pathc; i++)
+ {
+ pDevice = new Gamepad();
+ if (pDevice->Open(joystickGlobBuffer.gl_pathv[i]))
+ {
+
+ if (pDevice->IsSupportedType())
+ {
+ break;
+ }
+ }
+
+ // we don't know why the device was not useable, make sure it gets closed cleanly
+ pDevice->Close();
+ pDevice = NULL;
+ }
+
+ }
+
+ if (pDevice)
+ {
+ // we have a device, so update it
+ pDevice->UpdateState();
+
+ // copy the device state into the struct param
+ memcpy(pState, pDevice->GetState(), sizeof(GamepadState));
+
+ // TODO: is the device still active/connected? if not, we should close it
+ // and clear pDevice, so that another device can take over
+
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+}
+
+Gamepad::Gamepad() :
+ IsInitialized(false),
+ Name(String("Undefined")),
+ Type(UNDEFINED)
+{
+}
+
+Gamepad::~Gamepad()
+{
+ this->Close();
+}
+
+bool Gamepad::Open(const String& devicePathName)
{
+ Name = "Undefined";
+ Type = UNDEFINED;
+
+ FileDescriptor = ::open(devicePathName.ToCStr(), O_RDONLY | O_NONBLOCK);
+ if (FileDescriptor == -1)
+ {
+ return false;
+ }
+
+ // get the device name
+ char name[128];
+ if (ioctl(FileDescriptor, JSIOCGNAME(sizeof(name)), name) < 0)
+ {
+ return false;
+ }
+
+ Name = name;
+
+ // see if device name matches one of our supported devices
+ static const UInt32 Wireless360Len = String(pNameXbox360Wireless).GetLength();
+ static const UInt32 Wired360Len = String(pNameXbox360Wired).GetLength();
+ if (Name.Substring(0, Wireless360Len) == pNameXbox360Wireless)
+ {
+ Type = XBOX360GAMEPADWIRELESS;
+ return true;
+ }
+ else if(Name.Substring(0, Wired360Len) == pNameXbox360Wired)
+ {
+ Type = XBOX360GAMEPADWIRED;
+ return true;
+ }
+
return false;
}
+bool Gamepad::Close()
+{
+ IsInitialized = false;
+ Name = "Undefined";
+ Type = UNDEFINED;
+ return !::close(FileDescriptor);
+}
+
+void Gamepad::UpdateState()
+{
+ GamepadState *pState = &State;
+ js_event gamepadEvent;
+
+ // read the latest batch of events
+ while (read(FileDescriptor, &gamepadEvent, sizeof(struct js_event)) != -1)
+ {
+ switch (gamepadEvent.type)
+ {
+ case JS_EVENT_BUTTON:
+ IsInitialized = true;
+ SetStateButton(pState, gamepadEvent.number, gamepadEvent.value);
+ break;
+
+ case JS_EVENT_AXIS:
+ IsInitialized = true;
+ SetStateAxis(pState, gamepadEvent.number, gamepadEvent.value);
+ break;
+
+ case JS_EVENT_BUTTON | JS_EVENT_INIT:
+ if (IsInitialized) // skip the fake values during device event initialization
+ {
+ SetStateButton(pState, gamepadEvent.number, gamepadEvent.value);
+ }
+ break;
+
+ case JS_EVENT_AXIS | JS_EVENT_INIT:
+ if (IsInitialized) // skip the fake values during device event initialization
+ {
+ SetStateAxis(pState, gamepadEvent.number, gamepadEvent.value);
+ }
+ break;
+
+ default:
+ LogText("OVR::Linux::UpdateState unknown event type\n");
+ }
+ }
+}
+
+const GamepadState* Gamepad::GetState()
+{
+ return &State;
+}
+
+
+bool Gamepad::IsSupportedType()
+{
+ return Type != UNDEFINED;
+}
+
+const String& Gamepad::GetIdentifier()
+{
+ return Name;
+}
+
+static inline float NormalizeGamepadStickXbox360(SInt32 in)
+{
+ float v;
+ if (abs(in) < 9000) return 0;
+ else if (in > 9000) v = (float)in - 9000;
+ else v = (float)in + 9000;
+ return v / (32767 - 9000);
+}
+
+static inline float NormalizeGamepadTriggerXbox360(SInt32 in,
+ SInt32 offset,
+ SInt32 deadBand,
+ float divisor)
+{
+ in += offset;
+
+ if (in < deadBand)
+ {
+ return 0;
+ }
+ else
+ {
+ return float(in - deadBand) / divisor;
+ }
+}
+
+static inline void UpdateButtonMaskAndBitfield(GamepadState *pState,
+ SInt32 value,
+ UInt32 buttonBitfield)
+{
+ if (value)
+ {
+ pState->Buttons |= buttonBitfield;
+ }
+ else
+ {
+ pState->Buttons = pState->Buttons & (0xFFFFFFFF ^ buttonBitfield);
+ }
+}
+
+void Gamepad::SetStateAxis(GamepadState *pState, UInt32 axis, SInt32 value)
+{
+ // some pads/sticks have lots in common with one another,
+ // handle those shared cases first
+ switch (Type)
+ {
+ case XBOX360GAMEPADWIRELESS:
+ case XBOX360GAMEPADWIRED:
+ switch (axis)
+ {
+ case 0:
+ pState->LX = NormalizeGamepadStickXbox360(value);
+ break;
+
+ case 1:
+ pState->LY = -NormalizeGamepadStickXbox360(value);
+ break;
+
+ case 3:
+ pState->RX = NormalizeGamepadStickXbox360(value);
+ break;
+
+ case 4:
+ pState->RY = -NormalizeGamepadStickXbox360(value);
+ break;
+ }
+ break;
+
+ case UNDEFINED:
+ default:
+ break;
+ }
+
+ // handle the special cases, or pads/sticks which are unique
+ switch (Type)
+ {
+ case XBOX360GAMEPADWIRELESS:
+ switch (axis)
+ {
+ case 2:
+ pState->LT = NormalizeGamepadTriggerXbox360(value, 0, 500, 32267);
+ break;
+
+ case 5:
+ pState->RT = NormalizeGamepadTriggerXbox360(value, 0, 500, 32267);
+ break;
+ }
+ break;
+
+ case XBOX360GAMEPADWIRED:
+ switch (axis)
+ {
+ case 2:
+ pState->LT = NormalizeGamepadTriggerXbox360(value, 32767, 1000, 64535);
+ break;
+
+ case 5:
+ pState->RT = NormalizeGamepadTriggerXbox360(value, 32767, 1000, 64535);
+ break;
+
+ case 6:
+ if (value == 0)
+ {
+ UpdateButtonMaskAndBitfield(pState, 0, Gamepad_Left);
+ UpdateButtonMaskAndBitfield(pState, 0, Gamepad_Right);
+ }
+ else if (value < 0)
+ {
+ UpdateButtonMaskAndBitfield(pState, 1, Gamepad_Left);
+ }
+ else if (value > 0)
+ {
+ UpdateButtonMaskAndBitfield(pState, 1, Gamepad_Right);
+ }
+ break;
+
+ case 7:
+ if (value == 0)
+ {
+ UpdateButtonMaskAndBitfield(pState, 0, Gamepad_Up);
+ UpdateButtonMaskAndBitfield(pState, 0, Gamepad_Down);
+ }
+ else if (value < 0)
+ {
+ UpdateButtonMaskAndBitfield(pState, 1, Gamepad_Up);
+ }
+ else if (value > 0)
+ {
+ UpdateButtonMaskAndBitfield(pState, 1, Gamepad_Down);
+ }
+ break;
+ }
+ break;
+
+ case UNDEFINED:
+ default:
+ break;
+ }
+}
+
+void Gamepad::SetStateButton(GamepadState *pState, UInt32 button, SInt32 value)
+{
+ // some pads/sticks have lots in common with one another,
+ // handle those shared cases first
+ switch (Type)
+ {
+ case XBOX360GAMEPADWIRELESS:
+ case XBOX360GAMEPADWIRED:
+ switch (button)
+ {
+ case 0:
+ UpdateButtonMaskAndBitfield(pState, value, Gamepad_A);
+ break;
+
+ case 1:
+ UpdateButtonMaskAndBitfield(pState, value, Gamepad_B);
+ break;
+
+ case 2:
+ UpdateButtonMaskAndBitfield(pState, value, Gamepad_X);
+ break;
+
+ case 3:
+ UpdateButtonMaskAndBitfield(pState, value, Gamepad_Y);
+ break;
+
+ case 4:
+ UpdateButtonMaskAndBitfield(pState, value, Gamepad_L1);
+ break;
+
+ case 5:
+ UpdateButtonMaskAndBitfield(pState, value, Gamepad_R1);
+ break;
+
+ case 6:
+ UpdateButtonMaskAndBitfield(pState, value, Gamepad_Back);
+ break;
+
+ case 7:
+ UpdateButtonMaskAndBitfield(pState, value, Gamepad_Start);
+ break;
+
+ case 8:
+ // we have no value defined for the Xbox/power button
+ break;
+
+ case 9:
+ UpdateButtonMaskAndBitfield(pState, value, Gamepad_LStick);
+ break;
+
+ case 10:
+ UpdateButtonMaskAndBitfield(pState, value, Gamepad_RStick);
+ break;
+ }
+ break;
+
+ case UNDEFINED:
+ default:
+ break;
+ }
+
+ // handle the special cases, or pads/sticks which are unique
+ switch (Type)
+ {
+ case XBOX360GAMEPADWIRELESS:
+ switch (button)
+ {
+ case 11:
+ UpdateButtonMaskAndBitfield(pState, value, Gamepad_Left);
+ break;
+
+ case 12:
+ UpdateButtonMaskAndBitfield(pState, value, Gamepad_Right);
+ break;
+
+ case 13:
+ UpdateButtonMaskAndBitfield(pState, value, Gamepad_Up);
+ break;
+
+ case 14:
+ UpdateButtonMaskAndBitfield(pState, value, Gamepad_Down);
+ break;
+ }
+
+ case XBOX360GAMEPADWIRED:
+ break;
+
+ case UNDEFINED:
+ default:
+ break;
+ }
+}
+
}}} // OVR::Platform::Linux
+
diff --git a/Samples/CommonSrc/Platform/Linux_Gamepad.h b/Samples/CommonSrc/Platform/Linux_Gamepad.h
index 9e6413d..ba66e70 100644
--- a/Samples/CommonSrc/Platform/Linux_Gamepad.h
+++ b/Samples/CommonSrc/Platform/Linux_Gamepad.h
@@ -3,7 +3,7 @@
Filename : Linux_Gamepad.h
Content : Linux implementation of Gamepad functionality.
Created : May 6, 2013
-Authors : Lee Cooper
+Authors : Lee Cooper, Simon Hallam
Copyright : Copyright 2013 Oculus VR, Inc. All Rights reserved.
@@ -28,22 +28,54 @@ limitations under the License.
namespace OVR { namespace Platform { namespace Linux {
+class Gamepad; // forward declaration for readability
+
class GamepadManager : public Platform::GamepadManager
{
public:
+
GamepadManager();
~GamepadManager();
- virtual UInt32 GetGamepadCount();
- virtual bool GetGamepadState(UInt32 index, GamepadState* pState);
+ virtual UInt32 GetGamepadCount();
+ virtual bool GetGamepadState(UInt32 index, GamepadState *pState);
private:
- // Dynamically ink to XInput to simplify projects.
- //HMODULE hXInputModule;
- //typedef DWORD (WINAPI *PFn_XInputGetState)(DWORD dwUserIndex, XINPUT_STATE* pState);
- //PFn_XInputGetState pXInputGetState;
- //UInt32 LastPadPacketNo;
+ Gamepad *pDevice;
+};
+
+class Gamepad
+{
+public:
+
+ Gamepad();
+ virtual ~Gamepad();
+
+ bool Open(const String& devicePathName);
+ bool Close();
+ bool IsSupportedType();
+ const String& GetIdentifier();
+ void UpdateState();
+ const GamepadState* GetState();
+
+private:
+
+ void SetStateAxis(GamepadState *pState, UInt32 axis, SInt32 value);
+ void SetStateButton(GamepadState *pState, UInt32 button, SInt32 value);
+
+ enum GamepadType
+ {
+ UNDEFINED,
+ XBOX360GAMEPADWIRELESS,
+ XBOX360GAMEPADWIRED
+ };
+
+ UInt32 FileDescriptor;
+ bool IsInitialized;
+ String Name;
+ GamepadType Type;
+ GamepadState State;
};
}}}
diff --git a/Samples/OculusRoomTiny/OculusRoomTiny_Msvc2010.vcxproj b/Samples/OculusRoomTiny/OculusRoomTiny_Msvc2010.vcxproj
index 4bc37a8..5ed8886 100644
--- a/Samples/OculusRoomTiny/OculusRoomTiny_Msvc2010.vcxproj
+++ b/Samples/OculusRoomTiny/OculusRoomTiny_Msvc2010.vcxproj
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
diff --git a/Samples/OculusRoomTiny/OculusRoomTiny_Msvc2010.vcxproj.filters b/Samples/OculusRoomTiny/OculusRoomTiny_Msvc2010.vcxproj.filters
index 3c09bd5..5643d9f 100644
--- a/Samples/OculusRoomTiny/OculusRoomTiny_Msvc2010.vcxproj.filters
+++ b/Samples/OculusRoomTiny/OculusRoomTiny_Msvc2010.vcxproj.filters
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ClCompile Include="OculusRoomModel.cpp" />
diff --git a/Samples/OculusWorldDemo/OculusWorldDemo.cpp b/Samples/OculusWorldDemo/OculusWorldDemo.cpp
index be2e6b2..613cdac 100644
--- a/Samples/OculusWorldDemo/OculusWorldDemo.cpp
+++ b/Samples/OculusWorldDemo/OculusWorldDemo.cpp
@@ -342,8 +342,8 @@ int OculusWorldDemoApp::OnStartup(int argc, const char** argv)
pUserProfile = pHMD->GetProfile();
if (pUserProfile)
{
- ThePlayer.EyeHeight = pUserProfile->GetEyeHeight();
- ThePlayer.EyePos.y = ThePlayer.EyeHeight;
+ ThePlayer.UserEyeHeight = pUserProfile->GetEyeHeight();
+ ThePlayer.EyePos.y = ThePlayer.UserEyeHeight;
}
}
else
@@ -915,7 +915,7 @@ void OculusWorldDemoApp::OnKey(OVR::KeyCode key, int chr, bool down, int modifie
// Reset the camera position in case we get stuck
case Key_T:
- ThePlayer.EyePos = Vector3f(10.0f, 1.6f, 10.0f);
+ ThePlayer.EyePos = Vector3f(10.0f, ThePlayer.UserEyeHeight, 10.0f);
break;
case Key_F5:
@@ -1094,6 +1094,7 @@ void OculusWorldDemoApp::OnIdle()
{
pSensor = *desc.Handle.CreateDeviceTyped<SensorDevice>();
SFusion.AttachToSensor(pSensor);
+
SetAdjustMessage("---------------------------\n"
"SENSOR connected\n"
"---------------------------");
@@ -1199,16 +1200,6 @@ void OculusWorldDemoApp::OnIdle()
(this->*pAdjustFunc)(dt * AdjustDirection * (ShiftDown ? 5.0f : 1.0f));
}
- // Process latency tester results.
- const char* results = LatencyUtil.GetResultsString();
- if (results != NULL)
- {
- LogText("LATENCY TESTER: %s\n", results);
- }
-
- // Have to place this as close as possible to where the HMD orientation is read.
- LatencyUtil.ProcessInputs();
-
// Magnetometer calibration procedure
if (MagCal.IsManuallyCalibrating())
UpdateManualMagCalibration();
@@ -1229,6 +1220,17 @@ void OculusWorldDemoApp::OnIdle()
}
}
+
+ // Process latency tester results.
+ const char* results = LatencyUtil.GetResultsString();
+ if (results != NULL)
+ {
+ LogText("LATENCY TESTER: %s\n", results);
+ }
+
+ // >>> THIS MUST BE PLACED AS CLOSE AS POSSIBLE TO WHERE THE HMD ORIENTATION IS READ <<<
+ LatencyUtil.ProcessInputs();
+
// Handle Sensor motion.
// We extract Yaw, Pitch, Roll instead of directly using the orientation
// to allow "additional" yaw manipulation with mouse/controller.
@@ -1459,9 +1461,9 @@ void OculusWorldDemoApp::UpdateManualMagCalibration()
static const char* HelpText =
"F1 \t100 NoStereo \t420 Z \t520 Manual Mag Calib\n"
"F2 \t100 Stereo \t420 X \t520 Auto Mag Calib\n"
- "F3 \t100 StereoHMD \t420 ; \t520 Mag Set Ref Point\n"
- "F4 \t100 MSAA \t420 F6 \t520 Mag Info\n"
- "F9 \t100 FullScreen \t420 R \t520 Reset SensorFusion\n"
+ "F3 \t100 StereoHMD \t420 F6 \t520 Yaw Drift Info\n"
+ "F4 \t100 MSAA \t420 R \t520 Reset SensorFusion\n"
+ "F9 \t100 FullScreen \t420\n"
"F11 \t100 Fast FullScreen \t500 - + \t660 Adj EyeHeight\n"
"C \t100 Chromatic Ab \t500 [ ] \t660 Adj FOV\n"
"P \t100 Motion Pred \t500 Shift \t660 Adj Faster\n"
@@ -1553,7 +1555,7 @@ void OculusWorldDemoApp::Render(const StereoEyeParams& stereo)
{
LoadingScene.Render(pRender, Matrix4f());
String loadMessage = String("Loading ") + MainFilePath;
- DrawTextBox(pRender, 0.0f, 0.25f, textHeight, loadMessage.ToCStr(), DrawText_HCenter);
+ DrawTextBox(pRender, 0.0f, 0.0f, textHeight, loadMessage.ToCStr(), DrawText_HCenter);
LoadingState = LoadingState_DoLoad;
}
@@ -1572,7 +1574,7 @@ void OculusWorldDemoApp::Render(const StereoEyeParams& stereo)
" FPS: %d Frame: %d \n Pos: %3.2f, %3.2f, %3.2f \n"
" EyeHeight: %3.2f",
RadToDegree(ThePlayer.EyeYaw), RadToDegree(ThePlayer.EyePitch), RadToDegree(ThePlayer.EyeRoll),
- FPS, FrameCounter, ThePlayer.EyePos.x, ThePlayer.EyePos.y, ThePlayer.EyePos.z, ThePlayer.EyePos.y);
+ FPS, FrameCounter, ThePlayer.EyePos.x, ThePlayer.EyePos.y, ThePlayer.EyePos.z, ThePlayer.UserEyeHeight);
size_t texMemInMB = pRender->GetTotalTextureMemoryUsage() / 1058576;
if (texMemInMB)
{
@@ -1680,10 +1682,10 @@ void OculusWorldDemoApp::AdjustEyeHeight(float dt)
{
float dist = 0.5f * dt;
- ThePlayer.EyeHeight += dist;
+ ThePlayer.UserEyeHeight += dist;
ThePlayer.EyePos.y += dist;
- SetAdjustMessage("EyeHeight: %4.2f", ThePlayer.EyeHeight);
+ SetAdjustMessage("UserEyeHeight: %4.2f", ThePlayer.UserEyeHeight);
}
void OculusWorldDemoApp::AdjustMotionPrediction(float dt)
diff --git a/Samples/OculusWorldDemo/OculusWorldDemo_Msvc2010.vcxproj b/Samples/OculusWorldDemo/OculusWorldDemo_Msvc2010.vcxproj
index a881ab8..fb72d47 100644
--- a/Samples/OculusWorldDemo/OculusWorldDemo_Msvc2010.vcxproj
+++ b/Samples/OculusWorldDemo/OculusWorldDemo_Msvc2010.vcxproj
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
diff --git a/Samples/OculusWorldDemo/OculusWorldDemo_Msvc2010.vcxproj.filters b/Samples/OculusWorldDemo/OculusWorldDemo_Msvc2010.vcxproj.filters
index e96dc9e..8199eb7 100644
--- a/Samples/OculusWorldDemo/OculusWorldDemo_Msvc2010.vcxproj.filters
+++ b/Samples/OculusWorldDemo/OculusWorldDemo_Msvc2010.vcxproj.filters
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="CommonSrc">
diff --git a/Samples/OculusWorldDemo/Player.cpp b/Samples/OculusWorldDemo/Player.cpp
index 5577b82..6422920 100644
--- a/Samples/OculusWorldDemo/Player.cpp
+++ b/Samples/OculusWorldDemo/Player.cpp
@@ -24,7 +24,7 @@ limitations under the License.
#include <Kernel/OVR_Alg.h>
Player::Player(void)
- : EyeHeight(1.8f),
+ : UserEyeHeight(1.8f),
EyePos(7.7f, 1.8f, -1.0f),
EyeYaw(YawInitial), EyePitch(0), EyeRoll(0),
LastSensorYaw(0)
@@ -158,9 +158,9 @@ void Player::HandleCollision(double dt, Array<Ptr<CollisionModel> >* collisionMo
}
// Maintain the minimum camera height
- if (EyeHeight - finalDistanceDown < 1.0f)
+ if (UserEyeHeight - finalDistanceDown < 1.0f)
{
- EyePos.y += EyeHeight - finalDistanceDown;
+ EyePos.y += UserEyeHeight - finalDistanceDown;
}
}
}
diff --git a/Samples/OculusWorldDemo/Player.h b/Samples/OculusWorldDemo/Player.h
index e1c0437..e57e67c 100644
--- a/Samples/OculusWorldDemo/Player.h
+++ b/Samples/OculusWorldDemo/Player.h
@@ -55,9 +55,11 @@ const float RailHeight = 0.8f;
class Player
{
public:
+
+ float UserEyeHeight;
+
// Position and look. The following apply:
Vector3f EyePos;
- float EyeHeight;
float EyeYaw; // Rotation around Y, CCW positive when looking at RHS (X,Z) plane.
float EyePitch; // Pitch. If sensor is plugged in, only read from sensor.
float EyeRoll; // Roll, only accessible from Sensor.
diff --git a/Samples/SensorBox/SensorBoxTest_Msvc2010.vcxproj b/Samples/SensorBox/SensorBoxTest_Msvc2010.vcxproj
index a0c06af..6f9e57c 100644
--- a/Samples/SensorBox/SensorBoxTest_Msvc2010.vcxproj
+++ b/Samples/SensorBox/SensorBoxTest_Msvc2010.vcxproj
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
diff --git a/Samples/SensorBox/SensorBoxTest_Msvc2010.vcxproj.filters b/Samples/SensorBox/SensorBoxTest_Msvc2010.vcxproj.filters
index 5c2ee68..07a8312 100644
--- a/Samples/SensorBox/SensorBoxTest_Msvc2010.vcxproj.filters
+++ b/Samples/SensorBox/SensorBoxTest_Msvc2010.vcxproj.filters
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="CommonSrc">