/// <inheritdoc /> public void Render(IBufferBinding <TVsIn> bufferBinding, int countVertices, PrimitiveTopology primitiveTopology) { void Point(uint index0) { var vsin = stackalloc TVsIn[1]; *vsin = bufferBinding.GetVsIn(index0); StageVertexShader(vsin, 1, primitiveTopology); } void Line(uint index0, uint index1) { var vsin = stackalloc TVsIn[2]; *vsin = bufferBinding.GetVsIn(index0); *(vsin + 1) = bufferBinding.GetVsIn(index1); StageVertexShader(vsin, 2, primitiveTopology); } void Triangle(uint index0, uint index1, uint index2) { var vsin = stackalloc TVsIn[3]; *vsin = bufferBinding.GetVsIn(index0); *(vsin + 1) = bufferBinding.GetVsIn(index1); *(vsin + 2) = bufferBinding.GetVsIn(index2); StageVertexShader(vsin, 3, primitiveTopology); } TraversePrimitives(primitiveTopology, countVertices, Point, Line, Triangle); }
/// <inheritdoc /> public override void Dispose() { Shader = default; BufferBinding = default; base.Dispose(); }
public void Render <TVsIn, TPsIn>(IShader <TVsIn, TPsIn> shader, IBufferBinding <TVsIn> bufferBinding) where TVsIn : unmanaged where TPsIn : unmanaged, IPsIn <TPsIn> { shader.Pipeline.Render(bufferBinding, Model.Positions.Length, Model.PrimitiveTopology); }
/// <summary /> protected GfxModel(RenderHost renderHost, IModel model, IShader <TVsIn, TPsIn> shader, IBufferBinding <TVsIn> bufferBinding) : base(renderHost, model) { Shader = shader; BufferBinding = bufferBinding; }
/// <summary /> protected GfxModel(IModel model, IShader <TVsIn, TPsIn> shader, IBufferBinding <TVsIn> bufferBinding) : base(model) { Shader = shader; BufferBinding = bufferBinding; }