public Block(int x, int y, int z, int lod, int size, VoxelObject voxelObject) { this.x = x; this.y = y; this.z = z; this.lod = lod; this.size = size; this.id = GenerateId(x, y, z, lod); this.spacing = (int)Mathf.Pow(2, lod); this.voxelObject = voxelObject; }
public void GenerateVoxelObject(VoxelObjectSettings voxelObjectSettings, Vector3 position) { var voxelObject = new VoxelObject(voxelObjectSettings, this); voxelObject.root.position = position; voxelObjects.Add(voxelObject); System.Threading.ThreadPool.QueueUserWorkItem(o => { voxelObject.GenerateIsovalues(); MainThread.ExecuteOnMainThread(() => voxelObject.SetLod(currLod)); }); }
public Octree(int depth, int size, VoxelObject voxelObject) { root = new Block(0, 0, 0, depth - 1, size, voxelObject); blockLod = new List <Block> [depth]; for (int i = 0; i < blockLod.Length; i++) { blockLod[i] = new List <Block>(); } blockLod[depth - 1].Add(root); BuildTreeRecursive(root); }