Tech ENABLE_COLOR_CLASSES set as default

This commit is contained in:
enricoturri1966 2022-01-14 08:19:00 +01:00
parent fab35e8aa4
commit 6201dad245
50 changed files with 18 additions and 1500 deletions
src/slic3r/GUI

View file

@ -22,9 +22,6 @@ 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>;
@ -33,21 +30,12 @@ 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
{
@ -132,11 +120,7 @@ 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;
@ -258,11 +242,7 @@ 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
@ -282,19 +262,10 @@ 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;
}
};
@ -325,11 +296,7 @@ class GCodeViewer
struct Model
{
GLModel model;
#if ENABLE_COLOR_CLASSES
ColorRGBA color;
#else
Color color;
#endif // ENABLE_COLOR_CLASSES
InstanceVBuffer instances;
GLModel::InitializationData data;
@ -429,11 +396,7 @@ 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
@ -525,11 +488,7 @@ 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; }
@ -733,11 +692,7 @@ 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;
@ -832,11 +787,7 @@ 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