Skip to content

Commit

Permalink
Added Hide and Show functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
Cherrytree56567 committed Apr 5, 2024
1 parent 47f0dc9 commit 33be520
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
6 changes: 5 additions & 1 deletion Drizzle3D/OpenGL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ namespace Drizzle3D {
glUniform1f(glGetUniformLocation(shaderProgram, (lightPrefix + ".quadratic").c_str()), Lights[i].quadratic);
}
for (const auto& obje : Objects) {
if (obje.hide)
continue;
} else {
if (obje.mat != shaderProgram) {
glUseProgram(obje.mat);
GLuint viewMatrixLoc = glGetUniformLocation(obje.mat, "viewMatrix");
Expand Down Expand Up @@ -178,9 +181,10 @@ namespace Drizzle3D {
glBindVertexArray(obje.VertexArray);
glDrawElements(GL_TRIANGLES, obje.indices.size(), GL_UNSIGNED_INT, 0);
}
}

glUseProgram(0);
glDisable(GL_CULL_FACE);
}

}
}
3 changes: 2 additions & 1 deletion Drizzle3D/RenderingLayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ namespace Drizzle3D {
GLuint textureID = NULL;
GLuint mat = 0;
char* name = (char*)"PLZ_SPECIFY_A_NAME";
bool hide = false;
// Add New Vulkan Shader here as pass it NULL by default.
};

Expand Down Expand Up @@ -121,4 +122,4 @@ namespace Drizzle3D {
std::shared_ptr<ResourceManager> resourcemgr;
Logging log;
};
}
}
7 changes: 5 additions & 2 deletions Drizzle3D/Vulkan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ namespace Drizzle3D {
// Set its values
}
for (const auto& obje : Objects) {
if (obje.hide) {
continue;
} else {
// Look at Object struct in RenderingLayer.h
if (false) { // If Default Vulkan shader is not equal to Vulkan Shader Inside "obje"

Expand Down Expand Up @@ -85,7 +88,7 @@ namespace Drizzle3D {

// Pass Vulkan Shader the ModelMatrix
}

}
// Bind Vertex Array inside of "obje"
// Draw Vertexs
}
Expand All @@ -101,4 +104,4 @@ namespace Drizzle3D {
// Copy vertex data to vertex buffer
// Create index buffer (similar to vertex buffer)
}
}
}

0 comments on commit 33be520

Please sign in to comment.