2019-08-09 04:18:08 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Runtime.InteropServices;
|
|
|
|
|
|
|
|
|
|
namespace CodeImp.DoomBuilder.Rendering
|
|
|
|
|
{
|
|
|
|
|
public class VertexBuffer : IDisposable
|
|
|
|
|
{
|
2019-08-16 09:24:22 +00:00
|
|
|
|
public VertexBuffer()
|
2019-08-09 04:18:08 +00:00
|
|
|
|
{
|
2019-08-16 09:24:22 +00:00
|
|
|
|
Handle = VertexBuffer_New();
|
2019-08-09 04:18:08 +00:00
|
|
|
|
if (Handle == IntPtr.Zero)
|
|
|
|
|
throw new Exception("VertexBuffer_New failed");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
~VertexBuffer()
|
|
|
|
|
{
|
|
|
|
|
Dispose();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool Disposed { get { return Handle == IntPtr.Zero; } }
|
|
|
|
|
|
|
|
|
|
public void Dispose()
|
|
|
|
|
{
|
|
|
|
|
if (!Disposed)
|
|
|
|
|
{
|
|
|
|
|
VertexBuffer_Delete(Handle);
|
|
|
|
|
Handle = IntPtr.Zero;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-08-09 22:46:51 +00:00
|
|
|
|
internal IntPtr Handle;
|
2019-08-09 04:18:08 +00:00
|
|
|
|
|
2019-08-30 08:30:28 +00:00
|
|
|
|
[DllImport("BuilderNative", CallingConvention = CallingConvention.Cdecl)]
|
2019-08-16 09:24:22 +00:00
|
|
|
|
static extern IntPtr VertexBuffer_New();
|
2019-08-09 04:18:08 +00:00
|
|
|
|
|
2019-08-30 08:30:28 +00:00
|
|
|
|
[DllImport("BuilderNative", CallingConvention = CallingConvention.Cdecl)]
|
2019-08-09 04:18:08 +00:00
|
|
|
|
static extern void VertexBuffer_Delete(IntPtr handle);
|
|
|
|
|
}
|
|
|
|
|
}
|