public static void TexturedCube(float size, RectangleD top, RectangleD bottom, RectangleD right, RectangleD left, RectangleD front, RectangleD back) { GL.Begin(BeginMode.Quads); GL.Normal3(0.0f, 1.0f, 0.0f); GL.TexCoord2(top.Right, top.Top); GL.Vertex3( size, size, -size); GL.TexCoord2(top.Left, top.Top); GL.Vertex3(-size, size, -size); GL.TexCoord2(top.Left, top.Bottom); GL.Vertex3(-size, size, size); GL.TexCoord2(top.Right, top.Bottom); GL.Vertex3( size, size, size); GL.Normal3(0.0f, -1.0f, 0.0f); GL.TexCoord2(bottom.Right, bottom.Top); GL.Vertex3(-size, -size, size); GL.TexCoord2(bottom.Left, bottom.Top); GL.Vertex3(-size, -size, -size); GL.TexCoord2(bottom.Left, bottom.Bottom); GL.Vertex3( size, -size, -size); GL.TexCoord2(bottom.Right, bottom.Bottom); GL.Vertex3( size, -size, size); GL.Normal3(1.0f, 0.0f, 0.0f); GL.TexCoord2(right.Right, right.Top); GL.Vertex3(size, size, -size); GL.TexCoord2(right.Left, right.Top); GL.Vertex3(size, size, size); GL.TexCoord2(right.Left, right.Bottom); GL.Vertex3(size, -size, size); GL.TexCoord2(right.Right, right.Bottom); GL.Vertex3(size, -size, -size); GL.Normal3(-1.0f, 0.0f, 0.0f); GL.TexCoord2(left.Right, left.Top); GL.Vertex3(-size, size, size); GL.TexCoord2(left.Left, left.Top); GL.Vertex3(-size, size, -size); GL.TexCoord2(left.Left, left.Bottom); GL.Vertex3(-size, -size, -size); GL.TexCoord2(left.Right, left.Bottom); GL.Vertex3(-size, -size, size); GL.Normal3(0.0f, 0.0f, 1.0f); GL.TexCoord2(front.Right, front.Top); GL.Vertex3( size, size, size); GL.TexCoord2(front.Left, front.Top); GL.Vertex3(-size, size, size); GL.TexCoord2(front.Left, front.Bottom); GL.Vertex3(-size, -size, size); GL.TexCoord2(front.Right, front.Bottom); GL.Vertex3( size, -size, size); GL.Normal3(0.0f, 0.0f, -1.0f); GL.TexCoord2(back.Right, back.Top); GL.Vertex3(-size, size, -size); GL.TexCoord2(back.Left, back.Top); GL.Vertex3( size, size, -size); GL.TexCoord2(back.Left, back.Bottom); GL.Vertex3( size, -size, -size); GL.TexCoord2(back.Right, back.Bottom); GL.Vertex3(-size, -size, -size); GL.End(); }
public void SpawnCube(float size, float mass, Matrix4 start) { Point[] block = Blocks.Data[_rnd.Next(0, Blocks.Data.Length)]; RectangleD top = new RectangleD(block[0].X / 16.0, block[0].Y / 16.0, 0.0625, 0.0625); RectangleD bottom = new RectangleD(block[1].X / 16.0, block[1].Y / 16.0, 0.0625, 0.0625); RectangleD right = new RectangleD(block[2].X / 16.0, block[2].Y / 16.0, 0.0625, 0.0625); RectangleD left = new RectangleD(block[3].X / 16.0, block[3].Y / 16.0, 0.0625, 0.0625); RectangleD front = new RectangleD(block[4].X / 16.0, block[4].Y / 16.0, 0.0625, 0.0625); RectangleD back = new RectangleD(block[5].X / 16.0, block[5].Y / 16.0, 0.0625, 0.0625); new Props.Cube(size, mass, start){ Texture = Texture, Top = top, Bottom = bottom, Right = right, Left = left, Front = front, Back = back }; }
public static void TexturedCube(float size, RectangleD sides) { TexturedCube(size, sides, sides, sides, sides, sides, sides); }