Esempio n. 1
0
 public override bool Init(Device device, InputElement[] elements, string vsFileName, string psFileName, string vsEntryPoint, string psEntryPoint)
 {
     if (!base.Init(device, elements, vsFileName, psFileName, vsEntryPoint, psEntryPoint))
     {
         return(false);
     }
     ConstantShaderParamBuffer = ConstantBufferFactory.ConstructBuffer <Shader_601151254Params>(device, "ShaderParamBuffer");
     return(true);
 }
Esempio n. 2
0
        public override bool Init(ID3D11Device Dx11Device, ShaderInitParams InitParams)
        {
            if (!base.Init(Dx11Device, InitParams))
            {
                return(false);
            }

            ConstantExtraParameterBuffer = ConstantBufferFactory.ConstructBuffer <ExtraParameterBuffer>(Dx11Device, "ExtraBuffer");

            return(true);
        }
        public override bool Init(Device Dx11Device, ShaderInitParams InitParams)
        {
            if (!base.Init(Dx11Device, InitParams))
            {
                return(false);
            }

            ConstantShaderParamBuffer = ConstantBufferFactory.ConstructBuffer <Shader_50760736Params>(Dx11Device, "ShaderParamBuffer");

            return(true);
        }
Esempio n. 4
0
        public override bool Init(Device device, InputElement[] elements, string vsFileName, string psFileName, string vsEntryPoint, string psEntryPoint)
        {
            if (!base.Init(device, elements, vsFileName, psFileName, vsEntryPoint, psEntryPoint))
            {
                return(false);
            }

            ConstantExtraParameterBuffer = ConstantBufferFactory.ConstructBuffer <ExtraParameterBuffer>(device, "ExtraBuffer");

            return(true);
        }
Esempio n. 5
0
        public virtual bool Init(Device device, ShaderInitParams InitParams)
        {
            // Attempt to construct pixel shader
            if (InitParams.PixelShaderFile.IsValid())
            {
                ShaderBytecode PixelBytecode = ConstructBytecode(InitParams.PixelShaderFile);
                OurPixelShader = new PixelShader(device, PixelBytecode);
                PixelBytecode.Dispose();
            }

            // Attempt to construct vertex shader
            if (InitParams.VertexShaderFile.IsValid())
            {
                ShaderBytecode VertexBytecode = ConstructBytecode(InitParams.VertexShaderFile);
                OurVertexShader = new VertexShader(device, VertexBytecode);
                Layout          = new InputLayout(device, ShaderSignature.GetInputSignature(VertexBytecode), InitParams.Elements);
                VertexBytecode.Dispose();
            }

            // Attempt to construct geometry shader
            if (InitParams.GeometryShaderFile.IsValid())
            {
                ShaderBytecode GeometryBytecode = ConstructBytecode(InitParams.GeometryShaderFile);
                OurGeometryShader = new GeometryShader(device, GeometryBytecode);
                GeometryBytecode.Dispose();
            }

            SamplerStateDescription samplerDesc = new SamplerStateDescription()
            {
                Filter             = Filter.Anisotropic,
                AddressU           = TextureAddressMode.Wrap,
                AddressV           = TextureAddressMode.Wrap,
                AddressW           = TextureAddressMode.Wrap,
                MipLodBias         = 0,
                MaximumAnisotropy  = 8,
                ComparisonFunction = Comparison.Always,
                BorderColor        = new Color4(0, 0, 0, 0),
                MinimumLod         = 0,
                MaximumLod         = 0
            };

            SamplerState = new SamplerState(device, samplerDesc);

            ConstantCameraBuffer       = ConstantBufferFactory.ConstructBuffer <DCameraBuffer>(device, "CameraBuffer");
            ConstantLightBuffer        = ConstantBufferFactory.ConstructBuffer <LightBuffer>(device, "LightBuffer");
            ConstantMatrixBuffer       = ConstantBufferFactory.ConstructBuffer <MatrixBuffer>(device, "MatrixBuffer");
            ConstantEditorParamsBuffer = ConstantBufferFactory.ConstructBuffer <EditorParameterBuffer>(device, "EditorBuffer");

            return(true);
        }
Esempio n. 6
0
        public virtual bool Init(ID3D11Device device, ShaderInitParams InitParams)
        {
            // Attempt to construct pixel shader
            if (InitParams.PixelShaderFile.IsValid())
            {
                Blob PixelBytecode = ConstructBytecode(InitParams.PixelShaderFile);
                OurPixelShader = device.CreatePixelShader(PixelBytecode);
                PixelBytecode.Dispose();
            }

            // Attempt to construct vertex shader
            if (InitParams.VertexShaderFile.IsValid())
            {
                Blob VertexBytecode = ConstructBytecode(InitParams.VertexShaderFile);
                OurVertexShader = device.CreateVertexShader(VertexBytecode);
                Layout          = device.CreateInputLayout(InitParams.Elements, VertexBytecode);
                VertexBytecode.Dispose();
            }

            // Attempt to construct geometry shader
            if (InitParams.GeometryShaderFile.IsValid())
            {
                Blob GeometryBytecode = ConstructBytecode(InitParams.GeometryShaderFile);
                OurGeometryShader = device.CreateGeometryShader(GeometryBytecode);
                GeometryBytecode.Dispose();
            }

            SamplerDescription samplerDesc = new SamplerDescription()
            {
                Filter             = Filter.Anisotropic,
                AddressU           = TextureAddressMode.Wrap,
                AddressV           = TextureAddressMode.Wrap,
                AddressW           = TextureAddressMode.Wrap,
                MipLODBias         = 0,
                MaxAnisotropy      = 8,
                ComparisonFunction = ComparisonFunction.Always,
                BorderColor        = new Color4(0, 0, 0, 0),
                MinLOD             = 0,
                MaxLOD             = 0
            };

            SamplerState = device.CreateSamplerState(samplerDesc);

            ConstantCameraBuffer       = ConstantBufferFactory.ConstructBuffer <DCameraBuffer>(device, "CameraBuffer");
            ConstantLightBuffer        = ConstantBufferFactory.ConstructBuffer <LightBuffer>(device, "LightBuffer");
            ConstantMatrixBuffer       = ConstantBufferFactory.ConstructBuffer <MatrixBuffer>(device, "MatrixBuffer");
            ConstantEditorParamsBuffer = ConstantBufferFactory.ConstructBuffer <EditorParameterBuffer>(device, "EditorBuffer");

            return(true);
        }
Esempio n. 7
0
        public virtual bool Init(Device device, InputElement[] elements, string vsFileName, string psFileName, string vsEntryPoint, string psEntryPoint)
        {
            ShaderBytecode pixelShaderByteCode;
            ShaderBytecode vertexShaderByteCode;

            vsFileName = ToolkitSettings.ShaderPath + vsFileName;
            psFileName = ToolkitSettings.ShaderPath + psFileName;

            pixelShaderByteCode  = ShaderBytecode.CompileFromFile(psFileName, psEntryPoint, "ps_4_0", ShaderFlags.None, EffectFlags.None);
            vertexShaderByteCode = ShaderBytecode.CompileFromFile(vsFileName, vsEntryPoint, "vs_4_0", ShaderFlags.None, EffectFlags.None);
            PixelShader          = new PixelShader(device, pixelShaderByteCode);
            VertexShader         = new VertexShader(device, vertexShaderByteCode);
            Layout = new InputLayout(device, ShaderSignature.GetInputSignature(vertexShaderByteCode), elements);

            SamplerStateDescription samplerDesc = new SamplerStateDescription()
            {
                Filter             = Filter.Anisotropic,
                AddressU           = TextureAddressMode.Wrap,
                AddressV           = TextureAddressMode.Wrap,
                AddressW           = TextureAddressMode.Wrap,
                MipLodBias         = 0,
                MaximumAnisotropy  = 16,
                ComparisonFunction = Comparison.Always,
                BorderColor        = new Color4(0, 0, 0, 0),
                MinimumLod         = 0,
                MaximumLod         = float.MaxValue
            };

            SamplerState = new SamplerState(device, samplerDesc);

            ConstantCameraBuffer       = ConstantBufferFactory.ConstructBuffer <DCameraBuffer>(device, "CameraBuffer");
            ConstantLightBuffer        = ConstantBufferFactory.ConstructBuffer <LightBuffer>(device, "LightBuffer");
            ConstantMatrixBuffer       = ConstantBufferFactory.ConstructBuffer <MatrixBuffer>(device, "MatrixBuffer");
            ConstantEditorParamsBuffer = ConstantBufferFactory.ConstructBuffer <EditorParameterBuffer>(device, "EditorBuffer");

            pixelShaderByteCode.Dispose();
            vertexShaderByteCode.Dispose();

            return(true);
        }