Merge commit '4ad35f424e01356a4745e5f50631dc050b328c98' into junbo/gitflow_211123_o3de
This commit is contained in:
+1
-4
@@ -150,10 +150,7 @@ namespace AzToolsFramework
|
||||
TypeBeingHandled actualValue = instance;
|
||||
for (int idx = 0; idx < m_common.GetElementCount(); ++idx)
|
||||
{
|
||||
if (elements[idx]->wasValueEditedByUser())
|
||||
{
|
||||
actualValue.SetElement(idx, static_cast<float>(elements[idx]->getValue()));
|
||||
}
|
||||
actualValue.SetElement(idx, static_cast<float>(elements[idx]->getValue()));
|
||||
}
|
||||
instance = actualValue;
|
||||
}
|
||||
|
||||
@@ -40,15 +40,17 @@ namespace Terrain
|
||||
|
||||
->DataElement(AZ::Edit::UIHandlers::Default, &TerrainWorldConfig::m_worldMin, "World Bounds (Min)", "")
|
||||
// Temporary constraint until the rest of the Terrain system is updated to support larger worlds.
|
||||
->Attribute(AZ::Edit::Attributes::ChangeValidate, &TerrainWorldConfig::ValidateWorldMin)
|
||||
->Attribute(AZ::Edit::Attributes::Min, -2048.0f)
|
||||
->Attribute(AZ::Edit::Attributes::Max, 2048.0f)
|
||||
->DataElement(AZ::Edit::UIHandlers::Default, &TerrainWorldConfig::m_worldMax, "World Bounds (Max)", "")
|
||||
// Temporary constraint until the rest of the Terrain system is updated to support larger worlds.
|
||||
->Attribute(AZ::Edit::Attributes::ChangeValidate, &TerrainWorldConfig::ValidateWorldMax)
|
||||
->Attribute(AZ::Edit::Attributes::Min, -2048.0f)
|
||||
->Attribute(AZ::Edit::Attributes::Max, 2048.0f)
|
||||
->DataElement(
|
||||
AZ::Edit::UIHandlers::Default, &TerrainWorldConfig::m_heightQueryResolution, "Height Query Resolution (m)", "")
|
||||
;
|
||||
->Attribute(AZ::Edit::Attributes::ChangeValidate, &TerrainWorldConfig::ValidateWorldHeight);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -128,4 +130,42 @@ namespace Terrain
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
float TerrainWorldConfig::NumberOfSamples(AZ::Vector3* min, AZ::Vector3* max, AZ::Vector2* heightQuery)
|
||||
{
|
||||
float numberOfSamples = ((max->GetX() - min->GetX()) / heightQuery->GetX()) * ((max->GetY() - min->GetY()) / heightQuery->GetY());
|
||||
return numberOfSamples;
|
||||
}
|
||||
|
||||
AZ::Outcome<void, AZStd::string> TerrainWorldConfig::DetermineMessage(float numSamples)
|
||||
{
|
||||
const float maximumSamplesAllowed = 8.0f * 1024.0f * 1024.0f;
|
||||
if (numSamples < maximumSamplesAllowed)
|
||||
{
|
||||
return AZ::Success();
|
||||
}
|
||||
return AZ::Failure(AZStd::string("The number of samples exceeds the maximum allowed."));
|
||||
}
|
||||
|
||||
AZ::Outcome<void, AZStd::string> TerrainWorldConfig::ValidateWorldMin(void* newValue, [[maybe_unused]]const AZ::Uuid& valueType)
|
||||
{
|
||||
AZ::Vector3 minValue = *static_cast<AZ::Vector3*>(newValue);
|
||||
|
||||
return DetermineMessage(NumberOfSamples(&minValue, &m_worldMax, &m_heightQueryResolution));
|
||||
}
|
||||
|
||||
AZ::Outcome<void, AZStd::string> TerrainWorldConfig::ValidateWorldMax(void* newValue, [[maybe_unused]] const AZ::Uuid& valueType)
|
||||
{
|
||||
AZ::Vector3 maxValue = *static_cast<AZ::Vector3*>(newValue);
|
||||
|
||||
return DetermineMessage(NumberOfSamples(&m_worldMin, &maxValue, &m_heightQueryResolution));
|
||||
}
|
||||
|
||||
AZ::Outcome<void, AZStd::string> TerrainWorldConfig::ValidateWorldHeight(void* newValue, [[maybe_unused]] const AZ::Uuid& valueType)
|
||||
{
|
||||
AZ::Vector2 heightValue = *static_cast<AZ::Vector2*>(newValue);
|
||||
|
||||
return DetermineMessage(NumberOfSamples(&m_worldMin, &m_worldMax, &heightValue));
|
||||
}
|
||||
|
||||
} // namespace Terrain
|
||||
|
||||
@@ -32,6 +32,14 @@ namespace Terrain
|
||||
AZ::Vector3 m_worldMin{ 0.0f, 0.0f, 0.0f };
|
||||
AZ::Vector3 m_worldMax{ 1024.0f, 1024.0f, 1024.0f };
|
||||
AZ::Vector2 m_heightQueryResolution{ 1.0f, 1.0f };
|
||||
|
||||
private:
|
||||
AZ::Outcome<void, AZStd::string> ValidateWorldMin(void* newValue, const AZ::Uuid& valueType);
|
||||
AZ::Outcome<void, AZStd::string> ValidateWorldMax(void* newValue, const AZ::Uuid& valueType);
|
||||
AZ::Outcome<void, AZStd::string> ValidateWorldHeight(void* newValue, const AZ::Uuid& valueType);
|
||||
float NumberOfSamples(AZ::Vector3* min, AZ::Vector3* max, AZ::Vector2* heightQuery);
|
||||
AZ::Outcome<void, AZStd::string> DetermineMessage(float numSamples);
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user