Add cold and active flag to cameras

This commit is contained in:
2024-08-14 19:57:54 -04:00
parent 35057890a9
commit 83434d8fb8
2 changed files with 17 additions and 1 deletions

View File

@@ -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;

View File

@@ -12,9 +12,9 @@
#include <glm/gtx/string_cast.hpp>
#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++ };