/* * 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 AnimViewportRenderer { public: AZ_CLASS_ALLOCATOR(AnimViewportRenderer, AZ::SystemAllocator, 0); AnimViewportRenderer(AZ::RPI::ViewportContextPtr viewportContext); ~AnimViewportRenderer(); void Reinit(); //! Return the center position of the existing objects. AZ::Vector3 GetCenter() const; 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_cameraEntity = nullptr; AZ::Component* m_cameraComponent = nullptr; AZ::Entity* m_modelEntity = nullptr; AZ::Data::AssetId m_modelAssetId; AZ::Entity* m_gridEntity = nullptr; AZStd::vector m_actorEntities; AZStd::vector m_lightHandles; }; }