CaveMeshes BuildCaveMesh(WallGrid grid, IHeightMap heightMap) { MeshData floorPreMesh = MeshGenerator.BuildFloor(grid, heightMap); Mesh floorMesh = floorPreMesh.CreateMesh(); return(new CaveMeshes(floorMesh)); }
MeshGenerator PrepareMeshGenerator(MeshGenerator meshGenerator, Map map) { WallGrid wallGrid = MapConverter.ToWallGrid(map, config.Scale); meshGenerator.Generate(wallGrid, config.CaveType, floorHeightMap, ceilingHeightMap); return(meshGenerator); }
public override GameObject Generate() { int scale = configuration.Scale; Map map = configuration.MapGenerator.Generate(); Material floorMaterial = configuration.Material; IHeightMap heightMap = configuration.HeightMapModule.GetHeightMap(); OutlineModule outlinePrefabber = configuration.OutlineModule; GameObject cave = new GameObject("Cave"); Map[,] mapChunks = MapSplitter.Subdivide(map); mapChunks.ForEach((x, y) => { Coord index = new Coord(x, y); WallGrid grid = MapConverter.MapToWallGrid(mapChunks[x, y], scale, index); List <Vector3[]> outlines = meshGenerator.BuildOutlines(grid); CaveMeshes caveMeshes = BuildCaveMesh(grid, heightMap); Sector sector = BuildSector(caveMeshes, index, cave, floorMaterial); GameObject rockAnchor = BuildRockAnchor(sector.GameObject, index); BuildOutline(outlines, outlinePrefabber, rockAnchor.transform); }); return(cave); }
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()); }
public BotFactory(Maze maze, EngineSettings settings, WallGrid walls, BrainFactory brainFactory, EyeFactory eyeFactory) { _maze = maze; _settings = settings; _walls = walls; _brainFactory = brainFactory; _eyeFactory = eyeFactory; }
void CreateMesh() { var wallGrid = new WallGrid(new byte[size, size], Vector3.zero); IHeightMap heightMap = parameters.ToHeightMap(); CaveMeshes meshes = MeshGenerator.GenerateCaveMeshes(wallGrid, CaveType.Isometric, heightMap, heightMap); mesh = meshes.Floor; }
public GameObject Generate(RockCaveConfiguration config, bool randomizeSeeds) { if (config == null) { throw new ArgumentNullException("config"); } string message = config.Validate(); if (message.Length > 0) { throw new ArgumentException(message, "config"); } if (randomizeSeeds) { config.SetSeed(GetRandomSeed()); } int scale = config.Scale; Map map = config.MapGenerator.Generate(); Material floorMaterial = config.Material; IHeightMap heightMap = config.HeightMapModule.GetHeightMap(); IOutlinePrefabber outlinePrefabber = config.OutlineModule.GetOutlinePrefabber(); GameObject cave = new GameObject("Cave"); Map[,] mapChunks = MapSplitter.Subdivide(map); mapChunks.ForEach((x, y) => { Coord index = new Coord(x, y); WallGrid grid = MapConverter.MapToWallGrid(mapChunks[x, y], scale, index); List <Vector3[]> outlines = MeshGenerator.BuildOutlines(grid); CaveMeshes caveMeshes = BuildCaveMesh(grid, heightMap); Sector sector = BuildSector(caveMeshes, index, cave, floorMaterial); GameObject rockAnchor = BuildRockAnchor(sector.GameObject, index); PlaceRocks(outlines, outlinePrefabber, rockAnchor.transform); }); return(cave); }
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); }