mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-17 03:37:54 -06:00
1st installment of tech ENABLE_SPLITTED_VERTEX_BUFFER - split vertex buffer when greater than a fixed max size
This commit is contained in:
parent
250adabd5c
commit
fb7dada01d
2 changed files with 1518 additions and 79 deletions
File diff suppressed because it is too large
Load diff
|
@ -21,6 +21,11 @@ class GCodeViewer
|
||||||
{
|
{
|
||||||
using Color = std::array<float, 3>;
|
using Color = std::array<float, 3>;
|
||||||
using VertexBuffer = std::vector<float>;
|
using VertexBuffer = std::vector<float>;
|
||||||
|
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
|
#if ENABLE_SPLITTED_VERTEX_BUFFER
|
||||||
|
using MultiVertexBuffer = std::vector<VertexBuffer>;
|
||||||
|
#endif // ENABLE_SPLITTED_VERTEX_BUFFER
|
||||||
|
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
using IndexBuffer = std::vector<unsigned int>;
|
using IndexBuffer = std::vector<unsigned int>;
|
||||||
using MultiIndexBuffer = std::vector<IndexBuffer>;
|
using MultiIndexBuffer = std::vector<IndexBuffer>;
|
||||||
|
|
||||||
|
@ -40,7 +45,7 @@ class GCodeViewer
|
||||||
CustomGCodes
|
CustomGCodes
|
||||||
};
|
};
|
||||||
|
|
||||||
// vbo buffer containing vertices data used to rendder a specific toolpath type
|
// vbo buffer containing vertices data used to render a specific toolpath type
|
||||||
struct VBuffer
|
struct VBuffer
|
||||||
{
|
{
|
||||||
enum class EFormat : unsigned char
|
enum class EFormat : unsigned char
|
||||||
|
@ -54,8 +59,17 @@ class GCodeViewer
|
||||||
};
|
};
|
||||||
|
|
||||||
EFormat format{ EFormat::Position };
|
EFormat format{ EFormat::Position };
|
||||||
|
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
|
#if ENABLE_SPLITTED_VERTEX_BUFFER
|
||||||
|
// vbos id
|
||||||
|
std::vector<unsigned int> ids;
|
||||||
|
#else
|
||||||
|
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
// vbo id
|
// vbo id
|
||||||
unsigned int id{ 0 };
|
unsigned int id{ 0 };
|
||||||
|
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
|
#endif // ENABLE_SPLITTED_VERTEX_BUFFER
|
||||||
|
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
// count of vertices, updated after data are sent to gpu
|
// count of vertices, updated after data are sent to gpu
|
||||||
size_t count{ 0 };
|
size_t count{ 0 };
|
||||||
|
|
||||||
|
@ -66,8 +80,7 @@ class GCodeViewer
|
||||||
|
|
||||||
size_t position_offset_floats() const { return 0; }
|
size_t position_offset_floats() const { return 0; }
|
||||||
size_t position_offset_size() const { return position_offset_floats() * sizeof(float); }
|
size_t position_offset_size() const { return position_offset_floats() * sizeof(float); }
|
||||||
size_t position_size_floats() const
|
size_t position_size_floats() const {
|
||||||
{
|
|
||||||
switch (format)
|
switch (format)
|
||||||
{
|
{
|
||||||
case EFormat::Position:
|
case EFormat::Position:
|
||||||
|
@ -78,8 +91,7 @@ class GCodeViewer
|
||||||
}
|
}
|
||||||
size_t position_size_bytes() const { return position_size_floats() * sizeof(float); }
|
size_t position_size_bytes() const { return position_size_floats() * sizeof(float); }
|
||||||
|
|
||||||
size_t normal_offset_floats() const
|
size_t normal_offset_floats() const {
|
||||||
{
|
|
||||||
switch (format)
|
switch (format)
|
||||||
{
|
{
|
||||||
case EFormat::Position:
|
case EFormat::Position:
|
||||||
|
@ -103,11 +115,22 @@ class GCodeViewer
|
||||||
void reset();
|
void reset();
|
||||||
};
|
};
|
||||||
|
|
||||||
// ibo buffer containing indices data (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
|
||||||
{
|
{
|
||||||
|
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
|
#if ENABLE_SPLITTED_VERTEX_BUFFER
|
||||||
|
// id of the associated vertex buffer
|
||||||
|
unsigned int vbo{ 0 };
|
||||||
|
// ibo id
|
||||||
|
unsigned int ibo{ 0 };
|
||||||
|
#else
|
||||||
|
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
// ibo id
|
// ibo id
|
||||||
unsigned int id{ 0 };
|
unsigned int id{ 0 };
|
||||||
|
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
|
#endif // ENABLE_SPLITTED_VERTEX_BUFFER
|
||||||
|
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
// count of indices, updated after data are sent to gpu
|
// count of indices, updated after data are sent to gpu
|
||||||
size_t count{ 0 };
|
size_t count{ 0 };
|
||||||
|
|
||||||
|
@ -128,10 +151,30 @@ class GCodeViewer
|
||||||
Vec3f position{ Vec3f::Zero() };
|
Vec3f position{ Vec3f::Zero() };
|
||||||
};
|
};
|
||||||
|
|
||||||
EMoveType type{ EMoveType::Noop };
|
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
ExtrusionRole role{ erNone };
|
#if ENABLE_SPLITTED_VERTEX_BUFFER
|
||||||
|
struct Sub_Path
|
||||||
|
{
|
||||||
Endpoint first;
|
Endpoint first;
|
||||||
Endpoint last;
|
Endpoint last;
|
||||||
|
|
||||||
|
bool contains(size_t s_id) const {
|
||||||
|
return first.s_id <= s_id && s_id <= last.s_id;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
#endif // ENABLE_SPLITTED_VERTEX_BUFFER
|
||||||
|
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
|
|
||||||
|
EMoveType type{ EMoveType::Noop };
|
||||||
|
ExtrusionRole role{ erNone };
|
||||||
|
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
|
#if !ENABLE_SPLITTED_VERTEX_BUFFER
|
||||||
|
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
|
Endpoint first;
|
||||||
|
Endpoint last;
|
||||||
|
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
|
#endif // !ENABLE_SPLITTED_VERTEX_BUFFER
|
||||||
|
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
float delta_extruder{ 0.0f };
|
float delta_extruder{ 0.0f };
|
||||||
float height{ 0.0f };
|
float height{ 0.0f };
|
||||||
float width{ 0.0f };
|
float width{ 0.0f };
|
||||||
|
@ -140,13 +183,46 @@ class GCodeViewer
|
||||||
float volumetric_rate{ 0.0f };
|
float volumetric_rate{ 0.0f };
|
||||||
unsigned char extruder_id{ 0 };
|
unsigned char extruder_id{ 0 };
|
||||||
unsigned char cp_color_id{ 0 };
|
unsigned char cp_color_id{ 0 };
|
||||||
|
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
|
#if ENABLE_SPLITTED_VERTEX_BUFFER
|
||||||
|
std::vector<Sub_Path> sub_paths;
|
||||||
|
#endif // ENABLE_SPLITTED_VERTEX_BUFFER
|
||||||
|
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
|
|
||||||
bool matches(const GCodeProcessor::MoveVertex& move) const;
|
bool matches(const GCodeProcessor::MoveVertex& move) const;
|
||||||
|
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
|
#if ENABLE_SPLITTED_VERTEX_BUFFER
|
||||||
|
size_t vertices_count() const {
|
||||||
|
return sub_paths.empty() ? 0 : sub_paths.back().last.s_id - sub_paths.front().first.s_id + 1;
|
||||||
|
}
|
||||||
|
bool contains(size_t s_id) const {
|
||||||
|
return sub_paths.empty() ? false : sub_paths.front().first.s_id <= s_id && s_id <= sub_paths.back().last.s_id;
|
||||||
|
}
|
||||||
|
int get_id_of_sub_path_containing(size_t s_id) const {
|
||||||
|
if (sub_paths.empty())
|
||||||
|
return -1;
|
||||||
|
else {
|
||||||
|
for (int i = 0; i < static_cast<int>(sub_paths.size()); ++i) {
|
||||||
|
if (sub_paths[i].contains(s_id))
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void add_sub_path(const GCodeProcessor::MoveVertex& move, unsigned int b_id, size_t i_id, size_t s_id) {
|
||||||
|
Endpoint endpoint = { b_id, i_id, s_id, move.position };
|
||||||
|
sub_paths.push_back({ endpoint , endpoint });
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
size_t vertices_count() const { return last.s_id - first.s_id + 1; }
|
size_t vertices_count() const { return last.s_id - first.s_id + 1; }
|
||||||
bool contains(size_t id) const { return first.s_id <= id && id <= last.s_id; }
|
bool contains(size_t id) const { return first.s_id <= id && id <= last.s_id; }
|
||||||
|
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
|
#endif // ENABLE_SPLITTED_VERTEX_BUFFER
|
||||||
|
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
};
|
};
|
||||||
|
|
||||||
// Used to batch the indices needed to render paths
|
// Used to batch the indices needed to render the paths
|
||||||
struct RenderPath
|
struct RenderPath
|
||||||
{
|
{
|
||||||
// Render path property
|
// Render path property
|
||||||
|
@ -202,10 +278,28 @@ class GCodeViewer
|
||||||
bool visible{ false };
|
bool visible{ false };
|
||||||
|
|
||||||
void reset();
|
void reset();
|
||||||
|
|
||||||
// b_id index of buffer contained in this->indices
|
// b_id index of buffer contained in this->indices
|
||||||
// i_id index of first index contained in this->indices[b_id]
|
// i_id index of first index contained in this->indices[b_id]
|
||||||
// s_id index of first vertex contained in this->vertices
|
// s_id index of first vertex contained in this->vertices
|
||||||
void add_path(const GCodeProcessor::MoveVertex& move, unsigned int b_id, size_t i_id, size_t s_id);
|
void add_path(const GCodeProcessor::MoveVertex& move, unsigned int b_id, size_t i_id, size_t s_id);
|
||||||
|
|
||||||
|
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
|
#if ENABLE_SPLITTED_VERTEX_BUFFER
|
||||||
|
unsigned int max_vertices_per_segment() const {
|
||||||
|
switch (render_primitive_type)
|
||||||
|
{
|
||||||
|
case ERenderPrimitiveType::Point: { return 1; }
|
||||||
|
case ERenderPrimitiveType::Line: { return 2; }
|
||||||
|
case ERenderPrimitiveType::Triangle: { return 8; }
|
||||||
|
default: { return 0; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t max_vertices_per_segment_size_floats() const { return vertices.vertex_size_floats() * static_cast<size_t>(max_vertices_per_segment()); }
|
||||||
|
size_t max_vertices_per_segment_size_bytes() const { return max_vertices_per_segment_size_floats() * sizeof(float); }
|
||||||
|
#endif // ENABLE_SPLITTED_VERTEX_BUFFER
|
||||||
|
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
unsigned int indices_per_segment() const {
|
unsigned int indices_per_segment() const {
|
||||||
switch (render_primitive_type)
|
switch (render_primitive_type)
|
||||||
{
|
{
|
||||||
|
@ -215,14 +309,22 @@ class GCodeViewer
|
||||||
default: { return 0; }
|
default: { return 0; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
|
#if ENABLE_SPLITTED_VERTEX_BUFFER
|
||||||
|
size_t indices_per_segment_size_bytes() const { return static_cast<size_t>(indices_per_segment() * sizeof(unsigned int)); }
|
||||||
|
#endif // ENABLE_SPLITTED_VERTEX_BUFFER
|
||||||
|
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
unsigned int start_segment_vertex_offset() const {
|
unsigned int start_segment_vertex_offset() const {
|
||||||
switch (render_primitive_type)
|
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
{
|
return 0;
|
||||||
case ERenderPrimitiveType::Point:
|
// switch (render_primitive_type)
|
||||||
case ERenderPrimitiveType::Line:
|
// {
|
||||||
case ERenderPrimitiveType::Triangle:
|
// case ERenderPrimitiveType::Point:
|
||||||
default: { return 0; }
|
// case ERenderPrimitiveType::Line:
|
||||||
}
|
// case ERenderPrimitiveType::Triangle:
|
||||||
|
// default: { return 0; }
|
||||||
|
// }
|
||||||
|
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
}
|
}
|
||||||
unsigned int end_segment_vertex_offset() const {
|
unsigned int end_segment_vertex_offset() const {
|
||||||
switch (render_primitive_type)
|
switch (render_primitive_type)
|
||||||
|
@ -234,7 +336,17 @@ class GCodeViewer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
|
#if ENABLE_SPLITTED_VERTEX_BUFFER
|
||||||
|
bool has_data() const {
|
||||||
|
return !vertices.ids.empty() && vertices.ids.front() != 0 && !indices.empty() && indices.front().ibo != 0;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
bool has_data() const { return vertices.id != 0 && !indices.empty() && indices.front().id != 0; }
|
bool has_data() const { return vertices.id != 0 && !indices.empty() && indices.front().id != 0; }
|
||||||
|
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
|
#endif // ENABLE_SPLITTED_VERTEX_BUFFER
|
||||||
|
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
};
|
};
|
||||||
|
|
||||||
// helper to render shells
|
// helper to render shells
|
||||||
|
@ -309,6 +421,13 @@ class GCodeViewer
|
||||||
{
|
{
|
||||||
size_t first{ 0 };
|
size_t first{ 0 };
|
||||||
size_t last{ 0 };
|
size_t last{ 0 };
|
||||||
|
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
|
#if ENABLE_SPLITTED_VERTEX_BUFFER
|
||||||
|
bool operator == (const Endpoints& other) const {
|
||||||
|
return first == other.first && last == other.last;
|
||||||
|
}
|
||||||
|
#endif // ENABLE_SPLITTED_VERTEX_BUFFER
|
||||||
|
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -316,14 +435,12 @@ class GCodeViewer
|
||||||
std::vector<Endpoints> m_endpoints;
|
std::vector<Endpoints> m_endpoints;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void append(double z, Endpoints endpoints)
|
void append(double z, Endpoints endpoints) {
|
||||||
{
|
|
||||||
m_zs.emplace_back(z);
|
m_zs.emplace_back(z);
|
||||||
m_endpoints.emplace_back(endpoints);
|
m_endpoints.emplace_back(endpoints);
|
||||||
}
|
}
|
||||||
|
|
||||||
void reset()
|
void reset() {
|
||||||
{
|
|
||||||
m_zs = std::vector<double>();
|
m_zs = std::vector<double>();
|
||||||
m_endpoints = std::vector<Endpoints>();
|
m_endpoints = std::vector<Endpoints>();
|
||||||
}
|
}
|
||||||
|
@ -335,6 +452,19 @@ class GCodeViewer
|
||||||
std::vector<Endpoints>& get_endpoints() { return m_endpoints; }
|
std::vector<Endpoints>& get_endpoints() { return m_endpoints; }
|
||||||
double get_z_at(unsigned int id) const { return (id < m_zs.size()) ? m_zs[id] : 0.0; }
|
double get_z_at(unsigned int id) const { return (id < m_zs.size()) ? m_zs[id] : 0.0; }
|
||||||
Endpoints get_endpoints_at(unsigned int id) const { return (id < m_endpoints.size()) ? m_endpoints[id] : Endpoints(); }
|
Endpoints get_endpoints_at(unsigned int id) const { return (id < m_endpoints.size()) ? m_endpoints[id] : Endpoints(); }
|
||||||
|
|
||||||
|
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
|
#if ENABLE_SPLITTED_VERTEX_BUFFER
|
||||||
|
bool operator != (const Layers& other) const {
|
||||||
|
if (m_zs != other.m_zs)
|
||||||
|
return true;
|
||||||
|
if (!(m_endpoints == other.m_endpoints))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
#endif // ENABLE_SPLITTED_VERTEX_BUFFER
|
||||||
|
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
};
|
};
|
||||||
|
|
||||||
#if ENABLE_GCODE_VIEWER_STATISTICS
|
#if ENABLE_GCODE_VIEWER_STATISTICS
|
||||||
|
@ -363,8 +493,10 @@ class GCodeViewer
|
||||||
int64_t extrude_segments_count{ 0 };
|
int64_t extrude_segments_count{ 0 };
|
||||||
int64_t vbuffers_count{ 0 };
|
int64_t vbuffers_count{ 0 };
|
||||||
int64_t ibuffers_count{ 0 };
|
int64_t ibuffers_count{ 0 };
|
||||||
int64_t max_vertices_in_vertex_buffer{ 0 };
|
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
int64_t max_indices_in_index_buffer{ 0 };
|
// int64_t max_vertices_in_vertex_buffer{ 0 };
|
||||||
|
// int64_t max_indices_in_index_buffer{ 0 };
|
||||||
|
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
|
|
||||||
void reset_all() {
|
void reset_all() {
|
||||||
reset_times();
|
reset_times();
|
||||||
|
@ -402,8 +534,10 @@ class GCodeViewer
|
||||||
extrude_segments_count = 0;
|
extrude_segments_count = 0;
|
||||||
vbuffers_count = 0;
|
vbuffers_count = 0;
|
||||||
ibuffers_count = 0;
|
ibuffers_count = 0;
|
||||||
max_vertices_in_vertex_buffer = 0;
|
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
max_indices_in_index_buffer = 0;
|
// max_vertices_in_vertex_buffer = 0;
|
||||||
|
// max_indices_in_index_buffer = 0;
|
||||||
|
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
#endif // ENABLE_GCODE_VIEWER_STATISTICS
|
#endif // ENABLE_GCODE_VIEWER_STATISTICS
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue