Initial commit

This commit is contained in:
alexpete
2021-03-05 11:26:34 -08:00
commit a10351f38d
27091 changed files with 5521199 additions and 0 deletions
@@ -0,0 +1,78 @@
/*
* 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 <PostProcess/GradientWeightModifier/EditorGradientWeightModifierComponent.h>
#include <AtomLyIntegration/CommonFeatures/PostProcess/GradientWeightModifier/GradientWeightModifierComponentConstants.h>
namespace AZ
{
namespace Render
{
void EditorGradientWeightModifierComponent::Reflect(AZ::ReflectContext* context)
{
BaseClass::Reflect(context);
if (AZ::SerializeContext* serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<EditorGradientWeightModifierComponent, BaseClass>()
->Version(1);
if (AZ::EditContext* editContext = serializeContext->GetEditContext())
{
editContext->Class<EditorGradientWeightModifierComponent>(
"PostFX Gradient Weight Modifier", "Modifies PostFX override factor based on a gradient signal sampled from an entity")
->ClassElement(Edit::ClassElements::EditorData, "")
->Attribute(Edit::Attributes::Category, "Atom")
->Attribute(AZ::Edit::Attributes::Icon, "Editor/Icons/Components/Component_Placeholder.svg")
->Attribute(AZ::Edit::Attributes::ViewportIcon, "editor/icons/components/viewport/component_placeholder.png")
->Attribute(Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC("Game", 0x232b318c))
->Attribute(Edit::Attributes::AutoExpand, true)
->Attribute(Edit::Attributes::HelpPageURL, "")
;
editContext->Class<GradientWeightModifierComponentController>("GradientWeightModifierComponentController", "")
->ClassElement(AZ::Edit::ClassElements::EditorData, "")
->Attribute(AZ::Edit::Attributes::AutoExpand, true)
->DataElement(AZ::Edit::UIHandlers::Default, &GradientWeightModifierComponentController::m_configuration, "Configuration", "")
->Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)
;
editContext->Class<GradientWeightModifierComponentConfig>("GradientWeightModifierComponentConfig", "")
->DataElement(AZ::Edit::UIHandlers::Default, &GradientWeightModifierComponentConfig::m_gradientSampler, "Gradient Sampler", "Gradient sampler configuration")
->Attribute(Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly)
;
}
}
if (auto behaviorContext = azrtti_cast<BehaviorContext*>(context))
{
behaviorContext->Class<EditorGradientWeightModifierComponent>()->RequestBus("PostFxWeightRequestBus");
behaviorContext->ConstantProperty("EditorGradientWeightModifierComponentTypeId", BehaviorConstant(Uuid(EditorGradientWeightModifierComponentTypeId)))
->Attribute(AZ::Script::Attributes::Module, "render")
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Automation);
}
}
EditorGradientWeightModifierComponent::EditorGradientWeightModifierComponent(const GradientWeightModifierComponentConfig& config)
: BaseClass(config)
{
}
AZ::u32 EditorGradientWeightModifierComponent::OnConfigurationChanged()
{
return Edit::PropertyRefreshLevels::AttributesAndValues;
}
}
}
@@ -0,0 +1,37 @@
/*
* 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 <AzToolsFramework/ToolsComponents/EditorComponentAdapter.h>
#include <PostProcess/GradientWeightModifier/GradientWeightModifierComponent.h>
namespace AZ
{
namespace Render
{
class EditorGradientWeightModifierComponent final
: public AzToolsFramework::Components::EditorComponentAdapter<GradientWeightModifierComponentController, GradientWeightModifierComponent, GradientWeightModifierComponentConfig>
{
public:
using BaseClass = AzToolsFramework::Components::EditorComponentAdapter<GradientWeightModifierComponentController, GradientWeightModifierComponent, GradientWeightModifierComponentConfig>;
AZ_EDITOR_COMPONENT(AZ::Render::EditorGradientWeightModifierComponent, EditorGradientWeightModifierComponentTypeId, BaseClass);
static void Reflect(AZ::ReflectContext* context);
EditorGradientWeightModifierComponent() = default;
EditorGradientWeightModifierComponent(const GradientWeightModifierComponentConfig& config);
AZ::u32 OnConfigurationChanged() override;
};
}
}
@@ -0,0 +1,44 @@
/*
* 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 <PostProcess/GradientWeightModifier/GradientWeightModifierComponent.h>
namespace AZ
{
namespace Render
{
GradientWeightModifierComponent::GradientWeightModifierComponent(const GradientWeightModifierComponentConfig& config)
: BaseClass(config)
{
}
void GradientWeightModifierComponent::Reflect(AZ::ReflectContext* context)
{
BaseClass::Reflect(context);
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<GradientWeightModifierComponent, BaseClass>();
}
if (auto behaviorContext = azrtti_cast<BehaviorContext*>(context))
{
behaviorContext->Class<GradientWeightModifierComponent>()->RequestBus("PostFxWeightRequestBus");
behaviorContext->ConstantProperty("GradientWeightModifierComponentTypeId", BehaviorConstant(Uuid(GradientWeightModifierComponentTypeId)))
->Attribute(AZ::Script::Attributes::Module, "render")
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Common);
}
}
}
}
@@ -0,0 +1,38 @@
/*
* 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/Component.h>
#include <AzFramework/Components/ComponentAdapter.h>
#include <AtomLyIntegration/CommonFeatures/PostProcess/GradientWeightModifier/GradientWeightModifierComponentConstants.h>
#include <AtomLyIntegration/CommonFeatures/PostProcess/GradientWeightModifier/GradientWeightModifierComponentConfig.h>
#include <PostProcess/GradientWeightModifier/GradientWeightModifierComponentController.h>
namespace AZ
{
namespace Render
{
class GradientWeightModifierComponent final
: public AzFramework::Components::ComponentAdapter<GradientWeightModifierComponentController, GradientWeightModifierComponentConfig>
{
public:
using BaseClass = AzFramework::Components::ComponentAdapter<GradientWeightModifierComponentController, GradientWeightModifierComponentConfig>;
AZ_COMPONENT(AZ::Render::GradientWeightModifierComponent, "{4DE2AD79-85BE-49FF-9DC5-D709720B013E}", BaseClass);
GradientWeightModifierComponent() = default;
GradientWeightModifierComponent(const GradientWeightModifierComponentConfig& config);
static void Reflect(AZ::ReflectContext* context);
};
}
}
@@ -0,0 +1,34 @@
/*
* 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 <AtomLyIntegration/CommonFeatures/PostProcess/GradientWeightModifier/GradientWeightModifierComponentConfig.h>
#include <AzCore/Serialization/SerializeContext.h>
#include <AzCore/Serialization/EditContext.h>
namespace AZ
{
namespace Render
{
void GradientWeightModifierComponentConfig::Reflect(ReflectContext* context)
{
if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
{
serializeContext->Class<GradientWeightModifierComponentConfig, ComponentConfig>()
->Version(0)
->Field("GradientSampler", &GradientWeightModifierComponentConfig::m_gradientSampler)
;
}
}
}
}
@@ -0,0 +1,77 @@
/*
* 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 <PostProcess/GradientWeightModifier/GradientWeightModifierComponentController.h>
namespace AZ
{
namespace Render
{
void GradientWeightModifierComponentController::Reflect(AZ::ReflectContext* context)
{
GradientWeightModifierComponentConfig::Reflect(context);
if (auto* serializeContext = azrtti_cast<SerializeContext*>(context))
{
serializeContext->Class<GradientWeightModifierComponentController>()
->Version(0)
->Field("Configuration", &GradientWeightModifierComponentController::m_configuration);
}
}
void GradientWeightModifierComponentController::GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided)
{
provided.push_back(AZ_CRC_CE("PostFXWeightModifierService"));
}
void GradientWeightModifierComponentController::GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible)
{
incompatible.push_back(AZ_CRC_CE("PostFXWeightModifierService"));
}
void GradientWeightModifierComponentController::GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required)
{
required.push_back(AZ_CRC_CE("PostFXLayerService"));
}
GradientWeightModifierComponentController::GradientWeightModifierComponentController(const GradientWeightModifierComponentConfig& config)
: m_configuration(config)
{
}
void GradientWeightModifierComponentController::Activate(EntityId entityId)
{
m_entityId = entityId;
m_configuration.m_gradientSampler.m_ownerEntityId = entityId;
PostFxWeightRequestBus::Handler::BusConnect(m_entityId);
}
void GradientWeightModifierComponentController::Deactivate()
{
PostFxWeightRequestBus::Handler::BusDisconnect(m_entityId);
m_entityId.SetInvalid();
}
void GradientWeightModifierComponentController::SetConfiguration(const GradientWeightModifierComponentConfig& config)
{
m_configuration = config;
}
float GradientWeightModifierComponentController::GetWeightAtPosition(const AZ::Vector3& influencerPosition) const
{
return m_configuration.m_gradientSampler.GetValue(influencerPosition);
}
}
}
@@ -0,0 +1,52 @@
/*
* 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/Component.h>
#include <AzCore/Component/TransformBus.h>
#include <AtomLyIntegration/CommonFeatures/PostProcess/GradientWeightModifier/GradientWeightModifierComponentConfig.h>
#include <AtomLyIntegration/CommonFeatures/PostProcess/PostFxWeightRequestBus.h>
namespace AZ
{
namespace Render
{
class GradientWeightModifierComponentController final
: public PostFxWeightRequestBus::Handler
{
public:
friend class EditorGradientWeightModifierComponent;
AZ_TYPE_INFO(AZ::Render::GradientWeightModifierComponentController, "{62AB316D-8B8E-434E-8F87-C4ABC42642A6}");
static void Reflect(AZ::ReflectContext* context);
static void GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided);
static void GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible);
static void GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required);
GradientWeightModifierComponentController() = default;
GradientWeightModifierComponentController(const GradientWeightModifierComponentConfig& config);
void Activate(EntityId entityId);
void Deactivate();
void SetConfiguration(const GradientWeightModifierComponentConfig& config);
const GradientWeightModifierComponentConfig& GetConfiguration() const { return m_configuration; }
virtual float GetWeightAtPosition(const AZ::Vector3& influencerPosition) const override;
private:
AZ_DISABLE_COPY(GradientWeightModifierComponentController);
GradientWeightModifierComponentConfig m_configuration;
EntityId m_entityId;
};
}
}