Beispiel #1
0
        public static void LoadContent()
        {
            MyMwcLog.WriteLine("MyRender.LoadContent - START");
            MyMwcLog.IncreaseIndent();

            MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartProfilingBlock("MyRender::LoadContent");
            UnloadContent(false); //Because XNA does not do this automatically

            m_device = MyMinerGame.Static.GraphicsDevice;

            CreateRenderTargets();
            CreateEnvironmentMapsRT(MyRenderConstants.ENVIRONMENT_MAP_SIZE);

            MyMwcLog.WriteLine("CreateRandomTexture");

            m_randomTexture = CreateRandomTexture();

            MyShadowRendererBase.LoadContent();

            MyOcclusionQueries.LoadContent(m_device);

            LoadEffects();

            MyMwcLog.WriteLine("MyShadowRenderer");

            if (m_shadowRenderer == null)
            {
#if RENDER_PROFILING
                //m_shadowRenderer = new MyShadowRenderer(GetShadowCascadeSize(), MyRenderTargets.ShadowMap, false);
                m_shadowRenderer = new MyShadowRenderer(GetShadowCascadeSize(), MyRenderTargets.ShadowMap, MyRenderTargets.ShadowMapZBuffer, true);
#else
                m_shadowRenderer = new MyShadowRenderer(GetShadowCascadeSize(), MyRenderTargets.ShadowMap, MyRenderTargets.ShadowMapZBuffer, true);
#endif
            }

            MyMwcLog.WriteLine("SpotShadowRenderer");

            if (m_spotShadowRenderer == null)
            {
                m_spotShadowRenderer = new MySpotShadowRenderer();
            }

            MyMwcLog.WriteLine("InitQueries");

            List <MyElement> list = new List <MyElement>();
            BoundingBox      aabb = new BoundingBox(new Vector3(float.MinValue), new Vector3(float.MaxValue));
            m_cullingStructure.OverlapAllBoundingBox(ref aabb, list);
            foreach (MyCullableRenderObject element in list)
            {
                element.InitQueries();
            }

            MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().EndProfilingBlock();

            MyMwcLog.DecreaseIndent();
            MyMwcLog.WriteLine("MyRender.LoadContent - END");
        }
        public static void LoadContent()
        {
            MyMwcLog.WriteLine("MyRender.LoadContent - START");
            MyMwcLog.IncreaseIndent();

            MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartProfilingBlock("MyRender::LoadContent");
            UnloadContent(false); //Because XNA does not do this automatically

            m_device = MyMinerGame.Static.GraphicsDevice;

            CreateRenderTargets();
            CreateEnvironmentMapsRT(MyRenderConstants.ENVIRONMENT_MAP_SIZE);

            MyMwcLog.WriteLine("CreateRandomTexture");

            m_randomTexture = CreateRandomTexture();

            MyShadowRendererBase.LoadContent();

            MyOcclusionQueries.LoadContent(m_device);

            LoadEffects();

            MyMwcLog.WriteLine("MyShadowRenderer");

            if (m_shadowRenderer == null)
            {
#if RENDER_PROFILING
                //m_shadowRenderer = new MyShadowRenderer(GetShadowCascadeSize(), MyRenderTargets.ShadowMap, false);
                m_shadowRenderer = new MyShadowRenderer(GetShadowCascadeSize(), MyRenderTargets.ShadowMap, MyRenderTargets.ShadowMapZBuffer, true);
#else
                m_shadowRenderer = new MyShadowRenderer(GetShadowCascadeSize(), MyRenderTargets.ShadowMap, MyRenderTargets.ShadowMapZBuffer, true);
#endif
            }

            MyMwcLog.WriteLine("SpotShadowRenderer");

            if (m_spotShadowRenderer == null)
                m_spotShadowRenderer = new MySpotShadowRenderer();

            MyMwcLog.WriteLine("InitQueries");

            List<MyElement> list = new List<MyElement>();
            BoundingBox aabb = new BoundingBox(new Vector3(float.MinValue), new Vector3(float.MaxValue));
            m_cullingStructure.OverlapAllBoundingBox(ref aabb, list);
            foreach (MyCullableRenderObject element in list)
            {
                element.InitQueries();
            }

            MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().EndProfilingBlock();

            MyMwcLog.DecreaseIndent();
            MyMwcLog.WriteLine("MyRender.LoadContent - END");
        }
Beispiel #3
0
            public List <MyRenderElement> TransparentRenderElementsToDraw; // if null, MyEntities.Draw() will be used

            public void Clear()
            {
                CallerID = null;

                RenderTargets    = null;
                CameraPosition   = null;
                ViewMatrix       = null;
                ProjectionMatrix = null;
                AspectRatio      = null;
                Fov      = null;
                Viewport = null;

                LodTransitionNear            = null;
                LodTransitionFar             = null;
                LodTransitionBackgroundStart = null;
                LodTransitionBackgroundEnd   = null;

                EnableHDR                = null;
                EnableLights             = null;
                EnableSun                = null;
                ShadowRenderer           = null;
                EnableShadowInterleaving = null;
                EnableSmallLights        = null;
                EnableSmallLightShadows  = null;
                EnableDebugHelpers       = null;
                EnableEnvironmentMapping = null;
                EnableNear               = null;

                BackgroundColor = null;

                EnableOcclusionQueries = true;
                EnableZoom             = true;
                FogMultiplierMult      = 1.0f;
                DepthToAlpha           = false;

                EnabledModules       = null;
                EnabledPostprocesses = null;
                EnabledRenderStages  = null;
            }