Tech ENABLE_COLOR_CLASSES - 1st installment -> Introduction of classes ColorRGB and ColorRGBA to unify color data definition and manipulation

This commit is contained in:
enricoturri1966 2021-12-22 10:45:35 +01:00
parent 48098fbaff
commit cd4094743e
53 changed files with 1810 additions and 60 deletions
src/slic3r/GUI

View file

@ -3,6 +3,9 @@
#include "libslic3r/Point.hpp"
#include "libslic3r/BoundingBox.hpp"
#if ENABLE_COLOR_CLASSES
#include "libslic3r/Color.hpp"
#endif // ENABLE_COLOR_CLASSES
#include <vector>
#include <string>
@ -33,7 +36,11 @@ namespace GUI {
unsigned int vbo_id{ 0 };
unsigned int ibo_id{ 0 };
size_t indices_count{ 0 };
#if ENABLE_COLOR_CLASSES
ColorRGBA color;
#else
std::array<float, 4> color{ 1.0f, 1.0f, 1.0f, 1.0f };
#endif // ENABLE_COLOR_CLASSES
};
struct InitializationData
@ -44,7 +51,11 @@ namespace GUI {
std::vector<Vec3f> positions;
std::vector<Vec3f> normals;
std::vector<unsigned int> indices;
#if ENABLE_COLOR_CLASSES
ColorRGBA color;
#else
std::array<float, 4> color{ 1.0f, 1.0f, 1.0f, 1.0f };
#endif // ENABLE_COLOR_CLASSES
};
std::vector<Entity> entities;
@ -74,7 +85,11 @@ namespace GUI {
bool init_from_file(const std::string& filename);
// if entity_id == -1 set the color of all entities
#if ENABLE_COLOR_CLASSES
void set_color(int entity_id, const ColorRGBA& color);
#else
void set_color(int entity_id, const std::array<float, 4>& color);
#endif // ENABLE_COLOR_CLASSES
void reset();
void render() const;