/// <summary>
    /// 插入碰撞盒四叉树
    /// </summary>
    void InsetEffectQuadTree()
    {
        foreach (SceneEffectInfo res in EffectInfoList)
        {
            if (!isVaildEffect(res))
            {
                continue;
            }

            Vector2 pos2D = Vector2.zero;

            pos2D.x = res.transform.position.x;
            pos2D.y = res.transform.position.z;

            QuadTreeNode p = GetQuadTreeParent(EffectRootParent, pos2D);
            if (null != p)
            {
                QuadTreeLeaves leaf = new QuadTreeLeaves();
                leaf.m_EffectInfo = res;
                leaf.m_Parent     = p;
                p.m_LeavesList.Add(leaf);
            }

            if (res.isAlwaysNormal)
            {
                res.UnOptimitzed();
            }
        }
    }
 /// <summary>
 /// 插入资源四叉树
 /// </summary>
 void InsetGrassResQuadTree()
 {
     foreach (SceneResInfo res in GrassResInfoList)
     {
         if (!isVaildGrassRes(res))
         {
             continue;
         }
         Vector2 pos2D = Vector2.zero;
         pos2D.x = res.RefPos.x;
         pos2D.y = res.RefPos.z;
         QuadTreeNode p = GetQuadTreeParent(GrassResRootParent, pos2D);
         if (null != p)
         {
             QuadTreeLeaves leaf = new QuadTreeLeaves();
             leaf.m_ResInfo = res;
             leaf.m_Parent  = p;
             p.m_LeavesList.Add(leaf);
             res.hostTreeNode = p;
             if (!Batches_AllGrassResParentNode.Contains(p))
             {
                 Batches_AllGrassResParentNode.Add(p);
             }
         }
     }
 }
Esempio n. 3
0
 void ProcessUnUsedLightInfo(int start, int end, List <QuadTreeLeaves> list)
 {
     if (list.Count > 0)
     {
         for (int i = start; i < end; i++)
         {
             QuadTreeLeaves leaf = list[i];
             leaf.m_LightInfo.Optimitzed();
         }
     }
 }
 void UpdateColliderInfo(int start, int end, List <QuadTreeLeaves> list)
 {
     if (list.Count > 0)
     {
         for (int i = start; i < end; i++)
         {
             QuadTreeLeaves leaf = list[i];
             leaf.m_ColliderInfo.OnUpdate(SceneCamera);
         }
     }
 }
Esempio n. 5
0
 void UpdateLightInfo(int start, int end, List <QuadTreeLeaves> list)
 {
     if (list.Count > 0)
     {
         for (int i = start; i < end; i++)
         {
             QuadTreeLeaves leaf = list[i];
             leaf.m_LightInfo.UnOptimitzed();
             //leaf.m_LightInfo.InfoUpdate();
         }
     }
 }
 void ProcessUnUsedAlwaysVisibleResInfo(int start, int end, List <QuadTreeLeaves> list)
 {
     if (list.Count > 0)
     {
         for (int i = start; i < end; i++)
         {
             QuadTreeLeaves leaf = list[i];
             leaf.m_ResInfo.OptimitzedRendering(null);
             leaf.m_ResInfo.OnUpdate(SceneCamera);
         }
     }
 }
    void OptimitzedBaatchesRendering(QuadTreeNode parent)
    {
        if (!parent.bOpmitizedRendering)
        {
            Effect.SceneFadeInOutMaterialFloat m_FadeFloat = null;

            parent.bOpmitizedRendering = true;

            int length = parent.m_LeavesList.Count;
            for (int j = 0; j < length; j++)
            {
                QuadTreeLeaves leaf = parent.m_LeavesList[j];
                leaf.m_ResInfo.OptimitzedMemory();
                leaf.m_ResInfo.OptimitzedRendering(parent.FadeMaterialList);
            }



            if (Batches_TreeNodeFadeTable.TryGetValue(parent, out m_FadeFloat))
            {
                m_FadeFloat.SetMaterialInstance(parent.FadeMaterialList);
                m_FadeFloat.enabled = true;

                parent.isDistanceFadingOut = true;

                if (!parent.isDistanceFadingIn)
                {
                    m_FadeFloat.FadeOutFrom     = 0.0f;
                    m_FadeFloat.FadeOutTo       = 1.0f;
                    m_FadeFloat.FadeOutDuartion = FadeTime;
                    m_FadeFloat.Play();
                }
                else
                {
                    m_FadeFloat.FadeOutDuartion = m_FadeFloat.FadeTimer;
                    m_FadeFloat.FadeOutFrom     = m_FadeFloat.currentFloat;
                    m_FadeFloat.FadeOutTo       = 1;
                    m_FadeFloat.FadeTimer       = 0;
                    m_FadeFloat.Update();
                    m_FadeFloat.ReStartFadeOutFinish_Constant();
                }

                parent.isDistanceFadingIn = false;
            }
        }
    }
Esempio n. 8
0
    /// <summary>
    /// 插入资源四叉树
    /// </summary>
    void InsetLightQuadTree()
    {
        foreach (SceneLightInfo res in LightInfoList)
        {
            if (!isVaildLight(res))
            {
                continue;
            }

            Vector2 pos2D = Vector2.zero;
            pos2D.x = res.transform.position.x;
            pos2D.y = res.transform.position.z;
            QuadTreeNode p = GetQuadTreeParent(LightRootParent, pos2D);
            if (null != p)
            {
                QuadTreeLeaves leaf = new QuadTreeLeaves();
                leaf.m_LightInfo = res;
                leaf.m_Parent    = p;
                p.m_LeavesList.Add(leaf);
            }
        }
    }
    /// <summary>
    /// 插入碰撞盒四叉树
    /// </summary>
    void InsetColliderQuadTree()
    {
        foreach (SceneColliderInfo res in ColliderInfoList)
        {
            if (!isVaildCollider(res))
            {
                continue;
            }

            Vector2 pos2D = Vector2.zero;
            pos2D.x = res.RefPos.x;
            pos2D.y = res.RefPos.z;
            QuadTreeNode p = GetQuadTreeParent(ColliderRootParent, pos2D);
            if (null != p)
            {
                QuadTreeLeaves leaf = new QuadTreeLeaves();
                leaf.m_ColliderInfo = res;
                leaf.m_Parent       = p;
                p.m_LeavesList.Add(leaf);
            }
        }
    }
    /// <summary>
    /// 插入总是可见的资源四叉树,与普通的分开管理
    /// </summary>
    void InsetAlwaysVisibleResQuadTree()
    {
        foreach (SceneResInfo res in ResInfoList)
        {
            if (!isVaildAlwaysVisibleRes(res))
            {
                continue;
            }
            Vector2 pos2D = Vector2.zero;
            pos2D.x = res.RefPos.x;
            pos2D.y = res.RefPos.z;

            QuadTreeNode p = GetQuadTreeParent(AlwaysVisibleResRootParent, pos2D);
            if (null != p)
            {
                QuadTreeLeaves leaf = new QuadTreeLeaves();
                res.Init(null, SceneCamera);
                leaf.m_ResInfo   = res;
                leaf.m_Parent    = p;
                res.hostTreeNode = p;
                p.m_LeavesList.Add(leaf);
            }
        }
    }