review changes.
Signed-off-by: sphrose <82213493+sphrose@users.noreply.github.com>
This commit is contained in:
@@ -687,28 +687,51 @@ namespace PhysX
|
||||
[[maybe_unused]] const AZ::Vector3& colliderScale,
|
||||
[[maybe_unused]] const bool forceUniformScaling) const
|
||||
{
|
||||
const float minXBounds = -(heightfieldShapeConfig.GetNumColumns() * heightfieldShapeConfig.GetGridResolution().GetX()) / 2.0f;
|
||||
const float minYBounds = -(heightfieldShapeConfig.GetNumRows() * heightfieldShapeConfig.GetGridResolution().GetY()) / 2.0f;
|
||||
const int numColumns = heightfieldShapeConfig.GetNumColumns();
|
||||
const int numRows = heightfieldShapeConfig.GetNumRows();
|
||||
|
||||
for (int xIndex = 0; xIndex < heightfieldShapeConfig.GetNumColumns() - 1; xIndex++)
|
||||
const float minXBounds = -(numColumns * heightfieldShapeConfig.GetGridResolution().GetX()) / 2.0f;
|
||||
const float minYBounds = -(numRows * heightfieldShapeConfig.GetGridResolution().GetY()) / 2.0f;
|
||||
|
||||
auto heights = heightfieldShapeConfig.GetSamples();
|
||||
|
||||
for (int xIndex = 0; xIndex < numColumns - 1; xIndex++)
|
||||
{
|
||||
for (int yIndex = 0; yIndex < heightfieldShapeConfig.GetNumRows() - 1; yIndex++)
|
||||
for (int yIndex = 0; yIndex < numRows - 1; yIndex++)
|
||||
{
|
||||
const int index0 = yIndex * heightfieldShapeConfig.GetNumColumns() + xIndex;
|
||||
const int index1 = yIndex * heightfieldShapeConfig.GetNumColumns() + xIndex + 1;
|
||||
const int index2 = (yIndex + 1) * heightfieldShapeConfig.GetNumColumns() + xIndex + 1;
|
||||
const int index3 = (yIndex + 1) * heightfieldShapeConfig.GetNumColumns() + xIndex;
|
||||
const int index0 = yIndex * numColumns + xIndex;
|
||||
const int index1 = yIndex * numColumns + xIndex + 1;
|
||||
const int index2 = (yIndex + 1) * numColumns + xIndex;
|
||||
const int index3 = (yIndex + 1) * numColumns + xIndex + 1;
|
||||
|
||||
const float x0 = minXBounds + heightfieldShapeConfig.GetGridResolution().GetX() * xIndex;
|
||||
const float x1 = minXBounds + heightfieldShapeConfig.GetGridResolution().GetX() * (xIndex + 1);
|
||||
const float y0 = minYBounds + heightfieldShapeConfig.GetGridResolution().GetY() * (yIndex + 1);
|
||||
const float y1 = minYBounds + heightfieldShapeConfig.GetGridResolution().GetY() * yIndex;
|
||||
|
||||
debugDisplay.DrawWireQuad(
|
||||
AZ::Vector3(x0, y0, heightfieldShapeConfig.GetSamples()[index0].m_height),
|
||||
AZ::Vector3(x1, y0, heightfieldShapeConfig.GetSamples()[index1].m_height),
|
||||
AZ::Vector3(x1, y1, heightfieldShapeConfig.GetSamples()[index2].m_height),
|
||||
AZ::Vector3(x0, y1, heightfieldShapeConfig.GetSamples()[index3].m_height));
|
||||
const float y0 = minYBounds + heightfieldShapeConfig.GetGridResolution().GetY() * yIndex;
|
||||
const float y1 = minYBounds + heightfieldShapeConfig.GetGridResolution().GetY() * (yIndex + 1);
|
||||
|
||||
// Always draw top and left line of quad
|
||||
debugDisplay.DrawLine(
|
||||
AZ::Vector3(x0, y0, heights[index0].m_height),
|
||||
AZ::Vector3(x1, y0, heights[index1].m_height));
|
||||
debugDisplay.DrawLine(
|
||||
AZ::Vector3(x0, y0, heights[index0].m_height),
|
||||
AZ::Vector3(x0, y1, heights[index2].m_height));
|
||||
|
||||
// Draw bottom line in last row
|
||||
if (yIndex == numRows - 2)
|
||||
{
|
||||
debugDisplay.DrawLine(
|
||||
AZ::Vector3(x1, y1, heights[index3].m_height),
|
||||
AZ::Vector3(x0, y1, heights[index2].m_height));
|
||||
}
|
||||
|
||||
// Draw right line in last column
|
||||
if (xIndex == numColumns - 2)
|
||||
{
|
||||
debugDisplay.DrawLine(
|
||||
AZ::Vector3(x1, y0, heights[index1].m_height),
|
||||
AZ::Vector3(x1, y1, heights[index3].m_height));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user