Start basic shadowmap stuff
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
// Created by kj16609 on 7/23/24.
|
||||
//
|
||||
|
||||
#include "engine/camera/Camera.hpp"
|
||||
#include "engine/camera/RenderCamera.hpp"
|
||||
|
||||
#include <cassert>
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
namespace fgl::engine::gui
|
||||
{
|
||||
|
||||
void handleCameraInput( const FrameInfo& info, Camera& camera )
|
||||
void handleCameraInput( const FrameInfo& info, RenderCamera& camera )
|
||||
{
|
||||
const auto delta_time { info.delta_time };
|
||||
|
||||
@@ -104,7 +104,7 @@ namespace fgl::engine::gui
|
||||
|
||||
assert( camera_ptr );
|
||||
|
||||
Camera& camera { *camera_ptr };
|
||||
RenderCamera& camera { *camera_ptr };
|
||||
|
||||
std::string name {};
|
||||
|
||||
@@ -31,6 +31,8 @@ namespace fgl::engine::gui
|
||||
void drawComponentsList( GameObject& game_object );
|
||||
void drawSelectedComponent();
|
||||
|
||||
void drawShadowmaps( const FrameInfo& info );
|
||||
|
||||
void drawCameraOutputs( FrameInfo& info );
|
||||
|
||||
void drawStats( const FrameInfo& info );
|
||||
|
||||
@@ -2,13 +2,14 @@
|
||||
#include <vulkan/vulkan.hpp>
|
||||
|
||||
#include "assets/transfer/TransferManager.hpp"
|
||||
#include "camera/CameraManager.hpp"
|
||||
#include "camera/ShadowMap.hpp"
|
||||
#include "core.hpp"
|
||||
#include "engine/debug/profiling/counters.hpp"
|
||||
#include "engine/debug/timing/FlameGraph.hpp"
|
||||
#include "engine/flags.hpp"
|
||||
#include "engine/math/literals/size.hpp"
|
||||
#include "engine/memory/buffers/BufferHandle.hpp"
|
||||
#include "memory/buffers/BufferHandle.hpp"
|
||||
#include "safe_include.hpp"
|
||||
|
||||
namespace fgl::engine::gui
|
||||
@@ -123,6 +124,38 @@ namespace fgl::engine::gui
|
||||
}
|
||||
}
|
||||
|
||||
void drawShadowmaps( const FrameInfo& info )
|
||||
{
|
||||
ImGui::Begin( "Shadowmaps" );
|
||||
|
||||
static std::unordered_map< int*, std::vector< Texture > > textures {};
|
||||
|
||||
bool move_sun { false };
|
||||
|
||||
move_sun = ImGui::Button( "Move sun shadowmap to camera" );
|
||||
|
||||
for ( const auto& weak_shadowmap : getShadowmaps() )
|
||||
{
|
||||
if ( weak_shadowmap.expired() ) continue;
|
||||
|
||||
auto shadowmap_ptr { weak_shadowmap.lock() };
|
||||
|
||||
ShadowMap& shadowmap { *shadowmap_ptr };
|
||||
|
||||
// if ( move_sun )
|
||||
{
|
||||
shadowmap.m_camera->moveTo( CameraManager::instance().getPrimary()->getTransform() );
|
||||
}
|
||||
|
||||
const FrameIndex frame_index { info.in_flight_idx };
|
||||
// camera.getCompositeSwapchain().m_gbuffer_target[ frame_index ]->drawImGui( target_size );
|
||||
|
||||
shadowmap.m_swapchain->depthTexture( frame_index )->drawImGui();
|
||||
}
|
||||
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
void drawStats( const FrameInfo& info )
|
||||
{
|
||||
ImGui::Begin( "Stats" );
|
||||
@@ -143,6 +176,11 @@ namespace fgl::engine::gui
|
||||
debug::timing::render();
|
||||
}
|
||||
|
||||
if ( ImGui::CollapsingHeader( "Shadowmaps" ) )
|
||||
{
|
||||
drawShadowmaps( info );
|
||||
}
|
||||
|
||||
if ( ImGui::Button( "Reload shaders" ) )
|
||||
{
|
||||
flags::triggerShaderReload();
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include "engine/FrameInfo.hpp"
|
||||
#include "engine/assets/model/Model.hpp"
|
||||
#include "engine/assets/model/builders/SceneBuilder.hpp"
|
||||
#include "engine/camera/Camera.hpp"
|
||||
#include "engine/camera/RenderCamera.hpp"
|
||||
#include "engine/filesystem/scanner/FileScanner.hpp"
|
||||
#include "engine/filesystem/types.hpp"
|
||||
#include "engine/rendering/PresentSwapChain.hpp"
|
||||
@@ -126,7 +126,7 @@ namespace fgl::engine::gui
|
||||
|
||||
inline void drawConfigBar(
|
||||
[[maybe_unused]] const FrameInfo& info,
|
||||
[[maybe_unused]] const Camera& camera,
|
||||
[[maybe_unused]] const RenderCamera& camera,
|
||||
[[maybe_unused]] const FrameIndex frame_index,
|
||||
std::uint_fast8_t& current )
|
||||
{
|
||||
@@ -167,7 +167,7 @@ namespace fgl::engine::gui
|
||||
}
|
||||
}
|
||||
|
||||
void drawRenderingOutputs( FrameInfo& info, const Camera& camera )
|
||||
void drawRenderingOutputs( FrameInfo& info, const RenderCamera& camera )
|
||||
{
|
||||
ZoneScoped;
|
||||
const auto frame_index { info.in_flight_idx };
|
||||
|
||||
@@ -7,12 +7,12 @@
|
||||
namespace fgl::engine
|
||||
{
|
||||
struct FrameInfo;
|
||||
class Camera;
|
||||
class RenderCamera;
|
||||
} // namespace fgl::engine
|
||||
|
||||
namespace fgl::engine::gui
|
||||
{
|
||||
|
||||
void drawRenderingOutputs( FrameInfo& info, const Camera& camera );
|
||||
void drawRenderingOutputs( FrameInfo& info, const RenderCamera& camera );
|
||||
|
||||
} // namespace fgl::engine::gui
|
||||
|
||||
Reference in New Issue
Block a user