Removed Cry FogVolume component (#346)
This commit is contained in:
@@ -39,7 +39,6 @@
|
||||
#include "Rendering/LightComponent.h"
|
||||
#include "Rendering/HighQualityShadowComponent.h"
|
||||
#include "Rendering/MeshComponent.h"
|
||||
#include "Rendering/FogVolumeComponent.h"
|
||||
#include "Rendering/GeomCacheComponent.h"
|
||||
#include "Ai/NavigationComponent.h"
|
||||
#include "Scripting/TagComponent.h"
|
||||
@@ -241,7 +240,6 @@ namespace LmbrCentral
|
||||
StereoRendererComponent::CreateDescriptor(),
|
||||
NavigationSystemComponent::CreateDescriptor(),
|
||||
GeometrySystemComponent::CreateDescriptor(),
|
||||
FogVolumeComponent::CreateDescriptor(),
|
||||
RandomTimedSpawnerComponent::CreateDescriptor(),
|
||||
GeometryCacheComponent::CreateDescriptor(),
|
||||
SphereShapeDebugDisplayComponent::CreateDescriptor(),
|
||||
|
||||
@@ -34,7 +34,6 @@
|
||||
#include "Rendering/EditorEnvProbeComponent.h"
|
||||
#include "Rendering/EditorHighQualityShadowComponent.h"
|
||||
#include "Rendering/EditorMeshComponent.h"
|
||||
#include "Rendering/EditorFogVolumeComponent.h"
|
||||
#include "Rendering/EditorGeomCacheComponent.h"
|
||||
#include "Scripting/EditorLookAtComponent.h"
|
||||
#include "Scripting/EditorRandomTimedSpawnerComponent.h"
|
||||
@@ -104,7 +103,6 @@ namespace LmbrCentral
|
||||
EditorCommentComponent::CreateDescriptor(),
|
||||
EditorNavigationAreaComponent::CreateDescriptor(),
|
||||
EditorNavigationSeedComponent::CreateDescriptor(),
|
||||
EditorFogVolumeComponent::CreateDescriptor(),
|
||||
EditorRandomTimedSpawnerComponent::CreateDescriptor(),
|
||||
EditorGeometryCacheComponent::CreateDescriptor(),
|
||||
EditorSpawnerComponent::CreateDescriptor(),
|
||||
|
||||
@@ -1,353 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
#include "LmbrCentral_precompiled.h"
|
||||
|
||||
#include <AzCore/RTTI/BehaviorContext.h>
|
||||
#include <AzCore/Serialization/EditContext.h>
|
||||
#include <AzCore/Component/TransformBus.h>
|
||||
|
||||
#include <LmbrCentral/Shape/BoxShapeComponentBus.h>
|
||||
#include <IEntityRenderState.h>
|
||||
|
||||
#include "EditorFogVolumeComponent.h"
|
||||
|
||||
namespace LmbrCentral
|
||||
{
|
||||
void EditorFogVolumeComponent::Activate()
|
||||
{
|
||||
Base::Activate();
|
||||
|
||||
const auto entityId = GetEntityId();
|
||||
|
||||
m_configuration.SetEntityId(entityId);
|
||||
m_configuration.UpdateSizeFromEntityShape();
|
||||
|
||||
m_fogVolume.SetEntityId(entityId);
|
||||
m_fogVolume.CreateFogVolumeRenderNode(m_configuration);
|
||||
|
||||
RefreshFog();
|
||||
|
||||
RenderNodeRequestBus::Handler::BusConnect(entityId);
|
||||
FogVolumeComponentRequestBus::Handler::BusConnect(entityId);
|
||||
ShapeComponentNotificationsBus::Handler::BusConnect(entityId);
|
||||
AZ::TransformNotificationBus::Handler::BusConnect(entityId);
|
||||
AzToolsFramework::EditorEvents::Bus::Handler::BusConnect();
|
||||
}
|
||||
|
||||
void EditorFogVolumeComponent::Deactivate()
|
||||
{
|
||||
Base::Deactivate();
|
||||
|
||||
m_fogVolume.DestroyRenderNode();
|
||||
m_fogVolume.SetEntityId(AZ::EntityId());
|
||||
m_configuration.SetEntityId(AZ::EntityId());
|
||||
|
||||
AzToolsFramework::EditorEvents::Bus::Handler::BusDisconnect();
|
||||
AZ::TransformNotificationBus::Handler::BusDisconnect();
|
||||
ShapeComponentNotificationsBus::Handler::BusDisconnect();
|
||||
FogVolumeComponentRequestBus::Handler::BusDisconnect();
|
||||
RenderNodeRequestBus::Handler::BusDisconnect();
|
||||
}
|
||||
|
||||
void EditorFogVolumeComponent::Reflect(AZ::ReflectContext* context)
|
||||
{
|
||||
AZ::SerializeContext* serializeContext = azrtti_cast<AZ::SerializeContext*>(context);
|
||||
|
||||
EditorFogVolumeConfiguration::Reflect(context);
|
||||
|
||||
if (serializeContext)
|
||||
{
|
||||
serializeContext->Class<EditorFogVolumeComponent, EditorComponentBase>()
|
||||
->Version(1)
|
||||
->Field("FogVolumeConfiguration", &EditorFogVolumeComponent::m_configuration);
|
||||
|
||||
if (AZ::EditContext* editContext = serializeContext->GetEditContext())
|
||||
{
|
||||
editContext->Class<EditorFogVolumeComponent>(
|
||||
"Fog Volume", "Allows to specify an area with a fog")
|
||||
->ClassElement(AZ::Edit::ClassElements::EditorData, "")
|
||||
->Attribute(AZ::Edit::Attributes::Category, "Environment")
|
||||
->Attribute(AZ::Edit::Attributes::Icon, "Editor/Icons/Components/FogVolume.svg")
|
||||
->Attribute(AZ::Edit::Attributes::ViewportIcon, "Editor/Icons/Components/Viewport/FogVolume.png")
|
||||
->Attribute(AZ::Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC("Game", 0x232b318c))
|
||||
->Attribute(AZ::Edit::Attributes::HelpPageURL, "http://docs.aws.amazon.com/console/lumberyard/userguide/fog-volume-component")
|
||||
->Attribute(AZ::Edit::Attributes::AutoExpand, false)
|
||||
->DataElement(0, &EditorFogVolumeComponent::m_configuration, "Settings", "Fog configuration")
|
||||
->Attribute(AZ::Edit::Attributes::AutoExpand, true)
|
||||
->Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
if (AZ::BehaviorContext* behaviorContext = azrtti_cast<AZ::BehaviorContext*>(context))
|
||||
{
|
||||
behaviorContext->Class<EditorFogVolumeComponent>()->RequestBus("EditorFogVolumeComponentRequestBus");
|
||||
FogVolumeComponent::ExposeRequestsBusInBehaviorContext(behaviorContext, "EditorFogVolumeComponentRequestBus");
|
||||
}
|
||||
}
|
||||
|
||||
IRenderNode* EditorFogVolumeComponent::GetRenderNode()
|
||||
{
|
||||
return m_fogVolume.GetRenderNode();
|
||||
}
|
||||
|
||||
float EditorFogVolumeComponent::GetRenderNodeRequestBusOrder() const
|
||||
{
|
||||
return FogVolumeComponent::s_renderNodeRequestBusOrder;
|
||||
}
|
||||
|
||||
void EditorFogVolumeComponent::RefreshFog()
|
||||
{
|
||||
m_fogVolume.UpdateFogVolumeProperties(m_configuration);
|
||||
m_fogVolume.UpdateRenderingFlags(m_configuration);
|
||||
m_fogVolume.UpdateFogVolumeTransform();
|
||||
}
|
||||
|
||||
void EditorFogVolumeComponent::OnTransformChanged([[maybe_unused]] const AZ::Transform& local, [[maybe_unused]] const AZ::Transform& world)
|
||||
{
|
||||
// Entities transform component calls OnTransformChanged before this component is activated
|
||||
// This only happens during undo operations so we guard against that in the Editor component
|
||||
if (m_fogVolume.GetRenderNode())
|
||||
{
|
||||
RefreshFog();
|
||||
}
|
||||
}
|
||||
|
||||
void EditorFogVolumeComponent::OnShapeChanged(ShapeComponentNotifications::ShapeChangeReasons changeReason)
|
||||
{
|
||||
if (changeReason == ShapeComponentNotifications::ShapeChangeReasons::ShapeChanged)
|
||||
{
|
||||
m_configuration.UpdateSizeFromEntityShape();
|
||||
RefreshFog();
|
||||
}
|
||||
}
|
||||
|
||||
void EditorFogVolumeComponent::OnEditorSpecChange()
|
||||
{
|
||||
RefreshFog();
|
||||
}
|
||||
|
||||
void EditorFogVolumeComponent::GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required)
|
||||
{
|
||||
return FogVolumeComponent::GetRequiredServices(required);
|
||||
}
|
||||
|
||||
void EditorFogVolumeComponent::BuildGameEntity(AZ::Entity* gameEntity)
|
||||
{
|
||||
FogVolumeComponent* fogComponent = gameEntity->CreateComponent<FogVolumeComponent>();
|
||||
if (fogComponent)
|
||||
{
|
||||
fogComponent->SetConfiguration(m_configuration);
|
||||
}
|
||||
}
|
||||
|
||||
void EditorFogVolumeConfiguration::Reflect(AZ::ReflectContext * context)
|
||||
{
|
||||
if (AZ::SerializeContext* serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
|
||||
{
|
||||
serializeContext->Class<EditorFogVolumeConfiguration, FogVolumeConfiguration>()->
|
||||
Version(1);
|
||||
|
||||
if (AZ::EditContext* editContext = serializeContext->GetEditContext())
|
||||
{
|
||||
editContext->Class<FogVolumeConfiguration>("Configuration", "Fog Volume configuration")
|
||||
|
||||
->ClassElement(AZ::Edit::ClassElements::EditorData, "")
|
||||
->Attribute(AZ::Edit::Attributes::AutoExpand, true)
|
||||
->Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)
|
||||
|
||||
->DataElement(AZ::Edit::UIHandlers::ComboBox, &FogVolumeConfiguration::m_volumeType,
|
||||
"Volume type", "Shape of the fog")
|
||||
->Attribute(AZ::Edit::Attributes::ChangeNotify, &FogVolumeConfiguration::PropertyChanged)
|
||||
->EnumAttribute(FogVolumeType::RectangularPrism, "Cuboid")
|
||||
->EnumAttribute(FogVolumeType::Ellipsoid, "Ellipsoid")
|
||||
|
||||
->DataElement(AZ::Edit::UIHandlers::Color, &FogVolumeConfiguration::m_color,
|
||||
"Color", "Fog color")
|
||||
->Attribute(AZ::Edit::Attributes::ChangeNotify, &FogVolumeConfiguration::PropertyChanged)
|
||||
|
||||
->DataElement(AZ::Edit::UIHandlers::CheckBox, &FogVolumeConfiguration::m_useGlobalFogColor,
|
||||
"Use global fog color", "If true, the Color property is ignored. Instead, the current global fog color is used")
|
||||
->Attribute(AZ::Edit::Attributes::ChangeNotify, &FogVolumeConfiguration::PropertyChanged)
|
||||
|
||||
->DataElement(AZ::Edit::UIHandlers::Slider, &FogVolumeConfiguration::m_globalDensity,
|
||||
"Fog Density", "Controls the density of the fog. The higher the value the more dense the fog and the less you'll be able to see objects behind or inside the fog volume")
|
||||
->Attribute(AZ::Edit::Attributes::ChangeNotify, &FogVolumeConfiguration::PropertyChanged)
|
||||
->Attribute(AZ::Edit::Attributes::Min, 0.01f)
|
||||
->Attribute(AZ::Edit::Attributes::Max, 1000.0f)
|
||||
->Attribute(AZ::Edit::Attributes::Step, 1.0f)
|
||||
|
||||
->DataElement(AZ::Edit::UIHandlers::Slider, &FogVolumeConfiguration::m_densityOffset,
|
||||
"Density offset", "Offset fog density, used in conjunction with the GlobalDensity parameter")
|
||||
->Attribute(AZ::Edit::Attributes::ChangeNotify, &FogVolumeConfiguration::PropertyChanged)
|
||||
->Attribute(AZ::Edit::Attributes::Min, -1000.0f)
|
||||
->Attribute(AZ::Edit::Attributes::Max, 1000.0f)
|
||||
->Attribute(AZ::Edit::Attributes::Step, 1.0f)
|
||||
|
||||
->DataElement(AZ::Edit::UIHandlers::Slider, &FogVolumeConfiguration::m_nearCutoff,
|
||||
"Near cutoff", "Stop rendering the object, depending on camera distance to object")
|
||||
->Attribute(AZ::Edit::Attributes::ChangeNotify, &FogVolumeConfiguration::PropertyChanged)
|
||||
->Attribute(AZ::Edit::Attributes::Min, 0.0f)
|
||||
->Attribute(AZ::Edit::Attributes::Max, 2.0f)
|
||||
->Attribute(AZ::Edit::Attributes::Step, 0.1f)
|
||||
|
||||
->DataElement(AZ::Edit::UIHandlers::Slider, &FogVolumeConfiguration::m_softEdges,
|
||||
"Soft edges", "Specifies a factor that is used to soften the edges of the fog volume when viewed from outside")
|
||||
->Attribute(AZ::Edit::Attributes::ChangeNotify, &FogVolumeConfiguration::PropertyChanged)
|
||||
->Attribute(AZ::Edit::Attributes::Min, 0.0f)
|
||||
->Attribute(AZ::Edit::Attributes::Max, 1.0f)
|
||||
->Attribute(AZ::Edit::Attributes::Step, 0.01f)
|
||||
|
||||
->DataElement(AZ::Edit::UIHandlers::Slider, &FogVolumeConfiguration::m_windInfluence,
|
||||
"Wind influence (Volumetric Fog only)", "Controls the influence of the wind (Volumetric Fog only)")
|
||||
->Attribute(AZ::Edit::Attributes::ChangeNotify, &FogVolumeConfiguration::PropertyChanged)
|
||||
->Attribute(AZ::Edit::Attributes::Min, 0.0f)
|
||||
->Attribute(AZ::Edit::Attributes::Max, 20.0f)
|
||||
->Attribute(AZ::Edit::Attributes::Step, 0.01f)
|
||||
|
||||
->ClassElement(AZ::Edit::ClassElements::Group, "Rendering General")
|
||||
->Attribute(AZ::Edit::Attributes::AutoExpand, true)
|
||||
|
||||
->DataElement(AZ::Edit::UIHandlers::CheckBox, &FogVolumeConfiguration::m_ignoresVisAreas,
|
||||
"Ignore vis. areas", "Controls whether this entity should respond to visareas")
|
||||
->Attribute(AZ::Edit::Attributes::ChangeNotify, &FogVolumeConfiguration::PropertyChanged)
|
||||
|
||||
->DataElement(AZ::Edit::UIHandlers::CheckBox, &FogVolumeConfiguration::m_affectsThisAreaOnly,
|
||||
"Affect this area only", "Set this parameter to false to make this entity affect in multiple visareas")
|
||||
->Attribute(AZ::Edit::Attributes::ChangeNotify, &FogVolumeConfiguration::PropertyChanged)
|
||||
|
||||
->DataElement(0, &FogVolumeConfiguration::m_viewDistMultiplier,
|
||||
"View distance multiplier", "Adjusts max view distance. If 1.0 then default is used. 1.1 would be 10% further than default.")
|
||||
->Attribute(AZ::Edit::Attributes::ChangeNotify, &FogVolumeConfiguration::PropertyChanged)
|
||||
->Attribute(AZ::Edit::Attributes::Suffix, "x")
|
||||
->Attribute(AZ::Edit::Attributes::Min, 0.f)
|
||||
|
||||
->DataElement(AZ::Edit::UIHandlers::ComboBox, &FogVolumeConfiguration::m_minSpec,
|
||||
"Minimum spec", "Min spec for the fog to be active.")
|
||||
->Attribute(AZ::Edit::Attributes::ChangeNotify, &FogVolumeConfiguration::PropertyChanged)
|
||||
->EnumAttribute(EngineSpec::Never, "Never")
|
||||
->EnumAttribute(EngineSpec::VeryHigh, "Very high")
|
||||
->EnumAttribute(EngineSpec::High, "High")
|
||||
->EnumAttribute(EngineSpec::Medium, "Medium")
|
||||
->EnumAttribute(EngineSpec::Low, "Low")
|
||||
|
||||
->ClassElement(AZ::Edit::ClassElements::Group, "")
|
||||
->Attribute(AZ::Edit::Attributes::AutoExpand, true)
|
||||
|
||||
->DataElement(AZ::Edit::UIHandlers::Slider, &FogVolumeConfiguration::m_hdrDynamic,
|
||||
"HDR Dynamic (Non-Volumetric Fog)", "Specifies how much brighter than the default 255,255,255 white the fog is (Non-Volumetric Fog only)")
|
||||
->Attribute(AZ::Edit::Attributes::ChangeNotify, &FogVolumeConfiguration::PropertyChanged)
|
||||
->Attribute(AZ::Edit::Attributes::Min, 0.0f)
|
||||
->Attribute(AZ::Edit::Attributes::Max, 20.0f)
|
||||
->Attribute(AZ::Edit::Attributes::Step, 0.01f)
|
||||
|
||||
->ClassElement(AZ::Edit::ClassElements::Group, "Fall Off Settings")
|
||||
->Attribute(AZ::Edit::Attributes::AutoExpand, true)
|
||||
|
||||
->DataElement(AZ::Edit::UIHandlers::Slider, &FogVolumeConfiguration::m_fallOffDirLong,
|
||||
"Longitude", "Controls the longitude of the world space fall off direction of the fog. 0 represents East, rotation is counter-clockwise")
|
||||
->Attribute(AZ::Edit::Attributes::ChangeNotify, &FogVolumeConfiguration::PropertyChanged)
|
||||
->Attribute(AZ::Edit::Attributes::Min, 0.0f)
|
||||
->Attribute(AZ::Edit::Attributes::Max, 360.0f)
|
||||
->Attribute(AZ::Edit::Attributes::Step, 1.0f)
|
||||
|
||||
->DataElement(AZ::Edit::UIHandlers::Slider, &FogVolumeConfiguration::m_fallOffDirLatitude,
|
||||
"Latitude", "Controls the latitude of the world space fall off direction of the fog. 90 lets the fall off direction point upwards in world space")
|
||||
->Attribute(AZ::Edit::Attributes::ChangeNotify, &FogVolumeConfiguration::PropertyChanged)
|
||||
->Attribute(AZ::Edit::Attributes::Min, 0.0f)
|
||||
->Attribute(AZ::Edit::Attributes::Max, 360.0f)
|
||||
->Attribute(AZ::Edit::Attributes::Step, 1.0f)
|
||||
|
||||
->DataElement(AZ::Edit::UIHandlers::Slider, &FogVolumeConfiguration::m_fallOffShift,
|
||||
"Shift", "Controls how much to shift the fog density distribution along the fall off direction in world units")
|
||||
->Attribute(AZ::Edit::Attributes::ChangeNotify, &FogVolumeConfiguration::PropertyChanged)
|
||||
->Attribute(AZ::Edit::Attributes::Min, -50.0f)
|
||||
->Attribute(AZ::Edit::Attributes::Max, 50.0f)
|
||||
->Attribute(AZ::Edit::Attributes::Step, 0.1f)
|
||||
->Attribute(AZ::Edit::Attributes::Suffix, "m")
|
||||
|
||||
->DataElement(AZ::Edit::UIHandlers::Slider, &FogVolumeConfiguration::m_fallOffScale,
|
||||
"Scale", "Scales the density distribution along the fall off direction. Higher values will make the fog fall off more rapidly and generate thicker fog layers along the negative fall off direction")
|
||||
->Attribute(AZ::Edit::Attributes::ChangeNotify, &FogVolumeConfiguration::PropertyChanged)
|
||||
->Attribute(AZ::Edit::Attributes::Min, -50.0f)
|
||||
->Attribute(AZ::Edit::Attributes::Max, 50.0f)
|
||||
->Attribute(AZ::Edit::Attributes::Step, 0.01f)
|
||||
|
||||
->ClassElement(AZ::Edit::ClassElements::Group, "Ramp (Volumetric Fog only)")
|
||||
->Attribute(AZ::Edit::Attributes::AutoExpand, true)
|
||||
|
||||
->DataElement(AZ::Edit::UIHandlers::Slider, &FogVolumeConfiguration::m_rampStart,
|
||||
"Start", "Specifies the start distance of fog density ramp in world units")
|
||||
->Attribute(AZ::Edit::Attributes::ChangeNotify, &FogVolumeConfiguration::PropertyChanged)
|
||||
->Attribute(AZ::Edit::Attributes::Min, 0.0f)
|
||||
->Attribute(AZ::Edit::Attributes::Max, 30000.0f)
|
||||
->Attribute(AZ::Edit::Attributes::Step, 1.0f)
|
||||
->Attribute(AZ::Edit::Attributes::Suffix, "m")
|
||||
|
||||
->DataElement(AZ::Edit::UIHandlers::Slider, &FogVolumeConfiguration::m_rampEnd,
|
||||
"End", "Specifies the end distance of fog density ramp in world units")
|
||||
->Attribute(AZ::Edit::Attributes::ChangeNotify, &FogVolumeConfiguration::PropertyChanged)
|
||||
->Attribute(AZ::Edit::Attributes::Min, 0.0f)
|
||||
->Attribute(AZ::Edit::Attributes::Max, 30000.0f)
|
||||
->Attribute(AZ::Edit::Attributes::Step, 1.0f)
|
||||
->Attribute(AZ::Edit::Attributes::Suffix, "m")
|
||||
|
||||
->DataElement(AZ::Edit::UIHandlers::Slider, &FogVolumeConfiguration::m_rampInfluence,
|
||||
"Influence", "Controls the influence of fog density ramp")
|
||||
->Attribute(AZ::Edit::Attributes::ChangeNotify, &FogVolumeConfiguration::PropertyChanged)
|
||||
->Attribute(AZ::Edit::Attributes::Min, 0.0f)
|
||||
->Attribute(AZ::Edit::Attributes::Max, 1.0f)
|
||||
->Attribute(AZ::Edit::Attributes::Step, 0.01f)
|
||||
|
||||
->ClassElement(AZ::Edit::ClassElements::Group, "Density Noise (Volumetric Fog only)")
|
||||
->Attribute(AZ::Edit::Attributes::AutoExpand, true)
|
||||
|
||||
->DataElement(AZ::Edit::UIHandlers::Slider, &FogVolumeConfiguration::m_densityNoiseScale,
|
||||
"Scale", "Scales the noise for the density")
|
||||
->Attribute(AZ::Edit::Attributes::ChangeNotify, &FogVolumeConfiguration::PropertyChanged)
|
||||
->Attribute(AZ::Edit::Attributes::Min, 0.0f)
|
||||
->Attribute(AZ::Edit::Attributes::Max, 10.0f)
|
||||
->Attribute(AZ::Edit::Attributes::Step, 0.01f)
|
||||
|
||||
->DataElement(AZ::Edit::UIHandlers::Slider, &FogVolumeConfiguration::m_densityNoiseOffset,
|
||||
"Offset", "Offsets the noise for the density")
|
||||
->Attribute(AZ::Edit::Attributes::ChangeNotify, &FogVolumeConfiguration::PropertyChanged)
|
||||
->Attribute(AZ::Edit::Attributes::Min, -2.0f)
|
||||
->Attribute(AZ::Edit::Attributes::Max, 2.0f)
|
||||
->Attribute(AZ::Edit::Attributes::Step, 0.01f)
|
||||
|
||||
->DataElement(AZ::Edit::UIHandlers::Slider, &FogVolumeConfiguration::m_densityNoiseTimeFrequency,
|
||||
"Time frequency", "Controls the time frequency of the noise for the density")
|
||||
->Attribute(AZ::Edit::Attributes::ChangeNotify, &FogVolumeConfiguration::PropertyChanged)
|
||||
->Attribute(AZ::Edit::Attributes::Min, 0.0f)
|
||||
->Attribute(AZ::Edit::Attributes::Max, 1.0f)
|
||||
->Attribute(AZ::Edit::Attributes::Step, 0.01f)
|
||||
|
||||
->DataElement(AZ::Edit::UIHandlers::Default, &FogVolumeConfiguration::m_densityNoiseFrequency,
|
||||
"Spatial frequency", "Controls the spatial frequency of the noise for the density")
|
||||
->Attribute(AZ::Edit::Attributes::ChangeNotify, &FogVolumeConfiguration::PropertyChanged)
|
||||
->Attribute(AZ::Edit::Attributes::Min, 0.0f)
|
||||
->Attribute(AZ::Edit::Attributes::Max, 10000.0f)
|
||||
;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
AZ::Crc32 EditorFogVolumeConfiguration::PropertyChanged()
|
||||
{
|
||||
if (m_entityId.IsValid())
|
||||
{
|
||||
FogVolumeComponentRequestBus::Event(m_entityId, &FogVolumeComponentRequestBus::Events::RefreshFog);
|
||||
}
|
||||
return AZ::Edit::PropertyRefreshLevels::None;
|
||||
}
|
||||
}
|
||||
@@ -1,93 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/base.h>
|
||||
#include <AzCore/Component/Component.h>
|
||||
#include <AzCore/Component/ComponentBus.h>
|
||||
#include <AzToolsFramework/ToolsComponents/EditorComponentBase.h>
|
||||
#include <AzToolsFramework/API/ToolsApplicationAPI.h>
|
||||
|
||||
#include <LmbrCentral/Rendering/RenderNodeBus.h>
|
||||
#include <LmbrCentral/Shape/ShapeComponentBus.h>
|
||||
|
||||
#include "FogVolumeComponent.h"
|
||||
#include "FogVolumeRequestsHandler.h"
|
||||
|
||||
namespace LmbrCentral
|
||||
{
|
||||
class EditorFogVolumeConfiguration
|
||||
: public FogVolumeConfiguration
|
||||
{
|
||||
public:
|
||||
AZ_TYPE_INFO(EditorFogVolumeConfiguration, "{9D431EA0-92F9-4A00-96C6-28B189A6EE56}");
|
||||
|
||||
static void Reflect(AZ::ReflectContext* context);
|
||||
AZ::Crc32 PropertyChanged() override;
|
||||
};
|
||||
|
||||
/**
|
||||
* In-editor fog volume component.
|
||||
*/
|
||||
class EditorFogVolumeComponent
|
||||
: public AzToolsFramework::Components::EditorComponentBase
|
||||
, private RenderNodeRequestBus::Handler
|
||||
, private FogVolumeComponentRequestsBusHandler
|
||||
, private AZ::TransformNotificationBus::Handler
|
||||
, private ShapeComponentNotificationsBus::Handler
|
||||
, private AzToolsFramework::EditorEvents::Bus::Handler
|
||||
{
|
||||
private:
|
||||
using Base = AzToolsFramework::Components::EditorComponentBase;
|
||||
|
||||
public:
|
||||
AZ_EDITOR_COMPONENT(EditorFogVolumeComponent, "{8CA5AB61-96D8-482F-B07C-DAD72ED73646}");
|
||||
|
||||
~EditorFogVolumeComponent() override = default;
|
||||
|
||||
// AZ::Component interface implementation
|
||||
void Activate() override;
|
||||
void Deactivate() override;
|
||||
|
||||
static void Reflect(AZ::ReflectContext* context);
|
||||
|
||||
// RenderNodeRequestBus::Handler
|
||||
IRenderNode* GetRenderNode() override;
|
||||
float GetRenderNodeRequestBusOrder() const override;
|
||||
|
||||
// FogVolumeComponentRequestBus::Handler
|
||||
void RefreshFog() override;
|
||||
|
||||
// TransformNotificationBus::Handler
|
||||
void OnTransformChanged(const AZ::Transform& local, const AZ::Transform& world) override;
|
||||
|
||||
// ShapeComponentNotificationsBus::Handler
|
||||
void OnShapeChanged(ShapeComponentNotifications::ShapeChangeReasons changeReason) override;
|
||||
|
||||
// AzToolsFramework::EditorEvents::Handler
|
||||
void OnEditorSpecChange() override;
|
||||
|
||||
static void GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required);
|
||||
|
||||
void BuildGameEntity(AZ::Entity* gameEntity) override;
|
||||
|
||||
protected:
|
||||
FogVolumeConfiguration& GetConfiguration() override
|
||||
{
|
||||
return m_configuration;
|
||||
}
|
||||
|
||||
private:
|
||||
EditorFogVolumeConfiguration m_configuration;
|
||||
FogVolume m_fogVolume;
|
||||
};
|
||||
}
|
||||
@@ -1,179 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
#include "LmbrCentral_precompiled.h"
|
||||
|
||||
#include <AzCore/Serialization/SerializeContext.h>
|
||||
#include <LmbrCentral/Shape/BoxShapeComponentBus.h>
|
||||
#include <MathConversion.h>
|
||||
#include <I3DEngine.h>
|
||||
|
||||
#include "FogVolumeCommon.h"
|
||||
#include "FogVolumeComponent.h"
|
||||
|
||||
#include <AzCore/Component/TransformBus.h>
|
||||
|
||||
namespace LmbrCentral
|
||||
{
|
||||
FogVolume::FogVolume()
|
||||
: m_fogRenderNode(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
FogVolume::~FogVolume()
|
||||
{
|
||||
DestroyRenderNode();
|
||||
}
|
||||
|
||||
void FogVolume::CreateFogVolumeRenderNode(const FogVolumeConfiguration& fogVolumeConfig)
|
||||
{
|
||||
AZ_Assert(m_entityId.IsValid(), "[FogVolumeCommon/FogVolumeComponent Component] Entity id is invalid");
|
||||
DestroyRenderNode();
|
||||
|
||||
m_fogRenderNode = static_cast<IFogVolumeRenderNode*>(gEnv->p3DEngine->CreateRenderNode(eERType_FogVolume));
|
||||
m_fogRenderNode->SetMinSpec(static_cast<int>(fogVolumeConfig.m_minSpec));
|
||||
m_fogRenderNode->SetViewDistanceMultiplier(fogVolumeConfig.m_viewDistMultiplier);
|
||||
|
||||
UpdateFogVolumeProperties(fogVolumeConfig);
|
||||
UpdateFogVolumeTransform();
|
||||
}
|
||||
|
||||
void FogVolume::DestroyRenderNode()
|
||||
{
|
||||
if (m_fogRenderNode != nullptr)
|
||||
{
|
||||
m_fogRenderNode->ReleaseNode();
|
||||
m_fogRenderNode = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void FogVolume::UpdateFogVolumeProperties(const FogVolumeConfiguration& fogVolumeConfig)
|
||||
{
|
||||
AZ_Assert(m_fogRenderNode != nullptr, "[FogVolumeCommon/FogVolumeComponent Component] Trying to updated null render node");
|
||||
|
||||
SFogVolumeProperties fogProperties;
|
||||
FogUtils::FogConfigToFogParams(fogVolumeConfig, fogProperties);
|
||||
|
||||
m_fogRenderNode->SetFogVolumeProperties(fogProperties);
|
||||
}
|
||||
|
||||
void FogVolume::UpdateFogVolumeTransform()
|
||||
{
|
||||
AZ_Assert(m_fogRenderNode != nullptr, "[FogVolumeCommon/FogVolumeComponent Component] Trying to updated null render node");
|
||||
|
||||
AZ::Transform parentTransform = AZ::Transform::CreateIdentity();
|
||||
AZ::TransformBus::EventResult(parentTransform, m_entityId, &AZ::TransformBus::Events::GetWorldTM);
|
||||
|
||||
m_fogRenderNode->SetScale(AZVec3ToLYVec3(parentTransform.GetScale()));
|
||||
m_fogRenderNode->SetMatrix(AZTransformToLYTransform(parentTransform));
|
||||
}
|
||||
|
||||
void FogVolume::UpdateRenderingFlags(const FogVolumeConfiguration& fogVolumeConfig)
|
||||
{
|
||||
if (m_fogRenderNode)
|
||||
{
|
||||
m_fogRenderNode->SetMinSpec(static_cast<AZ::u32>(fogVolumeConfig.m_minSpec));
|
||||
|
||||
if (gEnv && gEnv->p3DEngine)
|
||||
{
|
||||
const int configSpec = gEnv->pSystem->GetConfigSpec(true);
|
||||
|
||||
AZ::u32 rendFlags = static_cast<AZ::u32>(m_fogRenderNode->GetRndFlags());
|
||||
|
||||
const bool hidden = static_cast<AZ::u32>(configSpec) < static_cast<AZ::u32>(fogVolumeConfig.m_minSpec);
|
||||
if (hidden)
|
||||
{
|
||||
rendFlags |= ERF_HIDDEN;
|
||||
}
|
||||
else
|
||||
{
|
||||
rendFlags &= ~ERF_HIDDEN;
|
||||
}
|
||||
|
||||
rendFlags |= ERF_COMPONENT_ENTITY;
|
||||
m_fogRenderNode->SetRndFlags(rendFlags);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FogUtils::FogConfigToFogParams(const LmbrCentral::FogVolumeConfiguration& configuration, SFogVolumeProperties& fogVolumeProperties)
|
||||
{
|
||||
AZ_Assert(configuration.m_volumeType != FogVolumeType::None, "[FogConfigToFogParams] Attempting to create a fog with invalid volume type")
|
||||
|
||||
fogVolumeProperties.m_volumeType = static_cast<int>(configuration.m_volumeType);
|
||||
fogVolumeProperties.m_size = AZVec3ToLYVec3(configuration.m_size);
|
||||
fogVolumeProperties.m_color = AZColorToLYVec3(configuration.m_color);
|
||||
fogVolumeProperties.m_useGlobalFogColor = configuration.m_useGlobalFogColor;
|
||||
fogVolumeProperties.m_ignoresVisAreas = configuration.m_ignoresVisAreas;
|
||||
fogVolumeProperties.m_affectsThisAreaOnly = configuration.m_affectsThisAreaOnly;
|
||||
|
||||
fogVolumeProperties.m_globalDensity = max(0.01f, configuration.m_globalDensity);
|
||||
fogVolumeProperties.m_densityOffset = configuration.m_densityOffset;
|
||||
fogVolumeProperties.m_nearCutoff = configuration.m_nearCutoff;
|
||||
fogVolumeProperties.m_fHDRDynamic = configuration.m_hdrDynamic;
|
||||
fogVolumeProperties.m_softEdges = configuration.m_softEdges;
|
||||
|
||||
fogVolumeProperties.m_heightFallOffDirLong = configuration.m_fallOffDirLong;
|
||||
fogVolumeProperties.m_heightFallOffDirLati = configuration.m_fallOffDirLatitude;
|
||||
fogVolumeProperties.m_heightFallOffShift = configuration.m_fallOffShift;
|
||||
fogVolumeProperties.m_heightFallOffScale = configuration.m_fallOffScale;
|
||||
|
||||
fogVolumeProperties.m_rampStart = configuration.m_rampStart;
|
||||
fogVolumeProperties.m_rampEnd = configuration.m_rampEnd;
|
||||
fogVolumeProperties.m_rampInfluence = configuration.m_rampInfluence;
|
||||
fogVolumeProperties.m_windInfluence = configuration.m_windInfluence;
|
||||
|
||||
fogVolumeProperties.m_densityNoiseScale = configuration.m_densityNoiseScale;
|
||||
fogVolumeProperties.m_densityNoiseOffset = configuration.m_densityNoiseOffset;
|
||||
fogVolumeProperties.m_densityNoiseTimeFrequency = configuration.m_densityNoiseTimeFrequency;
|
||||
fogVolumeProperties.m_densityNoiseFrequency = AZVec3ToLYVec3(configuration.m_densityNoiseFrequency);
|
||||
}
|
||||
|
||||
void FogVolumeConfiguration::Reflect(AZ::ReflectContext * context)
|
||||
{
|
||||
if (AZ::SerializeContext *serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
|
||||
{
|
||||
serializeContext->Class<FogVolumeConfiguration>()
|
||||
->Version(1)
|
||||
->Field("VolumeType", &FogVolumeConfiguration::m_volumeType)
|
||||
->Field("Color", &FogVolumeConfiguration::m_color)
|
||||
->Field("HdrDynamic", &FogVolumeConfiguration::m_hdrDynamic)
|
||||
->Field("UseGlobalFogColor", &FogVolumeConfiguration::m_useGlobalFogColor)
|
||||
->Field("SoftEdges", &FogVolumeConfiguration::m_softEdges)
|
||||
->Field("WindInfluence", &FogVolumeConfiguration::m_windInfluence)
|
||||
->Field("GlobalDensity", &FogVolumeConfiguration::m_globalDensity)
|
||||
->Field("DensityOffset", &FogVolumeConfiguration::m_densityOffset)
|
||||
->Field("NearCutoff", &FogVolumeConfiguration::m_nearCutoff)
|
||||
->Field("EngineSpec", &FogVolumeConfiguration::m_minSpec)
|
||||
->Field("DistMult", &FogVolumeConfiguration::m_viewDistMultiplier)
|
||||
->Field("IgnoresVisAreas", &FogVolumeConfiguration::m_ignoresVisAreas)
|
||||
->Field("AffectsThisAreaOnly", &FogVolumeConfiguration::m_affectsThisAreaOnly)
|
||||
->Field("FallOffDirLong", &FogVolumeConfiguration::m_fallOffDirLong)
|
||||
->Field("FallOffDirLatitude", &FogVolumeConfiguration::m_fallOffDirLatitude)
|
||||
->Field("FallOffShift", &FogVolumeConfiguration::m_fallOffShift)
|
||||
->Field("FallOffScale", &FogVolumeConfiguration::m_fallOffScale)
|
||||
->Field("RampStart", &FogVolumeConfiguration::m_rampStart)
|
||||
->Field("RampEnd", &FogVolumeConfiguration::m_rampEnd)
|
||||
->Field("RampInfluence", &FogVolumeConfiguration::m_rampInfluence)
|
||||
->Field("DensityNoiseScale", &FogVolumeConfiguration::m_densityNoiseScale)
|
||||
->Field("DensityNoiseOffset", &FogVolumeConfiguration::m_densityNoiseOffset)
|
||||
->Field("DensityNoiseTimeFrequency", &FogVolumeConfiguration::m_densityNoiseTimeFrequency)
|
||||
->Field("DensityNoiseFrequency", &FogVolumeConfiguration::m_densityNoiseFrequency)
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
void FogVolumeConfiguration::UpdateSizeFromEntityShape()
|
||||
{
|
||||
AZ_Assert(m_entityId.IsValid(), "[FogVolumeConfiguration] Entity id is invalid");
|
||||
BoxShapeComponentRequestsBus::EventResult(m_size, m_entityId, &BoxShapeComponentRequestsBus::Events::GetBoxDimensions);
|
||||
}
|
||||
}
|
||||
@@ -1,116 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/Component/EntityId.h>
|
||||
#include <AzCore/Math/Color.h>
|
||||
#include <IEntityRenderState.h>
|
||||
|
||||
#include <LmbrCentral/Rendering/FogVolumeComponentBus.h>
|
||||
|
||||
struct SFogVolumeProperties;
|
||||
struct IFogVolumeRenderNode;
|
||||
|
||||
namespace LmbrCentral
|
||||
{
|
||||
/**
|
||||
* Stores configuration settings for the Fog Volume.
|
||||
*/
|
||||
class FogVolumeConfiguration
|
||||
{
|
||||
public:
|
||||
AZ_TYPE_INFO(FogVolumeConfiguration, "{3B786BBB-0B1D-4EF2-9181-CC75C783C26E}");
|
||||
virtual ~FogVolumeConfiguration() {};
|
||||
|
||||
static void Reflect(AZ::ReflectContext* context);
|
||||
|
||||
// Universal rendering properties
|
||||
EngineSpec m_minSpec = EngineSpec::Low;
|
||||
float m_viewDistMultiplier = 1.0f;
|
||||
|
||||
FogVolumeType m_volumeType = FogVolumeType::Ellipsoid;
|
||||
AZ::Color m_color = AZ::Color(1.f, 1.f, 1.f, 1.f);
|
||||
// Size is not reflected: taken from BoxShape
|
||||
AZ::Vector3 m_size = AZ::Vector3(1.0f, 1.0f, 1.0f);
|
||||
|
||||
float m_hdrDynamic = false;
|
||||
bool m_useGlobalFogColor = false;
|
||||
|
||||
float m_globalDensity = 1.0f;
|
||||
float m_densityOffset = 0.0f;
|
||||
float m_nearCutoff = 0.0f;
|
||||
|
||||
float m_fallOffDirLong = 0.0f;
|
||||
float m_fallOffDirLatitude = 90.0f;
|
||||
float m_fallOffShift = 0.0f;
|
||||
float m_fallOffScale = 1.0f;
|
||||
|
||||
float m_softEdges = 1.0f;
|
||||
|
||||
float m_rampStart = 1.0f;
|
||||
float m_rampEnd = 50.0f;
|
||||
float m_rampInfluence = 0.0f;
|
||||
float m_windInfluence = 1.0f;
|
||||
|
||||
float m_densityNoiseScale = 1.0f;
|
||||
float m_densityNoiseOffset = 1.0f;
|
||||
float m_densityNoiseTimeFrequency = 0.0f;
|
||||
|
||||
AZ::Vector3 m_densityNoiseFrequency = AZ::Vector3(10.0f, 10.0f, 10.0f);
|
||||
bool m_ignoresVisAreas = false;
|
||||
bool m_affectsThisAreaOnly = 0.0f;
|
||||
|
||||
void UpdateSizeFromEntityShape();
|
||||
|
||||
// Implemented in EditorFogVolumeConfiguration
|
||||
virtual AZ::Crc32 PropertyChanged() { return 0; }
|
||||
|
||||
void SetEntityId(AZ::EntityId id) { m_entityId = id; }
|
||||
|
||||
protected:
|
||||
// Not reflected
|
||||
AZ::EntityId m_entityId;
|
||||
};
|
||||
|
||||
class FogVolume
|
||||
{
|
||||
public:
|
||||
FogVolume();
|
||||
FogVolume(const FogVolume&) = delete;
|
||||
FogVolume& operator= (const FogVolume&) = delete;
|
||||
|
||||
virtual ~FogVolume();
|
||||
|
||||
void SetEntityId(AZ::EntityId id) { m_entityId = id; }
|
||||
|
||||
void CreateFogVolumeRenderNode(const FogVolumeConfiguration& fogVolumeConfig);
|
||||
void DestroyRenderNode();
|
||||
|
||||
IFogVolumeRenderNode* GetRenderNode() const
|
||||
{
|
||||
return m_fogRenderNode;
|
||||
}
|
||||
|
||||
void UpdateFogVolumeProperties(const FogVolumeConfiguration& fogVolumeConfig);
|
||||
void UpdateRenderingFlags(const FogVolumeConfiguration& fogVolumeConfig);
|
||||
void UpdateFogVolumeTransform();
|
||||
|
||||
private:
|
||||
IFogVolumeRenderNode* m_fogRenderNode;
|
||||
AZ::EntityId m_entityId;
|
||||
};
|
||||
|
||||
namespace FogUtils
|
||||
{
|
||||
void FogConfigToFogParams(const LmbrCentral::FogVolumeConfiguration& configuration, SFogVolumeProperties& fogVolumeProperties);
|
||||
}
|
||||
}
|
||||
@@ -1,203 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
#include "LmbrCentral_precompiled.h"
|
||||
|
||||
#include <AzCore/Serialization/SerializeContext.h>
|
||||
#include <AzCore/RTTI/BehaviorContext.h>
|
||||
#include <IEntityRenderState.h>
|
||||
|
||||
#include "FogVolumeComponent.h"
|
||||
|
||||
namespace LmbrCentral
|
||||
{
|
||||
const float FogVolumeComponent::s_renderNodeRequestBusOrder = 500.f;
|
||||
|
||||
void FogVolumeComponent::Activate()
|
||||
{
|
||||
const auto entityId = GetEntityId();
|
||||
|
||||
m_configuration.SetEntityId(entityId);
|
||||
m_configuration.UpdateSizeFromEntityShape();
|
||||
|
||||
m_fogVolume.SetEntityId(entityId);
|
||||
m_fogVolume.CreateFogVolumeRenderNode(m_configuration);
|
||||
|
||||
RefreshFog();
|
||||
|
||||
RenderNodeRequestBus::Handler::BusConnect(entityId);
|
||||
FogVolumeComponentRequestBus::Handler::BusConnect(entityId);
|
||||
ShapeComponentNotificationsBus::Handler::BusConnect(entityId);
|
||||
AZ::TransformNotificationBus::Handler::BusConnect(entityId);
|
||||
}
|
||||
|
||||
void FogVolumeComponent::Deactivate()
|
||||
{
|
||||
m_fogVolume.DestroyRenderNode();
|
||||
m_fogVolume.SetEntityId(AZ::EntityId());
|
||||
m_configuration.SetEntityId(AZ::EntityId());
|
||||
|
||||
RenderNodeRequestBus::Handler::BusDisconnect();
|
||||
FogVolumeComponentRequestBus::Handler::BusDisconnect();
|
||||
ShapeComponentNotificationsBus::Handler::BusDisconnect();
|
||||
AZ::TransformNotificationBus::Handler::BusDisconnect();
|
||||
}
|
||||
|
||||
void FogVolumeComponent::Reflect(AZ::ReflectContext* context)
|
||||
{
|
||||
FogVolumeConfiguration::Reflect(context);
|
||||
|
||||
if (AZ::SerializeContext* serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
|
||||
{
|
||||
serializeContext->Class<FogVolumeComponent, AZ::Component>()
|
||||
->Version(1)
|
||||
->Field("FogVolumeConfiguration", &FogVolumeComponent::m_configuration);
|
||||
}
|
||||
|
||||
if (AZ::BehaviorContext* behaviorContext = azrtti_cast<AZ::BehaviorContext*>(context))
|
||||
{
|
||||
behaviorContext->Class<FogVolumeComponent>()->RequestBus("FogVolumeComponentRequestBus");
|
||||
FogVolumeComponent::ExposeRequestsBusInBehaviorContext(behaviorContext, "FogVolumeComponentRequestBus");
|
||||
}
|
||||
}
|
||||
|
||||
IRenderNode* FogVolumeComponent::GetRenderNode()
|
||||
{
|
||||
return m_fogVolume.GetRenderNode();
|
||||
}
|
||||
|
||||
float FogVolumeComponent::GetRenderNodeRequestBusOrder() const
|
||||
{
|
||||
return s_renderNodeRequestBusOrder;
|
||||
}
|
||||
|
||||
void FogVolumeComponent::RefreshFog()
|
||||
{
|
||||
m_fogVolume.UpdateFogVolumeProperties(m_configuration);
|
||||
m_fogVolume.UpdateRenderingFlags(m_configuration);
|
||||
m_fogVolume.UpdateFogVolumeTransform();
|
||||
}
|
||||
|
||||
void FogVolumeComponent::OnTransformChanged([[maybe_unused]] const AZ::Transform & local, [[maybe_unused]] const AZ::Transform & world)
|
||||
{
|
||||
RefreshFog();
|
||||
}
|
||||
|
||||
void FogVolumeComponent::OnShapeChanged(ShapeComponentNotifications::ShapeChangeReasons changeReason)
|
||||
{
|
||||
if (changeReason == ShapeComponentNotifications::ShapeChangeReasons::ShapeChanged)
|
||||
{
|
||||
m_configuration.UpdateSizeFromEntityShape();
|
||||
RefreshFog();
|
||||
}
|
||||
}
|
||||
|
||||
void FogVolumeComponent::GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType & required)
|
||||
{
|
||||
required.push_back(AZ_CRC("BoxShapeService", 0x946a0032));
|
||||
}
|
||||
|
||||
void FogVolumeComponent::ExposeRequestsBusInBehaviorContext(AZ::BehaviorContext* behaviorContext, const char* name)
|
||||
{
|
||||
behaviorContext->EBus<FogVolumeComponentRequestBus>(name)
|
||||
->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::All)
|
||||
->Event("RefreshFog", &FogVolumeComponentRequestBus::Events::RefreshFog)
|
||||
|
||||
->Event("GetVolumeType", &FogVolumeComponentRequestBus::Events::GetVolumeType)
|
||||
->Event("SetVolumeType", &FogVolumeComponentRequestBus::Events::SetVolumeType)
|
||||
->VirtualProperty("VolumeType", "GetVolumeType", "SetVolumeType")
|
||||
|
||||
->Event("GetColor", &FogVolumeComponentRequestBus::Events::GetColor)
|
||||
->Event("SetColor", &FogVolumeComponentRequestBus::Events::SetColor)
|
||||
->VirtualProperty("Color", "GetColor", "SetColor")
|
||||
|
||||
->Event("GetHdrDynamic", &FogVolumeComponentRequestBus::Events::GetHdrDynamic)
|
||||
->Event("SetHdrDynamic", &FogVolumeComponentRequestBus::Events::SetHdrDynamic)
|
||||
->VirtualProperty("HdrDynamic", "GetHdrDynamic", "SetHdrDynamic")
|
||||
|
||||
->Event("GetUseGlobalFogColor", &FogVolumeComponentRequestBus::Events::GetUseGlobalFogColor)
|
||||
->Event("SetUseGlobalFogColor", &FogVolumeComponentRequestBus::Events::SetUseGlobalFogColor)
|
||||
->VirtualProperty("UseGlobalFogColor", "GetUseGlobalFogColor", "SetUseGlobalFogColor")
|
||||
|
||||
->Event("GetGlobalDensity", &FogVolumeComponentRequestBus::Events::GetGlobalDensity)
|
||||
->Event("SetGlobalDensity", &FogVolumeComponentRequestBus::Events::SetGlobalDensity)
|
||||
->VirtualProperty("GlobalDensity", "GetGlobalDensity", "SetGlobalDensity")
|
||||
|
||||
->Event("GetDensityOffset", &FogVolumeComponentRequestBus::Events::GetDensityOffset)
|
||||
->Event("SetDensityOffset", &FogVolumeComponentRequestBus::Events::SetDensityOffset)
|
||||
->VirtualProperty("DensityOffset", "GetDensityOffset", "SetDensityOffset")
|
||||
|
||||
->Event("GetNearCutoff", &FogVolumeComponentRequestBus::Events::GetNearCutoff)
|
||||
->Event("SetNearCutoff", &FogVolumeComponentRequestBus::Events::SetNearCutoff)
|
||||
->VirtualProperty("NearCutoff", "GetNearCutoff", "SetNearCutoff")
|
||||
|
||||
->Event("GetFallOffDirLong", &FogVolumeComponentRequestBus::Events::GetFallOffDirLong)
|
||||
->Event("SetFallOffDirLong", &FogVolumeComponentRequestBus::Events::SetFallOffDirLong)
|
||||
->VirtualProperty("FallOffDirLong", "GetFallOffDirLong", "SetFallOffDirLong")
|
||||
|
||||
->Event("GetFallOffDirLatitude", &FogVolumeComponentRequestBus::Events::GetFallOffDirLatitude)
|
||||
->Event("SetFallOffDirLatitude", &FogVolumeComponentRequestBus::Events::SetFallOffDirLatitude)
|
||||
->VirtualProperty("FallOffDirLatitude", "GetFallOffDirLatitude", "SetFallOffDirLatitude")
|
||||
|
||||
->Event("GetFallOffShift", &FogVolumeComponentRequestBus::Events::GetFallOffShift)
|
||||
->Event("SetFallOffShift", &FogVolumeComponentRequestBus::Events::SetFallOffShift)
|
||||
->VirtualProperty("FallOffShift", "GetFallOffShift", "SetFallOffShift")
|
||||
|
||||
->Event("GetFallOffScale", &FogVolumeComponentRequestBus::Events::GetFallOffScale)
|
||||
->Event("SetFallOffScale", &FogVolumeComponentRequestBus::Events::SetFallOffScale)
|
||||
->VirtualProperty("FallOffScale", "GetFallOffScale", "SetFallOffScale")
|
||||
|
||||
->Event("GetSoftEdges", &FogVolumeComponentRequestBus::Events::GetSoftEdges)
|
||||
->Event("SetSoftEdges", &FogVolumeComponentRequestBus::Events::SetSoftEdges)
|
||||
->VirtualProperty("SoftEdges", "GetSoftEdges", "SetSoftEdges")
|
||||
|
||||
->Event("GetRampStart", &FogVolumeComponentRequestBus::Events::GetRampStart)
|
||||
->Event("SetRampStart", &FogVolumeComponentRequestBus::Events::SetRampStart)
|
||||
->VirtualProperty("RampStart", "GetRampStart", "SetRampStart")
|
||||
|
||||
->Event("GetRampEnd", &FogVolumeComponentRequestBus::Events::GetRampEnd)
|
||||
->Event("SetRampEnd", &FogVolumeComponentRequestBus::Events::SetRampEnd)
|
||||
->VirtualProperty("RampEnd", "GetRampEnd", "SetRampEnd")
|
||||
|
||||
->Event("GetRampInfluence", &FogVolumeComponentRequestBus::Events::GetRampInfluence)
|
||||
->Event("SetRampInfluence", &FogVolumeComponentRequestBus::Events::SetRampInfluence)
|
||||
->VirtualProperty("RampInfluence", "GetRampInfluence", "SetRampInfluence")
|
||||
|
||||
->Event("GetWindInfluence", &FogVolumeComponentRequestBus::Events::GetWindInfluence)
|
||||
->Event("SetWindInfluence", &FogVolumeComponentRequestBus::Events::SetWindInfluence)
|
||||
->VirtualProperty("WindInfluence", "GetWindInfluence", "SetWindInfluence")
|
||||
|
||||
->Event("GetDensityNoiseScale", &FogVolumeComponentRequestBus::Events::GetDensityNoiseScale)
|
||||
->Event("SetDensityNoiseScale", &FogVolumeComponentRequestBus::Events::SetDensityNoiseScale)
|
||||
->VirtualProperty("DensityNoiseScale", "GetDensityNoiseScale", "SetDensityNoiseScale")
|
||||
|
||||
->Event("GetDensityNoiseOffset", &FogVolumeComponentRequestBus::Events::GetDensityNoiseOffset)
|
||||
->Event("SetDensityNoiseOffset", &FogVolumeComponentRequestBus::Events::SetDensityNoiseOffset)
|
||||
->VirtualProperty("DensityNoiseOffset", "GetDensityNoiseOffset", "SetDensityNoiseOffset")
|
||||
|
||||
->Event("GetDensityNoiseTimeFrequency", &FogVolumeComponentRequestBus::Events::GetDensityNoiseTimeFrequency)
|
||||
->Event("SetDensityNoiseTimeFrequency", &FogVolumeComponentRequestBus::Events::SetDensityNoiseTimeFrequency)
|
||||
->VirtualProperty("DensityNoiseTimeFrequency", "GetDensityNoiseTimeFrequency", "SetDensityNoiseTimeFrequency")
|
||||
|
||||
->Event("GetDensityNoiseFrequency", &FogVolumeComponentRequestBus::Events::GetDensityNoiseFrequency)
|
||||
->Event("SetDensityNoiseFrequency", &FogVolumeComponentRequestBus::Events::SetDensityNoiseFrequency)
|
||||
->VirtualProperty("DensityNoiseFrequency", "GetDensityNoiseFrequency", "SetDensityNoiseFrequency")
|
||||
|
||||
->Event("GetIgnoresVisAreas", &FogVolumeComponentRequestBus::Events::GetIgnoresVisAreas)
|
||||
->Event("SetIgnoresVisAreas", &FogVolumeComponentRequestBus::Events::SetIgnoresVisAreas)
|
||||
->VirtualProperty("IgnoresVisAreas", "GetIgnoresVisAreas", "SetIgnoresVisAreas")
|
||||
|
||||
->Event("GetAffectsThisAreaOnly", &FogVolumeComponentRequestBus::Events::GetAffectsThisAreaOnly)
|
||||
->Event("SetAffectsThisAreaOnly", &FogVolumeComponentRequestBus::Events::SetAffectsThisAreaOnly)
|
||||
->VirtualProperty("AffectsThisAreaOnly", "GetAffectsThisAreaOnly", "SetAffectsThisAreaOnly")
|
||||
;
|
||||
}
|
||||
}
|
||||
@@ -1,84 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/base.h>
|
||||
|
||||
#include <AzCore/Component/Component.h>
|
||||
#include <AzCore/Component/ComponentBus.h>
|
||||
#include <AzCore/Component/TransformBus.h>
|
||||
#include <AzCore/Math/Vector3.h>
|
||||
|
||||
#include <LmbrCentral/Rendering/RenderNodeBus.h>
|
||||
#include <LmbrCentral/Shape/ShapeComponentBus.h>
|
||||
|
||||
#include <IEntityRenderState.h>
|
||||
|
||||
#include "FogVolumeCommon.h"
|
||||
#include "FogVolumeRequestsHandler.h"
|
||||
|
||||
namespace LmbrCentral
|
||||
{
|
||||
/*!
|
||||
* In-game Fog Volume component.
|
||||
*/
|
||||
class FogVolumeComponent
|
||||
: public AZ::Component
|
||||
, public RenderNodeRequestBus::Handler
|
||||
, private FogVolumeComponentRequestsBusHandler
|
||||
, private AZ::TransformNotificationBus::Handler
|
||||
, private ShapeComponentNotificationsBus::Handler
|
||||
{
|
||||
public:
|
||||
AZ_COMPONENT(FogVolumeComponent, "{C01B9E8F-C015-46AC-9065-79445CE1408A}");
|
||||
~FogVolumeComponent() override = default;
|
||||
|
||||
template<typename T>
|
||||
void SetConfiguration(T&& configuration)
|
||||
{
|
||||
m_configuration = AZStd::forward<T>(configuration);
|
||||
}
|
||||
|
||||
// AZ::Component interface implementation
|
||||
void Activate() override;
|
||||
void Deactivate() override;
|
||||
|
||||
static void Reflect(AZ::ReflectContext* context);
|
||||
|
||||
// RenderNodeRequestBus::Handler interface implementation
|
||||
IRenderNode* GetRenderNode() override;
|
||||
float GetRenderNodeRequestBusOrder() const override;
|
||||
static const float s_renderNodeRequestBusOrder;
|
||||
|
||||
// TransformNotificationBus::Handler
|
||||
void OnTransformChanged(const AZ::Transform& local, const AZ::Transform& world) override;
|
||||
|
||||
// ShapeComponentNotificationsBus::Handler
|
||||
void OnShapeChanged(ShapeComponentNotifications::ShapeChangeReasons changeReason) override;
|
||||
|
||||
// FogVolumeComponentRequestBus::Handler
|
||||
void RefreshFog() override;
|
||||
|
||||
static void GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required);
|
||||
static void ExposeRequestsBusInBehaviorContext(AZ::BehaviorContext* behaviorContext, const char* name);
|
||||
|
||||
protected:
|
||||
FogVolumeConfiguration& GetConfiguration() override
|
||||
{
|
||||
return m_configuration;
|
||||
}
|
||||
|
||||
private:
|
||||
FogVolumeConfiguration m_configuration;
|
||||
FogVolume m_fogVolume;
|
||||
};
|
||||
}
|
||||
@@ -1,264 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
#include "LmbrCentral_precompiled.h"
|
||||
|
||||
#include "FogVolumeRequestsHandler.h"
|
||||
#include "FogVolumeCommon.h"
|
||||
|
||||
namespace LmbrCentral
|
||||
{
|
||||
FogVolumeType FogVolumeComponentRequestsBusHandler::GetVolumeType()
|
||||
{
|
||||
return GetConfiguration().m_volumeType;
|
||||
}
|
||||
|
||||
void FogVolumeComponentRequestsBusHandler::SetVolumeType(FogVolumeType volumeType)
|
||||
{
|
||||
auto& configuration = GetConfiguration();
|
||||
if (configuration.m_volumeType != volumeType)
|
||||
{
|
||||
configuration.m_volumeType = volumeType;
|
||||
RefreshFog();
|
||||
}
|
||||
}
|
||||
|
||||
AZ::Color FogVolumeComponentRequestsBusHandler::GetColor()
|
||||
{
|
||||
return GetConfiguration().m_color;
|
||||
}
|
||||
|
||||
void FogVolumeComponentRequestsBusHandler::SetColor(AZ::Color color)
|
||||
{
|
||||
GetConfiguration().m_color = color;
|
||||
RefreshFog();
|
||||
}
|
||||
|
||||
float FogVolumeComponentRequestsBusHandler::GetHdrDynamic()
|
||||
{
|
||||
return GetConfiguration().m_hdrDynamic;
|
||||
}
|
||||
|
||||
void FogVolumeComponentRequestsBusHandler::SetHdrDynamic(float hdrDynamic)
|
||||
{
|
||||
GetConfiguration().m_hdrDynamic = hdrDynamic;
|
||||
RefreshFog();
|
||||
}
|
||||
|
||||
bool FogVolumeComponentRequestsBusHandler::GetUseGlobalFogColor()
|
||||
{
|
||||
return GetConfiguration().m_useGlobalFogColor;
|
||||
}
|
||||
|
||||
void FogVolumeComponentRequestsBusHandler::SetUseGlobalFogColor(bool useGlobalFogColor)
|
||||
{
|
||||
GetConfiguration().m_useGlobalFogColor = useGlobalFogColor;
|
||||
RefreshFog();
|
||||
}
|
||||
|
||||
float FogVolumeComponentRequestsBusHandler::GetGlobalDensity()
|
||||
{
|
||||
return GetConfiguration().m_globalDensity;
|
||||
}
|
||||
|
||||
void FogVolumeComponentRequestsBusHandler::SetGlobalDensity(float globalDensity)
|
||||
{
|
||||
GetConfiguration().m_globalDensity = globalDensity;
|
||||
RefreshFog();
|
||||
}
|
||||
|
||||
float FogVolumeComponentRequestsBusHandler::GetDensityOffset()
|
||||
{
|
||||
return GetConfiguration().m_densityOffset;
|
||||
}
|
||||
|
||||
void FogVolumeComponentRequestsBusHandler::SetDensityOffset(float densityOffset)
|
||||
{
|
||||
GetConfiguration().m_densityOffset = densityOffset;
|
||||
RefreshFog();
|
||||
}
|
||||
|
||||
float FogVolumeComponentRequestsBusHandler::GetNearCutoff()
|
||||
{
|
||||
return GetConfiguration().m_nearCutoff;
|
||||
}
|
||||
|
||||
void FogVolumeComponentRequestsBusHandler::SetNearCutoff(float nearCutoff)
|
||||
{
|
||||
GetConfiguration().m_nearCutoff = nearCutoff;
|
||||
RefreshFog();
|
||||
}
|
||||
|
||||
float FogVolumeComponentRequestsBusHandler::GetFallOffDirLong()
|
||||
{
|
||||
return GetConfiguration().m_fallOffDirLong;
|
||||
}
|
||||
|
||||
void FogVolumeComponentRequestsBusHandler::SetFallOffDirLong(float fallOffDirLong)
|
||||
{
|
||||
GetConfiguration().m_fallOffDirLong = fallOffDirLong;
|
||||
RefreshFog();
|
||||
}
|
||||
|
||||
float FogVolumeComponentRequestsBusHandler::GetFallOffDirLatitude()
|
||||
{
|
||||
return GetConfiguration().m_fallOffDirLatitude;
|
||||
}
|
||||
|
||||
void FogVolumeComponentRequestsBusHandler::SetFallOffDirLatitude(float fallOffDirLatitude)
|
||||
{
|
||||
GetConfiguration().m_fallOffDirLatitude = fallOffDirLatitude;
|
||||
RefreshFog();
|
||||
}
|
||||
|
||||
float FogVolumeComponentRequestsBusHandler::GetFallOffShift()
|
||||
{
|
||||
return GetConfiguration().m_fallOffShift;
|
||||
}
|
||||
|
||||
void FogVolumeComponentRequestsBusHandler::SetFallOffShift(float fallOffShift)
|
||||
{
|
||||
GetConfiguration().m_fallOffShift = fallOffShift;
|
||||
RefreshFog();
|
||||
}
|
||||
|
||||
float FogVolumeComponentRequestsBusHandler::GetFallOffScale()
|
||||
{
|
||||
return GetConfiguration().m_fallOffScale;
|
||||
}
|
||||
|
||||
void FogVolumeComponentRequestsBusHandler::SetFallOffScale(float fallOffScale)
|
||||
{
|
||||
GetConfiguration().m_fallOffScale = fallOffScale;
|
||||
RefreshFog();
|
||||
}
|
||||
|
||||
float FogVolumeComponentRequestsBusHandler::GetSoftEdges()
|
||||
{
|
||||
return GetConfiguration().m_softEdges;
|
||||
}
|
||||
|
||||
void FogVolumeComponentRequestsBusHandler::SetSoftEdges(float softEdges)
|
||||
{
|
||||
GetConfiguration().m_softEdges = softEdges;
|
||||
RefreshFog();
|
||||
}
|
||||
|
||||
float FogVolumeComponentRequestsBusHandler::GetRampStart()
|
||||
{
|
||||
return GetConfiguration().m_rampStart;
|
||||
}
|
||||
|
||||
void FogVolumeComponentRequestsBusHandler::SetRampStart(float rampStart)
|
||||
{
|
||||
GetConfiguration().m_rampStart = rampStart;
|
||||
RefreshFog();
|
||||
}
|
||||
|
||||
float FogVolumeComponentRequestsBusHandler::GetRampEnd()
|
||||
{
|
||||
return GetConfiguration().m_rampEnd;
|
||||
}
|
||||
|
||||
void FogVolumeComponentRequestsBusHandler::SetRampEnd(float rampEnd)
|
||||
{
|
||||
GetConfiguration().m_rampEnd = rampEnd;
|
||||
RefreshFog();
|
||||
}
|
||||
|
||||
float FogVolumeComponentRequestsBusHandler::GetRampInfluence()
|
||||
{
|
||||
return GetConfiguration().m_rampInfluence;
|
||||
}
|
||||
|
||||
void FogVolumeComponentRequestsBusHandler::SetRampInfluence(float rampInfluence)
|
||||
{
|
||||
GetConfiguration().m_rampInfluence = rampInfluence;
|
||||
RefreshFog();
|
||||
}
|
||||
|
||||
float FogVolumeComponentRequestsBusHandler::GetWindInfluence()
|
||||
{
|
||||
return GetConfiguration().m_windInfluence;
|
||||
}
|
||||
|
||||
void FogVolumeComponentRequestsBusHandler::SetWindInfluence(float windInfluence)
|
||||
{
|
||||
GetConfiguration().m_windInfluence = windInfluence;
|
||||
RefreshFog();
|
||||
}
|
||||
|
||||
float FogVolumeComponentRequestsBusHandler::GetDensityNoiseScale()
|
||||
{
|
||||
return GetConfiguration().m_densityNoiseScale;
|
||||
}
|
||||
|
||||
void FogVolumeComponentRequestsBusHandler::SetDensityNoiseScale(float densityNoiseScale)
|
||||
{
|
||||
GetConfiguration().m_densityNoiseScale = densityNoiseScale;
|
||||
RefreshFog();
|
||||
}
|
||||
|
||||
float FogVolumeComponentRequestsBusHandler::GetDensityNoiseOffset()
|
||||
{
|
||||
return GetConfiguration().m_densityNoiseOffset;
|
||||
}
|
||||
|
||||
void FogVolumeComponentRequestsBusHandler::SetDensityNoiseOffset(float densityNoiseOffset)
|
||||
{
|
||||
GetConfiguration().m_densityNoiseOffset = densityNoiseOffset;
|
||||
RefreshFog();
|
||||
}
|
||||
|
||||
float FogVolumeComponentRequestsBusHandler::GetDensityNoiseTimeFrequency()
|
||||
{
|
||||
return GetConfiguration().m_densityNoiseTimeFrequency;
|
||||
}
|
||||
|
||||
void FogVolumeComponentRequestsBusHandler::SetDensityNoiseTimeFrequency(float timeFrequency)
|
||||
{
|
||||
GetConfiguration().m_densityNoiseTimeFrequency = timeFrequency;
|
||||
RefreshFog();
|
||||
}
|
||||
|
||||
AZ::Vector3 FogVolumeComponentRequestsBusHandler::GetDensityNoiseFrequency()
|
||||
{
|
||||
return GetConfiguration().m_densityNoiseFrequency;
|
||||
}
|
||||
|
||||
void FogVolumeComponentRequestsBusHandler::SetDensityNoiseFrequency(AZ::Vector3 densityNoiseFrequency)
|
||||
{
|
||||
GetConfiguration().m_densityNoiseFrequency = densityNoiseFrequency;
|
||||
RefreshFog();
|
||||
}
|
||||
|
||||
bool FogVolumeComponentRequestsBusHandler::GetIgnoresVisAreas()
|
||||
{
|
||||
return GetConfiguration().m_ignoresVisAreas;
|
||||
}
|
||||
|
||||
void FogVolumeComponentRequestsBusHandler::SetIgnoresVisAreas(bool ignoresVisAreas)
|
||||
{
|
||||
GetConfiguration().m_ignoresVisAreas = ignoresVisAreas;
|
||||
RefreshFog();
|
||||
}
|
||||
|
||||
bool FogVolumeComponentRequestsBusHandler::GetAffectsThisAreaOnly()
|
||||
{
|
||||
return GetConfiguration().m_affectsThisAreaOnly;
|
||||
}
|
||||
|
||||
void FogVolumeComponentRequestsBusHandler::SetAffectsThisAreaOnly(bool affectsThisAreaOnly)
|
||||
{
|
||||
GetConfiguration().m_affectsThisAreaOnly = affectsThisAreaOnly;
|
||||
RefreshFog();
|
||||
}
|
||||
}
|
||||
@@ -1,94 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/Math/Color.h>
|
||||
#include <LmbrCentral/Rendering/FogVolumeComponentBus.h>
|
||||
|
||||
namespace LmbrCentral
|
||||
{
|
||||
class FogVolumeComponentRequestsBusHandler
|
||||
: public FogVolumeComponentRequestBus::Handler
|
||||
{
|
||||
/////////////////////////////////////////////
|
||||
// FogVolumeComponentRequestBus::Handler
|
||||
FogVolumeType GetVolumeType() override;
|
||||
void SetVolumeType(FogVolumeType volumeType) override;
|
||||
|
||||
AZ::Color GetColor() override;
|
||||
void SetColor(AZ::Color color) override;
|
||||
|
||||
float GetHdrDynamic() override;
|
||||
void SetHdrDynamic(float hdrDynamic) override;
|
||||
|
||||
bool GetUseGlobalFogColor() override;
|
||||
void SetUseGlobalFogColor(bool useGlobalFogColor) override;
|
||||
|
||||
float GetGlobalDensity() override;
|
||||
void SetGlobalDensity(float globalDensity) override;
|
||||
|
||||
float GetDensityOffset() override;
|
||||
void SetDensityOffset(float densityOffset) override;
|
||||
|
||||
float GetNearCutoff() override;
|
||||
void SetNearCutoff(float nearCutoff) override;
|
||||
|
||||
float GetFallOffDirLong() override;
|
||||
void SetFallOffDirLong(float fallOffDirLong) override;
|
||||
|
||||
float GetFallOffDirLatitude() override;
|
||||
void SetFallOffDirLatitude(float fallOffDirLatitude) override;
|
||||
|
||||
float GetFallOffShift() override;
|
||||
void SetFallOffShift(float fallOffShift) override;
|
||||
|
||||
float GetFallOffScale() override;
|
||||
void SetFallOffScale(float fallOffScale) override;
|
||||
|
||||
float GetSoftEdges() override;
|
||||
void SetSoftEdges(float softEdges) override;
|
||||
|
||||
float GetRampStart() override;
|
||||
void SetRampStart(float rampStart) override;
|
||||
|
||||
float GetRampEnd() override;
|
||||
void SetRampEnd(float rampEnd) override;
|
||||
|
||||
float GetRampInfluence() override;
|
||||
void SetRampInfluence(float rampInfluence) override;
|
||||
|
||||
float GetWindInfluence() override;
|
||||
void SetWindInfluence(float windInfluence) override;
|
||||
|
||||
float GetDensityNoiseScale() override;
|
||||
void SetDensityNoiseScale(float densityNoiseScale) override;
|
||||
|
||||
float GetDensityNoiseOffset() override;
|
||||
void SetDensityNoiseOffset(float densityNoiseOffset) override;
|
||||
|
||||
float GetDensityNoiseTimeFrequency() override;
|
||||
void SetDensityNoiseTimeFrequency(float timeFrequency) override;
|
||||
|
||||
AZ::Vector3 GetDensityNoiseFrequency() override;
|
||||
void SetDensityNoiseFrequency(AZ::Vector3 densityNoiseFrequency) override;
|
||||
|
||||
bool GetIgnoresVisAreas() override;
|
||||
void SetIgnoresVisAreas(bool ignoresVisAreas) override;
|
||||
|
||||
bool GetAffectsThisAreaOnly() override;
|
||||
void SetAffectsThisAreaOnly(bool affectsThisAreaOnly) override;
|
||||
/////////////////////////////////////////////
|
||||
|
||||
protected:
|
||||
virtual FogVolumeConfiguration& GetConfiguration() = 0;
|
||||
};
|
||||
}
|
||||
@@ -1,247 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/Component/ComponentBus.h>
|
||||
|
||||
namespace LmbrCentral
|
||||
{
|
||||
class FogVolumeConfiguration;
|
||||
|
||||
enum class FogVolumeType : AZ::s32
|
||||
{
|
||||
None = -1,
|
||||
Ellipsoid = 0,
|
||||
RectangularPrism = 1,
|
||||
};
|
||||
|
||||
class FogVolumeComponentRequests
|
||||
: public AZ::ComponentBus
|
||||
{
|
||||
public:
|
||||
virtual ~FogVolumeComponentRequests() {}
|
||||
|
||||
/// Propagates updated configuration to the fog volume component
|
||||
virtual void RefreshFog() {};
|
||||
|
||||
/**
|
||||
* Gets the volume shape type.
|
||||
*/
|
||||
virtual FogVolumeType GetVolumeType() { return FogVolumeType::None; }
|
||||
/**
|
||||
* Sets the volume shape type.
|
||||
*/
|
||||
virtual void SetVolumeType([[maybe_unused]] FogVolumeType volumeType) {};
|
||||
|
||||
/**
|
||||
* Gets color of the fog.
|
||||
*/
|
||||
virtual AZ::Color GetColor() { return AZ::Color::CreateOne(); }
|
||||
/**
|
||||
* Sets color of the fog.
|
||||
*/
|
||||
virtual void SetColor([[maybe_unused]] AZ::Color color) {};
|
||||
|
||||
/**
|
||||
* Gets HDR Dynamic.
|
||||
*/
|
||||
virtual float GetHdrDynamic() { return FLT_MAX; }
|
||||
/**
|
||||
* Set HDR Dynamic.
|
||||
*/
|
||||
virtual void SetHdrDynamic([[maybe_unused]] float hdrDynamic) {};
|
||||
|
||||
/**
|
||||
* Returns true if global fog color is used instead of the color property.
|
||||
*/
|
||||
virtual bool GetUseGlobalFogColor() { return false; }
|
||||
/**
|
||||
* Sets whether global fog color is used instead of the color property.
|
||||
*/
|
||||
virtual void SetUseGlobalFogColor([[maybe_unused]] bool useGlobalFogColor) {};
|
||||
|
||||
/**
|
||||
* Gets Fog density.
|
||||
*/
|
||||
virtual float GetGlobalDensity() { return FLT_MAX; }
|
||||
/**
|
||||
* Sets Fog density. Fog density controls how thick the fog appears.
|
||||
*/
|
||||
virtual void SetGlobalDensity([[maybe_unused]] float globalDensity) {};
|
||||
|
||||
/**
|
||||
* Gets density offset
|
||||
*/
|
||||
virtual float GetDensityOffset() { return FLT_MAX; }
|
||||
/**
|
||||
* Sets density offset. Density offset additionaly controls to the density of the fog volume.
|
||||
*/
|
||||
virtual void SetDensityOffset([[maybe_unused]] float densityOffset) {};
|
||||
|
||||
/**
|
||||
* Gets near cutoff distance
|
||||
*/
|
||||
virtual float GetNearCutoff() { return FLT_MAX; }
|
||||
/**
|
||||
* Sets near cutoff distance. Stops rendering the volume, depending on the camera distance to the object (m).
|
||||
*/
|
||||
virtual void SetNearCutoff([[maybe_unused]] float nearCutoff) {};
|
||||
|
||||
/**
|
||||
* Gets fall off direction horizontally.
|
||||
*/
|
||||
virtual float GetFallOffDirLong() { return FLT_MAX; }
|
||||
/**
|
||||
* Sets fall off direction horizontally.
|
||||
*/
|
||||
virtual void SetFallOffDirLong([[maybe_unused]] float fallOffDirLong) {};
|
||||
|
||||
/**
|
||||
* Gets vertical fall off direction.
|
||||
*/
|
||||
virtual float GetFallOffDirLatitude() { return FLT_MAX; }
|
||||
/**
|
||||
* Sets vertical fall off direction. Controls the latitude of the world space fall off direction of the fog.
|
||||
* A value of 90 degrees lets the fall off direction point upwards in world space (respectively, -90° points downwards).
|
||||
*/
|
||||
virtual void SetFallOffDirLatitude([[maybe_unused]] float fallOffDirLatitude) {};
|
||||
|
||||
/**
|
||||
* Gets fall off shift.
|
||||
*/
|
||||
virtual float GetFallOffShift() { return FLT_MAX; }
|
||||
/**
|
||||
* Sets fall off shift. Controls how much to shift the fog density along the fall off direction.
|
||||
* Positive values will move thicker fog layers along the fall off direction into the fog volume.
|
||||
* Negative values will move thick layers along the negative fall off direction out of the fog volume.
|
||||
*/
|
||||
virtual void SetFallOffShift([[maybe_unused]] float fallOffShift) {};
|
||||
|
||||
/**
|
||||
* Gets the scale of density distribution along the fall off direction.
|
||||
*/
|
||||
virtual float GetFallOffScale() { return FLT_MAX; }
|
||||
/**
|
||||
* Sets the scale of the density distribution along the fall off direction. Higher values will make the fog fall off more rapidly.
|
||||
*/
|
||||
virtual void SetFallOffScale([[maybe_unused]] float fallOffScale) {};
|
||||
|
||||
/**
|
||||
* Gets a factor that is used to soften the edges of the fog volume when viewed from outside.
|
||||
*/
|
||||
virtual float GetSoftEdges() { return FLT_MAX; }
|
||||
/**
|
||||
* Sets a factor that is used to soften the edges of the fog volume when viewed from outside.
|
||||
*/
|
||||
virtual void SetSoftEdges([[maybe_unused]] float softEdges) {};
|
||||
|
||||
/**
|
||||
* Gets the start distance of fog density ramp in world units (m) Only works with Volumetric Fog.
|
||||
*/
|
||||
virtual float GetRampStart() { return FLT_MAX; }
|
||||
/**
|
||||
* Sets the start distance of fog density ramp in world units (m) Only works with Volumetric Fog.
|
||||
*/
|
||||
virtual void SetRampStart([[maybe_unused]] float rampStart) {};
|
||||
|
||||
/**
|
||||
* Gets the end distance of fog density ramp in world units (m). Only works with Volumetric Fog.
|
||||
*/
|
||||
virtual float GetRampEnd() { return FLT_MAX; }
|
||||
/**
|
||||
* Sets the end distance of fog density ramp in world units (m). Only works with Volumetric Fog.
|
||||
*/
|
||||
virtual void SetRampEnd([[maybe_unused]] float rampEnd) {};
|
||||
|
||||
/**
|
||||
* Gets the influence of fog density ramp. Only works with Volumetric Fog.
|
||||
*/
|
||||
virtual float GetRampInfluence() { return FLT_MAX; }
|
||||
/**
|
||||
* Sets the influence of fog density ramp. Only works with Volumetric Fog.
|
||||
*/
|
||||
virtual void SetRampInfluence([[maybe_unused]] float rampInfluence) {};
|
||||
|
||||
/**
|
||||
* Gets the influence of the global wind upon the fog volume. Only works with Volumetric Fog.
|
||||
*/
|
||||
virtual float GetWindInfluence() { return FLT_MAX; }
|
||||
/**
|
||||
* Sets the influence of the global wind upon the fog volume. Only works with Volumetric Fog.
|
||||
*/
|
||||
virtual void SetWindInfluence([[maybe_unused]] float windInfluence) {};
|
||||
|
||||
/**
|
||||
* Gets the scale of the noise value for the density. Only works with Volumetric Fog.
|
||||
*/
|
||||
virtual float GetDensityNoiseScale() { return FLT_MAX; }
|
||||
/**
|
||||
* Sets the scale of the noise value for the density. This will define the thickness of the individual patches of fog (clouds),
|
||||
* or if you look at it from the other direction it will define how big the spaces are in-between each cloud. Reducing the value
|
||||
* will thin out the cloud density and increase the spacing between each cloud.
|
||||
* Only works with Volumetric Fog.
|
||||
*/
|
||||
virtual void SetDensityNoiseScale([[maybe_unused]] float densityNoiseScale) {};
|
||||
|
||||
/**
|
||||
* Gets the offset of the noise value for the density. Only works with Volumetric Fog.
|
||||
*/
|
||||
virtual float GetDensityNoiseOffset() { return FLT_MAX; }
|
||||
/**
|
||||
* Sets the offset of the noise value for the density. Noise breaks up the solid shape of the fog volume into patches.
|
||||
* Only works with Volumetric Fog.
|
||||
*/
|
||||
virtual void SetDensityNoiseOffset([[maybe_unused]] float densityNoiseOffset) {};
|
||||
|
||||
/**
|
||||
* Gets the time frequency of the noise for the density. High frequencies produce fast changing fog. Allows the individual fog patches to morph into
|
||||
* different shapes during the course of their lifetime. Keep this value low otherwise they will morph too quickly and will look very unnatural
|
||||
*/
|
||||
virtual float GetDensityNoiseTimeFrequency() { return FLT_MAX; }
|
||||
/**
|
||||
* Sets the time frequency of the noise for the density. High frequencies produce fast changing fog. Only works with Volumetric Fog.
|
||||
*/
|
||||
virtual void SetDensityNoiseTimeFrequency([[maybe_unused]] float timeFrequency) {};
|
||||
|
||||
/**
|
||||
* Gets the spatial frequency of the noise for the density.
|
||||
*/
|
||||
virtual AZ::Vector3 GetDensityNoiseFrequency() { return AZ::Vector3::CreateOne(); }
|
||||
/**
|
||||
* Sets the spatial frequency of the noise for the density. Allows defining how many fog patches are there.
|
||||
* Increasing Z value will create a layered effect within the volume simulating different fog patches stacked on top of each other.
|
||||
* Adding higher values in X & Y would mean there would be more individual fog patches within the volume.
|
||||
* Only works with Volumetric Fog
|
||||
*/
|
||||
virtual void SetDensityNoiseFrequency([[maybe_unused]] AZ::Vector3 densityNoiseFrequency) {};
|
||||
|
||||
/**
|
||||
* Returns true if the FogVolume entity should respond to VisAreas and ClipVolumes.
|
||||
*/
|
||||
virtual bool GetIgnoresVisAreas() { return false; };
|
||||
/**
|
||||
* Sets whether the FogVolume entity should respond to VisAreas and ClipVolumes.
|
||||
*/
|
||||
virtual void SetIgnoresVisAreas([[maybe_unused]] bool ignoresVisAreas) {};
|
||||
|
||||
/**
|
||||
* Returns true if the FogVolume entity effect doesn't occur in multiple VisAreas and ClipVolumes.
|
||||
*/
|
||||
virtual bool GetAffectsThisAreaOnly() { return false; };
|
||||
/**
|
||||
* Sets whether the FogVolume entity effect doesn't occur in multiple VisAreas and ClipVolumes.
|
||||
*/
|
||||
virtual void SetAffectsThisAreaOnly([[maybe_unused]] bool affectsThisAreaOnly) {};
|
||||
};
|
||||
|
||||
using FogVolumeComponentRequestBus = AZ::EBus<FogVolumeComponentRequests>;
|
||||
}
|
||||
@@ -58,8 +58,6 @@ set(FILES
|
||||
Source/Rendering/EditorMeshComponent.cpp
|
||||
Source/Rendering/EditorHighQualityShadowComponent.h
|
||||
Source/Rendering/EditorHighQualityShadowComponent.cpp
|
||||
Source/Rendering/EditorFogVolumeComponent.h
|
||||
Source/Rendering/EditorFogVolumeComponent.cpp
|
||||
Source/Rendering/EditorGeomCacheComponent.h
|
||||
Source/Rendering/EditorGeomCacheComponent.cpp
|
||||
Source/Scripting/EditorLookAtComponent.h
|
||||
|
||||
@@ -45,7 +45,6 @@ set(FILES
|
||||
include/LmbrCentral/Rendering/MeshComponentBus.h
|
||||
include/LmbrCentral/Rendering/MeshModificationBus.h
|
||||
include/LmbrCentral/Rendering/RenderNodeBus.h
|
||||
include/LmbrCentral/Rendering/FogVolumeComponentBus.h
|
||||
include/LmbrCentral/Rendering/HighQualityShadowComponentBus.h
|
||||
include/LmbrCentral/Rendering/GeomCacheComponentBus.h
|
||||
include/LmbrCentral/Rendering/GiRegistrationBus.h
|
||||
@@ -115,12 +114,6 @@ set(FILES
|
||||
Source/Rendering/LightInstance.h
|
||||
Source/Rendering/LightInstance.cpp
|
||||
Source/Rendering/MaterialHandle.cpp
|
||||
Source/Rendering/FogVolumeComponent.h
|
||||
Source/Rendering/FogVolumeComponent.cpp
|
||||
Source/Rendering/FogVolumeCommon.h
|
||||
Source/Rendering/FogVolumeCommon.cpp
|
||||
Source/Rendering/FogVolumeRequestsHandler.h
|
||||
Source/Rendering/FogVolumeRequestsHandler.cpp
|
||||
Source/Rendering/MeshAssetHandler.h
|
||||
Source/Rendering/MeshAssetHandler.cpp
|
||||
Source/Rendering/MeshComponent.h
|
||||
|
||||
Reference in New Issue
Block a user