diff options
author | Jacek Antonelli | 2008-08-15 23:45:34 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:45:34 -0500 |
commit | cd17687f01420952712a500107e0f93e7ab8d5f8 (patch) | |
tree | ce48c2b706f2c1176290e39fb555fbdf6648ce01 /linden/indra/newview/llwlparamset.h | |
parent | Second Life viewer sources 1.19.0.5 (diff) | |
download | meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.zip meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.gz meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.bz2 meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.xz |
Second Life viewer sources 1.19.1.0
Diffstat (limited to '')
-rw-r--r-- | linden/indra/newview/llwlparamset.h | 252 |
1 files changed, 252 insertions, 0 deletions
diff --git a/linden/indra/newview/llwlparamset.h b/linden/indra/newview/llwlparamset.h new file mode 100644 index 0000000..6fa0bff --- /dev/null +++ b/linden/indra/newview/llwlparamset.h | |||
@@ -0,0 +1,252 @@ | |||
1 | /** | ||
2 | * @file llwlparamset.h | ||
3 | * @brief Interface for the LLWLParamSet class. | ||
4 | * | ||
5 | * $LicenseInfo:firstyear=2005&license=viewergpl$ | ||
6 | * | ||
7 | * Copyright (c) 2005-2008, Linden Research, Inc. | ||
8 | * | ||
9 | * Second Life Viewer Source Code | ||
10 | * The source code in this file ("Source Code") is provided by Linden Lab | ||
11 | * to you under the terms of the GNU General Public License, version 2.0 | ||
12 | * ("GPL"), unless you have obtained a separate licensing agreement | ||
13 | * ("Other License"), formally executed by you and Linden Lab. Terms of | ||
14 | * the GPL can be found in doc/GPL-license.txt in this distribution, or | ||
15 | * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 | ||
16 | * | ||
17 | * There are special exceptions to the terms and conditions of the GPL as | ||
18 | * it is applied to this Source Code. View the full text of the exception | ||
19 | * in the file doc/FLOSS-exception.txt in this software distribution, or | ||
20 | * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception | ||
21 | * | ||
22 | * By copying, modifying or distributing this software, you acknowledge | ||
23 | * that you have read and understood your obligations described above, | ||
24 | * and agree to abide by those obligations. | ||
25 | * | ||
26 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | ||
27 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
28 | * COMPLETENESS OR PERFORMANCE. | ||
29 | * $/LicenseInfo$ | ||
30 | */ | ||
31 | |||
32 | #ifndef LL_WLPARAM_SET_H | ||
33 | #define LL_WLPARAM_SET_H | ||
34 | |||
35 | #include <string> | ||
36 | #include <map> | ||
37 | |||
38 | #include "v4math.h" | ||
39 | #include "v4color.h" | ||
40 | #include "llglslshader.h" | ||
41 | |||
42 | class LLFloaterWindLight; | ||
43 | class LLWLParamSet; | ||
44 | |||
45 | /// A class representing a set of parameter values for the WindLight shaders. | ||
46 | class LLWLParamSet { | ||
47 | |||
48 | friend class LLWLParamManager; | ||
49 | |||
50 | public: | ||
51 | LLString mName; | ||
52 | |||
53 | private: | ||
54 | |||
55 | LLSD mParamValues; | ||
56 | |||
57 | float mCloudScrollXOffset, mCloudScrollYOffset; | ||
58 | |||
59 | public: | ||
60 | |||
61 | LLWLParamSet(); | ||
62 | |||
63 | /// Update this set of shader uniforms from the parameter values. | ||
64 | void update(LLGLSLShader * shader) const; | ||
65 | |||
66 | /// set the total llsd | ||
67 | void setAll(const LLSD& val); | ||
68 | |||
69 | /// get the total llsd | ||
70 | const LLSD& getAll(); | ||
71 | |||
72 | |||
73 | /// Set a float parameter. | ||
74 | /// \param paramName The name of the parameter to set. | ||
75 | /// \param x The float value to set. | ||
76 | void set(const char * paramName, float x); | ||
77 | |||
78 | /// Set a float2 parameter. | ||
79 | /// \param paramName The name of the parameter to set. | ||
80 | /// \param x The x component's value to set. | ||
81 | /// \param y The y component's value to set. | ||
82 | void set(const char * paramName, float x, float y); | ||
83 | |||
84 | /// Set a float3 parameter. | ||
85 | /// \param paramName The name of the parameter to set. | ||
86 | /// \param x The x component's value to set. | ||
87 | /// \param y The y component's value to set. | ||
88 | /// \param z The z component's value to set. | ||
89 | void set(const char * paramName, float x, float y, float z); | ||
90 | |||
91 | /// Set a float4 parameter. | ||
92 | /// \param paramName The name of the parameter to set. | ||
93 | /// \param x The x component's value to set. | ||
94 | /// \param y The y component's value to set. | ||
95 | /// \param z The z component's value to set. | ||
96 | /// \param w The w component's value to set. | ||
97 | void set(const char * paramName, float x, float y, float z, float w); | ||
98 | |||
99 | /// Set a float4 parameter. | ||
100 | /// \param paramName The name of the parameter to set. | ||
101 | /// \param val An array of the 4 float values to set the parameter to. | ||
102 | void set(const char * paramName, const float * val); | ||
103 | |||
104 | /// Set a float4 parameter. | ||
105 | /// \param paramName The name of the parameter to set. | ||
106 | /// \param val A struct of the 4 float values to set the parameter to. | ||
107 | void set(const char * paramName, const LLVector4 & val); | ||
108 | |||
109 | /// Set a float4 parameter. | ||
110 | /// \param paramName The name of the parameter to set. | ||
111 | /// \param val A struct of the 4 float values to set the parameter to. | ||
112 | void set(const char * paramName, const LLColor4 & val); | ||
113 | |||
114 | /// Get a float4 parameter. | ||
115 | /// \param paramName The name of the parameter to set. | ||
116 | /// \param error A flag to set if it's not the proper return type | ||
117 | LLVector4 getVector(const char * paramName, bool& error); | ||
118 | |||
119 | /// Get an integer parameter | ||
120 | /// \param paramName The name of the parameter to set. | ||
121 | /// \param error A flag to set if it's not the proper return type | ||
122 | F32 getFloat(const char * paramName, bool& error); | ||
123 | |||
124 | |||
125 | // specific getters and setters | ||
126 | |||
127 | |||
128 | /// set the star's brightness | ||
129 | /// \param val brightness value | ||
130 | void setStarBrightness(F32 val); | ||
131 | |||
132 | /// get the star brightness value; | ||
133 | F32 getStarBrightness(); | ||
134 | |||
135 | /// set the star's brightness | ||
136 | /// \param val brightness value | ||
137 | void setSunAngle(F32 val); | ||
138 | |||
139 | /// get the star brightness value; | ||
140 | F32 getSunAngle(); | ||
141 | |||
142 | /// set the star's brightness | ||
143 | /// \param val brightness value | ||
144 | void setEastAngle(F32 val); | ||
145 | |||
146 | /// get the star brightness value; | ||
147 | F32 getEastAngle(); | ||
148 | |||
149 | |||
150 | |||
151 | /// set the cloud scroll x enable value | ||
152 | /// \param val scroll x value | ||
153 | void setEnableCloudScrollX(bool val); | ||
154 | |||
155 | /// get the scroll x enable value; | ||
156 | bool getEnableCloudScrollX(); | ||
157 | |||
158 | /// set the star's brightness | ||
159 | /// \param val scroll y bool value | ||
160 | void setEnableCloudScrollY(bool val); | ||
161 | |||
162 | /// get the scroll enable y value; | ||
163 | bool getEnableCloudScrollY(); | ||
164 | |||
165 | /// set the cloud scroll x enable value | ||
166 | /// \param val scroll x value | ||
167 | void setCloudScrollX(F32 val); | ||
168 | |||
169 | /// get the scroll x enable value; | ||
170 | F32 getCloudScrollX(); | ||
171 | |||
172 | /// set the star's brightness | ||
173 | /// \param val scroll y bool value | ||
174 | void setCloudScrollY(F32 val); | ||
175 | |||
176 | /// get the scroll enable y value; | ||
177 | F32 getCloudScrollY(); | ||
178 | |||
179 | /// interpolate two parameter sets | ||
180 | /// \param src The parameter set to start with | ||
181 | /// \param dest The parameter set to end with | ||
182 | /// \param weight The amount to interpolate | ||
183 | void mix(LLWLParamSet& src, LLWLParamSet& dest, | ||
184 | F32 weight); | ||
185 | |||
186 | void updateCloudScrolling(void); | ||
187 | }; | ||
188 | |||
189 | inline void LLWLParamSet::setAll(const LLSD& val) | ||
190 | { | ||
191 | if(val.isMap()) { | ||
192 | mParamValues = val; | ||
193 | } | ||
194 | } | ||
195 | |||
196 | inline const LLSD& LLWLParamSet::getAll() | ||
197 | { | ||
198 | return mParamValues; | ||
199 | } | ||
200 | |||
201 | inline void LLWLParamSet::setStarBrightness(float val) { | ||
202 | mParamValues["star_brightness"] = val; | ||
203 | } | ||
204 | |||
205 | inline F32 LLWLParamSet::getStarBrightness() { | ||
206 | return (F32) mParamValues["star_brightness"].asReal(); | ||
207 | } | ||
208 | |||
209 | inline F32 LLWLParamSet::getSunAngle() { | ||
210 | return (F32) mParamValues["sun_angle"].asReal(); | ||
211 | } | ||
212 | |||
213 | inline F32 LLWLParamSet::getEastAngle() { | ||
214 | return (F32) mParamValues["east_angle"].asReal(); | ||
215 | } | ||
216 | |||
217 | |||
218 | inline void LLWLParamSet::setEnableCloudScrollX(bool val) { | ||
219 | mParamValues["enable_cloud_scroll"][0] = val; | ||
220 | } | ||
221 | |||
222 | inline bool LLWLParamSet::getEnableCloudScrollX() { | ||
223 | return mParamValues["enable_cloud_scroll"][0].asBoolean(); | ||
224 | } | ||
225 | |||
226 | inline void LLWLParamSet::setEnableCloudScrollY(bool val) { | ||
227 | mParamValues["enable_cloud_scroll"][1] = val; | ||
228 | } | ||
229 | |||
230 | inline bool LLWLParamSet::getEnableCloudScrollY() { | ||
231 | return mParamValues["enable_cloud_scroll"][1].asBoolean(); | ||
232 | } | ||
233 | |||
234 | |||
235 | inline void LLWLParamSet::setCloudScrollX(F32 val) { | ||
236 | mParamValues["cloud_scroll_rate"][0] = val; | ||
237 | } | ||
238 | |||
239 | inline F32 LLWLParamSet::getCloudScrollX() { | ||
240 | return (F32) mParamValues["cloud_scroll_rate"][0].asReal(); | ||
241 | } | ||
242 | |||
243 | inline void LLWLParamSet::setCloudScrollY(F32 val) { | ||
244 | mParamValues["cloud_scroll_rate"][1] = val; | ||
245 | } | ||
246 | |||
247 | inline F32 LLWLParamSet::getCloudScrollY() { | ||
248 | return (F32) mParamValues["cloud_scroll_rate"][1].asReal(); | ||
249 | } | ||
250 | |||
251 | |||
252 | #endif // LL_WLPARAM_SET_H | ||