Changing it so that the Draw functions always stop at exactly maxAngle
This commit is contained in:
@@ -802,7 +802,7 @@ namespace AZ::AtomBridge
|
||||
constexpr float sweepAngleDegrees = 360.0f;
|
||||
const float stepAngle = DegToRad(angularStepDegrees);
|
||||
const float startAngle = DegToRad(startAngleDegrees);
|
||||
const float stopAngle = DegToRad(sweepAngleDegrees) + startAngle;
|
||||
const float stopAngle = DegToRad(sweepAngleDegrees);
|
||||
SingleColorDynamicSizeLineHelper lines(1+static_cast<int>(sweepAngleDegrees/angularStepDegrees));
|
||||
AZ::Vector3 radiusV3 = AZ::Vector3(radius);
|
||||
AZ::Vector3 pos = AZ::Vector3(center.GetX(), center.GetY(), z);
|
||||
@@ -832,7 +832,7 @@ namespace AZ::AtomBridge
|
||||
// Draw axis aligned arc
|
||||
const float stepAngle = DegToRad(angularStepDegrees);
|
||||
const float startAngle = DegToRad(startAngleDegrees);
|
||||
const float stopAngle = DegToRad(sweepAngleDegrees) + startAngle;
|
||||
const float stopAngle = DegToRad(sweepAngleDegrees);
|
||||
SingleColorDynamicSizeLineHelper lines(1+static_cast<int>(sweepAngleDegrees/angularStepDegrees));
|
||||
AZ::Vector3 radiusV3 = AZ::Vector3(radius);
|
||||
CreateAxisAlignedArc(
|
||||
@@ -861,7 +861,7 @@ namespace AZ::AtomBridge
|
||||
// Draw arbitraty axis arc
|
||||
const float stepAngle = DegToRad(angularStepDegrees);
|
||||
const float startAngle = DegToRad(startAngleDegrees);
|
||||
const float stopAngle = DegToRad(sweepAngleDegrees) + startAngle;
|
||||
const float stopAngle = DegToRad(sweepAngleDegrees);
|
||||
SingleColorDynamicSizeLineHelper lines(1+static_cast<int>(sweepAngleDegrees/angularStepDegrees));
|
||||
AZ::Vector3 radiusV3 = AZ::Vector3(radius);
|
||||
CreateArbitraryAxisArc(
|
||||
@@ -904,7 +904,7 @@ namespace AZ::AtomBridge
|
||||
{
|
||||
// Draw circle with single radius.
|
||||
const float step = DegToRad(10.0f);
|
||||
const float maxAngle = DegToRad(360.0f) + step;
|
||||
const float maxAngle = DegToRad(360.0f);
|
||||
SingleColorStaticSizeLineHelper<40> lines; // hard code 40 lines until DegToRad is constexpr.
|
||||
|
||||
AZ::Vector3 radiusV3 = AZ::Vector3(radius);
|
||||
@@ -1134,7 +1134,7 @@ namespace AZ::AtomBridge
|
||||
// This matches Cry behavior, the DrawWireSphere above may need modifying to use the same approach.
|
||||
// Draw 3 axis aligned circles
|
||||
const float step = DegToRad(10.0f);
|
||||
const float maxAngle = DegToRad(360.0f) + step;
|
||||
const float maxAngle = DegToRad(360.0f);
|
||||
SingleColorStaticSizeLineHelper<40*3> lines; // hard code to 40 lines * 3 circles until DegToRad is constexpr.
|
||||
|
||||
// Z Axis
|
||||
@@ -1160,7 +1160,7 @@ namespace AZ::AtomBridge
|
||||
// Draw 3 axis aligned circles
|
||||
const float stepAngle = DegToRad(11.25f);
|
||||
const float startAngle = DegToRad(0.0f);
|
||||
const float stopAngle = DegToRad(360.0f) + stepAngle;
|
||||
const float stopAngle = DegToRad(360.0f);
|
||||
SingleColorDynamicSizeLineHelper lines(2+static_cast<int>(360.0f/11.25f)); // num disk segments + 1 for azis line + 1 for spare
|
||||
const AZ::Vector3 radiusV3 = AZ::Vector3(radius);
|
||||
CreateArbitraryAxisArc(
|
||||
|
||||
@@ -332,6 +332,15 @@ namespace AZ::AtomBridge
|
||||
p0 = p1;
|
||||
++segmentIndex;
|
||||
}
|
||||
// Complete the arc by drawing the last bit
|
||||
sinCos.SetElement(circleAxis1, sinf(maxAngle));
|
||||
sinCos.SetElement(circleAxis2, cosf(maxAngle));
|
||||
p1 = position + radiusV3 * sinCos;
|
||||
p1 = ToWorldSpacePosition(p1);
|
||||
if (filterFunc(p0, p1, segmentIndex))
|
||||
{
|
||||
lines.AddLineSegment(p0, p1);
|
||||
}
|
||||
}
|
||||
|
||||
template<typename LineStorageType>
|
||||
@@ -369,5 +378,13 @@ namespace AZ::AtomBridge
|
||||
p0 = p1;
|
||||
++segmentIndex;
|
||||
}
|
||||
// Complete the arc by drawing the last bit
|
||||
AZ::SinCos(maxAngle, sinVF, cosVF);
|
||||
p1 = position + radiusV3 * (cosVF * a + sinVF * b);
|
||||
p1 = ToWorldSpacePosition(p1);
|
||||
if (filterFunc(p0, p1, segmentIndex))
|
||||
{
|
||||
lines.AddLineSegment(p0, p1);
|
||||
}
|
||||
}
|
||||
} // namespace AZ::AtomBridge
|
||||
|
||||
Reference in New Issue
Block a user