July 2017
Beginner to intermediate
390 pages
10h 53m
English
So, let us now have a look at the actual updating and rendering code. This work is done in the SurfaceMesh class. Here is the implementation:
public void Render(DeviceContext3 context) { context.VertexShader.SetConstantBuffers(0, _modelConstantBuffer); var stride = Utilities.SizeOf<VertexPositionColor>(); var offset = 0; var bufferBinding = new VertexBufferBinding(_vertexBuffer, stride, offset); context.InputAssembler.SetVertexBuffers(0, bufferBinding); context.InputAssembler.SetIndexBuffer( _indexBuffer, Format.R16_UInt, 0); context.DrawIndexedInstanced(_indexCount, 2, 0, 0, 0); } public void Update(DeviceContext3 context) { _modelConstantBufferData.model = _transformMatrix; if (!NeedsUpdate) return; context.UpdateSubresource(ref ...Read now
Unlock full access