Ejemplo n.º 1
0
 public BaseShader(Device Dx11Device, ShaderInitParams InitParams)
 {
     if (!Init(Dx11Device, InitParams))
     {
         MessageBox.Show("Failed to construct shader!", "Toolkit");
     }
 }
Ejemplo n.º 2
0
        public bool Init(ID3D11Device device)
        {
            // construct default shader
            ShaderInitParams DefaultInitParams = new ShaderInitParams();

            DefaultInitParams.Elements         = VertexLayouts.NormalLayout.GetLayout();
            DefaultInitParams.PixelShaderFile  = new ShaderInitParams.ShaderFileEntryPoint("LightPS.hlsl", "LightPixelShader", "ps_4_0");
            DefaultInitParams.VertexShaderFile = new ShaderInitParams.ShaderFileEntryPoint("LightVS.hlsl", "LightVertexShader", "vs_4_0");

            DefaultShader OurDefaultShader = new DefaultShader(device, DefaultInitParams);

            // construct debug shader
            ShaderInitParams DebugInitParams = new ShaderInitParams();

            DebugInitParams.Elements         = VertexLayouts.BasicLayout.GetLayout();
            DebugInitParams.PixelShaderFile  = new ShaderInitParams.ShaderFileEntryPoint("DebugPS.hlsl", "DebugPixelShader", "ps_4_0");
            DebugInitParams.VertexShaderFile = new ShaderInitParams.ShaderFileEntryPoint("DebugVS.hlsl", "DebugVertexShader", "vs_4_0");

            DebugShader OurDebugShader = new DebugShader(device, DebugInitParams);

            // construct collision shader
            ShaderInitParams CollisionInitParams = new ShaderInitParams();

            CollisionInitParams.Elements         = VertexLayouts.CollisionLayout.GetLayout();
            CollisionInitParams.PixelShaderFile  = new ShaderInitParams.ShaderFileEntryPoint("CollisionPS.hlsl", "CollisionShader", "ps_4_0");
            CollisionInitParams.VertexShaderFile = new ShaderInitParams.ShaderFileEntryPoint("CollisionVS.hlsl", "CollisionShader", "vs_4_0");

            CollisionShader OurCollisionShader = new CollisionShader(device, CollisionInitParams);

            // construct shader_601151254 shader
            ShaderInitParams Shader601151254_InitParams = new ShaderInitParams();

            Shader601151254_InitParams.Elements         = VertexLayouts.NormalLayout.GetLayout();
            Shader601151254_InitParams.PixelShaderFile  = new ShaderInitParams.ShaderFileEntryPoint("LightPS.hlsl", "PS_601151254", "ps_4_0");
            Shader601151254_InitParams.VertexShaderFile = new ShaderInitParams.ShaderFileEntryPoint("LightVS.hlsl", "LightVertexShader", "vs_4_0");

            Shader_601151254 OurShader601151254 = new Shader_601151254(device, Shader601151254_InitParams);

            // construct shader_50760736 shader
            ShaderInitParams Shader_50760736_InitParams = new ShaderInitParams();

            Shader_50760736_InitParams.Elements         = VertexLayouts.NormalLayout.GetLayout();
            Shader_50760736_InitParams.PixelShaderFile  = new ShaderInitParams.ShaderFileEntryPoint("LightPS.hlsl", "PS_50760736", "ps_4_0");
            Shader_50760736_InitParams.VertexShaderFile = new ShaderInitParams.ShaderFileEntryPoint("LightVS.hlsl", "LightVertexShader", "vs_4_0");

            Shader_50760736 OurShader50760736 = new Shader_50760736(device, Shader_50760736_InitParams);

            shaders = new Dictionary <ulong, BaseShader>();
            shaders.Add(0, OurDefaultShader);
            shaders.Add(1, OurDebugShader);
            shaders.Add(2, OurCollisionShader);
            shaders.Add(601151254, OurShader601151254);
            shaders.Add(50760736, OurShader50760736);

            return(true);
        }
Ejemplo n.º 3
0
        public override bool Init(ID3D11Device Dx11Device, ShaderInitParams InitParams)
        {
            if (!base.Init(Dx11Device, InitParams))
            {
                return(false);
            }

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

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

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

            return(true);
        }
Ejemplo 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);
        }
Ejemplo 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);
        }
Ejemplo n.º 7
0
 public DebugShader(Device Dx11Device, ShaderInitParams InitParams) : base(Dx11Device, InitParams)
 {
 }
Ejemplo n.º 8
0
 public DefaultShader(ID3D11Device Dx11Device, ShaderInitParams InitParams) : base(Dx11Device, InitParams)
 {
 }
Ejemplo n.º 9
0
 public CollisionShader(ID3D11Device Dx11Device, ShaderInitParams InitParams) : base(Dx11Device, InitParams)
 {
 }
Ejemplo n.º 10
0
 public Shader_50760736(Device Dx11Device, ShaderInitParams InitParams) : base(Dx11Device, InitParams)
 {
 }
Ejemplo n.º 11
0
 public Shader_601151254(ID3D11Device Dx11Device, ShaderInitParams InitParams) : base(Dx11Device, InitParams)
 {
 }