Tech ENABLE_SEAMS_USING_MODELS set as default
This commit is contained in:
parent
3f0bdb5816
commit
75856d5e65
@ -43,8 +43,6 @@
|
|||||||
|
|
||||||
// Enable implementation of retract acceleration in gcode processor
|
// Enable implementation of retract acceleration in gcode processor
|
||||||
#define ENABLE_RETRACT_ACCELERATION (1 && ENABLE_2_4_0_ALPHA1)
|
#define ENABLE_RETRACT_ACCELERATION (1 && ENABLE_2_4_0_ALPHA1)
|
||||||
// Enable rendering seams (and other options) in preview using models
|
|
||||||
#define ENABLE_SEAMS_USING_MODELS (1 && ENABLE_2_4_0_ALPHA1)
|
|
||||||
// Enable save and save as commands to be enabled also when the plater is empty and allow to load empty projects
|
// Enable save and save as commands to be enabled also when the plater is empty and allow to load empty projects
|
||||||
#define ENABLE_SAVE_COMMANDS_ALWAYS_ENABLED (1 && ENABLE_2_4_0_ALPHA1)
|
#define ENABLE_SAVE_COMMANDS_ALWAYS_ENABLED (1 && ENABLE_2_4_0_ALPHA1)
|
||||||
|
|
||||||
@ -55,9 +53,9 @@
|
|||||||
#define ENABLE_2_4_0_ALPHA2 1
|
#define ENABLE_2_4_0_ALPHA2 1
|
||||||
|
|
||||||
// Enable rendering seams (and other options) in preview using batched models on systems not supporting OpenGL 3.3
|
// Enable rendering seams (and other options) in preview using batched models on systems not supporting OpenGL 3.3
|
||||||
#define ENABLE_SEAMS_USING_BATCHED_MODELS (1 && ENABLE_SEAMS_USING_MODELS && ENABLE_2_4_0_ALPHA2)
|
#define ENABLE_SEAMS_USING_BATCHED_MODELS (1 && ENABLE_2_4_0_ALPHA2)
|
||||||
// Enable fixing the z position of color change, pause print and custom gcode markers in preview
|
// Enable fixing the z position of color change, pause print and custom gcode markers in preview
|
||||||
#define ENABLE_FIX_PREVIEW_OPTIONS_Z (1 && ENABLE_SEAMS_USING_MODELS && ENABLE_2_4_0_ALPHA2)
|
#define ENABLE_FIX_PREVIEW_OPTIONS_Z (1 && ENABLE_2_4_0_ALPHA2)
|
||||||
// Enable replacing a missing file during reload from disk command
|
// Enable replacing a missing file during reload from disk command
|
||||||
#define ENABLE_RELOAD_FROM_DISK_REPLACE_FILE (1 && ENABLE_2_4_0_ALPHA2)
|
#define ENABLE_RELOAD_FROM_DISK_REPLACE_FILE (1 && ENABLE_2_4_0_ALPHA2)
|
||||||
// Enable fixing the synchronization of seams with the horizontal slider in preview
|
// Enable fixing the synchronization of seams with the horizontal slider in preview
|
||||||
|
@ -89,7 +89,6 @@ void GCodeViewer::VBuffer::reset()
|
|||||||
count = 0;
|
count = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLE_SEAMS_USING_MODELS
|
|
||||||
void GCodeViewer::InstanceVBuffer::Ranges::reset()
|
void GCodeViewer::InstanceVBuffer::Ranges::reset()
|
||||||
{
|
{
|
||||||
for (Range& range : ranges) {
|
for (Range& range : ranges) {
|
||||||
@ -107,7 +106,6 @@ void GCodeViewer::InstanceVBuffer::reset()
|
|||||||
buffer.clear();
|
buffer.clear();
|
||||||
render_ranges.reset();
|
render_ranges.reset();
|
||||||
}
|
}
|
||||||
#endif // ENABLE_SEAMS_USING_MODELS
|
|
||||||
|
|
||||||
void GCodeViewer::IBuffer::reset()
|
void GCodeViewer::IBuffer::reset()
|
||||||
{
|
{
|
||||||
@ -150,12 +148,10 @@ bool GCodeViewer::Path::matches(const GCodeProcessorResult::MoveVertex& move) co
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLE_SEAMS_USING_MODELS
|
|
||||||
void GCodeViewer::TBuffer::Model::reset()
|
void GCodeViewer::TBuffer::Model::reset()
|
||||||
{
|
{
|
||||||
instances.reset();
|
instances.reset();
|
||||||
}
|
}
|
||||||
#endif // ENABLE_SEAMS_USING_MODELS
|
|
||||||
|
|
||||||
void GCodeViewer::TBuffer::reset()
|
void GCodeViewer::TBuffer::reset()
|
||||||
{
|
{
|
||||||
@ -167,9 +163,7 @@ void GCodeViewer::TBuffer::reset()
|
|||||||
indices.clear();
|
indices.clear();
|
||||||
paths.clear();
|
paths.clear();
|
||||||
render_paths.clear();
|
render_paths.clear();
|
||||||
#if ENABLE_SEAMS_USING_MODELS
|
|
||||||
model.reset();
|
model.reset();
|
||||||
#endif // ENABLE_SEAMS_USING_MODELS
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GCodeViewer::TBuffer::add_path(const GCodeProcessorResult::MoveVertex& move, unsigned int b_id, size_t i_id, size_t s_id)
|
void GCodeViewer::TBuffer::add_path(const GCodeProcessorResult::MoveVertex& move, unsigned int b_id, size_t i_id, size_t s_id)
|
||||||
@ -567,48 +561,11 @@ const GCodeViewer::Color GCodeViewer::Neutral_Color = { 0.25f, 0.25f, 0.25f, 1.0
|
|||||||
|
|
||||||
GCodeViewer::GCodeViewer()
|
GCodeViewer::GCodeViewer()
|
||||||
{
|
{
|
||||||
#if !ENABLE_SEAMS_USING_MODELS
|
|
||||||
// initializes non OpenGL data of TBuffers
|
|
||||||
// OpenGL data are initialized into render().init_gl_data()
|
|
||||||
for (size_t i = 0; i < m_buffers.size(); ++i) {
|
|
||||||
TBuffer& buffer = m_buffers[i];
|
|
||||||
switch (buffer_type(i))
|
|
||||||
{
|
|
||||||
default: { break; }
|
|
||||||
case EMoveType::Tool_change:
|
|
||||||
case EMoveType::Color_change:
|
|
||||||
case EMoveType::Pause_Print:
|
|
||||||
case EMoveType::Custom_GCode:
|
|
||||||
case EMoveType::Retract:
|
|
||||||
case EMoveType::Unretract:
|
|
||||||
case EMoveType::Seam: {
|
|
||||||
buffer.render_primitive_type = TBuffer::ERenderPrimitiveType::Point;
|
|
||||||
buffer.vertices.format = VBuffer::EFormat::Position;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case EMoveType::Wipe:
|
|
||||||
case EMoveType::Extrude: {
|
|
||||||
buffer.render_primitive_type = TBuffer::ERenderPrimitiveType::Triangle;
|
|
||||||
buffer.vertices.format = VBuffer::EFormat::PositionNormal3;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case EMoveType::Travel: {
|
|
||||||
buffer.render_primitive_type = TBuffer::ERenderPrimitiveType::Line;
|
|
||||||
buffer.vertices.format = VBuffer::EFormat::PositionNormal1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
set_toolpath_move_type_visible(EMoveType::Extrude, true);
|
|
||||||
#endif // !ENABLE_SEAMS_USING_MODELS
|
|
||||||
|
|
||||||
m_extrusions.reset_role_visibility_flags();
|
m_extrusions.reset_role_visibility_flags();
|
||||||
|
|
||||||
// m_sequential_view.skip_invisible_moves = true;
|
// m_sequential_view.skip_invisible_moves = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLE_SEAMS_USING_MODELS
|
|
||||||
void GCodeViewer::init()
|
void GCodeViewer::init()
|
||||||
{
|
{
|
||||||
if (m_gl_data_initialized)
|
if (m_gl_data_initialized)
|
||||||
@ -689,7 +646,6 @@ void GCodeViewer::init()
|
|||||||
|
|
||||||
m_gl_data_initialized = true;
|
m_gl_data_initialized = true;
|
||||||
}
|
}
|
||||||
#endif // ENABLE_SEAMS_USING_MODELS
|
|
||||||
|
|
||||||
void GCodeViewer::load(const GCodeProcessorResult& gcode_result, const Print& print, bool initialized)
|
void GCodeViewer::load(const GCodeProcessorResult& gcode_result, const Print& print, bool initialized)
|
||||||
{
|
{
|
||||||
@ -879,72 +835,11 @@ void GCodeViewer::reset()
|
|||||||
|
|
||||||
void GCodeViewer::render()
|
void GCodeViewer::render()
|
||||||
{
|
{
|
||||||
#if !ENABLE_SEAMS_USING_MODELS
|
|
||||||
auto init_gl_data = [this]() {
|
|
||||||
// initializes opengl data of TBuffers
|
|
||||||
for (size_t i = 0; i < m_buffers.size(); ++i) {
|
|
||||||
TBuffer& buffer = m_buffers[i];
|
|
||||||
EMoveType type = buffer_type(i);
|
|
||||||
switch (type)
|
|
||||||
{
|
|
||||||
default: { break; }
|
|
||||||
case EMoveType::Tool_change:
|
|
||||||
case EMoveType::Color_change:
|
|
||||||
case EMoveType::Pause_Print:
|
|
||||||
case EMoveType::Custom_GCode:
|
|
||||||
case EMoveType::Retract:
|
|
||||||
case EMoveType::Unretract:
|
|
||||||
case EMoveType::Seam: {
|
|
||||||
if (wxGetApp().is_gl_version_greater_or_equal_to(3, 3)) {
|
|
||||||
buffer.render_primitive_type = TBuffer::ERenderPrimitiveType::Model;
|
|
||||||
buffer.shader = "gouraud_light_instanced";
|
|
||||||
buffer.model.model.init_from(diamond(16));
|
|
||||||
buffer.model.color = option_color(type);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
buffer.render_primitive_type = TBuffer::ERenderPrimitiveType::Point;
|
|
||||||
buffer.vertices.format = VBuffer::EFormat::Position;
|
|
||||||
buffer.shader = wxGetApp().is_glsl_version_greater_or_equal_to(1, 20) ? "options_120" : "options_110";
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case EMoveType::Wipe:
|
|
||||||
case EMoveType::Extrude: {
|
|
||||||
buffer.shader = "gouraud_light";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case EMoveType::Travel: {
|
|
||||||
buffer.shader = "toolpaths_lines";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// initializes tool marker
|
|
||||||
m_sequential_view.marker.init();
|
|
||||||
|
|
||||||
// initializes point sizes
|
|
||||||
std::array<int, 2> point_sizes;
|
|
||||||
::glGetIntegerv(GL_ALIASED_POINT_SIZE_RANGE, point_sizes.data());
|
|
||||||
m_detected_point_sizes = { static_cast<float>(point_sizes[0]), static_cast<float>(point_sizes[1]) };
|
|
||||||
m_gl_data_initialized = true;
|
|
||||||
};
|
|
||||||
#endif // !ENABLE_SEAMS_USING_MODELS
|
|
||||||
|
|
||||||
#if ENABLE_GCODE_VIEWER_STATISTICS
|
#if ENABLE_GCODE_VIEWER_STATISTICS
|
||||||
m_statistics.reset_opengl();
|
m_statistics.reset_opengl();
|
||||||
#if ENABLE_SEAMS_USING_MODELS
|
|
||||||
m_statistics.total_instances_gpu_size = 0;
|
m_statistics.total_instances_gpu_size = 0;
|
||||||
#endif // ENABLE_SEAMS_USING_MODELS
|
|
||||||
#endif // ENABLE_GCODE_VIEWER_STATISTICS
|
#endif // ENABLE_GCODE_VIEWER_STATISTICS
|
||||||
|
|
||||||
#if !ENABLE_SEAMS_USING_MODELS
|
|
||||||
// OpenGL data must be initialized after the glContext has been created.
|
|
||||||
// This is ensured when this method is called by GLCanvas3D::_render_gcode().
|
|
||||||
if (!m_gl_data_initialized)
|
|
||||||
init_gl_data();
|
|
||||||
#endif // !ENABLE_SEAMS_USING_MODELS
|
|
||||||
|
|
||||||
if (m_roles.empty())
|
if (m_roles.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -1501,7 +1396,6 @@ void GCodeViewer::load_toolpaths(const GCodeProcessorResult& gcode_result)
|
|||||||
sq_prev_length = sq_length;
|
sq_prev_length = sq_length;
|
||||||
};
|
};
|
||||||
|
|
||||||
#if ENABLE_SEAMS_USING_MODELS
|
|
||||||
// format data into the buffers to be rendered as instanced model
|
// format data into the buffers to be rendered as instanced model
|
||||||
auto add_model_instance = [](const GCodeProcessorResult::MoveVertex& curr, InstanceBuffer& instances, InstanceIdBuffer& instances_ids, size_t move_id) {
|
auto add_model_instance = [](const GCodeProcessorResult::MoveVertex& curr, InstanceBuffer& instances, InstanceIdBuffer& instances_ids, size_t move_id) {
|
||||||
// append position
|
// append position
|
||||||
@ -1559,7 +1453,6 @@ void GCodeViewer::load_toolpaths(const GCodeProcessorResult& gcode_result)
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
#endif // ENABLE_SEAMS_USING_BATCHED_MODELS
|
#endif // ENABLE_SEAMS_USING_BATCHED_MODELS
|
||||||
#endif // ENABLE_SEAMS_USING_MODELS
|
|
||||||
|
|
||||||
#if ENABLE_GCODE_VIEWER_STATISTICS
|
#if ENABLE_GCODE_VIEWER_STATISTICS
|
||||||
auto start_time = std::chrono::high_resolution_clock::now();
|
auto start_time = std::chrono::high_resolution_clock::now();
|
||||||
@ -1614,10 +1507,8 @@ void GCodeViewer::load_toolpaths(const GCodeProcessorResult& gcode_result)
|
|||||||
|
|
||||||
std::vector<MultiVertexBuffer> vertices(m_buffers.size());
|
std::vector<MultiVertexBuffer> vertices(m_buffers.size());
|
||||||
std::vector<MultiIndexBuffer> indices(m_buffers.size());
|
std::vector<MultiIndexBuffer> indices(m_buffers.size());
|
||||||
#if ENABLE_SEAMS_USING_MODELS
|
|
||||||
std::vector<InstanceBuffer> instances(m_buffers.size());
|
std::vector<InstanceBuffer> instances(m_buffers.size());
|
||||||
std::vector<InstanceIdBuffer> instances_ids(m_buffers.size());
|
std::vector<InstanceIdBuffer> instances_ids(m_buffers.size());
|
||||||
#endif // ENABLE_SEAMS_USING_MODELS
|
|
||||||
#if ENABLE_FIX_SEAMS_SYNCH
|
#if ENABLE_FIX_SEAMS_SYNCH
|
||||||
std::vector<InstancesOffsets> instances_offsets(m_buffers.size());
|
std::vector<InstancesOffsets> instances_offsets(m_buffers.size());
|
||||||
#endif // ENABLE_FIX_SEAMS_SYNCH
|
#endif // ENABLE_FIX_SEAMS_SYNCH
|
||||||
@ -1658,13 +1549,11 @@ void GCodeViewer::load_toolpaths(const GCodeProcessorResult& gcode_result)
|
|||||||
const unsigned char id = buffer_id(curr.type);
|
const unsigned char id = buffer_id(curr.type);
|
||||||
TBuffer& t_buffer = m_buffers[id];
|
TBuffer& t_buffer = m_buffers[id];
|
||||||
MultiVertexBuffer& v_multibuffer = vertices[id];
|
MultiVertexBuffer& v_multibuffer = vertices[id];
|
||||||
#if ENABLE_SEAMS_USING_MODELS
|
|
||||||
InstanceBuffer& inst_buffer = instances[id];
|
InstanceBuffer& inst_buffer = instances[id];
|
||||||
InstanceIdBuffer& inst_id_buffer = instances_ids[id];
|
InstanceIdBuffer& inst_id_buffer = instances_ids[id];
|
||||||
#if ENABLE_FIX_SEAMS_SYNCH
|
#if ENABLE_FIX_SEAMS_SYNCH
|
||||||
InstancesOffsets& inst_offsets = instances_offsets[id];
|
InstancesOffsets& inst_offsets = instances_offsets[id];
|
||||||
#endif // ENABLE_FIX_SEAMS_SYNCH
|
#endif // ENABLE_FIX_SEAMS_SYNCH
|
||||||
#endif // ENABLE_SEAMS_USING_MODELS
|
|
||||||
|
|
||||||
// ensure there is at least one vertex buffer
|
// ensure there is at least one vertex buffer
|
||||||
if (v_multibuffer.empty())
|
if (v_multibuffer.empty())
|
||||||
@ -1701,7 +1590,6 @@ void GCodeViewer::load_toolpaths(const GCodeProcessorResult& gcode_result)
|
|||||||
#else
|
#else
|
||||||
case TBuffer::ERenderPrimitiveType::Triangle: { add_vertices_as_solid(prev, curr, t_buffer, static_cast<unsigned int>(v_multibuffer.size()) - 1, v_buffer, i); break; }
|
case TBuffer::ERenderPrimitiveType::Triangle: { add_vertices_as_solid(prev, curr, t_buffer, static_cast<unsigned int>(v_multibuffer.size()) - 1, v_buffer, i); break; }
|
||||||
#endif // ENABLE_FIX_SEAMS_SYNCH
|
#endif // ENABLE_FIX_SEAMS_SYNCH
|
||||||
#if ENABLE_SEAMS_USING_MODELS
|
|
||||||
#if ENABLE_SEAMS_USING_BATCHED_MODELS
|
#if ENABLE_SEAMS_USING_BATCHED_MODELS
|
||||||
case TBuffer::ERenderPrimitiveType::InstancedModel:
|
case TBuffer::ERenderPrimitiveType::InstancedModel:
|
||||||
{
|
{
|
||||||
@ -1742,7 +1630,6 @@ void GCodeViewer::load_toolpaths(const GCodeProcessorResult& gcode_result)
|
|||||||
#endif // ENABLE_GCODE_VIEWER_STATISTICS
|
#endif // ENABLE_GCODE_VIEWER_STATISTICS
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif // ENABLE_SEAMS_USING_MODELS
|
|
||||||
#endif // ENABLE_SEAMS_USING_BATCHED_MODELS
|
#endif // ENABLE_SEAMS_USING_BATCHED_MODELS
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1951,7 +1838,6 @@ void GCodeViewer::load_toolpaths(const GCodeProcessorResult& gcode_result)
|
|||||||
// send vertices data to gpu, where needed
|
// send vertices data to gpu, where needed
|
||||||
for (size_t i = 0; i < m_buffers.size(); ++i) {
|
for (size_t i = 0; i < m_buffers.size(); ++i) {
|
||||||
TBuffer& t_buffer = m_buffers[i];
|
TBuffer& t_buffer = m_buffers[i];
|
||||||
#if ENABLE_SEAMS_USING_MODELS
|
|
||||||
#if ENABLE_SEAMS_USING_BATCHED_MODELS
|
#if ENABLE_SEAMS_USING_BATCHED_MODELS
|
||||||
if (t_buffer.render_primitive_type == TBuffer::ERenderPrimitiveType::InstancedModel) {
|
if (t_buffer.render_primitive_type == TBuffer::ERenderPrimitiveType::InstancedModel) {
|
||||||
const InstanceBuffer& inst_buffer = instances[i];
|
const InstanceBuffer& inst_buffer = instances[i];
|
||||||
@ -1987,7 +1873,6 @@ void GCodeViewer::load_toolpaths(const GCodeProcessorResult& gcode_result)
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
#endif // ENABLE_SEAMS_USING_BATCHED_MODELS
|
#endif // ENABLE_SEAMS_USING_BATCHED_MODELS
|
||||||
#endif // ENABLE_SEAMS_USING_MODELS
|
|
||||||
const MultiVertexBuffer& v_multibuffer = vertices[i];
|
const MultiVertexBuffer& v_multibuffer = vertices[i];
|
||||||
for (const VertexBuffer& v_buffer : v_multibuffer) {
|
for (const VertexBuffer& v_buffer : v_multibuffer) {
|
||||||
const size_t size_elements = v_buffer.size();
|
const size_t size_elements = v_buffer.size();
|
||||||
@ -2010,9 +1895,7 @@ void GCodeViewer::load_toolpaths(const GCodeProcessorResult& gcode_result)
|
|||||||
t_buffer.vertices.vbos.push_back(static_cast<unsigned int>(id));
|
t_buffer.vertices.vbos.push_back(static_cast<unsigned int>(id));
|
||||||
t_buffer.vertices.sizes.push_back(size_bytes);
|
t_buffer.vertices.sizes.push_back(size_bytes);
|
||||||
}
|
}
|
||||||
#if ENABLE_SEAMS_USING_MODELS
|
|
||||||
}
|
}
|
||||||
#endif // ENABLE_SEAMS_USING_MODELS
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLE_GCODE_VIEWER_STATISTICS
|
#if ENABLE_GCODE_VIEWER_STATISTICS
|
||||||
@ -2023,10 +1906,8 @@ void GCodeViewer::load_toolpaths(const GCodeProcessorResult& gcode_result)
|
|||||||
|
|
||||||
// dismiss vertices data, no more needed
|
// dismiss vertices data, no more needed
|
||||||
std::vector<MultiVertexBuffer>().swap(vertices);
|
std::vector<MultiVertexBuffer>().swap(vertices);
|
||||||
#if ENABLE_SEAMS_USING_MODELS
|
|
||||||
std::vector<InstanceBuffer>().swap(instances);
|
std::vector<InstanceBuffer>().swap(instances);
|
||||||
std::vector<InstanceIdBuffer>().swap(instances_ids);
|
std::vector<InstanceIdBuffer>().swap(instances_ids);
|
||||||
#endif // ENABLE_SEAMS_USING_MODELS
|
|
||||||
|
|
||||||
// toolpaths data -> extract indices from result
|
// toolpaths data -> extract indices from result
|
||||||
// paths may have been filled while extracting vertices,
|
// paths may have been filled while extracting vertices,
|
||||||
@ -2082,9 +1963,7 @@ void GCodeViewer::load_toolpaths(const GCodeProcessorResult& gcode_result)
|
|||||||
// ensure there is at least one index buffer
|
// ensure there is at least one index buffer
|
||||||
if (i_multibuffer.empty()) {
|
if (i_multibuffer.empty()) {
|
||||||
i_multibuffer.push_back(IndexBuffer());
|
i_multibuffer.push_back(IndexBuffer());
|
||||||
#if ENABLE_SEAMS_USING_MODELS
|
|
||||||
if (!t_buffer.vertices.vbos.empty())
|
if (!t_buffer.vertices.vbos.empty())
|
||||||
#endif // ENABLE_SEAMS_USING_MODELS
|
|
||||||
vbo_index_list.push_back(t_buffer.vertices.vbos[curr_vertex_buffer.first]);
|
vbo_index_list.push_back(t_buffer.vertices.vbos[curr_vertex_buffer.first]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2192,13 +2071,11 @@ void GCodeViewer::load_toolpaths(const GCodeProcessorResult& gcode_result)
|
|||||||
// toolpaths data -> send indices data to gpu
|
// toolpaths data -> send indices data to gpu
|
||||||
for (size_t i = 0; i < m_buffers.size(); ++i) {
|
for (size_t i = 0; i < m_buffers.size(); ++i) {
|
||||||
TBuffer& t_buffer = m_buffers[i];
|
TBuffer& t_buffer = m_buffers[i];
|
||||||
#if ENABLE_SEAMS_USING_MODELS
|
|
||||||
#if ENABLE_SEAMS_USING_BATCHED_MODELS
|
#if ENABLE_SEAMS_USING_BATCHED_MODELS
|
||||||
if (t_buffer.render_primitive_type != TBuffer::ERenderPrimitiveType::InstancedModel) {
|
if (t_buffer.render_primitive_type != TBuffer::ERenderPrimitiveType::InstancedModel) {
|
||||||
#else
|
#else
|
||||||
if (t_buffer.render_primitive_type != TBuffer::ERenderPrimitiveType::Model) {
|
if (t_buffer.render_primitive_type != TBuffer::ERenderPrimitiveType::Model) {
|
||||||
#endif // ENABLE_SEAMS_USING_BATCHED_MODELS
|
#endif // ENABLE_SEAMS_USING_BATCHED_MODELS
|
||||||
#endif // ENABLE_SEAMS_USING_MODELS
|
|
||||||
const MultiIndexBuffer& i_multibuffer = indices[i];
|
const MultiIndexBuffer& i_multibuffer = indices[i];
|
||||||
for (const IndexBuffer& i_buffer : i_multibuffer) {
|
for (const IndexBuffer& i_buffer : i_multibuffer) {
|
||||||
const size_t size_elements = i_buffer.size();
|
const size_t size_elements = i_buffer.size();
|
||||||
@ -2221,9 +2098,7 @@ void GCodeViewer::load_toolpaths(const GCodeProcessorResult& gcode_result)
|
|||||||
glsafe(::glBufferData(GL_ELEMENT_ARRAY_BUFFER, size_bytes, i_buffer.data(), GL_STATIC_DRAW));
|
glsafe(::glBufferData(GL_ELEMENT_ARRAY_BUFFER, size_bytes, i_buffer.data(), GL_STATIC_DRAW));
|
||||||
glsafe(::glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0));
|
glsafe(::glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0));
|
||||||
}
|
}
|
||||||
#if ENABLE_SEAMS_USING_MODELS
|
|
||||||
}
|
}
|
||||||
#endif // ENABLE_SEAMS_USING_MODELS
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (progress_dialog != nullptr) {
|
if (progress_dialog != nullptr) {
|
||||||
@ -2474,9 +2349,7 @@ void GCodeViewer::refresh_render_paths(bool keep_sequential_current_first, bool
|
|||||||
#if ENABLE_GCODE_VIEWER_STATISTICS
|
#if ENABLE_GCODE_VIEWER_STATISTICS
|
||||||
Statistics* statistics = const_cast<Statistics*>(&m_statistics);
|
Statistics* statistics = const_cast<Statistics*>(&m_statistics);
|
||||||
statistics->render_paths_size = 0;
|
statistics->render_paths_size = 0;
|
||||||
#if ENABLE_SEAMS_USING_MODELS
|
|
||||||
statistics->models_instances_size = 0;
|
statistics->models_instances_size = 0;
|
||||||
#endif // ENABLE_SEAMS_USING_MODELS
|
|
||||||
#endif // ENABLE_GCODE_VIEWER_STATISTICS
|
#endif // ENABLE_GCODE_VIEWER_STATISTICS
|
||||||
|
|
||||||
const bool top_layer_only = get_app_config()->get("seq_top_layer_only") == "1";
|
const bool top_layer_only = get_app_config()->get("seq_top_layer_only") == "1";
|
||||||
@ -2497,7 +2370,6 @@ void GCodeViewer::refresh_render_paths(bool keep_sequential_current_first, bool
|
|||||||
if (!buffer.visible)
|
if (!buffer.visible)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
#if ENABLE_SEAMS_USING_MODELS
|
|
||||||
#if ENABLE_SEAMS_USING_BATCHED_MODELS
|
#if ENABLE_SEAMS_USING_BATCHED_MODELS
|
||||||
if (buffer.render_primitive_type == TBuffer::ERenderPrimitiveType::InstancedModel ||
|
if (buffer.render_primitive_type == TBuffer::ERenderPrimitiveType::InstancedModel ||
|
||||||
buffer.render_primitive_type == TBuffer::ERenderPrimitiveType::BatchedModel) {
|
buffer.render_primitive_type == TBuffer::ERenderPrimitiveType::BatchedModel) {
|
||||||
@ -2521,7 +2393,6 @@ void GCodeViewer::refresh_render_paths(bool keep_sequential_current_first, bool
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
#endif // ENABLE_SEAMS_USING_MODELS
|
|
||||||
for (size_t i = 0; i < buffer.paths.size(); ++i) {
|
for (size_t i = 0; i < buffer.paths.size(); ++i) {
|
||||||
const Path& path = buffer.paths[i];
|
const Path& path = buffer.paths[i];
|
||||||
if (path.type == EMoveType::Travel) {
|
if (path.type == EMoveType::Travel) {
|
||||||
@ -2555,9 +2426,7 @@ void GCodeViewer::refresh_render_paths(bool keep_sequential_current_first, bool
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if ENABLE_SEAMS_USING_MODELS
|
|
||||||
}
|
}
|
||||||
#endif // ENABLE_SEAMS_USING_MODELS
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// update current sequential position
|
// update current sequential position
|
||||||
@ -2567,7 +2436,6 @@ void GCodeViewer::refresh_render_paths(bool keep_sequential_current_first, bool
|
|||||||
// get the world position from the vertex buffer
|
// get the world position from the vertex buffer
|
||||||
bool found = false;
|
bool found = false;
|
||||||
for (const TBuffer& buffer : m_buffers) {
|
for (const TBuffer& buffer : m_buffers) {
|
||||||
#if ENABLE_SEAMS_USING_MODELS
|
|
||||||
#if ENABLE_SEAMS_USING_BATCHED_MODELS
|
#if ENABLE_SEAMS_USING_BATCHED_MODELS
|
||||||
if (buffer.render_primitive_type == TBuffer::ERenderPrimitiveType::InstancedModel ||
|
if (buffer.render_primitive_type == TBuffer::ERenderPrimitiveType::InstancedModel ||
|
||||||
buffer.render_primitive_type == TBuffer::ERenderPrimitiveType::BatchedModel) {
|
buffer.render_primitive_type == TBuffer::ERenderPrimitiveType::BatchedModel) {
|
||||||
@ -2590,7 +2458,6 @@ void GCodeViewer::refresh_render_paths(bool keep_sequential_current_first, bool
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
#endif // ENABLE_SEAMS_USING_MODELS
|
|
||||||
// searches the path containing the current position
|
// searches the path containing the current position
|
||||||
for (const Path& path : buffer.paths) {
|
for (const Path& path : buffer.paths) {
|
||||||
if (path.contains(m_sequential_view.current.last)) {
|
if (path.contains(m_sequential_view.current.last)) {
|
||||||
@ -2631,9 +2498,7 @@ void GCodeViewer::refresh_render_paths(bool keep_sequential_current_first, bool
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if ENABLE_SEAMS_USING_MODELS
|
|
||||||
}
|
}
|
||||||
#endif // ENABLE_SEAMS_USING_MODELS
|
|
||||||
|
|
||||||
if (found)
|
if (found)
|
||||||
break;
|
break;
|
||||||
@ -2740,7 +2605,6 @@ void GCodeViewer::refresh_render_paths(bool keep_sequential_current_first, bool
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLE_SEAMS_USING_MODELS
|
|
||||||
#if ENABLE_SEAMS_USING_BATCHED_MODELS
|
#if ENABLE_SEAMS_USING_BATCHED_MODELS
|
||||||
// second pass: for buffers using instanced and batched models, update the instances render ranges
|
// second pass: for buffers using instanced and batched models, update the instances render ranges
|
||||||
#else
|
#else
|
||||||
@ -2796,14 +2660,11 @@ void GCodeViewer::refresh_render_paths(bool keep_sequential_current_first, bool
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // ENABLE_SEAMS_USING_MODELS
|
|
||||||
|
|
||||||
// set sequential data to their final value
|
// set sequential data to their final value
|
||||||
sequential_view->endpoints = top_layer_only ? top_layer_endpoints : global_endpoints;
|
sequential_view->endpoints = top_layer_only ? top_layer_endpoints : global_endpoints;
|
||||||
sequential_view->current.first = !top_layer_only && keep_sequential_current_first ? std::clamp(sequential_view->current.first, sequential_view->endpoints.first, sequential_view->endpoints.last) : sequential_view->endpoints.first;
|
sequential_view->current.first = !top_layer_only && keep_sequential_current_first ? std::clamp(sequential_view->current.first, sequential_view->endpoints.first, sequential_view->endpoints.last) : sequential_view->endpoints.first;
|
||||||
#if ENABLE_SEAMS_USING_MODELS
|
|
||||||
sequential_view->global = global_endpoints;
|
sequential_view->global = global_endpoints;
|
||||||
#endif // ENABLE_SEAMS_USING_MODELS
|
|
||||||
|
|
||||||
// updates sequential range caps
|
// updates sequential range caps
|
||||||
std::array<SequentialRangeCap, 2>* sequential_range_caps = const_cast<std::array<SequentialRangeCap, 2>*>(&m_sequential_range_caps);
|
std::array<SequentialRangeCap, 2>* sequential_range_caps = const_cast<std::array<SequentialRangeCap, 2>*>(&m_sequential_range_caps);
|
||||||
@ -2925,11 +2786,9 @@ void GCodeViewer::refresh_render_paths(bool keep_sequential_current_first, bool
|
|||||||
statistics->render_paths_size += SLIC3R_STDVEC_MEMSIZE(path.sizes, unsigned int);
|
statistics->render_paths_size += SLIC3R_STDVEC_MEMSIZE(path.sizes, unsigned int);
|
||||||
statistics->render_paths_size += SLIC3R_STDVEC_MEMSIZE(path.offsets, size_t);
|
statistics->render_paths_size += SLIC3R_STDVEC_MEMSIZE(path.offsets, size_t);
|
||||||
}
|
}
|
||||||
#if ENABLE_SEAMS_USING_MODELS
|
|
||||||
statistics->models_instances_size += SLIC3R_STDVEC_MEMSIZE(buffer.model.instances.buffer, float);
|
statistics->models_instances_size += SLIC3R_STDVEC_MEMSIZE(buffer.model.instances.buffer, float);
|
||||||
statistics->models_instances_size += SLIC3R_STDVEC_MEMSIZE(buffer.model.instances.s_ids, size_t);
|
statistics->models_instances_size += SLIC3R_STDVEC_MEMSIZE(buffer.model.instances.s_ids, size_t);
|
||||||
statistics->models_instances_size += SLIC3R_STDVEC_MEMSIZE(buffer.model.instances.render_ranges.ranges, InstanceVBuffer::Ranges::Range);
|
statistics->models_instances_size += SLIC3R_STDVEC_MEMSIZE(buffer.model.instances.render_ranges.ranges, InstanceVBuffer::Ranges::Range);
|
||||||
#endif // ENABLE_SEAMS_USING_MODELS
|
|
||||||
}
|
}
|
||||||
statistics->refresh_paths_time = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::high_resolution_clock::now() - start_time).count();
|
statistics->refresh_paths_time = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::high_resolution_clock::now() - start_time).count();
|
||||||
#endif // ENABLE_GCODE_VIEWER_STATISTICS
|
#endif // ENABLE_GCODE_VIEWER_STATISTICS
|
||||||
@ -3018,7 +2877,6 @@ void GCodeViewer::render_toolpaths()
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#if ENABLE_SEAMS_USING_MODELS
|
|
||||||
#if ENABLE_GCODE_VIEWER_STATISTICS
|
#if ENABLE_GCODE_VIEWER_STATISTICS
|
||||||
auto render_as_instanced_model = [this]
|
auto render_as_instanced_model = [this]
|
||||||
#else
|
#else
|
||||||
@ -3103,7 +2961,6 @@ void GCodeViewer::render_toolpaths()
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
#endif // ENABLE_SEAMS_USING_BATCHED_MODELS
|
#endif // ENABLE_SEAMS_USING_BATCHED_MODELS
|
||||||
#endif // ENABLE_SEAMS_USING_MODELS
|
|
||||||
|
|
||||||
auto line_width = [](double zoom) {
|
auto line_width = [](double zoom) {
|
||||||
return (zoom < 5.0) ? 1.0 : (1.0 + 5.0 * (zoom - 5.0) / (100.0 - 5.0));
|
return (zoom < 5.0) ? 1.0 : (1.0 + 5.0 * (zoom - 5.0) / (100.0 - 5.0));
|
||||||
@ -3113,11 +2970,7 @@ void GCodeViewer::render_toolpaths()
|
|||||||
unsigned char end_id = buffer_id(EMoveType::Count);
|
unsigned char end_id = buffer_id(EMoveType::Count);
|
||||||
|
|
||||||
for (unsigned char i = begin_id; i < end_id; ++i) {
|
for (unsigned char i = begin_id; i < end_id; ++i) {
|
||||||
#if ENABLE_SEAMS_USING_MODELS
|
|
||||||
TBuffer& buffer = m_buffers[i];
|
TBuffer& buffer = m_buffers[i];
|
||||||
#else
|
|
||||||
const TBuffer& buffer = m_buffers[i];
|
|
||||||
#endif // ENABLE_SEAMS_USING_MODELS
|
|
||||||
if (!buffer.visible || !buffer.has_data())
|
if (!buffer.visible || !buffer.has_data())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -3125,7 +2978,6 @@ void GCodeViewer::render_toolpaths()
|
|||||||
if (shader != nullptr) {
|
if (shader != nullptr) {
|
||||||
shader->start_using();
|
shader->start_using();
|
||||||
|
|
||||||
#if ENABLE_SEAMS_USING_MODELS
|
|
||||||
#if ENABLE_SEAMS_USING_BATCHED_MODELS
|
#if ENABLE_SEAMS_USING_BATCHED_MODELS
|
||||||
if (buffer.render_primitive_type == TBuffer::ERenderPrimitiveType::InstancedModel) {
|
if (buffer.render_primitive_type == TBuffer::ERenderPrimitiveType::InstancedModel) {
|
||||||
#else
|
#else
|
||||||
@ -3143,7 +2995,6 @@ void GCodeViewer::render_toolpaths()
|
|||||||
}
|
}
|
||||||
#endif // ENABLE_SEAMS_USING_BATCHED_MODELS
|
#endif // ENABLE_SEAMS_USING_BATCHED_MODELS
|
||||||
else {
|
else {
|
||||||
#endif // ENABLE_SEAMS_USING_MODELS
|
|
||||||
for (size_t j = 0; j < buffer.indices.size(); ++j) {
|
for (size_t j = 0; j < buffer.indices.size(); ++j) {
|
||||||
const IBuffer& i_buffer = buffer.indices[j];
|
const IBuffer& i_buffer = buffer.indices[j];
|
||||||
|
|
||||||
@ -3184,9 +3035,7 @@ void GCodeViewer::render_toolpaths()
|
|||||||
glsafe(::glDisableClientState(GL_VERTEX_ARRAY));
|
glsafe(::glDisableClientState(GL_VERTEX_ARRAY));
|
||||||
glsafe(::glBindBuffer(GL_ARRAY_BUFFER, 0));
|
glsafe(::glBindBuffer(GL_ARRAY_BUFFER, 0));
|
||||||
}
|
}
|
||||||
#if ENABLE_SEAMS_USING_MODELS
|
|
||||||
}
|
}
|
||||||
#endif // ENABLE_SEAMS_USING_MODELS
|
|
||||||
|
|
||||||
shader->stop_using();
|
shader->stop_using();
|
||||||
}
|
}
|
||||||
@ -4198,13 +4047,11 @@ void GCodeViewer::render_statistics()
|
|||||||
add_counter(std::string("Multi GL_LINES:"), m_statistics.gl_multi_lines_calls_count);
|
add_counter(std::string("Multi GL_LINES:"), m_statistics.gl_multi_lines_calls_count);
|
||||||
add_counter(std::string("Multi GL_TRIANGLES:"), m_statistics.gl_multi_triangles_calls_count);
|
add_counter(std::string("Multi GL_TRIANGLES:"), m_statistics.gl_multi_triangles_calls_count);
|
||||||
add_counter(std::string("GL_TRIANGLES:"), m_statistics.gl_triangles_calls_count);
|
add_counter(std::string("GL_TRIANGLES:"), m_statistics.gl_triangles_calls_count);
|
||||||
#if ENABLE_SEAMS_USING_MODELS
|
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
add_counter(std::string("Instanced models:"), m_statistics.gl_instanced_models_calls_count);
|
add_counter(std::string("Instanced models:"), m_statistics.gl_instanced_models_calls_count);
|
||||||
#if ENABLE_SEAMS_USING_BATCHED_MODELS
|
#if ENABLE_SEAMS_USING_BATCHED_MODELS
|
||||||
add_counter(std::string("Batched models:"), m_statistics.gl_batched_models_calls_count);
|
add_counter(std::string("Batched models:"), m_statistics.gl_batched_models_calls_count);
|
||||||
#endif // ENABLE_SEAMS_USING_BATCHED_MODELS
|
#endif // ENABLE_SEAMS_USING_BATCHED_MODELS
|
||||||
#endif // ENABLE_SEAMS_USING_MODELS
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ImGui::CollapsingHeader("CPU memory")) {
|
if (ImGui::CollapsingHeader("CPU memory")) {
|
||||||
@ -4213,17 +4060,13 @@ void GCodeViewer::render_statistics()
|
|||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
add_memory(std::string("Paths:"), m_statistics.paths_size);
|
add_memory(std::string("Paths:"), m_statistics.paths_size);
|
||||||
add_memory(std::string("Render paths:"), m_statistics.render_paths_size);
|
add_memory(std::string("Render paths:"), m_statistics.render_paths_size);
|
||||||
#if ENABLE_SEAMS_USING_MODELS
|
|
||||||
add_memory(std::string("Models instances:"), m_statistics.models_instances_size);
|
add_memory(std::string("Models instances:"), m_statistics.models_instances_size);
|
||||||
#endif // ENABLE_SEAMS_USING_MODELS
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ImGui::CollapsingHeader("GPU memory")) {
|
if (ImGui::CollapsingHeader("GPU memory")) {
|
||||||
add_memory(std::string("Vertices:"), m_statistics.total_vertices_gpu_size);
|
add_memory(std::string("Vertices:"), m_statistics.total_vertices_gpu_size);
|
||||||
add_memory(std::string("Indices:"), m_statistics.total_indices_gpu_size);
|
add_memory(std::string("Indices:"), m_statistics.total_indices_gpu_size);
|
||||||
#if ENABLE_SEAMS_USING_MODELS
|
|
||||||
add_memory(std::string("Instances:"), m_statistics.total_instances_gpu_size);
|
add_memory(std::string("Instances:"), m_statistics.total_instances_gpu_size);
|
||||||
#endif // ENABLE_SEAMS_USING_MODELS
|
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
add_memory(std::string("Max VBuffer:"), m_statistics.max_vbuffer_gpu_size);
|
add_memory(std::string("Max VBuffer:"), m_statistics.max_vbuffer_gpu_size);
|
||||||
add_memory(std::string("Max IBuffer:"), m_statistics.max_ibuffer_gpu_size);
|
add_memory(std::string("Max IBuffer:"), m_statistics.max_ibuffer_gpu_size);
|
||||||
@ -4233,12 +4076,10 @@ void GCodeViewer::render_statistics()
|
|||||||
add_counter(std::string("Travel segments count:"), m_statistics.travel_segments_count);
|
add_counter(std::string("Travel segments count:"), m_statistics.travel_segments_count);
|
||||||
add_counter(std::string("Wipe segments count:"), m_statistics.wipe_segments_count);
|
add_counter(std::string("Wipe segments count:"), m_statistics.wipe_segments_count);
|
||||||
add_counter(std::string("Extrude segments count:"), m_statistics.extrude_segments_count);
|
add_counter(std::string("Extrude segments count:"), m_statistics.extrude_segments_count);
|
||||||
#if ENABLE_SEAMS_USING_MODELS
|
|
||||||
add_counter(std::string("Instances count:"), m_statistics.instances_count);
|
add_counter(std::string("Instances count:"), m_statistics.instances_count);
|
||||||
#if ENABLE_SEAMS_USING_BATCHED_MODELS
|
#if ENABLE_SEAMS_USING_BATCHED_MODELS
|
||||||
add_counter(std::string("Batched count:"), m_statistics.batched_count);
|
add_counter(std::string("Batched count:"), m_statistics.batched_count);
|
||||||
#endif // ENABLE_SEAMS_USING_BATCHED_MODELS
|
#endif // ENABLE_SEAMS_USING_BATCHED_MODELS
|
||||||
#endif // ENABLE_SEAMS_USING_MODELS
|
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
add_counter(std::string("VBuffers count:"), m_statistics.vbuffers_count);
|
add_counter(std::string("VBuffers count:"), m_statistics.vbuffers_count);
|
||||||
add_counter(std::string("IBuffers count:"), m_statistics.ibuffers_count);
|
add_counter(std::string("IBuffers count:"), m_statistics.ibuffers_count);
|
||||||
|
@ -27,10 +27,8 @@ class GCodeViewer
|
|||||||
using MultiVertexBuffer = std::vector<VertexBuffer>;
|
using MultiVertexBuffer = std::vector<VertexBuffer>;
|
||||||
using IndexBuffer = std::vector<IBufferType>;
|
using IndexBuffer = std::vector<IBufferType>;
|
||||||
using MultiIndexBuffer = std::vector<IndexBuffer>;
|
using MultiIndexBuffer = std::vector<IndexBuffer>;
|
||||||
#if ENABLE_SEAMS_USING_MODELS
|
|
||||||
using InstanceBuffer = std::vector<float>;
|
using InstanceBuffer = std::vector<float>;
|
||||||
using InstanceIdBuffer = std::vector<size_t>;
|
using InstanceIdBuffer = std::vector<size_t>;
|
||||||
#endif // ENABLE_SEAMS_USING_MODELS
|
|
||||||
#if ENABLE_FIX_SEAMS_SYNCH
|
#if ENABLE_FIX_SEAMS_SYNCH
|
||||||
using InstancesOffsets = std::vector<Vec3f>;
|
using InstancesOffsets = std::vector<Vec3f>;
|
||||||
#endif // ENABLE_FIX_SEAMS_SYNCH
|
#endif // ENABLE_FIX_SEAMS_SYNCH
|
||||||
@ -107,7 +105,6 @@ class GCodeViewer
|
|||||||
void reset();
|
void reset();
|
||||||
};
|
};
|
||||||
|
|
||||||
#if ENABLE_SEAMS_USING_MODELS
|
|
||||||
#if ENABLE_SEAMS_USING_BATCHED_MODELS
|
#if ENABLE_SEAMS_USING_BATCHED_MODELS
|
||||||
// buffer containing instances data used to render a toolpaths using instanced or batched models
|
// buffer containing instances data used to render a toolpaths using instanced or batched models
|
||||||
// instance record format:
|
// instance record format:
|
||||||
@ -178,7 +175,6 @@ class GCodeViewer
|
|||||||
|
|
||||||
void reset();
|
void reset();
|
||||||
};
|
};
|
||||||
#endif // ENABLE_SEAMS_USING_MODELS
|
|
||||||
|
|
||||||
// ibo buffer containing indices data (for lines/triangles) used to render a specific toolpath type
|
// ibo buffer containing indices data (for lines/triangles) used to render a specific toolpath type
|
||||||
struct IBuffer
|
struct IBuffer
|
||||||
@ -313,7 +309,6 @@ class GCodeViewer
|
|||||||
{
|
{
|
||||||
Point,
|
Point,
|
||||||
Line,
|
Line,
|
||||||
#if ENABLE_SEAMS_USING_MODELS
|
|
||||||
Triangle,
|
Triangle,
|
||||||
#if ENABLE_SEAMS_USING_BATCHED_MODELS
|
#if ENABLE_SEAMS_USING_BATCHED_MODELS
|
||||||
InstancedModel,
|
InstancedModel,
|
||||||
@ -321,9 +316,6 @@ class GCodeViewer
|
|||||||
#else
|
#else
|
||||||
Model
|
Model
|
||||||
#endif // ENABLE_SEAMS_USING_BATCHED_MODELS
|
#endif // ENABLE_SEAMS_USING_BATCHED_MODELS
|
||||||
#else
|
|
||||||
Triangle
|
|
||||||
#endif // ENABLE_SEAMS_USING_MODELS
|
|
||||||
};
|
};
|
||||||
|
|
||||||
ERenderPrimitiveType render_primitive_type;
|
ERenderPrimitiveType render_primitive_type;
|
||||||
@ -332,7 +324,6 @@ class GCodeViewer
|
|||||||
VBuffer vertices;
|
VBuffer vertices;
|
||||||
std::vector<IBuffer> indices;
|
std::vector<IBuffer> indices;
|
||||||
|
|
||||||
#if ENABLE_SEAMS_USING_MODELS
|
|
||||||
struct Model
|
struct Model
|
||||||
{
|
{
|
||||||
GLModel model;
|
GLModel model;
|
||||||
@ -347,7 +338,6 @@ class GCodeViewer
|
|||||||
|
|
||||||
// contain the buffer for model primitive types
|
// contain the buffer for model primitive types
|
||||||
Model model;
|
Model model;
|
||||||
#endif // ENABLE_SEAMS_USING_MODELS
|
|
||||||
|
|
||||||
std::string shader;
|
std::string shader;
|
||||||
std::vector<Path> paths;
|
std::vector<Path> paths;
|
||||||
@ -396,7 +386,6 @@ class GCodeViewer
|
|||||||
}
|
}
|
||||||
size_t max_indices_per_segment_size_bytes() const { return max_indices_per_segment() * sizeof(IBufferType); }
|
size_t max_indices_per_segment_size_bytes() const { return max_indices_per_segment() * sizeof(IBufferType); }
|
||||||
|
|
||||||
#if ENABLE_SEAMS_USING_MODELS
|
|
||||||
bool has_data() const {
|
bool has_data() const {
|
||||||
switch (render_primitive_type)
|
switch (render_primitive_type)
|
||||||
{
|
{
|
||||||
@ -417,11 +406,6 @@ class GCodeViewer
|
|||||||
default: { return false; }
|
default: { return false; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
bool has_data() const {
|
|
||||||
return !vertices.vbos.empty() && vertices.vbos.front() != 0 && !indices.empty() && indices.front().ibo != 0;
|
|
||||||
}
|
|
||||||
#endif // ENABLE_SEAMS_USING_MODELS
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// helper to render shells
|
// helper to render shells
|
||||||
@ -569,36 +553,28 @@ class GCodeViewer
|
|||||||
int64_t gl_multi_lines_calls_count{ 0 };
|
int64_t gl_multi_lines_calls_count{ 0 };
|
||||||
int64_t gl_multi_triangles_calls_count{ 0 };
|
int64_t gl_multi_triangles_calls_count{ 0 };
|
||||||
int64_t gl_triangles_calls_count{ 0 };
|
int64_t gl_triangles_calls_count{ 0 };
|
||||||
#if ENABLE_SEAMS_USING_MODELS
|
|
||||||
int64_t gl_instanced_models_calls_count{ 0 };
|
int64_t gl_instanced_models_calls_count{ 0 };
|
||||||
#if ENABLE_SEAMS_USING_BATCHED_MODELS
|
#if ENABLE_SEAMS_USING_BATCHED_MODELS
|
||||||
int64_t gl_batched_models_calls_count{ 0 };
|
int64_t gl_batched_models_calls_count{ 0 };
|
||||||
#endif // ENABLE_SEAMS_USING_BATCHED_MODELS
|
#endif // ENABLE_SEAMS_USING_BATCHED_MODELS
|
||||||
#endif // ENABLE_SEAMS_USING_MODELS
|
|
||||||
// memory
|
// memory
|
||||||
int64_t results_size{ 0 };
|
int64_t results_size{ 0 };
|
||||||
int64_t total_vertices_gpu_size{ 0 };
|
int64_t total_vertices_gpu_size{ 0 };
|
||||||
int64_t total_indices_gpu_size{ 0 };
|
int64_t total_indices_gpu_size{ 0 };
|
||||||
#if ENABLE_SEAMS_USING_MODELS
|
|
||||||
int64_t total_instances_gpu_size{ 0 };
|
int64_t total_instances_gpu_size{ 0 };
|
||||||
#endif // ENABLE_SEAMS_USING_MODELS
|
|
||||||
int64_t max_vbuffer_gpu_size{ 0 };
|
int64_t max_vbuffer_gpu_size{ 0 };
|
||||||
int64_t max_ibuffer_gpu_size{ 0 };
|
int64_t max_ibuffer_gpu_size{ 0 };
|
||||||
int64_t paths_size{ 0 };
|
int64_t paths_size{ 0 };
|
||||||
int64_t render_paths_size{ 0 };
|
int64_t render_paths_size{ 0 };
|
||||||
#if ENABLE_SEAMS_USING_MODELS
|
|
||||||
int64_t models_instances_size{ 0 };
|
int64_t models_instances_size{ 0 };
|
||||||
#endif // ENABLE_SEAMS_USING_MODELS
|
|
||||||
// other
|
// other
|
||||||
int64_t travel_segments_count{ 0 };
|
int64_t travel_segments_count{ 0 };
|
||||||
int64_t wipe_segments_count{ 0 };
|
int64_t wipe_segments_count{ 0 };
|
||||||
int64_t extrude_segments_count{ 0 };
|
int64_t extrude_segments_count{ 0 };
|
||||||
#if ENABLE_SEAMS_USING_MODELS
|
|
||||||
int64_t instances_count{ 0 };
|
int64_t instances_count{ 0 };
|
||||||
#if ENABLE_SEAMS_USING_BATCHED_MODELS
|
#if ENABLE_SEAMS_USING_BATCHED_MODELS
|
||||||
int64_t batched_count{ 0 };
|
int64_t batched_count{ 0 };
|
||||||
#endif // ENABLE_SEAMS_USING_BATCHED_MODELS
|
#endif // ENABLE_SEAMS_USING_BATCHED_MODELS
|
||||||
#endif // ENABLE_SEAMS_USING_MODELS
|
|
||||||
int64_t vbuffers_count{ 0 };
|
int64_t vbuffers_count{ 0 };
|
||||||
int64_t ibuffers_count{ 0 };
|
int64_t ibuffers_count{ 0 };
|
||||||
|
|
||||||
@ -624,40 +600,32 @@ class GCodeViewer
|
|||||||
gl_multi_lines_calls_count = 0;
|
gl_multi_lines_calls_count = 0;
|
||||||
gl_multi_triangles_calls_count = 0;
|
gl_multi_triangles_calls_count = 0;
|
||||||
gl_triangles_calls_count = 0;
|
gl_triangles_calls_count = 0;
|
||||||
#if ENABLE_SEAMS_USING_MODELS
|
|
||||||
gl_instanced_models_calls_count = 0;
|
gl_instanced_models_calls_count = 0;
|
||||||
#if ENABLE_SEAMS_USING_BATCHED_MODELS
|
#if ENABLE_SEAMS_USING_BATCHED_MODELS
|
||||||
gl_batched_models_calls_count = 0;
|
gl_batched_models_calls_count = 0;
|
||||||
#endif // ENABLE_SEAMS_USING_BATCHED_MODELS
|
#endif // ENABLE_SEAMS_USING_BATCHED_MODELS
|
||||||
#endif // ENABLE_SEAMS_USING_MODELS
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void reset_sizes() {
|
void reset_sizes() {
|
||||||
results_size = 0;
|
results_size = 0;
|
||||||
total_vertices_gpu_size = 0;
|
total_vertices_gpu_size = 0;
|
||||||
total_indices_gpu_size = 0;
|
total_indices_gpu_size = 0;
|
||||||
#if ENABLE_SEAMS_USING_MODELS
|
|
||||||
total_instances_gpu_size = 0;
|
total_instances_gpu_size = 0;
|
||||||
#endif // ENABLE_SEAMS_USING_MODELS
|
|
||||||
max_vbuffer_gpu_size = 0;
|
max_vbuffer_gpu_size = 0;
|
||||||
max_ibuffer_gpu_size = 0;
|
max_ibuffer_gpu_size = 0;
|
||||||
paths_size = 0;
|
paths_size = 0;
|
||||||
render_paths_size = 0;
|
render_paths_size = 0;
|
||||||
#if ENABLE_SEAMS_USING_MODELS
|
|
||||||
models_instances_size = 0;
|
models_instances_size = 0;
|
||||||
#endif // ENABLE_SEAMS_USING_MODELS
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void reset_others() {
|
void reset_others() {
|
||||||
travel_segments_count = 0;
|
travel_segments_count = 0;
|
||||||
wipe_segments_count = 0;
|
wipe_segments_count = 0;
|
||||||
extrude_segments_count = 0;
|
extrude_segments_count = 0;
|
||||||
#if ENABLE_SEAMS_USING_MODELS
|
|
||||||
instances_count = 0;
|
instances_count = 0;
|
||||||
#if ENABLE_SEAMS_USING_BATCHED_MODELS
|
#if ENABLE_SEAMS_USING_BATCHED_MODELS
|
||||||
batched_count = 0;
|
batched_count = 0;
|
||||||
#endif // ENABLE_SEAMS_USING_BATCHED_MODELS
|
#endif // ENABLE_SEAMS_USING_BATCHED_MODELS
|
||||||
#endif // ENABLE_SEAMS_USING_MODELS
|
|
||||||
vbuffers_count = 0;
|
vbuffers_count = 0;
|
||||||
ibuffers_count = 0;
|
ibuffers_count = 0;
|
||||||
}
|
}
|
||||||
@ -743,9 +711,7 @@ public:
|
|||||||
Endpoints endpoints;
|
Endpoints endpoints;
|
||||||
Endpoints current;
|
Endpoints current;
|
||||||
Endpoints last_current;
|
Endpoints last_current;
|
||||||
#if ENABLE_SEAMS_USING_MODELS
|
|
||||||
Endpoints global;
|
Endpoints global;
|
||||||
#endif // ENABLE_SEAMS_USING_MODELS
|
|
||||||
Vec3f current_position{ Vec3f::Zero() };
|
Vec3f current_position{ Vec3f::Zero() };
|
||||||
#if ENABLE_FIX_SEAMS_SYNCH
|
#if ENABLE_FIX_SEAMS_SYNCH
|
||||||
Vec3f current_offset{ Vec3f::Zero() };
|
Vec3f current_offset{ Vec3f::Zero() };
|
||||||
@ -811,9 +777,7 @@ public:
|
|||||||
GCodeViewer();
|
GCodeViewer();
|
||||||
~GCodeViewer() { reset(); }
|
~GCodeViewer() { reset(); }
|
||||||
|
|
||||||
#if ENABLE_SEAMS_USING_MODELS
|
|
||||||
void init();
|
void init();
|
||||||
#endif // ENABLE_SEAMS_USING_MODELS
|
|
||||||
|
|
||||||
// extract rendering data from the given parameters
|
// extract rendering data from the given parameters
|
||||||
void load(const GCodeProcessorResult& gcode_result, const Print& print, bool initialized);
|
void load(const GCodeProcessorResult& gcode_result, const Print& print, bool initialized);
|
||||||
|
@ -1422,10 +1422,8 @@ void GLCanvas3D::render()
|
|||||||
if (!is_initialized() && !init())
|
if (!is_initialized() && !init())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#if ENABLE_SEAMS_USING_MODELS
|
|
||||||
if (!m_main_toolbar.is_enabled())
|
if (!m_main_toolbar.is_enabled())
|
||||||
m_gcode_viewer.init();
|
m_gcode_viewer.init();
|
||||||
#endif // ENABLE_SEAMS_USING_MODELS
|
|
||||||
|
|
||||||
if (! m_bed.build_volume().valid()) {
|
if (! m_bed.build_volume().valid()) {
|
||||||
// this happens at startup when no data is still saved under <>\AppData\Roaming\Slic3rPE
|
// this happens at startup when no data is still saved under <>\AppData\Roaming\Slic3rPE
|
||||||
|
@ -623,9 +623,7 @@ public:
|
|||||||
void reset_volumes();
|
void reset_volumes();
|
||||||
ModelInstanceEPrintVolumeState check_volumes_outside_state() const;
|
ModelInstanceEPrintVolumeState check_volumes_outside_state() const;
|
||||||
|
|
||||||
#if ENABLE_SEAMS_USING_MODELS
|
|
||||||
void init_gcode_viewer() { m_gcode_viewer.init(); }
|
void init_gcode_viewer() { m_gcode_viewer.init(); }
|
||||||
#endif // ENABLE_SEAMS_USING_MODELS
|
|
||||||
void reset_gcode_toolpaths() { m_gcode_viewer.reset(); }
|
void reset_gcode_toolpaths() { m_gcode_viewer.reset(); }
|
||||||
const GCodeViewer::SequentialView& get_gcode_sequential_view() const { return m_gcode_viewer.get_sequential_view(); }
|
const GCodeViewer::SequentialView& get_gcode_sequential_view() const { return m_gcode_viewer.get_sequential_view(); }
|
||||||
void update_gcode_sequential_view_current(unsigned int first, unsigned int last) { m_gcode_viewer.update_sequential_view_current(first, last); }
|
void update_gcode_sequential_view_current(unsigned int first, unsigned int last) { m_gcode_viewer.update_sequential_view_current(first, last); }
|
||||||
|
@ -231,7 +231,6 @@ void GLModel::render() const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLE_SEAMS_USING_MODELS
|
|
||||||
void GLModel::render_instanced(unsigned int instances_vbo, unsigned int instances_count) const
|
void GLModel::render_instanced(unsigned int instances_vbo, unsigned int instances_count) const
|
||||||
{
|
{
|
||||||
if (instances_vbo == 0)
|
if (instances_vbo == 0)
|
||||||
@ -308,7 +307,6 @@ void GLModel::render_instanced(unsigned int instances_vbo, unsigned int instance
|
|||||||
|
|
||||||
glsafe(::glBindBuffer(GL_ARRAY_BUFFER, 0));
|
glsafe(::glBindBuffer(GL_ARRAY_BUFFER, 0));
|
||||||
}
|
}
|
||||||
#endif // ENABLE_SEAMS_USING_MODELS
|
|
||||||
|
|
||||||
void GLModel::send_to_gpu(RenderData& data, const std::vector<float>& vertices, const std::vector<unsigned int>& indices)
|
void GLModel::send_to_gpu(RenderData& data, const std::vector<float>& vertices, const std::vector<unsigned int>& indices)
|
||||||
{
|
{
|
||||||
|
@ -80,9 +80,7 @@ namespace GUI {
|
|||||||
|
|
||||||
void reset();
|
void reset();
|
||||||
void render() const;
|
void render() const;
|
||||||
#if ENABLE_SEAMS_USING_MODELS
|
|
||||||
void render_instanced(unsigned int instances_vbo, unsigned int instances_count) const;
|
void render_instanced(unsigned int instances_vbo, unsigned int instances_count) const;
|
||||||
#endif // ENABLE_SEAMS_USING_MODELS
|
|
||||||
|
|
||||||
bool is_initialized() const { return !m_render_data.empty(); }
|
bool is_initialized() const { return !m_render_data.empty(); }
|
||||||
|
|
||||||
|
@ -46,17 +46,13 @@ std::pair<bool, std::string> GLShadersManager::init()
|
|||||||
if (GUI::wxGetApp().is_gl_version_greater_or_equal_to(3, 3))
|
if (GUI::wxGetApp().is_gl_version_greater_or_equal_to(3, 3))
|
||||||
valid &= append_shader("gouraud_light_instanced", { "gouraud_light_instanced.vs", "gouraud_light_instanced.fs" });
|
valid &= append_shader("gouraud_light_instanced", { "gouraud_light_instanced.vs", "gouraud_light_instanced.fs" });
|
||||||
#else
|
#else
|
||||||
#if ENABLE_SEAMS_USING_MODELS
|
|
||||||
if (GUI::wxGetApp().is_gl_version_greater_or_equal_to(3, 3))
|
if (GUI::wxGetApp().is_gl_version_greater_or_equal_to(3, 3))
|
||||||
valid &= append_shader("gouraud_light_instanced", { "gouraud_light_instanced.vs", "gouraud_light_instanced.fs" });
|
valid &= append_shader("gouraud_light_instanced", { "gouraud_light_instanced.vs", "gouraud_light_instanced.fs" });
|
||||||
else {
|
else {
|
||||||
#endif // ENABLE_SEAMS_USING_MODELS
|
|
||||||
valid &= append_shader("options_110", { "options_110.vs", "options_110.fs" });
|
valid &= append_shader("options_110", { "options_110.vs", "options_110.fs" });
|
||||||
if (GUI::wxGetApp().is_glsl_version_greater_or_equal_to(1, 20))
|
if (GUI::wxGetApp().is_glsl_version_greater_or_equal_to(1, 20))
|
||||||
valid &= append_shader("options_120", { "options_120.vs", "options_120.fs" });
|
valid &= append_shader("options_120", { "options_120.vs", "options_120.fs" });
|
||||||
#if ENABLE_SEAMS_USING_MODELS
|
|
||||||
}
|
}
|
||||||
#endif // ENABLE_SEAMS_USING_MODELS
|
|
||||||
#endif // ENABLE_SEAMS_USING_BATCHED_MODELS
|
#endif // ENABLE_SEAMS_USING_BATCHED_MODELS
|
||||||
// used to render extrusion and travel paths as lines in gcode preview
|
// used to render extrusion and travel paths as lines in gcode preview
|
||||||
valid &= append_shader("toolpaths_lines", { "toolpaths_lines.vs", "toolpaths_lines.fs" });
|
valid &= append_shader("toolpaths_lines", { "toolpaths_lines.vs", "toolpaths_lines.fs" });
|
||||||
|
@ -3904,9 +3904,7 @@ void Plater::priv::set_current_panel(wxPanel* panel)
|
|||||||
bool export_in_progress = this->background_process.is_export_scheduled();
|
bool export_in_progress = this->background_process.is_export_scheduled();
|
||||||
bool model_fits = view3D->get_canvas3d()->check_volumes_outside_state() != ModelInstancePVS_Partly_Outside;
|
bool model_fits = view3D->get_canvas3d()->check_volumes_outside_state() != ModelInstancePVS_Partly_Outside;
|
||||||
if (!model.objects.empty() && !export_in_progress && model_fits) {
|
if (!model.objects.empty() && !export_in_progress && model_fits) {
|
||||||
#if ENABLE_SEAMS_USING_MODELS
|
|
||||||
preview->get_canvas3d()->init_gcode_viewer();
|
preview->get_canvas3d()->init_gcode_viewer();
|
||||||
#endif // ENABLE_SEAMS_USING_MODELS
|
|
||||||
q->reslice();
|
q->reslice();
|
||||||
}
|
}
|
||||||
// keeps current gcode preview, if any
|
// keeps current gcode preview, if any
|
||||||
|
Loading…
Reference in New Issue
Block a user