public RenderMeshPass(IDevice device, ID3DCompiler compiler) { using var vertexShaderBlob = new Blob(compiler.CompileShaderFromFile(@"F:\Git\GameDev\src\Titan.D3D11.Bindings\VertexShader.hlsl", "main", "vs_5_0")); using var pixelShaderBlob = new Blob(compiler.CompileShaderFromFile(@"F:\Git\GameDev\src\Titan.D3D11.Bindings\PixelShader.hlsl", "main", "ps_5_0")); _vertexShader = device.CreateVertexShader(vertexShaderBlob); _pixelShader = device.CreatePixelShader(pixelShaderBlob); _inputLayout = device.CreateInputLayout(new VertexLayout(4).Append("Position", VertexLayoutTypes.Position3D).Append("Normal", VertexLayoutTypes.Position3D).Append("Texture", VertexLayoutTypes.Texture2D).Append("Color", VertexLayoutTypes.Float4Color), vertexShaderBlob); _perFrameConstantBuffer = device.CreateConstantBuffer <PerFrameContantBuffer>(BufferUsage.Dynamic, BufferAccessFlags.Write); _lightsConstantBuffer = device.CreateConstantBuffer <LightsConstantBuffer>(BufferUsage.Dynamic, BufferAccessFlags.Write); _perObjectConstantBuffer = device.CreateConstantBuffer <PerObjectContantBuffer>(BufferUsage.Dynamic, BufferAccessFlags.Write); _sampler = device.CreateSampler(); }
public RenderToBackbufferPass(IDevice device, ID3DCompiler compiler) { _backBuffer = device.BackBuffer; _depthStencil = device.DepthStencil; _indexBuffer = device.CreateIndexBuffer(new int[] { 0, 3, 1, 3, 2, 1 }); _vertexBuffer = device.CreateVertexBuffer(CreateCube()); using var pixelShaderBlob = new Blob(compiler.CompileShaderFromFile(@"F:\Git\GameDev\resources\shaders\BackBufferPixelShader.hlsl", "main", "ps_5_0")); _pixelShader = device.CreatePixelShader(pixelShaderBlob); using var vertexShaderBlob = new Blob(compiler.CompileShaderFromFile(@"F:\Git\GameDev\resources\shaders\BackBufferVertexShader.hlsl", "main", "vs_5_0")); _vertexShader = device.CreateVertexShader(vertexShaderBlob); _inputLayout = device.CreateInputLayout(new VertexLayout(2).Append("POSITION", VertexLayoutTypes.Position2D).Append("TEXCOORD", VertexLayoutTypes.Position2D), vertexShaderBlob); _sampler = device.CreateSampler(); }