예제 #1
0
        internal static void PrepareCulling()
        {
            m_cullQuery.Reset();
            m_wavefront.Clear();

            // add main camera
            AddCamera(ref MyEnvironment.ViewD, ref MyEnvironment.OriginalProjectionD,
                      new MyViewport(MyRender11.ViewportResolution.X, MyRender11.ViewportResolution.Y),
                      MyGBuffer.Main);
            m_cullQuery.FrustumQueries[m_wavefront.Count - 1].Type = MyFrustumEnum.MainFrustum;

            MyShadows.PrepareShadowmaps();
            foreach (var query in MyShadows.ShadowMapQueries)
            {
                bool isCascade = query.QueryType == MyFrustumEnum.ShadowCascade;
                AddShadowCaster(new BoundingFrustumD(query.ProjectionInfo.WorldToProjection), query.ProjectionInfo.CurrentLocalToProjection, query.Viewport, query.DepthBuffer, isCascade, query.QueryType.ToString());

                if (isCascade)
                {
                    var smallCulling = new MyCullingSmallObjects();
                    smallCulling.ProjectionDir    = query.ProjectionDir;
                    smallCulling.ProjectionFactor = query.ProjectionFactor;
                    smallCulling.SkipThreshhold   = MyRender11.Settings.ShadowCascadeSmallSkipThresholds[query.CascadeIndex];
                    m_cullQuery.FrustumQueries[m_wavefront.Count - 1].SmallObjects = smallCulling;
                    m_cullQuery.FrustumQueries[m_wavefront.Count - 1].CascadeIndex = query.CascadeIndex;
                }

                m_cullQuery.FrustumQueries[m_wavefront.Count - 1].Type    = query.QueryType;
                m_cullQuery.FrustumQueries[m_wavefront.Count - 1].Ignored = query.IgnoredEntities;
            }
        }
예제 #2
0
        internal static void PrepareCulling()
        {
            m_cullQuery.Reset();
            m_wavefront.Clear();

            // add main camera
            AddCamera(ref MyEnvironment.View, ref MyEnvironment.Projection,
                      new MyViewport(MyRender11.ViewportResolution.X, MyRender11.ViewportResolution.Y),
                      MyGBuffer.Main);
            m_cullQuery.FrustumQuery[m_wavefront.Count - 1].Type = MyFrustumEnum.MainFrustum;

            MyShadows.ResetShadowmaps();
            foreach (var query in MyShadows.ShadowmapList)
            {
                bool isCascade = query.QueryType == MyFrustumEnum.Cascade0 || query.QueryType == MyFrustumEnum.Cascade1 || query.QueryType == MyFrustumEnum.Cascade2 || query.QueryType == MyFrustumEnum.Cascade3;
                AddShadowCaster(new BoundingFrustum(query.ProjectionInfo.WorldToProjection), query.ProjectionInfo.CurrentLocalToProjection, query.Viewport, query.DepthBuffer, isCascade, query.QueryType.ToString());

                if (query.QueryType == MyFrustumEnum.Cascade0)
                {
                    var smallCulling = new MyCullingSmallObjects();
                    smallCulling.ProjectionDir    = query.ProjectionDir;
                    smallCulling.ProjectionFactor = 1;// query.projectionFactor;
                    smallCulling.SkipThreshhold   = MyRender11.Settings.Cascade0SmallSkip;
                    m_cullQuery.FrustumQuery[m_wavefront.Count - 1].SmallObjects = smallCulling;
                }
                else if (query.QueryType == MyFrustumEnum.Cascade1)
                {
                    var smallCulling = new MyCullingSmallObjects();
                    smallCulling.ProjectionDir    = query.ProjectionDir;
                    smallCulling.ProjectionFactor = 1;// query.projectionFactor;
                    smallCulling.SkipThreshhold   = MyRender11.Settings.Cascade1SmallSkip;
                    m_cullQuery.FrustumQuery[m_wavefront.Count - 1].SmallObjects = smallCulling;
                }
                else if (query.QueryType == MyFrustumEnum.Cascade2)
                {
                    var smallCulling = new MyCullingSmallObjects();
                    smallCulling.ProjectionDir    = query.ProjectionDir;
                    smallCulling.ProjectionFactor = 1;// query.projectionFactor;
                    smallCulling.SkipThreshhold   = MyRender11.Settings.Cascade2SmallSkip;
                    m_cullQuery.FrustumQuery[m_wavefront.Count - 1].SmallObjects = smallCulling;
                }
                else if (query.QueryType == MyFrustumEnum.Cascade3)
                {
                    var smallCulling = new MyCullingSmallObjects();
                    smallCulling.ProjectionDir    = query.ProjectionDir;
                    smallCulling.ProjectionFactor = 1;// query.projectionFactor;
                    smallCulling.SkipThreshhold   = MyRender11.Settings.Cascade3SmallSkip;
                    m_cullQuery.FrustumQuery[m_wavefront.Count - 1].SmallObjects = smallCulling;
                }

                m_cullQuery.FrustumQuery[m_wavefront.Count - 1].Type    = query.QueryType;
                m_cullQuery.FrustumQuery[m_wavefront.Count - 1].Ignored = query.IgnoredEntities;
            }
        }
예제 #3
0
 private void EndFrame()
 {
     m_cullQuery.Reset();
 }