Пример #1
0
            CaveMeshes BuildCaveMesh(WallGrid grid, IHeightMap heightMap)
            {
                MeshData floorPreMesh = MeshGenerator.BuildFloor(grid, heightMap);
                Mesh     floorMesh    = floorPreMesh.CreateMesh();

                return(new CaveMeshes(floorMesh));
            }
Пример #2
0
        Mesh CreateMesh()
        {
            var        wallGrid  = new WallGrid(new byte[size, size], Vector3.zero, scale);
            IHeightMap heightMap = heightMapModule.GetHeightMap();
            MeshData   preMesh   = MeshGenerator.BuildFloor(wallGrid, heightMap);

            return(preMesh.CreateMesh());
        }
Пример #3
0
            static CaveMeshes[,] GenerateCaveChunks(Map[,] mapChunks, ThreeTierCaveType type, int scale, IHeightMap floor, IHeightMap ceiling)
            {
                int xNumChunks = mapChunks.GetLength(0);
                int yNumChunks = mapChunks.GetLength(1);
                var caveChunks = new CaveMeshes[xNumChunks, yNumChunks];
                var actions    = new Action[mapChunks.Length];

                mapChunks.ForEach((x, y) =>
                {
                    Coord index = new Coord(x, y);
                    actions[y * xNumChunks + x] = new Action(() =>
                    {
                        WallGrid grid        = MapConverter.MapToWallGrid(mapChunks[x, y], scale, index);
                        MeshData floorMesh   = MeshGenerator.BuildFloor(grid, floor);
                        MeshData ceilingMesh = SelectCeilingBuilder(type)(grid, ceiling);
                        MeshData wallMesh    = MeshGenerator.BuildWalls(grid, floor, ceiling);

                        caveChunks[index.x, index.y] = new CaveMeshes(floorMesh, wallMesh, ceilingMesh);
                    });
                });
                Execute(actions);
                return(caveChunks);
            }