public bool Set(System.Byte x, System.Byte y, System.Byte z, _Element value, bool replace = true) { if (_allocSize == 0) { this.Create(0xFF); } var index = HashInt(x, y, z) & _allocSize; var entry = _data[index]; while (entry != null) { var pos = entry.position; if (pos.x == x && pos.y == y && pos.z == z) { if (replace) { _data[index].value = value; return(true); } return(false); } index = (index + 1) & _allocSize; entry = _data[index]; } if (value != null) { _data[index] = new VoxelDataNode <Vector3 <System.Byte>, _Element>(new Vector3 <System.Byte>(x, y, z), value); _count++; if (_count >= _allocSize) { this.Grow(); } return(true); } return(false); }
private bool Grow(VoxelDataNode <Vector3 <System.Byte>, _Element> data) { var pos = data.position; var index = HashInt(pos.x, pos.y, pos.z) & _allocSize; var entry = _data[index]; while (entry != null) { index = (index + 1) & _allocSize; entry = _data[index]; } if (data.value != null) { _data[index] = data; _count++; return(true); } return(false); }