// External public Chunk GenerateChunk(Vector2DI inChunkPos) { Chunk.Data newChunkData = _chunkDataGenerator.Generate(inChunkPos); Chunk.View newChunkView = _chunkViewGenerator.Generate(inChunkPos, newChunkData); Chunk newChunk = new Chunk(newChunkData, newChunkView, _world); return(newChunk); }
// External public Chunk.View Generate(Vector2DI inPosition, Chunk.Data inChunkData) { GameObject newChunkGO = new GameObject("Chunk"); MeshFilter meshFilter = newChunkGO.AddComponent <MeshFilter>(); MeshRenderer meshRenderer = newChunkGO.AddComponent <MeshRenderer>(); meshRenderer.material = _chunkMaterial; newChunkGO.transform.position = new Vector3(inPosition.x, 0, inPosition.y); MeshGenerator.Output meshData = _meshGenerator.Generate(inChunkData); ApplyMesh(meshFilter, meshData); Chunk.View newChunkView = new Chunk.View(newChunkGO); return(newChunkView); }
public void RegenerateChunkView(Chunk.Data inChunkData, Chunk.View inChunkView) { _chunkViewGenerator.RegenerateChunkUV2(inChunkData, inChunkView); }
public void RegenerateChunkUV2(Chunk.Data inChunkData, Chunk.View inChunkView) { inChunkView.mesh.uv2 = _meshGenerator.GenerateUV2(inChunkData); }