Fixed unselection selecting entity with id 0

This commit is contained in:
Antoine Pilote
2023-07-06 19:11:27 -04:00
parent 57bce04d23
commit c960016883
4 changed files with 11 additions and 7 deletions

View File

@@ -241,9 +241,13 @@ namespace Nuake {
gbuffer.Bind();
if (const int result = gbuffer.ReadPixel(3, pixelPos); result >= 0)
if (const int result = gbuffer.ReadPixel(3, pixelPos); result > 0)
{
Selection = EditorSelection(Entity{ (entt::entity)result, Engine::GetCurrentScene().get() });
Selection = EditorSelection(Entity{ (entt::entity)(result - 1), Engine::GetCurrentScene().get()});
}
else
{
Selection = EditorSelection(); // None
}
gbuffer.Unbind();