summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarius Kintel <marius@kintel.net>2012-01-25 20:13:03 (GMT)
committerMarius Kintel <marius@kintel.net>2012-01-25 20:13:03 (GMT)
commit4cbdbf9827d2576f8672a6c167261b4b27682920 (patch)
treeb9d413ac635585ceb3abc53b83a48d66ac5e20f3 /src
parented02aa85ef0ec0a1adc9aa34f6e1a9f7715a4704 (diff)
Ported remaining color handling away from Qt
Diffstat (limited to 'src')
-rw-r--r--src/CGALRenderer.cc6
-rw-r--r--src/Preferences.cc66
-rw-r--r--src/Preferences.h4
-rw-r--r--src/color.cc10
-rw-r--r--src/colormap.h297
-rw-r--r--src/glview.cc8
-rw-r--r--src/linalg.h8
-rw-r--r--src/renderer.cc30
-rw-r--r--src/rendersettings.cc24
-rw-r--r--src/rendersettings.h10
10 files changed, 236 insertions, 227 deletions
diff --git a/src/CGALRenderer.cc b/src/CGALRenderer.cc
index bac25a6..adf1217 100644
--- a/src/CGALRenderer.cc
+++ b/src/CGALRenderer.cc
@@ -85,8 +85,7 @@ void CGALRenderer::draw(bool showfaces, bool showedges) const
// Draw 2D polygons
glDisable(GL_LIGHTING);
// FIXME: const QColor &col = Preferences::inst()->color(Preferences::CGAL_FACE_2D_COLOR);
- const QColor &col = QColor(0x00, 0xbf, 0x99);
- glColor3f(col.redF(), col.greenF(), col.blueF());
+ glColor3f(0.0f, 0.75f, 0.60f);
for (size_t i=0; i < this->polyset->polygons.size(); i++) {
glBegin(GL_POLYGON);
@@ -108,8 +107,7 @@ void CGALRenderer::draw(bool showfaces, bool showedges) const
glDisable(GL_LIGHTING);
glLineWidth(2);
// FIXME: const QColor &col2 = Preferences::inst()->color(Preferences::CGAL_EDGE_2D_COLOR);
- const QColor &col2 = QColor(0xff, 0x00, 0x00);
- glColor3f(col2.redF(), col2.greenF(), col2.blueF());
+ glColor3f(1.0f, 0.0f, 0.0f);
// Extract the boundary, including inner boundaries of the polygons
for (fci_t fit = E.faces_begin(), facesend = E.faces_end(); fit != facesend; ++fit) {
diff --git a/src/Preferences.cc b/src/Preferences.cc
index 10ed44d..802c50c 100644
--- a/src/Preferences.cc
+++ b/src/Preferences.cc
@@ -57,7 +57,7 @@ Preferences::Preferences(QWidget *parent) : QMainWindow(parent)
uint savedsize = getValue("editor/fontsize").toUInt();
QFontDatabase db;
- foreach(int size, db.standardSizes()) {
+ foreach(uint size, db.standardSizes()) {
this->fontSize->addItem(QString::number(size));
if (size == savedsize) {
this->fontSize->setCurrentIndex(this->fontSize->count()-1);
@@ -88,38 +88,38 @@ Preferences::Preferences(QWidget *parent) : QMainWindow(parent)
this->actionTriggered(this->prefsAction3DView);
// 3D View pane
- this->colorschemes["Cornfield"][RenderSettings::BACKGROUND_COLOR] = QColor(0xff, 0xff, 0xe5);
- this->colorschemes["Cornfield"][RenderSettings::OPENCSG_FACE_FRONT_COLOR] = QColor(0xf9, 0xd7, 0x2c);
- this->colorschemes["Cornfield"][RenderSettings::OPENCSG_FACE_BACK_COLOR] = QColor(0x9d, 0xcb, 0x51);
- this->colorschemes["Cornfield"][RenderSettings::CGAL_FACE_FRONT_COLOR] = QColor(0xf9, 0xd7, 0x2c);
- this->colorschemes["Cornfield"][RenderSettings::CGAL_FACE_BACK_COLOR] = QColor(0x9d, 0xcb, 0x51);
- this->colorschemes["Cornfield"][RenderSettings::CGAL_FACE_2D_COLOR] = QColor(0x00, 0xbf, 0x99);
- this->colorschemes["Cornfield"][RenderSettings::CGAL_EDGE_FRONT_COLOR] = QColor(0xff, 0x00, 0x00);
- this->colorschemes["Cornfield"][RenderSettings::CGAL_EDGE_BACK_COLOR] = QColor(0xff, 0x00, 0x00);
- this->colorschemes["Cornfield"][RenderSettings::CGAL_EDGE_2D_COLOR] = QColor(0xff, 0x00, 0x00);
- this->colorschemes["Cornfield"][RenderSettings::CROSSHAIR_COLOR] = QColor(0x80, 0x00, 0x00);
-
- this->colorschemes["Metallic"][RenderSettings::BACKGROUND_COLOR] = QColor(0xaa, 0xaa, 0xff);
- this->colorschemes["Metallic"][RenderSettings::OPENCSG_FACE_FRONT_COLOR] = QColor(0xdd, 0xdd, 0xff);
- this->colorschemes["Metallic"][RenderSettings::OPENCSG_FACE_BACK_COLOR] = QColor(0xdd, 0x22, 0xdd);
- this->colorschemes["Metallic"][RenderSettings::CGAL_FACE_FRONT_COLOR] = QColor(0xdd, 0xdd, 0xff);
- this->colorschemes["Metallic"][RenderSettings::CGAL_FACE_BACK_COLOR] = QColor(0xdd, 0x22, 0xdd);
- this->colorschemes["Metallic"][RenderSettings::CGAL_FACE_2D_COLOR] = QColor(0x00, 0xbf, 0x99);
- this->colorschemes["Metallic"][RenderSettings::CGAL_EDGE_FRONT_COLOR] = QColor(0xff, 0x00, 0x00);
- this->colorschemes["Metallic"][RenderSettings::CGAL_EDGE_BACK_COLOR] = QColor(0xff, 0x00, 0x00);
- this->colorschemes["Metallic"][RenderSettings::CGAL_EDGE_2D_COLOR] = QColor(0xff, 0x00, 0x00);
- this->colorschemes["Metallic"][RenderSettings::CROSSHAIR_COLOR] = QColor(0x80, 0x00, 0x00);
-
- this->colorschemes["Sunset"][RenderSettings::BACKGROUND_COLOR] = QColor(0xaa, 0x44, 0x44);
- this->colorschemes["Sunset"][RenderSettings::OPENCSG_FACE_FRONT_COLOR] = QColor(0xff, 0xaa, 0xaa);
- this->colorschemes["Sunset"][RenderSettings::OPENCSG_FACE_BACK_COLOR] = QColor(0x88, 0x22, 0x33);
- this->colorschemes["Sunset"][RenderSettings::CGAL_FACE_FRONT_COLOR] = QColor(0xff, 0xaa, 0xaa);
- this->colorschemes["Sunset"][RenderSettings::CGAL_FACE_BACK_COLOR] = QColor(0x88, 0x22, 0x33);
- this->colorschemes["Sunset"][RenderSettings::CGAL_FACE_2D_COLOR] = QColor(0x00, 0xbf, 0x99);
- this->colorschemes["Sunset"][RenderSettings::CGAL_EDGE_FRONT_COLOR] = QColor(0xff, 0x00, 0x00);
- this->colorschemes["Sunset"][RenderSettings::CGAL_EDGE_BACK_COLOR] = QColor(0xff, 0x00, 0x00);
- this->colorschemes["Sunset"][RenderSettings::CGAL_EDGE_2D_COLOR] = QColor(0xff, 0x00, 0x00);
- this->colorschemes["Sunset"][RenderSettings::CROSSHAIR_COLOR] = QColor(0x80, 0x00, 0x00);
+ this->colorschemes["Cornfield"][RenderSettings::BACKGROUND_COLOR] = Color4f(0xff, 0xff, 0xe5);
+ this->colorschemes["Cornfield"][RenderSettings::OPENCSG_FACE_FRONT_COLOR] = Color4f(0xf9, 0xd7, 0x2c);
+ this->colorschemes["Cornfield"][RenderSettings::OPENCSG_FACE_BACK_COLOR] = Color4f(0x9d, 0xcb, 0x51);
+ this->colorschemes["Cornfield"][RenderSettings::CGAL_FACE_FRONT_COLOR] = Color4f(0xf9, 0xd7, 0x2c);
+ this->colorschemes["Cornfield"][RenderSettings::CGAL_FACE_BACK_COLOR] = Color4f(0x9d, 0xcb, 0x51);
+ this->colorschemes["Cornfield"][RenderSettings::CGAL_FACE_2D_COLOR] = Color4f(0x00, 0xbf, 0x99);
+ this->colorschemes["Cornfield"][RenderSettings::CGAL_EDGE_FRONT_COLOR] = Color4f(0xff, 0x00, 0x00);
+ this->colorschemes["Cornfield"][RenderSettings::CGAL_EDGE_BACK_COLOR] = Color4f(0xff, 0x00, 0x00);
+ this->colorschemes["Cornfield"][RenderSettings::CGAL_EDGE_2D_COLOR] = Color4f(0xff, 0x00, 0x00);
+ this->colorschemes["Cornfield"][RenderSettings::CROSSHAIR_COLOR] = Color4f(0x80, 0x00, 0x00);
+
+ this->colorschemes["Metallic"][RenderSettings::BACKGROUND_COLOR] = Color4f(0xaa, 0xaa, 0xff);
+ this->colorschemes["Metallic"][RenderSettings::OPENCSG_FACE_FRONT_COLOR] = Color4f(0xdd, 0xdd, 0xff);
+ this->colorschemes["Metallic"][RenderSettings::OPENCSG_FACE_BACK_COLOR] = Color4f(0xdd, 0x22, 0xdd);
+ this->colorschemes["Metallic"][RenderSettings::CGAL_FACE_FRONT_COLOR] = Color4f(0xdd, 0xdd, 0xff);
+ this->colorschemes["Metallic"][RenderSettings::CGAL_FACE_BACK_COLOR] = Color4f(0xdd, 0x22, 0xdd);
+ this->colorschemes["Metallic"][RenderSettings::CGAL_FACE_2D_COLOR] = Color4f(0x00, 0xbf, 0x99);
+ this->colorschemes["Metallic"][RenderSettings::CGAL_EDGE_FRONT_COLOR] = Color4f(0xff, 0x00, 0x00);
+ this->colorschemes["Metallic"][RenderSettings::CGAL_EDGE_BACK_COLOR] = Color4f(0xff, 0x00, 0x00);
+ this->colorschemes["Metallic"][RenderSettings::CGAL_EDGE_2D_COLOR] = Color4f(0xff, 0x00, 0x00);
+ this->colorschemes["Metallic"][RenderSettings::CROSSHAIR_COLOR] = Color4f(0x80, 0x00, 0x00);
+
+ this->colorschemes["Sunset"][RenderSettings::BACKGROUND_COLOR] = Color4f(0xaa, 0x44, 0x44);
+ this->colorschemes["Sunset"][RenderSettings::OPENCSG_FACE_FRONT_COLOR] = Color4f(0xff, 0xaa, 0xaa);
+ this->colorschemes["Sunset"][RenderSettings::OPENCSG_FACE_BACK_COLOR] = Color4f(0x88, 0x22, 0x33);
+ this->colorschemes["Sunset"][RenderSettings::CGAL_FACE_FRONT_COLOR] = Color4f(0xff, 0xaa, 0xaa);
+ this->colorschemes["Sunset"][RenderSettings::CGAL_FACE_BACK_COLOR] = Color4f(0x88, 0x22, 0x33);
+ this->colorschemes["Sunset"][RenderSettings::CGAL_FACE_2D_COLOR] = Color4f(0x00, 0xbf, 0x99);
+ this->colorschemes["Sunset"][RenderSettings::CGAL_EDGE_FRONT_COLOR] = Color4f(0xff, 0x00, 0x00);
+ this->colorschemes["Sunset"][RenderSettings::CGAL_EDGE_BACK_COLOR] = Color4f(0xff, 0x00, 0x00);
+ this->colorschemes["Sunset"][RenderSettings::CGAL_EDGE_2D_COLOR] = Color4f(0xff, 0x00, 0x00);
+ this->colorschemes["Sunset"][RenderSettings::CROSSHAIR_COLOR] = Color4f(0x80, 0x00, 0x00);
// Advanced pane
QValidator *validator = new QIntValidator(this);
diff --git a/src/Preferences.h b/src/Preferences.h
index 5ebce43..48e07b4 100644
--- a/src/Preferences.h
+++ b/src/Preferences.h
@@ -5,6 +5,8 @@
#include <QSettings>
#include "ui_Preferences.h"
#include "rendersettings.h"
+#include "linalg.h"
+#include <map>
class Preferences : public QMainWindow, public Ui::Preferences
{
@@ -41,7 +43,7 @@ private:
void removeDefaultSettings();
QSettings::SettingsMap defaultmap;
- QHash<QString, QMap<RenderSettings::RenderColor, QColor> > colorschemes;
+ QHash<QString, std::map<RenderSettings::RenderColor, Color4f> > colorschemes;
static Preferences *instance;
};
diff --git a/src/color.cc b/src/color.cc
index 1d3eb3e..e458bfb 100644
--- a/src/color.cc
+++ b/src/color.cc
@@ -43,7 +43,7 @@ public:
virtual AbstractNode *evaluate(const Context *ctx, const ModuleInstantiation *inst) const;
private:
- static boost::unordered_map<std::string, Vector3f> colormap;
+ static boost::unordered_map<std::string, Color4f> colormap;
};
#include "colormap.h"
@@ -69,12 +69,12 @@ AbstractNode *ColorModule::evaluate(const Context *ctx, const ModuleInstantiatio
} else if (v.type == Value::STRING) {
std::string colorname = v.text;
boost::algorithm::to_lower(colorname);
- Vector3f color;
+ Color4f color;
if (colormap.find(colorname) != colormap.end()) {
color = colormap[colorname];
- node->color[0] = color[0]/255;
- node->color[1] = color[1]/255;
- node->color[2] = color[2]/255;
+ node->color[0] = color[0];
+ node->color[1] = color[1];
+ node->color[2] = color[2];
} else {
PRINTB_NOCACHE("WARNING: Color name \"%s\" unknown. Please see", colorname);
PRINT_NOCACHE("WARNING: http://en.wikipedia.org/wiki/Web_colors");
diff --git a/src/colormap.h b/src/colormap.h
index 343875c..7c0652c 100644
--- a/src/colormap.h
+++ b/src/colormap.h
@@ -1,148 +1,149 @@
-boost::unordered_map<std::string, Vector3f> ColorModule::colormap = map_list_of
- ("aliceblue", Vector3f(240, 248, 255))
- ("antiquewhite", Vector3f(250, 235, 215))
- ("aqua", Vector3f(0, 255, 255))
- ("aquamarine", Vector3f(127, 255, 212))
- ("azure", Vector3f(240, 255, 255))
- ("beige", Vector3f(245, 245, 220))
- ("bisque", Vector3f(255, 228, 196))
- ("black", Vector3f(0, 0, 0))
- ("blanchedalmond", Vector3f(255, 235, 205))
- ("blue", Vector3f(0, 0, 255))
- ("blueviolet", Vector3f(138, 43, 226))
- ("brown", Vector3f(165, 42, 42))
- ("burlywood", Vector3f(222, 184, 135))
- ("cadetblue", Vector3f(95, 158, 160))
- ("chartreuse", Vector3f(127, 255, 0))
- ("chocolate", Vector3f(210, 105, 30))
- ("coral", Vector3f(255, 127, 80))
- ("cornflowerblue", Vector3f(100, 149, 237))
- ("cornsilk", Vector3f(255, 248, 220))
- ("crimson", Vector3f(220, 20, 60))
- ("cyan", Vector3f(0, 255, 255))
- ("darkblue", Vector3f(0, 0, 139))
- ("darkcyan", Vector3f(0, 139, 139))
- ("darkgoldenrod", Vector3f(184, 134, 11))
- ("darkgray", Vector3f(169, 169, 169))
- ("darkgreen", Vector3f(0, 100, 0))
- ("darkgrey", Vector3f(169, 169, 169))
- ("darkkhaki", Vector3f(189, 183, 107))
- ("darkmagenta", Vector3f(139, 0, 139))
- ("darkolivegreen", Vector3f(85, 107, 47))
- ("darkorange", Vector3f(255, 140, 0))
- ("darkorchid", Vector3f(153, 50, 204))
- ("darkred", Vector3f(139, 0, 0))
- ("darksalmon", Vector3f(233, 150, 122))
- ("darkseagreen", Vector3f(143, 188, 143))
- ("darkslateblue", Vector3f(72, 61, 139))
- ("darkslategray", Vector3f(47, 79, 79))
- ("darkslategrey", Vector3f(47, 79, 79))
- ("darkturquoise", Vector3f(0, 206, 209))
- ("darkviolet", Vector3f(148, 0, 211))
- ("deeppink", Vector3f(255, 20, 147))
- ("deepskyblue", Vector3f(0, 191, 255))
- ("dimgray", Vector3f(105, 105, 105))
- ("dimgrey", Vector3f(105, 105, 105))
- ("dodgerblue", Vector3f(30, 144, 255))
- ("firebrick", Vector3f(178, 34, 34))
- ("floralwhite", Vector3f(255, 250, 240))
- ("forestgreen", Vector3f(34, 139, 34))
- ("fuchsia", Vector3f(255, 0, 255))
- ("gainsboro", Vector3f(220, 220, 220))
- ("ghostwhite", Vector3f(248, 248, 255))
- ("gold", Vector3f(255, 215, 0))
- ("goldenrod", Vector3f(218, 165, 32))
- ("gray", Vector3f(128, 128, 128))
- ("green", Vector3f(0, 128, 0))
- ("greenyellow", Vector3f(173, 255, 47))
- ("grey", Vector3f(128, 128, 128))
- ("honeydew", Vector3f(240, 255, 240))
- ("hotpink", Vector3f(255, 105, 180))
- ("indianred", Vector3f(205, 92, 92))
- ("indigo", Vector3f(75, 0, 130))
- ("ivory", Vector3f(255, 255, 240))
- ("khaki", Vector3f(240, 230, 140))
- ("lavender", Vector3f(230, 230, 250))
- ("lavenderblush", Vector3f(255, 240, 245))
- ("lawngreen", Vector3f(124, 252, 0))
- ("lemonchiffon", Vector3f(255, 250, 205))
- ("lightblue", Vector3f(173, 216, 230))
- ("lightcoral", Vector3f(240, 128, 128))
- ("lightcyan", Vector3f(224, 255, 255))
- ("lightgoldenrodyellow", Vector3f(250, 250, 210))
- ("lightgray", Vector3f(211, 211, 211))
- ("lightgreen", Vector3f(144, 238, 144))
- ("lightgrey", Vector3f(211, 211, 211))
- ("lightpink", Vector3f(255, 182, 193))
- ("lightsalmon", Vector3f(255, 160, 122))
- ("lightseagreen", Vector3f(32, 178, 170))
- ("lightskyblue", Vector3f(135, 206, 250))
- ("lightslategray", Vector3f(119, 136, 153))
- ("lightslategrey", Vector3f(119, 136, 153))
- ("lightsteelblue", Vector3f(176, 196, 222))
- ("lightyellow", Vector3f(255, 255, 224))
- ("lime", Vector3f(0, 255, 0))
- ("limegreen", Vector3f(50, 205, 50))
- ("linen", Vector3f(250, 240, 230))
- ("magenta", Vector3f(255, 0, 255))
- ("maroon", Vector3f(128, 0, 0))
- ("mediumaquamarine", Vector3f(102, 205, 170))
- ("mediumblue", Vector3f(0, 0, 205))
- ("mediumorchid", Vector3f(186, 85, 211))
- ("mediumpurple", Vector3f(147, 112, 219))
- ("mediumseagreen", Vector3f(60, 179, 113))
- ("mediumslateblue", Vector3f(123, 104, 238))
- ("mediumspringgreen", Vector3f(0, 250, 154))
- ("mediumturquoise", Vector3f(72, 209, 204))
- ("mediumvioletred", Vector3f(199, 21, 133))
- ("midnightblue", Vector3f(25, 25, 112))
- ("mintcream", Vector3f(245, 255, 250))
- ("mistyrose", Vector3f(255, 228, 225))
- ("moccasin", Vector3f(255, 228, 181))
- ("navajowhite", Vector3f(255, 222, 173))
- ("navy", Vector3f(0, 0, 128))
- ("oldlace", Vector3f(253, 245, 230))
- ("olive", Vector3f(128, 128, 0))
- ("olivedrab", Vector3f(107, 142, 35))
- ("orange", Vector3f(255, 165, 0))
- ("orangered", Vector3f(255, 69, 0))
- ("orchid", Vector3f(218, 112, 214))
- ("palegoldenrod", Vector3f(238, 232, 170))
- ("palegreen", Vector3f(152, 251, 152))
- ("paleturquoise", Vector3f(175, 238, 238))
- ("palevioletred", Vector3f(219, 112, 147))
- ("papayawhip", Vector3f(255, 239, 213))
- ("peachpuff", Vector3f(255, 218, 185))
- ("peru", Vector3f(205, 133, 63))
- ("pink", Vector3f(255, 192, 203))
- ("plum", Vector3f(221, 160, 221))
- ("powderblue", Vector3f(176, 224, 230))
- ("purple", Vector3f(128, 0, 128))
- ("red", Vector3f(255, 0, 0))
- ("rosybrown", Vector3f(188, 143, 143))
- ("royalblue", Vector3f(65, 105, 225))
- ("saddlebrown", Vector3f(139, 69, 19))
- ("salmon", Vector3f(250, 128, 114))
- ("sandybrown", Vector3f(244, 164, 96))
- ("seagreen", Vector3f(46, 139, 87))
- ("seashell", Vector3f(255, 245, 238))
- ("sienna", Vector3f(160, 82, 45))
- ("silver", Vector3f(192, 192, 192))
- ("skyblue", Vector3f(135, 206, 235))
- ("slateblue", Vector3f(106, 90, 205))
- ("slategray", Vector3f(112, 128, 144))
- ("slategrey", Vector3f(112, 128, 144))
- ("snow", Vector3f(255, 250, 250))
- ("springgreen", Vector3f(0, 255, 127))
- ("steelblue", Vector3f(70, 130, 180))
- ("tan", Vector3f(210, 180, 140))
- ("teal", Vector3f(0, 128, 128))
- ("thistle", Vector3f(216, 191, 216))
- ("tomato", Vector3f(255, 99, 71))
- ("turquoise", Vector3f(64, 224, 208))
- ("violet", Vector3f(238, 130, 238))
- ("wheat", Vector3f(245, 222, 179))
- ("white", Vector3f(255, 255, 255))
- ("whitesmoke", Vector3f(245, 245, 245))
- ("yellow", Vector3f(255, 255, 0))
- ("yellowgreen", Vector3f(154, 205, 50));
+boost::unordered_map<std::string, Color4f> ColorModule::colormap = map_list_of
+ ("aliceblue", Color4f(240, 248, 255))
+ ("antiquewhite", Color4f(250, 235, 215))
+ ("aqua", Color4f(0, 255, 255))
+ ("aquamarine", Color4f(127, 255, 212))
+ ("azure", Color4f(240, 255, 255))
+ ("beige", Color4f(245, 245, 220))
+ ("bisque", Color4f(255, 228, 196))
+ ("black", Color4f(0, 0, 0))
+ ("blanchedalmond", Color4f(255, 235, 205))
+ ("blue", Color4f(0, 0, 255))
+ ("blueviolet", Color4f(138, 43, 226))
+ ("brown", Color4f(165, 42, 42))
+ ("burlywood", Color4f(222, 184, 135))
+ ("cadetblue", Color4f(95, 158, 160))
+ ("chartreuse", Color4f(127, 255, 0))
+ ("chocolate", Color4f(210, 105, 30))
+ ("coral", Color4f(255, 127, 80))
+ ("cornflowerblue", Color4f(100, 149, 237))
+ ("cornsilk", Color4f(255, 248, 220))
+ ("crimson", Color4f(220, 20, 60))
+ ("cyan", Color4f(0, 255, 255))
+ ("darkblue", Color4f(0, 0, 139))
+ ("darkcyan", Color4f(0, 139, 139))
+ ("darkgoldenrod", Color4f(184, 134, 11))
+ ("darkgray", Color4f(169, 169, 169))
+ ("darkgreen", Color4f(0, 100, 0))
+ ("darkgrey", Color4f(169, 169, 169))
+ ("darkkhaki", Color4f(189, 183, 107))
+ ("darkmagenta", Color4f(139, 0, 139))
+ ("darkolivegreen", Color4f(85, 107, 47))
+ ("darkorange", Color4f(255, 140, 0))
+ ("darkorchid", Color4f(153, 50, 204))
+ ("darkred", Color4f(139, 0, 0))
+ ("darksalmon", Color4f(233, 150, 122))
+ ("darkseagreen", Color4f(143, 188, 143))
+ ("darkslateblue", Color4f(72, 61, 139))
+ ("darkslategray", Color4f(47, 79, 79))
+ ("darkslategrey", Color4f(47, 79, 79))
+ ("darkturquoise", Color4f(0, 206, 209))
+ ("darkviolet", Color4f(148, 0, 211))
+ ("deeppink", Color4f(255, 20, 147))
+ ("deepskyblue", Color4f(0, 191, 255))
+ ("dimgray", Color4f(105, 105, 105))
+ ("dimgrey", Color4f(105, 105, 105))
+ ("dodgerblue", Color4f(30, 144, 255))
+ ("firebrick", Color4f(178, 34, 34))
+ ("floralwhite", Color4f(255, 250, 240))
+ ("forestgreen", Color4f(34, 139, 34))
+ ("fuchsia", Color4f(255, 0, 255))
+ ("gainsboro", Color4f(220, 220, 220))
+ ("ghostwhite", Color4f(248, 248, 255))
+ ("gold", Color4f(255, 215, 0))
+ ("goldenrod", Color4f(218, 165, 32))
+ ("gray", Color4f(128, 128, 128))
+ ("green", Color4f(0, 128, 0))
+ ("greenyellow", Color4f(173, 255, 47))
+ ("grey", Color4f(128, 128, 128))
+ ("honeydew", Color4f(240, 255, 240))
+ ("hotpink", Color4f(255, 105, 180))
+ ("indianred", Color4f(205, 92, 92))
+ ("indigo", Color4f(75, 0, 130))
+ ("ivory", Color4f(255, 255, 240))
+ ("khaki", Color4f(240, 230, 140))
+ ("lavender", Color4f(230, 230, 250))
+ ("lavenderblush", Color4f(255, 240, 245))
+ ("lawngreen", Color4f(124, 252, 0))
+ ("lemonchiffon", Color4f(255, 250, 205))
+ ("lightblue", Color4f(173, 216, 230))
+ ("lightcoral", Color4f(240, 128, 128))
+ ("lightcyan", Color4f(224, 255, 255))
+ ("lightgoldenrodyellow", Color4f(250, 250, 210))
+ ("lightgray", Color4f(211, 211, 211))
+ ("lightgreen", Color4f(144, 238, 144))
+ ("lightgrey", Color4f(211, 211, 211))
+ ("lightpink", Color4f(255, 182, 193))
+ ("lightsalmon", Color4f(255, 160, 122))
+ ("lightseagreen", Color4f(32, 178, 170))
+ ("lightskyblue", Color4f(135, 206, 250))
+ ("lightslategray", Color4f(119, 136, 153))
+ ("lightslategrey", Color4f(119, 136, 153))
+ ("lightsteelblue", Color4f(176, 196, 222))
+ ("lightyellow", Color4f(255, 255, 224))
+ ("lime", Color4f(0, 255, 0))
+ ("limegreen", Color4f(50, 205, 50))
+ ("linen", Color4f(250, 240, 230))
+ ("magenta", Color4f(255, 0, 255))
+ ("maroon", Color4f(128, 0, 0))
+ ("mediumaquamarine", Color4f(102, 205, 170))
+ ("mediumblue", Color4f(0, 0, 205))
+ ("mediumorchid", Color4f(186, 85, 211))
+ ("mediumpurple", Color4f(147, 112, 219))
+ ("mediumseagreen", Color4f(60, 179, 113))
+ ("mediumslateblue", Color4f(123, 104, 238))
+ ("mediumspringgreen", Color4f(0, 250, 154))
+ ("mediumturquoise", Color4f(72, 209, 204))
+ ("mediumvioletred", Color4f(199, 21, 133))
+ ("midnightblue", Color4f(25, 25, 112))
+ ("mintcream", Color4f(245, 255, 250))
+ ("mistyrose", Color4f(255, 228, 225))
+ ("moccasin", Color4f(255, 228, 181))
+ ("navajowhite", Color4f(255, 222, 173))
+ ("navy", Color4f(0, 0, 128))
+ ("oldlace", Color4f(253, 245, 230))
+ ("olive", Color4f(128, 128, 0))
+ ("olivedrab", Color4f(107, 142, 35))
+ ("orange", Color4f(255, 165, 0))
+ ("orangered", Color4f(255, 69, 0))
+ ("orchid", Color4f(218, 112, 214))
+ ("palegoldenrod", Color4f(238, 232, 170))
+ ("palegreen", Color4f(152, 251, 152))
+ ("paleturquoise", Color4f(175, 238, 238))
+ ("palevioletred", Color4f(219, 112, 147))
+ ("papayawhip", Color4f(255, 239, 213))
+ ("peachpuff", Color4f(255, 218, 185))
+ ("peru", Color4f(205, 133, 63))
+ ("pink", Color4f(255, 192, 203))
+ ("plum", Color4f(221, 160, 221))
+ ("powderblue", Color4f(176, 224, 230))
+ ("purple", Color4f(128, 0, 128))
+ ("red", Color4f(255, 0, 0))
+ ("rosybrown", Color4f(188, 143, 143))
+ ("royalblue", Color4f(65, 105, 225))
+ ("saddlebrown", Color4f(139, 69, 19))
+ ("salmon", Color4f(250, 128, 114))
+ ("sandybrown", Color4f(244, 164, 96))
+ ("seagreen", Color4f(46, 139, 87))
+ ("seashell", Color4f(255, 245, 238))
+ ("sienna", Color4f(160, 82, 45))
+ ("silver", Color4f(192, 192, 192))
+ ("skyblue", Color4f(135, 206, 235))
+ ("slateblue", Color4f(106, 90, 205))
+ ("slategray", Color4f(112, 128, 144))
+ ("slategrey", Color4f(112, 128, 144))
+ ("snow", Color4f(255, 250, 250))
+ ("springgreen", Color4f(0, 255, 127))
+ ("steelblue", Color4f(70, 130, 180))
+ ("tan", Color4f(210, 180, 140))
+ ("teal", Color4f(0, 128, 128))
+ ("thistle", Color4f(216, 191, 216))
+ ("tomato", Color4f(255, 99, 71))
+ ("transparent", Color4f(0, 0, 0, 0))
+ ("turquoise", Color4f(64, 224, 208))
+ ("violet", Color4f(238, 130, 238))
+ ("wheat", Color4f(245, 222, 179))
+ ("white", Color4f(255, 255, 255))
+ ("whitesmoke", Color4f(245, 245, 245))
+ ("yellow", Color4f(255, 255, 0))
+ ("yellowgreen", Color4f(154, 205, 50));
diff --git a/src/glview.cc b/src/glview.cc
index 3d26fa5..499e555 100644
--- a/src/glview.cc
+++ b/src/glview.cc
@@ -383,8 +383,8 @@ void GLView::paintGL()
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
- const QColor &bgcol = RenderSettings::inst()->color(RenderSettings::BACKGROUND_COLOR);
- glClearColor(bgcol.redF(), bgcol.greenF(), bgcol.blueF(), 0.0);
+ Color4f bgcol = RenderSettings::inst()->color(RenderSettings::BACKGROUND_COLOR);
+ glClearColor(bgcol[0], bgcol[1], bgcol[2], 0.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
@@ -399,8 +399,8 @@ void GLView::paintGL()
if (showcrosshairs)
{
glLineWidth(3);
- const QColor &col = RenderSettings::inst()->color(RenderSettings::CROSSHAIR_COLOR);
- glColor3f(col.redF(), col.greenF(), col.blueF());
+ Color4f col = RenderSettings::inst()->color(RenderSettings::CROSSHAIR_COLOR);
+ glColor3f(col[0], col[1], col[2]);
glBegin(GL_LINES);
for (double xf = -1; xf <= +1; xf += 2)
for (double yf = -1; yf <= +1; yf += 2) {
diff --git a/src/linalg.h b/src/linalg.h
index 41aa730..65243dc 100644
--- a/src/linalg.h
+++ b/src/linalg.h
@@ -19,6 +19,14 @@ BoundingBox operator*(const Transform3d &m, const BoundingBox &box);
class Color4f : public Eigen::Vector4f
{
public:
+ Color4f() { }
+ Color4f(int r, int g, int b, int a = 255) { setRgb(r,g,b,a); }
+ Color4f(float r, float g, float b, float a = 1.0f) : Eigen::Vector4f(r, g, b, a) { }
+
+ void setRgb(int r, int g, int b, int a = 255) {
+ *this << r/255.0f, g/255.0f, b/255.0f, a/255.0f;
+ }
+
bool isValid() const { return this->minCoeff() >= 0.0f; }
};
diff --git a/src/renderer.cc b/src/renderer.cc
index 5a767b8..db3204f 100644
--- a/src/renderer.cc
+++ b/src/renderer.cc
@@ -1,16 +1,16 @@
#include "renderer.h"
#include "rendersettings.h"
-#include <QColor>
+#include "linalg.h"
void Renderer::setColor(const float color[4], GLint *shaderinfo) const
{
- QColor col = RenderSettings::inst()->color(RenderSettings::OPENCSG_FACE_FRONT_COLOR);
- double c[4] = {color[0], color[1], color[2], color[3]};
- if (c[0] < 0) c[0] = col.redF();
- if (c[1] < 0) c[1] = col.greenF();
- if (c[2] < 0) c[2] = col.blueF();
- if (c[3] < 0) c[3] = col.alphaF();
- glColor4dv(c);
+ Color4f col = RenderSettings::inst()->color(RenderSettings::OPENCSG_FACE_FRONT_COLOR);
+ float c[4] = {color[0], color[1], color[2], color[3]};
+ if (c[0] < 0) c[0] = col[0];
+ if (c[1] < 0) c[1] = col[1];
+ if (c[2] < 0) c[2] = col[2];
+ if (c[3] < 0) c[3] = col[3];
+ glColor4fv(c);
if (shaderinfo) {
glUniform4f(shaderinfo[1], c[0], c[1], c[2], c[3]);
glUniform4f(shaderinfo[2], (c[0]+1)/2, (c[1]+1)/2, (c[2]+1)/2, 1.0);
@@ -19,7 +19,7 @@ void Renderer::setColor(const float color[4], GLint *shaderinfo) const
void Renderer::setColor(ColorMode colormode, GLint *shaderinfo) const
{
- QColor col;
+ Color4f col;
switch (colormode) {
case COLORMODE_NONE:
return;
@@ -52,15 +52,15 @@ void Renderer::setColor(ColorMode colormode, GLint *shaderinfo) const
break;
}
float rgba[4];
- rgba[0] = col.redF();
- rgba[1] = col.greenF();
- rgba[2] = col.blueF();
- rgba[3] = col.alphaF();
+ rgba[0] = col[0];
+ rgba[1] = col[1];
+ rgba[2] = col[2];
+ rgba[3] = col[3];
glColor4fv(rgba);
#ifdef ENABLE_OPENCSG
if (shaderinfo) {
- glUniform4f(shaderinfo[1], col.redF(), col.greenF(), col.blueF(), 1.0f);
- glUniform4f(shaderinfo[2], (col.redF()+1)/2, (col.greenF()+1)/2, (col.blueF()+1)/2, 1.0f);
+ glUniform4f(shaderinfo[1], col[0], col[1], col[2], 1.0f);
+ glUniform4f(shaderinfo[2], (col[0]+1)/2, (col[1]+1)/2, (col[2]+1)/2, 1.0f);
}
#endif
}
diff --git a/src/rendersettings.cc b/src/rendersettings.cc
index ee57c34..195f2d8 100644
--- a/src/rendersettings.cc
+++ b/src/rendersettings.cc
@@ -12,24 +12,24 @@ RenderSettings *RenderSettings::inst(bool erase)
RenderSettings::RenderSettings()
{
- this->colors[BACKGROUND_COLOR] = QColor(0xff, 0xff, 0xe5);
- this->colors[OPENCSG_FACE_FRONT_COLOR] = QColor(0xf9, 0xd7, 0x2c);
- this->colors[OPENCSG_FACE_BACK_COLOR] = QColor(0x9d, 0xcb, 0x51);
- this->colors[CGAL_FACE_FRONT_COLOR] = QColor(0xf9, 0xd7, 0x2c);
- this->colors[CGAL_FACE_BACK_COLOR] = QColor(0x9d, 0xcb, 0x51);
- this->colors[CGAL_FACE_2D_COLOR] = QColor(0x00, 0xbf, 0x99);
- this->colors[CGAL_EDGE_FRONT_COLOR] = QColor(0xff, 0x00, 0x00);
- this->colors[CGAL_EDGE_BACK_COLOR] = QColor(0xff, 0x00, 0x00);
- this->colors[CGAL_EDGE_2D_COLOR] = QColor(0xff, 0x00, 0x00);
- this->colors[CROSSHAIR_COLOR] = QColor(0x80, 0x00, 0x00);
+ this->colors[BACKGROUND_COLOR] = Color4f(0xff, 0xff, 0xe5);
+ this->colors[OPENCSG_FACE_FRONT_COLOR] = Color4f(0xf9, 0xd7, 0x2c);
+ this->colors[OPENCSG_FACE_BACK_COLOR] = Color4f(0x9d, 0xcb, 0x51);
+ this->colors[CGAL_FACE_FRONT_COLOR] = Color4f(0xf9, 0xd7, 0x2c);
+ this->colors[CGAL_FACE_BACK_COLOR] = Color4f(0x9d, 0xcb, 0x51);
+ this->colors[CGAL_FACE_2D_COLOR] = Color4f(0x00, 0xbf, 0x99);
+ this->colors[CGAL_EDGE_FRONT_COLOR] = Color4f(0xff, 0x00, 0x00);
+ this->colors[CGAL_EDGE_BACK_COLOR] = Color4f(0xff, 0x00, 0x00);
+ this->colors[CGAL_EDGE_2D_COLOR] = Color4f(0xff, 0x00, 0x00);
+ this->colors[CROSSHAIR_COLOR] = Color4f(0x80, 0x00, 0x00);
}
-QColor RenderSettings::color(RenderColor idx) const
+Color4f RenderSettings::color(RenderColor idx)
{
return this->colors[idx];
}
-void RenderSettings::setColors(const QMap<RenderColor, QColor> &colors)
+void RenderSettings::setColors(const std::map<RenderColor, Color4f> &colors)
{
this->colors = colors;
}
diff --git a/src/rendersettings.h b/src/rendersettings.h
index 32e56f1..15a0746 100644
--- a/src/rendersettings.h
+++ b/src/rendersettings.h
@@ -1,8 +1,8 @@
#ifndef RENDERSETTINGS_H_
#define RENDERSETTINGS_H_
-#include <QColor>
-#include <QMap>
+#include <map>
+#include "linalg.h"
class RenderSettings
{
@@ -22,14 +22,14 @@ public:
CROSSHAIR_COLOR
};
- void setColors(const QMap<RenderColor, QColor> &colors);
- QColor color(RenderColor idx) const;
+ void setColors(const std::map<RenderColor, Color4f> &colors);
+ Color4f color(RenderColor idx);
private:
RenderSettings();
~RenderSettings() {}
- QMap<RenderColor, QColor> colors;
+ std::map<RenderColor, Color4f> colors;
};
#endif
contact: Jan Huwald // Impressum