Commit 8a512f5c authored by Bunin, Matvii's avatar Bunin, Matvii
Browse files

small bugfix

parent c1c62f6c
......@@ -25,8 +25,8 @@ void Render::bindLightsUBO() {
void Render::processClick(int x, int y) {
unsigned char objId = 0;
glReadPixels(x, y, 1, 1, GL_STENCIL_INDEX, GL_UNSIGNED_BYTE, &objId);
if (objId != -1) {
bool& disabled = clickableNodes->at(objId)->disabled;
if (objId != 0) {
bool& disabled = clickableNodes->at(objId - 1)->disabled;
disabled = !disabled;
}
}
......@@ -74,6 +74,15 @@ void Render::draw() {
return false;
}
}
else {
if (a->id == plId) {
return false;
}
if (b->id == plId) {
return true;
}
}
glm::vec3 apos = a->nodes[0]->getGlobalPos();
glm::vec3 bpos = b->nodes[0]->getGlobalPos();
......
......@@ -139,7 +139,7 @@ void RenderObject::render(Camera& camera, GLuint lightsUBO, GLuint fogTexture, g
glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
for (const auto& node : nodes) {
glStencilFunc(GL_ALWAYS, node->objectId, -1);
glStencilFunc(GL_ALWAYS, node->objectId + 1, 0);
glUniformMatrix4fv(shader.uniform("transform.model"), 1, GL_FALSE, glm::value_ptr(node->transform));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment