mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2024-11-24 04:41:10 +00:00
42 lines
1.1 KiB
C#
42 lines
1.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace CodeImp.DoomBuilder.Rendering
|
|
{
|
|
internal class Mesh : IDisposable
|
|
{
|
|
unsafe public Mesh(RenderDevice graphics, WorldVertex[] vertexData, int[] indexData)
|
|
{
|
|
graphics.SetBufferData(Vertices, vertexData);
|
|
graphics.SetBufferData(Indices, indexData);
|
|
Count = indexData.Length;
|
|
}
|
|
|
|
~Mesh()
|
|
{
|
|
Dispose();
|
|
}
|
|
|
|
internal void Draw(RenderDevice device)
|
|
{
|
|
device.SetVertexBuffer(Vertices);
|
|
device.SetIndexBuffer(Indices);
|
|
device.DrawIndexed(PrimitiveType.TriangleList, 0, Count / 3);
|
|
device.SetIndexBuffer(null);
|
|
device.SetVertexBuffer(null);
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
Vertices.Dispose();
|
|
Indices.Dispose();
|
|
}
|
|
|
|
VertexBuffer Vertices = new VertexBuffer();
|
|
IndexBuffer Indices = new IndexBuffer();
|
|
int Count;
|
|
}
|
|
}
|