debug window: use wireframe from checkbox in rendering

hud
EmaMaker 2023-09-18 21:37:21 +02:00
parent 07068d740a
commit 50bc52a679
3 changed files with 5 additions and 7 deletions

View File

@ -108,6 +108,8 @@ namespace debug{
std::any_cast<int>(parameters.at("render_chunks_deleted"))); std::any_cast<int>(parameters.at("render_chunks_deleted")));
ImGui::Text("Vertices in the scene: %d", ImGui::Text("Vertices in the scene: %d",
std::any_cast<int>(parameters.at("render_chunks_vertices"))); std::any_cast<int>(parameters.at("render_chunks_vertices")));
ImGui::Checkbox("Wireframe",
std::any_cast<bool*>(parameters.at("wireframe_return")));
} }
if(ImGui::CollapsingHeader("Chunks")){ if(ImGui::CollapsingHeader("Chunks")){

View File

@ -22,7 +22,6 @@ int frames = 0;
float lastBlockPick=0.0; float lastBlockPick=0.0;
bool blockpick = false; bool blockpick = false;
bool canChangeWireframe = true;
bool cursor = false; bool cursor = false;
int main() int main()
@ -153,12 +152,6 @@ void processInput(GLFWwindow *window)
lastBlockPick=glfwGetTime(); lastBlockPick=glfwGetTime();
} }
if (glfwGetKey(window, GLFW_KEY_F) == GLFW_PRESS && canChangeWireframe){
wireframe = !wireframe;
canChangeWireframe = false;
}
if (glfwGetKey(window, GLFW_KEY_F) == GLFW_RELEASE) canChangeWireframe = true;
// Reset blockpicking if enough time has passed // Reset blockpicking if enough time has passed
if(glfwGetMouseButton(window, GLFW_MOUSE_BUTTON_1) == GLFW_RELEASE && glfwGetMouseButton(window, GLFW_MOUSE_BUTTON_2) == GLFW_RELEASE) blockpick = false; if(glfwGetMouseButton(window, GLFW_MOUSE_BUTTON_1) == GLFW_RELEASE && glfwGetMouseButton(window, GLFW_MOUSE_BUTTON_2) == GLFW_RELEASE) blockpick = false;

View File

@ -25,7 +25,9 @@ namespace renderer{
GLuint renderTexFrameBuffer, renderTex, renderTexDepthBuffer, quadVAO, quadVBO; GLuint renderTexFrameBuffer, renderTex, renderTexDepthBuffer, quadVAO, quadVBO;
int screenWidth, screenHeight; int screenWidth, screenHeight;
int crosshair_type{0}; int crosshair_type{0};
bool wireframe{false};
void init(GLFWwindow* window){ void init(GLFWwindow* window){
// Setup rendering // Setup rendering
@ -107,6 +109,7 @@ namespace renderer{
glTexParameteri(GL_TEXTURE_2D_ARRAY,GL_TEXTURE_WRAP_T,GL_REPEAT); glTexParameteri(GL_TEXTURE_2D_ARRAY,GL_TEXTURE_WRAP_T,GL_REPEAT);
debug::window::set_parameter("crosshair_type_return", &crosshair_type); debug::window::set_parameter("crosshair_type_return", &crosshair_type);
debug::window::set_parameter("wireframe_return", &wireframe);
} }