Test the Terrain World configuration changes when parameters are chan… (#6063)

* Test the Terrain World configuration changes when parameters are changed in the component

Signed-off-by: John Jones-Steele <82226755+jjjoness@users.noreply.github.com>

* Changes from PR

Signed-off-by: John Jones-Steele <82226755+jjjoness@users.noreply.github.com>

* Before merge

Signed-off-by: John Jones-Steele <82226755+jjjoness@users.noreply.github.com>

* Before merge 2

Signed-off-by: John Jones-Steele <82226755+jjjoness@users.noreply.github.com>

* Changes from PR

Signed-off-by: John Jones-Steele <82226755+jjjoness@users.noreply.github.com>

* Change from PR

Signed-off-by: John Jones-Steele <82226755+jjjoness@users.noreply.github.com>

* Change before merge

Signed-off-by: John Jones-Steele <82226755+jjjoness@users.noreply.github.com>

* Change before merge 2

Signed-off-by: John Jones-Steele <82226755+jjjoness@users.noreply.github.com>

* Change before merge 3

Signed-off-by: John Jones-Steele <82226755+jjjoness@users.noreply.github.com>

* Change after merge to fix conflicts

Signed-off-by: John Jones-Steele <82226755+jjjoness@users.noreply.github.com>

* Fix merge conflict

Signed-off-by: John Jones-Steele <82226755+jjjoness@users.noreply.github.com>

* Fix merge conflict

Signed-off-by: John Jones-Steele <82226755+jjjoness@users.noreply.github.com>

* CHanges from PR

Signed-off-by: John Jones-Steele <82226755+jjjoness@users.noreply.github.com>
This commit is contained in:
John Jones-Steele
2021-12-08 14:09:56 +00:00
committed by GitHub
parent 5eb058f679
commit 9e7d5fe52b
7 changed files with 294 additions and 29 deletions
@@ -63,25 +63,30 @@ namespace AzFramework::Terrain
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Common)
->Attribute(AZ::Script::Attributes::Category, "Terrain")
->Attribute(AZ::Script::Attributes::Module, "terrain")
->Event("GetNormal", &AzFramework::Terrain::TerrainDataRequestBus::Events::GetNormal)
->Event("GetMaxSurfaceWeight", &AzFramework::Terrain::TerrainDataRequestBus::Events::GetMaxSurfaceWeight)
->Event("GetMaxSurfaceWeightFromVector2",
&AzFramework::Terrain::TerrainDataRequestBus::Events::GetMaxSurfaceWeightFromVector2)
->Event("GetSurfaceWeights", &AzFramework::Terrain::TerrainDataRequestBus::Events::GetSurfaceWeights)
->Event("GetSurfaceWeightsFromVector2",
&AzFramework::Terrain::TerrainDataRequestBus::Events::GetSurfaceWeightsFromVector2)
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Common)
->Event("GetHeight", &AzFramework::Terrain::TerrainDataRequestBus::Events::BehaviorContextGetHeight)
->Event("GetHeightFromFloats", &AzFramework::Terrain::TerrainDataRequestBus::Events::BehaviorContextGetHeightFromFloats)
->Event("GetHeightFromVector2", &AzFramework::Terrain::TerrainDataRequestBus::Events::BehaviorContextGetHeightFromVector2)
->Event("GetNormal", &AzFramework::Terrain::TerrainDataRequestBus::Events::BehaviorContextGetNormal)
->Event("GetMaxSurfaceWeight", &AzFramework::Terrain::TerrainDataRequestBus::Events::BehaviorContextGetMaxSurfaceWeight)
->Event(
"GetMaxSurfaceWeightFromVector2",
&AzFramework::Terrain::TerrainDataRequestBus::Events::BehaviorContextGetMaxSurfaceWeightFromVector2)
->Event("GetSurfaceWeights", &AzFramework::Terrain::TerrainDataRequestBus::Events::BehaviorContextGetSurfaceWeights)
->Event(
"GetSurfaceWeightsFromVector2",
&AzFramework::Terrain::TerrainDataRequestBus::Events::BehaviorContextGetSurfaceWeightsFromVector2)
->Event("GetIsHole", &AzFramework::Terrain::TerrainDataRequestBus::Events::GetIsHole)
->Event("GetIsHoleFromFloats", &AzFramework::Terrain::TerrainDataRequestBus::Events::GetIsHoleFromFloats)
->Event("GetSurfacePoint", &AzFramework::Terrain::TerrainDataRequestBus::Events::BehaviorContextGetSurfacePoint)
->Event("GetSurfacePointFromVector2",
->Event(
"GetSurfacePointFromVector2",
&AzFramework::Terrain::TerrainDataRequestBus::Events::BehaviorContextGetSurfacePointFromVector2)
->Event("GetTerrainAabb", &AzFramework::Terrain::TerrainDataRequestBus::Events::GetTerrainAabb)
->Event("GetTerrainHeightQueryResolution",
->Event(
"GetTerrainHeightQueryResolution",
&AzFramework::Terrain::TerrainDataRequestBus::Events::GetTerrainHeightQueryResolution)
->Event("GetHeight", &AzFramework::Terrain::TerrainDataRequestBus::Events::GetHeightVal)
->Event("GetHeightFromVector2", &AzFramework::Terrain::TerrainDataRequestBus::Events::GetHeightValFromVector2)
->Event("GetHeightFromFloats", &AzFramework::Terrain::TerrainDataRequestBus::Events::GetHeightValFromFloats)
;
;
behaviorContext->EBus<AzFramework::Terrain::TerrainDataNotificationBus>("TerrainDataNotificationBus")
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Common)
@@ -150,24 +150,49 @@ namespace AzFramework
GetSurfacePointFromVector2(inPosition, result, sampleFilter);
return result;
}
// Functions without the optional bool* parameter that can be used from Python tests.
float GetHeightVal(AZ::Vector3 position, Sampler sampler = Sampler::BILINEAR) const
// Private variations of the GetHeight.., GetNormal..., GetMaxSurfaceWeight..., GetSurfaceWeights... APIs
// exposed to BehaviorContext that does not use the terrainExists "out" parameter.
float BehaviorContextGetHeight(const AZ::Vector3& position, Sampler sampler = Sampler::BILINEAR)
{
bool terrainExists;
return GetHeight(position, sampler, &terrainExists);
return GetHeight(position, sampler, nullptr);
}
float GetHeightValFromVector2(AZ::Vector2 position, Sampler sampler = Sampler::BILINEAR) const
float BehaviorContextGetHeightFromVector2(const AZ::Vector2& position, Sampler sampler = Sampler::BILINEAR)
{
bool terrainExists;
return GetHeightFromVector2(position, sampler, &terrainExists);
return GetHeightFromVector2(position, sampler, nullptr);
}
float GetHeightValFromFloats(float x, float y, Sampler sampler = Sampler::BILINEAR) const
float BehaviorContextGetHeightFromFloats(float x, float y, Sampler sampler = Sampler::BILINEAR)
{
bool terrainExists;
return GetHeightFromFloats(x, y, sampler, &terrainExists);
return GetHeightFromFloats(x, y, sampler, nullptr);
}
AZ::Vector3 BehaviorContextGetNormal(const AZ::Vector3& position, Sampler sampleFilter = Sampler::BILINEAR)
{
return GetNormal(position, sampleFilter, nullptr);
}
SurfaceData::SurfaceTagWeight BehaviorContextGetMaxSurfaceWeight(
const AZ::Vector3& position, Sampler sampleFilter = Sampler::BILINEAR)
{
return GetMaxSurfaceWeight(position, sampleFilter, nullptr);
}
SurfaceData::SurfaceTagWeight BehaviorContextGetMaxSurfaceWeightFromVector2(
const AZ::Vector2& inPosition, Sampler sampleFilter = Sampler::DEFAULT)
{
return GetMaxSurfaceWeightFromVector2(inPosition, sampleFilter, nullptr);
}
SurfaceData::SurfaceTagWeightList BehaviorContextGetSurfaceWeights(
const AZ::Vector3& inPosition,
Sampler sampleFilter = Sampler::DEFAULT)
{
SurfaceData::SurfaceTagWeightList list;
GetSurfaceWeights(inPosition, list, sampleFilter, nullptr);
return list;
}
SurfaceData::SurfaceTagWeightList BehaviorContextGetSurfaceWeightsFromVector2(
const AZ::Vector2& inPosition,
Sampler sampleFilter = Sampler::DEFAULT)
{
SurfaceData::SurfaceTagWeightList list;
GetSurfaceWeightsFromVector2(inPosition, list, sampleFilter, nullptr);
return list;
}
};
using TerrainDataRequestBus = AZ::EBus<TerrainDataRequests>;