public Renderer() { if (Instance != null) { throw CargoEngineException.Create("multiple instances of renderer"); } Instance = this; DeviceCreationFlags devFlags = 0; #if DEBUG devFlags |= DeviceCreationFlags.Debug; #endif Device = new Device(SharpDX.Direct3D.DriverType.Hardware, devFlags); ImmPipeline = new RenderPipeline(Device.ImmediateContext); inputLayouts = new Dictionary <int, InputLayout>(); for (var i = 0; i < NUM_THREADS; i++) { var pipeline = new RenderPipeline(Device); deferredPipelines[i] = pipeline; } Shaders = new ShaderLoader(this); }
public void Apply(RenderPipeline pipeline) { UpdateBuffers(); pipeline.InputAssembler.PrimitiveTopology = (PrimitiveTopology)Topology; pipeline.InputAssembler.IndexBuffer = indexBuffer; pipeline.InputAssembler.IndexBufferFormat = indexBufferFormat; pipeline.InputAssembler.VertexBuffer.SetStates(0, buffers.ToArray()); pipeline.InputAssembler.InputElements = InputElements; }
public abstract void Render(RenderPipeline pipeline);
public void Deactivate(RenderPipeline pipeline) { var rts = new RenderTargetView[RenderTargets.Count]; pipeline.DevContext.OutputMerger.SetRenderTargets(null, rts); }