static Vector2 VoxelBoundsFunction(VoxelElement element, int axis) { BoundingBox bounds = element.bounds;//.Transform.TransformBounds(element.Mesh.GetBounds()); return (axis == 0) ? new Vector2(bounds.Min.X, bounds.Max.X) : ((axis == 1) ? new Vector2(bounds.Min.Y, bounds.Max.Y) : new Vector2(bounds.Min.Z, bounds.Max.Z)); }
static int VoxelCompareFunction(VoxelElement elementA, VoxelElement elementB, int axis) { BoundingBox boundsA = elementA.bounds;//.Transform.TransformBounds(elementA.Mesh.GetBounds()); Vector3 posA = (boundsA.Max + boundsA.Min) * 0.5f;// elementA.Transform.GetPosition(); float valueA = (axis == 0) ? posA.X : (axis == 1) ? posA.Y : posA.Z; BoundingBox boundsB = elementB.bounds;//.Transform.TransformBounds(elementB.Mesh.GetBounds()); Vector3 posB = (boundsB.Max + boundsB.Min) * 0.5f;//elementB.Transform.GetPosition(); float valueB = (axis == 0) ? posB.X : (axis == 1) ? posB.Y : posB.Z; if (valueA < valueB) return -1; if (valueA > valueB) return 1; return 0; }
static BoundingBox VoxelBoundsEval(VoxelElement element) { return element.bounds; }