private void init(DisposableI parent, BufferLayoutDescI bufferLayoutDesc) { try { video = parent.FindParentOrSelfWithException<Video>(); vertexBuffer = new VertexBuffer(this, bufferLayoutDesc, BufferUsages.Write, VertexBufferTopologys.Triangle, vertices); } catch (Exception e) { Dispose(); throw e; } }
private void enable(IndexBufferI indexBuffer, VertexBufferI instanceBuffer) { if (instanceBuffer == null) { video.Device.SetVertexBuffer(vertexBuffer); instanceBuffer = null; } else { this.instanceBuffer = (VertexBuffer)instanceBuffer; } if (indexBuffer == null) { video.Device.Indices = null; indexBuffer = null; } else { this.currentIndexBuffer = (IndexBuffer)indexBuffer; this.currentIndexBuffer.enable(); } }