mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-13 21:26:01 +08:00
Tech ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL merged into ENABLE_LEGACY_OPENGL_REMOVAL
This commit is contained in:
parent
05efb88e3f
commit
5ffe010a9d
@ -95,10 +95,10 @@ public:
|
|||||||
bool all_paths_inside_vertices_and_normals_interleaved(const std::vector<float>& paths, const Eigen::AlignedBox<float, 3>& bbox, bool ignore_bottom = true) const;
|
bool all_paths_inside_vertices_and_normals_interleaved(const std::vector<float>& paths, const Eigen::AlignedBox<float, 3>& bbox, bool ignore_bottom = true) const;
|
||||||
|
|
||||||
|
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
const std::pair<std::vector<Vec2d>, std::vector<Vec2d>>& top_bottom_convex_hull_decomposition_scene() const { return m_top_bottom_convex_hull_decomposition_scene; }
|
const std::pair<std::vector<Vec2d>, std::vector<Vec2d>>& top_bottom_convex_hull_decomposition_scene() const { return m_top_bottom_convex_hull_decomposition_scene; }
|
||||||
const std::pair<std::vector<Vec2d>, std::vector<Vec2d>>& top_bottom_convex_hull_decomposition_bed() const { return m_top_bottom_convex_hull_decomposition_bed; }
|
const std::pair<std::vector<Vec2d>, std::vector<Vec2d>>& top_bottom_convex_hull_decomposition_bed() const { return m_top_bottom_convex_hull_decomposition_bed; }
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Source definition of the print bed geometry (PrintConfig::bed_shape)
|
// Source definition of the print bed geometry (PrintConfig::bed_shape)
|
||||||
|
@ -68,10 +68,8 @@
|
|||||||
#define ENABLE_WIPETOWER_OBJECTID_1000_REMOVAL (1 && ENABLE_2_5_0_ALPHA1)
|
#define ENABLE_WIPETOWER_OBJECTID_1000_REMOVAL (1 && ENABLE_2_5_0_ALPHA1)
|
||||||
// Enable removal of legacy OpenGL calls
|
// Enable removal of legacy OpenGL calls
|
||||||
#define ENABLE_LEGACY_OPENGL_REMOVAL (1 && ENABLE_2_5_0_ALPHA1)
|
#define ENABLE_LEGACY_OPENGL_REMOVAL (1 && ENABLE_2_5_0_ALPHA1)
|
||||||
// Enable replace GLIndexedVertexArray with GLModel
|
|
||||||
#define ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL (1 && ENABLE_LEGACY_OPENGL_REMOVAL)
|
|
||||||
// Enable using vertex attributes and matrices in shaders
|
// Enable using vertex attributes and matrices in shaders
|
||||||
#define ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES (1 && ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL)
|
#define ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES (1 && ENABLE_LEGACY_OPENGL_REMOVAL)
|
||||||
// Enable show non-manifold edges
|
// Enable show non-manifold edges
|
||||||
#define ENABLE_SHOW_NON_MANIFOLD_EDGES (1 && ENABLE_2_5_0_ALPHA1)
|
#define ENABLE_SHOW_NON_MANIFOLD_EDGES (1 && ENABLE_2_5_0_ALPHA1)
|
||||||
// Enable rework of Reload from disk command
|
// Enable rework of Reload from disk command
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
#include <GL/glew.h>
|
#include <GL/glew.h>
|
||||||
|
|
||||||
#if !ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if !ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
#if ENABLE_SMOOTH_NORMALS
|
#if ENABLE_SMOOTH_NORMALS
|
||||||
#include <igl/per_face_normals.h>
|
#include <igl/per_face_normals.h>
|
||||||
#include <igl/per_corner_normals.h>
|
#include <igl/per_corner_normals.h>
|
||||||
#include <igl/per_vertex_normals.h>
|
#include <igl/per_vertex_normals.h>
|
||||||
#endif // ENABLE_SMOOTH_NORMALS
|
#endif // ENABLE_SMOOTH_NORMALS
|
||||||
#endif // !ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // !ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
|
|
||||||
#include "3DScene.hpp"
|
#include "3DScene.hpp"
|
||||||
#include "GLShader.hpp"
|
#include "GLShader.hpp"
|
||||||
@ -74,7 +74,7 @@ void glAssertRecentCallImpl(const char* file_name, unsigned int line, const char
|
|||||||
|
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
|
|
||||||
#if !ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if !ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
#if ENABLE_SMOOTH_NORMALS
|
#if ENABLE_SMOOTH_NORMALS
|
||||||
static void smooth_normals_corner(TriangleMesh& mesh, std::vector<stl_normal>& normals)
|
static void smooth_normals_corner(TriangleMesh& mesh, std::vector<stl_normal>& normals)
|
||||||
{
|
{
|
||||||
@ -293,7 +293,7 @@ void GLIndexedVertexArray::render(
|
|||||||
|
|
||||||
glsafe(::glBindBuffer(GL_ARRAY_BUFFER, 0));
|
glsafe(::glBindBuffer(GL_ARRAY_BUFFER, 0));
|
||||||
}
|
}
|
||||||
#endif // !ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // !ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
|
|
||||||
const float GLVolume::SinkingContours::HalfWidth = 0.25f;
|
const float GLVolume::SinkingContours::HalfWidth = 0.25f;
|
||||||
|
|
||||||
@ -514,9 +514,9 @@ GLVolume::GLVolume(float r, float g, float b, float a)
|
|||||||
, force_neutral_color(false)
|
, force_neutral_color(false)
|
||||||
, force_sinking_contours(false)
|
, force_sinking_contours(false)
|
||||||
, tverts_range(0, size_t(-1))
|
, tverts_range(0, size_t(-1))
|
||||||
#if !ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if !ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
, qverts_range(0, size_t(-1))
|
, qverts_range(0, size_t(-1))
|
||||||
#endif // !ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // !ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
{
|
{
|
||||||
color = { r, g, b, a };
|
color = { r, g, b, a };
|
||||||
set_render_color(color);
|
set_render_color(color);
|
||||||
@ -632,7 +632,7 @@ const BoundingBoxf3& GLVolume::transformed_non_sinking_bounding_box() const
|
|||||||
return *m_transformed_non_sinking_bounding_box;
|
return *m_transformed_non_sinking_bounding_box;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
void GLVolume::set_range(double min_z, double max_z)
|
void GLVolume::set_range(double min_z, double max_z)
|
||||||
{
|
{
|
||||||
this->tverts_range.first = 0;
|
this->tverts_range.first = 0;
|
||||||
@ -698,7 +698,7 @@ void GLVolume::set_range(double min_z, double max_z)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
|
|
||||||
void GLVolume::render()
|
void GLVolume::render()
|
||||||
{
|
{
|
||||||
@ -719,14 +719,14 @@ void GLVolume::render()
|
|||||||
glsafe(::glMultMatrixd(world_matrix().data()));
|
glsafe(::glMultMatrixd(world_matrix().data()));
|
||||||
#endif // !ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
|
#endif // !ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
|
||||||
|
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
if (tverts_range == std::make_pair<size_t, size_t>(0, -1))
|
if (tverts_range == std::make_pair<size_t, size_t>(0, -1))
|
||||||
model.render();
|
model.render();
|
||||||
else
|
else
|
||||||
model.render(this->tverts_range);
|
model.render(this->tverts_range);
|
||||||
#else
|
#else
|
||||||
this->indexed_vertex_array.render(this->tverts_range, this->qverts_range);
|
this->indexed_vertex_array.render(this->tverts_range, this->qverts_range);
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
|
|
||||||
#if !ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
|
#if !ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
|
||||||
glsafe(::glPopMatrix());
|
glsafe(::glPopMatrix());
|
||||||
@ -764,7 +764,7 @@ void GLVolume::render_non_manifold_edges()
|
|||||||
}
|
}
|
||||||
#endif // ENABLE_SHOW_NON_MANIFOLD_EDGES
|
#endif // ENABLE_SHOW_NON_MANIFOLD_EDGES
|
||||||
|
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
std::vector<int> GLVolumeCollection::load_object(
|
std::vector<int> GLVolumeCollection::load_object(
|
||||||
const ModelObject* model_object,
|
const ModelObject* model_object,
|
||||||
int obj_idx,
|
int obj_idx,
|
||||||
@ -775,20 +775,20 @@ std::vector<int> GLVolumeCollection::load_object(
|
|||||||
int obj_idx,
|
int obj_idx,
|
||||||
const std::vector<int> &instance_idxs,
|
const std::vector<int> &instance_idxs,
|
||||||
bool opengl_initialized)
|
bool opengl_initialized)
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
{
|
{
|
||||||
std::vector<int> volumes_idx;
|
std::vector<int> volumes_idx;
|
||||||
for (int volume_idx = 0; volume_idx < int(model_object->volumes.size()); ++volume_idx)
|
for (int volume_idx = 0; volume_idx < int(model_object->volumes.size()); ++volume_idx)
|
||||||
for (int instance_idx : instance_idxs)
|
for (int instance_idx : instance_idxs)
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
volumes_idx.emplace_back(this->GLVolumeCollection::load_object_volume(model_object, obj_idx, volume_idx, instance_idx));
|
volumes_idx.emplace_back(this->GLVolumeCollection::load_object_volume(model_object, obj_idx, volume_idx, instance_idx));
|
||||||
#else
|
#else
|
||||||
volumes_idx.emplace_back(this->GLVolumeCollection::load_object_volume(model_object, obj_idx, volume_idx, instance_idx, opengl_initialized));
|
volumes_idx.emplace_back(this->GLVolumeCollection::load_object_volume(model_object, obj_idx, volume_idx, instance_idx, opengl_initialized));
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
return volumes_idx;
|
return volumes_idx;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
int GLVolumeCollection::load_object_volume(
|
int GLVolumeCollection::load_object_volume(
|
||||||
const ModelObject* model_object,
|
const ModelObject* model_object,
|
||||||
int obj_idx,
|
int obj_idx,
|
||||||
@ -801,7 +801,7 @@ int GLVolumeCollection::load_object_volume(
|
|||||||
int volume_idx,
|
int volume_idx,
|
||||||
int instance_idx,
|
int instance_idx,
|
||||||
bool opengl_initialized)
|
bool opengl_initialized)
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
{
|
{
|
||||||
const ModelVolume *model_volume = model_object->volumes[volume_idx];
|
const ModelVolume *model_volume = model_object->volumes[volume_idx];
|
||||||
const int extruder_id = model_volume->extruder_id();
|
const int extruder_id = model_volume->extruder_id();
|
||||||
@ -810,7 +810,7 @@ int GLVolumeCollection::load_object_volume(
|
|||||||
this->volumes.emplace_back(new GLVolume());
|
this->volumes.emplace_back(new GLVolume());
|
||||||
GLVolume& v = *this->volumes.back();
|
GLVolume& v = *this->volumes.back();
|
||||||
v.set_color(color_from_model_volume(*model_volume));
|
v.set_color(color_from_model_volume(*model_volume));
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
#if ENABLE_SMOOTH_NORMALS
|
#if ENABLE_SMOOTH_NORMALS
|
||||||
v.model.init_from(mesh, true);
|
v.model.init_from(mesh, true);
|
||||||
#else
|
#else
|
||||||
@ -823,7 +823,7 @@ int GLVolumeCollection::load_object_volume(
|
|||||||
v.indexed_vertex_array.load_mesh(mesh);
|
v.indexed_vertex_array.load_mesh(mesh);
|
||||||
#endif // ENABLE_SMOOTH_NORMALS
|
#endif // ENABLE_SMOOTH_NORMALS
|
||||||
v.indexed_vertex_array.finalize_geometry(opengl_initialized);
|
v.indexed_vertex_array.finalize_geometry(opengl_initialized);
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
v.composite_id = GLVolume::CompositeID(obj_idx, volume_idx, instance_idx);
|
v.composite_id = GLVolume::CompositeID(obj_idx, volume_idx, instance_idx);
|
||||||
if (model_volume->is_model_part()) {
|
if (model_volume->is_model_part()) {
|
||||||
// GLVolume will reference a convex hull from model_volume!
|
// GLVolume will reference a convex hull from model_volume!
|
||||||
@ -842,7 +842,7 @@ int GLVolumeCollection::load_object_volume(
|
|||||||
// Load SLA auxiliary GLVolumes (for support trees or pad).
|
// Load SLA auxiliary GLVolumes (for support trees or pad).
|
||||||
// This function produces volumes for multiple instances in a single shot,
|
// This function produces volumes for multiple instances in a single shot,
|
||||||
// as some object specific mesh conversions may be expensive.
|
// as some object specific mesh conversions may be expensive.
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
void GLVolumeCollection::load_object_auxiliary(
|
void GLVolumeCollection::load_object_auxiliary(
|
||||||
const SLAPrintObject* print_object,
|
const SLAPrintObject* print_object,
|
||||||
int obj_idx,
|
int obj_idx,
|
||||||
@ -861,7 +861,7 @@ void GLVolumeCollection::load_object_auxiliary(
|
|||||||
// Timestamp of the last change of the milestone
|
// Timestamp of the last change of the milestone
|
||||||
size_t timestamp,
|
size_t timestamp,
|
||||||
bool opengl_initialized)
|
bool opengl_initialized)
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
{
|
{
|
||||||
assert(print_object->is_step_done(milestone));
|
assert(print_object->is_step_done(milestone));
|
||||||
Transform3d mesh_trafo_inv = print_object->trafo().inverse();
|
Transform3d mesh_trafo_inv = print_object->trafo().inverse();
|
||||||
@ -874,7 +874,7 @@ void GLVolumeCollection::load_object_auxiliary(
|
|||||||
const ModelInstance& model_instance = *print_object->model_object()->instances[instance_idx.first];
|
const ModelInstance& model_instance = *print_object->model_object()->instances[instance_idx.first];
|
||||||
this->volumes.emplace_back(new GLVolume((milestone == slaposPad) ? GLVolume::SLA_PAD_COLOR : GLVolume::SLA_SUPPORT_COLOR));
|
this->volumes.emplace_back(new GLVolume((milestone == slaposPad) ? GLVolume::SLA_PAD_COLOR : GLVolume::SLA_SUPPORT_COLOR));
|
||||||
GLVolume& v = *this->volumes.back();
|
GLVolume& v = *this->volumes.back();
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
#if ENABLE_SMOOTH_NORMALS
|
#if ENABLE_SMOOTH_NORMALS
|
||||||
v.model.init_from(mesh, true);
|
v.model.init_from(mesh, true);
|
||||||
#else
|
#else
|
||||||
@ -888,7 +888,7 @@ void GLVolumeCollection::load_object_auxiliary(
|
|||||||
v.indexed_vertex_array.load_mesh(mesh);
|
v.indexed_vertex_array.load_mesh(mesh);
|
||||||
#endif // ENABLE_SMOOTH_NORMALS
|
#endif // ENABLE_SMOOTH_NORMALS
|
||||||
v.indexed_vertex_array.finalize_geometry(opengl_initialized);
|
v.indexed_vertex_array.finalize_geometry(opengl_initialized);
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
v.composite_id = GLVolume::CompositeID(obj_idx, -int(milestone), (int)instance_idx.first);
|
v.composite_id = GLVolume::CompositeID(obj_idx, -int(milestone), (int)instance_idx.first);
|
||||||
v.geometry_id = std::pair<size_t, size_t>(timestamp, model_instance.id().id);
|
v.geometry_id = std::pair<size_t, size_t>(timestamp, model_instance.id().id);
|
||||||
// Create a copy of the convex hull mesh for each instance. Use a move operator on the last instance.
|
// Create a copy of the convex hull mesh for each instance. Use a move operator on the last instance.
|
||||||
@ -904,7 +904,7 @@ void GLVolumeCollection::load_object_auxiliary(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
#if ENABLE_WIPETOWER_OBJECTID_1000_REMOVAL
|
#if ENABLE_WIPETOWER_OBJECTID_1000_REMOVAL
|
||||||
int GLVolumeCollection::load_wipe_tower_preview(
|
int GLVolumeCollection::load_wipe_tower_preview(
|
||||||
float pos_x, float pos_y, float width, float depth, float height,
|
float pos_x, float pos_y, float width, float depth, float height,
|
||||||
@ -924,7 +924,7 @@ int GLVolumeCollection::load_wipe_tower_preview(
|
|||||||
int obj_idx, float pos_x, float pos_y, float width, float depth, float height,
|
int obj_idx, float pos_x, float pos_y, float width, float depth, float height,
|
||||||
float rotation_angle, bool size_unknown, float brim_width, bool opengl_initialized)
|
float rotation_angle, bool size_unknown, float brim_width, bool opengl_initialized)
|
||||||
#endif // ENABLE_WIPETOWER_OBJECTID_1000_REMOVAL
|
#endif // ENABLE_WIPETOWER_OBJECTID_1000_REMOVAL
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
{
|
{
|
||||||
if (depth < 0.01f)
|
if (depth < 0.01f)
|
||||||
return int(this->volumes.size() - 1);
|
return int(this->volumes.size() - 1);
|
||||||
@ -981,16 +981,16 @@ int GLVolumeCollection::load_wipe_tower_preview(
|
|||||||
|
|
||||||
volumes.emplace_back(new GLVolume(color));
|
volumes.emplace_back(new GLVolume(color));
|
||||||
GLVolume& v = *volumes.back();
|
GLVolume& v = *volumes.back();
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
v.model.init_from(mesh);
|
v.model.init_from(mesh);
|
||||||
v.model.set_color(color);
|
v.model.set_color(color);
|
||||||
#else
|
#else
|
||||||
v.indexed_vertex_array.load_mesh(mesh);
|
v.indexed_vertex_array.load_mesh(mesh);
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
v.set_convex_hull(mesh.convex_hull_3d());
|
v.set_convex_hull(mesh.convex_hull_3d());
|
||||||
#if !ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if !ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
v.indexed_vertex_array.finalize_geometry(opengl_initialized);
|
v.indexed_vertex_array.finalize_geometry(opengl_initialized);
|
||||||
#endif // !ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // !ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
v.set_volume_offset(Vec3d(pos_x, pos_y, 0.0));
|
v.set_volume_offset(Vec3d(pos_x, pos_y, 0.0));
|
||||||
v.set_volume_rotation(Vec3d(0., 0., (M_PI / 180.) * rotation_angle));
|
v.set_volume_rotation(Vec3d(0., 0., (M_PI / 180.) * rotation_angle));
|
||||||
#if ENABLE_WIPETOWER_OBJECTID_1000_REMOVAL
|
#if ENABLE_WIPETOWER_OBJECTID_1000_REMOVAL
|
||||||
@ -1005,7 +1005,7 @@ int GLVolumeCollection::load_wipe_tower_preview(
|
|||||||
return int(volumes.size() - 1);
|
return int(volumes.size() - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
GLVolume* GLVolumeCollection::new_toolpath_volume(const ColorRGBA& rgba)
|
GLVolume* GLVolumeCollection::new_toolpath_volume(const ColorRGBA& rgba)
|
||||||
{
|
{
|
||||||
GLVolume* out = new_nontoolpath_volume(rgba);
|
GLVolume* out = new_nontoolpath_volume(rgba);
|
||||||
@ -1037,7 +1037,7 @@ GLVolume* GLVolumeCollection::new_nontoolpath_volume(const ColorRGBA& rgba, size
|
|||||||
this->volumes.emplace_back(out);
|
this->volumes.emplace_back(out);
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
|
|
||||||
GLVolumeWithIdAndZList volumes_to_render(const GLVolumePtrs& volumes, GLVolumeCollection::ERenderType type, const Transform3d& view_matrix, std::function<bool(const GLVolume&)> filter_func)
|
GLVolumeWithIdAndZList volumes_to_render(const GLVolumePtrs& volumes, GLVolumeCollection::ERenderType type, const Transform3d& view_matrix, std::function<bool(const GLVolume&)> filter_func)
|
||||||
{
|
{
|
||||||
@ -1139,10 +1139,12 @@ void GLVolumeCollection::render(GLVolumeCollection::ERenderType type, bool disab
|
|||||||
glsafe(::glEnableClientState(GL_NORMAL_ARRAY));
|
glsafe(::glEnableClientState(GL_NORMAL_ARRAY));
|
||||||
#endif // !ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
|
#endif // !ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
|
||||||
|
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
if (!volume.first->model.is_initialized())
|
//#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
#endif // !ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
// if (!volume.first->model.is_initialized())
|
||||||
shader->set_uniform("uniform_color", volume.first->render_color);
|
//#endif // !ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
|
// shader->set_uniform("uniform_color", volume.first->render_color);
|
||||||
|
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
shader->set_uniform("z_range", m_z_range, 2);
|
shader->set_uniform("z_range", m_z_range, 2);
|
||||||
shader->set_uniform("clipping_plane", m_clipping_plane, 4);
|
shader->set_uniform("clipping_plane", m_clipping_plane, 4);
|
||||||
shader->set_uniform("print_volume.type", static_cast<int>(m_print_volume.type));
|
shader->set_uniform("print_volume.type", static_cast<int>(m_print_volume.type));
|
||||||
@ -1162,9 +1164,9 @@ void GLVolumeCollection::render(GLVolumeCollection::ERenderType type, bool disab
|
|||||||
#endif // ENABLE_ENVIRONMENT_MAP
|
#endif // ENABLE_ENVIRONMENT_MAP
|
||||||
glcheck();
|
glcheck();
|
||||||
|
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
volume.first->model.set_color(volume.first->render_color);
|
volume.first->model.set_color(volume.first->render_color);
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
#if ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
|
#if ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
|
||||||
const Transform3d matrix = view_matrix * volume.first->world_matrix();
|
const Transform3d matrix = view_matrix * volume.first->world_matrix();
|
||||||
shader->set_uniform("view_model_matrix", matrix);
|
shader->set_uniform("view_model_matrix", matrix);
|
||||||
@ -1408,7 +1410,7 @@ std::string GLVolumeCollection::log_memory_info() const
|
|||||||
return " (GLVolumeCollection RAM: " + format_memsize_MB(this->cpu_memory_used()) + " GPU: " + format_memsize_MB(this->gpu_memory_used()) + " Both: " + format_memsize_MB(this->gpu_memory_used()) + ")";
|
return " (GLVolumeCollection RAM: " + format_memsize_MB(this->cpu_memory_used()) + " GPU: " + format_memsize_MB(this->gpu_memory_used()) + " Both: " + format_memsize_MB(this->gpu_memory_used()) + ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
static void thick_lines_to_geometry(
|
static void thick_lines_to_geometry(
|
||||||
const Lines& lines,
|
const Lines& lines,
|
||||||
const std::vector<double>& widths,
|
const std::vector<double>& widths,
|
||||||
@ -2377,9 +2379,9 @@ static void point_to_indexed_vertex_array(const Vec3crd& point,
|
|||||||
volume.push_triangle(idxs[3], idxs[1], idxs[4]);
|
volume.push_triangle(idxs[3], idxs[1], idxs[4]);
|
||||||
volume.push_triangle(idxs[0], idxs[3], idxs[4]);
|
volume.push_triangle(idxs[0], idxs[3], idxs[4]);
|
||||||
}
|
}
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
|
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
void _3DScene::thick_lines_to_verts(
|
void _3DScene::thick_lines_to_verts(
|
||||||
const Lines& lines,
|
const Lines& lines,
|
||||||
const std::vector<double>& widths,
|
const std::vector<double>& widths,
|
||||||
@ -2442,10 +2444,10 @@ void _3DScene::extrusionentity_to_verts(const ExtrusionPath &extrusion_path, flo
|
|||||||
{
|
{
|
||||||
extrusionentity_to_verts(extrusion_path.polyline, extrusion_path.width, extrusion_path.height, print_z, volume);
|
extrusionentity_to_verts(extrusion_path.polyline, extrusion_path.width, extrusion_path.height, print_z, volume);
|
||||||
}
|
}
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
|
|
||||||
// Fill in the qverts and tverts with quads and triangles for the extrusion_path.
|
// Fill in the qverts and tverts with quads and triangles for the extrusion_path.
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
void _3DScene::extrusionentity_to_verts(const ExtrusionPath& extrusion_path, float print_z, const Point& copy, GUI::GLModel::Geometry& geometry)
|
void _3DScene::extrusionentity_to_verts(const ExtrusionPath& extrusion_path, float print_z, const Point& copy, GUI::GLModel::Geometry& geometry)
|
||||||
{
|
{
|
||||||
Polyline polyline = extrusion_path.polyline;
|
Polyline polyline = extrusion_path.polyline;
|
||||||
@ -2467,10 +2469,10 @@ void _3DScene::extrusionentity_to_verts(const ExtrusionPath &extrusion_path, flo
|
|||||||
std::vector<double> heights(lines.size(), extrusion_path.height);
|
std::vector<double> heights(lines.size(), extrusion_path.height);
|
||||||
thick_lines_to_verts(lines, widths, heights, false, print_z, volume);
|
thick_lines_to_verts(lines, widths, heights, false, print_z, volume);
|
||||||
}
|
}
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
|
|
||||||
// Fill in the qverts and tverts with quads and triangles for the extrusion_loop.
|
// Fill in the qverts and tverts with quads and triangles for the extrusion_loop.
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
void _3DScene::extrusionentity_to_verts(const ExtrusionLoop& extrusion_loop, float print_z, const Point& copy, GUI::GLModel::Geometry& geometry)
|
void _3DScene::extrusionentity_to_verts(const ExtrusionLoop& extrusion_loop, float print_z, const Point& copy, GUI::GLModel::Geometry& geometry)
|
||||||
{
|
{
|
||||||
Lines lines;
|
Lines lines;
|
||||||
@ -2504,10 +2506,10 @@ void _3DScene::extrusionentity_to_verts(const ExtrusionLoop &extrusion_loop, flo
|
|||||||
}
|
}
|
||||||
thick_lines_to_verts(lines, widths, heights, true, print_z, volume);
|
thick_lines_to_verts(lines, widths, heights, true, print_z, volume);
|
||||||
}
|
}
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
|
|
||||||
// Fill in the qverts and tverts with quads and triangles for the extrusion_multi_path.
|
// Fill in the qverts and tverts with quads and triangles for the extrusion_multi_path.
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
void _3DScene::extrusionentity_to_verts(const ExtrusionMultiPath& extrusion_multi_path, float print_z, const Point& copy, GUI::GLModel::Geometry& geometry)
|
void _3DScene::extrusionentity_to_verts(const ExtrusionMultiPath& extrusion_multi_path, float print_z, const Point& copy, GUI::GLModel::Geometry& geometry)
|
||||||
{
|
{
|
||||||
Lines lines;
|
Lines lines;
|
||||||
@ -2541,9 +2543,9 @@ void _3DScene::extrusionentity_to_verts(const ExtrusionMultiPath &extrusion_mult
|
|||||||
}
|
}
|
||||||
thick_lines_to_verts(lines, widths, heights, false, print_z, volume);
|
thick_lines_to_verts(lines, widths, heights, false, print_z, volume);
|
||||||
}
|
}
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
|
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
void _3DScene::extrusionentity_to_verts(const ExtrusionEntityCollection& extrusion_entity_collection, float print_z, const Point& copy, GUI::GLModel::Geometry& geometry)
|
void _3DScene::extrusionentity_to_verts(const ExtrusionEntityCollection& extrusion_entity_collection, float print_z, const Point& copy, GUI::GLModel::Geometry& geometry)
|
||||||
{
|
{
|
||||||
for (const ExtrusionEntity* extrusion_entity : extrusion_entity_collection.entities)
|
for (const ExtrusionEntity* extrusion_entity : extrusion_entity_collection.entities)
|
||||||
@ -2555,9 +2557,9 @@ void _3DScene::extrusionentity_to_verts(const ExtrusionEntityCollection &extrusi
|
|||||||
for (const ExtrusionEntity *extrusion_entity : extrusion_entity_collection.entities)
|
for (const ExtrusionEntity *extrusion_entity : extrusion_entity_collection.entities)
|
||||||
extrusionentity_to_verts(extrusion_entity, print_z, copy, volume);
|
extrusionentity_to_verts(extrusion_entity, print_z, copy, volume);
|
||||||
}
|
}
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
|
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
void _3DScene::extrusionentity_to_verts(const ExtrusionEntity* extrusion_entity, float print_z, const Point& copy, GUI::GLModel::Geometry& geometry)
|
void _3DScene::extrusionentity_to_verts(const ExtrusionEntity* extrusion_entity, float print_z, const Point& copy, GUI::GLModel::Geometry& geometry)
|
||||||
{
|
{
|
||||||
if (extrusion_entity != nullptr) {
|
if (extrusion_entity != nullptr) {
|
||||||
@ -2622,6 +2624,6 @@ void _3DScene::point3_to_verts(const Vec3crd& point, double width, double height
|
|||||||
{
|
{
|
||||||
thick_point_to_verts(point, width, height, volume);
|
thick_point_to_verts(point, width, height, volume);
|
||||||
}
|
}
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
|
|
||||||
} // namespace Slic3r
|
} // namespace Slic3r
|
||||||
|
@ -46,7 +46,7 @@ enum ModelInstanceEPrintVolumeState : unsigned char;
|
|||||||
// Return appropriate color based on the ModelVolume.
|
// Return appropriate color based on the ModelVolume.
|
||||||
extern ColorRGBA color_from_model_volume(const ModelVolume& model_volume);
|
extern ColorRGBA color_from_model_volume(const ModelVolume& model_volume);
|
||||||
|
|
||||||
#if !ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if !ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
// A container for interleaved arrays of 3D vertices and normals,
|
// A container for interleaved arrays of 3D vertices and normals,
|
||||||
// possibly indexed by triangles and / or quads.
|
// possibly indexed by triangles and / or quads.
|
||||||
class GLIndexedVertexArray {
|
class GLIndexedVertexArray {
|
||||||
@ -247,7 +247,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
BoundingBox m_bounding_box;
|
BoundingBox m_bounding_box;
|
||||||
};
|
};
|
||||||
#endif // !ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // !ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
|
|
||||||
class GLVolume {
|
class GLVolume {
|
||||||
public:
|
public:
|
||||||
@ -390,17 +390,17 @@ public:
|
|||||||
// Is mouse or rectangle selection over this object to select/deselect it ?
|
// Is mouse or rectangle selection over this object to select/deselect it ?
|
||||||
EHoverState hover;
|
EHoverState hover;
|
||||||
|
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
GUI::GLModel model;
|
GUI::GLModel model;
|
||||||
#else
|
#else
|
||||||
// Interleaved triangles & normals with indexed triangles & quads.
|
// Interleaved triangles & normals with indexed triangles & quads.
|
||||||
GLIndexedVertexArray indexed_vertex_array;
|
GLIndexedVertexArray indexed_vertex_array;
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
// Ranges of triangle and quad indices to be rendered.
|
// Ranges of triangle and quad indices to be rendered.
|
||||||
std::pair<size_t, size_t> tverts_range;
|
std::pair<size_t, size_t> tverts_range;
|
||||||
#if !ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if !ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
std::pair<size_t, size_t> qverts_range;
|
std::pair<size_t, size_t> qverts_range;
|
||||||
#endif // !ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // !ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
|
|
||||||
// If the qverts or tverts contain thick extrusions, then offsets keeps pointers of the starts
|
// If the qverts or tverts contain thick extrusions, then offsets keeps pointers of the starts
|
||||||
// of the extrusions per layer.
|
// of the extrusions per layer.
|
||||||
@ -410,7 +410,7 @@ public:
|
|||||||
|
|
||||||
// Bounding box of this volume, in unscaled coordinates.
|
// Bounding box of this volume, in unscaled coordinates.
|
||||||
BoundingBoxf3 bounding_box() const {
|
BoundingBoxf3 bounding_box() const {
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
return this->model.get_bounding_box();
|
return this->model.get_bounding_box();
|
||||||
#else
|
#else
|
||||||
BoundingBoxf3 out;
|
BoundingBoxf3 out;
|
||||||
@ -420,7 +420,7 @@ public:
|
|||||||
out.defined = true;
|
out.defined = true;
|
||||||
}
|
}
|
||||||
return out;
|
return out;
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_color(const ColorRGBA& rgba) { color = rgba; }
|
void set_color(const ColorRGBA& rgba) { color = rgba; }
|
||||||
@ -510,20 +510,20 @@ public:
|
|||||||
// convex hull
|
// convex hull
|
||||||
const TriangleMesh* convex_hull() const { return m_convex_hull.get(); }
|
const TriangleMesh* convex_hull() const { return m_convex_hull.get(); }
|
||||||
|
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
bool empty() const { return this->model.is_empty(); }
|
bool empty() const { return this->model.is_empty(); }
|
||||||
#else
|
#else
|
||||||
bool empty() const { return this->indexed_vertex_array.empty(); }
|
bool empty() const { return this->indexed_vertex_array.empty(); }
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
|
|
||||||
void set_range(double low, double high);
|
void set_range(double low, double high);
|
||||||
|
|
||||||
void render();
|
void render();
|
||||||
|
|
||||||
#if !ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if !ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
void finalize_geometry(bool opengl_initialized) { this->indexed_vertex_array.finalize_geometry(opengl_initialized); }
|
void finalize_geometry(bool opengl_initialized) { this->indexed_vertex_array.finalize_geometry(opengl_initialized); }
|
||||||
void release_geometry() { this->indexed_vertex_array.release_geometry(); }
|
void release_geometry() { this->indexed_vertex_array.release_geometry(); }
|
||||||
#endif // !ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // !ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
|
|
||||||
void set_bounding_boxes_as_dirty() {
|
void set_bounding_boxes_as_dirty() {
|
||||||
m_transformed_bounding_box.reset();
|
m_transformed_bounding_box.reset();
|
||||||
@ -543,7 +543,7 @@ public:
|
|||||||
|
|
||||||
// Return an estimate of the memory consumed by this class.
|
// Return an estimate of the memory consumed by this class.
|
||||||
size_t cpu_memory_used() const {
|
size_t cpu_memory_used() const {
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
return sizeof(*this) + this->model.cpu_memory_used() + this->print_zs.capacity() * sizeof(coordf_t) +
|
return sizeof(*this) + this->model.cpu_memory_used() + this->print_zs.capacity() * sizeof(coordf_t) +
|
||||||
this->offsets.capacity() * sizeof(size_t);
|
this->offsets.capacity() * sizeof(size_t);
|
||||||
}
|
}
|
||||||
@ -555,7 +555,7 @@ public:
|
|||||||
}
|
}
|
||||||
// Return an estimate of the memory held by GPU vertex buffers.
|
// Return an estimate of the memory held by GPU vertex buffers.
|
||||||
size_t gpu_memory_used() const { return this->indexed_vertex_array.gpu_memory_used(); }
|
size_t gpu_memory_used() const { return this->indexed_vertex_array.gpu_memory_used(); }
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
size_t total_memory_used() const { return this->cpu_memory_used() + this->gpu_memory_used(); }
|
size_t total_memory_used() const { return this->cpu_memory_used() + this->gpu_memory_used(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -615,7 +615,7 @@ public:
|
|||||||
GLVolumeCollection() { set_default_slope_normal_z(); }
|
GLVolumeCollection() { set_default_slope_normal_z(); }
|
||||||
~GLVolumeCollection() { clear(); }
|
~GLVolumeCollection() { clear(); }
|
||||||
|
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
std::vector<int> load_object(
|
std::vector<int> load_object(
|
||||||
const ModelObject* model_object,
|
const ModelObject* model_object,
|
||||||
int obj_idx,
|
int obj_idx,
|
||||||
@ -676,15 +676,15 @@ public:
|
|||||||
int load_wipe_tower_preview(
|
int load_wipe_tower_preview(
|
||||||
int obj_idx, float pos_x, float pos_y, float width, float depth, float height, float rotation_angle, bool size_unknown, float brim_width, bool opengl_initialized);
|
int obj_idx, float pos_x, float pos_y, float width, float depth, float height, float rotation_angle, bool size_unknown, float brim_width, bool opengl_initialized);
|
||||||
#endif // ENABLE_WIPETOWER_OBJECTID_1000_REMOVAL
|
#endif // ENABLE_WIPETOWER_OBJECTID_1000_REMOVAL
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
|
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
GLVolume* new_toolpath_volume(const ColorRGBA& rgba);
|
GLVolume* new_toolpath_volume(const ColorRGBA& rgba);
|
||||||
GLVolume* new_nontoolpath_volume(const ColorRGBA& rgba);
|
GLVolume* new_nontoolpath_volume(const ColorRGBA& rgba);
|
||||||
#else
|
#else
|
||||||
GLVolume* new_toolpath_volume(const ColorRGBA& rgba, size_t reserve_vbo_floats = 0);
|
GLVolume* new_toolpath_volume(const ColorRGBA& rgba, size_t reserve_vbo_floats = 0);
|
||||||
GLVolume* new_nontoolpath_volume(const ColorRGBA& rgba, size_t reserve_vbo_floats = 0);
|
GLVolume* new_nontoolpath_volume(const ColorRGBA& rgba, size_t reserve_vbo_floats = 0);
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
|
|
||||||
// Render the volumes by OpenGL.
|
// Render the volumes by OpenGL.
|
||||||
#if ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
|
#if ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
|
||||||
@ -694,7 +694,7 @@ public:
|
|||||||
void render(ERenderType type, bool disable_cullface, const Transform3d& view_matrix, std::function<bool(const GLVolume&)> filter_func = std::function<bool(const GLVolume&)>()) const;
|
void render(ERenderType type, bool disable_cullface, const Transform3d& view_matrix, std::function<bool(const GLVolume&)> filter_func = std::function<bool(const GLVolume&)>()) const;
|
||||||
#endif // ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
|
#endif // ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
|
||||||
|
|
||||||
#if !ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if !ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
// Finalize the initialization of the geometry & indices,
|
// Finalize the initialization of the geometry & indices,
|
||||||
// upload the geometry and indices to OpenGL VBO objects
|
// upload the geometry and indices to OpenGL VBO objects
|
||||||
// and shrink the allocated data, possibly relasing it if it has been loaded into the VBOs.
|
// and shrink the allocated data, possibly relasing it if it has been loaded into the VBOs.
|
||||||
@ -702,7 +702,7 @@ public:
|
|||||||
// Release the geometry data assigned to the volumes.
|
// Release the geometry data assigned to the volumes.
|
||||||
// If OpenGL VBOs were allocated, an OpenGL context has to be active to release them.
|
// If OpenGL VBOs were allocated, an OpenGL context has to be active to release them.
|
||||||
void release_geometry() { for (auto *v : volumes) v->release_geometry(); }
|
void release_geometry() { for (auto *v : volumes) v->release_geometry(); }
|
||||||
#endif // !ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // !ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
// Clear the geometry
|
// Clear the geometry
|
||||||
void clear() { for (auto *v : volumes) delete v; volumes.clear(); }
|
void clear() { for (auto *v : volumes) delete v; volumes.clear(); }
|
||||||
|
|
||||||
@ -752,7 +752,7 @@ GLVolumeWithIdAndZList volumes_to_render(const GLVolumePtrs& volumes, GLVolumeCo
|
|||||||
|
|
||||||
struct _3DScene
|
struct _3DScene
|
||||||
{
|
{
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
static void thick_lines_to_verts(const Lines& lines, const std::vector<double>& widths, const std::vector<double>& heights, bool closed, double top_z, GUI::GLModel::Geometry& geometry);
|
static void thick_lines_to_verts(const Lines& lines, const std::vector<double>& widths, const std::vector<double>& heights, bool closed, double top_z, GUI::GLModel::Geometry& geometry);
|
||||||
static void thick_lines_to_verts(const Lines3& lines, const std::vector<double>& widths, const std::vector<double>& heights, bool closed, GUI::GLModel::Geometry& geometry);
|
static void thick_lines_to_verts(const Lines3& lines, const std::vector<double>& widths, const std::vector<double>& heights, bool closed, GUI::GLModel::Geometry& geometry);
|
||||||
static void extrusionentity_to_verts(const ExtrusionPath& extrusion_path, float print_z, const Point& copy, GUI::GLModel::Geometry& geometry);
|
static void extrusionentity_to_verts(const ExtrusionPath& extrusion_path, float print_z, const Point& copy, GUI::GLModel::Geometry& geometry);
|
||||||
@ -772,7 +772,7 @@ struct _3DScene
|
|||||||
static void extrusionentity_to_verts(const ExtrusionEntity* extrusion_entity, float print_z, const Point& copy, GLVolume& volume);
|
static void extrusionentity_to_verts(const ExtrusionEntity* extrusion_entity, float print_z, const Point& copy, GLVolume& volume);
|
||||||
static void polyline3_to_verts(const Polyline3& polyline, double width, double height, GLVolume& volume);
|
static void polyline3_to_verts(const Polyline3& polyline, double width, double height, GLVolume& volume);
|
||||||
static void point3_to_verts(const Vec3crd& point, double width, double height, GLVolume& volume);
|
static void point3_to_verts(const Vec3crd& point, double width, double height, GLVolume& volume);
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -757,11 +757,11 @@ void GCodeViewer::init()
|
|||||||
m_gl_data_initialized = true;
|
m_gl_data_initialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
void GCodeViewer::load(const GCodeProcessorResult& gcode_result, const Print& print)
|
void GCodeViewer::load(const GCodeProcessorResult& gcode_result, const Print& print)
|
||||||
#else
|
#else
|
||||||
void GCodeViewer::load(const GCodeProcessorResult& gcode_result, const Print& print, bool initialized)
|
void GCodeViewer::load(const GCodeProcessorResult& gcode_result, const Print& print, bool initialized)
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
{
|
{
|
||||||
// avoid processing if called with the same gcode_result
|
// avoid processing if called with the same gcode_result
|
||||||
#if ENABLE_VOLUMETRIC_RATE_TOOLPATHS_RECALC
|
#if ENABLE_VOLUMETRIC_RATE_TOOLPATHS_RECALC
|
||||||
@ -800,11 +800,11 @@ void GCodeViewer::load(const GCodeProcessorResult& gcode_result, const Print& pr
|
|||||||
m_filament_densities = gcode_result.filament_densities;
|
m_filament_densities = gcode_result.filament_densities;
|
||||||
|
|
||||||
if (wxGetApp().is_editor())
|
if (wxGetApp().is_editor())
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
load_shells(print);
|
load_shells(print);
|
||||||
#else
|
#else
|
||||||
load_shells(print, initialized);
|
load_shells(print, initialized);
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
else {
|
else {
|
||||||
Pointfs bed_shape;
|
Pointfs bed_shape;
|
||||||
std::string texture;
|
std::string texture;
|
||||||
@ -2354,11 +2354,11 @@ void GCodeViewer::load_toolpaths(const GCodeProcessorResult& gcode_result)
|
|||||||
progress_dialog->Destroy();
|
progress_dialog->Destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
void GCodeViewer::load_shells(const Print& print)
|
void GCodeViewer::load_shells(const Print& print)
|
||||||
#else
|
#else
|
||||||
void GCodeViewer::load_shells(const Print& print, bool initialized)
|
void GCodeViewer::load_shells(const Print& print, bool initialized)
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
{
|
{
|
||||||
if (print.objects().empty())
|
if (print.objects().empty())
|
||||||
// no shells, return
|
// no shells, return
|
||||||
@ -2375,11 +2375,11 @@ void GCodeViewer::load_shells(const Print& print, bool initialized)
|
|||||||
}
|
}
|
||||||
|
|
||||||
size_t current_volumes_count = m_shells.volumes.volumes.size();
|
size_t current_volumes_count = m_shells.volumes.volumes.size();
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
m_shells.volumes.load_object(model_obj, object_id, instance_ids);
|
m_shells.volumes.load_object(model_obj, object_id, instance_ids);
|
||||||
#else
|
#else
|
||||||
m_shells.volumes.load_object(model_obj, object_id, instance_ids, initialized);
|
m_shells.volumes.load_object(model_obj, object_id, instance_ids, initialized);
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
|
|
||||||
// adjust shells' z if raft is present
|
// adjust shells' z if raft is present
|
||||||
const SlicingParameters& slicing_parameters = obj->slicing_parameters();
|
const SlicingParameters& slicing_parameters = obj->slicing_parameters();
|
||||||
@ -2403,7 +2403,7 @@ void GCodeViewer::load_shells(const Print& print, bool initialized)
|
|||||||
const float depth = print.wipe_tower_data(extruders_count).depth;
|
const float depth = print.wipe_tower_data(extruders_count).depth;
|
||||||
const float brim_width = print.wipe_tower_data(extruders_count).brim_width;
|
const float brim_width = print.wipe_tower_data(extruders_count).brim_width;
|
||||||
|
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
#if ENABLE_WIPETOWER_OBJECTID_1000_REMOVAL
|
#if ENABLE_WIPETOWER_OBJECTID_1000_REMOVAL
|
||||||
m_shells.volumes.load_wipe_tower_preview(config.wipe_tower_x, config.wipe_tower_y, config.wipe_tower_width, depth, max_z, config.wipe_tower_rotation_angle,
|
m_shells.volumes.load_wipe_tower_preview(config.wipe_tower_x, config.wipe_tower_y, config.wipe_tower_width, depth, max_z, config.wipe_tower_rotation_angle,
|
||||||
!print.is_step_done(psWipeTower), brim_width);
|
!print.is_step_done(psWipeTower), brim_width);
|
||||||
@ -2419,7 +2419,7 @@ void GCodeViewer::load_shells(const Print& print, bool initialized)
|
|||||||
m_shells.volumes.load_wipe_tower_preview(1000, config.wipe_tower_x, config.wipe_tower_y, config.wipe_tower_width, depth, max_z, config.wipe_tower_rotation_angle,
|
m_shells.volumes.load_wipe_tower_preview(1000, config.wipe_tower_x, config.wipe_tower_y, config.wipe_tower_width, depth, max_z, config.wipe_tower_rotation_angle,
|
||||||
!print.is_step_done(psWipeTower), brim_width, initialized);
|
!print.is_step_done(psWipeTower), brim_width, initialized);
|
||||||
#endif // ENABLE_WIPETOWER_OBJECTID_1000_REMOVAL
|
#endif // ENABLE_WIPETOWER_OBJECTID_1000_REMOVAL
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3400,7 +3400,7 @@ void GCodeViewer::render_shells()
|
|||||||
if (shader == nullptr)
|
if (shader == nullptr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#if !ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if !ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
// when the background processing is enabled, it may happen that the shells data have been loaded
|
// when the background processing is enabled, it may happen that the shells data have been loaded
|
||||||
// before opengl has been initialized for the preview canvas.
|
// before opengl has been initialized for the preview canvas.
|
||||||
// when this happens, the volumes' data have not been sent to gpu yet.
|
// when this happens, the volumes' data have not been sent to gpu yet.
|
||||||
@ -3408,7 +3408,7 @@ void GCodeViewer::render_shells()
|
|||||||
if (!v->indexed_vertex_array.has_VBOs())
|
if (!v->indexed_vertex_array.has_VBOs())
|
||||||
v->finalize_geometry(true);
|
v->finalize_geometry(true);
|
||||||
}
|
}
|
||||||
#endif // !ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // !ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
|
|
||||||
// glsafe(::glDepthMask(GL_FALSE));
|
// glsafe(::glDepthMask(GL_FALSE));
|
||||||
|
|
||||||
|
@ -823,11 +823,11 @@ public:
|
|||||||
void init();
|
void init();
|
||||||
|
|
||||||
// extract rendering data from the given parameters
|
// extract rendering data from the given parameters
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
void load(const GCodeProcessorResult& gcode_result, const Print& print);
|
void load(const GCodeProcessorResult& gcode_result, const Print& print);
|
||||||
#else
|
#else
|
||||||
void load(const GCodeProcessorResult& gcode_result, const Print& print, bool initialized);
|
void load(const GCodeProcessorResult& gcode_result, const Print& print, bool initialized);
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
// recalculate ranges in dependence of what is visible and sets tool/print colors
|
// recalculate ranges in dependence of what is visible and sets tool/print colors
|
||||||
void refresh(const GCodeProcessorResult& gcode_result, const std::vector<std::string>& str_tool_colors);
|
void refresh(const GCodeProcessorResult& gcode_result, const std::vector<std::string>& str_tool_colors);
|
||||||
#if ENABLE_PREVIEW_LAYOUT
|
#if ENABLE_PREVIEW_LAYOUT
|
||||||
@ -887,11 +887,11 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void load_toolpaths(const GCodeProcessorResult& gcode_result);
|
void load_toolpaths(const GCodeProcessorResult& gcode_result);
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
void load_shells(const Print& print);
|
void load_shells(const Print& print);
|
||||||
#else
|
#else
|
||||||
void load_shells(const Print& print, bool initialized);
|
void load_shells(const Print& print, bool initialized);
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
#if !ENABLE_PREVIEW_LAYOUT
|
#if !ENABLE_PREVIEW_LAYOUT
|
||||||
void refresh_render_paths(bool keep_sequential_current_first, bool keep_sequential_current_last) const;
|
void refresh_render_paths(bool keep_sequential_current_first, bool keep_sequential_current_last) const;
|
||||||
#endif // !ENABLE_PREVIEW_LAYOUT
|
#endif // !ENABLE_PREVIEW_LAYOUT
|
||||||
|
@ -87,11 +87,11 @@ static const Slic3r::ColorRGB ERROR_BG_LIGHT_COLOR = { 0.753f, 0.192f, 0.039f
|
|||||||
// Number of floats
|
// Number of floats
|
||||||
static constexpr const size_t MAX_VERTEX_BUFFER_SIZE = 131072 * 6; // 3.15MB
|
static constexpr const size_t MAX_VERTEX_BUFFER_SIZE = 131072 * 6; // 3.15MB
|
||||||
// Reserve size in number of floats.
|
// Reserve size in number of floats.
|
||||||
#if !ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if !ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
static constexpr const size_t VERTEX_BUFFER_RESERVE_SIZE = 131072 * 2; // 1.05MB
|
static constexpr const size_t VERTEX_BUFFER_RESERVE_SIZE = 131072 * 2; // 1.05MB
|
||||||
// Reserve size in number of floats, maximum sum of all preallocated buffers.
|
// Reserve size in number of floats, maximum sum of all preallocated buffers.
|
||||||
//static constexpr const size_t VERTEX_BUFFER_RESERVE_SIZE_SUM_MAX = 1024 * 1024 * 128 / 4; // 128MB
|
//static constexpr const size_t VERTEX_BUFFER_RESERVE_SIZE_SUM_MAX = 1024 * 1024 * 128 / 4; // 128MB
|
||||||
#endif // !ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // !ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
|
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
namespace GUI {
|
namespace GUI {
|
||||||
@ -1305,11 +1305,11 @@ bool GLCanvas3D::init()
|
|||||||
if (m_main_toolbar.is_enabled())
|
if (m_main_toolbar.is_enabled())
|
||||||
m_layers_editing.init();
|
m_layers_editing.init();
|
||||||
|
|
||||||
#if !ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if !ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
// on linux the gl context is not valid until the canvas is not shown on screen
|
// on linux the gl context is not valid until the canvas is not shown on screen
|
||||||
// we defer the geometry finalization of volumes until the first call to render()
|
// we defer the geometry finalization of volumes until the first call to render()
|
||||||
m_volumes.finalize_geometry(true);
|
m_volumes.finalize_geometry(true);
|
||||||
#endif // !ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // !ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
|
|
||||||
if (m_gizmos.is_enabled() && !m_gizmos.init())
|
if (m_gizmos.is_enabled() && !m_gizmos.init())
|
||||||
std::cout << "Unable to initialize gizmos: please, check that all the required textures are available" << std::endl;
|
std::cout << "Unable to initialize gizmos: please, check that all the required textures are available" << std::endl;
|
||||||
@ -1918,11 +1918,11 @@ std::vector<int> GLCanvas3D::load_object(const ModelObject& model_object, int ob
|
|||||||
instance_idxs.emplace_back(i);
|
instance_idxs.emplace_back(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
return m_volumes.load_object(&model_object, obj_idx, instance_idxs);
|
return m_volumes.load_object(&model_object, obj_idx, instance_idxs);
|
||||||
#else
|
#else
|
||||||
return m_volumes.load_object(&model_object, obj_idx, instance_idxs, m_initialized);
|
return m_volumes.load_object(&model_object, obj_idx, instance_idxs, m_initialized);
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<int> GLCanvas3D::load_object(const Model& model, int obj_idx)
|
std::vector<int> GLCanvas3D::load_object(const Model& model, int obj_idx)
|
||||||
@ -2147,11 +2147,11 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re
|
|||||||
// Note the index of the loaded volume, so that we can reload the main model GLVolume with the hollowed mesh
|
// Note the index of the loaded volume, so that we can reload the main model GLVolume with the hollowed mesh
|
||||||
// later in this function.
|
// later in this function.
|
||||||
it->volume_idx = m_volumes.volumes.size();
|
it->volume_idx = m_volumes.volumes.size();
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
m_volumes.load_object_volume(&model_object, obj_idx, volume_idx, instance_idx);
|
m_volumes.load_object_volume(&model_object, obj_idx, volume_idx, instance_idx);
|
||||||
#else
|
#else
|
||||||
m_volumes.load_object_volume(&model_object, obj_idx, volume_idx, instance_idx, m_initialized);
|
m_volumes.load_object_volume(&model_object, obj_idx, volume_idx, instance_idx, m_initialized);
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
m_volumes.volumes.back()->geometry_id = key.geometry_id;
|
m_volumes.volumes.back()->geometry_id = key.geometry_id;
|
||||||
update_object_list = true;
|
update_object_list = true;
|
||||||
} else {
|
} else {
|
||||||
@ -2208,48 +2208,48 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re
|
|||||||
GLVolume &volume = *m_volumes.volumes[it->volume_idx];
|
GLVolume &volume = *m_volumes.volumes[it->volume_idx];
|
||||||
if (! volume.offsets.empty() && state.step[istep].timestamp != volume.offsets.front()) {
|
if (! volume.offsets.empty() && state.step[istep].timestamp != volume.offsets.front()) {
|
||||||
// The backend either produced a new hollowed mesh, or it invalidated the one that the front end has seen.
|
// The backend either produced a new hollowed mesh, or it invalidated the one that the front end has seen.
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
volume.model.reset();
|
volume.model.reset();
|
||||||
#else
|
#else
|
||||||
volume.indexed_vertex_array.release_geometry();
|
volume.indexed_vertex_array.release_geometry();
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
if (state.step[istep].state == PrintStateBase::DONE) {
|
if (state.step[istep].state == PrintStateBase::DONE) {
|
||||||
TriangleMesh mesh = print_object->get_mesh(slaposDrillHoles);
|
TriangleMesh mesh = print_object->get_mesh(slaposDrillHoles);
|
||||||
assert(! mesh.empty());
|
assert(! mesh.empty());
|
||||||
mesh.transform(sla_print->sla_trafo(*m_model->objects[volume.object_idx()]).inverse());
|
mesh.transform(sla_print->sla_trafo(*m_model->objects[volume.object_idx()]).inverse());
|
||||||
#if ENABLE_SMOOTH_NORMALS
|
#if ENABLE_SMOOTH_NORMALS
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
volume.model.init_from(mesh, true);
|
volume.model.init_from(mesh, true);
|
||||||
#else
|
#else
|
||||||
volume.indexed_vertex_array.load_mesh(mesh, true);
|
volume.indexed_vertex_array.load_mesh(mesh, true);
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
#else
|
#else
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
volume.model.init_from(mesh);
|
volume.model.init_from(mesh);
|
||||||
#else
|
#else
|
||||||
volume.indexed_vertex_array.load_mesh(mesh);
|
volume.indexed_vertex_array.load_mesh(mesh);
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
#endif // ENABLE_SMOOTH_NORMALS
|
#endif // ENABLE_SMOOTH_NORMALS
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Reload the original volume.
|
// Reload the original volume.
|
||||||
#if ENABLE_SMOOTH_NORMALS
|
#if ENABLE_SMOOTH_NORMALS
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
volume.model.init_from(m_model->objects[volume.object_idx()]->volumes[volume.volume_idx()]->mesh(), true);
|
volume.model.init_from(m_model->objects[volume.object_idx()]->volumes[volume.volume_idx()]->mesh(), true);
|
||||||
#else
|
#else
|
||||||
volume.indexed_vertex_array.load_mesh(m_model->objects[volume.object_idx()]->volumes[volume.volume_idx()]->mesh(), true);
|
volume.indexed_vertex_array.load_mesh(m_model->objects[volume.object_idx()]->volumes[volume.volume_idx()]->mesh(), true);
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
#else
|
#else
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
volume.model.init_from(m_model->objects[volume.object_idx()]->volumes[volume.volume_idx()]->mesh());
|
volume.model.init_from(m_model->objects[volume.object_idx()]->volumes[volume.volume_idx()]->mesh());
|
||||||
#else
|
#else
|
||||||
volume.indexed_vertex_array.load_mesh(m_model->objects[volume.object_idx()]->volumes[volume.volume_idx()]->mesh());
|
volume.indexed_vertex_array.load_mesh(m_model->objects[volume.object_idx()]->volumes[volume.volume_idx()]->mesh());
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
#endif // ENABLE_SMOOTH_NORMALS
|
#endif // ENABLE_SMOOTH_NORMALS
|
||||||
}
|
}
|
||||||
#if !ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if !ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
volume.finalize_geometry(true);
|
volume.finalize_geometry(true);
|
||||||
#endif // !ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // !ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
}
|
}
|
||||||
//FIXME it is an ugly hack to write the timestamp into the "offsets" field to not have to add another member variable
|
//FIXME it is an ugly hack to write the timestamp into the "offsets" field to not have to add another member variable
|
||||||
// to the GLVolume. We should refactor GLVolume significantly, so that the GLVolume will not contain member variables
|
// to the GLVolume. We should refactor GLVolume significantly, so that the GLVolume will not contain member variables
|
||||||
@ -2279,11 +2279,11 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re
|
|||||||
|
|
||||||
for (size_t istep = 0; istep < sla_steps.size(); ++istep)
|
for (size_t istep = 0; istep < sla_steps.size(); ++istep)
|
||||||
if (!instances[istep].empty())
|
if (!instances[istep].empty())
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
m_volumes.load_object_auxiliary(print_object, object_idx, instances[istep], sla_steps[istep], state.step[istep].timestamp);
|
m_volumes.load_object_auxiliary(print_object, object_idx, instances[istep], sla_steps[istep], state.step[istep].timestamp);
|
||||||
#else
|
#else
|
||||||
m_volumes.load_object_auxiliary(print_object, object_idx, instances[istep], sla_steps[istep], state.step[istep].timestamp, m_initialized);
|
m_volumes.load_object_auxiliary(print_object, object_idx, instances[istep], sla_steps[istep], state.step[istep].timestamp, m_initialized);
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
}
|
}
|
||||||
|
|
||||||
// Shift-up all volumes of the object so that it has the right elevation with respect to the print bed
|
// Shift-up all volumes of the object so that it has the right elevation with respect to the print bed
|
||||||
@ -2313,7 +2313,7 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re
|
|||||||
float depth = print->wipe_tower_data(extruders_count).depth;
|
float depth = print->wipe_tower_data(extruders_count).depth;
|
||||||
float brim_width = print->wipe_tower_data(extruders_count).brim_width;
|
float brim_width = print->wipe_tower_data(extruders_count).brim_width;
|
||||||
|
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
#if ENABLE_WIPETOWER_OBJECTID_1000_REMOVAL
|
#if ENABLE_WIPETOWER_OBJECTID_1000_REMOVAL
|
||||||
int volume_idx_wipe_tower_new = m_volumes.load_wipe_tower_preview(
|
int volume_idx_wipe_tower_new = m_volumes.load_wipe_tower_preview(
|
||||||
x, y, w, depth, (float)height, a, !print->is_step_done(psWipeTower),
|
x, y, w, depth, (float)height, a, !print->is_step_done(psWipeTower),
|
||||||
@ -2333,7 +2333,7 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re
|
|||||||
1000, x, y, w, depth, (float)height, a, !print->is_step_done(psWipeTower),
|
1000, x, y, w, depth, (float)height, a, !print->is_step_done(psWipeTower),
|
||||||
brim_width, m_initialized);
|
brim_width, m_initialized);
|
||||||
#endif // ENABLE_WIPETOWER_OBJECTID_1000_REMOVAL
|
#endif // ENABLE_WIPETOWER_OBJECTID_1000_REMOVAL
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
if (volume_idx_wipe_tower_old != -1)
|
if (volume_idx_wipe_tower_old != -1)
|
||||||
map_glvolume_old_to_new[volume_idx_wipe_tower_old] = volume_idx_wipe_tower_new;
|
map_glvolume_old_to_new[volume_idx_wipe_tower_old] = volume_idx_wipe_tower_new;
|
||||||
}
|
}
|
||||||
@ -2393,7 +2393,7 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re
|
|||||||
m_dirty = true;
|
m_dirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if !ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
static void reserve_new_volume_finalize_old_volume(GLVolume& vol_new, GLVolume& vol_old, bool gl_initialized, size_t prealloc_size = VERTEX_BUFFER_RESERVE_SIZE)
|
static void reserve_new_volume_finalize_old_volume(GLVolume& vol_new, GLVolume& vol_old, bool gl_initialized, size_t prealloc_size = VERTEX_BUFFER_RESERVE_SIZE)
|
||||||
{
|
{
|
||||||
// Assign the large pre-allocated buffers to the new GLVolume.
|
// Assign the large pre-allocated buffers to the new GLVolume.
|
||||||
@ -2408,15 +2408,15 @@ static void reserve_new_volume_finalize_old_volume(GLVolume& vol_new, GLVolume&
|
|||||||
// Finalize the old geometry, possibly move data to the graphics card.
|
// Finalize the old geometry, possibly move data to the graphics card.
|
||||||
vol_old.finalize_geometry(gl_initialized);
|
vol_old.finalize_geometry(gl_initialized);
|
||||||
}
|
}
|
||||||
#endif // !ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // !ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
|
|
||||||
void GLCanvas3D::load_gcode_preview(const GCodeProcessorResult& gcode_result, const std::vector<std::string>& str_tool_colors)
|
void GLCanvas3D::load_gcode_preview(const GCodeProcessorResult& gcode_result, const std::vector<std::string>& str_tool_colors)
|
||||||
{
|
{
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
m_gcode_viewer.load(gcode_result, *this->fff_print());
|
m_gcode_viewer.load(gcode_result, *this->fff_print());
|
||||||
#else
|
#else
|
||||||
m_gcode_viewer.load(gcode_result, *this->fff_print(), m_initialized);
|
m_gcode_viewer.load(gcode_result, *this->fff_print(), m_initialized);
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
|
|
||||||
if (wxGetApp().is_editor()) {
|
if (wxGetApp().is_editor()) {
|
||||||
m_gcode_viewer.update_shells_color_by_extruder(m_config);
|
m_gcode_viewer.update_shells_color_by_extruder(m_config);
|
||||||
@ -4535,11 +4535,11 @@ void GLCanvas3D::_render_thumbnail_internal(ThumbnailData& thumbnail_data, const
|
|||||||
#endif // ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
|
#endif // ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
|
||||||
|
|
||||||
for (GLVolume* vol : visible_volumes) {
|
for (GLVolume* vol : visible_volumes) {
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
vol->model.set_color((vol->printable && !vol->is_outside) ? (current_printer_technology() == ptSLA ? vol->color : ColorRGBA::ORANGE()) : ColorRGBA::GRAY());
|
vol->model.set_color((vol->printable && !vol->is_outside) ? (current_printer_technology() == ptSLA ? vol->color : ColorRGBA::ORANGE()) : ColorRGBA::GRAY());
|
||||||
#else
|
#else
|
||||||
shader->set_uniform("uniform_color", (vol->printable && !vol->is_outside) ? (current_printer_technology() == ptSLA ? vol->color : ColorRGBA::ORANGE()) : ColorRGBA::GRAY());
|
shader->set_uniform("uniform_color", (vol->printable && !vol->is_outside) ? (current_printer_technology() == ptSLA ? vol->color : ColorRGBA::ORANGE()) : ColorRGBA::GRAY());
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
// the volume may have been deactivated by an active gizmo
|
// the volume may have been deactivated by an active gizmo
|
||||||
const bool is_active = vol->is_active;
|
const bool is_active = vol->is_active;
|
||||||
vol->is_active = true;
|
vol->is_active = true;
|
||||||
@ -5815,7 +5815,7 @@ void GLCanvas3D::_render_overlays()
|
|||||||
|
|
||||||
void GLCanvas3D::_render_volumes_for_picking() const
|
void GLCanvas3D::_render_volumes_for_picking() const
|
||||||
{
|
{
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
#if ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
|
#if ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
|
||||||
GLShaderProgram* shader = wxGetApp().get_shader("flat_attr");
|
GLShaderProgram* shader = wxGetApp().get_shader("flat_attr");
|
||||||
#else
|
#else
|
||||||
@ -5823,7 +5823,7 @@ void GLCanvas3D::_render_volumes_for_picking() const
|
|||||||
#endif // ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
|
#endif // ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
|
||||||
if (shader == nullptr)
|
if (shader == nullptr)
|
||||||
return;
|
return;
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
|
|
||||||
// do not cull backfaces to show broken geometry, if any
|
// do not cull backfaces to show broken geometry, if any
|
||||||
glsafe(::glDisable(GL_CULL_FACE));
|
glsafe(::glDisable(GL_CULL_FACE));
|
||||||
@ -5842,21 +5842,21 @@ void GLCanvas3D::_render_volumes_for_picking() const
|
|||||||
// we reserve color = (0,0,0) for occluders (as the printbed)
|
// we reserve color = (0,0,0) for occluders (as the printbed)
|
||||||
// so we shift volumes' id by 1 to get the proper color
|
// so we shift volumes' id by 1 to get the proper color
|
||||||
const unsigned int id = 1 + volume.second.first;
|
const unsigned int id = 1 + volume.second.first;
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
volume.first->model.set_color(picking_decode(id));
|
volume.first->model.set_color(picking_decode(id));
|
||||||
shader->start_using();
|
shader->start_using();
|
||||||
#else
|
#else
|
||||||
glsafe(::glColor4fv(picking_decode(id).data()));
|
glsafe(::glColor4fv(picking_decode(id).data()));
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
#if ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
|
#if ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
|
||||||
const Camera& camera = wxGetApp().plater()->get_camera();
|
const Camera& camera = wxGetApp().plater()->get_camera();
|
||||||
shader->set_uniform("view_model_matrix", camera.get_view_matrix() * volume.first->world_matrix());
|
shader->set_uniform("view_model_matrix", camera.get_view_matrix() * volume.first->world_matrix());
|
||||||
shader->set_uniform("projection_matrix", camera.get_projection_matrix());
|
shader->set_uniform("projection_matrix", camera.get_projection_matrix());
|
||||||
#endif // ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
|
#endif // ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
|
||||||
volume.first->render();
|
volume.first->render();
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
shader->stop_using();
|
shader->stop_using();
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6487,16 +6487,16 @@ void GLCanvas3D::_load_print_toolpaths(const BuildVolume &build_volume)
|
|||||||
skirt_height = std::min(skirt_height, print_zs.size());
|
skirt_height = std::min(skirt_height, print_zs.size());
|
||||||
print_zs.erase(print_zs.begin() + skirt_height, print_zs.end());
|
print_zs.erase(print_zs.begin() + skirt_height, print_zs.end());
|
||||||
|
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
GLVolume* volume = m_volumes.new_toolpath_volume(color);
|
GLVolume* volume = m_volumes.new_toolpath_volume(color);
|
||||||
GLModel::Geometry init_data;
|
GLModel::Geometry init_data;
|
||||||
init_data.format = { GLModel::Geometry::EPrimitiveType::Triangles, GLModel::Geometry::EVertexLayout::P3N3, GLModel::Geometry::EIndexType::UINT };
|
init_data.format = { GLModel::Geometry::EPrimitiveType::Triangles, GLModel::Geometry::EVertexLayout::P3N3, GLModel::Geometry::EIndexType::UINT };
|
||||||
#else
|
#else
|
||||||
GLVolume *volume = m_volumes.new_toolpath_volume(color, VERTEX_BUFFER_RESERVE_SIZE);
|
GLVolume *volume = m_volumes.new_toolpath_volume(color, VERTEX_BUFFER_RESERVE_SIZE);
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
for (size_t i = 0; i < skirt_height; ++ i) {
|
for (size_t i = 0; i < skirt_height; ++ i) {
|
||||||
volume->print_zs.emplace_back(print_zs[i]);
|
volume->print_zs.emplace_back(print_zs[i]);
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
volume->offsets.emplace_back(init_data.indices_count());
|
volume->offsets.emplace_back(init_data.indices_count());
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
_3DScene::extrusionentity_to_verts(print->brim(), print_zs[i], Point(0, 0), init_data);
|
_3DScene::extrusionentity_to_verts(print->brim(), print_zs[i], Point(0, 0), init_data);
|
||||||
@ -6507,28 +6507,28 @@ void GLCanvas3D::_load_print_toolpaths(const BuildVolume &build_volume)
|
|||||||
if (i == 0)
|
if (i == 0)
|
||||||
_3DScene::extrusionentity_to_verts(print->brim(), print_zs[i], Point(0, 0), *volume);
|
_3DScene::extrusionentity_to_verts(print->brim(), print_zs[i], Point(0, 0), *volume);
|
||||||
_3DScene::extrusionentity_to_verts(print->skirt(), print_zs[i], Point(0, 0), *volume);
|
_3DScene::extrusionentity_to_verts(print->skirt(), print_zs[i], Point(0, 0), *volume);
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
// Ensure that no volume grows over the limits. If the volume is too large, allocate a new one.
|
// Ensure that no volume grows over the limits. If the volume is too large, allocate a new one.
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
if (init_data.vertices_size_bytes() > MAX_VERTEX_BUFFER_SIZE) {
|
if (init_data.vertices_size_bytes() > MAX_VERTEX_BUFFER_SIZE) {
|
||||||
volume->model.init_from(std::move(init_data));
|
volume->model.init_from(std::move(init_data));
|
||||||
#else
|
#else
|
||||||
if (volume->indexed_vertex_array.vertices_and_normals_interleaved.size() > MAX_VERTEX_BUFFER_SIZE) {
|
if (volume->indexed_vertex_array.vertices_and_normals_interleaved.size() > MAX_VERTEX_BUFFER_SIZE) {
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
GLVolume &vol = *volume;
|
GLVolume &vol = *volume;
|
||||||
volume = m_volumes.new_toolpath_volume(vol.color);
|
volume = m_volumes.new_toolpath_volume(vol.color);
|
||||||
#if !ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if !ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
reserve_new_volume_finalize_old_volume(*volume, vol, m_initialized);
|
reserve_new_volume_finalize_old_volume(*volume, vol, m_initialized);
|
||||||
#endif // !ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // !ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
volume->model.init_from(std::move(init_data));
|
volume->model.init_from(std::move(init_data));
|
||||||
volume->is_outside = !contains(build_volume, volume->model);
|
volume->is_outside = !contains(build_volume, volume->model);
|
||||||
#else
|
#else
|
||||||
volume->is_outside = ! build_volume.all_paths_inside_vertices_and_normals_interleaved(volume->indexed_vertex_array.vertices_and_normals_interleaved, volume->indexed_vertex_array.bounding_box());
|
volume->is_outside = ! build_volume.all_paths_inside_vertices_and_normals_interleaved(volume->indexed_vertex_array.vertices_and_normals_interleaved, volume->indexed_vertex_array.bounding_box());
|
||||||
volume->indexed_vertex_array.finalize_geometry(m_initialized);
|
volume->indexed_vertex_array.finalize_geometry(m_initialized);
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLCanvas3D::_load_print_object_toolpaths(const PrintObject& print_object, const BuildVolume& build_volume, const std::vector<std::string>& str_tool_colors, const std::vector<CustomGCode::Item>& color_print_values)
|
void GLCanvas3D::_load_print_object_toolpaths(const PrintObject& print_object, const BuildVolume& build_volume, const std::vector<std::string>& str_tool_colors, const std::vector<CustomGCode::Item>& color_print_values)
|
||||||
@ -6700,11 +6700,11 @@ void GLCanvas3D::_load_print_object_toolpaths(const PrintObject& print_object, c
|
|||||||
// Allocate the volume before locking.
|
// Allocate the volume before locking.
|
||||||
GLVolume *volume = new GLVolume(color);
|
GLVolume *volume = new GLVolume(color);
|
||||||
volume->is_extrusion_path = true;
|
volume->is_extrusion_path = true;
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
// to prevent sending data to gpu (in the main thread) while
|
// to prevent sending data to gpu (in the main thread) while
|
||||||
// editing the model geometry
|
// editing the model geometry
|
||||||
volume->model.disable_render();
|
volume->model.disable_render();
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
tbb::spin_mutex::scoped_lock lock;
|
tbb::spin_mutex::scoped_lock lock;
|
||||||
// Lock by ROII, so if the emplace_back() fails, the lock will be released.
|
// Lock by ROII, so if the emplace_back() fails, the lock will be released.
|
||||||
lock.acquire(new_volume_mutex);
|
lock.acquire(new_volume_mutex);
|
||||||
@ -6717,7 +6717,7 @@ void GLCanvas3D::_load_print_object_toolpaths(const PrintObject& print_object, c
|
|||||||
tbb::blocked_range<size_t>(0, ctxt.layers.size(), grain_size),
|
tbb::blocked_range<size_t>(0, ctxt.layers.size(), grain_size),
|
||||||
[&ctxt, &new_volume, is_selected_separate_extruder, this](const tbb::blocked_range<size_t>& range) {
|
[&ctxt, &new_volume, is_selected_separate_extruder, this](const tbb::blocked_range<size_t>& range) {
|
||||||
GLVolumePtrs vols;
|
GLVolumePtrs vols;
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
std::vector<GLModel::Geometry> geometries;
|
std::vector<GLModel::Geometry> geometries;
|
||||||
auto select_geometry = [&ctxt, &geometries](size_t layer_idx, int extruder, int feature) -> GLModel::Geometry& {
|
auto select_geometry = [&ctxt, &geometries](size_t layer_idx, int extruder, int feature) -> GLModel::Geometry& {
|
||||||
return geometries[ctxt.color_by_color_print() ?
|
return geometries[ctxt.color_by_color_print() ?
|
||||||
@ -6736,23 +6736,23 @@ void GLCanvas3D::_load_print_object_toolpaths(const PrintObject& print_object, c
|
|||||||
feature
|
feature
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
if (ctxt.color_by_color_print() || ctxt.color_by_tool()) {
|
if (ctxt.color_by_color_print() || ctxt.color_by_tool()) {
|
||||||
for (size_t i = 0; i < ctxt.number_tools(); ++i) {
|
for (size_t i = 0; i < ctxt.number_tools(); ++i) {
|
||||||
vols.emplace_back(new_volume(ctxt.color_tool(i)));
|
vols.emplace_back(new_volume(ctxt.color_tool(i)));
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
geometries.emplace_back(GLModel::Geometry());
|
geometries.emplace_back(GLModel::Geometry());
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
vols = { new_volume(ctxt.color_perimeters()), new_volume(ctxt.color_infill()), new_volume(ctxt.color_support()) };
|
vols = { new_volume(ctxt.color_perimeters()), new_volume(ctxt.color_infill()), new_volume(ctxt.color_support()) };
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
geometries = { GLModel::Geometry(), GLModel::Geometry(), GLModel::Geometry() };
|
geometries = { GLModel::Geometry(), GLModel::Geometry(), GLModel::Geometry() };
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
assert(vols.size() == geometries.size());
|
assert(vols.size() == geometries.size());
|
||||||
for (GLModel::Geometry& g : geometries) {
|
for (GLModel::Geometry& g : geometries) {
|
||||||
g.format = { GLModel::Geometry::EPrimitiveType::Triangles, GLModel::Geometry::EVertexLayout::P3N3, GLModel::Geometry::EIndexType::UINT };
|
g.format = { GLModel::Geometry::EPrimitiveType::Triangles, GLModel::Geometry::EVertexLayout::P3N3, GLModel::Geometry::EIndexType::UINT };
|
||||||
@ -6761,7 +6761,7 @@ void GLCanvas3D::_load_print_object_toolpaths(const PrintObject& print_object, c
|
|||||||
for (GLVolume *vol : vols)
|
for (GLVolume *vol : vols)
|
||||||
// Reserving number of vertices (3x position + 3x color)
|
// Reserving number of vertices (3x position + 3x color)
|
||||||
vol->indexed_vertex_array.reserve(VERTEX_BUFFER_RESERVE_SIZE / 6);
|
vol->indexed_vertex_array.reserve(VERTEX_BUFFER_RESERVE_SIZE / 6);
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
for (size_t idx_layer = range.begin(); idx_layer < range.end(); ++ idx_layer) {
|
for (size_t idx_layer = range.begin(); idx_layer < range.end(); ++ idx_layer) {
|
||||||
const Layer *layer = ctxt.layers[idx_layer];
|
const Layer *layer = ctxt.layers[idx_layer];
|
||||||
|
|
||||||
@ -6782,7 +6782,7 @@ void GLCanvas3D::_load_print_object_toolpaths(const PrintObject& print_object, c
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
for (size_t i = 0; i < vols.size(); ++i) {
|
for (size_t i = 0; i < vols.size(); ++i) {
|
||||||
GLVolume* vol = vols[i];
|
GLVolume* vol = vols[i];
|
||||||
if (vol->print_zs.empty() || vol->print_zs.back() != layer->print_z) {
|
if (vol->print_zs.empty() || vol->print_zs.back() != layer->print_z) {
|
||||||
@ -6797,7 +6797,7 @@ void GLCanvas3D::_load_print_object_toolpaths(const PrintObject& print_object, c
|
|||||||
vol->offsets.emplace_back(vol->indexed_vertex_array.quad_indices.size());
|
vol->offsets.emplace_back(vol->indexed_vertex_array.quad_indices.size());
|
||||||
vol->offsets.emplace_back(vol->indexed_vertex_array.triangle_indices.size());
|
vol->offsets.emplace_back(vol->indexed_vertex_array.triangle_indices.size());
|
||||||
}
|
}
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
|
|
||||||
for (const PrintInstance &instance : *ctxt.shifted_copies) {
|
for (const PrintInstance &instance : *ctxt.shifted_copies) {
|
||||||
const Point © = instance.shift;
|
const Point © = instance.shift;
|
||||||
@ -6810,19 +6810,19 @@ void GLCanvas3D::_load_print_object_toolpaths(const PrintObject& print_object, c
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (ctxt.has_perimeters)
|
if (ctxt.has_perimeters)
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
_3DScene::extrusionentity_to_verts(layerm->perimeters, float(layer->print_z), copy,
|
_3DScene::extrusionentity_to_verts(layerm->perimeters, float(layer->print_z), copy,
|
||||||
select_geometry(idx_layer, layerm->region().config().perimeter_extruder.value, 0));
|
select_geometry(idx_layer, layerm->region().config().perimeter_extruder.value, 0));
|
||||||
#else
|
#else
|
||||||
_3DScene::extrusionentity_to_verts(layerm->perimeters, float(layer->print_z), copy,
|
_3DScene::extrusionentity_to_verts(layerm->perimeters, float(layer->print_z), copy,
|
||||||
volume(idx_layer, layerm->region().config().perimeter_extruder.value, 0));
|
volume(idx_layer, layerm->region().config().perimeter_extruder.value, 0));
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
if (ctxt.has_infill) {
|
if (ctxt.has_infill) {
|
||||||
for (const ExtrusionEntity *ee : layerm->fills.entities) {
|
for (const ExtrusionEntity *ee : layerm->fills.entities) {
|
||||||
// fill represents infill extrusions of a single island.
|
// fill represents infill extrusions of a single island.
|
||||||
const auto *fill = dynamic_cast<const ExtrusionEntityCollection*>(ee);
|
const auto *fill = dynamic_cast<const ExtrusionEntityCollection*>(ee);
|
||||||
if (! fill->entities.empty())
|
if (! fill->entities.empty())
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
_3DScene::extrusionentity_to_verts(*fill, float(layer->print_z), copy,
|
_3DScene::extrusionentity_to_verts(*fill, float(layer->print_z), copy,
|
||||||
select_geometry(idx_layer, is_solid_infill(fill->entities.front()->role()) ?
|
select_geometry(idx_layer, is_solid_infill(fill->entities.front()->role()) ?
|
||||||
layerm->region().config().solid_infill_extruder :
|
layerm->region().config().solid_infill_extruder :
|
||||||
@ -6834,7 +6834,7 @@ void GLCanvas3D::_load_print_object_toolpaths(const PrintObject& print_object, c
|
|||||||
layerm->region().config().solid_infill_extruder :
|
layerm->region().config().solid_infill_extruder :
|
||||||
layerm->region().config().infill_extruder,
|
layerm->region().config().infill_extruder,
|
||||||
1));
|
1));
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -6842,7 +6842,7 @@ void GLCanvas3D::_load_print_object_toolpaths(const PrintObject& print_object, c
|
|||||||
const SupportLayer *support_layer = dynamic_cast<const SupportLayer*>(layer);
|
const SupportLayer *support_layer = dynamic_cast<const SupportLayer*>(layer);
|
||||||
if (support_layer) {
|
if (support_layer) {
|
||||||
for (const ExtrusionEntity *extrusion_entity : support_layer->support_fills.entities)
|
for (const ExtrusionEntity *extrusion_entity : support_layer->support_fills.entities)
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
_3DScene::extrusionentity_to_verts(extrusion_entity, float(layer->print_z), copy,
|
_3DScene::extrusionentity_to_verts(extrusion_entity, float(layer->print_z), copy,
|
||||||
select_geometry(idx_layer, (extrusion_entity->role() == erSupportMaterial) ?
|
select_geometry(idx_layer, (extrusion_entity->role() == erSupportMaterial) ?
|
||||||
support_layer->object()->config().support_material_extruder :
|
support_layer->object()->config().support_material_extruder :
|
||||||
@ -6854,28 +6854,28 @@ void GLCanvas3D::_load_print_object_toolpaths(const PrintObject& print_object, c
|
|||||||
support_layer->object()->config().support_material_extruder :
|
support_layer->object()->config().support_material_extruder :
|
||||||
support_layer->object()->config().support_material_interface_extruder,
|
support_layer->object()->config().support_material_interface_extruder,
|
||||||
2));
|
2));
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Ensure that no volume grows over the limits. If the volume is too large, allocate a new one.
|
// Ensure that no volume grows over the limits. If the volume is too large, allocate a new one.
|
||||||
for (size_t i = 0; i < vols.size(); ++i) {
|
for (size_t i = 0; i < vols.size(); ++i) {
|
||||||
GLVolume &vol = *vols[i];
|
GLVolume &vol = *vols[i];
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
if (geometries[i].vertices_size_bytes() > MAX_VERTEX_BUFFER_SIZE) {
|
if (geometries[i].vertices_size_bytes() > MAX_VERTEX_BUFFER_SIZE) {
|
||||||
vol.model.init_from(std::move(geometries[i]));
|
vol.model.init_from(std::move(geometries[i]));
|
||||||
#else
|
#else
|
||||||
if (vol.indexed_vertex_array.vertices_and_normals_interleaved.size() > MAX_VERTEX_BUFFER_SIZE) {
|
if (vol.indexed_vertex_array.vertices_and_normals_interleaved.size() > MAX_VERTEX_BUFFER_SIZE) {
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
vols[i] = new_volume(vol.color);
|
vols[i] = new_volume(vol.color);
|
||||||
#if !ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if !ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
reserve_new_volume_finalize_old_volume(*vols[i], vol, false);
|
reserve_new_volume_finalize_old_volume(*vols[i], vol, false);
|
||||||
#endif // !ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // !ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
for (size_t i = 0; i < vols.size(); ++i) {
|
for (size_t i = 0; i < vols.size(); ++i) {
|
||||||
if (!geometries[i].is_empty())
|
if (!geometries[i].is_empty())
|
||||||
vols[i]->model.init_from(std::move(geometries[i]));
|
vols[i]->model.init_from(std::move(geometries[i]));
|
||||||
@ -6885,7 +6885,7 @@ void GLCanvas3D::_load_print_object_toolpaths(const PrintObject& print_object, c
|
|||||||
// Ideally one would call vol->indexed_vertex_array.finalize() here to move the buffers to the OpenGL driver,
|
// Ideally one would call vol->indexed_vertex_array.finalize() here to move the buffers to the OpenGL driver,
|
||||||
// but this code runs in parallel and the OpenGL driver is not thread safe.
|
// but this code runs in parallel and the OpenGL driver is not thread safe.
|
||||||
vol->indexed_vertex_array.shrink_to_fit();
|
vol->indexed_vertex_array.shrink_to_fit();
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
});
|
});
|
||||||
|
|
||||||
BOOST_LOG_TRIVIAL(debug) << "Loading print object toolpaths in parallel - finalizing results" << m_volumes.log_memory_info() << log_memory_info();
|
BOOST_LOG_TRIVIAL(debug) << "Loading print object toolpaths in parallel - finalizing results" << m_volumes.log_memory_info() << log_memory_info();
|
||||||
@ -6900,14 +6900,14 @@ void GLCanvas3D::_load_print_object_toolpaths(const PrintObject& print_object, c
|
|||||||
}
|
}
|
||||||
for (size_t i = volumes_cnt_initial; i < m_volumes.volumes.size(); ++i) {
|
for (size_t i = volumes_cnt_initial; i < m_volumes.volumes.size(); ++i) {
|
||||||
GLVolume* v = m_volumes.volumes[i];
|
GLVolume* v = m_volumes.volumes[i];
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
v->is_outside = !contains(build_volume, v->model);
|
v->is_outside = !contains(build_volume, v->model);
|
||||||
// We are done editinig the model, now it can be sent to gpu
|
// We are done editinig the model, now it can be sent to gpu
|
||||||
v->model.enable_render();
|
v->model.enable_render();
|
||||||
#else
|
#else
|
||||||
v->is_outside = ! build_volume.all_paths_inside_vertices_and_normals_interleaved(v->indexed_vertex_array.vertices_and_normals_interleaved, v->indexed_vertex_array.bounding_box());
|
v->is_outside = ! build_volume.all_paths_inside_vertices_and_normals_interleaved(v->indexed_vertex_array.vertices_and_normals_interleaved, v->indexed_vertex_array.bounding_box());
|
||||||
v->indexed_vertex_array.finalize_geometry(m_initialized);
|
v->indexed_vertex_array.finalize_geometry(m_initialized);
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_LOG_TRIVIAL(debug) << "Loading print object toolpaths in parallel - end" << m_volumes.log_memory_info() << log_memory_info();
|
BOOST_LOG_TRIVIAL(debug) << "Loading print object toolpaths in parallel - end" << m_volumes.log_memory_info() << log_memory_info();
|
||||||
@ -6972,11 +6972,11 @@ void GLCanvas3D::_load_wipe_tower_toolpaths(const BuildVolume& build_volume, con
|
|||||||
auto new_volume = [this, &new_volume_mutex](const ColorRGBA& color) {
|
auto new_volume = [this, &new_volume_mutex](const ColorRGBA& color) {
|
||||||
auto *volume = new GLVolume(color);
|
auto *volume = new GLVolume(color);
|
||||||
volume->is_extrusion_path = true;
|
volume->is_extrusion_path = true;
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
// to prevent sending data to gpu (in the main thread) while
|
// to prevent sending data to gpu (in the main thread) while
|
||||||
// editing the model geometry
|
// editing the model geometry
|
||||||
volume->model.disable_render();
|
volume->model.disable_render();
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
tbb::spin_mutex::scoped_lock lock;
|
tbb::spin_mutex::scoped_lock lock;
|
||||||
lock.acquire(new_volume_mutex);
|
lock.acquire(new_volume_mutex);
|
||||||
m_volumes.volumes.emplace_back(volume);
|
m_volumes.volumes.emplace_back(volume);
|
||||||
@ -6990,25 +6990,25 @@ void GLCanvas3D::_load_wipe_tower_toolpaths(const BuildVolume& build_volume, con
|
|||||||
[&ctxt, &new_volume](const tbb::blocked_range<size_t>& range) {
|
[&ctxt, &new_volume](const tbb::blocked_range<size_t>& range) {
|
||||||
// Bounding box of this slab of a wipe tower.
|
// Bounding box of this slab of a wipe tower.
|
||||||
GLVolumePtrs vols;
|
GLVolumePtrs vols;
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
std::vector<GLModel::Geometry> geometries;
|
std::vector<GLModel::Geometry> geometries;
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
if (ctxt.color_by_tool()) {
|
if (ctxt.color_by_tool()) {
|
||||||
for (size_t i = 0; i < ctxt.number_tools(); ++i) {
|
for (size_t i = 0; i < ctxt.number_tools(); ++i) {
|
||||||
vols.emplace_back(new_volume(ctxt.color_tool(i)));
|
vols.emplace_back(new_volume(ctxt.color_tool(i)));
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
geometries.emplace_back(GLModel::Geometry());
|
geometries.emplace_back(GLModel::Geometry());
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
vols = { new_volume(ctxt.color_support()) };
|
vols = { new_volume(ctxt.color_support()) };
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
geometries = { GLModel::Geometry() };
|
geometries = { GLModel::Geometry() };
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
assert(vols.size() == geometries.size());
|
assert(vols.size() == geometries.size());
|
||||||
for (GLModel::Geometry& g : geometries) {
|
for (GLModel::Geometry& g : geometries) {
|
||||||
g.format = { GLModel::Geometry::EPrimitiveType::Triangles, GLModel::Geometry::EVertexLayout::P3N3, GLModel::Geometry::EIndexType::UINT };
|
g.format = { GLModel::Geometry::EPrimitiveType::Triangles, GLModel::Geometry::EVertexLayout::P3N3, GLModel::Geometry::EIndexType::UINT };
|
||||||
@ -7017,19 +7017,19 @@ void GLCanvas3D::_load_wipe_tower_toolpaths(const BuildVolume& build_volume, con
|
|||||||
for (GLVolume *volume : vols)
|
for (GLVolume *volume : vols)
|
||||||
// Reserving number of vertices (3x position + 3x color)
|
// Reserving number of vertices (3x position + 3x color)
|
||||||
volume->indexed_vertex_array.reserve(VERTEX_BUFFER_RESERVE_SIZE / 6);
|
volume->indexed_vertex_array.reserve(VERTEX_BUFFER_RESERVE_SIZE / 6);
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
for (size_t idx_layer = range.begin(); idx_layer < range.end(); ++idx_layer) {
|
for (size_t idx_layer = range.begin(); idx_layer < range.end(); ++idx_layer) {
|
||||||
const std::vector<WipeTower::ToolChangeResult> &layer = ctxt.tool_change(idx_layer);
|
const std::vector<WipeTower::ToolChangeResult> &layer = ctxt.tool_change(idx_layer);
|
||||||
for (size_t i = 0; i < vols.size(); ++i) {
|
for (size_t i = 0; i < vols.size(); ++i) {
|
||||||
GLVolume &vol = *vols[i];
|
GLVolume &vol = *vols[i];
|
||||||
if (vol.print_zs.empty() || vol.print_zs.back() != layer.front().print_z) {
|
if (vol.print_zs.empty() || vol.print_zs.back() != layer.front().print_z) {
|
||||||
vol.print_zs.emplace_back(layer.front().print_z);
|
vol.print_zs.emplace_back(layer.front().print_z);
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
vol.offsets.emplace_back(geometries[i].indices_count());
|
vol.offsets.emplace_back(geometries[i].indices_count());
|
||||||
#else
|
#else
|
||||||
vol.offsets.emplace_back(vol.indexed_vertex_array.quad_indices.size());
|
vol.offsets.emplace_back(vol.indexed_vertex_array.quad_indices.size());
|
||||||
vol.offsets.emplace_back(vol.indexed_vertex_array.triangle_indices.size());
|
vol.offsets.emplace_back(vol.indexed_vertex_array.triangle_indices.size());
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (const WipeTower::ToolChangeResult &extrusions : layer) {
|
for (const WipeTower::ToolChangeResult &extrusions : layer) {
|
||||||
@ -7072,32 +7072,32 @@ void GLCanvas3D::_load_wipe_tower_toolpaths(const BuildVolume& build_volume, con
|
|||||||
e_prev = e;
|
e_prev = e;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
_3DScene::thick_lines_to_verts(lines, widths, heights, lines.front().a == lines.back().b, extrusions.print_z,
|
_3DScene::thick_lines_to_verts(lines, widths, heights, lines.front().a == lines.back().b, extrusions.print_z,
|
||||||
geometries[ctxt.volume_idx(e.tool, 0)]);
|
geometries[ctxt.volume_idx(e.tool, 0)]);
|
||||||
#else
|
#else
|
||||||
_3DScene::thick_lines_to_verts(lines, widths, heights, lines.front().a == lines.back().b, extrusions.print_z,
|
_3DScene::thick_lines_to_verts(lines, widths, heights, lines.front().a == lines.back().b, extrusions.print_z,
|
||||||
*vols[ctxt.volume_idx(e.tool, 0)]);
|
*vols[ctxt.volume_idx(e.tool, 0)]);
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (size_t i = 0; i < vols.size(); ++i) {
|
for (size_t i = 0; i < vols.size(); ++i) {
|
||||||
GLVolume &vol = *vols[i];
|
GLVolume &vol = *vols[i];
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
if (geometries[i].vertices_size_bytes() > MAX_VERTEX_BUFFER_SIZE) {
|
if (geometries[i].vertices_size_bytes() > MAX_VERTEX_BUFFER_SIZE) {
|
||||||
vol.model.init_from(std::move(geometries[i]));
|
vol.model.init_from(std::move(geometries[i]));
|
||||||
#else
|
#else
|
||||||
if (vol.indexed_vertex_array.vertices_and_normals_interleaved.size() > MAX_VERTEX_BUFFER_SIZE) {
|
if (vol.indexed_vertex_array.vertices_and_normals_interleaved.size() > MAX_VERTEX_BUFFER_SIZE) {
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
vols[i] = new_volume(vol.color);
|
vols[i] = new_volume(vol.color);
|
||||||
#if !ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if !ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
reserve_new_volume_finalize_old_volume(*vols[i], vol, false);
|
reserve_new_volume_finalize_old_volume(*vols[i], vol, false);
|
||||||
#endif // !ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // !ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
for (size_t i = 0; i < vols.size(); ++i) {
|
for (size_t i = 0; i < vols.size(); ++i) {
|
||||||
if (!geometries[i].is_empty())
|
if (!geometries[i].is_empty())
|
||||||
vols[i]->model.init_from(std::move(geometries[i]));
|
vols[i]->model.init_from(std::move(geometries[i]));
|
||||||
@ -7105,7 +7105,7 @@ void GLCanvas3D::_load_wipe_tower_toolpaths(const BuildVolume& build_volume, con
|
|||||||
#else
|
#else
|
||||||
for (GLVolume *vol : vols)
|
for (GLVolume *vol : vols)
|
||||||
vol->indexed_vertex_array.shrink_to_fit();
|
vol->indexed_vertex_array.shrink_to_fit();
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
});
|
});
|
||||||
|
|
||||||
BOOST_LOG_TRIVIAL(debug) << "Loading wipe tower toolpaths in parallel - finalizing results" << m_volumes.log_memory_info() << log_memory_info();
|
BOOST_LOG_TRIVIAL(debug) << "Loading wipe tower toolpaths in parallel - finalizing results" << m_volumes.log_memory_info() << log_memory_info();
|
||||||
@ -7120,14 +7120,14 @@ void GLCanvas3D::_load_wipe_tower_toolpaths(const BuildVolume& build_volume, con
|
|||||||
}
|
}
|
||||||
for (size_t i = volumes_cnt_initial; i < m_volumes.volumes.size(); ++i) {
|
for (size_t i = volumes_cnt_initial; i < m_volumes.volumes.size(); ++i) {
|
||||||
GLVolume* v = m_volumes.volumes[i];
|
GLVolume* v = m_volumes.volumes[i];
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
v->is_outside = !contains(build_volume, v->model);
|
v->is_outside = !contains(build_volume, v->model);
|
||||||
// We are done editinig the model, now it can be sent to gpu
|
// We are done editinig the model, now it can be sent to gpu
|
||||||
v->model.enable_render();
|
v->model.enable_render();
|
||||||
#else
|
#else
|
||||||
v->is_outside = ! build_volume.all_paths_inside_vertices_and_normals_interleaved(v->indexed_vertex_array.vertices_and_normals_interleaved, v->indexed_vertex_array.bounding_box());
|
v->is_outside = ! build_volume.all_paths_inside_vertices_and_normals_interleaved(v->indexed_vertex_array.vertices_and_normals_interleaved, v->indexed_vertex_array.bounding_box());
|
||||||
v->indexed_vertex_array.finalize_geometry(m_initialized);
|
v->indexed_vertex_array.finalize_geometry(m_initialized);
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_LOG_TRIVIAL(debug) << "Loading wipe tower toolpaths in parallel - end" << m_volumes.log_memory_info() << log_memory_info();
|
BOOST_LOG_TRIVIAL(debug) << "Loading wipe tower toolpaths in parallel - end" << m_volumes.log_memory_info() << log_memory_info();
|
||||||
@ -7151,21 +7151,21 @@ void GLCanvas3D::_load_sla_shells()
|
|||||||
m_volumes.volumes.emplace_back(new GLVolume(color));
|
m_volumes.volumes.emplace_back(new GLVolume(color));
|
||||||
GLVolume& v = *m_volumes.volumes.back();
|
GLVolume& v = *m_volumes.volumes.back();
|
||||||
#if ENABLE_SMOOTH_NORMALS
|
#if ENABLE_SMOOTH_NORMALS
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
v.model.init_from(mesh, true);
|
v.model.init_from(mesh, true);
|
||||||
#else
|
#else
|
||||||
v.indexed_vertex_array.load_mesh(mesh, true);
|
v.indexed_vertex_array.load_mesh(mesh, true);
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
#else
|
#else
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
v.model.init_from(mesh);
|
v.model.init_from(mesh);
|
||||||
#else
|
#else
|
||||||
v.indexed_vertex_array.load_mesh(mesh);
|
v.indexed_vertex_array.load_mesh(mesh);
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
#endif // ENABLE_SMOOTH_NORMALS
|
#endif // ENABLE_SMOOTH_NORMALS
|
||||||
#if !ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if !ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
v.indexed_vertex_array.finalize_geometry(m_initialized);
|
v.indexed_vertex_array.finalize_geometry(m_initialized);
|
||||||
#endif // !ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // !ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
v.shader_outside_printer_detection_enabled = outside_printer_detection_enabled;
|
v.shader_outside_printer_detection_enabled = outside_printer_detection_enabled;
|
||||||
v.composite_id.volume_id = volume_id;
|
v.composite_id.volume_id = volume_id;
|
||||||
v.set_instance_offset(unscale(instance.shift.x(), instance.shift.y(), 0.0));
|
v.set_instance_offset(unscale(instance.shift.x(), instance.shift.y(), 0.0));
|
||||||
|
@ -8,28 +8,28 @@
|
|||||||
#include "libslic3r/TriangleMesh.hpp"
|
#include "libslic3r/TriangleMesh.hpp"
|
||||||
#include "libslic3r/Model.hpp"
|
#include "libslic3r/Model.hpp"
|
||||||
#include "libslic3r/Polygon.hpp"
|
#include "libslic3r/Polygon.hpp"
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
#include "libslic3r/BuildVolume.hpp"
|
#include "libslic3r/BuildVolume.hpp"
|
||||||
#include "libslic3r/Geometry/ConvexHull.hpp"
|
#include "libslic3r/Geometry/ConvexHull.hpp"
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
|
|
||||||
#include <boost/filesystem/operations.hpp>
|
#include <boost/filesystem/operations.hpp>
|
||||||
#include <boost/algorithm/string/predicate.hpp>
|
#include <boost/algorithm/string/predicate.hpp>
|
||||||
|
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
#if ENABLE_SMOOTH_NORMALS
|
#if ENABLE_SMOOTH_NORMALS
|
||||||
#include <igl/per_face_normals.h>
|
#include <igl/per_face_normals.h>
|
||||||
#include <igl/per_corner_normals.h>
|
#include <igl/per_corner_normals.h>
|
||||||
#include <igl/per_vertex_normals.h>
|
#include <igl/per_vertex_normals.h>
|
||||||
#endif // ENABLE_SMOOTH_NORMALS
|
#endif // ENABLE_SMOOTH_NORMALS
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
|
|
||||||
#include <GL/glew.h>
|
#include <GL/glew.h>
|
||||||
|
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
namespace GUI {
|
namespace GUI {
|
||||||
|
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
#if ENABLE_SMOOTH_NORMALS
|
#if ENABLE_SMOOTH_NORMALS
|
||||||
static void smooth_normals_corner(const TriangleMesh& mesh, std::vector<stl_normal>& normals)
|
static void smooth_normals_corner(const TriangleMesh& mesh, std::vector<stl_normal>& normals)
|
||||||
{
|
{
|
||||||
@ -56,7 +56,7 @@ static void smooth_normals_corner(const TriangleMesh& mesh, std::vector<stl_norm
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // ENABLE_SMOOTH_NORMALS
|
#endif // ENABLE_SMOOTH_NORMALS
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
|
|
||||||
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
void GLModel::Geometry::reserve_vertices(size_t vertices_count)
|
void GLModel::Geometry::reserve_vertices(size_t vertices_count)
|
||||||
@ -248,7 +248,7 @@ Vec2f GLModel::Geometry::extract_tex_coord_2(size_t id) const
|
|||||||
return { *(start + 0), *(start + 1) };
|
return { *(start + 0), *(start + 1) };
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
void GLModel::Geometry::set_vertex(size_t id, const Vec3f& position, const Vec3f& normal)
|
void GLModel::Geometry::set_vertex(size_t id, const Vec3f& position, const Vec3f& normal)
|
||||||
{
|
{
|
||||||
assert(format.vertex_layout == EVertexLayout::P3N3);
|
assert(format.vertex_layout == EVertexLayout::P3N3);
|
||||||
@ -277,7 +277,7 @@ void GLModel::Geometry::set_uint_index(size_t id, unsigned int index)
|
|||||||
if (id < indices_count())
|
if (id < indices_count())
|
||||||
::memcpy(indices.data() + id * sizeof(unsigned int), &index, sizeof(unsigned int));
|
::memcpy(indices.data() + id * sizeof(unsigned int), &index, sizeof(unsigned int));
|
||||||
}
|
}
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
|
|
||||||
unsigned int GLModel::Geometry::extract_uint_index(size_t id) const
|
unsigned int GLModel::Geometry::extract_uint_index(size_t id) const
|
||||||
{
|
{
|
||||||
@ -313,7 +313,7 @@ unsigned short GLModel::Geometry::extract_ushort_index(size_t id) const
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
void GLModel::Geometry::remove_vertex(size_t id)
|
void GLModel::Geometry::remove_vertex(size_t id)
|
||||||
{
|
{
|
||||||
assert(id < vertices_count());
|
assert(id < vertices_count());
|
||||||
@ -323,7 +323,7 @@ void GLModel::Geometry::remove_vertex(size_t id)
|
|||||||
vertices.erase(it, it + stride);
|
vertices.erase(it, it + stride);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
|
|
||||||
size_t GLModel::Geometry::vertex_stride_floats(const Format& format)
|
size_t GLModel::Geometry::vertex_stride_floats(const Format& format)
|
||||||
{
|
{
|
||||||
@ -856,61 +856,63 @@ void GLModel::render()
|
|||||||
void GLModel::render() const
|
void GLModel::render() const
|
||||||
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
{
|
{
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
render(std::make_pair<size_t, size_t>(0, indices_count()));
|
render(std::make_pair<size_t, size_t>(0, indices_count()));
|
||||||
#else
|
#else
|
||||||
GLShaderProgram* shader = wxGetApp().get_current_shader();
|
GLShaderProgram* shader = wxGetApp().get_current_shader();
|
||||||
|
|
||||||
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
if (shader == nullptr)
|
//#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
return;
|
// if (shader == nullptr)
|
||||||
|
// return;
|
||||||
// sends data to gpu if not done yet
|
//
|
||||||
if (m_render_data.vbo_id == 0 || m_render_data.ibo_id == 0) {
|
// // sends data to gpu if not done yet
|
||||||
if (m_render_data.geometry.vertices_count() > 0 && m_render_data.geometry.indices_count() > 0 && !send_to_gpu())
|
// if (m_render_data.vbo_id == 0 || m_render_data.ibo_id == 0) {
|
||||||
return;
|
// if (m_render_data.geometry.vertices_count() > 0 && m_render_data.geometry.indices_count() > 0 && !send_to_gpu())
|
||||||
}
|
// return;
|
||||||
|
// }
|
||||||
const Geometry& data = m_render_data.geometry;
|
//
|
||||||
|
// const Geometry& data = m_render_data.geometry;
|
||||||
const GLenum mode = get_primitive_mode(data.format);
|
//
|
||||||
const GLenum index_type = get_index_type(data.format);
|
// const GLenum mode = get_primitive_mode(data.format);
|
||||||
|
// const GLenum index_type = get_index_type(data.format);
|
||||||
const size_t vertex_stride_bytes = Geometry::vertex_stride_bytes(data.format);
|
//
|
||||||
const bool position = Geometry::has_position(data.format);
|
// const size_t vertex_stride_bytes = Geometry::vertex_stride_bytes(data.format);
|
||||||
const bool normal = Geometry::has_normal(data.format);
|
// const bool position = Geometry::has_position(data.format);
|
||||||
const bool tex_coord = Geometry::has_tex_coord(data.format);
|
// const bool normal = Geometry::has_normal(data.format);
|
||||||
|
// const bool tex_coord = Geometry::has_tex_coord(data.format);
|
||||||
glsafe(::glBindBuffer(GL_ARRAY_BUFFER, m_render_data.vbo_id));
|
//
|
||||||
|
// glsafe(::glBindBuffer(GL_ARRAY_BUFFER, m_render_data.vbo_id));
|
||||||
if (position) {
|
//
|
||||||
glsafe(::glVertexPointer(Geometry::position_stride_floats(data.format), GL_FLOAT, vertex_stride_bytes, (const void*)Geometry::position_offset_bytes(data.format)));
|
// if (position) {
|
||||||
glsafe(::glEnableClientState(GL_VERTEX_ARRAY));
|
// glsafe(::glVertexPointer(Geometry::position_stride_floats(data.format), GL_FLOAT, vertex_stride_bytes, (const void*)Geometry::position_offset_bytes(data.format)));
|
||||||
}
|
// glsafe(::glEnableClientState(GL_VERTEX_ARRAY));
|
||||||
if (normal) {
|
// }
|
||||||
glsafe(::glNormalPointer(GL_FLOAT, vertex_stride_bytes, (const void*)Geometry::normal_offset_bytes(data.format)));
|
// if (normal) {
|
||||||
glsafe(::glEnableClientState(GL_NORMAL_ARRAY));
|
// glsafe(::glNormalPointer(GL_FLOAT, vertex_stride_bytes, (const void*)Geometry::normal_offset_bytes(data.format)));
|
||||||
}
|
// glsafe(::glEnableClientState(GL_NORMAL_ARRAY));
|
||||||
if (tex_coord) {
|
// }
|
||||||
glsafe(::glTexCoordPointer(Geometry::tex_coord_stride_floats(data.format), GL_FLOAT, vertex_stride_bytes, (const void*)Geometry::tex_coord_offset_bytes(data.format)));
|
// if (tex_coord) {
|
||||||
glsafe(::glEnableClientState(GL_TEXTURE_COORD_ARRAY));
|
// glsafe(::glTexCoordPointer(Geometry::tex_coord_stride_floats(data.format), GL_FLOAT, vertex_stride_bytes, (const void*)Geometry::tex_coord_offset_bytes(data.format)));
|
||||||
}
|
// glsafe(::glEnableClientState(GL_TEXTURE_COORD_ARRAY));
|
||||||
|
// }
|
||||||
shader->set_uniform("uniform_color", data.color);
|
//
|
||||||
|
// shader->set_uniform("uniform_color", data.color);
|
||||||
glsafe(::glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_render_data.ibo_id));
|
//
|
||||||
glsafe(::glDrawElements(mode, indices_count(), index_type, nullptr));
|
// glsafe(::glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_render_data.ibo_id));
|
||||||
glsafe(::glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0));
|
// glsafe(::glDrawElements(mode, indices_count(), index_type, nullptr));
|
||||||
|
// glsafe(::glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0));
|
||||||
if (tex_coord)
|
//
|
||||||
glsafe(::glDisableClientState(GL_TEXTURE_COORD_ARRAY));
|
// if (tex_coord)
|
||||||
if (normal)
|
// glsafe(::glDisableClientState(GL_TEXTURE_COORD_ARRAY));
|
||||||
glsafe(::glDisableClientState(GL_NORMAL_ARRAY));
|
// if (normal)
|
||||||
if (position)
|
// glsafe(::glDisableClientState(GL_NORMAL_ARRAY));
|
||||||
glsafe(::glDisableClientState(GL_VERTEX_ARRAY));
|
// if (position)
|
||||||
|
// glsafe(::glDisableClientState(GL_VERTEX_ARRAY));
|
||||||
glsafe(::glBindBuffer(GL_ARRAY_BUFFER, 0));
|
//
|
||||||
#else
|
// glsafe(::glBindBuffer(GL_ARRAY_BUFFER, 0));
|
||||||
|
//#else
|
||||||
|
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
for (const RenderData& data : m_render_data) {
|
for (const RenderData& data : m_render_data) {
|
||||||
if (data.vbo_id == 0 || data.ibo_id == 0)
|
if (data.vbo_id == 0 || data.ibo_id == 0)
|
||||||
continue;
|
continue;
|
||||||
@ -946,11 +948,13 @@ void GLModel::render() const
|
|||||||
|
|
||||||
glsafe(::glBindBuffer(GL_ARRAY_BUFFER, 0));
|
glsafe(::glBindBuffer(GL_ARRAY_BUFFER, 0));
|
||||||
}
|
}
|
||||||
|
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
|
//#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
|
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
void GLModel::render(const std::pair<size_t, size_t>& range)
|
void GLModel::render(const std::pair<size_t, size_t>& range)
|
||||||
{
|
{
|
||||||
if (m_render_disabled)
|
if (m_render_disabled)
|
||||||
@ -1048,7 +1052,7 @@ void GLModel::render(const std::pair<size_t, size_t>& range)
|
|||||||
|
|
||||||
glsafe(::glBindBuffer(GL_ARRAY_BUFFER, 0));
|
glsafe(::glBindBuffer(GL_ARRAY_BUFFER, 0));
|
||||||
}
|
}
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
|
|
||||||
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
void GLModel::render_instanced(unsigned int instances_vbo, unsigned int instances_count)
|
void GLModel::render_instanced(unsigned int instances_vbo, unsigned int instances_count)
|
||||||
@ -1270,7 +1274,7 @@ static void append_triangle(GLModel::Geometry& data, unsigned short v1, unsigned
|
|||||||
}
|
}
|
||||||
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
|
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
template<typename Fn>
|
template<typename Fn>
|
||||||
inline bool all_vertices_inside(const GLModel::Geometry& geometry, Fn fn)
|
inline bool all_vertices_inside(const GLModel::Geometry& geometry, Fn fn)
|
||||||
{
|
{
|
||||||
@ -1324,7 +1328,7 @@ bool contains(const BuildVolume& volume, const GLModel& model, bool ignore_botto
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
|
|
||||||
GLModel::Geometry stilized_arrow(unsigned short resolution, float tip_radius, float tip_height, float stem_radius, float stem_height)
|
GLModel::Geometry stilized_arrow(unsigned short resolution, float tip_radius, float tip_height, float stem_radius, float stem_height)
|
||||||
{
|
{
|
||||||
|
@ -14,9 +14,9 @@ namespace Slic3r {
|
|||||||
class TriangleMesh;
|
class TriangleMesh;
|
||||||
class Polygon;
|
class Polygon;
|
||||||
using Polygons = std::vector<Polygon>;
|
using Polygons = std::vector<Polygon>;
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
class BuildVolume;
|
class BuildVolume;
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
|
|
||||||
namespace GUI {
|
namespace GUI {
|
||||||
|
|
||||||
@ -92,12 +92,10 @@ namespace GUI {
|
|||||||
void add_vertex(const Vec3f& position, const Vec2f& tex_coord); // EVertexLayout::P3T2
|
void add_vertex(const Vec3f& position, const Vec2f& tex_coord); // EVertexLayout::P3T2
|
||||||
void add_vertex(const Vec3f& position, const Vec3f& normal); // EVertexLayout::P3N3
|
void add_vertex(const Vec3f& position, const Vec3f& normal); // EVertexLayout::P3N3
|
||||||
|
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
|
||||||
void set_vertex(size_t id, const Vec3f& position, const Vec3f& normal); // EVertexLayout::P3N3
|
void set_vertex(size_t id, const Vec3f& position, const Vec3f& normal); // EVertexLayout::P3N3
|
||||||
|
|
||||||
void set_ushort_index(size_t id, unsigned short index);
|
void set_ushort_index(size_t id, unsigned short index);
|
||||||
void set_uint_index(size_t id, unsigned int index);
|
void set_uint_index(size_t id, unsigned int index);
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
|
||||||
|
|
||||||
void add_ushort_index(unsigned short id);
|
void add_ushort_index(unsigned short id);
|
||||||
void add_uint_index(unsigned int id);
|
void add_uint_index(unsigned int id);
|
||||||
@ -116,9 +114,7 @@ namespace GUI {
|
|||||||
unsigned int extract_uint_index(size_t id) const;
|
unsigned int extract_uint_index(size_t id) const;
|
||||||
unsigned short extract_ushort_index(size_t id) const;
|
unsigned short extract_ushort_index(size_t id) const;
|
||||||
|
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
|
||||||
void remove_vertex(size_t id);
|
void remove_vertex(size_t id);
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
|
||||||
|
|
||||||
bool is_empty() const { return vertices_count() == 0 || indices_count() == 0; }
|
bool is_empty() const { return vertices_count() == 0 || indices_count() == 0; }
|
||||||
|
|
||||||
@ -189,11 +185,7 @@ namespace GUI {
|
|||||||
private:
|
private:
|
||||||
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
RenderData m_render_data;
|
RenderData m_render_data;
|
||||||
#else
|
|
||||||
std::vector<RenderData> m_render_data;
|
|
||||||
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
|
||||||
|
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
|
||||||
// By default the vertex and index buffers data are sent to gpu at the first call to render() method.
|
// By default the vertex and index buffers data are sent to gpu at the first call to render() method.
|
||||||
// If you need to initialize a model from outside the main thread, so that a call to render() may happen
|
// If you need to initialize a model from outside the main thread, so that a call to render() may happen
|
||||||
// before the initialization is complete, use the methods:
|
// before the initialization is complete, use the methods:
|
||||||
@ -202,7 +194,9 @@ namespace GUI {
|
|||||||
// enable_render()
|
// enable_render()
|
||||||
// to keep the data on cpu side until needed.
|
// to keep the data on cpu side until needed.
|
||||||
bool m_render_disabled{ false };
|
bool m_render_disabled{ false };
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#else
|
||||||
|
std::vector<RenderData> m_render_data;
|
||||||
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
BoundingBoxf3 m_bounding_box;
|
BoundingBoxf3 m_bounding_box;
|
||||||
std::string m_filename;
|
std::string m_filename;
|
||||||
|
|
||||||
@ -221,9 +215,7 @@ namespace GUI {
|
|||||||
|
|
||||||
size_t indices_size_bytes() const { return indices_count() * Geometry::index_stride_bytes(m_render_data.geometry.format); }
|
size_t indices_size_bytes() const { return indices_count() * Geometry::index_stride_bytes(m_render_data.geometry.format); }
|
||||||
|
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
|
||||||
const Geometry& get_geometry() const { return m_render_data.geometry; }
|
const Geometry& get_geometry() const { return m_render_data.geometry; }
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
|
||||||
|
|
||||||
void init_from(Geometry&& data);
|
void init_from(Geometry&& data);
|
||||||
#if ENABLE_SMOOTH_NORMALS
|
#if ENABLE_SMOOTH_NORMALS
|
||||||
@ -251,15 +243,11 @@ namespace GUI {
|
|||||||
void reset();
|
void reset();
|
||||||
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
void render();
|
void render();
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
|
||||||
void render(const std::pair<size_t, size_t>& range);
|
void render(const std::pair<size_t, size_t>& range);
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
|
||||||
void render_instanced(unsigned int instances_vbo, unsigned int instances_count);
|
void render_instanced(unsigned int instances_vbo, unsigned int instances_count);
|
||||||
|
|
||||||
bool is_initialized() const { return vertices_count() > 0 && indices_count() > 0; }
|
bool is_initialized() const { return vertices_count() > 0 && indices_count() > 0; }
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
|
||||||
bool is_empty() const { return m_render_data.geometry.is_empty(); }
|
bool is_empty() const { return m_render_data.geometry.is_empty(); }
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
|
||||||
#else
|
#else
|
||||||
void render() const;
|
void render() const;
|
||||||
void render_instanced(unsigned int instances_vbo, unsigned int instances_count) const;
|
void render_instanced(unsigned int instances_vbo, unsigned int instances_count) const;
|
||||||
@ -270,7 +258,7 @@ namespace GUI {
|
|||||||
const BoundingBoxf3& get_bounding_box() const { return m_bounding_box; }
|
const BoundingBoxf3& get_bounding_box() const { return m_bounding_box; }
|
||||||
const std::string& get_filename() const { return m_filename; }
|
const std::string& get_filename() const { return m_filename; }
|
||||||
|
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
bool is_render_disabled() const { return m_render_disabled; }
|
bool is_render_disabled() const { return m_render_disabled; }
|
||||||
void enable_render() { m_render_disabled = false; }
|
void enable_render() { m_render_disabled = false; }
|
||||||
void disable_render() { m_render_disabled = true; }
|
void disable_render() { m_render_disabled = true; }
|
||||||
@ -291,7 +279,7 @@ namespace GUI {
|
|||||||
ret += indices_size_bytes();
|
ret += indices_size_bytes();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
|
|
||||||
private:
|
private:
|
||||||
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
@ -301,9 +289,9 @@ namespace GUI {
|
|||||||
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
};
|
};
|
||||||
|
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
bool contains(const BuildVolume& volume, const GLModel& model, bool ignore_bottom = true);
|
bool contains(const BuildVolume& volume, const GLModel& model, bool ignore_bottom = true);
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
|
|
||||||
// create an arrow with cylindrical stem and conical tip, with the given dimensions and resolution
|
// create an arrow with cylindrical stem and conical tip, with the given dimensions and resolution
|
||||||
// the origin of the arrow is in the center of the stem cap
|
// the origin of the arrow is in the center of the stem cap
|
||||||
|
@ -275,12 +275,12 @@ static void generate_thumbnail_from_model(const std::string& filename)
|
|||||||
GLVolumeCollection volumes;
|
GLVolumeCollection volumes;
|
||||||
volumes.volumes.push_back(new GLVolume());
|
volumes.volumes.push_back(new GLVolume());
|
||||||
GLVolume* volume = volumes.volumes.back();
|
GLVolume* volume = volumes.volumes.back();
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
volume->model.init_from(model.mesh());
|
volume->model.init_from(model.mesh());
|
||||||
#else
|
#else
|
||||||
volume->indexed_vertex_array.load_mesh(model.mesh());
|
volume->indexed_vertex_array.load_mesh(model.mesh());
|
||||||
volume->indexed_vertex_array.finalize_geometry(true);
|
volume->indexed_vertex_array.finalize_geometry(true);
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
volume->set_instance_transformation(model.objects[0]->instances[0]->get_transformation());
|
volume->set_instance_transformation(model.objects[0]->instances[0]->get_transformation());
|
||||||
volume->set_volume_transformation(model.objects[0]->volumes[0]->get_transformation());
|
volume->set_volume_transformation(model.objects[0]->volumes[0]->get_transformation());
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
// Include GLGizmoBase.hpp before I18N.hpp as it includes some libigl code, which overrides our localization "L" macro.
|
// Include GLGizmoBase.hpp before I18N.hpp as it includes some libigl code, which overrides our localization "L" macro.
|
||||||
#include "GLGizmoFlatten.hpp"
|
#include "GLGizmoFlatten.hpp"
|
||||||
#include "slic3r/GUI/GLCanvas3D.hpp"
|
#include "slic3r/GUI/GLCanvas3D.hpp"
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
#include "slic3r/GUI/GUI_App.hpp"
|
#include "slic3r/GUI/GUI_App.hpp"
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
#if ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
|
#if ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
|
||||||
#include "slic3r/GUI/Plater.hpp"
|
#include "slic3r/GUI/Plater.hpp"
|
||||||
#endif // ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
|
#endif // ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
|
||||||
@ -104,7 +104,7 @@ void GLGizmoFlatten::on_render()
|
|||||||
{
|
{
|
||||||
const Selection& selection = m_parent.get_selection();
|
const Selection& selection = m_parent.get_selection();
|
||||||
|
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
#if ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
|
#if ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
|
||||||
GLShaderProgram* shader = wxGetApp().get_shader("flat_attr");
|
GLShaderProgram* shader = wxGetApp().get_shader("flat_attr");
|
||||||
#else
|
#else
|
||||||
@ -114,7 +114,7 @@ void GLGizmoFlatten::on_render()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
shader->start_using();
|
shader->start_using();
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
|
|
||||||
glsafe(::glClear(GL_DEPTH_BUFFER_BIT));
|
glsafe(::glClear(GL_DEPTH_BUFFER_BIT));
|
||||||
|
|
||||||
@ -138,14 +138,14 @@ void GLGizmoFlatten::on_render()
|
|||||||
if (this->is_plane_update_necessary())
|
if (this->is_plane_update_necessary())
|
||||||
update_planes();
|
update_planes();
|
||||||
for (int i = 0; i < (int)m_planes.size(); ++i) {
|
for (int i = 0; i < (int)m_planes.size(); ++i) {
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
m_planes[i].vbo.set_color(i == m_hover_id ? DEFAULT_HOVER_PLANE_COLOR : DEFAULT_PLANE_COLOR);
|
m_planes[i].vbo.set_color(i == m_hover_id ? DEFAULT_HOVER_PLANE_COLOR : DEFAULT_PLANE_COLOR);
|
||||||
m_planes[i].vbo.render();
|
m_planes[i].vbo.render();
|
||||||
#else
|
#else
|
||||||
glsafe(::glColor4fv(i == m_hover_id ? DEFAULT_HOVER_PLANE_COLOR.data() : DEFAULT_PLANE_COLOR.data()));
|
glsafe(::glColor4fv(i == m_hover_id ? DEFAULT_HOVER_PLANE_COLOR.data() : DEFAULT_PLANE_COLOR.data()));
|
||||||
if (m_planes[i].vbo.has_VBOs())
|
if (m_planes[i].vbo.has_VBOs())
|
||||||
m_planes[i].vbo.render();
|
m_planes[i].vbo.render();
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
}
|
}
|
||||||
#if !ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
|
#if !ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
|
||||||
glsafe(::glPopMatrix());
|
glsafe(::glPopMatrix());
|
||||||
@ -155,16 +155,16 @@ void GLGizmoFlatten::on_render()
|
|||||||
glsafe(::glEnable(GL_CULL_FACE));
|
glsafe(::glEnable(GL_CULL_FACE));
|
||||||
glsafe(::glDisable(GL_BLEND));
|
glsafe(::glDisable(GL_BLEND));
|
||||||
|
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
shader->stop_using();
|
shader->stop_using();
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLGizmoFlatten::on_render_for_picking()
|
void GLGizmoFlatten::on_render_for_picking()
|
||||||
{
|
{
|
||||||
const Selection& selection = m_parent.get_selection();
|
const Selection& selection = m_parent.get_selection();
|
||||||
|
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
#if ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
|
#if ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
|
||||||
GLShaderProgram* shader = wxGetApp().get_shader("flat_attr");
|
GLShaderProgram* shader = wxGetApp().get_shader("flat_attr");
|
||||||
#else
|
#else
|
||||||
@ -174,7 +174,7 @@ void GLGizmoFlatten::on_render_for_picking()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
shader->start_using();
|
shader->start_using();
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
|
|
||||||
glsafe(::glDisable(GL_DEPTH_TEST));
|
glsafe(::glDisable(GL_DEPTH_TEST));
|
||||||
glsafe(::glDisable(GL_BLEND));
|
glsafe(::glDisable(GL_BLEND));
|
||||||
@ -196,11 +196,11 @@ void GLGizmoFlatten::on_render_for_picking()
|
|||||||
if (this->is_plane_update_necessary())
|
if (this->is_plane_update_necessary())
|
||||||
update_planes();
|
update_planes();
|
||||||
for (int i = 0; i < (int)m_planes.size(); ++i) {
|
for (int i = 0; i < (int)m_planes.size(); ++i) {
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
m_planes[i].vbo.set_color(picking_color_component(i));
|
m_planes[i].vbo.set_color(picking_color_component(i));
|
||||||
#else
|
#else
|
||||||
glsafe(::glColor4fv(picking_color_component(i).data()));
|
glsafe(::glColor4fv(picking_color_component(i).data()));
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
m_planes[i].vbo.render();
|
m_planes[i].vbo.render();
|
||||||
}
|
}
|
||||||
#if !ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
|
#if !ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
|
||||||
@ -210,9 +210,9 @@ void GLGizmoFlatten::on_render_for_picking()
|
|||||||
|
|
||||||
glsafe(::glEnable(GL_CULL_FACE));
|
glsafe(::glEnable(GL_CULL_FACE));
|
||||||
|
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
shader->stop_using();
|
shader->stop_using();
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLGizmoFlatten::set_flattening_data(const ModelObject* model_object)
|
void GLGizmoFlatten::set_flattening_data(const ModelObject* model_object)
|
||||||
@ -427,7 +427,7 @@ void GLGizmoFlatten::update_planes()
|
|||||||
// And finally create respective VBOs. The polygon is convex with
|
// And finally create respective VBOs. The polygon is convex with
|
||||||
// the vertices in order, so triangulation is trivial.
|
// the vertices in order, so triangulation is trivial.
|
||||||
for (auto& plane : m_planes) {
|
for (auto& plane : m_planes) {
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
GLModel::Geometry init_data;
|
GLModel::Geometry init_data;
|
||||||
init_data.format = { GLModel::Geometry::EPrimitiveType::TriangleFan, GLModel::Geometry::EVertexLayout::P3N3, GLModel::Geometry::index_type(plane.vertices.size()) };
|
init_data.format = { GLModel::Geometry::EPrimitiveType::TriangleFan, GLModel::Geometry::EVertexLayout::P3N3, GLModel::Geometry::index_type(plane.vertices.size()) };
|
||||||
init_data.reserve_vertices(plane.vertices.size());
|
init_data.reserve_vertices(plane.vertices.size());
|
||||||
@ -448,7 +448,7 @@ void GLGizmoFlatten::update_planes()
|
|||||||
for (size_t i=1; i<plane.vertices.size()-1; ++i)
|
for (size_t i=1; i<plane.vertices.size()-1; ++i)
|
||||||
plane.vbo.push_triangle(0, i, i+1); // triangle fan
|
plane.vbo.push_triangle(0, i, i+1); // triangle fan
|
||||||
plane.vbo.finalize_geometry(true);
|
plane.vbo.finalize_geometry(true);
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
// FIXME: vertices should really be local, they need not
|
// FIXME: vertices should really be local, they need not
|
||||||
// persist now when we use VBOs
|
// persist now when we use VBOs
|
||||||
plane.vertices.clear();
|
plane.vertices.clear();
|
||||||
|
@ -2,11 +2,11 @@
|
|||||||
#define slic3r_GLGizmoFlatten_hpp_
|
#define slic3r_GLGizmoFlatten_hpp_
|
||||||
|
|
||||||
#include "GLGizmoBase.hpp"
|
#include "GLGizmoBase.hpp"
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
#include "slic3r/GUI/GLModel.hpp"
|
#include "slic3r/GUI/GLModel.hpp"
|
||||||
#else
|
#else
|
||||||
#include "slic3r/GUI/3DScene.hpp"
|
#include "slic3r/GUI/3DScene.hpp"
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
|
|
||||||
|
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
@ -25,11 +25,11 @@ private:
|
|||||||
|
|
||||||
struct PlaneData {
|
struct PlaneData {
|
||||||
std::vector<Vec3d> vertices; // should be in fact local in update_planes()
|
std::vector<Vec3d> vertices; // should be in fact local in update_planes()
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
GLModel vbo;
|
GLModel vbo;
|
||||||
#else
|
#else
|
||||||
GLIndexedVertexArray vbo;
|
GLIndexedVertexArray vbo;
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
Vec3d normal;
|
Vec3d normal;
|
||||||
float area;
|
float area;
|
||||||
};
|
};
|
||||||
|
@ -18,11 +18,11 @@
|
|||||||
|
|
||||||
namespace Slic3r::GUI {
|
namespace Slic3r::GUI {
|
||||||
|
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
std::shared_ptr<GLModel> GLGizmoPainterBase::s_sphere = nullptr;
|
std::shared_ptr<GLModel> GLGizmoPainterBase::s_sphere = nullptr;
|
||||||
#else
|
#else
|
||||||
std::shared_ptr<GLIndexedVertexArray> GLGizmoPainterBase::s_sphere = nullptr;
|
std::shared_ptr<GLIndexedVertexArray> GLGizmoPainterBase::s_sphere = nullptr;
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
|
|
||||||
GLGizmoPainterBase::GLGizmoPainterBase(GLCanvas3D& parent, const std::string& icon_filename, unsigned int sprite_id)
|
GLGizmoPainterBase::GLGizmoPainterBase(GLCanvas3D& parent, const std::string& icon_filename, unsigned int sprite_id)
|
||||||
: GLGizmoBase(parent, icon_filename, sprite_id)
|
: GLGizmoBase(parent, icon_filename, sprite_id)
|
||||||
@ -31,13 +31,13 @@ GLGizmoPainterBase::GLGizmoPainterBase(GLCanvas3D& parent, const std::string& ic
|
|||||||
|
|
||||||
GLGizmoPainterBase::~GLGizmoPainterBase()
|
GLGizmoPainterBase::~GLGizmoPainterBase()
|
||||||
{
|
{
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
if (s_sphere != nullptr)
|
if (s_sphere != nullptr)
|
||||||
s_sphere.reset();
|
s_sphere.reset();
|
||||||
#else
|
#else
|
||||||
if (s_sphere != nullptr && s_sphere->has_VBOs())
|
if (s_sphere != nullptr && s_sphere->has_VBOs())
|
||||||
s_sphere->release_geometry();
|
s_sphere->release_geometry();
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLGizmoPainterBase::data_changed()
|
void GLGizmoPainterBase::data_changed()
|
||||||
@ -282,14 +282,14 @@ void GLGizmoPainterBase::render_cursor_circle()
|
|||||||
void GLGizmoPainterBase::render_cursor_sphere(const Transform3d& trafo) const
|
void GLGizmoPainterBase::render_cursor_sphere(const Transform3d& trafo) const
|
||||||
{
|
{
|
||||||
if (s_sphere == nullptr) {
|
if (s_sphere == nullptr) {
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
s_sphere = std::make_shared<GLModel>();
|
s_sphere = std::make_shared<GLModel>();
|
||||||
s_sphere->init_from(its_make_sphere(1.0, double(PI) / 12.0));
|
s_sphere->init_from(its_make_sphere(1.0, double(PI) / 12.0));
|
||||||
#else
|
#else
|
||||||
s_sphere = std::make_shared<GLIndexedVertexArray>();
|
s_sphere = std::make_shared<GLIndexedVertexArray>();
|
||||||
s_sphere->load_its_flat_shading(its_make_sphere(1.0, double(PI) / 12.0));
|
s_sphere->load_its_flat_shading(its_make_sphere(1.0, double(PI) / 12.0));
|
||||||
s_sphere->finalize_geometry(true);
|
s_sphere->finalize_geometry(true);
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
|
#if ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
|
||||||
@ -320,7 +320,7 @@ void GLGizmoPainterBase::render_cursor_sphere(const Transform3d& trafo) const
|
|||||||
render_color = this->get_cursor_sphere_left_button_color();
|
render_color = this->get_cursor_sphere_left_button_color();
|
||||||
else if (m_button_down == Button::Right)
|
else if (m_button_down == Button::Right)
|
||||||
render_color = this->get_cursor_sphere_right_button_color();
|
render_color = this->get_cursor_sphere_right_button_color();
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
shader->start_using();
|
shader->start_using();
|
||||||
|
|
||||||
#if ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
|
#if ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
|
||||||
@ -339,12 +339,12 @@ void GLGizmoPainterBase::render_cursor_sphere(const Transform3d& trafo) const
|
|||||||
glsafe(::glColor4fv(render_color.data()));
|
glsafe(::glColor4fv(render_color.data()));
|
||||||
|
|
||||||
assert(s_sphere != nullptr);
|
assert(s_sphere != nullptr);
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
s_sphere->render();
|
s_sphere->render();
|
||||||
|
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
shader->stop_using();
|
shader->stop_using();
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
|
|
||||||
if (is_left_handed)
|
if (is_left_handed)
|
||||||
glFrontFace(GL_CCW);
|
glFrontFace(GL_CCW);
|
||||||
@ -936,7 +936,7 @@ void TriangleSelectorGUI::render(ImGuiWrapper* imgui)
|
|||||||
shader->set_uniform("offset_depth_buffer", true);
|
shader->set_uniform("offset_depth_buffer", true);
|
||||||
for (auto iva : {std::make_pair(&m_iva_enforcers, enforcers_color),
|
for (auto iva : {std::make_pair(&m_iva_enforcers, enforcers_color),
|
||||||
std::make_pair(&m_iva_blockers, blockers_color)}) {
|
std::make_pair(&m_iva_blockers, blockers_color)}) {
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
iva.first->set_color(iva.second);
|
iva.first->set_color(iva.second);
|
||||||
iva.first->render();
|
iva.first->render();
|
||||||
#else
|
#else
|
||||||
@ -944,10 +944,10 @@ void TriangleSelectorGUI::render(ImGuiWrapper* imgui)
|
|||||||
shader->set_uniform("uniform_color", iva.second);
|
shader->set_uniform("uniform_color", iva.second);
|
||||||
iva.first->render();
|
iva.first->render();
|
||||||
}
|
}
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
for (auto& iva : m_iva_seed_fills) {
|
for (auto& iva : m_iva_seed_fills) {
|
||||||
size_t color_idx = &iva - &m_iva_seed_fills.front();
|
size_t color_idx = &iva - &m_iva_seed_fills.front();
|
||||||
const ColorRGBA& color = TriangleSelectorGUI::get_seed_fill_color(color_idx == 1 ? enforcers_color :
|
const ColorRGBA& color = TriangleSelectorGUI::get_seed_fill_color(color_idx == 1 ? enforcers_color :
|
||||||
@ -966,7 +966,7 @@ void TriangleSelectorGUI::render(ImGuiWrapper* imgui)
|
|||||||
shader->set_uniform("uniform_color", color);
|
shader->set_uniform("uniform_color", color);
|
||||||
iva.render();
|
iva.render();
|
||||||
}
|
}
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
|
|
||||||
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
#if ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
|
#if ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
|
||||||
@ -1004,7 +1004,7 @@ void TriangleSelectorGUI::update_render_data()
|
|||||||
int blc_cnt = 0;
|
int blc_cnt = 0;
|
||||||
std::vector<int> seed_fill_cnt(m_iva_seed_fills.size(), 0);
|
std::vector<int> seed_fill_cnt(m_iva_seed_fills.size(), 0);
|
||||||
|
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
for (auto* iva : { &m_iva_enforcers, &m_iva_blockers }) {
|
for (auto* iva : { &m_iva_enforcers, &m_iva_blockers }) {
|
||||||
iva->reset();
|
iva->reset();
|
||||||
}
|
}
|
||||||
@ -1026,14 +1026,14 @@ void TriangleSelectorGUI::update_render_data()
|
|||||||
|
|
||||||
for (auto &iva : m_iva_seed_fills)
|
for (auto &iva : m_iva_seed_fills)
|
||||||
iva.release_geometry();
|
iva.release_geometry();
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
|
|
||||||
for (const Triangle &tr : m_triangles) {
|
for (const Triangle &tr : m_triangles) {
|
||||||
if (!tr.valid() || tr.is_split() || (tr.get_state() == EnforcerBlockerType::NONE && !tr.is_selected_by_seed_fill()))
|
if (!tr.valid() || tr.is_split() || (tr.get_state() == EnforcerBlockerType::NONE && !tr.is_selected_by_seed_fill()))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
int tr_state = int(tr.get_state());
|
int tr_state = int(tr.get_state());
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
GLModel::Geometry &iva = tr.is_selected_by_seed_fill() ? iva_seed_fills_data[tr_state] :
|
GLModel::Geometry &iva = tr.is_selected_by_seed_fill() ? iva_seed_fills_data[tr_state] :
|
||||||
tr.get_state() == EnforcerBlockerType::ENFORCER ? iva_enforcers_data :
|
tr.get_state() == EnforcerBlockerType::ENFORCER ? iva_enforcers_data :
|
||||||
iva_blockers_data;
|
iva_blockers_data;
|
||||||
@ -1041,7 +1041,7 @@ void TriangleSelectorGUI::update_render_data()
|
|||||||
GLIndexedVertexArray &iva = tr.is_selected_by_seed_fill() ? m_iva_seed_fills[tr_state] :
|
GLIndexedVertexArray &iva = tr.is_selected_by_seed_fill() ? m_iva_seed_fills[tr_state] :
|
||||||
tr.get_state() == EnforcerBlockerType::ENFORCER ? m_iva_enforcers :
|
tr.get_state() == EnforcerBlockerType::ENFORCER ? m_iva_enforcers :
|
||||||
m_iva_blockers;
|
m_iva_blockers;
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
int &cnt = tr.is_selected_by_seed_fill() ? seed_fill_cnt[tr_state] :
|
int &cnt = tr.is_selected_by_seed_fill() ? seed_fill_cnt[tr_state] :
|
||||||
tr.get_state() == EnforcerBlockerType::ENFORCER ? enf_cnt :
|
tr.get_state() == EnforcerBlockerType::ENFORCER ? enf_cnt :
|
||||||
blc_cnt;
|
blc_cnt;
|
||||||
@ -1051,7 +1051,7 @@ void TriangleSelectorGUI::update_render_data()
|
|||||||
//FIXME the normal may likely be pulled from m_triangle_selectors, but it may not be worth the effort
|
//FIXME the normal may likely be pulled from m_triangle_selectors, but it may not be worth the effort
|
||||||
// or the current implementation may be more cache friendly.
|
// or the current implementation may be more cache friendly.
|
||||||
const Vec3f n = (v1 - v0).cross(v2 - v1).normalized();
|
const Vec3f n = (v1 - v0).cross(v2 - v1).normalized();
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
iva.add_vertex(v0, n);
|
iva.add_vertex(v0, n);
|
||||||
iva.add_vertex(v1, n);
|
iva.add_vertex(v1, n);
|
||||||
iva.add_vertex(v2, n);
|
iva.add_vertex(v2, n);
|
||||||
@ -1061,11 +1061,11 @@ void TriangleSelectorGUI::update_render_data()
|
|||||||
iva.push_geometry(v1, n);
|
iva.push_geometry(v1, n);
|
||||||
iva.push_geometry(v2, n);
|
iva.push_geometry(v2, n);
|
||||||
iva.push_triangle(cnt, cnt + 1, cnt + 2);
|
iva.push_triangle(cnt, cnt + 1, cnt + 2);
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
cnt += 3;
|
cnt += 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
if (!iva_enforcers_data.is_empty())
|
if (!iva_enforcers_data.is_empty())
|
||||||
m_iva_enforcers.init_from(std::move(iva_enforcers_data));
|
m_iva_enforcers.init_from(std::move(iva_enforcers_data));
|
||||||
if (!iva_blockers_data.is_empty())
|
if (!iva_blockers_data.is_empty())
|
||||||
@ -1074,17 +1074,15 @@ void TriangleSelectorGUI::update_render_data()
|
|||||||
if (!iva_seed_fills_data[i].is_empty())
|
if (!iva_seed_fills_data[i].is_empty())
|
||||||
m_iva_seed_fills[i].init_from(std::move(iva_seed_fills_data[i]));
|
m_iva_seed_fills[i].init_from(std::move(iva_seed_fills_data[i]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
update_paint_contour();
|
||||||
#else
|
#else
|
||||||
for (auto *iva : {&m_iva_enforcers, &m_iva_blockers})
|
for (auto *iva : {&m_iva_enforcers, &m_iva_blockers})
|
||||||
iva->finalize_geometry(true);
|
iva->finalize_geometry(true);
|
||||||
|
|
||||||
for (auto &iva : m_iva_seed_fills)
|
for (auto &iva : m_iva_seed_fills)
|
||||||
iva.finalize_geometry(true);
|
iva.finalize_geometry(true);
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
|
||||||
|
|
||||||
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
|
||||||
update_paint_contour();
|
|
||||||
#else
|
|
||||||
m_paint_contour.release_geometry();
|
m_paint_contour.release_geometry();
|
||||||
std::vector<Vec2i> contour_edges = this->get_seed_fill_contour();
|
std::vector<Vec2i> contour_edges = this->get_seed_fill_contour();
|
||||||
m_paint_contour.contour_vertices.reserve(contour_edges.size() * 6);
|
m_paint_contour.contour_vertices.reserve(contour_edges.size() * 6);
|
||||||
@ -1201,60 +1199,60 @@ void TriangleSelectorGUI::render_debug(ImGuiWrapper* imgui)
|
|||||||
INVALID
|
INVALID
|
||||||
};
|
};
|
||||||
|
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
for (auto& va : m_varrays)
|
for (auto& va : m_varrays)
|
||||||
va.reset();
|
va.reset();
|
||||||
#else
|
#else
|
||||||
for (auto& va : m_varrays)
|
for (auto& va : m_varrays)
|
||||||
va.release_geometry();
|
va.release_geometry();
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
|
|
||||||
std::array<int, 3> cnts;
|
std::array<int, 3> cnts;
|
||||||
|
|
||||||
::glScalef(1.01f, 1.01f, 1.01f);
|
::glScalef(1.01f, 1.01f, 1.01f);
|
||||||
|
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
std::array<GLModel::Geometry, 3> varrays_data;
|
std::array<GLModel::Geometry, 3> varrays_data;
|
||||||
for (auto& data : varrays_data)
|
for (auto& data : varrays_data)
|
||||||
data.format = { GLModel::Geometry::EPrimitiveType::Triangles, GLModel::Geometry::EVertexLayout::P3N3, GLModel::Geometry::EIndexType::UINT };
|
data.format = { GLModel::Geometry::EPrimitiveType::Triangles, GLModel::Geometry::EVertexLayout::P3N3, GLModel::Geometry::EIndexType::UINT };
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
|
|
||||||
for (int tr_id=0; tr_id<int(m_triangles.size()); ++tr_id) {
|
for (int tr_id=0; tr_id<int(m_triangles.size()); ++tr_id) {
|
||||||
const Triangle& tr = m_triangles[tr_id];
|
const Triangle& tr = m_triangles[tr_id];
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
GLModel::Geometry* va = nullptr;
|
GLModel::Geometry* va = nullptr;
|
||||||
#else
|
#else
|
||||||
GLIndexedVertexArray* va = nullptr;
|
GLIndexedVertexArray* va = nullptr;
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
int* cnt = nullptr;
|
int* cnt = nullptr;
|
||||||
if (tr_id < m_orig_size_indices) {
|
if (tr_id < m_orig_size_indices) {
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
va = &varrays_data[ORIGINAL];
|
va = &varrays_data[ORIGINAL];
|
||||||
#else
|
#else
|
||||||
va = &m_varrays[ORIGINAL];
|
va = &m_varrays[ORIGINAL];
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
cnt = &cnts[ORIGINAL];
|
cnt = &cnts[ORIGINAL];
|
||||||
}
|
}
|
||||||
else if (tr.valid()) {
|
else if (tr.valid()) {
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
va = &varrays_data[SPLIT];
|
va = &varrays_data[SPLIT];
|
||||||
#else
|
#else
|
||||||
va = &m_varrays[SPLIT];
|
va = &m_varrays[SPLIT];
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
cnt = &cnts[SPLIT];
|
cnt = &cnts[SPLIT];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (! m_show_invalid)
|
if (! m_show_invalid)
|
||||||
continue;
|
continue;
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
va = &varrays_data[INVALID];
|
va = &varrays_data[INVALID];
|
||||||
#else
|
#else
|
||||||
va = &m_varrays[INVALID];
|
va = &m_varrays[INVALID];
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
cnt = &cnts[INVALID];
|
cnt = &cnts[INVALID];
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
for (int i = 0; i < 3; ++i) {
|
for (int i = 0; i < 3; ++i) {
|
||||||
va->add_vertex(m_vertices[tr.verts_idxs[i]].v, Vec3f(0.0f, 0.0f, 1.0f));
|
va->add_vertex(m_vertices[tr.verts_idxs[i]].v, Vec3f(0.0f, 0.0f, 1.0f));
|
||||||
}
|
}
|
||||||
@ -1268,11 +1266,11 @@ void TriangleSelectorGUI::render_debug(ImGuiWrapper* imgui)
|
|||||||
va->push_triangle(*cnt,
|
va->push_triangle(*cnt,
|
||||||
*cnt + 1,
|
*cnt + 1,
|
||||||
*cnt + 2);
|
*cnt + 2);
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
*cnt += 3;
|
*cnt += 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
for (int i = 0; i < 3; ++i) {
|
for (int i = 0; i < 3; ++i) {
|
||||||
if (!varrays_data[i].is_empty())
|
if (!varrays_data[i].is_empty())
|
||||||
m_varrays[i].init_from(std::move(varrays_data[i]));
|
m_varrays[i].init_from(std::move(varrays_data[i]));
|
||||||
@ -1283,9 +1281,9 @@ void TriangleSelectorGUI::render_debug(ImGuiWrapper* imgui)
|
|||||||
//
|
//
|
||||||
// for (auto& iva : m_iva_seed_fills)
|
// for (auto& iva : m_iva_seed_fills)
|
||||||
// iva.finalize_geometry(true);
|
// iva.finalize_geometry(true);
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
|
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
GLShaderProgram* curr_shader = wxGetApp().get_current_shader();
|
GLShaderProgram* curr_shader = wxGetApp().get_current_shader();
|
||||||
if (curr_shader != nullptr)
|
if (curr_shader != nullptr)
|
||||||
curr_shader->stop_using();
|
curr_shader->stop_using();
|
||||||
@ -1303,11 +1301,11 @@ void TriangleSelectorGUI::render_debug(ImGuiWrapper* imgui)
|
|||||||
shader->set_uniform("view_model_matrix", camera.get_view_matrix());
|
shader->set_uniform("view_model_matrix", camera.get_view_matrix());
|
||||||
shader->set_uniform("projection_matrix", camera.get_projection_matrix());
|
shader->set_uniform("projection_matrix", camera.get_projection_matrix());
|
||||||
#endif // ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
|
#endif // ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
|
|
||||||
::glPolygonMode( GL_FRONT_AND_BACK, GL_LINE );
|
::glPolygonMode( GL_FRONT_AND_BACK, GL_LINE );
|
||||||
for (vtype i : {ORIGINAL, SPLIT, INVALID}) {
|
for (vtype i : {ORIGINAL, SPLIT, INVALID}) {
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
GLModel& va = m_varrays[i];
|
GLModel& va = m_varrays[i];
|
||||||
switch (i) {
|
switch (i) {
|
||||||
case ORIGINAL: va.set_color({ 0.0f, 0.0f, 1.0f, 1.0f }); break;
|
case ORIGINAL: va.set_color({ 0.0f, 0.0f, 1.0f, 1.0f }); break;
|
||||||
@ -1326,17 +1324,17 @@ void TriangleSelectorGUI::render_debug(ImGuiWrapper* imgui)
|
|||||||
}
|
}
|
||||||
va.render();
|
va.render();
|
||||||
}
|
}
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
}
|
}
|
||||||
::glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
|
::glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
|
||||||
|
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
shader->stop_using();
|
shader->stop_using();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (curr_shader != nullptr)
|
if (curr_shader != nullptr)
|
||||||
curr_shader->start_using();
|
curr_shader->start_using();
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
}
|
}
|
||||||
#endif // PRUSASLICER_TRIANGLE_SELECTOR_DEBUG
|
#endif // PRUSASLICER_TRIANGLE_SELECTOR_DEBUG
|
||||||
|
|
||||||
|
@ -3,11 +3,11 @@
|
|||||||
|
|
||||||
#include "GLGizmoBase.hpp"
|
#include "GLGizmoBase.hpp"
|
||||||
|
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
#include "slic3r/GUI/GLModel.hpp"
|
#include "slic3r/GUI/GLModel.hpp"
|
||||||
#else
|
#else
|
||||||
#include "slic3r/GUI/3DScene.hpp"
|
#include "slic3r/GUI/3DScene.hpp"
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
|
|
||||||
#include "libslic3r/ObjectID.hpp"
|
#include "libslic3r/ObjectID.hpp"
|
||||||
#include "libslic3r/TriangleSelector.hpp"
|
#include "libslic3r/TriangleSelector.hpp"
|
||||||
@ -103,7 +103,7 @@ protected:
|
|||||||
private:
|
private:
|
||||||
void update_render_data();
|
void update_render_data();
|
||||||
|
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
GLModel m_iva_enforcers;
|
GLModel m_iva_enforcers;
|
||||||
GLModel m_iva_blockers;
|
GLModel m_iva_blockers;
|
||||||
std::array<GLModel, 3> m_iva_seed_fills;
|
std::array<GLModel, 3> m_iva_seed_fills;
|
||||||
@ -115,7 +115,7 @@ private:
|
|||||||
GLIndexedVertexArray m_iva_blockers;
|
GLIndexedVertexArray m_iva_blockers;
|
||||||
std::array<GLIndexedVertexArray, 3> m_iva_seed_fills;
|
std::array<GLIndexedVertexArray, 3> m_iva_seed_fills;
|
||||||
std::array<GLIndexedVertexArray, 3> m_varrays;
|
std::array<GLIndexedVertexArray, 3> m_varrays;
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
@ -250,11 +250,11 @@ private:
|
|||||||
const Camera& camera,
|
const Camera& camera,
|
||||||
const std::vector<Transform3d>& trafo_matrices) const;
|
const std::vector<Transform3d>& trafo_matrices) const;
|
||||||
|
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
static std::shared_ptr<GLModel> s_sphere;
|
static std::shared_ptr<GLModel> s_sphere;
|
||||||
#else
|
#else
|
||||||
static std::shared_ptr<GLIndexedVertexArray> s_sphere;
|
static std::shared_ptr<GLIndexedVertexArray> s_sphere;
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
|
|
||||||
bool m_internal_stack_active = false;
|
bool m_internal_stack_active = false;
|
||||||
bool m_schedule_update = false;
|
bool m_schedule_update = false;
|
||||||
|
@ -216,21 +216,21 @@ void InstancesHider::render_cut() const
|
|||||||
#if !ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
|
#if !ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
|
||||||
glsafe(::glPushMatrix());
|
glsafe(::glPushMatrix());
|
||||||
#endif // !ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
|
#endif // !ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
|
||||||
#if !ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if !ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
if (mv->is_model_part())
|
if (mv->is_model_part())
|
||||||
glsafe(::glColor3f(0.8f, 0.3f, 0.0f));
|
glsafe(::glColor3f(0.8f, 0.3f, 0.0f));
|
||||||
else {
|
else {
|
||||||
const ColorRGBA color = color_from_model_volume(*mv);
|
const ColorRGBA color = color_from_model_volume(*mv);
|
||||||
glsafe(::glColor4fv(color.data()));
|
glsafe(::glColor4fv(color.data()));
|
||||||
}
|
}
|
||||||
#endif // !ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // !ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
glsafe(::glPushAttrib(GL_DEPTH_TEST));
|
glsafe(::glPushAttrib(GL_DEPTH_TEST));
|
||||||
glsafe(::glDisable(GL_DEPTH_TEST));
|
glsafe(::glDisable(GL_DEPTH_TEST));
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
clipper->render_cut(mv->is_model_part() ? ColorRGBA(0.8f, 0.3f, 0.0f, 1.0f) : color_from_model_volume(*mv));
|
clipper->render_cut(mv->is_model_part() ? ColorRGBA(0.8f, 0.3f, 0.0f, 1.0f) : color_from_model_volume(*mv));
|
||||||
#else
|
#else
|
||||||
clipper->render_cut();
|
clipper->render_cut();
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
glsafe(::glPopAttrib());
|
glsafe(::glPopAttrib());
|
||||||
#if !ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
|
#if !ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
|
||||||
glsafe(::glPopMatrix());
|
glsafe(::glPopMatrix());
|
||||||
@ -430,12 +430,12 @@ void ObjectClipper::render_cut() const
|
|||||||
#if !ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
|
#if !ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
|
||||||
glsafe(::glPushMatrix());
|
glsafe(::glPushMatrix());
|
||||||
#endif // !ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
|
#endif // !ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
clipper->render_cut({ 1.0f, 0.37f, 0.0f, 1.0f });
|
clipper->render_cut({ 1.0f, 0.37f, 0.0f, 1.0f });
|
||||||
#else
|
#else
|
||||||
glsafe(::glColor3f(1.0f, 0.37f, 0.0f));
|
glsafe(::glColor3f(1.0f, 0.37f, 0.0f));
|
||||||
clipper->render_cut();
|
clipper->render_cut();
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
#if !ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
|
#if !ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
|
||||||
glsafe(::glPopMatrix());
|
glsafe(::glPopMatrix());
|
||||||
#endif // !ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
|
#endif // !ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
|
||||||
@ -551,12 +551,12 @@ void SupportsClipper::render_cut() const
|
|||||||
#if !ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
|
#if !ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
|
||||||
glsafe(::glPushMatrix());
|
glsafe(::glPushMatrix());
|
||||||
#endif // !ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
|
#endif // !ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
m_clipper->render_cut({ 1.0f, 0.f, 0.37f, 1.0f });
|
m_clipper->render_cut({ 1.0f, 0.f, 0.37f, 1.0f });
|
||||||
#else
|
#else
|
||||||
glsafe(::glColor3f(1.0f, 0.f, 0.37f));
|
glsafe(::glColor3f(1.0f, 0.f, 0.37f));
|
||||||
m_clipper->render_cut();
|
m_clipper->render_cut();
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
#if !ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
|
#if !ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
|
||||||
glsafe(::glPopMatrix());
|
glsafe(::glPopMatrix());
|
||||||
#endif // !ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
|
#endif // !ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
|
||||||
|
@ -6,9 +6,9 @@
|
|||||||
#include "libslic3r/ClipperUtils.hpp"
|
#include "libslic3r/ClipperUtils.hpp"
|
||||||
#include "libslic3r/Model.hpp"
|
#include "libslic3r/Model.hpp"
|
||||||
|
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
#include "slic3r/GUI/GUI_App.hpp"
|
#include "slic3r/GUI/GUI_App.hpp"
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
#include "slic3r/GUI/Camera.hpp"
|
#include "slic3r/GUI/Camera.hpp"
|
||||||
#if ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
|
#if ENABLE_GLBEGIN_GLEND_SHADERS_ATTRIBUTES
|
||||||
#include "slic3r/GUI/Plater.hpp"
|
#include "slic3r/GUI/Plater.hpp"
|
||||||
@ -70,18 +70,16 @@ void MeshClipper::set_transformation(const Geometry::Transformation& trafo)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
|
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
|
||||||
void MeshClipper::render_cut(const ColorRGBA& color)
|
void MeshClipper::render_cut(const ColorRGBA& color)
|
||||||
#else
|
#else
|
||||||
void MeshClipper::render_cut()
|
void MeshClipper::render_cut()
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
{
|
{
|
||||||
if (! m_triangles_valid)
|
if (! m_triangles_valid)
|
||||||
recalculate_triangles();
|
recalculate_triangles();
|
||||||
|
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
if (m_model.vertices_count() == 0 || m_model.indices_count() == 0)
|
if (m_model.vertices_count() == 0 || m_model.indices_count() == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -111,7 +109,7 @@ void MeshClipper::render_cut()
|
|||||||
#else
|
#else
|
||||||
if (m_vertex_array.has_VBOs())
|
if (m_vertex_array.has_VBOs())
|
||||||
m_vertex_array.render();
|
m_vertex_array.render();
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -200,7 +198,7 @@ void MeshClipper::recalculate_triangles()
|
|||||||
|
|
||||||
tr.pretranslate(0.001 * m_plane.get_normal().normalized()); // to avoid z-fighting
|
tr.pretranslate(0.001 * m_plane.get_normal().normalized()); // to avoid z-fighting
|
||||||
|
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
m_model.reset();
|
m_model.reset();
|
||||||
|
|
||||||
GLModel::Geometry init_data;
|
GLModel::Geometry init_data;
|
||||||
@ -232,7 +230,7 @@ void MeshClipper::recalculate_triangles()
|
|||||||
m_vertex_array.push_triangle(idx, idx+1, idx+2);
|
m_vertex_array.push_triangle(idx, idx+1, idx+2);
|
||||||
}
|
}
|
||||||
m_vertex_array.finalize_geometry(true);
|
m_vertex_array.finalize_geometry(true);
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
|
|
||||||
m_triangles_valid = true;
|
m_triangles_valid = true;
|
||||||
}
|
}
|
||||||
|
@ -7,11 +7,11 @@
|
|||||||
#include "libslic3r/SLA/IndexedMesh.hpp"
|
#include "libslic3r/SLA/IndexedMesh.hpp"
|
||||||
#include "admesh/stl.h"
|
#include "admesh/stl.h"
|
||||||
|
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
#include "slic3r/GUI/GLModel.hpp"
|
#include "slic3r/GUI/GLModel.hpp"
|
||||||
#else
|
#else
|
||||||
#include "slic3r/GUI/3DScene.hpp"
|
#include "slic3r/GUI/3DScene.hpp"
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
|
|
||||||
#include <cfloat>
|
#include <cfloat>
|
||||||
|
|
||||||
@ -98,11 +98,11 @@ public:
|
|||||||
|
|
||||||
// Render the triangulated cut. Transformation matrices should
|
// Render the triangulated cut. Transformation matrices should
|
||||||
// be set in world coords.
|
// be set in world coords.
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
void render_cut(const ColorRGBA& color);
|
void render_cut(const ColorRGBA& color);
|
||||||
#else
|
#else
|
||||||
void render_cut();
|
void render_cut();
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void recalculate_triangles();
|
void recalculate_triangles();
|
||||||
@ -113,11 +113,11 @@ private:
|
|||||||
ClippingPlane m_plane;
|
ClippingPlane m_plane;
|
||||||
ClippingPlane m_limiting_plane = ClippingPlane::ClipsNothing();
|
ClippingPlane m_limiting_plane = ClippingPlane::ClipsNothing();
|
||||||
std::vector<Vec2f> m_triangles2d;
|
std::vector<Vec2f> m_triangles2d;
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
GLModel m_model;
|
GLModel m_model;
|
||||||
#else
|
#else
|
||||||
GLIndexedVertexArray m_vertex_array;
|
GLIndexedVertexArray m_vertex_array;
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
bool m_triangles_valid = false;
|
bool m_triangles_valid = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -21,9 +21,9 @@
|
|||||||
#include <libslic3r/ObjectID.hpp>
|
#include <libslic3r/ObjectID.hpp>
|
||||||
#include <libslic3r/Utils.hpp>
|
#include <libslic3r/Utils.hpp>
|
||||||
|
|
||||||
#if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
#include "slic3r/GUI/3DScene.hpp"
|
#include "slic3r/GUI/3DScene.hpp"
|
||||||
#endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
|
|
||||||
#include <boost/foreach.hpp>
|
#include <boost/foreach.hpp>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user