Assets/Examples/Scripts/Chunk.cs
/// <summary>
/// Completes the mesh generation job and updates the MeshFilter's and the MeshCollider's meshes.
/// </summary>
Completes the mesh generation job and updates the MeshFilter's and the MeshCollider's meshes.
Completes the mesh generation job and updates the MeshFilter ' s and the MeshCollider ' s meshes .
private void CompleteMeshGeneration()
        {
            MarchingCubesJobHandle.Complete();
            Vector3[] vertices = new Vector3[_counter.Count * 3];
            int[] triangles = new int[_counter.Count * 3];
            if (_counter.Count * 3 > 0)
            {
                _outputVertices.Slice(0, vertices.Length).CopyToFast(vertices);
                _outputTriangles.Slice(0, triangles.Length).CopyToFast(triangles);
            }
            _counter.Dispose();
            _mesh.Clear();
            _mesh.vertices = vertices;
            _mesh.SetTriangles(triangles, 0);
            _mesh.RecalculateNormals();
            _meshFilter.sharedMesh = _mesh;
            _meshCollider.sharedMesh = _mesh;
            _creatingMesh = false;
        }
private void CompleteMeshGeneration ( ) { MarchingCubesJobHandle . Complete ( ) ; Vector3 [ ] vertices = new Vector3 [ _counter . Count * 3 ] ; int [ ] triangles = new int [ _counter . Count * 3 ] ; if ( _counter . Count * 3 > 0 ) { _outputVertices . Slice ( 0 , vertices . Length ) . CopyToFast ( vertices ) ; _outputTriangles . Slice ( 0 , triangles . Length ) . CopyToFast ( triangles ) ; } _counter . Dispose ( ) ; _mesh . Clear ( ) ; _mesh . vertices = vertices ; _mesh . SetTriangles ( triangles , 0 ) ; _mesh . RecalculateNormals ( ) ; _meshFilter . sharedMesh = _mesh ; _meshCollider . sharedMesh = _mesh ; _creatingMesh = false ; }
Completes the mesh generation job and updates the MeshFilter's and the MeshCollider's meshes.
Completes the mesh generation job and updates the MeshFilter ' s and the MeshCollider ' s meshes .