Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef OVR_Win32_HMDDevice_h
00017 #define OVR_Win32_HMDDevice_h
00018
00019 #include "OVR_Win32_DeviceManager.h"
00020 #include "OVR_Profile.h"
00021
00022 namespace OVR { namespace Win32 {
00023
00024 class HMDDevice;
00025
00026
00027
00028
00029
00030
00031
00032
00033 class HMDDeviceFactory : public DeviceFactory
00034 {
00035 public:
00036 static HMDDeviceFactory Instance;
00037
00038
00039 virtual void EnumerateDevices(EnumerateVisitor& visitor);
00040
00041 protected:
00042 DeviceManager* getManager() const { return (DeviceManager*) pManager; }
00043 };
00044
00045
00046 class HMDDeviceCreateDesc : public DeviceCreateDesc
00047 {
00048 friend class HMDDevice;
00049
00050 protected:
00051 enum
00052 {
00053 Contents_Screen = 1,
00054 Contents_Distortion = 2,
00055 Contents_7Inch = 4,
00056 };
00057 String DeviceId;
00058 String DisplayDeviceName;
00059 int DesktopX, DesktopY;
00060 unsigned Contents;
00061 unsigned HResolution, VResolution;
00062 float HScreenSize, VScreenSize;
00063 float DistortionK[4];
00064
00065 public:
00066 HMDDeviceCreateDesc(DeviceFactory* factory,
00067 const String& deviceId, const String& displayDeviceName);
00068 HMDDeviceCreateDesc(const HMDDeviceCreateDesc& other);
00069
00070 virtual DeviceCreateDesc* Clone() const
00071 {
00072 return new HMDDeviceCreateDesc(*this);
00073 }
00074
00075 virtual DeviceBase* NewDeviceInstance();
00076
00077 virtual MatchResult MatchDevice(const DeviceCreateDesc& other,
00078 DeviceCreateDesc**) const;
00079
00080
00081 virtual bool MatchDevice(const String& path);
00082
00083 virtual bool UpdateMatchedCandidate(const DeviceCreateDesc&, bool* newDeviceFlag = NULL);
00084
00085 virtual bool GetDeviceInfo(DeviceInfo* info) const;
00086
00087
00088
00089 Profile* GetProfileAddRef() const;
00090
00091 ProfileType GetProfileType() const
00092 {
00093 return (HResolution >= 1920) ? Profile_RiftDKHD : Profile_RiftDK1;
00094 }
00095
00096
00097 void SetScreenParameters(int x, int y, unsigned hres, unsigned vres, float hsize, float vsize)
00098 {
00099 DesktopX = x;
00100 DesktopY = y;
00101 HResolution = hres;
00102 VResolution = vres;
00103 HScreenSize = hsize;
00104 VScreenSize = vsize;
00105 Contents |= Contents_Screen;
00106 }
00107 void SetDistortion(const float* dks)
00108 {
00109 for (int i = 0; i < 4; i++)
00110 DistortionK[i] = dks[i];
00111 Contents |= Contents_Distortion;
00112 }
00113
00114 void Set7Inch() { Contents |= Contents_7Inch; }
00115
00116 bool Is7Inch() const;
00117 };
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127 class HMDDevice : public DeviceImpl<OVR::HMDDevice>
00128 {
00129 public:
00130 HMDDevice(HMDDeviceCreateDesc* createDesc);
00131 ~HMDDevice();
00132
00133 virtual bool Initialize(DeviceBase* parent);
00134 virtual void Shutdown();
00135
00136
00137
00138 virtual Profile* GetProfile() const;
00139 virtual const char* GetProfileName() const;
00140 virtual bool SetProfileName(const char* name);
00141
00142
00143 virtual OVR::SensorDevice* GetSensor();
00144
00145 protected:
00146 HMDDeviceCreateDesc* getDesc() const { return (HMDDeviceCreateDesc*)pCreateDesc.GetPtr(); }
00147
00148
00149 String ProfileName;
00150 mutable Ptr<Profile> pCachedProfile;
00151 };
00152
00153
00154 }}
00155
00156 #endif // OVR_Win32_HMDDevice_h
00157