Starting point for CSM projectiong matrix debugging
This commit is contained in:
@@ -62,8 +62,7 @@
|
||||
#include "src/Rendering/Vulkan/VulkanRenderer.h"
|
||||
#include <src/Rendering/Vulkan/VkResources.h>
|
||||
#include <src/Rendering/Vulkan/VulkanImage/VulkanImage.h>
|
||||
|
||||
|
||||
#include <volk/volk.h>
|
||||
namespace Nuake {
|
||||
|
||||
ImFont* normalFont;
|
||||
@@ -631,23 +630,24 @@ namespace Nuake {
|
||||
|
||||
if (SelectedViewport == 1)
|
||||
{
|
||||
textureDesc = pipeline.GetRenderPass("GBuffer").GetAttachment("Albedo").Image->GetImGuiDescriptorSet();
|
||||
//pipeline.GetRenderPass("Shadow").GetDepthAttachment().Image->TransitionLayout(VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL);
|
||||
textureDesc = pipeline.GetRenderPass("Shadow").GetDepthAttachment().Image->GetImGuiDescriptorSet();
|
||||
texture = Engine::GetCurrentScene()->m_SceneRenderer->GetGBuffer().GetTexture(GL_COLOR_ATTACHMENT0);
|
||||
}
|
||||
else if (SelectedViewport == 2)
|
||||
{
|
||||
textureDesc = pipeline.GetRenderPass("GBuffer").GetAttachment("Normal").Image->GetImGuiDescriptorSet();
|
||||
texture = Engine::GetCurrentScene()->m_SceneRenderer->GetGBuffer().GetTexture(GL_COLOR_ATTACHMENT1);
|
||||
//textureDesc = pipeline.GetRenderPass("GBuffer").GetAttachment("Normal").Image->GetImGuiDescriptorSet();
|
||||
//texture = Engine::GetCurrentScene()->m_SceneRenderer->GetGBuffer().GetTexture(GL_COLOR_ATTACHMENT1);
|
||||
}
|
||||
else if (SelectedViewport == 3)
|
||||
{
|
||||
textureDesc = pipeline.GetRenderPass("GBuffer").GetDepthAttachment().Image->GetImGuiDescriptorSet();
|
||||
texture = Engine::GetCurrentScene()->m_SceneRenderer->GetScaledDepthTexture();
|
||||
//textureDesc = pipeline.GetRenderPass("GBuffer").GetDepthAttachment().Image->GetImGuiDescriptorSet();
|
||||
//texture = Engine::GetCurrentScene()->m_SceneRenderer->GetScaledDepthTexture();
|
||||
}
|
||||
else if (SelectedViewport == 4)
|
||||
{
|
||||
textureDesc = pipeline.GetRenderPass("GBuffer").GetAttachment("Material").Image->GetImGuiDescriptorSet();
|
||||
texture = Engine::GetCurrentScene()->m_SceneRenderer->GetVelocityTexture();
|
||||
//textureDesc = pipeline.GetRenderPass("GBuffer").GetAttachment("Material").Image->GetImGuiDescriptorSet();
|
||||
//texture = Engine::GetCurrentScene()->m_SceneRenderer->GetVelocityTexture();
|
||||
}
|
||||
|
||||
ImVec2 imagePos = ImGui::GetWindowPos() + ImGui::GetCursorPos();
|
||||
|
||||
@@ -825,6 +825,7 @@ void VkSceneRenderer::BuildMatrixBuffer()
|
||||
auto [transform, lightComp] = lightView.get<TransformComponent, LightComponent>(e);
|
||||
|
||||
Vector3 direction = transform.GetGlobalRotation() * Vector3(0, 0, -1);
|
||||
lightComp.Direction = direction;
|
||||
|
||||
LightData light = {};
|
||||
light.position = Vector3(transform.GetGlobalTransform()[3]);
|
||||
|
||||
@@ -149,8 +149,7 @@ namespace Nuake
|
||||
void BeginScene(RenderContext inContext);
|
||||
void EndScene();
|
||||
|
||||
RenderPipeline& GetRenderPipeline() { return GBufferPipeline; }
|
||||
|
||||
RenderPipeline& GetRenderPipeline() { return ShadowPipeline; }
|
||||
private:
|
||||
void LoadShaders();
|
||||
void CreateBuffers();
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace Nuake
|
||||
void CalculateViewProjection(glm::mat4& view, const glm::mat4& projection)
|
||||
{
|
||||
Matrix4 normalProj = projection;
|
||||
normalProj *= -1.0f;
|
||||
//normalProj *= -1.0f;
|
||||
glm::mat4 viewProjection = normalProj * view;
|
||||
glm::mat4 inverseViewProjection = glm::inverse(viewProjection);
|
||||
|
||||
@@ -158,9 +158,8 @@ namespace Nuake
|
||||
roundOffset.w = 0.0f;
|
||||
lightProjectionMatrix[3] += roundOffset;
|
||||
|
||||
m_LightViews[cascade].View = view;
|
||||
m_LightViews[cascade].Proj = projection;
|
||||
//m_LightViews[cascade].Proj[1][1] *= -1.0f;
|
||||
m_LightViews[cascade].View = lightViewMatrix;
|
||||
m_LightViews[cascade].Proj = lightProjectionMatrix;
|
||||
|
||||
// Store SplitDistance and ViewProjection-Matrix
|
||||
mCascadeSplitDepth[cascade] = (nearClip + splitDist * clipRange) * 1.0f;
|
||||
|
||||
@@ -81,7 +81,7 @@ VSOutput main(uint vertexIndex : SV_VertexID)
|
||||
Camera camData = camera[0];
|
||||
ModelData modelData = model[pushConstants.modelIndex];
|
||||
|
||||
CameraView camView = cameras[pushConstants.cameraID];
|
||||
CameraView camView = cameras[pushConstants.cameraID];
|
||||
|
||||
// Load vertex data from the buffer
|
||||
Vertex v = vertexBuffer[vertexIndex];
|
||||
|
||||
Reference in New Issue
Block a user