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