aboutsummaryrefslogtreecommitdiffstats
path: root/Samples/OculusWorldDemo
diff options
context:
space:
mode:
authorBrad Davis <[email protected]>2013-08-16 10:21:36 -0700
committerBrad Davis <[email protected]>2013-08-16 10:21:50 -0700
commitf29e505a7df820e1376d97b41515bdc89d472499 (patch)
tree74c17222d3ab8790c2f004334c8ad5425ecc45e7 /Samples/OculusWorldDemo
parentda29f23ae3e9b7d8d168fda5d131c11121675b1c (diff)
Official SDK version 0.24
Diffstat (limited to 'Samples/OculusWorldDemo')
-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
5 files changed, 30 insertions, 26 deletions
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.