Player.h
Go to the documentation of this file.
00001 /************************************************************************************
00002 
00003 Filename    :   Player.h
00004 Content     :   Player location and hit-testing logic
00005 Created     :   October 4, 2012
00006 
00007 Copyright   :   Copyright 2012 Oculus, Inc. All Rights reserved.
00008 
00009 Licensed under the Apache License, Version 2.0 (the "License");
00010 you may not use this file except in compliance with the License.
00011 You may obtain a copy of the License at
00012 
00013 http://www.apache.org/licenses/LICENSE-2.0
00014 
00015 Unless required by applicable law or agreed to in writing, software
00016 distributed under the License is distributed on an "AS IS" BASIS,
00017 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00018 See the License for the specific language governing permissions and
00019 limitations under the License.
00020 
00021 
00022 *************************************************************************************/
00023 
00024 #ifndef OVR_WorldDemo_Player_h
00025 #define OVR_WorldDemo_Player_h
00026 
00027 #include "OVR.h"
00028 #include "../CommonSrc/Render/Render_Device.h"
00029 
00030 using namespace OVR;
00031 using namespace OVR::Render;
00032 
00033 //-------------------------------------------------------------------------------------
00034 // The RHS coordinate system is defines as follows (as seen in perspective view):
00035 //  Y - Up
00036 //  Z - Back
00037 //  X - Right
00038 const Vector3f  UpVector(0.0f, 1.0f, 0.0f);
00039 const Vector3f  ForwardVector(0.0f, 0.0f, -1.0f);
00040 const Vector3f  RightVector(1.0f, 0.0f, 0.0f);
00041 
00042 // We start out looking in the positive Z (180 degree rotation).
00043 const float             YawInitial      = 3.141592f;
00044 const float             Sensitivity     = 1.0f;
00045 const float             MoveSpeed       = 3.0f; // m/s
00046 
00047 // These are used for collision detection
00048 const float             RailHeight      = 0.8f;
00049 
00050 
00051 //-------------------------------------------------------------------------------------
00052 // ***** Player
00053 
00054 // Player class describes position and movement state of the player in the 3D world.
00055 class Player
00056 {
00057 public:
00058         // Position and look. The following apply:
00059     Vector3f            EyePos;
00060         float                           EyeHeight;
00061     float               EyeYaw;         // Rotation around Y, CCW positive when looking at RHS (X,Z) plane.
00062     float               EyePitch;       // Pitch. If sensor is plugged in, only read from sensor.
00063     float               EyeRoll;        // Roll, only accessible from Sensor.
00064     float               LastSensorYaw;  // Stores previous Yaw value from to support computing delta.
00065 
00066         // Movement state; different bits may be set based on the state of keys.
00067     UByte               MoveForward;
00068     UByte               MoveBack;
00069     UByte               MoveLeft;
00070     UByte               MoveRight;
00071     Vector3f            GamepadMove, GamepadRotate;
00072 
00073         Player();
00074         ~Player();
00075         void HandleCollision(double dt, Array<Ptr<CollisionModel> >* collisionModels,
00076                                  Array<Ptr<CollisionModel> >* groundCollisionModels, bool shiftDown);
00077 };
00078 
00079 #endif


oculus_sdk
Author(s):
autogenerated on Mon Oct 6 2014 03:01:19