mirror of
https://github.com/antopilo/Nuake.git
synced 2026-09-15 20:08:54 +03:00
Fixed unselection selecting entity with id 0
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace Nuake
|
||||
{
|
||||
Ref<Mesh> Mesh;
|
||||
Matrix4 transform;
|
||||
uint32_t entityId;
|
||||
int32_t entityId;
|
||||
};
|
||||
|
||||
class RenderList
|
||||
@@ -23,7 +23,7 @@ namespace Nuake
|
||||
this->m_RenderList = std::map<Ref<Material>, std::vector<RenderMesh>>();
|
||||
}
|
||||
|
||||
void AddToRenderList(Ref<Mesh> mesh, Matrix4 transform, const uint32_t entityId = -1)
|
||||
void AddToRenderList(Ref<Mesh> mesh, Matrix4 transform, const int32_t entityId = -1)
|
||||
{
|
||||
Ref<Material> material = mesh->GetMaterial();
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace Nuake
|
||||
for (auto& m : i.second)
|
||||
{
|
||||
shader->SetUniformMat4f("u_Model", m.transform);
|
||||
shader->SetUniform1i("u_EntityID", m.entityId);
|
||||
shader->SetUniform1i("u_EntityID", m.entityId + 1);
|
||||
m.Mesh->Draw(shader, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ namespace Nuake
|
||||
{
|
||||
}
|
||||
|
||||
void Renderer::SubmitMesh(Ref<Mesh> mesh, Matrix4 transform, const uint32_t entityId)
|
||||
void Renderer::SubmitMesh(Ref<Mesh> mesh, Matrix4 transform, const int32_t entityId)
|
||||
{
|
||||
m_RenderList.AddToRenderList(mesh, transform, entityId);
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ namespace Nuake
|
||||
static void LoadShaders();
|
||||
|
||||
static void BeginScene();
|
||||
static void SubmitMesh(Ref<Mesh> mesh, Matrix4 transform, const uint32_t entityId = -1);
|
||||
static void SubmitMesh(Ref<Mesh> mesh, Matrix4 transform, const int32_t entityId = -1);
|
||||
static void SubmitCube(Matrix4 transform);
|
||||
static void Flush(Shader* shader, bool depthOnly = false);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user