Beispiel #1
0
 protected override void OnAwake()
 {
     m_multiThreading = 1 < SystemInfo.processorCount;
     if (m_multiThreading)
     {
         ThreadPool.InitInstance();
     }
     base.OnAwake();
     m_selfTransform = transform;
     m_meshState     = MeshState.Uncreated;
     if (m_meshTree != null)
     {
         if (!m_meshTree.IsBuildFinished())
         {
             if (m_meshTree.IsPrebuilt())
             {
                 m_meshTree.BuildFromPrebuiltData();
                 if (Debug.isDebugBuild || Application.isEditor)
                 {
                     CheckError();
                 }
             }
             else
             {
                 m_meshTree.AsyncBuild();
             }
         }
         m_search = m_meshTree.CreateSearch();
     }
 }
Beispiel #2
0
        public override void Search(MeshTreeSearch search)
        {
            if (!(search is OctMeshTreeSearch))
            {
                Debug.LogError("Invalid MeshTreeSearch class!");
                return;
            }
            var octSearch = (OctMeshTreeSearch)search;

            octSearch.Initialize();
            Search(octSearch, ref m_treeNodes[m_treeNodes.Length - 1], m_bounds.center, m_bounds.extents);
            if (search.m_bOutputNormals && m_normals != null && 0 < m_normals.Length)
            {
                octSearch.Finalize(m_vertices, m_indices, m_normals);
            }
            else
            {
                octSearch.Finalize(m_vertices, m_indices);
            }
        }
Beispiel #3
0
        public override void Search(MeshTreeSearch search)
        {
            if (!(search is BinaryMeshTreeSearch))
            {
                Debug.LogError("Invalid MeshTreeSearch class!");
                return;
            }
            var binSearch = (BinaryMeshTreeSearch)search;

            binSearch.Initialize();
            Search(binSearch, ref m_treeNodes[m_treeNodes.Length - 1]);
            if (search.m_bOutputNormals && m_normals != null && 0 < m_normals.Length)
            {
                binSearch.Finalize(m_vertices, m_indices, m_normals);
            }
            else
            {
                binSearch.Finalize(m_vertices, m_indices);
            }
        }
Beispiel #4
0
        public override void Search(MeshTreeSearch search)
        {
            if (!(search is TerrainMeshTreeSearch))
            {
                if (Debug.isDebugBuild || Application.isEditor)
                {
                    Debug.LogError("Invalid MeshTreeSearch class!");
                }
                return;
            }
            var terrainSearch = (TerrainMeshTreeSearch)search;

            terrainSearch.Initialize();
            Search(terrainSearch, ref m_treeNodes[m_treeNodes.Length - 1], m_bounds.extents, 0, 0, m_heightMapWidth);
            if (search.m_bOutputNormals)
            {
                terrainSearch.FinalizeWithNormal(m_heightMap, m_scale.x, m_scale.z);
            }
            else
            {
                terrainSearch.Finalize(m_heightMap, m_scale.x, m_scale.z);
            }
        }
Beispiel #5
0
 public abstract void Search(MeshTreeSearch search);