Heightmap probing is now rendered in real time.
This commit is contained in:
+6
-1
@@ -339,6 +339,8 @@ void grbl::program_renderer::initialize_program_buffers() {
|
||||
}
|
||||
|
||||
GLsizei grbl::program_renderer::update_model_vbo(const grbl::program& pgm) {
|
||||
if (!pgm.is_loaded) return 0;
|
||||
|
||||
static auto movement_re = std::regex(R"(([gG]0*1?\s+|[xXyYzZ]\s*[0-9\.\-]+))");
|
||||
bool is_tool_on = false;
|
||||
|
||||
@@ -428,6 +430,9 @@ void grbl::program_renderer::update_grid(const grbl::heightmap& grid) {
|
||||
|
||||
glm::vec4 color = {0.5, 0.3, 0, 1};
|
||||
|
||||
// this should only be called whenever the grid changes
|
||||
// therefor it should be called each and every time we
|
||||
// probe a new location. let's check that.
|
||||
std::vector<float> buffer_data;
|
||||
|
||||
for (int y = 0; y < grid.y_segments; y++) {
|
||||
@@ -466,7 +471,7 @@ void grbl::program_renderer::update_grid(const grbl::heightmap& grid) {
|
||||
heightmap_vertices_count = buffer_data.size() * sizeof(float) / size_of_vertex_in_bytes;
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, heightmap_vbo_id);
|
||||
glBufferData(GL_ARRAY_BUFFER, sizeof(float) * buffer_data.size(), buffer_data.data(), GL_STATIC_DRAW);
|
||||
glBufferData(GL_ARRAY_BUFFER, sizeof(float) * buffer_data.size(), buffer_data.data(), GL_DYNAMIC_DRAW);
|
||||
}
|
||||
|
||||
void grbl::program_renderer::initialize_heightmap_buffers() {
|
||||
|
||||
Reference in New Issue
Block a user