public GpuData Cube_PositionNormalTexture() { return(_cube_PositionNormalTexture ?? (_cube_PositionNormalTexture = GpuData.Create( new IndexBufferBuilder <ushort>(6 * 6) .AddNext(0, 2, 1) .AddNext(0, 3, 2) .AddNext(4 + 0, 4 + 1, 4 + 2) .AddNext(4 + 0, 4 + 2, 4 + 3) .AddNext(8 + 0, 8 + 2, 8 + 1) .AddNext(8 + 0, 8 + 3, 8 + 2) .AddNext(12 + 0, 12 + 1, 12 + 2) .AddNext(12 + 0, 12 + 2, 12 + 3) .AddNext(16 + 0, 16 + 2, 16 + 1) .AddNext(16 + 0, 16 + 3, 16 + 2) .AddNext(20 + 0, 20 + 1, 20 + 2) .AddNext(20 + 0, 20 + 2, 20 + 3) , new VertexBufferBuilder <VertexPositionNormalTexture>(24) // Top .AddNext(new VertexPositionNormalTexture(new Vector3(1, 1, 1), Vector3.Up, new Vector2(0, 1))) .AddNext(new VertexPositionNormalTexture(new Vector3(1, 1, -1), Vector3.Up, new Vector2(1, 1))) .AddNext(new VertexPositionNormalTexture(new Vector3(-1, 1, -1), Vector3.Up, new Vector2(0, 0))) .AddNext(new VertexPositionNormalTexture(new Vector3(-1, 1, 1), Vector3.Up, new Vector2(1, 0))) // Bottom .AddNext(new VertexPositionNormalTexture(new Vector3(1, -1, 1), Vector3.Down, new Vector2(0, 1))) .AddNext(new VertexPositionNormalTexture(new Vector3(1, -1, -1), Vector3.Down, new Vector2(1, 1))) .AddNext(new VertexPositionNormalTexture(new Vector3(-1, -1, -1), Vector3.Down, new Vector2(0, 0))) .AddNext(new VertexPositionNormalTexture(new Vector3(-1, -1, 1), Vector3.Down, new Vector2(1, 0))) // Left .AddNext(new VertexPositionNormalTexture(new Vector3(-1, 1, 1), Vector3.Left, new Vector2(0, 1))) .AddNext(new VertexPositionNormalTexture(new Vector3(-1, 1, -1), Vector3.Left, new Vector2(1, 1))) .AddNext(new VertexPositionNormalTexture(new Vector3(-1, -1, -1), Vector3.Left, new Vector2(0, 0))) .AddNext(new VertexPositionNormalTexture(new Vector3(-1, -1, 1), Vector3.Left, new Vector2(1, 0))) // Right .AddNext(new VertexPositionNormalTexture(new Vector3(1, 1, 1), Vector3.Right, new Vector2(0, 1))) .AddNext(new VertexPositionNormalTexture(new Vector3(1, 1, -1), Vector3.Right, new Vector2(1, 1))) .AddNext(new VertexPositionNormalTexture(new Vector3(1, -1, -1), Vector3.Right, new Vector2(0, 0))) .AddNext(new VertexPositionNormalTexture(new Vector3(1, -1, 1), Vector3.Right, new Vector2(1, 0))) // Forward .AddNext(new VertexPositionNormalTexture(new Vector3(1, 1, -1), Vector3.Forward, new Vector2(0, 1))) .AddNext(new VertexPositionNormalTexture(new Vector3(1, -1, -1), Vector3.Forward, new Vector2(1, 1))) .AddNext(new VertexPositionNormalTexture(new Vector3(-1, -1, -1), Vector3.Forward, new Vector2(0, 0))) .AddNext(new VertexPositionNormalTexture(new Vector3(-1, 1, -1), Vector3.Forward, new Vector2(1, 0))) // Backward .AddNext(new VertexPositionNormalTexture(new Vector3(1, 1, 1), Vector3.Backward, new Vector2(0, 1))) .AddNext(new VertexPositionNormalTexture(new Vector3(1, -1, 1), Vector3.Backward, new Vector2(1, 1))) .AddNext(new VertexPositionNormalTexture(new Vector3(-1, -1, 1), Vector3.Backward, new Vector2(0, 0))) .AddNext(new VertexPositionNormalTexture(new Vector3(-1, 1, 1), Vector3.Backward, new Vector2(1, 0))), GraphicsDevice )).Value); }
public GpuData Square_TextureOnly() { return(_square_textureOnly ?? (_square_textureOnly = GpuData.Create( new IndexBufferBuilder <ushort>(6) .AddNext(0, 1, 2) .AddNext(1, 3, 2), new VertexBufferBuilder <VertexTexture>(4) .AddNext(new VertexTexture(new Vector2(0, 1))) .AddNext(new VertexTexture(new Vector2(1, 1))) .AddNext(new VertexTexture(new Vector2(0, 0))) .AddNext(new VertexTexture(new Vector2(1, 0))), GraphicsDevice )).Value); }
public static void RenderTriangleList(this GpuData indexVertexBuffer, GraphicsDevice graphicsDevice, int baseVertex = 0, int startIndex = 0) { graphicsDevice.SetVertexBuffer(indexVertexBuffer.VertexBuffer); graphicsDevice.Indices = indexVertexBuffer.IndexBuffer; graphicsDevice.DrawIndexedPrimitives(PrimitiveType.TriangleList, baseVertex, startIndex, indexVertexBuffer.IndexBuffer.IndexCount); }