Esempio n. 1
0
 private void loadCloned(BasicShader baseShader)
 {
     ParentShader = baseShader;
     Effect       = ParentShader.Effect.Clone(false);
     if (ParentShader.CurrentTechnique != null)
     {
         SetTechnique(ParentShader.CurrentTechnique.Description.Name);
     }
 }
Esempio n. 2
0
        public static BasicShader LoadAutoreload(IGraphicsManager graphics, FileInfo fi, Action <BasicShader> loadedDelegate, ShaderMacro[] macros)
        {
            var s = new BasicShader(graphics.Device);

            if (loadedDelegate != null)
            {
                s.loadedEvent += loadedDelegate;
            }
            s.shaderMacros = macros;
            s.loadAutoreload(fi);
            graphics.AddBasicShader(s);
            return(s);
        }
Esempio n. 3
0
        public BasicShader Clone()
        {
            if (IsClone)
            {
                throw new InvalidOperationException("Can't clone a cloned shader!");
            }

            var clone = new BasicShader(device);

            clone.loadCloned(this);

            //Track clones
            clones.Add(clone);


            return(clone);
        }
            public TestFilledGBuffer(DX11Game game, int width, int height)
            {
                this.game = game;
                GBuffer   = new GBuffer(game.Device, width, height);

                var device  = game.Device;
                var context = device.ImmediateContext;


                var diffuseTexture = Texture2D.FromFile(device, SlimDXDirectX11Test.Wallpaper001_png);

                diffuseTextureRv = new ShaderResourceView(device, diffuseTexture);

                shader = BasicShader.LoadAutoreload(game, new FileInfo(CompiledShaderCache.Current.RootShaderPath + "Deferred\\RenderGBuffer.fx"));

                shader.SetTechnique("Technique1");


                box = new TestBox(device, shader.GetCurrentPass(0).Description.Signature);
            }