From 25ca2a7c58391ad336115b74b4bacd24e79015f6 Mon Sep 17 00:00:00 2001 From: Henry de Jongh Date: Wed, 14 Mar 2018 19:34:42 +0100 Subject: [PATCH] Created public properties for primitive- and compound brushes. Fixes #41. --- .../CompoundBrushes/CurvedStairBrush.cs | 66 ++++++++++++++++ Scripts/Brushes/CompoundBrushes/StairBrush.cs | 78 ++++++++++++++++++- Scripts/Brushes/CompoundBrushes/TrimBrush.cs | 14 +++- Scripts/Brushes/PrimitiveBrush.cs | 53 ++++++++++++- 4 files changed, 201 insertions(+), 10 deletions(-) diff --git a/Scripts/Brushes/CompoundBrushes/CurvedStairBrush.cs b/Scripts/Brushes/CompoundBrushes/CurvedStairBrush.cs index 2fcd0819..d6d3a76f 100644 --- a/Scripts/Brushes/CompoundBrushes/CurvedStairBrush.cs +++ b/Scripts/Brushes/CompoundBrushes/CurvedStairBrush.cs @@ -18,46 +18,112 @@ public class CurvedStairBrush : CompoundBrush [SerializeField] float innerRadius = 1.0f; + /// + /// Gets or sets the radius in meters in the center of the staircase. + /// + /// The radius in meters in the center of the staircase. + public float InnerRadius { get { return innerRadius; } set { innerRadius = value; } } + /// The height of each step. [SerializeField] float stepHeight = 0.0625f; + /// + /// Gets or sets the height of each step. + /// + /// The height of each step. + public float StepHeight { get { return stepHeight; } set { stepHeight = value; } } + /// The width of each step. [SerializeField] float stepWidth = 1.0f; + /// + /// Gets or sets the width of each step. + /// + /// The width of each step. + public float StepWidth { get { return stepWidth; } set { stepWidth = value; } } + /// The amount of curvature in degrees. [SerializeField] float angleOfCurve = 90.0f; + /// + /// Gets or sets the amount of curvature in degrees. + /// + /// The amount of curvature in degrees. + public float AngleOfCurve { get { return angleOfCurve; } set { angleOfCurve = value; } } + /// The amount of steps on the staircase. [SerializeField] int numSteps = 4; + /// + /// Gets or sets the amount of steps on the staircase. + /// + /// The amount of steps on the staircase. + public int NumberOfSteps { get { return numSteps; } set { numSteps = value; } } + /// An amount of height to add to the first stair step. [SerializeField] float addToFirstStep = 0.0f; + /// + /// Gets or sets an amount of height to add to the first stair step. + /// + /// An amount of height to add to the first stair step. + public float AddToFirstStep { get { return addToFirstStep; } set { addToFirstStep = value; } } + /// Whether the stairs are mirrored counter-clockwise. [SerializeField] bool counterClockwise = false; + /// + /// Gets or sets a value indicating whether the stairs are mirrored counter-clockwise. + /// + /// true if the stairs are mirrored counter-clockwise; otherwise, false. + public bool CounterClockwise { get { return counterClockwise; } set { counterClockwise = value; } } + /// Whether the stairs reach down to the bottom. [SerializeField] bool fillToBottom = true; + /// + /// Gets or sets a value indicating whether the stairs reach down to the bottom. + /// + /// true if the stairs reach down to the bottom; otherwise, false. + public bool FillToBottom { get { return fillToBottom; } set { fillToBottom = value; } } + /// Whether to generate stairs or a curved wall. [SerializeField] bool curvedWall = false; + /// + /// Gets or sets a value indicating whether to generate stairs or a curved wall. + /// + /// true if it generates stairs; otherwise, false to generate a curved wall. + public bool CurvedWall { get { return curvedWall; } set { curvedWall = value; } } + /// Whether the floor is stairs or a smooth slope. [SerializeField] bool slopedFloor = false; + /// + /// Gets or sets a value indicating whether the floor is stairs or a smooth slope. + /// + /// true if the floor is a smooth slope; otherwise, false if the floor is stairs. + public bool SlopedFloor { get { return slopedFloor; } set { slopedFloor = value; } } + /// Whether the ceiling is stairs or a smooth slope. [SerializeField] bool slopedCeiling = false; + /// + /// Gets or sets a value indicating whether the ceiling is stairs or a smooth slope. + /// + /// true if the ceiling is a smooth slope; otherwise, false if the ceiling is stairs. + public bool SlopedCeiling { get { return slopedCeiling; } set { slopedCeiling = value; } } + /// The last known extents of the compound brush to detect user resizing the bounds. private Vector3 m_LastKnownExtents; /// The last known position of the compound brush to prevent movement on resizing the bounds. diff --git a/Scripts/Brushes/CompoundBrushes/StairBrush.cs b/Scripts/Brushes/CompoundBrushes/StairBrush.cs index 61ee9c09..57cf7c18 100644 --- a/Scripts/Brushes/CompoundBrushes/StairBrush.cs +++ b/Scripts/Brushes/CompoundBrushes/StairBrush.cs @@ -9,31 +9,103 @@ namespace Sabresaurus.SabreCSG [ExecuteInEditMode] public class StairBrush : CompoundBrush { + /// + /// The depth of each step. + /// [SerializeField] float stepDepth = 0.2f; + /// + /// Gets or sets the depth of each step. + /// + /// The depth of each step. + public float StepDepth { get { return stepDepth; } set { stepDepth = value; } } + + /// + /// The height of each step. + /// [SerializeField] float stepHeight = 0.1f; + /// + /// Gets or sets the height of each step. + /// + /// The height of each step. + public float StepHeight { get { return stepHeight; } set { stepHeight = value; } } + + /// + /// The step depth spacing. + /// [SerializeField] float stepDepthSpacing = 0f; + /// + /// Gets or sets the step depth spacing. + /// + /// The step depth spacing. + public float StepDepthSpacing { get { return stepDepthSpacing; } set { stepDepthSpacing = value; } } + + /// + /// The step height spacing. + /// [SerializeField] float stepHeightSpacing = 0f; - [SerializeField] + /// + /// Gets or sets the step height spacing. + /// + /// The step height spacing. + public float StepHeightSpacing { get { return stepHeightSpacing; } set { stepHeightSpacing = value; } } + + /// + /// Whether to automatically determine the best step depth. + /// + [SerializeField] bool autoDepth = false; + /// + /// Gets or sets a value indicating whether to automatically determine the best step depth. + /// + /// true to automatically determine the best step depth; otherwise, false. + public bool AutomaticDepth { get { return autoDepth; } set { autoDepth = value; } } + + /// + /// Whether to automatically determine the best step height. + /// [SerializeField] bool autoHeight = false; - [SerializeField] + /// + /// Gets or sets a value indicating whether to automatically determine the best step height. + /// + /// true to automatically determine the best step height; otherwise, false. + public bool AutomaticHeight { get { return autoDepth; } set { autoDepth = value; } } + + /// + /// Whether to lead from the top. + /// + [SerializeField] bool leadFromTop = false; + /// + /// Gets or sets a value indicating whether to lead from the top. + /// + /// true to lead from the top; otherwise, false. + public bool LeadFromTop { get { return leadFromTop; } set { leadFromTop = value; } } + + /// + /// Whether to fill steps to the bottom to make a solid staircase. + /// [SerializeField] bool fillToBottom = false; - public override int BrushCount + /// + /// Gets or sets a value indicating whether to fill steps to the bottom to make a solid staircase. + /// + /// true to fill steps to the bottom to make a solid staircase; otherwise, false. + public bool FillToBottom { get { return fillToBottom; } set { fillToBottom = value; } } + + public override int BrushCount { get { diff --git a/Scripts/Brushes/CompoundBrushes/TrimBrush.cs b/Scripts/Brushes/CompoundBrushes/TrimBrush.cs index 09ce1f3d..c1d984ec 100644 --- a/Scripts/Brushes/CompoundBrushes/TrimBrush.cs +++ b/Scripts/Brushes/CompoundBrushes/TrimBrush.cs @@ -9,11 +9,19 @@ namespace Sabresaurus.SabreCSG [ExecuteInEditMode] public class TrimBrush : CompoundBrush { - - [SerializeField] + /// + /// The size of the trim. + /// + [SerializeField] float trimSize = 0.25f; - public override int BrushCount + /// + /// Gets or sets the size of the trim. + /// + /// The size of the trim. + public float TrimSize { get { return trimSize; } set { trimSize = value; } } + + public override int BrushCount { get { diff --git a/Scripts/Brushes/PrimitiveBrush.cs b/Scripts/Brushes/PrimitiveBrush.cs index 19dc6a59..05816d62 100755 --- a/Scripts/Brushes/PrimitiveBrush.cs +++ b/Scripts/Brushes/PrimitiveBrush.cs @@ -17,7 +17,7 @@ public enum PrimitiveBrushType { }; /// - /// A simple brush that represents a single convex shape + /// A simple brush that represents a single convex shape. /// [ExecuteInEditMode] public class PrimitiveBrush : Brush @@ -25,21 +25,66 @@ public class PrimitiveBrush : Brush [SerializeField] Polygon[] polygons; - [SerializeField,HideInInspector] + /// + /// The prism side count. + /// + [SerializeField,HideInInspector] int prismSideCount = 6; - [SerializeField,HideInInspector] + /// + /// Gets or sets the prism side count. + /// + /// The prism side count. + public int PrismSideCount { get { return prismSideCount; } set { prismSideCount = value; } } + + /// + /// The cylinder side count. + /// + [SerializeField,HideInInspector] int cylinderSideCount = 20; + /// + /// Gets or sets the cylinder side count. + /// + /// The cylinder side count. + public int CylinderSideCount { get { return cylinderSideCount; } set { cylinderSideCount = value; } } + + /// + /// The cone side count. + /// [SerializeField, HideInInspector] int coneSideCount = 20; + /// + /// Gets or sets the cone side count. + /// + /// The cone side count. + public int ConeSideCount { get { return coneSideCount; } set { coneSideCount = value; } } + + /// + /// The sphere side count. + /// [SerializeField,HideInInspector] int sphereSideCount = 6; - [SerializeField,HideInInspector] + /// + /// Gets or sets the sphere side count. + /// + /// The sphere side count. + public int SphereSideCount { get { return sphereSideCount; } set { sphereSideCount = value; } } + + /// + /// The icon sphere iteration count. + /// + [SerializeField,HideInInspector] int icoSphereIterationCount = 1; + /// + /// Gets or sets the icon sphere iteration count. + /// + /// The icon sphere iteration count. + public int IcoSphereIterationCount { get { return icoSphereIterationCount; } set { icoSphereIterationCount = value; } } + [SerializeField,HideInInspector] PrimitiveBrushType brushType = PrimitiveBrushType.Cube;