Exemplo n.º 1
0
        public HLSLStaticEntitySprite(Device device, string shaderPath, VertexDeclaration VertexDeclaration, iCBuffer CBPerFrame = null, EntryPoints shadersEntryPoint = null)
            : base(device, shaderPath, VertexDeclaration, new UtopiaIncludeHandler())
        {
            //Create Constant Buffers interfaces ==================================================
            CBPerFrameLocal = ToDispose(new CBuffer <CBPerFrame_Struct>(device, "PerFrameLocal"));
            CBuffers.Add(CBPerFrameLocal);

            if (CBPerFrame != null)
            {
                CBuffers.Add(CBPerFrame.Clone());
            }

            //Create the resource interfaces ==================================================
            DiffuseTexture = new ShaderResource("DiffuseTexture");
            ShaderResources.Add(DiffuseTexture);

            BiomesColors = new ShaderResource("BiomesColors");
            ShaderResources.Add(BiomesColors);

            //Create the Sampler interface ==================================================
            SamplerDiffuse = new ShaderSampler("SamplerDiffuse");
            ShaderSamplers.Add(SamplerDiffuse);

            //Load the shaders
            base.LoadShaders(shadersEntryPoint == null ? _shadersEntryPoint : shadersEntryPoint);
        }
Exemplo n.º 2
0
        public HLSLSprites2(Device device, bool withAlphaClip, string shaderFilePath)
            : base(device, shaderFilePath, VertexSprite2.VertexDeclaration, null)
        {
            if (!withAlphaClip)
            {
                _shadersEntryPoint.PixelShader_EntryPoint = "SpritePSNoClip";
            }

            //Create Constant Buffers interfaces ==================================================
            CBPerDraw = ToDispose(new CBuffer <CBPerDraw_Struct>(device, "PerDraw"));
            CBuffers.Add(CBPerDraw);

            CBTextureTransform = ToDispose(new CBuffer <CBTextureTransform_Struct>(device, "TextureTransform"));
            CBuffers.Add(CBTextureTransform);

            //Create the resource interfaces ==================================================
            SpriteTexture = new ShaderResource("SpriteTexture");
            ShaderResources.Add(SpriteTexture);

            //Create the Sampler interface ==================================================
            SpriteSampler = new ShaderSampler("SpriteSampler");
            ShaderSamplers.Add(SpriteSampler);

            //Load the shaders
            base.LoadShaders(_shadersEntryPoint);
        }
Exemplo n.º 3
0
        public HLSLTerran(Device device, string shaderPath, VertexDeclaration VertexDeclaration, iCBuffer CBPerFrame = null, EntryPoints shadersEntryPoint = null)
            : base(device, shaderPath, VertexDeclaration, new UtopiaIncludeHandler())
        {
            //Create Contstant Buffers interfaces ==================================================
            CBPerDraw = ToDispose(new CBuffer <CBPerDraw_Struct>(device, "PerDraw"));
            CBuffers.Add(CBPerDraw);

            if (CBPerFrame != null)
            {
                CBuffers.Add(CBPerFrame.Clone());
            }

            //Create the resource interfaces ==================================================
            TerraTexture = new ShaderResource("TerraTexture");
            ShaderResources.Add(TerraTexture);

            SkyBackBuffer = new ShaderResource("SkyBackBuffer");
            ShaderResources.Add(SkyBackBuffer);

            BiomesColors = new ShaderResource("BiomesColors");
            ShaderResources.Add(BiomesColors);

            ShadowMap = new ShaderResource("ShadowMap");
            ShaderResources.Add(ShadowMap);

            //Create the Sampler interface ==================================================
            SamplerDiffuse = new ShaderSampler("SamplerDiffuse");
            ShaderSamplers.Add(SamplerDiffuse);

            SamplerBackBuffer = new ShaderSampler("SamplerBackBuffer");
            ShaderSamplers.Add(SamplerBackBuffer);

            //Load the shaders
            base.LoadShaders(shadersEntryPoint == null ? _shadersEntryPoint : shadersEntryPoint);
        }
Exemplo n.º 4
0
        public HLSLUtopiaPointSprite3DText(Device device, string shaderPath, VertexDeclaration VertexDeclaration, iCBuffer CBPerFrame, Include includeHandler, EntryPoints shadersEntryPoint = null)
            : base(device, shaderPath, VertexDeclaration, includeHandler)
        {
            //Create Constant Buffers interfaces ==================================================
            CBuffers.Add(CBPerFrame.Clone());

            //Create the resource interfaces ==================================================
            DiffuseTexture = new ShaderResource("DiffuseTexture");
            ShaderResources.Add(DiffuseTexture);

            //Create the Sampler interface ==================================================
            SamplerDiffuse = new ShaderSampler("SamplerDiffuse");
            ShaderSamplers.Add(SamplerDiffuse);

            //Load the shaders
            base.LoadShaders(shadersEntryPoint == null ? _shadersEntryPoint : shadersEntryPoint);
        }
Exemplo n.º 5
0
        public HLSLClouds(Device device, string effectPath, VertexDeclaration vertexDeclaration, params iCBuffer[] externalCBuffers)
            : base(device, effectPath, vertexDeclaration, new UtopiaIncludeHandler(), externalCBuffers)
        {
            //Create Constant Buffers interfaces
            CBPerDraw = ToDispose(new CBuffer <CBPerDrawStruct>(device, "PerDraw"));
            CBuffers.Add(CBPerDraw);

            //Create the resource interfaces ==================================================
            SamplerBackBuffer = new ShaderSampler("SamplerBackBuffer");
            ShaderSamplers.Add(SamplerBackBuffer);

            SolidBackBuffer = new ShaderResource("SkyBackBuffer");
            ShaderResources.Add(SolidBackBuffer);

            //Load the shaders only after the CBuffer have been defined
            base.LoadShaders(_shadersEntryPoint);
        }
Exemplo n.º 6
0
        public HLSLSprites(Device device, string FileName)
            : base(device, @"Effects\Sprites\" + FileName, VertexSprite2.VertexDeclaration, null)
        {
            //Create Constant Buffers interfaces ==================================================
            CBPerDraw = ToDispose(new CBuffer <CBPerDraw_Struct>(device, "PerDraw"));
            CBuffers.Add(CBPerDraw);

            //Create the resource interfaces ==================================================
            SpriteTexture = new ShaderResource("SpriteTexture");
            ShaderResources.Add(SpriteTexture);

            //Create the Sampler interface ==================================================
            SpriteSampler = new ShaderSampler("SpriteSampler");
            ShaderSamplers.Add(SpriteSampler);

            //Load the shaders
            base.LoadShaders(_shadersEntryPoint);
        }
Exemplo n.º 7
0
        public HLSLCubeTool(Device device, string shaderPath, VertexDeclaration VertexDeclaration, EntryPoints shadersEntryPoint = null)
            : base(device, shaderPath, VertexDeclaration, null)
        {
            //Create Constant Buffers interfaces ==================================================
            CBPerDraw = ToDispose(new CBuffer <CBPerDraw_Struct>(device, "PerDraw"));
            CBuffers.Add(CBPerDraw);

            //Create the resource interfaces ==================================================
            DiffuseTexture = new ShaderResource("DiffuseTexture");
            ShaderResources.Add(DiffuseTexture);

            //Create the Sampler interface ==================================================
            SamplerDiffuse = new ShaderSampler("SamplerDiffuse");
            ShaderSamplers.Add(SamplerDiffuse);

            //Load the shaders
            base.LoadShaders(shadersEntryPoint == null ? _shadersEntryPoint : shadersEntryPoint);
        }
Exemplo n.º 8
0
        public HLSLColorOverlay(Device device, string shaderFilePath)
            : base(device, shaderFilePath, VertexPosition2Texture.VertexDeclaration, null)
        {
            //Create Constant Buffers interfaces
            CBPerDraw = ToDispose(new CBuffer <CBPerDraw_Struct>(device, "PerDraw"));
            CBuffers.Add(CBPerDraw);

            //Create the resource interfaces ==================================================
            SpriteTexture = new ShaderResource("SpriteTexture");
            ShaderResources.Add(SpriteTexture);

            //Create the Sampler interface ==================================================
            SpriteSampler = new ShaderSampler("SpriteSampler");
            ShaderSamplers.Add(SpriteSampler);

            //Load the shaders
            LoadShaders(_shadersEntryPoint);
        }
Exemplo n.º 9
0
        public HLSLGhost(Device device, string shaderPath, VertexDeclaration VertexDeclaration, EntryPoints shadersEntryPoint = null)
            : base(device, shaderPath, VertexDeclaration, new UtopiaIncludeHandler())
        {
            //Create Contstant Buffers interfaces ==================================================
            CBPerDraw = ToDispose(new CBuffer <CBPerDrawStructure>(device, "PerDraw"));
            CBuffers.Add(CBPerDraw);

            //Create the resource interfaces ==================================================
            PostEffectBackBuffer = new ShaderResource("PostEffectBackBuffer");
            ShaderResources.Add(PostEffectBackBuffer);

            //Create the Sampler interface ==================================================
            SamplerPostEffectBackBuffer = new ShaderSampler("SamplerPostEffectBackBuffer");
            ShaderSamplers.Add(SamplerPostEffectBackBuffer);

            //Load the shaders
            base.LoadShaders(shadersEntryPoint == null ? _shadersEntryPoint : shadersEntryPoint);
        }
Exemplo n.º 10
0
        public HLSLVoxelModelInstanced(Device device, string shaderPath, VertexDeclaration VertexDeclaration, EntryPoints shadersEntryPoint = null)
            : base(device, shaderPath, VertexDeclaration, null)
        {
            //Create Constant Buffers interfaces ==================================================
            CBPerFrame = ToDispose(new CBuffer <CBPerFrameStructure>(device, "VoxelModelPerFrame"));
            CBuffers.Add(CBPerFrame);

            CBPerModel = ToDispose(new CBuffer <CBPerModelStructure>(device, "VoxelModel", true));
            CBuffers.Add(CBPerModel);

            ShadowMap = new ShaderResource("ShadowMap");
            ShaderResources.Add(ShadowMap);

            SamplerBackBuffer = new ShaderSampler("SamplerBackBuffer");
            ShaderSamplers.Add(SamplerBackBuffer);

            //Load the shaders
            base.LoadShaders(shadersEntryPoint == null ? _shadersEntryPoint : shadersEntryPoint);
        }
        public HLSLVertexPositionColorTexture(Device device)
            : base(device, @"Effects\Basics\VertexPositionColorTexture.hlsl", VertexPositionColorTexture.VertexDeclaration, null)
        {
            //Create Constant Buffers interfaces ==================================================
            CBPerDraw = ToDispose(new CBuffer <CBPerDraw_Struct>(device, "PerDraw"));
            CBuffers.Add(CBPerDraw);

            CBPerFrame = ToDispose(new CBuffer <CBPerFrame_Struct>(device, "PerFrame"));
            CBuffers.Add(CBPerFrame);

            //Create the resource interfaces ==================================================
            DiffuseTexture = new ShaderResource("DiffuseTexture");
            ShaderResources.Add(DiffuseTexture);

            //Create the Sampler interface ==================================================
            SamplerDiffuse = new ShaderSampler("SamplerDiffuse");
            ShaderSamplers.Add(SamplerDiffuse);

            //Load the shaders
            base.LoadShaders(_shadersEntryPoint);
        }
Exemplo n.º 12
0
        public HLSLBlur(Device device, BlurPass pass, string effectFilePath)
            : base(device, effectFilePath, VertexPosition2Texture.VertexDeclaration, null)
        {
            //Create Constant Buffers interfaces
            CBPerDraw = ToDispose(new CBuffer <CBPerDraw_Struct>(device, "PerDraw"));
            CBuffers.Add(CBPerDraw);

            //Create the resource interfaces ==================================================
            SpriteTexture = new ShaderResource("SpriteTexture");
            ShaderResources.Add(SpriteTexture);

            //Create the Sampler interface ==================================================
            SpriteSampler = new ShaderSampler("SpriteSampler");
            ShaderSamplers.Add(SpriteSampler);

            //Load the shaders
            switch (pass)
            {
            case BlurPass.Horizontal:
                _shadersEntryPoint = new EntryPoints()
                {
                    VertexShader_EntryPoint = "VS",
                    PixelShader_EntryPoint  = "PS_BlurHorizontal"
                };
                break;

            case BlurPass.Vertical:
                _shadersEntryPoint = new EntryPoints()
                {
                    VertexShader_EntryPoint = "VS",
                    PixelShader_EntryPoint  = "PS_BlurVertical"
                };
                break;
            }
            base.LoadShaders(_shadersEntryPoint);
        }