Making terrain query resolution a single float instead of a Vector2 (#7186)

* Making terrain query resolution a single float instead of a Vector2

Signed-off-by: Ken Pruiksma <pruiksma@amazon.com>

* Keeping the concept of different x/y step sizes in region queries since that may be useful and is separate from query resolution. Also keeping the concept of different x/y step sizes in physics since that's independent of the terrain gem.

Signed-off-by: Ken Pruiksma <pruiksma@amazon.com>

* Formatting cleanups

Signed-off-by: Ken Pruiksma <pruiksma@amazon.com>

* A few more minor cleanups

Signed-off-by: Ken Pruiksma <pruiksma@amazon.com>

* Added support to convert serialized Vector2 query resolution to a single float.

Signed-off-by: Ken Pruiksma <pruiksma@amazon.com>

* Switch ray intersection check back to using separate values for x and y resolution

Signed-off-by: Ken Pruiksma <pruiksma@amazon.com>

* Fixing new unit tests added to use float query resolution.

Signed-off-by: Ken Pruiksma <pruiksma@amazon.com>

* Updating automated test

Signed-off-by: Ken Pruiksma <pruiksma@amazon.com>
This commit is contained in:
Ken Pruiksma
2022-01-31 16:10:03 -06:00
committed by GitHub
parent 0a5e61b834
commit b455b915a8
23 changed files with 167 additions and 109 deletions
+2 -2
View File
@@ -317,8 +317,8 @@ void CGameExporter::ExportLevelInfo(const QString& path)
root->setAttr("Name", levelName.toUtf8().data());
auto terrain = AzFramework::Terrain::TerrainDataRequestBus::FindFirstHandler();
const AZ::Aabb terrainAabb = terrain ? terrain->GetTerrainAabb() : AZ::Aabb::CreateFromPoint(AZ::Vector3::CreateZero());
const AZ::Vector2 terrainGridResolution = terrain ? terrain->GetTerrainHeightQueryResolution() : AZ::Vector2::CreateOne();
const int compiledHeightmapSize = static_cast<int>(terrainAabb.GetXExtent() / terrainGridResolution.GetX());
const float terrainGridResolution = terrain ? terrain->GetTerrainHeightQueryResolution() : 1.0f;
const int compiledHeightmapSize = static_cast<int>(terrainAabb.GetXExtent() / terrainGridResolution);
root->setAttr("HeightmapSize", compiledHeightmapSize);
//////////////////////////////////////////////////////////////////////////