2 * Copyright (c) 2007-2010 SlimDX Group
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
5 * of this software and associated documentation files (the "Software"), to deal
6 * in the Software without restriction, including without limitation the rights
7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 * copies of the Software, and to permit persons to whom the Software is
9 * furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 #include "../math/Color4.h"
25 #include "../math/Matrix.h"
26 #include "../math/Vector2.h"
27 #include "../math/Vector3.h"
28 #include "../math/Vector4.h"
31 #include "EffectHandle.h"
33 #include "EffectDescription9.h"
34 #include "FunctionDescription.h"
35 #include "TechniqueDescription.h"
36 #include "PassDescription.h"
37 #include "ParameterDescription.h"
46 /// Provides methods for getting and setting effect parameters such as constants, functions, shaders, and techniques.
48 /// <unmanaged>ID3DXBaseEffect</unmanaged>
49 public ref class BaseEffect abstract : public ComObject
51 COMOBJECT_BASE(ID3DXBaseEffect);
55 /// Initializes a new instance of the <see cref="BaseEffect"/> class.
61 /// Gets the handle of an annotation.
63 /// <param name="handle">Handle of a technique, pass, or top-level parameter.</param>
64 /// <param name="index">Annotation index.</param>
65 /// <returns>The handle of the annotation.</returns>
66 EffectHandle^ GetAnnotation( EffectHandle^ handle, int index );
69 /// Gets the handle of an annotation.
71 /// <param name="handle">Handle of a technique, pass, or top-level parameter.</param>
72 /// <param name="name">Name of the annotation.</param>
73 /// <returns>The handle of the annotation.</returns>
74 EffectHandle^ GetAnnotation( EffectHandle^ handle, System::String^ name );
77 /// Gets the handle of a parameter.
79 /// <param name="parameter">Handle of the parameter, or <c>null</c> for top-level parameters.</param>
80 /// <param name="index">Parameter index.</param>
81 /// <returns>The handle of the parameter.</returns>
82 EffectHandle^ GetParameter( EffectHandle^ parameter, int index );
85 /// Gets the handle of a parameter.
87 /// <param name="parameter">Handle of the parameter, or <c>null</c> for top-level parameters.</param>
88 /// <param name="name">Name of the parameter.</param>
89 /// <returns>The handle of the parameter.</returns>
90 EffectHandle^ GetParameter( EffectHandle^ parameter, System::String^ name );
93 /// Gets the handle of a parameter by looking up its semantic.
95 /// <param name="parameter">Handle of the parameter, or <c>null</c> for top-level parameters.</param>
96 /// <param name="name">The name of the semantic.</param>
97 /// <returns>The handle of the parameter.</returns>
98 EffectHandle^ GetParameterBySemantic( EffectHandle^ parameter, System::String^ name );
101 /// Gets the handle of an array element parameter.
103 /// <param name="parameter">Handle of the array.</param>
104 /// <param name="index">Array parameter index.</param>
105 /// <returns>The handle of the parameter.</returns>
106 EffectHandle^ GetParameterElement( EffectHandle^ parameter, int index );
109 /// Gets a parameter or annotation description.
111 /// <param name="parameter">Handle of the parameter or annotation.</param>
112 /// <returns>The description of the specified parameter or annotation.</returns>
113 ParameterDescription GetParameterDescription( EffectHandle^ parameter );
116 /// Gets the handle of a function.
118 /// <param name="index">Function index.</param>
119 /// <returns>The handle of the function.</returns>
120 EffectHandle^ GetFunction( int index );
123 /// Gets the handle of a function.
125 /// <param name="name">Name of the function.</param>
126 /// <returns>The handle of the function.</returns>
127 EffectHandle^ GetFunction( System::String^ name );
130 /// Gets a function description.
132 /// <param name="handle">Handle to the function.</param>
133 /// <returns>The function description.</returns>
134 FunctionDescription GetFunctionDescription( EffectHandle^ handle );
137 /// Gets the handle of a technique.
139 /// <param name="index">Technique index.</param>
140 /// <returns>The handle of the technique.</returns>
141 EffectHandle^ GetTechnique( int index );
144 /// Gets the handle of a technique.
146 /// <param name="name">Name of the technique.</param>
147 /// <returns>The handle of the technique.</returns>
148 EffectHandle^ GetTechnique( System::String^ name );
151 /// Gets a technique description.
153 /// <param name="handle">Handle to the technique.</param>
154 /// <returns>The technique description.</returns>
155 TechniqueDescription GetTechniqueDescription( EffectHandle^ handle );
158 /// Gets the handle of a pass.
160 /// <param name="technique">Handle of the parent technique.</param>
161 /// <param name="index">Pass index.</param>
162 /// <returns>The handle of the pass.</returns>
163 EffectHandle^ GetPass( EffectHandle^ technique, int index );
166 /// Gets the handle of a pass.
168 /// <param name="technique">Handle of the parent technique.</param>
169 /// <param name="name">Name of the pass.</param>
170 /// <returns>The handle of the pass.</returns>
171 EffectHandle^ GetPass( EffectHandle^ technique, System::String^ name );
174 /// Gets the description of a pass.
176 /// <param name="handle">Handle to the pass.</param>
177 /// <returns>The pass description.</returns>
178 PassDescription GetPassDescription( EffectHandle^ handle );
181 /// Gets the value of the specified parameter.
183 /// <param name="parameter">Handle of the parameter.</param>
184 /// <returns>The value of the parameter.</returns>
185 generic<typename T> where T : value class
186 T GetValue( EffectHandle^ parameter );
189 /// Gets the value of the specified parameter.
191 /// <param name="parameter">Handle of the parameter.</param>
192 /// <returns>The value of the parameter.</returns>
193 generic<typename T> where T : value class
194 array<T>^ GetValue( EffectHandle^ parameter, int count );
197 /// Sets the value of a parameter using the specified data.
199 /// <param name="parameter">The parameter whose value is to be set.</param>
200 /// <param name="value">The new value for the parameter.</param>
201 /// <returns>A <see cref="SlimDX::Result"/> object describing the result of the operation.</returns>
202 generic<typename T> where T : value class
203 Result SetValue( EffectHandle^ parameter, T value );
206 /// Sets the value of a parameter using the specified data.
208 /// <param name="parameter">The array parameter whose value is to be set.</param>
209 /// <param name="values">The array of new values for the array parameter.</param>
210 /// <returns>A <see cref="SlimDX::Result"/> object describing the result of the operation.</returns>
211 generic<typename T> where T : value class
212 Result SetValue( EffectHandle^ parameter, array<T>^ values );
215 /// Gets the value of the specified parameter as a texture.
217 /// <param name="parameter">Handle of the parameter.</param>
218 /// <returns>The texture value of the parameter.</returns>
219 BaseTexture^ GetTexture( EffectHandle^ parameter );
222 /// Sets the value of a parameter using the specified data.
224 /// <param name="parameter">The parameter whose value is to be set.</param>
225 /// <param name="value">The new value for the parameter.</param>
226 /// <returns>A <see cref="SlimDX::Result"/> object describing the result of the operation.</returns>
227 Result SetTexture( EffectHandle^ parameter, BaseTexture^ value );
230 /// Gets the value of the specified parameter as a string.
232 /// <param name="parameter">Handle of the parameter.</param>
233 /// <returns>The string value of the parameter.</returns>
234 System::String^ GetString( EffectHandle^ parameter );
237 /// Sets the value of a parameter using the specified data.
239 /// <param name="parameter">The parameter whose value is to be set.</param>
240 /// <param name="value">The new value for the parameter.</param>
241 /// <returns>A <see cref="SlimDX::Result"/> object describing the result of the operation.</returns>
242 Result SetString( EffectHandle^ parameter, System::String^ value );
245 /// Gets a pixel shader from the effect.
247 /// <param name="parameter">The effect parameter identifying the shader.</param>
248 /// <returns>The requested pixel shader.</returns>
249 PixelShader^ GetPixelShader( EffectHandle^ parameter );
252 /// Gets a vertex shader from the effect.
254 /// <param name="parameter">The effect parameter identifying the shader.</param>
255 /// <returns>The requested vertex shader.</returns>
256 VertexShader^ GetVertexShader( EffectHandle^ parameter );
259 /// Gets the effect description.
261 property EffectDescription Description
263 EffectDescription get();