2007-09-25 21:11:16 +00:00
|
|
|
|
#region --- License ---
|
|
|
|
|
/* Copyright (c) 2006, 2007 Stefanos Apostolopoulos
|
|
|
|
|
* See license.txt for license info
|
|
|
|
|
*/
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
using System;
|
2007-09-22 22:01:43 +00:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Text;
|
2007-09-25 21:11:16 +00:00
|
|
|
|
using System.Drawing;
|
2007-09-22 22:01:43 +00:00
|
|
|
|
|
|
|
|
|
using OpenTK.Math;
|
2007-09-30 12:34:20 +00:00
|
|
|
|
using System.Runtime.InteropServices;
|
2007-09-22 22:01:43 +00:00
|
|
|
|
|
|
|
|
|
namespace Examples.Shapes
|
|
|
|
|
{
|
2007-09-30 12:34:20 +00:00
|
|
|
|
public class Cube : Shape
|
2007-09-22 22:01:43 +00:00
|
|
|
|
{
|
2007-09-30 12:34:20 +00:00
|
|
|
|
public Cube()
|
2007-09-22 22:01:43 +00:00
|
|
|
|
{
|
2007-09-30 12:34:20 +00:00
|
|
|
|
Vertices = new Vector3[]
|
|
|
|
|
{
|
|
|
|
|
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)
|
|
|
|
|
};
|
2007-09-22 22:01:43 +00:00
|
|
|
|
|
2007-09-30 12:34:20 +00:00
|
|
|
|
Indices = new int[]
|
|
|
|
|
{
|
|
|
|
|
// 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,
|
|
|
|
|
};
|
2007-09-22 22:01:43 +00:00
|
|
|
|
|
2007-09-30 12:34:20 +00:00
|
|
|
|
Normals = new Vector3[]
|
|
|
|
|
{
|
|
|
|
|
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),
|
|
|
|
|
};
|
2007-09-22 22:01:43 +00:00
|
|
|
|
|
2007-09-30 12:34:20 +00:00
|
|
|
|
Colors = new int[]
|
|
|
|
|
{
|
|
|
|
|
Color.Firebrick.ToArgb(),
|
|
|
|
|
Color.Honeydew.ToArgb(),
|
|
|
|
|
Color.Moccasin.ToArgb(),
|
|
|
|
|
Color.Yellow.ToArgb(),
|
|
|
|
|
Color.Crimson.ToArgb(),
|
|
|
|
|
Color.DarkGoldenrod.ToArgb(),
|
|
|
|
|
Color.ForestGreen.ToArgb(),
|
|
|
|
|
Color.Sienna.ToArgb(),
|
|
|
|
|
};
|
|
|
|
|
}
|
2007-09-22 22:01:43 +00:00
|
|
|
|
}
|
|
|
|
|
}
|