Merge branch 'development' into cmake/warn_virtual
Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
This commit is contained in:
+24
@@ -10,6 +10,7 @@
|
||||
|
||||
#include <QWidget>
|
||||
#include <QElapsedTimer>
|
||||
#include <QPointer>
|
||||
#include <Atom/RPI.Public/Base.h>
|
||||
#include <AzToolsFramework/Viewport/ViewportMessages.h>
|
||||
#include <AzToolsFramework/Input/QtEventToAzInputManager.h>
|
||||
@@ -21,6 +22,8 @@
|
||||
#include <AzFramework/Windowing/WindowBus.h>
|
||||
#include <AzCore/Component/TickBus.h>
|
||||
#include <Atom/RPI.Public/AuxGeom/AuxGeomFeatureProcessorInterface.h>
|
||||
#include <Atom/Bootstrap/BootstrapNotificationBus.h>
|
||||
#include <AtomToolsFramework/Viewport/RenderViewportWidgetNotificationBus.h>
|
||||
|
||||
namespace AtomToolsFramework
|
||||
{
|
||||
@@ -35,6 +38,8 @@ namespace AtomToolsFramework
|
||||
, public AzFramework::WindowRequestBus::Handler
|
||||
, protected AzFramework::InputChannelEventListener
|
||||
, protected AZ::TickBus::Handler
|
||||
, protected AZ::Render::Bootstrap::NotificationBus::Handler
|
||||
, protected AtomToolsFramework::RenderViewportWidgetNotificationBus::Handler
|
||||
{
|
||||
public:
|
||||
//! Creates a RenderViewportWidget.
|
||||
@@ -121,6 +126,7 @@ namespace AtomToolsFramework
|
||||
|
||||
// AZ::TickBus::Handler ...
|
||||
void OnTick(float deltaTime, AZ::ScriptTimePoint time) override;
|
||||
int GetTickOrder() override;
|
||||
|
||||
// QWidget ...
|
||||
void resizeEvent(QResizeEvent *event) override;
|
||||
@@ -128,9 +134,21 @@ namespace AtomToolsFramework
|
||||
void enterEvent(QEvent* event) override;
|
||||
void leaveEvent(QEvent* event) override;
|
||||
void mouseMoveEvent(QMouseEvent* event) override;
|
||||
void focusInEvent(QFocusEvent* event) override;
|
||||
|
||||
// AZ::Render::Bootstrap::NotificationBus::Handler ...
|
||||
void OnFrameRateLimitChanged(float fpsLimit) override;
|
||||
|
||||
// AtomToolsFramework::RenderViewportWidgetNotificationBus::Handler ...
|
||||
void OnInactiveViewportFrameRateChanged(float fpsLimit) override;
|
||||
|
||||
private:
|
||||
AzFramework::NativeWindowHandle GetNativeWindowHandle() const;
|
||||
void UpdateFrameRate();
|
||||
|
||||
void SetScreen(QScreen* screen);
|
||||
void SendWindowResizeEvent();
|
||||
void NotifyUpdateRefreshRate();
|
||||
|
||||
// The underlying ViewportContext, our entry-point to the Atom RPI.
|
||||
AZ::RPI::ViewportContextPtr m_viewportContext;
|
||||
@@ -153,5 +171,11 @@ namespace AtomToolsFramework
|
||||
AZ::ScriptTimePoint m_time;
|
||||
// Maps our internal Qt events into AzFramework InputChannels for our ViewportControllerList.
|
||||
AzToolsFramework::QtEventToAzInputMapper* m_inputChannelMapper = nullptr;
|
||||
// Stores our current screen, used for tracking the current refresh rate.
|
||||
QScreen* m_screen = nullptr;
|
||||
// Stores the last RenderViewportWidget that has received user focus.
|
||||
// This is used for optional framerate throtting for "inactive" viewports via the
|
||||
// ed_inactive_viewport_fps_limit CVAR.
|
||||
AZ::EnvironmentVariable<RenderViewportWidget*> m_lastFocusedViewport;
|
||||
};
|
||||
} //namespace AtomToolsFramework
|
||||
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* 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 <AzCore/EBus/EBus.h>
|
||||
|
||||
namespace AtomToolsFramework
|
||||
{
|
||||
//! Provides an interface for providing notifications specific to RenderViewportWidget.
|
||||
//! @note Most behaviors in RenderViewportWidget are handled by its underyling
|
||||
//! ViewportContext, this bus is specifically for functionality exclusive to the
|
||||
//! Qt layer provided by RenderViewportWidget.
|
||||
class RenderViewportWidgetNotifications : public AZ::EBusTraits
|
||||
{
|
||||
public:
|
||||
static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single;
|
||||
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Multiple;
|
||||
|
||||
//! Triggered when the idle frame rate limit for inactive viewports changed.
|
||||
//! Controlled by the ed_inactive_viewport_fps_limit CVAR.
|
||||
//! Active viewports are controlled by the r_fps_limit CVAR.
|
||||
virtual void OnInactiveViewportFrameRateChanged([[maybe_unused]]float fpsLimit){}
|
||||
|
||||
protected:
|
||||
~RenderViewportWidgetNotifications() = default;
|
||||
};
|
||||
|
||||
using RenderViewportWidgetNotificationBus = AZ::EBus<RenderViewportWidgetNotifications>;
|
||||
} // namespace AtomToolsFramework
|
||||
Reference in New Issue
Block a user