re-adding render to texture

This commit is contained in:
Kbz-8
2024-12-20 01:19:15 +01:00
parent b6660b99d6
commit b6edf442a2
7 changed files with 77 additions and 42 deletions

View File

@@ -1,5 +1,7 @@
#include <PreCompiled.h>
#include <Core/Graphics.h>
#include <Core/Application.h>
#include <Core/Handles.h>
namespace mlx
{
@@ -9,11 +11,24 @@ namespace mlx
{
MLX_PROFILE_FUNCTION();
p_window = std::make_shared<Window>(info);
m_has_window = true;
if(info->render_target == nullptr)
{
p_window = std::make_shared<Window>(info);
m_has_window = true;
}
else
m_has_window = false;
m_renderer.Init(p_window.get());
m_scene_renderer.Init(nullptr);
if(info->render_target != nullptr)
{
m_renderer.Init(info->render_target->texture);
m_scene_renderer.Init(info->render_target->texture);
}
else
{
m_renderer.Init(p_window.get());
m_scene_renderer.Init(nullptr);
}
p_scene = std::make_unique<Scene>();
}
@@ -25,7 +40,7 @@ namespace mlx
m_scene_renderer.Render(*p_scene, m_renderer);
m_renderer.EndFrame();
#ifdef GRAPHICS_MEMORY_DUMP
// dump memory to file every two seconds
// Dump memory usage to file every two seconds
using namespace std::chrono_literals;
static std::int64_t timer = static_cast<std::uint64_t>(std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::high_resolution_clock::now().time_since_epoch()).count());
if(std::chrono::duration<std::uint64_t>{ static_cast<std::uint64_t>(std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::high_resolution_clock::now().time_since_epoch()).count()) - timer } >= 1s)