namespace UnityEngine.ProBuilder.Shapes
{
///
/// Base class for all Shape types that represent a primitive [shape](../manual/shape-tool.html).
///
[System.Serializable]
public abstract class Shape
{
///
/// Allows the user to redefine the default bounding box for this shape.
///
/// The mesh to find the bounds for.
/// The desired size for the shape defined when using the [Shape Tool](../manual/shape-tool.html).
/// The rotation (orientation) to use for this mesh.
/// The default bounds computed for the shape.
/// The bounds from this shape's property.
public virtual Bounds UpdateBounds(ProBuilderMesh mesh, Vector3 size, Quaternion rotation, Bounds bounds)
{
return mesh.mesh.bounds;
}
///
/// Rebuilds the specified mesh using the existing property values for this shape. This includes
/// building a list of vertices and normals for each face, applying smoothing to the faces if
/// required, and calculating the bounds of the mesh.
///
/// The mesh to rebuild.
/// The position of the opposite corner of the bounding box for this shape.
/// The rotation (orientation) to use for this mesh.
/// The bounds calculated for this shape after rebuilding it.
public abstract Bounds RebuildMesh(ProBuilderMesh mesh, Vector3 size, Quaternion rotation);
///
/// Overwrites this shape's property values by copying them from the specified Shape object.
///
/// The to copy property values from.
public abstract void CopyShape(Shape shape);
}
///
/// Represents an attribute for a Shape type.
///
[System.AttributeUsage(System.AttributeTargets.Class)]
public class ShapeAttribute : System.Attribute
{
/// Name of the attribute
public string name;
///
/// Creates a ShapeAttribute with the specified name.
///
/// The name of the new ShapeAttribute.
public ShapeAttribute(string n)
{
name = n;
}
}
}