Exemplo n.º 1
0
        private void PathChange()
        {
            RenderTargetCube tc = new RenderTargetCube(Game1.graphicsDevice, Math.Max(64, (int)Resolution.get()), false, SurfaceFormat.Color, DepthFormat.None);

            {
                for (int i = 0; i < 6; i++)
                {
                    CubeMapFace face = (CubeMapFace)i;
                    SkyFaceTexture = AssetManager.Load <Texture2D>(this.GetParent().TextureDirectory.get() +
                                                                   Path.get() + face.ToString().Substring(0, 3).ToLower() +
                                                                   face.ToString().Last().ToString().ToUpper());
                    Game1.graphicsDevice.SetRenderTarget(tc, face);
                    Game1.graphicsDevice.Clear(Color.Black);
                    Game1.graphicsDevice.Textures[0] = SkyFaceTexture;
                    Deferred3DScene.PasteEffect.CurrentTechnique.Passes[0].Apply();
                    FullscreenQuad.Draw();
                }
            }

            Game1.graphicsDevice.SetRenderTarget(null);
            Game1.graphicsDevice.Clear(Color.Transparent);
            if (MyCube.get() != null)
            {
                MyCube.get().Dispose();
            }
            MyCube.set(tc);
        }
        public override void Draw2D(GameObjectTag DrawTag)
        {
#if EDITOR
            if (FinalTarget == null)
            {
                Console.WriteLine("Final Target is null");
            }
#endif

            MasterManager.SetViewportToFullscreen();
            Game1.graphicsDevice.Clear(Color.Black);

            Game1.graphicsDevice.BlendState        = BlendState.Opaque;
            Game1.graphicsDevice.DepthStencilState = DepthStencilState.None;

            Game1.graphicsDevice.SamplerStates[0] = SamplerState.PointClamp;
            Game1.graphicsDevice.Textures[0]      = FinalTarget;
            PasteEffect.CurrentTechnique.Passes[0].Apply();
            FullscreenQuad.Draw();
#if EDITOR && WINDOWS
            if (ParentLevel.LevelForEditing)
            {
                objectControls.Draw3D(DrawCamera);
            }
#endif
        }
Exemplo n.º 3
0
        public override void Draw3D(Camera3D camera, GameObjectTag DrawTag)
        {
            if (lightState == BasicLight.LightState.Dead || MyEffect.get() != null)
            {
                base.Draw3D(camera, DrawTag);
                return;
            }

            MyEffect.get().CurrentTechnique.Passes[0].Apply();
            FullscreenQuad.Draw();

            base.Draw3D(camera, DrawTag);
        }
        void DrawFullscreenQuad(Texture2D texture, RenderTarget2D renderTarget,
                                Effect effect)
        {
            Game1.graphicsDevice.BlendState        = BlendState.Opaque;
            Game1.graphicsDevice.DepthStencilState = DepthStencilState.None;
            //Game1.graphicsDevice.SamplerStates[0] = SamplerState.PointClamp;
            Game1.graphicsDevice.SamplerStates[1] = SamplerState.PointClamp;

            Game1.graphicsDevice.SetRenderTarget(renderTarget);
            Game1.graphicsDevice.Clear(Color.Black);
            Game1.graphicsDevice.Textures[0] = texture;

            effect.Techniques[0].Passes[0].Apply();
            FullscreenQuad.Draw();
        }
Exemplo n.º 5
0
        public override void Draw3D(Camera3D camera, GameObjectTag DrawTag)
        {
            if (lightState == BasicLight.LightState.Dead || MyEffect.Holder != null)
            {
                base.Draw3D(camera, DrawTag);
                return;
            }

            DeferredLightEffect effect3D = (DeferredLightEffect)MyEffect.Holder;

            effect3D.SetTextureSize(ParentScene.WindowSize);
            effect3D.SetInverseCamera(camera);
            effect3D.MyEffect.CurrentTechnique.Passes[0].Apply();
            FullscreenQuad.Draw();

            base.Draw3D(camera, DrawTag);
        }
Exemplo n.º 6
0
        public override void Draw2D(GameObjectTag DrawTag)
        {
            if (FadeColor.A() > 0)
            {
                switch (FadeType.get())
                {
                default:
                    Game1.graphicsDevice.BlendState = BlendState.AlphaBlend;
                    BasicFadeEffect.CurrentTechnique.Passes[0].Apply();
                    BasicFadeColorParam.SetValue(FadeColor.get());

                    break;
                }

                FullscreenQuad.Draw();
            }

            base.Draw2D(DrawTag);
        }
Exemplo n.º 7
0
        public override void Draw2D(GameObjectTag DrawTag)
        {
#if EDITOR && WINDOWS
            if (!ParentLevel.LevelForEditing)
            {
#endif
            MasterManager.SetViewportToFullscreen();
            Game1.graphicsDevice.Clear(Color.Black);

#if EDITOR && WINDOWS
        }

        if (deferredControls.deferredMode == DeferredMode.Depth || deferredControls.deferredMode == DeferredMode.Normal || deferredControls.deferredMode == DeferredMode.Lighting)
        {
            Game1.graphicsDevice.BlendState        = BlendState.Opaque;
            Game1.graphicsDevice.SamplerStates[0]  = SamplerState.PointClamp;
            Game1.graphicsDevice.DepthStencilState = DepthStencilState.None;
            Game1.graphicsDevice.Textures[0]       = deferredControls.deferredMode == DeferredMode.Lighting ? LightMap : GBufferTargets[deferredControls.deferredMode == DeferredMode.Normal ? 0 : 1].RenderTarget;
            PasteEffect.CurrentTechnique.Passes[0].Apply();
            FullscreenQuad.Draw();
            objectControls.Draw3D(DrawCamera);
        }
        else
#endif
            if (DrawCamera != null)
            {
                Game1.graphicsDevice.BlendState        = BlendState.Opaque;
                Game1.graphicsDevice.DepthStencilState = DepthStencilState.None;

                Game1.graphicsDevice.SamplerStates[0] = SamplerState.PointClamp;
                Game1.graphicsDevice.Textures[0]      = FinalTarget;
                PasteEffect.CurrentTechnique.Passes[0].Apply();
                FullscreenQuad.Draw();
#if EDITOR && WINDOWS
                if (ParentLevel.LevelForEditing)
                {
                    objectControls.Draw3D(DrawCamera);
                }
#endif
            }
            base.Draw2D(DrawTag);
        }
Exemplo n.º 8
0
        private void DClearGBuffer()
        {
#if WINDOWS
            if (GBufferTargets[0].RenderTarget.IsDisposed || GBufferTargets[1].RenderTarget.IsDisposed)
            {
                SetWindowSize(WindowSize);
            }
#endif
#if XBOX
            if (GBufferTargets == null)
            {
                SetWindowSize(new Vector2(Game1.ResolutionX, Game1.ResolutionY));
            }
#endif
            Game1.graphicsDevice.BlendState        = BlendState.Opaque;
            Game1.graphicsDevice.DepthStencilState = DepthStencilState.None;
            Game1.graphicsDevice.SamplerStates[0]  = SamplerState.AnisotropicClamp;
            Game1.graphicsDevice.SamplerStates[1]  = SamplerState.PointClamp;
            Game1.graphicsDevice.SetRenderTargets(GBufferTargets);
            ClearEffect.CurrentTechnique.Passes[0].Apply();
            FullscreenQuad.Draw();
        }
        public override void Draw2D(GameObjectTag DrawTag)
        {
#if EDITOR && WINDOWS
            if (ParentLevel.LevelForEditing)
            {
                DrawScene(DrawCamera);
            }
            else
#endif
            {
                Game1.graphicsDevice.SetRenderTarget(null);
                Game1.graphicsDevice.Clear(Color.Black);

                Game1.graphicsDevice.BlendState        = BlendState.Opaque;
                Game1.graphicsDevice.DepthStencilState = DepthStencilState.None;

                Game1.graphicsDevice.Textures[0] = FinalTarget;
                PasteEffect.Techniques[0].Passes[0].Apply();

                FullscreenQuad.Draw();

                DrawScene(DrawCamera);
            }
        }