diff options
Diffstat (limited to 'src/slic3r/GUI/GCodeViewer.hpp')
-rw-r--r-- | src/slic3r/GUI/GCodeViewer.hpp | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/slic3r/GUI/GCodeViewer.hpp b/src/slic3r/GUI/GCodeViewer.hpp index c56e88c88..1a8c8838c 100644 --- a/src/slic3r/GUI/GCodeViewer.hpp +++ b/src/slic3r/GUI/GCodeViewer.hpp @@ -22,7 +22,9 @@ namespace GUI { class GCodeViewer { using IBufferType = unsigned short; +#if !ENABLE_COLOR_CLASSES using Color = std::array<float, 4>; +#endif // !ENABLE_COLOR_CLASSES using VertexBuffer = std::vector<float>; using MultiVertexBuffer = std::vector<VertexBuffer>; using IndexBuffer = std::vector<IBufferType>; @@ -31,12 +33,21 @@ class GCodeViewer using InstanceIdBuffer = std::vector<size_t>; using InstancesOffsets = std::vector<Vec3f>; +#if ENABLE_COLOR_CLASSES + static const std::vector<ColorRGBA> Extrusion_Role_Colors; + static const std::vector<ColorRGBA> Options_Colors; + static const std::vector<ColorRGBA> Travel_Colors; + static const std::vector<ColorRGBA> Range_Colors; + static const ColorRGBA Wipe_Color; + static const ColorRGBA Neutral_Color; +#else static const std::vector<Color> Extrusion_Role_Colors; static const std::vector<Color> Options_Colors; static const std::vector<Color> Travel_Colors; static const std::vector<Color> Range_Colors; static const Color Wipe_Color; static const Color Neutral_Color; +#endif // ENABLE_COLOR_CLASSES enum class EOptionsColors : unsigned char { @@ -121,7 +132,11 @@ class GCodeViewer // vbo id unsigned int vbo{ 0 }; // Color to apply to the instances +#if ENABLE_COLOR_CLASSES + ColorRGBA color; +#else Color color; +#endif // ENABLE_COLOR_CLASSES }; std::vector<Range> ranges; @@ -243,7 +258,11 @@ class GCodeViewer // Index of the parent tbuffer unsigned char tbuffer_id; // Render path property +#if ENABLE_COLOR_CLASSES + ColorRGBA color; +#else Color color; +#endif // ENABLE_COLOR_CLASSES // Index of the buffer in TBuffer::indices unsigned int ibuffer_id; // Render path content @@ -263,12 +282,19 @@ class GCodeViewer bool operator() (const RenderPath &l, const RenderPath &r) const { if (l.tbuffer_id < r.tbuffer_id) return true; +#if ENABLE_COLOR_CLASSES + if (l.color < r.color) + return true; + else if (l.color > r.color) + return false; +#else for (int i = 0; i < 3; ++i) { if (l.color[i] < r.color[i]) return true; else if (l.color[i] > r.color[i]) return false; } +#endif // ENABLE_COLOR_CLASSES return l.ibuffer_id < r.ibuffer_id; } }; @@ -299,7 +325,11 @@ class GCodeViewer struct Model { GLModel model; +#if ENABLE_COLOR_CLASSES + ColorRGBA color; +#else Color color; +#endif // ENABLE_COLOR_CLASSES InstanceVBuffer instances; GLModel::InitializationData data; @@ -399,7 +429,11 @@ class GCodeViewer void reset() { min = FLT_MAX; max = -FLT_MAX; count = 0; } float step_size() const { return (max - min) / (static_cast<float>(Range_Colors.size()) - 1.0f); } +#if ENABLE_COLOR_CLASSES + ColorRGBA get_color_at(float value) const; +#else Color get_color_at(float value) const; +#endif // ENABLE_COLOR_CLASSES }; struct Ranges @@ -493,7 +527,11 @@ class GCodeViewer TBuffer* buffer{ nullptr }; unsigned int ibo{ 0 }; unsigned int vbo{ 0 }; +#if ENABLE_COLOR_CLASSES + ColorRGBA color; +#else Color color; +#endif // ENABLE_COLOR_CLASSES ~SequentialRangeCap(); bool is_renderable() const { return buffer != nullptr; } @@ -697,7 +735,11 @@ private: // bounding box of toolpaths + marker tools BoundingBoxf3 m_max_bounding_box; float m_max_print_height{ 0.0f }; +#if ENABLE_COLOR_CLASSES + std::vector<ColorRGBA> m_tool_colors; +#else std::vector<Color> m_tool_colors; +#endif // ENABLE_COLOR_CLASSES Layers m_layers; std::array<unsigned int, 2> m_layers_z_range; std::vector<ExtrusionRole> m_roles; @@ -792,7 +834,11 @@ private: } bool is_visible(const Path& path) const { return is_visible(path.role); } void log_memory_used(const std::string& label, int64_t additional = 0) const; +#if ENABLE_COLOR_CLASSES + ColorRGBA option_color(EMoveType move_type) const; +#else Color option_color(EMoveType move_type) const; +#endif // ENABLE_COLOR_CLASSES }; } // namespace GUI |