Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
GeometricPrimitive.Teapot.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 //
4 // Copyright (c) 2010-2013 SharpDX - Alexandre Mutel
5 //
6 // Permission is hereby granted, free of charge, to any person obtaining a copy
7 // of this software and associated documentation files (the "Software"), to deal
8 // in the Software without restriction, including without limitation the rights
9 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 // copies of the Software, and to permit persons to whom the Software is
11 // furnished to do so, subject to the following conditions:
12 //
13 // The above copyright notice and this permission notice shall be included in
14 // all copies or substantial portions of the Software.
15 //
16 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 // THE SOFTWARE.
23 // -----------------------------------------------------------------------------
24 // The following code is a port of DirectXTk http://directxtk.codeplex.com
25 // -----------------------------------------------------------------------------
26 // Microsoft Public License (Ms-PL)
27 //
28 // This license governs use of the accompanying software. If you use the
29 // software, you accept this license. If you do not accept the license, do not
30 // use the software.
31 //
32 // 1. Definitions
33 // The terms "reproduce," "reproduction," "derivative works," and
34 // "distribution" have the same meaning here as under U.S. copyright law.
35 // A "contribution" is the original software, or any additions or changes to
36 // the software.
37 // A "contributor" is any person that distributes its contribution under this
38 // license.
39 // "Licensed patents" are a contributor's patent claims that read directly on
40 // its contribution.
41 //
42 // 2. Grant of Rights
43 // (A) Copyright Grant- Subject to the terms of this license, including the
44 // license conditions and limitations in section 3, each contributor grants
45 // you a non-exclusive, worldwide, royalty-free copyright license to reproduce
46 // its contribution, prepare derivative works of its contribution, and
47 // distribute its contribution or any derivative works that you create.
48 // (B) Patent Grant- Subject to the terms of this license, including the license
49 // conditions and limitations in section 3, each contributor grants you a
50 // non-exclusive, worldwide, royalty-free license under its licensed patents to
51 // make, have made, use, sell, offer for sale, import, and/or otherwise dispose
52 // of its contribution in the software or derivative works of the contribution
53 // in the software.
54 //
55 // 3. Conditions and Limitations
56 // (A) No Trademark License- This license does not grant you rights to use any
57 // contributors' name, logo, or trademarks.
58 // (B) If you bring a patent claim against any contributor over patents that
59 // you claim are infringed by the software, your patent license from such
60 // contributor to the software ends automatically.
61 // (C) If you distribute any portion of the software, you must retain all
62 // copyright, patent, trademark, and attribution notices that are present in the
63 // software.
64 // (D) If you distribute any portion of the software in source code form, you
65 // may do so only under this license by including a complete copy of this
66 // license with your distribution. If you distribute any portion of the software
67 // in compiled or object code form, you may only do so under a license that
68 // complies with this license.
69 // (E) The software is licensed "as-is." You bear the risk of using it. The
70 // contributors give no express warranties, guarantees or conditions. You may
71 // have additional consumer rights under your local laws which this license
72 // cannot change. To the extent permitted under your local laws, the
73 // contributors exclude the implied warranties of merchantability, fitness for a
74 // particular purpose and non-infringement.
75 
76 using System;
77 using System.Collections.Generic;
78 using SiliconStudio.Core.Mathematics;
79 
80 namespace SiliconStudio.Paradox.Graphics
81 {
82  public partial class GeometricPrimitive
83  {
84  /// <summary>
85  /// A Teapot primitive.
86  /// </summary>
87  public struct Teapot
88  {
89  // The teapot model consists of 10 bezier patches. Each patch has 16 control
90  // points, plus a flag indicating whether it should be mirrored in the Z axis
91  // as well as in X (all of the teapot is symmetrical from left to right, but
92  // only some parts are symmetrical from front to back). The control points
93  // are stored as integer indices into the TeapotControlPoints array.
94  private struct TeapotPatch
95  {
96  public TeapotPatch(bool mirrorZ, params int[] indices)
97  {
98  this.mirrorZ = mirrorZ;
99  this.indices = indices;
100  }
101 
102  public bool mirrorZ;
103  public int[] indices;
104  }
105 
106  // Static data array defines the bezier patches that make up the teapot.
107  private static readonly TeapotPatch[] TeapotPatches = new TeapotPatch[]
108  {
109  // Rim.
110  new TeapotPatch(true, new[] {102, 103, 104, 105, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}),
111 
112  // Body.
113  new TeapotPatch(true, new[] {12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27}),
114  new TeapotPatch(true, new[] {24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40}),
115 
116  // Lid.
117  new TeapotPatch(true, new[] {96, 96, 96, 96, 97, 98, 99, 100, 101, 101, 101, 101, 0, 1, 2, 3}),
118  new TeapotPatch(true, new[] {0, 1, 2, 3, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117}),
119 
120  // Handle.
121  new TeapotPatch(false, new[] {41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56}),
122  new TeapotPatch(false, new[] {53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 28, 65, 66, 67}),
123 
124  // Spout.
125  new TeapotPatch(false, new[] {68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83}),
126  new TeapotPatch(false, new[] {80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95}),
127 
128  // Bottom.
129  new TeapotPatch(true, new[] {118, 118, 118, 118, 124, 122, 119, 121, 123, 126, 125, 120, 40, 39, 38, 37}),
130  };
131 
132 
133  // Static array defines the control point positions that make up the teapot.
134  private static readonly Vector3[] TeapotControlPoints = new Vector3[]
135  {
136  new Vector3(0, 0.345f, -0.05f),
137  new Vector3(-0.028f, 0.345f, -0.05f),
138  new Vector3(-0.05f, 0.345f, -0.028f),
139  new Vector3(-0.05f, 0.345f, -0),
140  new Vector3(0, 0.3028125f, -0.334375f),
141  new Vector3(-0.18725f, 0.3028125f, -0.334375f),
142  new Vector3(-0.334375f, 0.3028125f, -0.18725f),
143  new Vector3(-0.334375f, 0.3028125f, -0),
144  new Vector3(0, 0.3028125f, -0.359375f),
145  new Vector3(-0.20125f, 0.3028125f, -0.359375f),
146  new Vector3(-0.359375f, 0.3028125f, -0.20125f),
147  new Vector3(-0.359375f, 0.3028125f, -0),
148  new Vector3(0, 0.27f, -0.375f),
149  new Vector3(-0.21f, 0.27f, -0.375f),
150  new Vector3(-0.375f, 0.27f, -0.21f),
151  new Vector3(-0.375f, 0.27f, -0),
152  new Vector3(0, 0.13875f, -0.4375f),
153  new Vector3(-0.245f, 0.13875f, -0.4375f),
154  new Vector3(-0.4375f, 0.13875f, -0.245f),
155  new Vector3(-0.4375f, 0.13875f, -0),
156  new Vector3(0, 0.007499993f, -0.5f),
157  new Vector3(-0.28f, 0.007499993f, -0.5f),
158  new Vector3(-0.5f, 0.007499993f, -0.28f),
159  new Vector3(-0.5f, 0.007499993f, -0),
160  new Vector3(0, -0.105f, -0.5f),
161  new Vector3(-0.28f, -0.105f, -0.5f),
162  new Vector3(-0.5f, -0.105f, -0.28f),
163  new Vector3(-0.5f, -0.105f, -0),
164  new Vector3(0, -0.105f, 0.5f),
165  new Vector3(0, -0.2175f, -0.5f),
166  new Vector3(-0.28f, -0.2175f, -0.5f),
167  new Vector3(-0.5f, -0.2175f, -0.28f),
168  new Vector3(-0.5f, -0.2175f, -0),
169  new Vector3(0, -0.27375f, -0.375f),
170  new Vector3(-0.21f, -0.27375f, -0.375f),
171  new Vector3(-0.375f, -0.27375f, -0.21f),
172  new Vector3(-0.375f, -0.27375f, -0),
173  new Vector3(0, -0.2925f, -0.375f),
174  new Vector3(-0.21f, -0.2925f, -0.375f),
175  new Vector3(-0.375f, -0.2925f, -0.21f),
176  new Vector3(-0.375f, -0.2925f, -0),
177  new Vector3(0, 0.17625f, 0.4f),
178  new Vector3(-0.075f, 0.17625f, 0.4f),
179  new Vector3(-0.075f, 0.2325f, 0.375f),
180  new Vector3(0, 0.2325f, 0.375f),
181  new Vector3(0, 0.17625f, 0.575f),
182  new Vector3(-0.075f, 0.17625f, 0.575f),
183  new Vector3(-0.075f, 0.2325f, 0.625f),
184  new Vector3(0, 0.2325f, 0.625f),
185  new Vector3(0, 0.17625f, 0.675f),
186  new Vector3(-0.075f, 0.17625f, 0.675f),
187  new Vector3(-0.075f, 0.2325f, 0.75f),
188  new Vector3(0, 0.2325f, 0.75f),
189  new Vector3(0, 0.12f, 0.675f),
190  new Vector3(-0.075f, 0.12f, 0.675f),
191  new Vector3(-0.075f, 0.12f, 0.75f),
192  new Vector3(0, 0.12f, 0.75f),
193  new Vector3(0, 0.06375f, 0.675f),
194  new Vector3(-0.075f, 0.06375f, 0.675f),
195  new Vector3(-0.075f, 0.007499993f, 0.75f),
196  new Vector3(0, 0.007499993f, 0.75f),
197  new Vector3(0, -0.04875001f, 0.625f),
198  new Vector3(-0.075f, -0.04875001f, 0.625f),
199  new Vector3(-0.075f, -0.09562501f, 0.6625f),
200  new Vector3(0, -0.09562501f, 0.6625f),
201  new Vector3(-0.075f, -0.105f, 0.5f),
202  new Vector3(-0.075f, -0.18f, 0.475f),
203  new Vector3(0, -0.18f, 0.475f),
204  new Vector3(0, 0.02624997f, -0.425f),
205  new Vector3(-0.165f, 0.02624997f, -0.425f),
206  new Vector3(-0.165f, -0.18f, -0.425f),
207  new Vector3(0, -0.18f, -0.425f),
208  new Vector3(0, 0.02624997f, -0.65f),
209  new Vector3(-0.165f, 0.02624997f, -0.65f),
210  new Vector3(-0.165f, -0.12375f, -0.775f),
211  new Vector3(0, -0.12375f, -0.775f),
212  new Vector3(0, 0.195f, -0.575f),
213  new Vector3(-0.0625f, 0.195f, -0.575f),
214  new Vector3(-0.0625f, 0.17625f, -0.6f),
215  new Vector3(0, 0.17625f, -0.6f),
216  new Vector3(0, 0.27f, -0.675f),
217  new Vector3(-0.0625f, 0.27f, -0.675f),
218  new Vector3(-0.0625f, 0.27f, -0.825f),
219  new Vector3(0, 0.27f, -0.825f),
220  new Vector3(0, 0.28875f, -0.7f),
221  new Vector3(-0.0625f, 0.28875f, -0.7f),
222  new Vector3(-0.0625f, 0.2934375f, -0.88125f),
223  new Vector3(0, 0.2934375f, -0.88125f),
224  new Vector3(0, 0.28875f, -0.725f),
225  new Vector3(-0.0375f, 0.28875f, -0.725f),
226  new Vector3(-0.0375f, 0.298125f, -0.8625f),
227  new Vector3(0, 0.298125f, -0.8625f),
228  new Vector3(0, 0.27f, -0.7f),
229  new Vector3(-0.0375f, 0.27f, -0.7f),
230  new Vector3(-0.0375f, 0.27f, -0.8f),
231  new Vector3(0, 0.27f, -0.8f),
232  new Vector3(0, 0.4575f, -0),
233  new Vector3(0, 0.4575f, -0.2f),
234  new Vector3(-0.1125f, 0.4575f, -0.2f),
235  new Vector3(-0.2f, 0.4575f, -0.1125f),
236  new Vector3(-0.2f, 0.4575f, -0),
237  new Vector3(0, 0.3825f, -0),
238  new Vector3(0, 0.27f, -0.35f),
239  new Vector3(-0.196f, 0.27f, -0.35f),
240  new Vector3(-0.35f, 0.27f, -0.196f),
241  new Vector3(-0.35f, 0.27f, -0),
242  new Vector3(0, 0.3075f, -0.1f),
243  new Vector3(-0.056f, 0.3075f, -0.1f),
244  new Vector3(-0.1f, 0.3075f, -0.056f),
245  new Vector3(-0.1f, 0.3075f, -0),
246  new Vector3(0, 0.3075f, -0.325f),
247  new Vector3(-0.182f, 0.3075f, -0.325f),
248  new Vector3(-0.325f, 0.3075f, -0.182f),
249  new Vector3(-0.325f, 0.3075f, -0),
250  new Vector3(0, 0.27f, -0.325f),
251  new Vector3(-0.182f, 0.27f, -0.325f),
252  new Vector3(-0.325f, 0.27f, -0.182f),
253  new Vector3(-0.325f, 0.27f, -0),
254  new Vector3(0, -0.33f, -0),
255  new Vector3(-0.1995f, -0.33f, -0.35625f),
256  new Vector3(0, -0.31125f, -0.375f),
257  new Vector3(0, -0.33f, -0.35625f),
258  new Vector3(-0.35625f, -0.33f, -0.1995f),
259  new Vector3(-0.375f, -0.31125f, -0),
260  new Vector3(-0.35625f, -0.33f, -0),
261  new Vector3(-0.21f, -0.31125f, -0.375f),
262  new Vector3(-0.375f, -0.31125f, -0.21f),
263  };
264 
265 
266  /// <summary>
267  /// Creates a teapot primitive.
268  /// </summary>
269  /// <param name="device">The device.</param>
270  /// <param name="size">The size.</param>
271  /// <param name="tessellation">The tessellation.</param>
272  /// <param name="toLeftHanded">if set to <c>true</c> vertices and indices will be transformed to left handed. Default is false.</param>
273  /// <returns>GeometricPrimitive.</returns>
274  /// <exception cref="System.ArgumentOutOfRangeException">tessellation;tessellation must be > 0</exception>
275  public static GeometricPrimitive New(GraphicsDevice device, float size = 1.0f, int tessellation = 8, bool toLeftHanded = false)
276  {
277  // Create the primitive object.
278  return new GeometricPrimitive(device, New(size, tessellation, toLeftHanded));
279  }
280 
281  /// <summary>
282  /// Creates a teapot primitive.
283  /// </summary>
284  /// <param name="size">The size.</param>
285  /// <param name="tessellation">The tessellation.</param>
286  /// <param name="toLeftHanded">if set to <c>true</c> vertices and indices will be transformed to left handed. Default is false.</param>
287  /// <returns>GeometricPrimitive.</returns>
288  /// <exception cref="System.ArgumentOutOfRangeException">tessellation;tessellation must be > 0</exception>
289  public static GeometricMeshData<VertexPositionNormalTexture> New(float size = 1.0f, int tessellation = 8, bool toLeftHanded = false)
290  {
291  var vertices = new List<VertexPositionNormalTexture>();
292  var indices = new List<int>();
293 
294  if (tessellation < 1)
295  throw new ArgumentOutOfRangeException("tessellation", "tessellation must be > 0");
296 
297  var scaleVector = new Vector3(size, size, size);
298  var scaleNegateX = scaleVector;
299  scaleNegateX.X = -scaleNegateX.X;
300  var scaleNegateZ = scaleVector;
301  scaleNegateZ.Z = -scaleNegateZ.Z;
302  var scaleNegateXZ = new Vector3(-size, size, -size);
303 
304  for (int i = 0; i < TeapotPatches.Length; i++)
305  {
306  var patch = TeapotPatches[i];
307 
308  // Because the teapot is symmetrical from left to right, we only store
309  // data for one side, then tessellate each patch twice, mirroring in X.
310  TessellatePatch(vertices, indices, ref patch, tessellation, scaleVector, false);
311  TessellatePatch(vertices, indices, ref patch, tessellation, scaleNegateX, true);
312 
313  if (patch.mirrorZ)
314  {
315  // Some parts of the teapot (the body, lid, and rim, but not the
316  // handle or spout) are also symmetrical from front to back, so
317  // we tessellate them four times, mirroring in Z as well as X.
318  TessellatePatch(vertices, indices, ref patch, tessellation, scaleNegateZ, true);
319  TessellatePatch(vertices, indices, ref patch, tessellation, scaleNegateXZ, false);
320  }
321  }
322 
323  return new GeometricMeshData<VertexPositionNormalTexture>(vertices.ToArray(), indices.ToArray(), toLeftHanded) { Name = "Teapot" };
324  }
325 
326  // Performs a cubic bezier interpolation between four control points,
327  // returning the value at the specified time (t ranges 0 to 1).
328  // This template implementation can be used to interpolate Vector3,
329  // float, or any other types that define suitable * and + operators.
330  public static Vector3 CubicInterpolate(ref Vector3 p1, ref Vector3 p2, ref Vector3 p3, ref Vector3 p4, float t)
331  {
332  var t2 = t*t;
333  var onet2 = (1 - t) * (1 - t);
334  return p1*(1 - t)*onet2 +
335  p2*3*t*onet2 +
336  p3*3*t2*(1 - t) +
337  p4*t*t2;
338  }
339 
340 
341  // Computes the tangent of a cubic bezier curve at the specified time.
342  // Template supports Vector3, float, or any other types with * and + operators.
343  private static Vector3 CubicTangent(ref Vector3 p1, ref Vector3 p2, ref Vector3 p3, ref Vector3 p4, float t)
344  {
345  var t2 = t*t;
346  return p1*(-1 + 2*t - t2) +
347  p2*(1 - 4*t + 3*t2) +
348  p3*(2*t - 3*t2) +
349  p4*(t2);
350  }
351 
352  // Creates vertices for a patch that is tessellated at the specified level.
353  // Calls the specified outputVertex function for each generated vertex,
354  // passing the position, normal, and texture coordinate as parameters.
355  private static void CreatePatchVertices(Vector3[] patch, int tessellation, bool isMirrored, List<VertexPositionNormalTexture> outputList)
356  {
357  for (int i = 0; i <= tessellation; i++)
358  {
359  float u = (float) i/tessellation;
360 
361  for (int j = 0; j <= tessellation; j++)
362  {
363  float v = (float) j/tessellation;
364 
365  // Perform four horizontal bezier interpolations
366  // between the control points of this patch.
367  var p1 = CubicInterpolate(ref patch[0], ref patch[1], ref patch[2], ref patch[3], u);
368  var p2 = CubicInterpolate(ref patch[4], ref patch[5], ref patch[6], ref patch[7], u);
369  var p3 = CubicInterpolate(ref patch[8], ref patch[9], ref patch[10], ref patch[11], u);
370  var p4 = CubicInterpolate(ref patch[12], ref patch[13], ref patch[14], ref patch[15], u);
371 
372  // Perform a vertical interpolation between the results of the
373  // previous horizontal interpolations, to compute the position.
374  var position = CubicInterpolate(ref p1, ref p2, ref p3, ref p4, v);
375 
376  // Perform another four bezier interpolations between the control
377  // points, but this time vertically rather than horizontally.
378  var q1 = CubicInterpolate(ref patch[0], ref patch[4], ref patch[8], ref patch[12], v);
379  var q2 = CubicInterpolate(ref patch[1], ref patch[5], ref patch[9], ref patch[13], v);
380  var q3 = CubicInterpolate(ref patch[2], ref patch[6], ref patch[10], ref patch[14], v);
381  var q4 = CubicInterpolate(ref patch[3], ref patch[7], ref patch[11], ref patch[15], v);
382 
383  // Compute vertical and horizontal tangent vectors.
384  var tangent1 = CubicTangent(ref p1, ref p2, ref p3, ref p4, v);
385  var tangent2 = CubicTangent(ref q1, ref q2, ref q3, ref q4, u);
386 
387  // Cross the two tangent vectors to compute the normal.
388  var normal = Vector3.Cross(tangent1, tangent2);
389 
390  if (!Vector3.NearEqual(normal, Vector3.Zero, new Vector3(1e-7f)))
391  {
392  normal.Normalize();
393 
394  // If this patch is mirrored, we must invert the normal.
395  if (isMirrored)
396  {
397  normal = -normal;
398  }
399  }
400  else
401  {
402  // In a tidy and well constructed bezier patch, the preceding
403  // normal computation will always work. But the classic teapot
404  // model is not tidy or well constructed! At the top and bottom
405  // of the teapot, it contains degenerate geometry where a patch
406  // has several control points in the same place, which causes
407  // the tangent computation to fail and produce a zero normal.
408  // We 'fix' these cases by just hard-coding a normal that points
409  // either straight up or straight down, depending on whether we
410  // are on the top or bottom of the teapot. This is not a robust
411  // solution for all possible degenerate bezier patches, but hey,
412  // it's good enough to make the teapot work correctly!
413  normal.X = 0.0f;
414  normal.Y = position.Y < 0.0f ? -1.0f : 1.0f;
415  normal.Z = 0.0f;
416  }
417 
418  // Compute the texture coordinate.
419  float mirroredU = isMirrored ? 1 - u : u;
420 
421  var textureCoordinate = new Vector2(mirroredU, v);
422 
423  // Output this vertex.
424  outputList.Add(new VertexPositionNormalTexture(position, normal, textureCoordinate));
425  }
426  }
427  }
428 
429  // Creates indices for a patch that is tessellated at the specified level.
430  // Calls the specified outputIndex function for each generated index value.
431  private static IEnumerable<int> CreatePatchIndices(int tessellation, bool isMirrored, int baseIndex)
432  {
433  int stride = tessellation + 1;
434  // Make a list of six index values (two triangles).
435  var indices = new int[6];
436 
437  for (int i = 0; i < tessellation; i++)
438  {
439  for (int j = 0; j < tessellation; j++)
440  {
441  indices[0] = baseIndex + i*stride + j;
442  indices[1] = baseIndex + (i + 1)*stride + j;
443  indices[2] = baseIndex + (i + 1)*stride + j + 1;
444  indices[3] = baseIndex + i*stride + j;
445  indices[4] = baseIndex + (i + 1)*stride + j + 1;
446  indices[5] = baseIndex + i*stride + j + 1;
447 
448  // If this patch is mirrored, reverse indices to fix the winding order.
449  if (isMirrored)
450  {
451  Array.Reverse(indices);
452  }
453 
454  foreach (var index in indices)
455  {
456  yield return index;
457  }
458  }
459  }
460  }
461 
462  // Tessellates the specified bezier patch.
463  private static void TessellatePatch(List<VertexPositionNormalTexture> vertices, List<int> indices, ref TeapotPatch patch, int tessellation, Vector3 scale,
464  bool isMirrored)
465  {
466  // Look up the 16 control points for this patch.
467  var controlPoints = new Vector3[16];
468 
469  for (int i = 0; i < 16; i++)
470  {
471  controlPoints[i] = TeapotControlPoints[patch.indices[i]] * scale;
472  }
473 
474  // Create the index data.
475  int vbase = vertices.Count;
476  indices.AddRange(CreatePatchIndices(tessellation, isMirrored, vbase));
477  CreatePatchVertices(controlPoints, tessellation, isMirrored, vertices);
478  }
479  }
480  }
481 }
static GeometricMeshData< VertexPositionNormalTexture > New(float size=1.0f, int tessellation=8, bool toLeftHanded=false)
Creates a teapot primitive.
SiliconStudio.Paradox.Games.Mathematics.Vector2 Vector2
A geometric primitive. Use Cube, Cylinder, GeoSphere, Plane, Sphere, Teapot, Torus. See Draw+vertices to learn how to use it.
Represents a three dimensional mathematical vector.
Definition: Vector3.cs:42
Performs primitive-based rendering, creates resources, handles system-level variables, adjusts gamma ramp levels, and creates shaders. See The+GraphicsDevice+class to learn more about the class.
static readonly Vector3 Zero
A SiliconStudio.Core.Mathematics.Vector3 with all of its components set to zero.
Definition: Vector3.cs:52
static bool NearEqual(Vector3 left, Vector3 right, Vector3 epsilon)
Tests whether one 3D vector is near another 3D vector.
Definition: Vector3.cs:1457
SiliconStudio.Core.Mathematics.Vector3 Vector3
static Vector3 CubicInterpolate(ref Vector3 p1, ref Vector3 p2, ref Vector3 p3, ref Vector3 p4, float t)
_In_ size_t _In_ size_t size
Definition: DirectXTexP.h:175
static GeometricPrimitive New(GraphicsDevice device, float size=1.0f, int tessellation=8, bool toLeftHanded=false)
Creates a teapot primitive.