/// <summary>
    /// 插入到batches,batches是以一个QuadTreeNode为单位
    /// </summary>
    /// <param name="parent"></param>
    void BuildBatches(QuadTreeNode parent)
    {
        //如果没存在淡入淡出
        if (!Batches_TreeNodeFadeTable.ContainsKey(parent))
        {
            Effect.SceneFadeInOutMaterialFloat m_FadeFloat = gameObject.AddComponent <Effect.SceneFadeInOutMaterialFloat>();
            m_FadeFloat.PropertyName = SceneResInfo.CutOutKeyWorld;
            m_FadeFloat.RegisterFinishEvent(OnBatchesFadingFinish);
            m_FadeFloat.FadeOutDuartion = FadeTime;
            m_FadeFloat.FadeOutFrom     = 1.0f;
            m_FadeFloat.FadeOutTo       = 0.0f;
            m_FadeFloat.FadeTimer       = m_FadeFloat.FadeOutFrom;
            m_FadeFloat.enabled         = false;


            List <Material>                 FadeInstanceList     = new List <Material>();
            Dictionary <Material, int>      matIndexTable        = new Dictionary <Material, int>();
            Dictionary <Material, Material> matFadeInstanceTable = new Dictionary <Material, Material>();
            foreach (QuadTreeLeaves m_Leaves in parent.m_LeavesList)
            {
                SceneResInfo res = m_Leaves.m_ResInfo;
                //回调,给到每个具体的类里,恢复原本的材质球
                m_FadeFloat.RegisterFinishEvent(res.OnFadeFinish);

                if (res.CheckSupportFading())
                {
                    Material[] shareds     = res.hostRender.sharedMaterials;
                    int        sharedCount = shareds.Length;
                    for (int i = 0; i < sharedCount; i++)
                    {
                        //如果这是一个全新的材质球,就新建一个,然后加入的实例链表里
                        if (!matIndexTable.ContainsKey(shareds[i]))
                        {
                            Material matFadeIn = SceneResInfo.CreateFadeingMaterial(shareds[i]);
                            FadeInstanceList.Add(matFadeIn);
                            matFadeInstanceTable.Add(shareds[i], matFadeIn);
                            matIndexTable.Add(shareds[i], FadeInstanceList.Count - 1);
                            res.BatchesIDs.Add(FadeInstanceList.Count - 1);
                        }
                        else
                        {
                            res.BatchesIDs.Add(matIndexTable[shareds[i]]);
                        }
                    }
                }
            }

            foreach (QuadTreeLeaves m_Leaves in parent.m_LeavesList)
            {
                SceneResInfo res = m_Leaves.m_ResInfo;
                res.Init(matFadeInstanceTable, SceneCamera);
            }

            parent.FadeMaterialList    = FadeInstanceList;
            parent.isDistanceFadingIn  = false;
            parent.isDistanceFadingIn  = false;
            parent.bOpmitizedRendering = true;
            InvBatches_TreeNodeFadeTable.Add(m_FadeFloat, parent);
            Batches_TreeNodeFadeTable.Add(parent, m_FadeFloat);
        }
    }
    void FadeInFromOcclusCulling(SceneResInfo res, bool testLog = false)
    {
        if (!GoablEnabledOcclusCulling)
        {
            return;
        }

        if (!res || res.hostTreeNode == null)
        {
            return;
        }
        QuadTreeNode parent = res.hostTreeNode;

        if (!parent.bOpmitizedRendering)
        {
            if (!res.CheckSupportFading())
            {
                return;
            }

            Material[] matList = GetFadingMaterial(res);
            if (null == matList)
            {
                return;
            }
            res.UpdateOcclusFadeIn(matList);
            if (!parent.isDistanceFadingIn)
            {
                if (!res.occlusFadingOut)
                {
                    if (!res.occlusFadingIn)
                    {
                        res.occlusFadingIn  = true;
                        res.occlusFadingOut = false;

                        Effect.SceneFadeInOutMaterialFloat occlusFade = GetFadeInstance(res);
                        occlusFade.SetMaterialInstance(matList);
                        occlusFade.FadeOutDuartion = FadeTime;
                        occlusFade.FadeOutFrom     = 1;
                        occlusFade.FadeOutTo       = 0;
                        occlusFade.enabled         = true;
                        occlusFade.Play();
                    }
                }
                else
                {
                    res.occlusFadingIn  = true;
                    res.occlusFadingOut = false;

                    Effect.SceneFadeInOutMaterialFloat occlusFade = res.occlusFadInstance;
                    occlusFade.SetMaterialInstance(matList);
                    occlusFade.FadeOutDuartion = occlusFade.FadeTimer;
                    occlusFade.FadeOutFrom     = occlusFade.currentFloat;
                    occlusFade.FadeOutTo       = 0;
                    occlusFade.FadeTimer       = 0;



                    occlusFade.Update();

                    if (occlusFade)
                    {
                        occlusFade.ReStartFadeOutFinish_Constant();
                    }
                }
            }
            else
            {
                res.occlusFadingIn        = true;
                res.occlusFadingOut       = false;
                parent.isDistanceFadingIn = false;

                Effect.SceneFadeInOutMaterialFloat distanceFade = Batches_TreeNodeFadeTable[parent];
                Effect.SceneFadeInOutMaterialFloat occlusFade   = GetFadeInstance(res);
                occlusFade.enabled = true;


                occlusFade.SetMaterialInstance(matList);
                occlusFade.FadeOutDuartion = distanceFade.FadeTimer;
                occlusFade.FadeOutFrom     = distanceFade.currentFloat;
                occlusFade.FadeOutTo       = 0;
                occlusFade.FadeTimer       = 0;
                occlusFade.Update();

                if (occlusFade)
                {
                    occlusFade.Play();
                }


                distanceFade.enabled = false;
                distanceFade.Stop();
            }
        }
    }