From 402fd2ae4ef42a3dd5dd75fe7d12ac453f084780 Mon Sep 17 00:00:00 2001 From: hultonha Date: Tue, 13 Jul 2021 18:10:33 +0100 Subject: [PATCH] small updates following review feedback Signed-off-by: hultonha --- Gems/LmbrCentral/Code/Source/Shape/TubeShape.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Gems/LmbrCentral/Code/Source/Shape/TubeShape.cpp b/Gems/LmbrCentral/Code/Source/Shape/TubeShape.cpp index 5c3e416008..b9d7a628a0 100644 --- a/Gems/LmbrCentral/Code/Source/Shape/TubeShape.cpp +++ b/Gems/LmbrCentral/Code/Source/Shape/TubeShape.cpp @@ -1,6 +1,6 @@ /* * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution. - * + * * SPDX-License-Identifier: Apache-2.0 OR MIT * */ @@ -131,7 +131,7 @@ namespace LmbrCentral m_variableRadius.SetElement(vertIndex, radius); ValidateVariableRadius(vertIndex); } - + ShapeComponentNotificationsBus::Event( m_entityId, &ShapeComponentNotificationsBus::Events::OnShapeChanged, ShapeComponentNotifications::ShapeChangeReasons::ShapeChanged); @@ -379,9 +379,10 @@ namespace LmbrCentral const float radius, const AZ::u32 capSegments, const AZ::u32 sides, AZStd::vector& vertexBufferOut) { - if (const size_t segmentCount = spline->GetSegmentCount(); segmentCount == 0) + const size_t segmentCount = spline->GetSegmentCount(); + if (segmentCount == 0) { - // clear the buffers so we no longer draw anything + // clear the buffer so we no longer draw anything vertexBufferOut.clear(); return; } @@ -400,7 +401,7 @@ namespace LmbrCentral // 2 verts for each segment // loops == sides // 2 loops per segment - const AZ::u32 segments = spline->GetSegmentCount() * spline->GetSegmentGranularity(); + const AZ::u32 segments = segmentCount * spline->GetSegmentGranularity(); const AZ::u32 totalEndSegments = capSegments * 2 * 2 * 2 * 2; const AZ::u32 totalSegments = segments * 2 * 2 * 2; const AZ::u32 totalLoops = 2 * sides * segments * 2; @@ -429,7 +430,7 @@ namespace LmbrCentral // body const float stepDelta = 1.0f / static_cast(spline->GetSegmentGranularity()); auto nextAddress = address; - const auto endIndex = address.m_segmentIndex + spline->GetSegmentCount(); + const auto endIndex = address.m_segmentIndex + segmentCount; while (address.m_segmentIndex < endIndex) { address.m_segmentFraction = 0.f;