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/llwaterparamset.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 'linden/indra/newview/llwaterparamset.h')
-rw-r--r-- | linden/indra/newview/llwaterparamset.h | 156 |
1 files changed, 156 insertions, 0 deletions
diff --git a/linden/indra/newview/llwaterparamset.h b/linden/indra/newview/llwaterparamset.h new file mode 100644 index 0000000..5d2581a --- /dev/null +++ b/linden/indra/newview/llwaterparamset.h | |||
@@ -0,0 +1,156 @@ | |||
1 | /** | ||
2 | * @file llwlparamset.h | ||
3 | * @brief Interface for the LLWaterParamSet 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_WATER_PARAM_SET_H | ||
33 | #define LL_WATER_PARAM_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 LLFloaterWater; | ||
43 | class LLWaterParamSet; | ||
44 | |||
45 | /// A class representing a set of parameter values for the Water shaders. | ||
46 | class LLWaterParamSet | ||
47 | { | ||
48 | friend class LLWaterParamManager; | ||
49 | |||
50 | public: | ||
51 | LLString mName; | ||
52 | |||
53 | private: | ||
54 | |||
55 | LLSD mParamValues; | ||
56 | |||
57 | public: | ||
58 | |||
59 | LLWaterParamSet(); | ||
60 | |||
61 | /// Bind this set of parameter values to the uniforms of a particular shader. | ||
62 | void update(LLGLSLShader * shader) const; | ||
63 | |||
64 | /// set the total llsd | ||
65 | void setAll(const LLSD& val); | ||
66 | |||
67 | /// get the total llsd | ||
68 | const LLSD& getAll(); | ||
69 | |||
70 | /// Set a float parameter. | ||
71 | /// \param paramName The name of the parameter to set. | ||
72 | /// \param x The float value to set. | ||
73 | void set(const char * paramName, float x); | ||
74 | |||
75 | /// Set a float2 parameter. | ||
76 | /// \param paramName The name of the parameter to set. | ||
77 | /// \param x The x component's value to set. | ||
78 | /// \param y The y component's value to set. | ||
79 | void set(const char * paramName, float x, float y); | ||
80 | |||
81 | /// Set a float3 parameter. | ||
82 | /// \param paramName The name of the parameter to set. | ||
83 | /// \param x The x component's value to set. | ||
84 | /// \param y The y component's value to set. | ||
85 | /// \param z The z component's value to set. | ||
86 | void set(const char * paramName, float x, float y, float z); | ||
87 | |||
88 | /// Set a float4 parameter. | ||
89 | /// \param paramName The name of the parameter to set. | ||
90 | /// \param x The x component's value to set. | ||
91 | /// \param y The y component's value to set. | ||
92 | /// \param z The z component's value to set. | ||
93 | /// \param w The w component's value to set. | ||
94 | void set(const char * paramName, float x, float y, float z, float w); | ||
95 | |||
96 | /// Set a float4 parameter. | ||
97 | /// \param paramName The name of the parameter to set. | ||
98 | /// \param val An array of the 4 float values to set the parameter to. | ||
99 | void set(const char * paramName, const float * val); | ||
100 | |||
101 | /// Set a float4 parameter. | ||
102 | /// \param paramName The name of the parameter to set. | ||
103 | /// \param val A struct of the 4 float values to set the parameter to. | ||
104 | void set(const char * paramName, const LLVector4 & val); | ||
105 | |||
106 | /// Set a float4 parameter. | ||
107 | /// \param paramName The name of the parameter to set. | ||
108 | /// \param val A struct of the 4 float values to set the parameter to. | ||
109 | void set(const char * paramName, const LLColor4 & val); | ||
110 | |||
111 | /// Get a float4 parameter. | ||
112 | /// \param paramName The name of the parameter to set. | ||
113 | /// \param error A flag to set if it's not the proper return type | ||
114 | LLVector4 getVector4(const char * paramName, bool& error); | ||
115 | |||
116 | /// Get a float3 parameter. | ||
117 | /// \param paramName The name of the parameter to set. | ||
118 | /// \param error A flag to set if it's not the proper return type | ||
119 | LLVector3 getVector3(const char * paramName, bool& error); | ||
120 | |||
121 | /// Get a float2 parameter. | ||
122 | /// \param paramName The name of the parameter to set. | ||
123 | /// \param error A flag to set if it's not the proper return type | ||
124 | LLVector2 getVector2(const char * paramName, bool& error); | ||
125 | |||
126 | /// Get an integer parameter | ||
127 | /// \param paramName The name of the parameter to set. | ||
128 | /// \param error A flag to set if it's not the proper return type | ||
129 | F32 getFloat(const char * paramName, bool& error); | ||
130 | |||
131 | /// interpolate two parameter sets | ||
132 | /// \param src The parameter set to start with | ||
133 | /// \param dest The parameter set to end with | ||
134 | /// \param weight The amount to interpolate | ||
135 | void mix(LLWaterParamSet& src, LLWaterParamSet& dest, | ||
136 | F32 weight); | ||
137 | |||
138 | }; | ||
139 | |||
140 | inline void LLWaterParamSet::setAll(const LLSD& val) | ||
141 | { | ||
142 | if(val.isMap()) { | ||
143 | LLSD::map_const_iterator mIt = val.beginMap(); | ||
144 | for(; mIt != val.endMap(); mIt++) | ||
145 | { | ||
146 | mParamValues[mIt->first] = mIt->second; | ||
147 | } | ||
148 | } | ||
149 | } | ||
150 | |||
151 | inline const LLSD& LLWaterParamSet::getAll() | ||
152 | { | ||
153 | return mParamValues; | ||
154 | } | ||
155 | |||
156 | #endif // LL_WaterPARAM_SET_H | ||