public static BrushMesh CreateBox(UnityEngine.Vector3 min, UnityEngine.Vector3 max, SurfaceLayers layers, SurfaceFlags surfaceFlags = SurfaceFlags.None) { if (!BoundsExtensions.IsValid(min, max)) { return(null); } if (min.x > max.x) { float x = min.x; min.x = max.x; max.x = x; } if (min.y > max.y) { float y = min.y; min.y = max.y; max.y = y; } if (min.z > max.z) { float z = min.z; min.z = max.z; max.z = z; } return(new BrushMesh { polygons = CreateBoxPolygons(layers, surfaceFlags), halfEdges = boxHalfEdges.ToArray(), vertices = CreateBoxVertices(min, max) }); }
static bool GenerateBox(ref BrushMesh brushMesh, ref ChiselBoxDefinition definition) { definition.Validate(); var min = definition.min; var max = definition.max; if (!BoundsExtensions.IsValid(min, max)) { brushMesh.Clear(); return(false); } return(GenerateBox(ref brushMesh, definition.min, definition.max, definition.surfaceDefinition)); }
public static bool GenerateBox(ref ChiselBrushContainer brushContainer, ref ChiselBoxDefinition definition) { definition.Validate(); var min = definition.min; var max = definition.max; if (!BoundsExtensions.IsValid(min, max)) { return(false); } brushContainer.EnsureSize(1); return(GenerateBox(ref brushContainer.brushMeshes[0], definition.min, definition.max, definition.surfaceDefinition)); }