LYN-7056 SurfaceDataConstants should be revised to have no terrain references

Signed-off-by: sphrose <82213493+sphrose@users.noreply.github.com>
This commit is contained in:
sphrose
2021-12-06 09:54:00 +00:00
parent 97106f9e60
commit f6c3187151
8 changed files with 44 additions and 19 deletions
+3
View File
@@ -70,6 +70,7 @@ if (PAL_TRAIT_BUILD_HOST_TOOLS)
AZ::AzToolsFramework
Gem::SurfaceData.Static
Gem::LmbrCentral.Editor
Gem::Terrain
RUNTIME_DEPENDENCIES
Gem::LmbrCentral.Editor
)
@@ -97,9 +98,11 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED)
BUILD_DEPENDENCIES
PRIVATE
AZ::AzTest
AZ::AzToolsFramework
Legacy::CryCommon
Gem::SurfaceData.Static
Gem::LmbrCentral
Gem::Terrain
)
ly_add_googletest(
NAME Gem::SurfaceData.Tests
@@ -9,25 +9,14 @@
#pragma once
#include <AzCore/Math/Crc.h>
#include <AzFramework/Terrain/TerrainDataRequestBus.h>
#include <AzFramework/SurfaceData/SurfaceData.h>
namespace SurfaceData
{
namespace Constants
{
static const char* s_unassignedTagName = AzFramework::SurfaceData::Constants::s_unassignedTagName;
static const char* s_terrainHoleTagName = "terrainHole";
static const char* s_terrainTagName = "terrain";
static const AZ::Crc32 s_unassignedTagCrc = AZ::Crc32(s_unassignedTagName);
static const AZ::Crc32 s_terrainHoleTagCrc = AZ::Crc32(s_terrainHoleTagName);
static const AZ::Crc32 s_terrainTagCrc = AZ::Crc32(s_terrainTagName);
static const char* s_allTagNames[] =
{
s_unassignedTagName,
s_terrainHoleTagName,
s_terrainTagName,
};
}
}
@@ -12,7 +12,6 @@
#include <AzFramework/Asset/GenericAssetHandler.h>
#include <AzToolsFramework/UI/PropertyEditor/PropertyEditorAPI.h>
namespace SurfaceData
{
namespace Details
@@ -14,6 +14,7 @@
#include <AzFramework/Asset/AssetCatalogBus.h>
#include <AzToolsFramework/ToolsComponents/EditorComponentBase.h>
#include <SurfaceData/SurfaceDataTagProviderRequestBus.h>
#include <Terrain/TerrainDataConstants.h>
namespace AZ::Data
{
@@ -22,6 +23,15 @@ namespace AZ::Data
namespace SurfaceData
{
namespace Constants
{
static const char* s_allTagNames[] = {
Constants::s_unassignedTagName,
Terrain::Constants::s_terrainHoleTagName,
Terrain::Constants::s_terrainTagName,
};
} //namespace Constants
class EditorSurfaceDataSystemConfig
: public AZ::ComponentConfig
{
@@ -47,7 +57,6 @@ namespace SurfaceData
static void GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required);
private:
void LoadAsset(const AZ::Data::AssetId& assetId);
void AddAsset(AZ::Data::Asset<AZ::Data::AssetData>& asset);
@@ -23,8 +23,8 @@
#include <SurfaceDataModule.h>
#include <SurfaceData/SurfaceDataProviderRequestBus.h>
#include <SurfaceData/SurfaceDataModifierRequestBus.h>
#include <SurfaceData/SurfaceTag.h>
#include <SurfaceData/Utility/SurfaceDataUtility.h>
#include <Editor/EditorSurfaceDataSystemComponent.h>
struct MockGlobalEnvironment
{
@@ -0,0 +1,24 @@
/*
* 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
*
*/
#pragma once
#include <AzCore/Math/Crc.h>
#include <AzFramework/SurfaceData/SurfaceData.h>
namespace Terrain
{
namespace Constants
{
static const char* s_terrainHoleTagName = "terrainHole";
static const char* s_terrainTagName = "terrain";
static const AZ::Crc32 s_terrainHoleTagCrc = AZ::Crc32(s_terrainHoleTagName);
static const AZ::Crc32 s_terrainTagCrc = AZ::Crc32(s_terrainTagName);
}
}
@@ -7,6 +7,7 @@
*/
#include <Components/TerrainSurfaceDataSystemComponent.h>
#include <Terrain/TerrainDataConstants.h>
#include <AzCore/Debug/Profiler.h>
#include <AzCore/Math/MathUtils.h>
#include <AzCore/Serialization/EditContext.h>
@@ -162,8 +163,7 @@ namespace Terrain
point.m_normal = terrainSurfacePoint.m_normal;
// Always add a "terrain" or "terrainHole" tag.
const AZ::Crc32 terrainTag =
isHole ? SurfaceData::Constants::s_terrainHoleTagCrc : SurfaceData::Constants::s_terrainTagCrc;
const AZ::Crc32 terrainTag = isHole ? Constants::s_terrainHoleTagCrc : Constants::s_terrainTagCrc;
SurfaceData::AddMaxValueForMasks(point.m_masks, terrainTag, 1.0f);
// Add all of the surface tags that the terrain has at this point.
@@ -189,8 +189,8 @@ namespace Terrain
SurfaceData::SurfaceTagVector TerrainSurfaceDataSystemComponent::GetSurfaceTags() const
{
SurfaceData::SurfaceTagVector tags;
tags.push_back(SurfaceData::Constants::s_terrainHoleTagCrc);
tags.push_back(SurfaceData::Constants::s_terrainTagCrc);
tags.push_back(Constants::s_terrainHoleTagCrc);
tags.push_back(Constants::s_terrainTagCrc);
return tags;
}
+1
View File
@@ -8,6 +8,7 @@
set(FILES
Include/Terrain/Ebuses/TerrainAreaSurfaceRequestBus.h
Include/Terrain/TerrainDataConstants.h
Source/Components/TerrainHeightGradientListComponent.cpp
Source/Components/TerrainHeightGradientListComponent.h
Source/Components/TerrainLayerSpawnerComponent.cpp