Work on applying the probed heightmap.

This commit is contained in:
2023-05-18 07:24:05 +03:00
parent f78aa930d6
commit 4e7e059e22
13 changed files with 334 additions and 37 deletions
+8 -5
View File
@@ -346,6 +346,9 @@ void grbl::program_renderer::initialize_program_buffers() {
GLsizei grbl::program_renderer::update_model_vbo(const grbl::program &pgm) {
if (!pgm.is_loaded) return 0;
min_pos = glm::vec3(std::numeric_limits<float>::max());
max_pos = glm::vec3(std::numeric_limits<float>::min());
min_pos = max_pos = glm::vec3(0);
/*
static auto movement_re = std::regex(R"(([gG]0*1?\s+|[xXyYzZ]\s*[0-9\.\-]+))");
@@ -436,19 +439,19 @@ GLsizei grbl::program_renderer::update_model_vbo(const grbl::program &pgm) {
auto feed_color = glm::vec4(1.0f, 0, 0, 1);
for (auto &c: parser.commands) {
auto line = dynamic_cast<grbl::line_motion_cmd *>(c.get());
auto arc = dynamic_cast<grbl::arc_motion_cmd *>(c.get());
auto line = dynamic_cast<grbl::line_motion_cmd *>(c);
auto arc = dynamic_cast<grbl::arc_motion_cmd *>(c);
if (line != nullptr) {
if (line->rapid)
if (line->rapid) {
add_line(buffer_data, line->start, rapid_color, line->end, rapid_color);
else
} else {
add_line(buffer_data, line->start, feed_color, line->end, feed_color);
if (!line->rapid) {
update_model_extents(line->start);
update_model_extents(line->end);
}
} else if (arc != nullptr) {
auto pieces = arc->split(0.1);
for (auto &p: pieces) {