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