diff --git a/src/engine/camera/Camera.cpp b/src/engine/camera/Camera.cpp index 70e7fb1..f1261b6 100644 --- a/src/engine/camera/Camera.cpp +++ b/src/engine/camera/Camera.cpp @@ -69,6 +69,15 @@ namespace fgl::engine void Camera::pass( FrameInfo& frame_info ) { + if ( m_cold && m_swapchain ) + { + //TODO: Make some way to destroy the swapchain in a deffered manner. + m_old_swapchain = m_swapchain; + m_swapchain = nullptr; + } + + if ( !m_active ) return; + assert( frame_info.camera == nullptr ); frame_info.camera = this; diff --git a/src/engine/camera/Camera.hpp b/src/engine/camera/Camera.hpp index d24e3a1..851e277 100644 --- a/src/engine/camera/Camera.hpp +++ b/src/engine/camera/Camera.hpp @@ -12,9 +12,9 @@ #include #pragma GCC diagnostic pop +#include "engine/descriptors/DescriptorSet.hpp" #include "engine/memory/buffers/HostSingleT.hpp" #include "engine/memory/buffers/UniqueFrameSuballocation.hpp" -#include "engine/descriptors/DescriptorSet.hpp" #include "engine/primitives/Frustum.hpp" #include "engine/primitives/Rotation.hpp" #include "engine/primitives/TransformComponent.hpp" @@ -44,6 +44,13 @@ namespace fgl::engine { inline static CameraIDX camera_counter { 0 }; + //! True if the camera is active and to be rendered + bool m_active { true }; + + //! If true, The camera's swapchain is to be destroyed in order to preserve memory. + //! This is here to allow us to set a camera cold when it's not likely to be used soon + bool m_cold { false }; + // Const is acceptable, Since this value should never change. EVER const CameraIDX camera_idx { camera_counter++ };