Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef OVR_Profile_h
00023 #define OVR_Profile_h
00024
00025 #include "Kernel/OVR_String.h"
00026 #include "Kernel/OVR_RefCount.h"
00027 #include "Kernel/OVR_Array.h"
00028
00029 namespace OVR {
00030
00031
00032 enum ProfileType
00033 {
00034 Profile_Unknown = 0,
00035 Profile_RiftDK1 = 1,
00036 Profile_RiftDKHD = 2,
00037 };
00038
00039 class Profile;
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061 class ProfileManager : public RefCountBase<ProfileManager>
00062 {
00063 protected:
00064
00065
00066 Lock ProfileLock;
00067 Array<Ptr<Profile> > ProfileCache;
00068 ProfileType CacheDevice;
00069 String DefaultProfile;
00070 bool Changed;
00071 char NameBuff[32];
00072
00073 public:
00074 static ProfileManager* Create();
00075
00076
00077 int GetProfileCount(ProfileType device);
00078 const char* GetProfileName(ProfileType device, unsigned int index);
00079 bool HasProfile(ProfileType device, const char* name);
00080 Profile* LoadProfile(ProfileType device, unsigned int index);
00081 Profile* LoadProfile(ProfileType device, const char* name);
00082 Profile* GetDeviceDefaultProfile(ProfileType device);
00083 const char* GetDefaultProfileName(ProfileType device);
00084 bool SetDefaultProfileName(ProfileType device, const char* name);
00085 bool Save(const Profile* profile);
00086 bool Delete(const Profile* profile);
00087
00088 protected:
00089 ProfileManager();
00090 ~ProfileManager();
00091 void LoadCache(ProfileType device);
00092 void SaveCache();
00093 void ClearCache();
00094 Profile* CreateProfileObject(const char* user,
00095 ProfileType device,
00096 const char** device_name);
00097 };
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107 class Profile : public RefCountBase<Profile>
00108 {
00109 public:
00110 enum { MaxNameLen = 32 };
00111
00112 enum GenderType
00113 {
00114 Gender_Unspecified = 0,
00115 Gender_Male = 1,
00116 Gender_Female = 2
00117 };
00118
00119 ProfileType Type;
00120 char Name[MaxNameLen];
00121
00122 protected:
00123 GenderType Gender;
00124 float PlayerHeight;
00125 float IPD;
00126
00127 public:
00128
00129 GenderType GetGender() { return Gender; };
00130 float GetPlayerHeight() { return PlayerHeight; };
00131 float GetIPD() { return IPD; };
00132 float GetEyeHeight();
00133
00134 void SetGender(GenderType gender) { Gender = gender; };
00135 void SetPlayerHeight(float height) { PlayerHeight = height; };
00136 void SetIPD(float ipd) { IPD = ipd; };
00137
00138
00139 protected:
00140 Profile(ProfileType type, const char* name);
00141
00142 virtual Profile* Clone() const = 0;
00143 virtual bool ParseProperty(const char* prop, const char* sval);
00144
00145 friend class ProfileManager;
00146 };
00147
00148
00149
00150
00151
00152
00153
00154 class RiftDK1Profile : public Profile
00155 {
00156 public:
00157 enum EyeCupType
00158 {
00159 EyeCup_A = 0,
00160 EyeCup_B = 1,
00161 EyeCup_C = 2
00162 };
00163
00164 protected:
00165 EyeCupType EyeCups;
00166 int LL;
00167 int LR;
00168 int RL;
00169 int RR;
00170
00171 public:
00172 EyeCupType GetEyeCup() { return EyeCups; };
00173 void SetEyeCup(EyeCupType cup) { EyeCups = cup; };
00174
00175 protected:
00176 RiftDK1Profile(const char* name);
00177
00178 virtual Profile* Clone() const;
00179 virtual bool ParseProperty(const char* prop, const char* sval);
00180
00181 friend class ProfileManager;
00182 };
00183
00184 }
00185
00186 #endif // OVR_Profile_h