Add boilerplate for shader based csg

This commit is contained in:
tamasmeszaros 2019-12-20 12:25:44 +01:00
parent 4f97a7122f
commit 93d0bbd7ef
7 changed files with 282 additions and 122 deletions

View file

@ -1,7 +1,6 @@
#include "Engine.hpp"
#include <libslic3r/Utils.hpp>
#include <libslic3r/SLAPrint.hpp>
#include <libslic3r/MTUtils.hpp>
#include <GL/glew.h>
@ -66,22 +65,6 @@ void CSGDisplay::render_scene()
glFlush();
}
template<class It,
class Trafo,
class GetPt,
class V = typename std::iterator_traits<It>::value_type>
std::vector<V> transform_pts(
It from, It to, Trafo &&tr, GetPt &&point)
{
auto ret = reserve_vector<V>(to - from);
for(auto it = from; it != to; ++it) {
V v = *it;
v.pos = tr * point(*it);
ret.emplace_back(std::move(v));
}
return ret;
}
void Scene::set_print(uqptr<SLAPrint> &&print)
{
m_print = std::move(print);
@ -287,7 +270,7 @@ void IndexedVertexArray::shrink_to_fit() {
this->quad_indices.shrink_to_fit();
}
void Primitive::render()
void Volume::render()
{
glsafe(::glPushMatrix());
glsafe(::glMultMatrixd(m_trafo.get_matrix().data()));