Skip to content

Commit 5dcc8e9

Browse files
author
Pier-Olivier Boulianne
committed
WIP: the sandbox is stuck on purple
1 parent 6567eb6 commit 5dcc8e9

4 files changed

Lines changed: 15 additions & 14 deletions

File tree

Core/Source/Lux/Core/Window.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -481,12 +481,12 @@ namespace Lux {
481481
void Window::SetVSync(bool enabled)
482482
{
483483
m_Specification.VSync = enabled;
484-
/*
484+
485485
Application::Get().QueueEvent([&]()
486486
{
487-
// m_SwapChain->SetVSync(m_Specification.VSync);
488-
// m_SwapChain->OnResize(m_Specification.Width, m_Specification.Height);
489-
});*/
487+
//m_SwapChain->SetVSync(m_Specification.VSync);
488+
//m_SwapChain->OnResize(m_Specification.Width, m_Specification.Height);
489+
});
490490
}
491491

492492
bool Window::IsVSync() const

Core/Source/Lux/Platform/Vulkan/DescriptorSetManager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -860,7 +860,7 @@ namespace Lux {
860860

861861
if (!InvalidatedInputResources.empty())
862862
{
863-
LUX_CORE_INFO_TAG("Renderer", "DescriptorSetManager::InvalidateAndUpdate ({}) - updating {} descriptors (frameIndex={})", m_Specification.DebugName, InvalidatedInputResources.size(), currentFrameIndex);
863+
//LUX_CORE_INFO_TAG("Renderer", "DescriptorSetManager::InvalidateAndUpdate ({}) - updating {} descriptors (frameIndex={})", m_Specification.DebugName, InvalidatedInputResources.size(), currentFrameIndex);
864864
Bake();
865865
}
866866

Core/Source/Lux/Renderer/Renderer2D.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ namespace Lux {
1414

1515
class VulkanSwapChain;
1616

17-
class Renderer2D
17+
class Renderer2D : public RefCounted
1818
{
1919
public:
2020

Sandbox/Source/Sandbox2D.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323

2424
Sandbox2D::Sandbox2D()
25-
:Layer("Sandbox2D"), m_CameraController(90.0f, 1600.0f, 900.0f, 10.0f, 1000.0f), m_SquareColor({ 0.2f, 0.3f, 0.8f, 1.0f })
25+
:Layer("Sandbox2D"), m_CameraController(60.0f, 1600.0f, 900.0f, 0.1f, 1000.0f), m_SquareColor({ 0.2f, 0.3f, 0.8f, 1.0f })
2626
{
2727

2828
}
@@ -32,7 +32,7 @@ void Sandbox2D::OnAttach()
3232
LUX_PROFILE_FUNCTION("Sandbox2D::OnAttach");
3333

3434
m_CommandBuffer = Lux::RenderCommandBuffer::Create(0, "Sandbox2D");
35-
//m_CheckerboardTexture = Lux::TextureImporter::LoadTexture2D("assets/textures/Checkerboard.png");
35+
m_CheckerboardTexture = Lux::TextureImporter::LoadTexture2D("assets/textures/Checkerboard.png");
3636
}
3737

3838
void Sandbox2D::OnDetach()
@@ -51,14 +51,14 @@ void Sandbox2D::OnUpdate(Lux::Timestep ts)
5151
Lux::Renderer2D::ResetStats();
5252

5353
auto& swapchain = Lux::Application::Get().GetWindow().GetSwapChain();
54-
Lux::Ref<Lux::SwapChainFramebuffer> framebuffer = Lux::SwapChainFramebuffer::Create(&swapchain);
54+
Lux::Ref<Lux::Framebuffer> framebuffer = Lux::SwapChainFramebuffer::Create(&swapchain);
5555

56-
// Submit clear and 2D draws via render command buffer
5756
m_CommandBuffer->Begin();
5857

5958
Lux::Renderer::Submit([cmd = m_CommandBuffer, fb = framebuffer]()
6059
{
61-
nvrhi::utils::ClearColorAttachment(cmd->GetActive(), fb->GetHandle(), 0, nvrhi::Color(0.1f, 0.1f, 0.1f, 1.0f));
60+
nvrhi::utils::ClearColorAttachment(cmd->GetActive(), fb->GetHandle(), 0,
61+
nvrhi::Color(0.1f, 0.1f, 0.1f, 1.0f));
6262
});
6363

6464
{
@@ -68,9 +68,10 @@ void Sandbox2D::OnUpdate(Lux::Timestep ts)
6868
LUX_PROFILE_SCOPE("Renderer Draw");
6969

7070
Lux::Ref<Lux::Texture2D> bgTexture = m_CheckerboardTexture ? m_CheckerboardTexture : Lux::Renderer::GetWhiteTexture();
71-
Lux::Renderer2D::BeginScene(m_CommandBuffer, &swapchain, m_CameraController);
72-
//Lux::Renderer2D::DrawQuad({ 0.0f, 0.0f, -0.1f }, { 20.0f, 20.0f }, bgTexture, 10.0f);
73-
Lux::Renderer2D::DrawRotatedQuad({ 1.0f, 0.0f }, { 0.8f, 0.8f }, rotation, { 0.8f, 0.2f, 0.3f, 1.0f });
71+
// Put geometry well inside the frustum to avoid any near-plane clipping ambiguity
72+
Lux::Renderer2D::BeginScene(m_CommandBuffer, framebuffer, m_CameraController);
73+
Lux::Renderer2D::DrawQuad({ 0.0f, 0.0f, -5.0f }, { 20.0f, 20.0f }, bgTexture, 10.0f);
74+
//Lux::Renderer2D::DrawRotatedQuad({ 1.0f, 0.0f, -5.0f }, { 0.8f, 0.8f }, rotation, { 0.8f, 0.2f, 0.3f, 1.0f });
7475
Lux::Renderer2D::EndScene();
7576
}
7677

0 commit comments

Comments
 (0)