Use OpenGL 2.0 shaders for the layer height rendering.

Use OpenGL 2.0 shaders for the print path rendering for performance reasons.
This commit is contained in:
bubnikv 2017-03-20 12:05:20 +01:00
parent 56f845f3c1
commit 045de596e2
10 changed files with 403 additions and 324 deletions

View file

@ -1,8 +1,28 @@
%module{Slic3r::XS};
#include <xsinit.h>
#include "slic3r/GUI/GLShader.hpp"
#include "slic3r/GUI/3DScene.hpp"
%name{Slic3r::GUI::_3DScene::GLShader} class GLShader {
GLShader();
~GLShader();
bool load(const char *fragment_shader, const char *vertex_shader);
void release();
int get_attrib_location(const char *name) const;
int get_uniform_location(const char *name) const;
bool set_uniform(const char *name, float value) const;
void enable() const;
void disable() const;
std::string last_error() const
%code%{ RETVAL = THIS->last_error; %};
};
%name{Slic3r::GUI::_3DScene::GLVolume} class GLVolume {
GLVolume();
~GLVolume();
@ -55,7 +75,7 @@
GLVolumeCollection();
~GLVolumeCollection();
std::vector<int> load_object(ModelObject *object, int obj_idx, std::vector<int> instance_idxs, std::string color_by, std::string select_by, std::string drag_by);
std::vector<int> load_object(ModelObject *object, int obj_idx, std::vector<int> instance_idxs, std::string color_by, std::string select_by, std::string drag_by, bool use_VBOs);
void erase()
%code{% THIS->clear(); %};
@ -65,7 +85,9 @@
void set_range(double low, double high);
void release_geometry();
void render_VBOs() const;
void render_legacy() const;
void release_geometry();
%{
SV*
@ -97,16 +119,16 @@ void
_load_print_toolpaths(print, volumes, use_VBOs)
Print *print;
GLVolumeCollection *volumes;
bool use_VBOs;
int use_VBOs;
CODE:
_3DScene::_load_print_toolpaths(print, volumes, use_VBOs);
_3DScene::_load_print_toolpaths(print, volumes, use_VBOs != 0);
void
_load_print_object_toolpaths(print_object, volumes, use_VBOs)
PrintObject *print_object;
GLVolumeCollection *volumes;
bool use_VBOs;
int use_VBOs;
CODE:
_3DScene::_load_print_object_toolpaths(print_object, volumes, use_VBOs);
_3DScene::_load_print_object_toolpaths(print_object, volumes, use_VBOs != 0);
%}