mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-12 09:17:52 -06:00
Objects rendering moved to c++
This commit is contained in:
parent
b4beb7aae9
commit
b36243ba10
9 changed files with 192 additions and 55 deletions
|
@ -282,6 +282,14 @@ sub new {
|
||||||
$self->_variable_layer_thickness_action(undef);
|
$self->_variable_layer_thickness_action(undef);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
#==============================================================================================================================
|
||||||
|
my $on_mark_volumes_for_layer_height = sub {
|
||||||
|
$self->mark_volumes_for_layer_height;
|
||||||
|
};
|
||||||
|
|
||||||
|
Slic3r::GUI::_3DScene::register_on_mark_volumes_for_layer_height($self, $on_mark_volumes_for_layer_height);
|
||||||
|
#==============================================================================================================================
|
||||||
|
|
||||||
return $self;
|
return $self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1504,6 +1512,7 @@ sub Render {
|
||||||
|
|
||||||
#==============================================================================================================================
|
#==============================================================================================================================
|
||||||
Slic3r::GUI::_3DScene::render_background($self);
|
Slic3r::GUI::_3DScene::render_background($self);
|
||||||
|
Slic3r::GUI::_3DScene::render_bed($self);
|
||||||
|
|
||||||
# # draw fixed background
|
# # draw fixed background
|
||||||
# if ($self->background) {
|
# if ($self->background) {
|
||||||
|
@ -1538,10 +1547,7 @@ sub Render {
|
||||||
#
|
#
|
||||||
# # draw ground
|
# # draw ground
|
||||||
# my $ground_z = GROUND_Z;
|
# my $ground_z = GROUND_Z;
|
||||||
#==============================================================================================================================
|
#
|
||||||
#==============================================================================================================================
|
|
||||||
Slic3r::GUI::_3DScene::render_bed($self);
|
|
||||||
|
|
||||||
# if ($self->bed_triangles) {
|
# if ($self->bed_triangles) {
|
||||||
# glDisable(GL_DEPTH_TEST);
|
# glDisable(GL_DEPTH_TEST);
|
||||||
#
|
#
|
||||||
|
@ -1575,6 +1581,10 @@ sub Render {
|
||||||
|
|
||||||
#==============================================================================================================================
|
#==============================================================================================================================
|
||||||
Slic3r::GUI::_3DScene::render_axes($self);
|
Slic3r::GUI::_3DScene::render_axes($self);
|
||||||
|
Slic3r::GUI::_3DScene::render_objects($self, $self->UseVBOs);
|
||||||
|
Slic3r::GUI::_3DScene::render_cutting_plane($self);
|
||||||
|
Slic3r::GUI::_3DScene::render_warning_texture($self);
|
||||||
|
Slic3r::GUI::_3DScene::render_legend_texture($self);
|
||||||
|
|
||||||
# {
|
# {
|
||||||
# # draw axes
|
# # draw axes
|
||||||
|
@ -1602,61 +1612,31 @@ sub Render {
|
||||||
# glVertex3f(@$origin, $ground_z+$axis_len);
|
# glVertex3f(@$origin, $ground_z+$axis_len);
|
||||||
# glEnd();
|
# glEnd();
|
||||||
# }
|
# }
|
||||||
#==============================================================================================================================
|
#
|
||||||
|
# glEnable(GL_LIGHTING);
|
||||||
glEnable(GL_LIGHTING);
|
#
|
||||||
|
# # draw objects
|
||||||
# draw objects
|
|
||||||
#===================================================================================================================================
|
|
||||||
if (!Slic3r::GUI::_3DScene::is_shader_enabled($self)) {
|
|
||||||
# if (! $self->use_plain_shader) {
|
# if (! $self->use_plain_shader) {
|
||||||
#===================================================================================================================================
|
|
||||||
#==============================================================================================================================
|
|
||||||
Slic3r::GUI::_3DScene::render_volumes($self, 0);
|
|
||||||
# $self->draw_volumes;
|
# $self->draw_volumes;
|
||||||
#==============================================================================================================================
|
# } elsif ($self->UseVBOs) {
|
||||||
} elsif ($self->UseVBOs) {
|
|
||||||
#==============================================================================================================================
|
|
||||||
if (Slic3r::GUI::_3DScene::is_picking_enabled($self)) {
|
|
||||||
# if ($self->enable_picking) {
|
# if ($self->enable_picking) {
|
||||||
#==============================================================================================================================
|
# $self->mark_volumes_for_layer_height;
|
||||||
$self->mark_volumes_for_layer_height;
|
# $self->volumes->set_print_box($self->bed_bounding_box->x_min, $self->bed_bounding_box->y_min, 0.0, $self->bed_bounding_box->x_max, $self->bed_bounding_box->y_max, $self->{config}->get('max_print_height'));
|
||||||
$self->volumes->set_print_box($self->bed_bounding_box->x_min, $self->bed_bounding_box->y_min, 0.0, $self->bed_bounding_box->x_max, $self->bed_bounding_box->y_max, $self->{config}->get('max_print_height'));
|
# $self->volumes->check_outside_state($self->{config});
|
||||||
$self->volumes->check_outside_state($self->{config});
|
# # do not cull backfaces to show broken geometry, if any
|
||||||
# do not cull backfaces to show broken geometry, if any
|
# glDisable(GL_CULL_FACE);
|
||||||
glDisable(GL_CULL_FACE);
|
# }
|
||||||
}
|
|
||||||
#==============================================================================================================================
|
|
||||||
Slic3r::GUI::_3DScene::start_using_shader($self);
|
|
||||||
# $self->{plain_shader}->enable if $self->{plain_shader};
|
# $self->{plain_shader}->enable if $self->{plain_shader};
|
||||||
#==============================================================================================================================
|
# $self->volumes->render_VBOs;
|
||||||
$self->volumes->render_VBOs;
|
|
||||||
#==============================================================================================================================
|
|
||||||
Slic3r::GUI::_3DScene::stop_using_shader($self);
|
|
||||||
# $self->{plain_shader}->disable;
|
# $self->{plain_shader}->disable;
|
||||||
#==============================================================================================================================
|
|
||||||
#==============================================================================================================================
|
|
||||||
glEnable(GL_CULL_FACE) if (Slic3r::GUI::_3DScene::is_picking_enabled($self));
|
|
||||||
# glEnable(GL_CULL_FACE) if ($self->enable_picking);
|
# glEnable(GL_CULL_FACE) if ($self->enable_picking);
|
||||||
#==============================================================================================================================
|
# } else {
|
||||||
} else {
|
# # do not cull backfaces to show broken geometry, if any
|
||||||
# do not cull backfaces to show broken geometry, if any
|
|
||||||
#==============================================================================================================================
|
|
||||||
glDisable(GL_CULL_FACE) if (Slic3r::GUI::_3DScene::is_picking_enabled($self));
|
|
||||||
# glDisable(GL_CULL_FACE) if ($self->enable_picking);
|
# glDisable(GL_CULL_FACE) if ($self->enable_picking);
|
||||||
#==============================================================================================================================
|
# $self->volumes->render_legacy;
|
||||||
$self->volumes->render_legacy;
|
|
||||||
#==============================================================================================================================
|
|
||||||
glEnable(GL_CULL_FACE) if (Slic3r::GUI::_3DScene::is_picking_enabled($self));
|
|
||||||
# glEnable(GL_CULL_FACE) if ($self->enable_picking);
|
# glEnable(GL_CULL_FACE) if ($self->enable_picking);
|
||||||
#==============================================================================================================================
|
# }
|
||||||
}
|
#
|
||||||
|
|
||||||
#==============================================================================================================================
|
|
||||||
Slic3r::GUI::_3DScene::render_cutting_plane($self);
|
|
||||||
Slic3r::GUI::_3DScene::render_warning_texture($self);
|
|
||||||
Slic3r::GUI::_3DScene::render_legend_texture($self);
|
|
||||||
|
|
||||||
# if (defined $self->cutting_plane_z) {
|
# if (defined $self->cutting_plane_z) {
|
||||||
# # draw cutting plane
|
# # draw cutting plane
|
||||||
# my $plane_z = $self->cutting_plane_z;
|
# my $plane_z = $self->cutting_plane_z;
|
||||||
|
|
|
@ -31,6 +31,9 @@ sub new {
|
||||||
$self->{model} = $model;
|
$self->{model} = $model;
|
||||||
$self->{print} = $print;
|
$self->{print} = $print;
|
||||||
$self->{config} = $config;
|
$self->{config} = $config;
|
||||||
|
#==============================================================================================================================
|
||||||
|
Slic3r::GUI::_3DScene::set_config($self, $config);
|
||||||
|
#==============================================================================================================================
|
||||||
$self->{on_select_object} = sub {};
|
$self->{on_select_object} = sub {};
|
||||||
$self->{on_instances_moved} = sub {};
|
$self->{on_instances_moved} = sub {};
|
||||||
$self->{on_wipe_tower_moved} = sub {};
|
$self->{on_wipe_tower_moved} = sub {};
|
||||||
|
|
|
@ -1792,6 +1792,16 @@ void _3DScene::reset_volumes(wxGLCanvas* canvas)
|
||||||
s_canvas_mgr.reset_volumes(canvas);
|
s_canvas_mgr.reset_volumes(canvas);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DynamicPrintConfig* _3DScene::get_config(wxGLCanvas* canvas)
|
||||||
|
{
|
||||||
|
return s_canvas_mgr.get_config(canvas);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _3DScene::set_config(wxGLCanvas* canvas, DynamicPrintConfig* config)
|
||||||
|
{
|
||||||
|
s_canvas_mgr.set_config(canvas, config);
|
||||||
|
}
|
||||||
|
|
||||||
void _3DScene::set_bed_shape(wxGLCanvas* canvas, const Pointfs& shape)
|
void _3DScene::set_bed_shape(wxGLCanvas* canvas, const Pointfs& shape)
|
||||||
{
|
{
|
||||||
return s_canvas_mgr.set_bed_shape(canvas, shape);
|
return s_canvas_mgr.set_bed_shape(canvas, shape);
|
||||||
|
@ -1988,6 +1998,11 @@ void _3DScene::render_volumes(wxGLCanvas* canvas, bool fake_colors)
|
||||||
s_canvas_mgr.render_volumes(canvas, fake_colors);
|
s_canvas_mgr.render_volumes(canvas, fake_colors);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _3DScene::render_objects(wxGLCanvas* canvas, bool useVBOs)
|
||||||
|
{
|
||||||
|
s_canvas_mgr.render_objects(canvas, useVBOs);
|
||||||
|
}
|
||||||
|
|
||||||
void _3DScene::render_cutting_plane(wxGLCanvas* canvas)
|
void _3DScene::render_cutting_plane(wxGLCanvas* canvas)
|
||||||
{
|
{
|
||||||
s_canvas_mgr.render_cutting_plane(canvas);
|
s_canvas_mgr.render_cutting_plane(canvas);
|
||||||
|
@ -2013,6 +2028,11 @@ void _3DScene::register_on_viewport_changed_callback(wxGLCanvas* canvas, void* c
|
||||||
s_canvas_mgr.register_on_viewport_changed_callback(canvas, callback);
|
s_canvas_mgr.register_on_viewport_changed_callback(canvas, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _3DScene::register_on_mark_volumes_for_layer_height(wxGLCanvas* canvas, void* callback)
|
||||||
|
{
|
||||||
|
s_canvas_mgr.register_on_mark_volumes_for_layer_height(canvas, callback);
|
||||||
|
}
|
||||||
|
|
||||||
//void _3DScene::_glew_init()
|
//void _3DScene::_glew_init()
|
||||||
//{
|
//{
|
||||||
// glewInit();
|
// glewInit();
|
||||||
|
|
|
@ -555,9 +555,11 @@ public:
|
||||||
|
|
||||||
static GLVolumeCollection* get_volumes(wxGLCanvas* canvas);
|
static GLVolumeCollection* get_volumes(wxGLCanvas* canvas);
|
||||||
static void set_volumes(wxGLCanvas* canvas, GLVolumeCollection* volumes);
|
static void set_volumes(wxGLCanvas* canvas, GLVolumeCollection* volumes);
|
||||||
|
|
||||||
static void reset_volumes(wxGLCanvas* canvas);
|
static void reset_volumes(wxGLCanvas* canvas);
|
||||||
|
|
||||||
|
static DynamicPrintConfig* get_config(wxGLCanvas* canvas);
|
||||||
|
static void set_config(wxGLCanvas* canvas, DynamicPrintConfig* config);
|
||||||
|
|
||||||
static void set_bed_shape(wxGLCanvas* canvas, const Pointfs& shape);
|
static void set_bed_shape(wxGLCanvas* canvas, const Pointfs& shape);
|
||||||
static void set_auto_bed_shape(wxGLCanvas* canvas);
|
static void set_auto_bed_shape(wxGLCanvas* canvas);
|
||||||
|
|
||||||
|
@ -612,6 +614,7 @@ public:
|
||||||
static void render_bed(wxGLCanvas* canvas);
|
static void render_bed(wxGLCanvas* canvas);
|
||||||
static void render_axes(wxGLCanvas* canvas);
|
static void render_axes(wxGLCanvas* canvas);
|
||||||
static void render_volumes(wxGLCanvas* canvas, bool fake_colors);
|
static void render_volumes(wxGLCanvas* canvas, bool fake_colors);
|
||||||
|
static void render_objects(wxGLCanvas* canvas, bool useVBOs);
|
||||||
static void render_cutting_plane(wxGLCanvas* canvas);
|
static void render_cutting_plane(wxGLCanvas* canvas);
|
||||||
static void render_warning_texture(wxGLCanvas* canvas);
|
static void render_warning_texture(wxGLCanvas* canvas);
|
||||||
static void render_legend_texture(wxGLCanvas* canvas);
|
static void render_legend_texture(wxGLCanvas* canvas);
|
||||||
|
@ -619,6 +622,7 @@ public:
|
||||||
static void render_texture(wxGLCanvas* canvas, unsigned int tex_id, float left, float right, float bottom, float top);
|
static void render_texture(wxGLCanvas* canvas, unsigned int tex_id, float left, float right, float bottom, float top);
|
||||||
|
|
||||||
static void register_on_viewport_changed_callback(wxGLCanvas* canvas, void* callback);
|
static void register_on_viewport_changed_callback(wxGLCanvas* canvas, void* callback);
|
||||||
|
static void register_on_mark_volumes_for_layer_height(wxGLCanvas* canvas, void* callback);
|
||||||
|
|
||||||
// static void _glew_init();
|
// static void _glew_init();
|
||||||
//##################################################################################################################
|
//##################################################################################################################
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include "../../slic3r/GUI/3DScene.hpp"
|
#include "../../slic3r/GUI/3DScene.hpp"
|
||||||
#include "../../slic3r/GUI/GLShader.hpp"
|
#include "../../slic3r/GUI/GLShader.hpp"
|
||||||
#include "../../libslic3r/ClipperUtils.hpp"
|
#include "../../libslic3r/ClipperUtils.hpp"
|
||||||
|
#include "../../libslic3r/PrintConfig.hpp"
|
||||||
|
|
||||||
#include <wx/glcanvas.h>
|
#include <wx/glcanvas.h>
|
||||||
|
|
||||||
|
@ -477,6 +478,7 @@ GLCanvas3D::GLCanvas3D(wxGLCanvas* canvas, wxGLContext* context)
|
||||||
: m_canvas(canvas)
|
: m_canvas(canvas)
|
||||||
, m_context(context)
|
, m_context(context)
|
||||||
, m_volumes(nullptr)
|
, m_volumes(nullptr)
|
||||||
|
, m_config(nullptr)
|
||||||
, m_dirty(true)
|
, m_dirty(true)
|
||||||
, m_apply_zoom_to_volumes_filter(false)
|
, m_apply_zoom_to_volumes_filter(false)
|
||||||
, m_warning_texture_enabled(false)
|
, m_warning_texture_enabled(false)
|
||||||
|
@ -612,6 +614,16 @@ void GLCanvas3D::reset_volumes()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DynamicPrintConfig* GLCanvas3D::get_config()
|
||||||
|
{
|
||||||
|
return m_config;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GLCanvas3D::set_config(DynamicPrintConfig* config)
|
||||||
|
{
|
||||||
|
m_config = config;
|
||||||
|
}
|
||||||
|
|
||||||
void GLCanvas3D::set_bed_shape(const Pointfs& shape)
|
void GLCanvas3D::set_bed_shape(const Pointfs& shape)
|
||||||
{
|
{
|
||||||
m_bed.set_shape(shape);
|
m_bed.set_shape(shape);
|
||||||
|
@ -935,6 +947,51 @@ void GLCanvas3D::render_volumes(bool fake_colors) const
|
||||||
::glEnable(GL_CULL_FACE);
|
::glEnable(GL_CULL_FACE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GLCanvas3D::render_objects(bool useVBOs)
|
||||||
|
{
|
||||||
|
if (m_volumes == nullptr)
|
||||||
|
return;
|
||||||
|
|
||||||
|
::glEnable(GL_LIGHTING);
|
||||||
|
|
||||||
|
if (!is_shader_enabled())
|
||||||
|
render_volumes(false);
|
||||||
|
else if (useVBOs)
|
||||||
|
{
|
||||||
|
if (is_picking_enabled())
|
||||||
|
{
|
||||||
|
m_on_mark_volumes_for_layer_height.call();
|
||||||
|
|
||||||
|
if (m_config != nullptr)
|
||||||
|
{
|
||||||
|
const BoundingBoxf3& bed_bb = bed_bounding_box();
|
||||||
|
m_volumes->set_print_box((float)bed_bb.min.x, (float)bed_bb.min.y, 0.0f, (float)bed_bb.max.x, (float)bed_bb.max.y, (float)m_config->opt_float("max_print_height"));
|
||||||
|
m_volumes->check_outside_state(m_config);
|
||||||
|
}
|
||||||
|
// do not cull backfaces to show broken geometry, if any
|
||||||
|
::glDisable(GL_CULL_FACE);
|
||||||
|
}
|
||||||
|
|
||||||
|
start_using_shader();
|
||||||
|
m_volumes->render_VBOs();
|
||||||
|
stop_using_shader();
|
||||||
|
|
||||||
|
if (is_picking_enabled())
|
||||||
|
::glEnable(GL_CULL_FACE);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// do not cull backfaces to show broken geometry, if any
|
||||||
|
if (is_picking_enabled())
|
||||||
|
::glDisable(GL_CULL_FACE);
|
||||||
|
|
||||||
|
m_volumes->render_legacy();
|
||||||
|
|
||||||
|
if (is_picking_enabled())
|
||||||
|
::glEnable(GL_CULL_FACE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void GLCanvas3D::render_cutting_plane() const
|
void GLCanvas3D::render_cutting_plane() const
|
||||||
{
|
{
|
||||||
m_cutting_plane.render(volumes_bounding_box());
|
m_cutting_plane.render(volumes_bounding_box());
|
||||||
|
@ -1036,6 +1093,12 @@ void GLCanvas3D::register_on_viewport_changed_callback(void* callback)
|
||||||
m_on_viewport_changed_callback.register_callback(callback);
|
m_on_viewport_changed_callback.register_callback(callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GLCanvas3D::register_on_mark_volumes_for_layer_height(void* callback)
|
||||||
|
{
|
||||||
|
if (callback != nullptr)
|
||||||
|
m_on_mark_volumes_for_layer_height.register_callback(callback);
|
||||||
|
}
|
||||||
|
|
||||||
void GLCanvas3D::on_size(wxSizeEvent& evt)
|
void GLCanvas3D::on_size(wxSizeEvent& evt)
|
||||||
{
|
{
|
||||||
set_dirty(true);
|
set_dirty(true);
|
||||||
|
@ -1210,6 +1273,7 @@ float GLCanvas3D::_get_zoom_to_bounding_box_factor(const BoundingBoxf3& bbox) co
|
||||||
void GLCanvas3D::_deregister_callbacks()
|
void GLCanvas3D::_deregister_callbacks()
|
||||||
{
|
{
|
||||||
m_on_viewport_changed_callback.deregister_callback();
|
m_on_viewport_changed_callback.deregister_callback();
|
||||||
|
m_on_mark_volumes_for_layer_height.deregister_callback();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace GUI
|
} // namespace GUI
|
||||||
|
|
|
@ -14,6 +14,7 @@ class wxKeyEvent;
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
|
|
||||||
class GLVolumeCollection;
|
class GLVolumeCollection;
|
||||||
|
class DynamicPrintConfig;
|
||||||
class GLShader;
|
class GLShader;
|
||||||
class ExPolygon;
|
class ExPolygon;
|
||||||
|
|
||||||
|
@ -171,6 +172,7 @@ private:
|
||||||
Shader m_shader;
|
Shader m_shader;
|
||||||
|
|
||||||
GLVolumeCollection* m_volumes;
|
GLVolumeCollection* m_volumes;
|
||||||
|
DynamicPrintConfig* m_config;
|
||||||
|
|
||||||
bool m_dirty;
|
bool m_dirty;
|
||||||
bool m_apply_zoom_to_volumes_filter;
|
bool m_apply_zoom_to_volumes_filter;
|
||||||
|
@ -179,6 +181,7 @@ private:
|
||||||
bool m_picking_enabled;
|
bool m_picking_enabled;
|
||||||
|
|
||||||
PerlCallback m_on_viewport_changed_callback;
|
PerlCallback m_on_viewport_changed_callback;
|
||||||
|
PerlCallback m_on_mark_volumes_for_layer_height;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GLCanvas3D(wxGLCanvas* canvas, wxGLContext* context);
|
GLCanvas3D(wxGLCanvas* canvas, wxGLContext* context);
|
||||||
|
@ -197,9 +200,11 @@ public:
|
||||||
|
|
||||||
GLVolumeCollection* get_volumes();
|
GLVolumeCollection* get_volumes();
|
||||||
void set_volumes(GLVolumeCollection* volumes);
|
void set_volumes(GLVolumeCollection* volumes);
|
||||||
|
|
||||||
void reset_volumes();
|
void reset_volumes();
|
||||||
|
|
||||||
|
DynamicPrintConfig* get_config();
|
||||||
|
void set_config(DynamicPrintConfig* config);
|
||||||
|
|
||||||
// Set the bed shape to a single closed 2D polygon(array of two element arrays),
|
// Set the bed shape to a single closed 2D polygon(array of two element arrays),
|
||||||
// triangulate the bed and store the triangles into m_bed.m_triangles,
|
// triangulate the bed and store the triangles into m_bed.m_triangles,
|
||||||
// fills the m_bed.m_grid_lines and sets m_bed.m_origin.
|
// fills the m_bed.m_grid_lines and sets m_bed.m_origin.
|
||||||
|
@ -259,6 +264,7 @@ public:
|
||||||
void render_bed() const;
|
void render_bed() const;
|
||||||
void render_axes() const;
|
void render_axes() const;
|
||||||
void render_volumes(bool fake_colors) const;
|
void render_volumes(bool fake_colors) const;
|
||||||
|
void render_objects(bool useVBOs);
|
||||||
void render_cutting_plane() const;
|
void render_cutting_plane() const;
|
||||||
void render_warning_texture() const;
|
void render_warning_texture() const;
|
||||||
void render_legend_texture() const;
|
void render_legend_texture() const;
|
||||||
|
@ -266,6 +272,7 @@ public:
|
||||||
void render_texture(unsigned int tex_id, float left, float right, float bottom, float top) const;
|
void render_texture(unsigned int tex_id, float left, float right, float bottom, float top) const;
|
||||||
|
|
||||||
void register_on_viewport_changed_callback(void* callback);
|
void register_on_viewport_changed_callback(void* callback);
|
||||||
|
void register_on_mark_volumes_for_layer_height(void* callback);
|
||||||
|
|
||||||
void on_size(wxSizeEvent& evt);
|
void on_size(wxSizeEvent& evt);
|
||||||
void on_idle(wxIdleEvent& evt);
|
void on_idle(wxIdleEvent& evt);
|
||||||
|
|
|
@ -200,6 +200,19 @@ void GLCanvas3DManager::reset_volumes(wxGLCanvas* canvas)
|
||||||
it->second->reset_volumes();
|
it->second->reset_volumes();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DynamicPrintConfig* GLCanvas3DManager::get_config(wxGLCanvas* canvas)
|
||||||
|
{
|
||||||
|
CanvasesMap::const_iterator it = _get_canvas(canvas);
|
||||||
|
return (it != m_canvases.end()) ? it->second->get_config() : nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GLCanvas3DManager::set_config(wxGLCanvas* canvas, DynamicPrintConfig* config)
|
||||||
|
{
|
||||||
|
CanvasesMap::iterator it = _get_canvas(canvas);
|
||||||
|
if (it != m_canvases.end())
|
||||||
|
it->second->set_config(config);
|
||||||
|
}
|
||||||
|
|
||||||
void GLCanvas3DManager::set_bed_shape(wxGLCanvas* canvas, const Pointfs& shape)
|
void GLCanvas3DManager::set_bed_shape(wxGLCanvas* canvas, const Pointfs& shape)
|
||||||
{
|
{
|
||||||
CanvasesMap::iterator it = _get_canvas(canvas);
|
CanvasesMap::iterator it = _get_canvas(canvas);
|
||||||
|
@ -463,6 +476,13 @@ void GLCanvas3DManager::render_volumes(wxGLCanvas* canvas, bool fake_colors) con
|
||||||
it->second->render_volumes(fake_colors);
|
it->second->render_volumes(fake_colors);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GLCanvas3DManager::render_objects(wxGLCanvas* canvas, bool useVBOs)
|
||||||
|
{
|
||||||
|
CanvasesMap::const_iterator it = _get_canvas(canvas);
|
||||||
|
if (it != m_canvases.end())
|
||||||
|
it->second->render_objects(useVBOs);
|
||||||
|
}
|
||||||
|
|
||||||
void GLCanvas3DManager::render_cutting_plane(wxGLCanvas* canvas) const
|
void GLCanvas3DManager::render_cutting_plane(wxGLCanvas* canvas) const
|
||||||
{
|
{
|
||||||
CanvasesMap::const_iterator it = _get_canvas(canvas);
|
CanvasesMap::const_iterator it = _get_canvas(canvas);
|
||||||
|
@ -498,6 +518,13 @@ void GLCanvas3DManager::register_on_viewport_changed_callback(wxGLCanvas* canvas
|
||||||
it->second->register_on_viewport_changed_callback(callback);
|
it->second->register_on_viewport_changed_callback(callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GLCanvas3DManager::register_on_mark_volumes_for_layer_height(wxGLCanvas* canvas, void* callback)
|
||||||
|
{
|
||||||
|
CanvasesMap::iterator it = _get_canvas(canvas);
|
||||||
|
if (it != m_canvases.end())
|
||||||
|
it->second->register_on_mark_volumes_for_layer_height(callback);
|
||||||
|
}
|
||||||
|
|
||||||
GLCanvas3DManager::CanvasesMap::iterator GLCanvas3DManager::_get_canvas(wxGLCanvas* canvas)
|
GLCanvas3DManager::CanvasesMap::iterator GLCanvas3DManager::_get_canvas(wxGLCanvas* canvas)
|
||||||
{
|
{
|
||||||
return (canvas == nullptr) ? m_canvases.end() : m_canvases.find(canvas);
|
return (canvas == nullptr) ? m_canvases.end() : m_canvases.find(canvas);
|
||||||
|
|
|
@ -63,9 +63,11 @@ public:
|
||||||
|
|
||||||
GLVolumeCollection* get_volumes(wxGLCanvas* canvas);
|
GLVolumeCollection* get_volumes(wxGLCanvas* canvas);
|
||||||
void set_volumes(wxGLCanvas* canvas, GLVolumeCollection* volumes);
|
void set_volumes(wxGLCanvas* canvas, GLVolumeCollection* volumes);
|
||||||
|
|
||||||
void reset_volumes(wxGLCanvas* canvas);
|
void reset_volumes(wxGLCanvas* canvas);
|
||||||
|
|
||||||
|
DynamicPrintConfig* get_config(wxGLCanvas* canvas);
|
||||||
|
void set_config(wxGLCanvas* canvas, DynamicPrintConfig* config);
|
||||||
|
|
||||||
void set_bed_shape(wxGLCanvas* canvas, const Pointfs& shape);
|
void set_bed_shape(wxGLCanvas* canvas, const Pointfs& shape);
|
||||||
void set_auto_bed_shape(wxGLCanvas* canvas);
|
void set_auto_bed_shape(wxGLCanvas* canvas);
|
||||||
|
|
||||||
|
@ -120,6 +122,7 @@ public:
|
||||||
void render_bed(wxGLCanvas* canvas) const;
|
void render_bed(wxGLCanvas* canvas) const;
|
||||||
void render_axes(wxGLCanvas* canvas) const;
|
void render_axes(wxGLCanvas* canvas) const;
|
||||||
void render_volumes(wxGLCanvas* canvas, bool fake_colors) const;
|
void render_volumes(wxGLCanvas* canvas, bool fake_colors) const;
|
||||||
|
void render_objects(wxGLCanvas* canvas, bool useVBOs);
|
||||||
void render_cutting_plane(wxGLCanvas* canvas) const;
|
void render_cutting_plane(wxGLCanvas* canvas) const;
|
||||||
void render_warning_texture(wxGLCanvas* canvas) const;
|
void render_warning_texture(wxGLCanvas* canvas) const;
|
||||||
void render_legend_texture(wxGLCanvas* canvas) const;
|
void render_legend_texture(wxGLCanvas* canvas) const;
|
||||||
|
@ -127,6 +130,7 @@ public:
|
||||||
void render_texture(wxGLCanvas* canvas, unsigned int tex_id, float left, float right, float bottom, float top) const;
|
void render_texture(wxGLCanvas* canvas, unsigned int tex_id, float left, float right, float bottom, float top) const;
|
||||||
|
|
||||||
void register_on_viewport_changed_callback(wxGLCanvas* canvas, void* callback);
|
void register_on_viewport_changed_callback(wxGLCanvas* canvas, void* callback);
|
||||||
|
void register_on_mark_volumes_for_layer_height(wxGLCanvas* canvas, void* callback);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CanvasesMap::iterator _get_canvas(wxGLCanvas* canvas);
|
CanvasesMap::iterator _get_canvas(wxGLCanvas* canvas);
|
||||||
|
|
|
@ -250,7 +250,22 @@ reset_volumes(canvas)
|
||||||
SV *canvas;
|
SV *canvas;
|
||||||
CODE:
|
CODE:
|
||||||
_3DScene::reset_volumes((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"));
|
_3DScene::reset_volumes((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"));
|
||||||
|
|
||||||
|
DynamicPrintConfig*
|
||||||
|
get_config(canvas)
|
||||||
|
SV *canvas;
|
||||||
|
CODE:
|
||||||
|
RETVAL = _3DScene::get_config((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"));
|
||||||
|
OUTPUT:
|
||||||
|
RETVAL
|
||||||
|
|
||||||
|
void
|
||||||
|
set_config(canvas, config)
|
||||||
|
SV *canvas;
|
||||||
|
DynamicPrintConfig *config;
|
||||||
|
CODE:
|
||||||
|
_3DScene::set_config((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), config);
|
||||||
|
|
||||||
void
|
void
|
||||||
set_bed_shape(canvas, shape)
|
set_bed_shape(canvas, shape)
|
||||||
SV *canvas;
|
SV *canvas;
|
||||||
|
@ -526,6 +541,13 @@ render_volumes(canvas, fake_colors)
|
||||||
CODE:
|
CODE:
|
||||||
_3DScene::render_volumes((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), fake_colors);
|
_3DScene::render_volumes((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), fake_colors);
|
||||||
|
|
||||||
|
void
|
||||||
|
render_objects(canvas, useVBOs)
|
||||||
|
SV *canvas;
|
||||||
|
bool useVBOs;
|
||||||
|
CODE:
|
||||||
|
_3DScene::render_objects((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), useVBOs);
|
||||||
|
|
||||||
void
|
void
|
||||||
render_cutting_plane(canvas)
|
render_cutting_plane(canvas)
|
||||||
SV *canvas;
|
SV *canvas;
|
||||||
|
@ -562,6 +584,12 @@ register_on_viewport_changed_callback(canvas, callback)
|
||||||
CODE:
|
CODE:
|
||||||
_3DScene::register_on_viewport_changed_callback((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), (void*)callback);
|
_3DScene::register_on_viewport_changed_callback((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), (void*)callback);
|
||||||
|
|
||||||
|
void
|
||||||
|
register_on_mark_volumes_for_layer_height(canvas, callback)
|
||||||
|
SV *canvas;
|
||||||
|
SV *callback;
|
||||||
|
CODE:
|
||||||
|
_3DScene::register_on_mark_volumes_for_layer_height((wxGLCanvas*)wxPli_sv_2_object(aTHX_ canvas, "Wx::GLCanvas"), (void*)callback);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue