Example #1
0
        public unsafe void Draw(IDeviceContext context, IRealTime realTime)
        {
            context.ShadersForDrawing = shaders;

            float totalRealTime = realTime.TotalRealTime;
            context.SetSubresourceData(timeUbuffer, 0, new SubresourceData(new IntPtr(&totalRealTime)));
            context.VertexStage.UniformBuffers[0] = timeUbuffer;

            context.InputAssembler.PrimitiveTopology = PrimitiveTopology.TriangleList;
            context.InputAssembler.VertexLayout = vertexLayout;
            context.InputAssembler.VertexSources[0] = new VertexSource(vertexBuffer, 0, Vertex.SizeInBytes);
            context.InputAssembler.IndexSource = new IndexSource(indexBuffer, 0, IndexFormat.SixteenBit);

            context.Rasterizer.State = rasterizerState;
            context.OutputMerger.DepthStencilState = depthStencilState;
            context.OutputMerger.BlendState = blendState;

            context.DrawIndexed(starCount * 6, 0, 0);
        }