Gets dynamic rendering mostly working
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
#include "engine/assets/model/Model.hpp"
|
||||
#include "engine/assets/model/builders/SceneBuilder.hpp"
|
||||
#include "engine/camera/Camera.hpp"
|
||||
#include "engine/camera/CameraSwapchain.hpp"
|
||||
#include "engine/camera/GBufferSwapchain.hpp"
|
||||
#include "engine/filesystem/scanner/FileScanner.hpp"
|
||||
#include "engine/filesystem/types.hpp"
|
||||
#include "engine/gameobjects/components/ModelComponent.hpp"
|
||||
@@ -53,9 +53,7 @@ namespace fgl::engine::gui
|
||||
|
||||
obj.addFlag( IsEntity | IsVisible );
|
||||
|
||||
auto component {
|
||||
std::make_unique< ModelComponent >( std::move( model ) )
|
||||
};
|
||||
auto component { std::make_unique< ModelComponent >( std::move( model ) ) };
|
||||
|
||||
obj.addComponent( std::move( component ) );
|
||||
|
||||
@@ -208,16 +206,17 @@ namespace fgl::engine::gui
|
||||
default:
|
||||
[[fallthrough]];
|
||||
case Composite:
|
||||
camera.getSwapchain().m_g_buffer_composite_img[ frame_index ]->drawImGui( target_size );
|
||||
camera.getCompositeSwapchain().m_gbuffer_target[ frame_index ]->drawImGui( target_size );
|
||||
// camera.getSwapchain().m_g_buffer_composite_img[ frame_index ]->drawImGui( target_size );
|
||||
break;
|
||||
case Albedo:
|
||||
camera.getSwapchain().m_g_buffer_color_img[ frame_index ]->drawImGui( target_size );
|
||||
// camera.getSwapchain().m_g_buffer_color_img[ frame_index ]->drawImGui( target_size );
|
||||
break;
|
||||
case Normal:
|
||||
camera.getSwapchain().m_g_buffer_normal_img[ frame_index ]->drawImGui( target_size );
|
||||
// camera.getSwapchain().m_g_buffer_normal_img[ frame_index ]->drawImGui( target_size );
|
||||
break;
|
||||
case Position:
|
||||
camera.getSwapchain().m_g_buffer_position_img[ frame_index ]->drawImGui( target_size );
|
||||
// camera.getSwapchain().m_g_buffer_position_img[ frame_index ]->drawImGui( target_size );
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -35,46 +35,53 @@ int main()
|
||||
|
||||
log::debug( "Vulkan instance version: {}.{}.{}.{}", major, minor, patch, minor );
|
||||
|
||||
EngineContext engine_ctx {};
|
||||
|
||||
// We start by hooking into the imgui rendering.
|
||||
engine_ctx.hookInitImGui( gui::initGui );
|
||||
engine_ctx.hookPreFrame( gui::startDrawImGui );
|
||||
engine_ctx.hookEarlyFrame( gui::drawImGui );
|
||||
engine_ctx.hookLateFrame( gui::endDrawImGui );
|
||||
engine_ctx.hookDestruction( gui::cleanupImGui );
|
||||
|
||||
// Now we need to create the camera for the editor.
|
||||
CameraManager& camera_manager { engine_ctx.cameraManager() };
|
||||
|
||||
auto& editor_camera { camera_manager.getPrimary() };
|
||||
|
||||
editor_camera->setFOV( glm::radians( 90.0f ) );
|
||||
|
||||
//! Will be true until the window says it wants to close.
|
||||
while ( engine_ctx.good() )
|
||||
try
|
||||
{
|
||||
debug::timing::reset();
|
||||
engine_ctx.tickDeltaTime();
|
||||
EngineContext engine_ctx {};
|
||||
|
||||
engine_ctx.handleTransfers();
|
||||
// We start by hooking into the imgui rendering.
|
||||
engine_ctx.hookInitImGui( gui::initGui );
|
||||
engine_ctx.hookPreFrame( gui::startDrawImGui );
|
||||
engine_ctx.hookEarlyFrame( gui::drawImGui );
|
||||
engine_ctx.hookLateFrame( gui::endDrawImGui );
|
||||
engine_ctx.hookDestruction( gui::cleanupImGui );
|
||||
|
||||
// Process input
|
||||
engine_ctx.processInput();
|
||||
// Now we need to create the camera for the editor.
|
||||
CameraManager& camera_manager { engine_ctx.cameraManager() };
|
||||
|
||||
// Here we can decide if we want to tick fully or not.
|
||||
auto& editor_camera { camera_manager.getPrimary() };
|
||||
|
||||
// Simulate step
|
||||
engine_ctx.tickSimulation();
|
||||
editor_camera->setFOV( glm::radians( 90.0f ) );
|
||||
|
||||
// Update the viewer camera
|
||||
//! Will be true until the window says it wants to close.
|
||||
while ( engine_ctx.good() )
|
||||
{
|
||||
debug::timing::reset();
|
||||
engine_ctx.tickDeltaTime();
|
||||
|
||||
// Render step
|
||||
engine_ctx.renderFrame();
|
||||
engine_ctx.handleTransfers();
|
||||
|
||||
engine_ctx.finishFrame();
|
||||
// This will 'end' the root node, Which is created on 'reset'
|
||||
debug::timing::internal::pop();
|
||||
// Process input
|
||||
engine_ctx.processInput();
|
||||
|
||||
// Here we can decide if we want to tick fully or not.
|
||||
|
||||
// Simulate step
|
||||
engine_ctx.tickSimulation();
|
||||
|
||||
// Update the viewer camera
|
||||
|
||||
// Render step
|
||||
engine_ctx.renderFrame();
|
||||
|
||||
engine_ctx.finishFrame();
|
||||
// This will 'end' the root node, Which is created on 'reset'
|
||||
debug::timing::internal::pop();
|
||||
}
|
||||
}
|
||||
catch ( const vk::LayerNotPresentError& e )
|
||||
{
|
||||
log::info( "{}:{}", e.code().message(), e.what() );
|
||||
}
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
|
||||
Reference in New Issue
Block a user