public void DrawTriangle(vec3[] points, Color color) { float[] data = GetData(points, color); ushort[] indices = { 0, 1, 2, 0 }; buffer.Buffer(data, indices); }
private void Buffer(vec3[] points, Color color, uint mode, ushort[] indices = null) { VerifyMode(mode); var data = GetData(points, color); // If the index array is null, it's assumed that indexes can be added sequentially. if (indices == null) { indices = new ushort[points.Length]; for (int i = 0; i < indices.Length; i++) { indices[i] = (ushort)i; } } buffer.Buffer(data, indices); }
public override unsafe void Add(T item) { var mesh = item.Mesh; Add(mesh, item); // Each mesh only needs to be buffered to GPU memory once (the first time it's used). if (mesh.Handle != null) { return; } var data = GetData(mesh); var indices = mesh.Indices; var handle = new MeshHandle(indices.Length, (int)buffer.IndexSize, buffer.BaseVertex); buffer.Buffer(data, indices); mesh.Handle = handle; }