public static CSGBrush CreateBrushFromPlanes(UnityEngine.GameObject gameObject,
                                                     UnityEngine.Plane[]                planes,
                                                     UnityEngine.Vector3[]              tangents  = null,
                                                     UnityEngine.Vector3[]              binormals = null,
                                                     UnityEngine.Material[]             materials = null,
                                                     UnityEngine.Matrix4x4[]    textureMatrices   = null,
                                                     TextureMatrixSpace textureMatrixSpace        = TextureMatrixSpace.WorldSpace,
                                                     uint[]                                             smoothingGroups = null,
                                                     TexGenFlags[]                              texGenFlags             = null)
        {
            ControlMesh controlMesh;
            Shape       shape;

            if (!BrushFactory.CreateControlMeshFromPlanes(out controlMesh,
                                                          out shape,
                                                          planes,
                                                          tangents,
                                                          binormals,
                                                          materials,
                                                          textureMatrices,
                                                          textureMatrixSpace,
                                                          smoothingGroups,
                                                          texGenFlags))
            {
                return(null);
            }

            return(BrushFactory.CreateBrushComponent(gameObject, controlMesh, shape));
        }
        public static CSGBrush CreateCubeBrush(UnityEngine.Transform parent, string brushName, UnityEngine.Vector3 size)
        {
            ControlMesh controlMesh;
            Shape       shape;

            BrushFactory.CreateCubeControlMesh(out controlMesh, out shape, size);

            return(CreateBrush(parent, brushName, controlMesh, shape));
        }
        public static bool SetBrushCubeMesh(CSGBrush brush, UnityEngine.Vector3 size)
        {
            if (!brush)
            {
                return(false);
            }

            ControlMesh controlMesh;
            Shape       shape;

            BrushFactory.CreateCubeControlMesh(out controlMesh, out shape, size);

            brush.ControlMesh = controlMesh;
            brush.Shape       = shape;
            if (brush.ControlMesh != null)
            {
                brush.ControlMesh.SetDirty();
            }
            if (brush.Shape != null)
            {
                ShapeUtility.EnsureInitialized(brush.Shape);
            }
            return(true);
        }