Beispiel #1
0
        public void GenerateMeshTerrain()
        {
            _objects = new List <ObjectData>();
            for (int i = 0; i <= MeshTerrainMeshSourceList.Count - 1; i++)
            {
                if (MeshTerrainMeshSourceList[i].MeshRenderer.GetComponent <MeshFilter>().sharedMesh == null)
                {
                    continue;
                }
                ObjectData o = new ObjectData(MeshTerrainMeshSourceList[i].MeshRenderer, (int)MeshTerrainMeshSourceList[i].TerrainSourceID);
                if (o.IsValid)
                {
                    _objects.Add(o);
                }
            }
            BVH.Build(ref _objects, out _nodes, out Tris, out _finalPrims);
            BVH.BuildLbvhData(_nodes, _finalPrims, out MeshTerrainData.lNodes, out MeshTerrainData.lPrims);

            MeshTerrainData.Bounds = CalculateTerrainBounds();

#if UNITY_EDITOR
            EditorUtility.SetDirty(MeshTerrainData);
#endif
            //GenerateCellCoverage();
            CreateNativeArrays();

            VegetationStudioManager.RefreshTerrainArea(TerrainBounds);
        }