Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
PrimitiveType.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 SiliconStudio.Core;
5 
6 namespace SiliconStudio.Paradox.Graphics
7 {
8  /// <summary>
9  /// Defines how vertex data is ordered.
10  /// </summary>
11  [DataContract]
12  public enum PrimitiveType
13  {
14  /// <summary>
15  /// No documentation.
16  /// </summary>
17  Undefined = unchecked((int)0),
18 
19  /// <summary>
20  /// No documentation.
21  /// </summary>
22  PointList = unchecked((int)1),
23 
24  /// <summary>
25  /// The data is ordered as a sequence of line segments; each line segment is described by two new vertices. The count may be any positive integer.
26  /// </summary>
27  LineList = unchecked((int)2),
28 
29  /// <summary>
30  /// The data is ordered as a sequence of line segments; each line segment is described by one new vertex and the last vertex from the previous line seqment. The count may be any positive integer.
31  /// </summary>
32  LineStrip = unchecked((int)3),
33 
34  /// <summary>
35  /// The data is ordered as a sequence of triangles; each triangle is described by three new vertices. Back-face culling is affected by the current winding-order render state.
36  /// </summary>
37  TriangleList = unchecked((int)4),
38 
39  /// <summary>
40  /// The data is ordered as a sequence of triangles; each triangle is described by two new vertices and one vertex from the previous triangle. The back-face culling flag is flipped automatically on even-numbered
41  /// </summary>
42  TriangleStrip = unchecked((int)5),
43 
44  /// <summary>
45  /// No documentation.
46  /// </summary>
47  LineListWithAdjacency = unchecked((int)10),
48 
49  /// <summary>
50  /// No documentation.
51  /// </summary>
52  LineStripWithAdjacency = unchecked((int)11),
53 
54  /// <summary>
55  /// No documentation.
56  /// </summary>
57  TriangleListWithAdjacency = unchecked((int)12),
58 
59  /// <summary>
60  /// No documentation.
61  /// </summary>
62  TriangleStripWithAdjacency = unchecked((int)13),
63 
64  PatchList = unchecked((int)33),
65  }
66 
67  public static class PrimitiveTypeExtensions
68  {
69  /// <summary>
70  /// Interpret the vertex data as a patch list.
71  /// </summary>
72  /// <param name="controlPoints">Number of control points. Value must be in the range 1 to 32.</param>
73  public static PrimitiveType ControlPointCount(this PrimitiveType primitiveType, int controlPoints)
74  {
75  if (primitiveType != PrimitiveType.PatchList)
76  throw new ArgumentException("Control points apply only to PrimitiveType.PatchList", "primitiveType");
77 
78  if (controlPoints < 1 || controlPoints > 32)
79  throw new ArgumentException("Value must be in between 1 and 32", "controlPoints");
80 
81  return PrimitiveType.PatchList + controlPoints - 1;
82  }
83  }
84 }
The data is ordered as a sequence of line segments; each line segment is described by two new vertice...
The data is ordered as a sequence of triangles; each triangle is described by three new vertices...
The data is ordered as a sequence of line segments; each line segment is described by one new vertex ...
static PrimitiveType ControlPointCount(this PrimitiveType primitiveType, int controlPoints)
Interpret the vertex data as a patch list.
PrimitiveType
Defines how vertex data is ordered.
The data is ordered as a sequence of triangles; each triangle is described by two new vertices and on...