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