Example #1
0
    private void GenerateChunkMesh()
    {
        ChunkMeshGenerationJob meshGenerationJob = new ChunkMeshGenerationJob()
        {
            cornerTable           = MarchingCubes.cornerTable,
            edgeTable             = MarchingCubes.edgeTable,
            triangleTable         = MarchingCubes.triangleTable,
            vertices              = _chunkMeshVertices,
            numElements           = _chunkNumElements,
            terrainHeightMap      = _chunkHeightMap,
            terrainSurfaceLevel   = surfaceLevel,
            axisDimensionsInCubes = new int3(width + 1, height + 1, depth + 1),
            numNodesPerAxis       = new int3(width + 2, height + 2, depth + 2),
        };

        if (animateCubeMarching)
        {
            meshGenerationJob.numCubes = _currentMarchingCubeCounter;
        }
        else
        {
            meshGenerationJob.numCubes = _totalNumCubes;
        }

        meshGenerationJob.Schedule().Complete();
    }
Example #2
0
    private void GenerateChunkMesh()
    {
        ChunkMeshGenerationJob meshGenerationJob = new ChunkMeshGenerationJob()
        {
            cornerTable           = MarchingCubes.cornerTable,
            edgeTable             = MarchingCubes.edgeTable,
            triangleTable         = MarchingCubes.triangleTable,
            vertices              = _meshVertices,
            numElements           = _numElements,
            terrainHeightMap      = _heightMap,
            terrainSurfaceLevel   = 0,
            axisDimensionsInCubes = new int3(1, 1, 1),
            numNodesPerAxis       = new int3(2, 2, 2),
        };

        meshGenerationJob.Schedule().Complete();
        ConstructChunkMesh();
    }