debug window: use crosshair type from slider in shader

hud
EmaMaker 2023-09-18 21:00:08 +02:00
parent 9d2d0c8772
commit 52696f2dde
2 changed files with 6 additions and 4 deletions

View File

@ -59,7 +59,6 @@ namespace debug{
parameters[key] = value;
}
int ch_type{0};
int block_type{0};
void show_debug_window(){
ImGui::Begin("Debug Window");
@ -91,9 +90,9 @@ namespace debug{
}
ImGui::SliderInt("Crosshair type",
&ch_type, 0, 1);
std::any_cast<int*>(parameters.at("crosshair_type_return")), 0, 1);
ImGui::SliderInt("Block to place",
&block_type, 2, 6);
block_type, 2, 6);
}
if(ImGui::CollapsingHeader("Mesh")){

View File

@ -25,6 +25,7 @@ namespace renderer{
GLuint renderTexFrameBuffer, renderTex, renderTexDepthBuffer, quadVAO, quadVBO;
int screenWidth, screenHeight;
int crosshair_type{0};
void init(GLFWwindow* window){
// Setup rendering
@ -104,6 +105,8 @@ namespace renderer{
glTexParameteri(GL_TEXTURE_2D_ARRAY,GL_TEXTURE_MAG_FILTER,GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D_ARRAY,GL_TEXTURE_WRAP_S,GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D_ARRAY,GL_TEXTURE_WRAP_T,GL_REPEAT);
debug::window::set_parameter("crosshair_type_return", &crosshair_type);
}
@ -238,7 +241,7 @@ namespace renderer{
quadShader->use();
quadShader->setInt("screenWidth", screenWidth);
quadShader->setInt("screenHeight", screenHeight);
quadShader->setInt("crosshairType", 1);
quadShader->setInt("crosshairType", crosshair_type);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
glBindVertexArray(0);