Skip to content
Snippets Groups Projects
Commit 48c17670 authored by Pascal Engeler's avatar Pascal Engeler
Browse files

Handle new uniforms (section line drawing on model)

parent 1501c777
Branches
No related tags found
No related merge requests found
......@@ -151,6 +151,12 @@ Heightmap::Heightmap(std::string filename): _filename(filename) {
_shader_ptr->setFloat("maxZ", static_cast<float>(_maxZ));
_shader_ptr->setFloat("bad_z_value", static_cast<float>(BAD_Z_VALUE));
_shader_ptr->setInt("colorscheme", 0);
_shader_ptr->setInt("plotLinesEnabled", 1);
_shader_ptr->setVec3("plotLineAlongX_color", glm::vec3(1.f,0.f,1.f));
_shader_ptr->setVec3("plotLineAlongY_color", glm::vec3(1.f,0.f,0.f));
_shader_ptr->setFloat("plotLineHalfThickness", 0.01f);
_shader_ptr->setFloat("plotLineAlongX_y", -99999.f);
_shader_ptr->setFloat("plotLineAlongY_x", -99999.f);
_shader_ptr->unuse();
/*Setup Framebuffer*/
......@@ -206,8 +212,18 @@ float Heightmap::getSurfaceHeight(unsigned x, unsigned y, glm::mat4 projection,
glClearColor(0.f, 0.f, 0.f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
//temporarily disable plot lines for this drawcall
_shader_ptr->use();
_shader_ptr->setInt("plotLinesEnabled", 0);
_shader_ptr->unuse();
draw(projection, view, model);
//re-enable plot lines
_shader_ptr->use();
_shader_ptr->setInt("plotLinesEnabled", 1);
_shader_ptr->unuse();
auto color = _framebuffer_ptr->getPixel(x, y);
float defo_um = _colorscheme_ptr->color2value(color[0], color[1], color[2]);
......@@ -225,6 +241,11 @@ void Heightmap::updatePlotWindow(){
ImGui::Begin("Height Profiles", nullptr);
ImGui::SliderFloat("Offset y", &_plotAlongX_y, _minY, _maxY, "%.3f mm");
ImGui::SliderFloat("Offset x", &_plotAlongY_x, _minX, _maxX, "%.3f mm");
//update uniforms accordingly
_shader_ptr->use();
_shader_ptr->setFloat("plotLineAlongX_y", _plotAlongX_y);
_shader_ptr->setFloat("plotLineAlongY_x", _plotAlongY_x);
_shader_ptr->unuse();
_plotHeightLineAlongX(_plotAlongX_y);
_plotHeightLineAlongY(_plotAlongY_x);
ImGui::End();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment