/// <summary>
 /// Initializes a new instance of the <see cref="WVPTransformShader" /> class.
 /// </summary>
 /// <param name="device">The device.</param>
 /// <param name="vertexShaderPath">The vertex shader path.</param>
 /// <param name="pixelShaderPath">The pixel shader path.</param>
 public WVPTransformShader(Device device, string vertexShaderPath, string pixelShaderPath, IInputLayoutProvider inputLayoutMaker)
     : base(device, vertexShaderPath, pixelShaderPath, inputLayoutMaker)
 {
     Contract.Ensures(matrixConstantBuffer != null, "matrixConstantBuffer must not be null after this method executes.");
     BufferDescription matrixBufferDesc = new BufferDescription(System.Runtime.InteropServices.Marshal.SizeOf(typeof(MatrixCBuffer)), ResourceUsage.Default, BindFlags.ConstantBuffer, CpuAccessFlags.None, ResourceOptionFlags.None, 0);
     matrixConstantBuffer = new SlimDX.Direct3D11.Buffer(device, matrixBufferDesc);
 }
 protected TransparencyShader(Device device, string vertexShaderPath, string pixelShaderPath, IInputLayoutProvider inputLayoutMaker)
     : base(device, vertexShaderPath, pixelShaderPath, inputLayoutMaker)
 {
     Contract.Ensures(transparencyConstantBuffer != null, "lightConstantBuffer must be instantiated by this function.");
     BufferDescription transparencyBufferDesc = new BufferDescription(System.Runtime.InteropServices.Marshal.SizeOf(typeof(TransparencyCBuffer)), ResourceUsage.Default, BindFlags.ConstantBuffer, CpuAccessFlags.None, ResourceOptionFlags.None, 0);
     transparencyConstantBuffer = new SlimDX.Direct3D11.Buffer(device, transparencyBufferDesc);
 }
Exemplo n.º 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ShaderBase" /> class.
 /// </summary>
 /// <param name="device">The device.</param>
 /// <param name="vertexShaderPath">The vertex shader file path.</param>
 /// <param name="pixelShaderPath">The pixel shader file path.</param>
 protected ShaderBase(Device device, string vertexShaderPath, string pixelShaderPath, IInputLayoutProvider inputLayoutMaker)
 {
     ShaderSignature inputSignature;
     using (ShaderBytecode bytecode = ShaderBytecode.CompileFromFile(vertexShaderPath, "VShader", "vs_4_0", ShaderFlags.None, EffectFlags.None))
     {
         vertexShader = new VertexShader(device, bytecode);
         inputSignature = ShaderSignature.GetInputSignature(bytecode);
     }
     using (ShaderBytecode bytecode = ShaderBytecode.CompileFromFile(pixelShaderPath, "PShader", "ps_4_0", ShaderFlags.None, EffectFlags.None))
         pixelShader = new PixelShader(device, bytecode);
     inputLayout = inputLayoutMaker.MakeInputLayout(device, inputSignature);
 }
Exemplo n.º 4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TextureShader" /> class and creates the sampler.
        /// </summary>
        /// <param name="device">The device.</param>
        /// <param name="vertexShaderPath">The vertex shader path.</param>
        /// <param name="pixelShaderPath">The pixel shader path.</param>
        protected TextureShader(Device device, string vertexShaderPath, string pixelShaderPath, IInputLayoutProvider inputLayoutMaker)
            : base(device, vertexShaderPath, pixelShaderPath, inputLayoutMaker)
        {
            SamplerDescription sampleDesc = new SamplerDescription()
            {
                Filter = Filter.MinMagMipLinear,
                AddressU = TextureAddressMode.Wrap,
                AddressV = TextureAddressMode.Wrap,
                AddressW = TextureAddressMode.Wrap,
                MipLodBias = 0f,
                MaximumAnisotropy = 1,
                ComparisonFunction = Comparison.Always,
                BorderColor = new Color4(0, 0, 0, 0),
                MinimumLod = 0,
                MaximumLod = float.MaxValue
            };

            sampler = SamplerState.FromDescription(device, sampleDesc);
        }
Exemplo n.º 5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GBufferShader"/> class.
 /// </summary>
 /// <param name="device">The device.</param>
 /// <param name="vertexShaderPath">The vertex shader path.</param>
 /// <param name="pixelShaderPath">The pixel shader path.</param>
 /// <param name="inputLayoutMaker">The input layout maker.</param>
 protected BumpShader(Device device, string vertexShaderPath, string pixelShaderPath, IInputLayoutProvider inputLayoutMaker)
     : base(device, vertexShaderPath, pixelShaderPath, inputLayoutMaker)
 {
 }