Skip to content
This repository has been archived by the owner on Feb 11, 2024. It is now read-only.

Created public properties for primitive- and compound brushes. Fixes #41. #60

Merged
merged 1 commit into from
Mar 14, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions Scripts/Brushes/CompoundBrushes/CurvedStairBrush.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,46 +18,112 @@ public class CurvedStairBrush : CompoundBrush
[SerializeField]
float innerRadius = 1.0f;

/// <summary>
/// Gets or sets the radius in meters in the center of the staircase.
/// </summary>
/// <value>The radius in meters in the center of the staircase.</value>
public float InnerRadius { get { return innerRadius; } set { innerRadius = value; } }

/// <summary>The height of each step.</summary>
[SerializeField]
float stepHeight = 0.0625f;

/// <summary>
/// Gets or sets the height of each step.
/// </summary>
/// <value>The height of each step.</value>
public float StepHeight { get { return stepHeight; } set { stepHeight = value; } }

/// <summary>The width of each step.</summary>
[SerializeField]
float stepWidth = 1.0f;

/// <summary>
/// Gets or sets the width of each step.
/// </summary>
/// <value>The width of each step.</value>
public float StepWidth { get { return stepWidth; } set { stepWidth = value; } }

/// <summary>The amount of curvature in degrees.</summary>
[SerializeField]
float angleOfCurve = 90.0f;

/// <summary>
/// Gets or sets the amount of curvature in degrees.
/// </summary>
/// <value>The amount of curvature in degrees.</value>
public float AngleOfCurve { get { return angleOfCurve; } set { angleOfCurve = value; } }

/// <summary>The amount of steps on the staircase.</summary>
[SerializeField]
int numSteps = 4;

/// <summary>
/// Gets or sets the amount of steps on the staircase.
/// </summary>
/// <value>The amount of steps on the staircase.</value>
public int NumberOfSteps { get { return numSteps; } set { numSteps = value; } }

/// <summary>An amount of height to add to the first stair step.</summary>
[SerializeField]
float addToFirstStep = 0.0f;

/// <summary>
/// Gets or sets an amount of height to add to the first stair step.
/// </summary>
/// <value>An amount of height to add to the first stair step.</value>
public float AddToFirstStep { get { return addToFirstStep; } set { addToFirstStep = value; } }

/// <summary>Whether the stairs are mirrored counter-clockwise.</summary>
[SerializeField]
bool counterClockwise = false;

/// <summary>
/// Gets or sets a value indicating whether the stairs are mirrored counter-clockwise.
/// </summary>
/// <value><c>true</c> if the stairs are mirrored counter-clockwise; otherwise, <c>false</c>.</value>
public bool CounterClockwise { get { return counterClockwise; } set { counterClockwise = value; } }

/// <summary>Whether the stairs reach down to the bottom.</summary>
[SerializeField]
bool fillToBottom = true;

/// <summary>
/// Gets or sets a value indicating whether the stairs reach down to the bottom.
/// </summary>
/// <value><c>true</c> if the stairs reach down to the bottom; otherwise, <c>false</c>.</value>
public bool FillToBottom { get { return fillToBottom; } set { fillToBottom = value; } }

/// <summary>Whether to generate stairs or a curved wall.</summary>
[SerializeField]
bool curvedWall = false;

/// <summary>
/// Gets or sets a value indicating whether to generate stairs or a curved wall.
/// </summary>
/// <value><c>true</c> if it generates stairs; otherwise, <c>false</c> to generate a curved wall.</value>
public bool CurvedWall { get { return curvedWall; } set { curvedWall = value; } }

/// <summary>Whether the floor is stairs or a smooth slope.</summary>
[SerializeField]
bool slopedFloor = false;

/// <summary>
/// Gets or sets a value indicating whether the floor is stairs or a smooth slope.
/// </summary>
/// <value><c>true</c> if the floor is a smooth slope; otherwise, <c>false</c> if the floor is stairs.</value>
public bool SlopedFloor { get { return slopedFloor; } set { slopedFloor = value; } }

/// <summary>Whether the ceiling is stairs or a smooth slope.</summary>
[SerializeField]
bool slopedCeiling = false;

/// <summary>
/// Gets or sets a value indicating whether the ceiling is stairs or a smooth slope.
/// </summary>
/// <value><c>true</c> if the ceiling is a smooth slope; otherwise, <c>false</c> if the ceiling is stairs.</value>
public bool SlopedCeiling { get { return slopedCeiling; } set { slopedCeiling = value; } }

/// <summary>The last known extents of the compound brush to detect user resizing the bounds.</summary>
private Vector3 m_LastKnownExtents;
/// <summary>The last known position of the compound brush to prevent movement on resizing the bounds.</summary>
Expand Down
78 changes: 75 additions & 3 deletions Scripts/Brushes/CompoundBrushes/StairBrush.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,103 @@ namespace Sabresaurus.SabreCSG
[ExecuteInEditMode]
public class StairBrush : CompoundBrush
{
/// <summary>
/// The depth of each step.
/// </summary>
[SerializeField]
float stepDepth = 0.2f;

/// <summary>
/// Gets or sets the depth of each step.
/// </summary>
/// <value>The depth of each step.</value>
public float StepDepth { get { return stepDepth; } set { stepDepth = value; } }

/// <summary>
/// The height of each step.
/// </summary>
[SerializeField]
float stepHeight = 0.1f;

/// <summary>
/// Gets or sets the height of each step.
/// </summary>
/// <value>The height of each step.</value>
public float StepHeight { get { return stepHeight; } set { stepHeight = value; } }

/// <summary>
/// The step depth spacing.
/// </summary>
[SerializeField]
float stepDepthSpacing = 0f;

/// <summary>
/// Gets or sets the step depth spacing.
/// </summary>
/// <value>The step depth spacing.</value>
public float StepDepthSpacing { get { return stepDepthSpacing; } set { stepDepthSpacing = value; } }

/// <summary>
/// The step height spacing.
/// </summary>
[SerializeField]
float stepHeightSpacing = 0f;

[SerializeField]
/// <summary>
/// Gets or sets the step height spacing.
/// </summary>
/// <value>The step height spacing.</value>
public float StepHeightSpacing { get { return stepHeightSpacing; } set { stepHeightSpacing = value; } }

/// <summary>
/// Whether to automatically determine the best step depth.
/// </summary>
[SerializeField]
bool autoDepth = false;

/// <summary>
/// Gets or sets a value indicating whether to automatically determine the best step depth.
/// </summary>
/// <value><c>true</c> to automatically determine the best step depth; otherwise, <c>false</c>.</value>
public bool AutomaticDepth { get { return autoDepth; } set { autoDepth = value; } }

/// <summary>
/// Whether to automatically determine the best step height.
/// </summary>
[SerializeField]
bool autoHeight = false;

[SerializeField]
/// <summary>
/// Gets or sets a value indicating whether to automatically determine the best step height.
/// </summary>
/// <value><c>true</c> to automatically determine the best step height; otherwise, <c>false</c>.</value>
public bool AutomaticHeight { get { return autoDepth; } set { autoDepth = value; } }

/// <summary>
/// Whether to lead from the top.
/// </summary>
[SerializeField]
bool leadFromTop = false;

/// <summary>
/// Gets or sets a value indicating whether to lead from the top.
/// </summary>
/// <value><c>true</c> to lead from the top; otherwise, <c>false</c>.</value>
public bool LeadFromTop { get { return leadFromTop; } set { leadFromTop = value; } }

/// <summary>
/// Whether to fill steps to the bottom to make a solid staircase.
/// </summary>
[SerializeField]
bool fillToBottom = false;

public override int BrushCount
/// <summary>
/// Gets or sets a value indicating whether to fill steps to the bottom to make a solid staircase.
/// </summary>
/// <value><c>true</c> to fill steps to the bottom to make a solid staircase; otherwise, <c>false</c>.</value>
public bool FillToBottom { get { return fillToBottom; } set { fillToBottom = value; } }

public override int BrushCount
{
get
{
Expand Down
14 changes: 11 additions & 3 deletions Scripts/Brushes/CompoundBrushes/TrimBrush.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,19 @@ namespace Sabresaurus.SabreCSG
[ExecuteInEditMode]
public class TrimBrush : CompoundBrush
{

[SerializeField]
/// <summary>
/// The size of the trim.
/// </summary>
[SerializeField]
float trimSize = 0.25f;

public override int BrushCount
/// <summary>
/// Gets or sets the size of the trim.
/// </summary>
/// <value>The size of the trim.</value>
public float TrimSize { get { return trimSize; } set { trimSize = value; } }

public override int BrushCount
{
get
{
Expand Down
53 changes: 49 additions & 4 deletions Scripts/Brushes/PrimitiveBrush.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,29 +17,74 @@ public enum PrimitiveBrushType {
};

/// <summary>
/// A simple brush that represents a single convex shape
/// A simple brush that represents a single convex shape.
/// </summary>
[ExecuteInEditMode]
public class PrimitiveBrush : Brush
{
[SerializeField]
Polygon[] polygons;

[SerializeField,HideInInspector]
/// <summary>
/// The prism side count.
/// </summary>
[SerializeField,HideInInspector]
int prismSideCount = 6;

[SerializeField,HideInInspector]
/// <summary>
/// Gets or sets the prism side count.
/// </summary>
/// <value>The prism side count.</value>
public int PrismSideCount { get { return prismSideCount; } set { prismSideCount = value; } }

/// <summary>
/// The cylinder side count.
/// </summary>
[SerializeField,HideInInspector]
int cylinderSideCount = 20;

/// <summary>
/// Gets or sets the cylinder side count.
/// </summary>
/// <value>The cylinder side count.</value>
public int CylinderSideCount { get { return cylinderSideCount; } set { cylinderSideCount = value; } }

/// <summary>
/// The cone side count.
/// </summary>
[SerializeField, HideInInspector]
int coneSideCount = 20;

/// <summary>
/// Gets or sets the cone side count.
/// </summary>
/// <value>The cone side count.</value>
public int ConeSideCount { get { return coneSideCount; } set { coneSideCount = value; } }

/// <summary>
/// The sphere side count.
/// </summary>
[SerializeField,HideInInspector]
int sphereSideCount = 6;

[SerializeField,HideInInspector]
/// <summary>
/// Gets or sets the sphere side count.
/// </summary>
/// <value>The sphere side count.</value>
public int SphereSideCount { get { return sphereSideCount; } set { sphereSideCount = value; } }

/// <summary>
/// The icon sphere iteration count.
/// </summary>
[SerializeField,HideInInspector]
int icoSphereIterationCount = 1;

/// <summary>
/// Gets or sets the icon sphere iteration count.
/// </summary>
/// <value>The icon sphere iteration count.</value>
public int IcoSphereIterationCount { get { return icoSphereIterationCount; } set { icoSphereIterationCount = value; } }

[SerializeField,HideInInspector]
PrimitiveBrushType brushType = PrimitiveBrushType.Cube;

Expand Down