//TODO: Dont store when chunk knows he stored before public void Store(Vector3Int anchorPos, float[] noise) { StoredChunkEdits edits; if (!TryGetStoredEditsAt(anchorPos, out edits)) { edits = new StoredChunkEdits(); StorageTreeRoot r = GetOrCreateStorageGroupAtCoordinate(PositionToStorageGroupCoord(anchorPos)); r.SetLeafAtPosition(anchorPos, edits, true); } edits.vals = noise; }
public bool TryGetStoredEditsAt(Vector3Int pos, out StoredChunkEdits edits) { Vector3Int coord = PositionToStorageGroupCoord(pos); if (storageGroups.TryGetValue(coord, out StorageTreeRoot chunkGroup)) { if (chunkGroup.HasChild) { if (chunkGroup.TryGetLeafAtGlobalPosition(pos, out edits)) { return(true); } } } edits = null; return(false); }
public void StoreChunk(StoredChunkEdits storage) { storage.noise = Points; //storage.originalCubePositions = GetCurrentCubePositions(); }