Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
MaterialStack.cs
Go to the documentation of this file.
1 // Copyright (c) 2014 Silicon Studio Corp. (http://siliconstudio.co.jp)
2 // This file is distributed under GPL v3. See LICENSE.md for details.
3 using System;
4 using System.Collections;
5 using System.Collections.Generic;
6 using System.Linq;
7 using System.Text;
8 using System.Threading.Tasks;
9 using SiliconStudio.Core.Mathematics;
10 
11 namespace SiliconStudio.Paradox
12 {
13  namespace AssimpNet
14  {
15  namespace Material
16  {
17  /// <summary>
18  /// Enumeration of the different types of node in the new Assimp's material stack.
19  /// </summary>
20  public enum StackType
21  {
22  Color = 0,
23  Texture,
24  Operation
25  }
26  /// <summary>
27  /// Enumeration of the new Assimp's flags.
28  /// </summary>
29  public enum Flags
30  {
31  Invert = 1,
32  ReplaceAlpha = 2
33  }
34  /// <summary>
35  /// Enumeration of the different operations in the new Assimp's material stack.
36  /// </summary>
37  public enum Operation
38  {
39  Add = 0,
40  Add3ds,
41  AddMaya,
42  Average,
43  Color,
44  ColorBurn,
45  ColorDodge,
46  Darken3ds,
47  DarkenMaya,
48  Desaturate,
51  Divide,
52  Exclusion,
53  HardLight,
54  HardMix,
55  Hue,
56  Illuminate,
57  In,
58  Lighten3ds,
60  LinearBurn,
61  LinearDodge,
64  None,
65  Out,
66  Over3ds,
67  Overlay3ds,
68  OverMaya,
69  PinLight,
70  Saturate,
71  Saturation,
72  Screen,
73  SoftLight,
76  Value,
77  Mask
78  }
79  /// <summary>
80  /// Enumeration of the different mapping modes in the new Assimp's material stack.
81  /// </summary>
82  public enum MappingMode
83  {
84  Wrap,
85  Clamp,
86  Decal,
87  Mirror
88  }
89  /// <summary>
90  /// Class representing an element in the new Assimp's material stack.
91  /// </summary>
92  public abstract class StackElement
93  {
94  /// <summary>
95  /// Initializes a new instance of the <see cref="StackElement"/> class.
96  /// </summary>
97  /// <param name="Alpha">The alpha of the node.</param>
98  /// <param name="Blend">The blending coefficient of the node.</param>
99  /// <param name="flags">The flags of the node.</param>
100  /// <param name="Type">The type of the node.</param>
101  public StackElement(float Alpha, float Blend, int flags, StackType Type)
102  {
103  alpha = Alpha;
104  blend = Blend;
105  type = Type;
106  }
107  /// <summary>
108  /// Gets the alpha of the node.
109  /// </summary>
110  /// <value>
111  /// The alpha of the node.
112  /// </value>
113  public float alpha { get; private set; }
114  /// <summary>
115  /// Gets the blending coefficient of the node.
116  /// </summary>
117  /// <value>
118  /// The blending coefficient of the node.
119  /// </value>
120  public float blend { get; private set; }
121  /// <summary>
122  /// Gets the flags of the node.
123  /// </summary>
124  /// <value>
125  /// The flags of the node.
126  /// </value>
127  public int flags { get; private set; }
128  /// <summary>
129  /// Gets the type of the node.
130  /// </summary>
131  /// <value>
132  /// The type of the node.
133  /// </value>
134  public StackType type { get; private set; }
135  }
136  /// <summary>
137  /// Class representing an operation in the new Assimp's material stack.
138  /// </summary>
140  {
141  /// <summary>
142  /// Initializes a new instance of the <see cref="StackOperation"/> class.
143  /// </summary>
144  /// <param name="Operation">The operation of the node.</param>
145  /// <param name="Alpha">The alpha of the node.</param>
146  /// <param name="Blend">The blending coefficient of the node.</param>
147  /// <param name="Flags">The flags.</param>
148  public StackOperation(Operation Operation, float Alpha = 1.0f, float Blend = 1.0f, int Flags = 0)
149  : base(Alpha, Blend, Flags, StackType.Operation)
150  {
151  operation = Operation;
152  }
153  /// <summary>
154  /// Gets the operation of the node.
155  /// </summary>
156  /// <value>
157  /// The operation of the node.
158  /// </value>
159  public Operation operation { get; private set; }
160  }
161  /// <summary>
162  /// Class representing a color in the new Assimp's material stack.
163  /// </summary>
164  public class StackColor : StackElement
165  {
166  /// <summary>
167  /// Initializes a new instance of the <see cref="StackColor"/> class.
168  /// </summary>
169  /// <param name="Color">The color of the node.</param>
170  /// <param name="Alpha">The alpha of the node.</param>
171  /// <param name="Blend">The blending coefficient of the node.</param>
172  /// <param name="Flags">The flags of the node.</param>
173  public StackColor(Color3 Color, float Alpha = 1.0f, float Blend = 1.0f, int Flags = 0)
174  : base(Alpha, Blend, Flags, StackType.Color)
175  {
176  color = Color;
177  }
178  /// <summary>
179  /// Gets the color of the node.
180  /// </summary>
181  /// <value>
182  /// The color of the node.
183  /// </value>
184  public Color3 color { get; private set; }
185  }
186  /// <summary>
187  /// Class representing a texture in the new Assimp's material stack.
188  /// </summary>
189  public class StackTexture : StackElement
190  {
191  /// <summary>
192  /// Initializes a new instance of the <see cref="StackTexture"/> class.
193  /// </summary>
194  /// <param name="TexturePath">The texture path.</param>
195  /// <param name="Channel">The uv channel used by the texture.</param>
196  /// <param name="MappingModeU">The U mapping mode.</param>
197  /// <param name="MappingModeV">The V mapping mode.</param>
198  /// <param name="Alpha">The alpha of the node.</param>
199  /// <param name="Blend">The blending coefficient of the node.</param>
200  /// <param name="Flags">The flags of the node.</param>
201  public StackTexture(String TexturePath, int Channel, MappingMode MappingModeU, MappingMode MappingModeV, float Alpha = 1.0f, float Blend = 1.0F, int Flags = 0)
202  : base(Alpha, Blend, Flags, StackType.Texture)
203  {
204  texturePath = TexturePath;
205  channel = Channel;
206  mappingModeU = MappingModeU;
207  mappingModeV = MappingModeV;
208  }
209  /// <summary>
210  /// Gets the texture path.
211  /// </summary>
212  /// <value>
213  /// The texture path.
214  /// </value>
215  public String texturePath { get; private set; }
216  /// <summary>
217  /// Gets the uv channel.
218  /// </summary>
219  /// <value>
220  /// The uv channel.
221  /// </value>
222  public int channel { get; private set; }
223  /// <summary>
224  /// Gets the U mapping mode.
225  /// </summary>
226  /// <value>
227  /// The U mapping mode.
228  /// </value>
229  public MappingMode mappingModeU { get; private set; }
230  /// <summary>
231  /// Gets the Vmapping mode.
232  /// </summary>
233  /// <value>
234  /// The V mapping mode.
235  /// </value>
236  public MappingMode mappingModeV { get; private set; }
237  }
238  /// <summary>
239  /// Class representing the new Assimp's material stack in c#.
240  /// </summary>
241  public class Stack
242  {
243  /// <summary>
244  /// Initializes a new instance of the <see cref="Stack"/> class.
245  /// </summary>
246  public Stack()
247  {
248  stack = new Stack<StackElement>();
249  }
250  /// <summary>
251  /// The internal stack.
252  /// </summary>
253  private Stack<StackElement> stack;
254  /// <summary>
255  /// Gets the size of the stack.
256  /// </summary>
257  /// <value>
258  /// The size of the stack.
259  /// </value>
260  private int Count { get { return stack.Count; } }
261  /// <summary>
262  /// Gets a value indicating whether the stack is empty.
263  /// </summary>
264  /// <value>
265  /// <c>true</c> if the stack is empty; otherwise, <c>false</c>.
266  /// </value>
267  public bool IsEmpty { get { return stack.Count == 0; } }
268  /// <summary>
269  /// Pushes the specified element.
270  /// </summary>
271  /// <param name="element">The element.</param>
272  public void Push(StackElement element)
273  {
274  stack.Push(element);
275  }
276  /// <summary>
277  /// Pops an element.
278  /// </summary>
279  /// <returns>The element.</returns>
280  public StackElement Pop()
281  {
282  return stack.Pop();
283  }
284  /// <summary>
285  /// Gets the top element of the stack.
286  /// </summary>
287  /// <returns>The top element of the stack.</returns>
289  {
290  return stack.Peek();
291  }
292  /// <summary>
293  /// Clears the stack.
294  /// </summary>
295  public void Clear()
296  {
297  stack.Clear();
298  }
299  }
300  }
301  }
302 }
Class representing a texture in the new Assimp's material stack.
_In_ size_t _In_ DXGI_FORMAT _In_ size_t _In_ DXGI_FORMAT _In_ DWORD flags
Definition: DirectXTexP.h:170
Represents a color in the form of rgb.
Definition: Color3.cs:41
StackOperation(Operation Operation, float Alpha=1.0f, float Blend=1.0f, int Flags=0)
Initializes a new instance of the StackOperation class.
StackElement Pop()
Pops an element.
StackElement Peek()
Gets the top element of the stack.
Class representing the new Assimp's material stack in c#.
Class representing a color in the new Assimp's material stack.
StackColor(Color3 Color, float Alpha=1.0f, float Blend=1.0f, int Flags=0)
Initializes a new instance of the StackColor class.
StackTexture(String TexturePath, int Channel, MappingMode MappingModeU, MappingMode MappingModeV, float Alpha=1.0f, float Blend=1.0F, int Flags=0)
Initializes a new instance of the StackTexture class.
Flags
Enumeration of the new Assimp's flags.
StackElement(float Alpha, float Blend, int flags, StackType Type)
Initializes a new instance of the StackElement class.
Class representing an operation in the new Assimp's material stack.
MappingMode
Enumeration of the different mapping modes in the new Assimp's material stack.
SiliconStudio.Core.Mathematics.Color Color
Definition: ColorPicker.cs:14
void Push(StackElement element)
Pushes the specified element.
Operation
Enumeration of the different operations in the new Assimp's material stack.
Represents a 32-bit color (4 bytes) in the form of RGBA (in byte order: R, G, B, A).
Definition: Color.cs:16
Class representing an element in the new Assimp's material stack.
StackType
Enumeration of the different types of node in the new Assimp's material stack.
Blend
Blend option. A blend option identifies the data source and an optional pre-blend operation...
Definition: Blend.cs:14
Stack()
Initializes a new instance of the Stack class.