00001
00032 #ifndef LL_WLPARAM_SET_H
00033 #define LL_WLPARAM_SET_H
00034
00035 #include <string>
00036 #include <map>
00037
00038 #include "v4math.h"
00039 #include "v4color.h"
00040 #include "llglslshader.h"
00041
00042 class LLFloaterWindLight;
00043 class LLWLParamSet;
00044
00046 class LLWLParamSet {
00047
00048 friend class LLWLParamManager;
00049
00050 public:
00051 LLString mName;
00052
00053 private:
00054
00055 LLSD mParamValues;
00056
00057 float mCloudScrollXOffset, mCloudScrollYOffset;
00058
00059 public:
00060
00061 LLWLParamSet();
00062
00064 void update(LLGLSLShader * shader) const;
00065
00067 void setAll(const LLSD& val);
00068
00070 const LLSD& getAll();
00071
00072
00076 void set(const char * paramName, float x);
00077
00082 void set(const char * paramName, float x, float y);
00083
00089 void set(const char * paramName, float x, float y, float z);
00090
00097 void set(const char * paramName, float x, float y, float z, float w);
00098
00102 void set(const char * paramName, const float * val);
00103
00107 void set(const char * paramName, const LLVector4 & val);
00108
00112 void set(const char * paramName, const LLColor4 & val);
00113
00117 LLVector4 getVector(const char * paramName, bool& error);
00118
00122 F32 getFloat(const char * paramName, bool& error);
00123
00124
00125
00126
00127
00130 void setStarBrightness(F32 val);
00131
00133 F32 getStarBrightness();
00134
00135 void setSunAngle(F32 val);
00136 F32 getSunAngle();
00137
00138 void setEastAngle(F32 val);
00139 F32 getEastAngle();
00140
00141
00142
00145 void setEnableCloudScrollX(bool val);
00146
00148 bool getEnableCloudScrollX();
00149
00152 void setEnableCloudScrollY(bool val);
00153
00155 bool getEnableCloudScrollY();
00156
00159 void setCloudScrollX(F32 val);
00160
00162 F32 getCloudScrollX();
00163
00166 void setCloudScrollY(F32 val);
00167
00169 F32 getCloudScrollY();
00170
00175 void mix(LLWLParamSet& src, LLWLParamSet& dest,
00176 F32 weight);
00177
00178 void updateCloudScrolling(void);
00179 };
00180
00181 inline void LLWLParamSet::setAll(const LLSD& val)
00182 {
00183 if(val.isMap()) {
00184 mParamValues = val;
00185 }
00186 }
00187
00188 inline const LLSD& LLWLParamSet::getAll()
00189 {
00190 return mParamValues;
00191 }
00192
00193 inline void LLWLParamSet::setStarBrightness(float val) {
00194 mParamValues["star_brightness"] = val;
00195 }
00196
00197 inline F32 LLWLParamSet::getStarBrightness() {
00198 return (F32) mParamValues["star_brightness"].asReal();
00199 }
00200
00201 inline F32 LLWLParamSet::getSunAngle() {
00202 return (F32) mParamValues["sun_angle"].asReal();
00203 }
00204
00205 inline F32 LLWLParamSet::getEastAngle() {
00206 return (F32) mParamValues["east_angle"].asReal();
00207 }
00208
00209
00210 inline void LLWLParamSet::setEnableCloudScrollX(bool val) {
00211 mParamValues["enable_cloud_scroll"][0] = val;
00212 }
00213
00214 inline bool LLWLParamSet::getEnableCloudScrollX() {
00215 return mParamValues["enable_cloud_scroll"][0].asBoolean();
00216 }
00217
00218 inline void LLWLParamSet::setEnableCloudScrollY(bool val) {
00219 mParamValues["enable_cloud_scroll"][1] = val;
00220 }
00221
00222 inline bool LLWLParamSet::getEnableCloudScrollY() {
00223 return mParamValues["enable_cloud_scroll"][1].asBoolean();
00224 }
00225
00226
00227 inline void LLWLParamSet::setCloudScrollX(F32 val) {
00228 mParamValues["cloud_scroll_rate"][0] = val;
00229 }
00230
00231 inline F32 LLWLParamSet::getCloudScrollX() {
00232 return (F32) mParamValues["cloud_scroll_rate"][0].asReal();
00233 }
00234
00235 inline void LLWLParamSet::setCloudScrollY(F32 val) {
00236 mParamValues["cloud_scroll_rate"][1] = val;
00237 }
00238
00239 inline F32 LLWLParamSet::getCloudScrollY() {
00240 return (F32) mParamValues["cloud_scroll_rate"][1].asReal();
00241 }
00242
00243
00244 #endif // LL_WLPARAM_SET_H