diff options
author | Brad Davis <[email protected]> | 2013-06-27 11:25:32 -0800 |
---|---|---|
committer | Brad Davis <[email protected]> | 2013-06-28 10:47:29 -0700 |
commit | ebefcc885f74461cd0e3f19b5ae3622dc6cf6dbc (patch) | |
tree | 2b16db7350fce54c2e6c1b1c4020d67419cb1164 /Samples/OculusWorldDemo/Player.h | |
parent | 0ade748e1845694c5cbe562fb823e56f09773e27 (diff) |
SDK 0.2.2
Diffstat (limited to 'Samples/OculusWorldDemo/Player.h')
-rw-r--r-- | Samples/OculusWorldDemo/Player.h | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/Samples/OculusWorldDemo/Player.h b/Samples/OculusWorldDemo/Player.h new file mode 100644 index 0000000..fc762c4 --- /dev/null +++ b/Samples/OculusWorldDemo/Player.h @@ -0,0 +1,79 @@ +/************************************************************************************
+
+Filename : Player.h
+Content : Player location and hit-testing logic
+Created : October 4, 2012
+
+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.
+
+
+*************************************************************************************/
+
+#ifndef OVR_WorldDemo_Player_h
+#define OVR_WorldDemo_Player_h
+
+#include "OVR.h"
+#include "../CommonSrc/Render/Render_Device.h"
+
+using namespace OVR;
+using namespace OVR::Render;
+
+//-------------------------------------------------------------------------------------
+// The RHS coordinate system is defines as follows (as seen in perspective view):
+// Y - Up
+// Z - Back
+// X - Right
+const Vector3f UpVector(0.0f, 1.0f, 0.0f);
+const Vector3f ForwardVector(0.0f, 0.0f, -1.0f);
+const Vector3f RightVector(1.0f, 0.0f, 0.0f);
+
+// We start out looking in the positive Z (180 degree rotation).
+const float YawInitial = 3.141592f;
+const float Sensitivity = 1.0f;
+const float MoveSpeed = 3.0f; // m/s
+
+// These are used for collision detection
+const float RailHeight = 0.8f;
+
+
+//-------------------------------------------------------------------------------------
+// ***** Player
+
+// Player class describes position and movement state of the player in the 3D world.
+class Player
+{
+public:
+ // 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.
+ float LastSensorYaw; // Stores previous Yaw value from to support computing delta.
+
+ // Movement state; different bits may be set based on the state of keys.
+ UByte MoveForward;
+ UByte MoveBack;
+ UByte MoveLeft;
+ UByte MoveRight;
+ Vector3f GamepadMove, GamepadRotate;
+
+ Player();
+ ~Player();
+ void HandleCollision(double dt, Array<Ptr<CollisionModel> >* collisionModels,
+ Array<Ptr<CollisionModel> >* groundCollisionModels, bool shiftDown);
+};
+
+#endif
|