Gizmo mouse picking now works

This commit is contained in:
Antoine Pilote
2023-10-12 19:49:17 -04:00
parent 90732fca50
commit c826056846
4 changed files with 4 additions and 4 deletions

View File

@@ -278,7 +278,7 @@ namespace Nuake {
auto gizmoBuffer = Engine::GetCurrentWindow()->GetFrameBuffer();
gizmoBuffer->Bind();
bool foundSomethingToSelect = false;
if (const int result = gizmoBuffer->ReadPixel(3, pixelPos); result > 0)
if (const int result = gizmoBuffer->ReadPixel(1, pixelPos); result > 0)
{
auto ent = Entity{ (entt::entity)(result - 1), Engine::GetCurrentScene().get() };
if (ent.IsValid())

View File

@@ -235175,7 +235175,7 @@ const std::string Resources_Shaders_gizmo_shader_path = R"(Resources/Shaders/giz
0x20, 0x6f, 0x75, 0x74, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x46, 0x72,
0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x3b, 0x0d, 0x0a, 0x6c, 0x61,
0x79, 0x6f, 0x75, 0x74, 0x28, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f,
0x6e, 0x20, 0x3d, 0x20, 0x33, 0x29, 0x20, 0x6f, 0x75, 0x74, 0x20, 0x69,
0x6e, 0x20, 0x3d, 0x20, 0x31, 0x29, 0x20, 0x6f, 0x75, 0x74, 0x20, 0x69,
0x6e, 0x74, 0x20, 0x67, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x49, 0x44,
0x3b, 0x0d, 0x0a, 0x0d, 0x0a, 0x69, 0x6e, 0x20, 0x76, 0x65, 0x63, 0x32,
0x20, 0x61, 0x5f, 0x55, 0x56, 0x3b, 0x0d, 0x0a, 0x69, 0x6e, 0x20, 0x6d,

View File

@@ -102,7 +102,7 @@ namespace Nuake
const Vector2 defaultResolution = Vector2(1, 1);
m_Framebuffer = CreateRef<FrameBuffer>(true, defaultResolution);
m_Framebuffer->SetTexture(CreateRef<Texture>(defaultResolution, GL_RGB));
m_Framebuffer->SetTexture(CreateRef<Texture>(defaultResolution, GL_RED_INTEGER, GL_R32I, GL_INT), GL_COLOR_ATTACHMENT3); // Entity ID
m_Framebuffer->SetTexture(CreateRef<Texture>(defaultResolution, GL_RED_INTEGER, GL_R32I, GL_INT), GL_COLOR_ATTACHMENT1); // Entity ID
InitImgui();

View File

@@ -24,7 +24,7 @@ void main()
#version 440 core
layout(location = 0) out vec4 FragColor;
layout(location = 3) out int gEntityID;
layout(location = 1) out int gEntityID;
in vec2 a_UV;
in mat4 o_Projection;