/* * 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 #include #include #include #include #include #include #include #include namespace AZ { class Entity; class Component; namespace Render { class DisplayMapperFeatureProcessorInterface; class DirectionalLightFeatureProcessorInterface; class MeshFeatureProcessorInterface; } namespace RPI { class WindowContext; } } namespace EMStudio { class RenderOptions; class AnimViewportRenderer { public: AZ_CLASS_ALLOCATOR(AnimViewportRenderer, AZ::SystemAllocator, 0); AnimViewportRenderer(AZ::RPI::ViewportContextPtr viewportContext, const RenderOptions* renderOptions); ~AnimViewportRenderer(); void Reinit(); //! Return the center position of the existing objects. AZ::Vector3 GetCharacterCenter() const; void UpdateActorRenderFlag(EMotionFX::ActorRenderFlags renderFlags); AZStd::shared_ptr GetFrameworkScene() const; AZ::EntityId GetEntityId() const; AzFramework::EntityContextId GetEntityContextId() const; // Call this function on update to prevent the character going out of bounds of the ground. void CheckBounds(); private: // This function resets the light, camera and other environment settings. void ResetEnvironment(); // This function creates in-editor entities for all actor assets stored in the actor manager, // and deletes all the actor entities that no longer has an actor asset in the actor manager. // Those entities are used in atom render viewport to visualize actors in animation editor. void ReinitActorEntities(); AZ::Entity* CreateActorEntity(AZ::Data::Asset actorAsset); AZ::Entity* FindActorEntity(AZ::Data::Asset actorAsset) const; void SetLightingPreset(const AZ::Render::LightingPreset* preset); AZStd::shared_ptr m_windowContext; AZStd::unique_ptr m_entityContext; AZStd::shared_ptr m_frameworkScene; AZ::RPI::ScenePtr m_scene; AZ::RPI::RenderPipelinePtr m_renderPipeline; AZ::Render::DirectionalLightFeatureProcessorInterface* m_directionalLightFeatureProcessor = nullptr; AZ::Render::DisplayMapperFeatureProcessorInterface* m_displayMapperFeatureProcessor = nullptr; AZ::Render::SkyBoxFeatureProcessorInterface* m_skyboxFeatureProcessor = nullptr; AZ::Render::MeshFeatureProcessorInterface* m_meshFeatureProcessor = nullptr; AZ::Entity* m_postProcessEntity = nullptr; AZ::Entity* m_iblEntity = nullptr; AZ::Entity* m_groundEntity = nullptr; AZStd::vector m_actorEntities; const RenderOptions* m_renderOptions; const float DefaultFrustumDimension = 128.0f; const float BoundMaxDistance = 150.0f; const float TileSize = 1.0f; AZStd::vector m_lightHandles; }; }