Compare commits

...

6 Commits

Author SHA1 Message Date
SweetId 54c43c7600 Fix examples compilation 2024-02-22 17:27:43 -05:00
Sid eccddc2871
Merge pull request #1 from SirLynix/renderer-fixes
Renderer fixes
2024-02-22 17:25:28 -05:00
Sid 785f814e15
Merge pull request #2 from SirLynix/main
Update for latest Nazara version
2024-02-22 17:22:42 -05:00
Lynix 2156fdce4f Update for latest Nazara version 2024-02-12 15:47:28 +01:00
Lynix 120ba7dcd7 Fix font texture mipmaps and setup a debug name 2023-11-28 15:22:10 +01:00
Lynix fa10201d69 Fix clear values 2023-11-28 15:21:56 +01:00
6 changed files with 16 additions and 11 deletions

View File

@ -2,8 +2,8 @@
#include <Nazara/Core/Application.hpp>
#include <Nazara/Core/Clock.hpp>
#include <Nazara/Graphics/Graphics.hpp>
#include <Nazara/Platform/AppWindowingComponent.hpp>
#include <Nazara/Platform/Platform.hpp>
#include <Nazara/Platform/WindowingAppComponent.hpp>
#include <Nazara/Renderer/GpuSwitch.hpp>
#include <Nazara/Renderer/WindowSwapchain.hpp>
@ -43,7 +43,7 @@ int WinMain(int argc, char* argv[])
#endif
{
Nz::Application<Nz::Graphics, Nz::Imgui> nazara(argc, argv);
auto& windowing = nazara.AddComponent<Nz::AppWindowingComponent>();
auto& windowing = nazara.AddComponent<Nz::WindowingAppComponent>();
std::shared_ptr<Nz::RenderDevice> device = Nz::Graphics::Instance()->GetRenderDevice();
std::string windowTitle = "Nazara Imgui Demo";

View File

@ -3,7 +3,6 @@
#include <Nazara/Graphics.hpp>
#include <Nazara/Platform.hpp>
#include <Nazara/Renderer.hpp>
#include <Nazara/Utility.hpp>
#include <NazaraImgui/ImguiHandler.hpp>
#include <NazaraImgui/ImguiWidgets.hpp>
@ -41,10 +40,10 @@ int WinMain(int argc, char* argv[])
#endif
{
Nz::Application<Nz::Graphics, Nz::Imgui> nazara(argc, argv);
auto& windowing = nazara.AddComponent<Nz::AppWindowingComponent>();
auto& windowing = nazara.AddComponent<Nz::WindowingAppComponent>();
std::shared_ptr<Nz::RenderDevice> device = Nz::Graphics::Instance()->GetRenderDevice();
auto& ecs = nazara.AddComponent<Nz::AppEntitySystemComponent>();
auto& ecs = nazara.AddComponent<Nz::EntitySystemAppComponent>();
auto& world = ecs.AddWorld<Nz::EnttWorld>();
auto& renderer = world.AddSystem<Nz::RenderSystem>();

View File

@ -2,11 +2,11 @@
#include <NazaraImgui/NazaraImgui.hpp>
#include <Nazara/Core/VertexStruct.hpp>
#include <Nazara/Renderer/CommandBufferBuilder.hpp>
#include <Nazara/Renderer/RenderDevice.hpp>
#include <Nazara/Renderer/RenderFrame.hpp>
#include <Nazara/Renderer/UploadPool.hpp>
#include <Nazara/Utility/VertexStruct.hpp>
#include <NZSL/Parser.hpp>

View File

@ -21,10 +21,10 @@ namespace Nz
FramePass& ImguiPipelinePass::RegisterToFrameGraph(FrameGraph& frameGraph, const PassInputOuputs& inputOuputs)
{
if (inputOuputs.inputCount != 1)
if (inputOuputs.inputAttachments.size() != 1)
throw std::runtime_error("one input expected");
if (inputOuputs.outputCount != 1)
if (inputOuputs.outputAttachments.size() != 1)
throw std::runtime_error("one output expected");
FramePass& imguiPass = frameGraph.AddPass("Imgui pass");

View File

@ -289,8 +289,13 @@ namespace Nz
int fb_height = static_cast<int>(io.DisplaySize.y * io.DisplayFramebufferScale.y);
Nz::Recti renderRect(0, 0, fb_width, fb_height);
Nz::CommandBufferBuilder::ClearValues clearValues[2] = {
{ .color = Nz::Color::Black() },
{ .depth = 1.f }
};
builder.BeginDebugRegion("ImGui", Nz::Color::Green());
builder.BeginRenderPass(renderTarget->GetFramebuffer(frame.GetImageIndex()), renderTarget->GetRenderPass(), renderRect);
builder.BeginRenderPass(renderTarget->GetFramebuffer(frame.GetImageIndex()), renderTarget->GetRenderPass(), renderRect, clearValues, 2);
m_imguiDrawer.Draw(builder);
builder.EndRenderPass();
builder.EndDebugRegion();
@ -355,8 +360,8 @@ namespace Nz
texParams.height = height;
texParams.pixelFormat = Nz::PixelFormat::RGBA8;
texParams.type = Nz::ImageType::E2D;
m_fontTexture = renderDevice->InstantiateTexture(texParams);
m_fontTexture->Update(pixels, width, height);
m_fontTexture = renderDevice->InstantiateTexture(texParams, pixels, true);
m_fontTexture->UpdateDebugName("FontTexture");
ImTextureID textureID = m_fontTexture.get();
io.Fonts->TexID = textureID;

View File

@ -11,6 +11,7 @@ add_requires("nazaraengine", { alias = "nazara", debug = is_mode("debug") })
add_requires("imgui v1.87-docking", { alias = "imgui" })
add_includedirs("include", "src")
set_exceptions("cxx")
set_languages("c89", "c++20")
set_rundir("./bin/$(plat)_$(arch)_$(mode)")
set_targetdir("./bin/$(plat)_$(arch)_$(mode)")