Annotation of /trunk/indra/newview/llwaterparamset.h
Parent Directory
|
Revision Log
Revision 135 - (view) (download)
| 1 : | mjm | 135 | /** |
| 2 : | * @file llwlparamset.h | ||
| 3 : | * @brief Interface for the LLWaterParamSet class. | ||
| 4 : | * | ||
| 5 : | * $LicenseInfo:firstyear=2005&license=viewergpl$ | ||
| 6 : | * | ||
| 7 : | * Copyright (c) 2005-2009, 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 | ||
| 21 : | * http://secondlifegrid.net/programs/open_source/licensing/flossexception | ||
| 22 : | * | ||
| 23 : | * By copying, modifying or distributing this software, you acknowledge | ||
| 24 : | * that you have read and understood your obligations described above, | ||
| 25 : | * and agree to abide by those obligations. | ||
| 26 : | * | ||
| 27 : | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | ||
| 28 : | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
| 29 : | * COMPLETENESS OR PERFORMANCE. | ||
| 30 : | * $/LicenseInfo$ | ||
| 31 : | */ | ||
| 32 : | |||
| 33 : | #ifndef LL_WATER_PARAM_SET_H | ||
| 34 : | #define LL_WATER_PARAM_SET_H | ||
| 35 : | |||
| 36 : | #include <string> | ||
| 37 : | #include <map> | ||
| 38 : | |||
| 39 : | #include "v4math.h" | ||
| 40 : | #include "v4color.h" | ||
| 41 : | #include "llviewershadermgr.h" | ||
| 42 : | |||
| 43 : | class LLFloaterWater; | ||
| 44 : | class LLWaterParamSet; | ||
| 45 : | |||
| 46 : | /// A class representing a set of parameter values for the Water shaders. | ||
| 47 : | class LLWaterParamSet | ||
| 48 : | { | ||
| 49 : | friend class LLWaterParamManager; | ||
| 50 : | |||
| 51 : | public: | ||
| 52 : | std::string mName; | ||
| 53 : | |||
| 54 : | private: | ||
| 55 : | |||
| 56 : | LLSD mParamValues; | ||
| 57 : | |||
| 58 : | public: | ||
| 59 : | |||
| 60 : | LLWaterParamSet(); | ||
| 61 : | |||
| 62 : | /// Bind this set of parameter values to the uniforms of a particular shader. | ||
| 63 : | void update(LLGLSLShader * shader) const; | ||
| 64 : | |||
| 65 : | /// set the total llsd | ||
| 66 : | void setAll(const LLSD& val); | ||
| 67 : | |||
| 68 : | /// get the total llsd | ||
| 69 : | const LLSD& getAll(); | ||
| 70 : | |||
| 71 : | /// Set a float parameter. | ||
| 72 : | /// \param paramName The name of the parameter to set. | ||
| 73 : | /// \param x The float value to set. | ||
| 74 : | void set(const std::string& paramName, float x); | ||
| 75 : | |||
| 76 : | /// Set a float2 parameter. | ||
| 77 : | /// \param paramName The name of the parameter to set. | ||
| 78 : | /// \param x The x component's value to set. | ||
| 79 : | /// \param y The y component's value to set. | ||
| 80 : | void set(const std::string& paramName, float x, float y); | ||
| 81 : | |||
| 82 : | /// Set a float3 parameter. | ||
| 83 : | /// \param paramName The name of the parameter to set. | ||
| 84 : | /// \param x The x component's value to set. | ||
| 85 : | /// \param y The y component's value to set. | ||
| 86 : | /// \param z The z component's value to set. | ||
| 87 : | void set(const std::string& paramName, float x, float y, float z); | ||
| 88 : | |||
| 89 : | /// Set a float4 parameter. | ||
| 90 : | /// \param paramName The name of the parameter to set. | ||
| 91 : | /// \param x The x component's value to set. | ||
| 92 : | /// \param y The y component's value to set. | ||
| 93 : | /// \param z The z component's value to set. | ||
| 94 : | /// \param w The w component's value to set. | ||
| 95 : | void set(const std::string& paramName, float x, float y, float z, float w); | ||
| 96 : | |||
| 97 : | /// Set a float4 parameter. | ||
| 98 : | /// \param paramName The name of the parameter to set. | ||
| 99 : | /// \param val An array of the 4 float values to set the parameter to. | ||
| 100 : | void set(const std::string& paramName, const float * val); | ||
| 101 : | |||
| 102 : | /// Set a float4 parameter. | ||
| 103 : | /// \param paramName The name of the parameter to set. | ||
| 104 : | /// \param val A struct of the 4 float values to set the parameter to. | ||
| 105 : | void set(const std::string& paramName, const LLVector4 & val); | ||
| 106 : | |||
| 107 : | /// Set a float4 parameter. | ||
| 108 : | /// \param paramName The name of the parameter to set. | ||
| 109 : | /// \param val A struct of the 4 float values to set the parameter to. | ||
| 110 : | void set(const std::string& paramName, const LLColor4 & val); | ||
| 111 : | |||
| 112 : | /// Get a float4 parameter. | ||
| 113 : | /// \param paramName The name of the parameter to set. | ||
| 114 : | /// \param error A flag to set if it's not the proper return type | ||
| 115 : | LLVector4 getVector4(const std::string& paramName, bool& error); | ||
| 116 : | |||
| 117 : | /// Get a float3 parameter. | ||
| 118 : | /// \param paramName The name of the parameter to set. | ||
| 119 : | /// \param error A flag to set if it's not the proper return type | ||
| 120 : | LLVector3 getVector3(const std::string& paramName, bool& error); | ||
| 121 : | |||
| 122 : | /// Get a float2 parameter. | ||
| 123 : | /// \param paramName The name of the parameter to set. | ||
| 124 : | /// \param error A flag to set if it's not the proper return type | ||
| 125 : | LLVector2 getVector2(const std::string& paramName, bool& error); | ||
| 126 : | |||
| 127 : | /// Get an integer parameter | ||
| 128 : | /// \param paramName The name of the parameter to set. | ||
| 129 : | /// \param error A flag to set if it's not the proper return type | ||
| 130 : | F32 getFloat(const std::string& paramName, bool& error); | ||
| 131 : | |||
| 132 : | /// interpolate two parameter sets | ||
| 133 : | /// \param src The parameter set to start with | ||
| 134 : | /// \param dest The parameter set to end with | ||
| 135 : | /// \param weight The amount to interpolate | ||
| 136 : | void mix(LLWaterParamSet& src, LLWaterParamSet& dest, | ||
| 137 : | F32 weight); | ||
| 138 : | |||
| 139 : | }; | ||
| 140 : | |||
| 141 : | inline void LLWaterParamSet::setAll(const LLSD& val) | ||
| 142 : | { | ||
| 143 : | if(val.isMap()) { | ||
| 144 : | LLSD::map_const_iterator mIt = val.beginMap(); | ||
| 145 : | for(; mIt != val.endMap(); mIt++) | ||
| 146 : | { | ||
| 147 : | mParamValues[mIt->first] = mIt->second; | ||
| 148 : | } | ||
| 149 : | } | ||
| 150 : | } | ||
| 151 : | |||
| 152 : | inline const LLSD& LLWaterParamSet::getAll() | ||
| 153 : | { | ||
| 154 : | return mParamValues; | ||
| 155 : | } | ||
| 156 : | |||
| 157 : | #endif // LL_WaterPARAM_SET_H |
| ViewVC Help | |
| Powered by ViewVC 1.0.0 |

