コード例 #1
0
        public override void PreDraw()
        {
#if EDITOR && WINDOWS
            if (!ParentLevel.LevelForEditing)
#endif
            {
                distortionRenderer.SetRenderTarget();

                Camera3D currentCamera = null;

                foreach (WorldViewer3D s in WorldViewerChildren)
                {
                    Render.CurrentWorldViewer3D = s;
                    s.getSceneView().Set();
                    Render.CurrentView = s.getSceneView();
                    currentCamera      = s.getCamera();
                    CurrentCamera      = currentCamera;

                    foreach (GameObject g in DistortionChildren)
                    {
                        g.Draw3D(currentCamera, GameObjectTag._3DDistortion);
                    }

                    InstanceManager.DrawDistortion(currentCamera);
                    ParticleManager.DrawDistortion(currentCamera);
                }
            }

            Game1.graphicsDevice.SetRenderTarget(FinalTarget);
            Game1.graphicsDevice.Clear(Color.Black);

#if EDITOR && WINDOWS
            if (!ParentLevel.LevelForEditing)
#endif
            {
                Camera3D currentCamera = null;

                foreach (WorldViewer3D s in WorldViewerChildren)
                {
                    Game1.graphicsDevice.BlendState        = BlendState.Opaque;
                    Game1.graphicsDevice.DepthStencilState = DepthStencilState.None;

                    Render.CurrentWorldViewer3D = s;
                    if (s.GetType().Equals(typeof(PlayerShip)))
                    {
                        DrawingShip = (PlayerShip)s;
                    }

                    s.getSceneView().Set();
                    Render.CurrentView = s.getSceneView();
                    currentCamera      = s.getCamera();
                    CurrentCamera      = currentCamera;


                    foreach (GameObject g in BackgroundChildren)
                    {
                        g.Draw3D(currentCamera, GameObjectTag._3DBackground);
                    }

                    Game1.graphicsDevice.DepthStencilState = DepthStencilState.Default;
                    Game1.graphicsDevice.BlendState        = BlendState.AlphaBlend;

                    foreach (GameObject g in ForwardChildren)
                    {
                        g.Draw3D(currentCamera, GameObjectTag._3DForward);
                    }

                    InstanceManager.DrawShield(currentCamera);

                    ParticleManager.PreDraw(currentCamera);

                    InstanceManager.Draw(currentCamera);

                    ParticleManager.Draw(currentCamera);

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

                    foreach (GameObject g in DepthOverChildren)
                    {
                        g.Draw3D(currentCamera, GameObjectTag._3DForward);
                    }
                }

                MasterManager.SetViewportToFullscreen();
            }
        }