Opentk/Source/Examples/Shapes/Cube.cs

65 lines
1.9 KiB
C#
Raw Normal View History

using System;
using System.Collections.Generic;
using System.Text;
using OpenTK.Math;
using System.Drawing;
namespace Examples.Shapes
{
public static class Cube
{
public static readonly Vector3[] Vertices = new Vector3[8]
{
new Vector3(-1.0f, -1.0f, 1.0f),
new Vector3( 1.0f, -1.0f, 1.0f),
new Vector3( 1.0f, 1.0f, 1.0f),
new Vector3(-1.0f, 1.0f, 1.0f),
new Vector3(-1.0f, -1.0f, -1.0f),
new Vector3( 1.0f, -1.0f, -1.0f),
new Vector3( 1.0f, 1.0f, -1.0f),
new Vector3(-1.0f, 1.0f, -1.0f),
};
public static readonly ushort[] Indices =
{
// front face
0, 1, 2, 2, 3, 0,
// top face
3, 2, 6, 6, 7, 3,
// back face
7, 6, 5, 5, 4, 7,
// left face
4, 0, 3, 3, 7, 4,
// bottom face
0, 1, 5, 5, 4, 0,
// right face
1, 5, 6, 6, 2, 1,
};
public static readonly Vector3[] Normals =
{
new Vector3(-1.0f, -1.0f, 1.0f),
new Vector3( 1.0f, -1.0f, 1.0f),
new Vector3( 1.0f, 1.0f, 1.0f),
new Vector3(-1.0f, 1.0f, 1.0f),
new Vector3(-1.0f, -1.0f, -1.0f),
new Vector3( 1.0f, -1.0f, -1.0f),
new Vector3( 1.0f, 1.0f, -1.0f),
new Vector3(-1.0f, 1.0f, -1.0f),
};
public static readonly int[] Colors =
{
Color.Firebrick.ToArgb(),
Color.Honeydew.ToArgb(),
Color.Moccasin.ToArgb(),
Color.Yellow.ToArgb(),
Color.Crimson.ToArgb(),
Color.DarkGoldenrod.ToArgb(),
Color.ForestGreen.ToArgb(),
Color.Sienna.ToArgb(),
};
}
}