OSDN Git Service

#32713 初コミット。SVNrev567時点での、ファイルはbranch/140707(ReBuild XGVersion)から移行したもの。
[dtxmaniaxg-verk/dtxmaniaxg-verk-git.git] / SlimDXc_Jun2010(VC++2008) / source / direct3d9 / BaseEffect.h
1 /*
2 * Copyright (c) 2007-2010 SlimDX Group
3
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:
10
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13
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
20 * THE SOFTWARE.
21 */
22 #pragma once
23
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"
29
30 #include "Device.h"
31 #include "EffectHandle.h"
32
33 #include "EffectDescription9.h"
34 #include "FunctionDescription.h"
35 #include "TechniqueDescription.h"
36 #include "PassDescription.h"
37 #include "ParameterDescription.h"
38
39 namespace SlimDX
40 {
41         ref class DataStream;
42
43         namespace Direct3D9
44         {
45                 /// <summary>
46                 /// Provides methods for getting and setting effect parameters such as constants, functions, shaders, and techniques.
47                 /// </summary>
48                 /// <unmanaged>ID3DXBaseEffect</unmanaged>
49                 public ref class BaseEffect abstract : public ComObject
50                 {
51                         COMOBJECT_BASE(ID3DXBaseEffect);
52
53                 protected:
54                         /// <summary>
55                         /// Initializes a new instance of the <see cref="BaseEffect"/> class.
56                         /// </summary>
57                         BaseEffect() { }
58
59                 public:
60                         /// <summary>
61                         /// Gets the handle of an annotation.
62                         /// </summary>
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 );
67
68                         /// <summary>
69                         /// Gets the handle of an annotation.
70                         /// </summary>
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 );
75
76                         /// <summary>
77                         /// Gets the handle of a parameter.
78                         /// </summary>
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 );
83
84                         /// <summary>
85                         /// Gets the handle of a parameter.
86                         /// </summary>
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 );
91
92                         /// <summary>
93                         /// Gets the handle of a parameter by looking up its semantic.
94                         /// </summary>
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 );
99
100                         /// <summary>
101                         /// Gets the handle of an array element parameter.
102                         /// </summary>
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 );
107
108                         /// <summary>
109                         /// Gets a parameter or annotation description.
110                         /// </summary>
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 );
114
115                         /// <summary>
116                         /// Gets the handle of a function.
117                         /// </summary>
118                         /// <param name="index">Function index.</param>
119                         /// <returns>The handle of the function.</returns>
120                         EffectHandle^ GetFunction( int index );
121
122                         /// <summary>
123                         /// Gets the handle of a function.
124                         /// </summary>
125                         /// <param name="name">Name of the function.</param>
126                         /// <returns>The handle of the function.</returns>
127                         EffectHandle^ GetFunction( System::String^ name );
128
129                         /// <summary>
130                         /// Gets a function description.
131                         /// </summary>
132                         /// <param name="handle">Handle to the function.</param>
133                         /// <returns>The function description.</returns>
134                         FunctionDescription GetFunctionDescription( EffectHandle^ handle );
135
136                         /// <summary>
137                         /// Gets the handle of a technique.
138                         /// </summary>
139                         /// <param name="index">Technique index.</param>
140                         /// <returns>The handle of the technique.</returns>
141                         EffectHandle^ GetTechnique( int index );
142
143                         /// <summary>
144                         /// Gets the handle of a technique.
145                         /// </summary>
146                         /// <param name="name">Name of the technique.</param>
147                         /// <returns>The handle of the technique.</returns>
148                         EffectHandle^ GetTechnique( System::String^ name );
149
150                         /// <summary>
151                         /// Gets a technique description.
152                         /// </summary>
153                         /// <param name="handle">Handle to the technique.</param>
154                         /// <returns>The technique description.</returns>
155                         TechniqueDescription GetTechniqueDescription( EffectHandle^ handle );
156
157                         /// <summary>
158                         /// Gets the handle of a pass.
159                         /// </summary>
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 );
164
165                         /// <summary>
166                         /// Gets the handle of a pass.
167                         /// </summary>
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 );
172
173                         /// <summary>
174                         /// Gets the description of a pass.
175                         /// </summary>
176                         /// <param name="handle">Handle to the pass.</param>
177                         /// <returns>The pass description.</returns>
178                         PassDescription GetPassDescription( EffectHandle^ handle );
179                         
180                         /// <summary>
181                         /// Gets the value of the specified parameter.
182                         /// </summary>
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 );
187
188                         /// <summary>
189                         /// Gets the value of the specified parameter.
190                         /// </summary>
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 );
195
196                         /// <summary>
197                         /// Sets the value of a parameter using the specified data.
198                         /// </summary>
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 );
204
205                         /// <summary>
206                         /// Sets the value of a parameter using the specified data.
207                         /// </summary>
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 );
213
214                         /// <summary>
215                         /// Gets the value of the specified parameter as a texture.
216                         /// </summary>
217                         /// <param name="parameter">Handle of the parameter.</param>
218                         /// <returns>The texture value of the parameter.</returns>
219                         BaseTexture^ GetTexture( EffectHandle^ parameter );
220
221                         /// <summary>
222                         /// Sets the value of a parameter using the specified data.
223                         /// </summary>
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 );
228
229                         /// <summary>
230                         /// Gets the value of the specified parameter as a string.
231                         /// </summary>
232                         /// <param name="parameter">Handle of the parameter.</param>
233                         /// <returns>The string value of the parameter.</returns>
234                         System::String^ GetString( EffectHandle^ parameter );
235
236                         /// <summary>
237                         /// Sets the value of a parameter using the specified data.
238                         /// </summary>
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 );
243
244                         /// <summary>
245                         /// Gets a pixel shader from the effect.
246                         /// </summary>
247                         /// <param name="parameter">The effect parameter identifying the shader.</param>
248                         /// <returns>The requested pixel shader.</returns>
249                         PixelShader^ GetPixelShader( EffectHandle^ parameter );
250
251                         /// <summary>
252                         /// Gets a vertex shader from the effect.
253                         /// </summary>
254                         /// <param name="parameter">The effect parameter identifying the shader.</param>
255                         /// <returns>The requested vertex shader.</returns>
256                         VertexShader^ GetVertexShader( EffectHandle^ parameter );
257
258                         /// <summary>
259                         /// Gets the effect description.
260                         /// </summary>
261                         property EffectDescription Description
262                         {
263                                 EffectDescription get();
264                         }
265                 };
266    }
267 }