diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/glview.cc | 18 | ||||
-rw-r--r-- | src/transform.cc | 20 |
2 files changed, 18 insertions, 20 deletions
diff --git a/src/glview.cc b/src/glview.cc index 74772de..3daa064 100644 --- a/src/glview.cc +++ b/src/glview.cc @@ -25,8 +25,7 @@ */ #include "GLView.h" -// FIXME: Reenable/rewrite - don't be dependant on GUI -//#include "Preferences.h" +#include "Preferences.h" #include <QApplication> #include <QWheelEvent> @@ -251,10 +250,10 @@ void GLView::display_opengl20_warning() // action connect(buttonbox, SIGNAL(accepted()), dialog, SLOT(accept())); - // connect(checkbox, SIGNAL(clicked(bool)), - // Preferences::inst()->OpenGL20WarningCheckbox, SLOT(setChecked(bool))); - // connect(checkbox, SIGNAL(clicked(bool)), - // Preferences::inst(), SLOT(OpenGL20WarningChanged(bool))); + connect(checkbox, SIGNAL(clicked(bool)), + Preferences::inst()->OpenGL20WarningCheckbox, SLOT(setChecked(bool))); + connect(checkbox, SIGNAL(clicked(bool)), + Preferences::inst(), SLOT(OpenGL20WarningChanged(bool))); dialog->exec(); } #endif @@ -271,9 +270,7 @@ void GLView::resizeGL(int w, int h) void GLView::paintGL() { -// FIXME: Reenable/rewrite - don't be dependant on GUI -// const QColor &bgcol = Preferences::inst()->color(Preferences::BACKGROUND_COLOR); - const QColor &bgcol = QColor(0xff, 0xff, 0xe5); + const QColor &bgcol = Preferences::inst()->color(Preferences::BACKGROUND_COLOR); glClearColor(bgcol.redF(), bgcol.greenF(), bgcol.blueF(), 0.0); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); @@ -316,8 +313,7 @@ void GLView::paintGL() if (showcrosshairs) { glLineWidth(3); -// const QColor &col = Preferences::inst()->color(Preferences::CROSSHAIR_COLOR); - const QColor &col = QColor(0x80, 0x00, 0x00); + const QColor &col = Preferences::inst()->color(Preferences::CROSSHAIR_COLOR); glColor3f(col.redF(), col.greenF(), col.blueF()); glBegin(GL_LINES); for (double xf = -1; xf <= +1; xf += 2) diff --git a/src/transform.cc b/src/transform.cc index d75c6a7..b22b766 100644 --- a/src/transform.cc +++ b/src/transform.cc @@ -109,7 +109,7 @@ AbstractNode *TransformModule::evaluate(const Context *ctx, const ModuleInstanti argnames = QVector<QString>() << "m"; break; case COLOR: - argnames = QVector<QString>() << "c"; + argnames = QVector<QString>() << "c" << "alpha"; break; default: assert(false); @@ -251,23 +251,25 @@ AbstractNode *TransformModule::evaluate(const Context *ctx, const ModuleInstanti // FIXME: Port to non-Qt #if 0 } else if (v.type == Value::STRING) { - double alpha = 1.0; - vector<string> chunks = split(v.text, ","); - string colorname = chunks[0]; - if (chunks.size() < 2 || !from_string(alpha, chunks[1])) alpha = 1.0; + QString colorname = v.text; QColor color; color.setNamedColor(colorname); if (color.isValid()) { - node->m[16+0] = color.redF(); - node->m[16+1] = color.greenF(); - node->m[16+2] = color.blueF(); - node->m[16+3] = alpha; + node->matrix[16+0] = color.redF(); + node->matrix[16+1] = color.greenF(); + node->matrix[16+2] = color.blueF(); } else { PRINTF_NOCACHE("WARNING: Color name \"%s\" unknown. Please see",v.text.toUtf8().data()); PRINTF_NOCACHE("WARNING: http://en.wikipedia.org/wiki/Web_colors"); } #endif } + Value alpha = c.lookup_variable("alpha"); + if (alpha.type == Value::NUMBER) { + node->matrix[16+3] = alpha.num; + } else { + node->matrix[16+3] = 1.0; + } } foreach (ModuleInstantiation *v, inst->children) { |