예제 #1
0
        public void InitializeLayers()
        {
            Layer.lightingTwoPointOh = false;
            this._layers.Add(new Layer("PARALLAX", 100));
            this._parallax = this._layers[this._layers.Count - 1];
            this._layers.Add(new Layer("VIRTUAL", 95));
            this._virtual = this._layers[this._layers.Count - 1];
            this._layers.Add(new Layer("BACKGROUND", 90));
            this._background = this._layers[this._layers.Count - 1];
            this._background.enableCulling = true;
            this._layers.Add(new Layer("GAME"));
            this._game = this._layers[this._layers.Count - 1];
            this._game.enableCulling = false;
            this._layers.Add(new Layer("BLOCKS", -18));
            this._blocks = this._layers[this._layers.Count - 1];
            this._blocks.enableCulling = true;
            this._layers.Add(new Layer("FOREGROUND", -80));
            this._foreground = this._layers[this._layers.Count - 1];
            this._layers.Add(new Layer("HUD", -90));
            this._hud = this._layers[this._layers.Count - 1];
            this._layers.Add(new Layer("CONSOLE", -100, new Camera((float)DuckGame.Graphics.width, (float)DuckGame.Graphics.height)));
            this._console = this._layers[this._layers.Count - 1];
            this._layers.Add(new Layer("GLOW", -20));
            this._glow = this._layers[this._layers.Count - 1];
            this._layers.Add(new Layer("LIGHTING", Layer.lightingTwoPointOh ? -19 : -10, targetLayer: true, targetSize: new Vec2((float)DuckGame.Graphics.width, (float)DuckGame.Graphics.height)));
            this._lighting = this._layers[this._layers.Count - 1];
            this._layers.Add(new Layer("LIGHTING2", -15, targetLayer: true, targetSize: new Vec2((float)DuckGame.Graphics.width, (float)DuckGame.Graphics.height)));
            this._lighting2 = this._layers[this._layers.Count - 1];
            BlendState blendState = new BlendState();

            blendState.ColorSourceBlend      = Blend.Zero;
            blendState.ColorDestinationBlend = Blend.SourceColor;
            blendState.ColorBlendFunction    = BlendFunction.Add;
            blendState.AlphaSourceBlend      = Blend.Zero;
            blendState.AlphaDestinationBlend = Blend.SourceAlpha;
            blendState.AlphaBlendFunction    = BlendFunction.Add;
            this._glow.blend           = BlendState.Additive;
            this._lighting.targetBlend = BlendState.Additive;
            this._lighting.targetBlend = new BlendState()
            {
                ColorSourceBlend      = Blend.One,
                ColorDestinationBlend = Blend.One,
                ColorBlendFunction    = BlendFunction.Add,
                AlphaSourceBlend      = Blend.One,
                AlphaDestinationBlend = Blend.One,
                AlphaBlendFunction    = BlendFunction.Add
            };
            this._lighting.blend                  = blendState;
            this._lighting.targetClearColor       = new Color(150, 150, 150, 0);
            this._lighting.targetDepthStencil     = DepthStencilState.None;
            this._lighting.flashAddClearInfluence = 1f;
            this._lighting2.targetBlend           = BlendState.Additive;
            this._lighting2.blend                 = BlendState.Additive;
            this._lighting2.targetClearColor      = new Color(0, 0, 0);
            this._lighting2.targetDepthStencil    = DepthStencilState.None;
            this._lighting2.shareDrawObjects      = this._lighting;
            this._lighting2.targetFade            = 0.3f;
            this._layers = this._layers.OrderBy <Layer, int>((Func <Layer, int>)(l => - l.depth)).ToList <Layer>();
            Layer.Parallax.flashAddInfluence = 1f;
            Layer.HUD.flashAddInfluence      = 1f;
            if (this._basicEffect == null)
            {
                this._itemSpawnEffect         = Content.Load <MTEffect>("Shaders/wireframeTex");
                this._basicWireframeEffect    = Content.Load <MTEffect>("Shaders/wireframe");
                this._basicWireframeEffectTex = Content.Load <MTEffect>("Shaders/wireframeTex");
                this._basicEffect             = Content.Load <MTEffect>("Shaders/basic");
                this._basicEffectFade         = Content.Load <MTEffect>("Shaders/basicFade");
                this._basicEffectAdd          = Content.Load <MTEffect>("Shaders/basicAdd");
                this._basicEffectFadeAdd      = Content.Load <MTEffect>("Shaders/basicFadeAdd");
            }
            this.ResetLayers();
        }
예제 #2
0
 public MaterialRedHot(Thing t)
 {
     this._effect      = Content.Load <MTEffect>("Shaders/redhot");
     this._goldTexture = Content.Load <Tex2D>("redHot");
     this._thing       = t;
 }