public byte GetBlock(int x, int y, int z) { byte result = 0; if (builder != null) { result = builder.GetBlock(x, y, z).type; } return(result); }
public Block GetBlock(int x, int y, int z) { Block result = default(Block); if (builder != null) { result = builder.GetBlock(x, y, z); } return(result); }
public GridPoint GetVector4(Vector3 world, Vector3Int local, Vector3Int global, bool generate) { //Vector3 origin = new Vector3(ChunkSizeX / 2, ChunkSizeY / 2, ChunkSizeX / 2); //return new Vector4(world.x, world.y, world.z, Vector3.Distance(origin, world)); GridPoint result = default(GridPoint); Vector3Int chunk = VoxelConversions.VoxelToChunk(global); uint type; if (generate) { if (IsInBounds(local.x, local.y, local.z)) { result = new GridPoint(world.x, world.y, world.z, (float)GetIsoValue(local, global, generate, out type), type); } else { result = new GridPoint(world.x, world.y, world.z, (float)Sampler.GetIsoValue(local, global, out type), type); //result = new GridPoint(world.x, world.y, world.z, 100); /*Vector3Int chunklocalVoxel = VoxelConversions.GlobalToLocalChunkCoord(chunk, global); * SmoothVoxelBuilder builder = (SmoothVoxelBuilder)controller.GetBuilder(chunk.x, chunk.y, chunk.z); * if (builder != null) * { * result = new GridPoint(world.x, world.y, world.z, (float)builder.Sampler.GetIsoValue(local, global, out type), type); * } * else * { * //result = new GridPoint(world.x, world.y, world.z, (float)Sampler.GetIsoValue(chunklocalVoxel, global, out type), type); * result = new GridPoint(world.x, world.y, world.z, (float)Sampler.GetIsoValue(local, global, out type), type); * }*/ } } else { if (chunk != location) { Vector3Int chunklocalVoxel = VoxelConversions.GlobalToLocalChunkCoord(chunk, global); IVoxelBuilder builder = controller.GetBuilder(chunk.x, chunk.y, chunk.z); if (builder != null) { Block builderBlock = builder.GetBlock(chunklocalVoxel.x, chunklocalVoxel.y, chunklocalVoxel.z); result = new GridPoint(world.x, world.y, world.z, (float)builderBlock.iso, builderBlock.type); } else { result = new GridPoint(world.x, world.y, world.z, (float)Sampler.GetIsoValue(chunklocalVoxel, global, out type)); } } else { result = new GridPoint(world.x, world.y, world.z, (float)GetIsoValue(local, global, generate, out type), (byte)type); } } result.OriginLocal = local; result.OriginGlobal = global; return(result); }