77 using SiliconStudio.Core.Mathematics;
79 namespace SiliconStudio.
Paradox.Graphics
81 public partial class GeometricPrimitive
88 private const int CubeFaceCount = 6;
90 private static readonly
Vector3[] faceNormals =
new Vector3[CubeFaceCount]
100 private static readonly
Vector2[] textureCoordinates =
new Vector2[4]
127 public static GeometricMeshData<VertexPositionNormalTexture>
New(
float size = 1.0f,
bool toLeftHanded =
false)
130 var indices =
new int[CubeFaceCount * 6];
137 for (
int i = 0; i < CubeFaceCount; i++)
139 Vector3 normal = faceNormals[i];
148 Vector3.Cross(ref normal, ref side1, out side2);
152 indices[indexCount++] = (vbase + 0);
153 indices[indexCount++] = (vbase + 1);
154 indices[indexCount++] = (vbase + 2);
156 indices[indexCount++] = (vbase + 0);
157 indices[indexCount++] = (vbase + 2);
158 indices[indexCount++] = (vbase + 3);
168 return new GeometricMeshData<VertexPositionNormalTexture>(vertices, indices, toLeftHanded) {Name =
"Cube"};
static void Cross(ref Vector3 left, ref Vector3 right, out Vector3 result)
Calculates the cross product of two vectors.
SiliconStudio.Paradox.Games.Mathematics.Vector2 Vector2
Represents a two dimensional mathematical vector.
A geometric primitive. Use Cube, Cylinder, GeoSphere, Plane, Sphere, Teapot, Torus. See Draw+vertices to learn how to use it.
Describes a custom vertex format structure that contains position, normal and texture information...
Represents a three dimensional mathematical vector.
static readonly Vector3 UnitZ
The Z unit SiliconStudio.Core.Mathematics.Vector3 (0, 0, 1).
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 UnitY
The Y unit SiliconStudio.Core.Mathematics.Vector3 (0, 1, 0).
SiliconStudio.Core.Mathematics.Vector3 Vector3
A cube has six faces, each one pointing in a different direction.
static GeometricMeshData< VertexPositionNormalTexture > New(float size=1.0f, bool toLeftHanded=false)
Creates a cube with six faces each one pointing in a different direction.
_In_ size_t _In_ size_t size
static GeometricPrimitive New(GraphicsDevice device, float size=1.0f, bool toLeftHanded=false)
Creates a cube with six faces each one pointing in a different direction.