7052ccfa52
* Terrain feature processor improvements regarding material, mesh, and lod - Now using a material with pbr lighting for terrain. Removed some of the old shader code that wasn't needed anymore - Move heightmap image declaration to the material so it's not needed in the object SRG anymore - Added prototype code (commented out) for smoothing the terrain with a b-spline weighting function - Mesh data is all made with a proper mesh asset now. - Added basic LOD support (no continuous LOD yet, but it does pop between lod levels) - Moved RenderCommon to be accessible publicly. It contains stencil refs that should be public. Signed-off-by: Ken Pruiksma <pruiksma@amazon.com> * Adding more material options to terrain shader Signed-off-by: Ken Pruiksma <pruiksma@amazon.com> * Fixing terrain's per object srg because of changes in the default per object srg. Signed-off-by: Ken Pruiksma <pruiksma@amazon.com> * Added more features to the terrain material. Shader & Material reloads are now handled. Signed-off-by: Ken Pruiksma <pruiksma@amazon.com> * Added stub for terrain render max area setting in the renderer component. Added detail texture tiling setable from the material Signed-off-by: Ken Pruiksma <pruiksma@amazon.com> * Missing change to material type from last commit Signed-off-by: Ken Pruiksma <pruiksma@amazon.com> * Adding macro material in material type and support detail roughness. Signed-off-by: Ken Pruiksma <pruiksma@amazon.com> * Fixing merge issues in terrain material type Signed-off-by: Ken Pruiksma <pruiksma@amazon.com> * Adding more features to the terrain material - Macro color and normals - Detail layer fade out - Reoriented detail normals Signed-off-by: Ken Pruiksma <pruiksma@amazon.com> * Remove line that unintentionally was added back during a rebase & merge. Signed-off-by: Ken Pruiksma <pruiksma@amazon.com> * Fixing previously deleted unused static that came back after a merge. Fixed an issue with macro normals in the terrain shader. Signed-off-by: Ken Pruiksma <pruiksma@amazon.com>
91 lines
2.8 KiB
C++
91 lines
2.8 KiB
C++
/*
|
|
* 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/Component/Component.h>
|
|
#include <AzCore/Math/Vector3.h>
|
|
#include <TerrainSystem/TerrainSystem.h>
|
|
|
|
namespace LmbrCentral
|
|
{
|
|
template<typename, typename>
|
|
class EditorWrappedComponentBase;
|
|
}
|
|
|
|
namespace AZ::RPI
|
|
{
|
|
class Scene;
|
|
}
|
|
|
|
namespace Terrain
|
|
{
|
|
class TerrainFeatureProcessor;
|
|
|
|
struct TerrainWorldRendererConfig final
|
|
: public AZ::ComponentConfig
|
|
{
|
|
AZ_CLASS_ALLOCATOR(TerrainWorldRendererConfig, AZ::SystemAllocator, 0);
|
|
AZ_RTTI(TerrainWorldRendererConfig, "{08C5863C-092D-4A69-8226-4978E4F6E343}", AZ::ComponentConfig);
|
|
static void Reflect(AZ::ReflectContext* context);
|
|
|
|
enum class WorldSize : uint8_t
|
|
{
|
|
Unknown,
|
|
|
|
_512Meters,
|
|
_1024Meters,
|
|
_2048Meters,
|
|
_4096Meters,
|
|
_8192Meters,
|
|
_16384Meters,
|
|
|
|
WorldSizeCount,
|
|
};
|
|
|
|
WorldSize m_worldSize;
|
|
};
|
|
|
|
|
|
class TerrainWorldRendererComponent
|
|
: public AZ::Component
|
|
, public AzFramework::Terrain::TerrainDataNotificationBus::Handler
|
|
{
|
|
public:
|
|
template<typename, typename>
|
|
friend class LmbrCentral::EditorWrappedComponentBase;
|
|
AZ_COMPONENT(TerrainWorldRendererComponent, "{3B0DB71E-5944-437C-8C88-70F8B405BFC7}");
|
|
static void GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& services);
|
|
static void GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& services);
|
|
static void GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& services);
|
|
static void Reflect(AZ::ReflectContext* context);
|
|
|
|
TerrainWorldRendererComponent(const TerrainWorldRendererConfig& configuration);
|
|
TerrainWorldRendererComponent() = default;
|
|
~TerrainWorldRendererComponent() override;
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
// AZ::Component interface implementation
|
|
void Activate() override;
|
|
void Deactivate() override;
|
|
bool ReadInConfig(const AZ::ComponentConfig* baseConfig) override;
|
|
bool WriteOutConfig(AZ::ComponentConfig* outBaseConfig) const override;
|
|
|
|
protected:
|
|
void OnTerrainDataDestroyBegin() override;
|
|
void OnTerrainDataChanged(const AZ::Aabb& dirtyRegion, TerrainDataChangedMask dataChangedMask) override;
|
|
|
|
AZ::RPI::Scene* GetScene() const;
|
|
|
|
private:
|
|
TerrainWorldRendererConfig m_configuration;
|
|
bool m_terrainRendererActive{ false };
|
|
TerrainFeatureProcessor* m_terrainFeatureProcessor{ nullptr };
|
|
};
|
|
}
|