summaryrefslogtreecommitdiff
path: root/src/renderer.cc
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/renderer.cc
parented02aa85ef0ec0a1adc9aa34f6e1a9f7715a4704 (diff)
Ported remaining color handling away from Qt
Diffstat (limited to 'src/renderer.cc')
-rw-r--r--src/renderer.cc30
1 files changed, 15 insertions, 15 deletions
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
}
contact: Jan Huwald // Impressum