Configuration.h
上传用户:henghua
上传日期:2007-11-14
资源大小:7655k
文件大小:2k
- #ifndef CONFIGURATION_H
- #define CONFIGURATION_H
- enum dtDatatypes
- {
- dtBool=0,
- dtFloat,
- dtInt
- };
- enum pParameters
- {
- p_bReflRefrStrength,
- p_fLODbias,
- p_fSunPosTheta,
- p_fSunPosAlpha,
- p_fSunShininess,
- p_fSunStrength,
- p_fWaterColourR,
- p_fWaterColourG,
- p_fWaterColourB,
- p_bDiffuseRefl,
- p_bisCloudy,
- p_bCloudiness,
- p_bisNight,
- p_bNight_Day,
- p_bisSnowing,
- p_bFogActive,
- numParameters
- };
- struct parameter
- {
- unsigned int datatype;
- union{
- int iData;
- bool bData;
- float fData;
- };
- };
- class CConfiguration
- {
- public:
- CConfiguration()
- {
- id = 0;
- add_parameter(p_bReflRefrStrength, dtFloat);
- add_parameter(p_fSunPosAlpha,dtFloat);
- add_parameter(p_fSunPosTheta,dtFloat);
- add_parameter(p_fSunShininess,dtFloat);
- add_parameter(p_fSunStrength,dtFloat);
- add_parameter(p_fLODbias,dtFloat);
- add_parameter(p_fWaterColourR,dtFloat);
- add_parameter(p_fWaterColourG,dtFloat);
- add_parameter(p_fWaterColourB,dtFloat);
- add_parameter(p_bDiffuseRefl,dtBool);
- add_parameter(p_bisCloudy,dtBool);
- add_parameter(p_bCloudiness,dtFloat);
- add_parameter(p_bNight_Day, dtFloat);
- add_parameter(p_bisNight,dtBool);
- add_parameter(p_bisSnowing,dtBool);
- add_parameter(p_bFogActive,dtBool);
- }
- bool add_parameter(unsigned int id, unsigned int datatype){
- params[id].datatype = datatype;
- return true;
- }
-
- float get_float(pParameters id){ return this->params[id].fData; }
- int get_int(pParameters id){ return this->params[id].iData; }
- bool get_bool(pParameters id){ return this->params[id].bData; }
- void set_float(pParameters id, float value){ params[id].fData = value; }
- void set_int(pParameters id, int value){ params[id].iData = value; }
- void set_bool(pParameters id, bool value){ params[id].bData = value; }
-
- parameter params[numParameters];
- private:
- unsigned int id;
- };
- #endif