You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
79 lines
4.3 KiB
C++
79 lines
4.3 KiB
C++
/*
|
|
* Copyright (c) Contributors to the Open 3D Engine Project
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
|
*
|
|
*/
|
|
|
|
#include <ImageBasedLights/EditorImageBasedLightComponent.h>
|
|
#include <AzToolsFramework/API/ToolsApplicationAPI.h>
|
|
#include <AzCore/Asset/AssetManager.h>
|
|
#include <AzCore/RTTI/BehaviorContext.h>
|
|
|
|
namespace AZ
|
|
{
|
|
namespace Render
|
|
{
|
|
void EditorImageBasedLightComponent::Reflect(AZ::ReflectContext* context)
|
|
{
|
|
BaseClass::Reflect(context);
|
|
|
|
if (AZ::SerializeContext* serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
|
|
{
|
|
serializeContext->Class<EditorImageBasedLightComponent, BaseClass>()
|
|
->Version(1, ConvertToEditorRenderComponentAdapter<1>);
|
|
|
|
if (AZ::EditContext* editContext = serializeContext->GetEditContext())
|
|
{
|
|
editContext->Class<EditorImageBasedLightComponent>(
|
|
"Global Skylight (IBL)", "Adds image based illumination to the scene")
|
|
->ClassElement(AZ::Edit::ClassElements::EditorData, "")
|
|
->Attribute(AZ::Edit::Attributes::Category, "Atom")
|
|
->Attribute(AZ::Edit::Attributes::Icon, "Icons/Components/Component_Placeholder.svg")
|
|
->Attribute(AZ::Edit::Attributes::ViewportIcon, "Icons/Components/Viewport/Component_Placeholder.png")
|
|
->Attribute(AZ::Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC("Game", 0x232b318c))
|
|
->Attribute(AZ::Edit::Attributes::AutoExpand, true)
|
|
->Attribute(AZ::Edit::Attributes::HelpPageURL, "https://docs.o3de.org/docs/user-guide/components/reference/atom/")
|
|
;
|
|
|
|
editContext->Class<ImageBasedLightComponentController>(
|
|
"ImageBasedLightComponentController", "")
|
|
->ClassElement(AZ::Edit::ClassElements::EditorData, "")
|
|
->Attribute(AZ::Edit::Attributes::AutoExpand, true)
|
|
->DataElement(AZ::Edit::UIHandlers::Default, &ImageBasedLightComponentController::m_configuration, "Configuration", "")
|
|
->Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)
|
|
;
|
|
|
|
editContext->Class<ImageBasedLightComponentConfig>(
|
|
"ImageBasedLightComponentConfig", "")
|
|
->ClassElement(AZ::Edit::ClassElements::EditorData, "")
|
|
->Attribute(AZ::Edit::Attributes::AutoExpand, true)
|
|
->DataElement(AZ::Edit::UIHandlers::Default, &ImageBasedLightComponentConfig::m_diffuseImageAsset, "Diffuse Image", "Cubemap image asset for determining diffuse lighting")
|
|
->DataElement(AZ::Edit::UIHandlers::Default, &ImageBasedLightComponentConfig::m_specularImageAsset, "Specular Image", "Cubemap image asset for determining specular lighting")
|
|
->DataElement(AZ::Edit::UIHandlers::Slider, &ImageBasedLightComponentConfig::m_exposure, "Exposure", "Exposure in stops")
|
|
->Attribute(AZ::Edit::Attributes::SoftMin, -5.0f)
|
|
->Attribute(AZ::Edit::Attributes::SoftMax, 5.0f)
|
|
->Attribute(AZ::Edit::Attributes::Min, -20.0f)
|
|
->Attribute(AZ::Edit::Attributes::Max, 20.0f)
|
|
;
|
|
}
|
|
}
|
|
|
|
if (auto behaviorContext = azrtti_cast<BehaviorContext*>(context))
|
|
{
|
|
behaviorContext->Class<EditorImageBasedLightComponent>()->RequestBus("ImageBasedLightComponentRequestBus");
|
|
|
|
behaviorContext->ConstantProperty("EditorImageBasedLightComponentTypeId", BehaviorConstant(Uuid(EditorImageBasedLightComponentTypeId)))
|
|
->Attribute(AZ::Script::Attributes::Module, "render")
|
|
->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Automation);
|
|
}
|
|
}
|
|
|
|
EditorImageBasedLightComponent::EditorImageBasedLightComponent(const ImageBasedLightComponentConfig& config)
|
|
: BaseClass(config)
|
|
{
|
|
}
|
|
|
|
} // namespace Render
|
|
} // namespace AZ
|