summaryrefslogtreecommitdiff
path: root/src/color.cc
diff options
context:
space:
mode:
authorMarius Kintel <marius@kintel.net>2012-03-27 22:05:00 (GMT)
committerMarius Kintel <marius@kintel.net>2012-03-27 22:05:58 (GMT)
commit327310f190bbd81c7b71b568d5bf72bb900cc9db (patch)
tree9399bb490ecafe9f0c7fd209c680311d829eb631 /src/color.cc
parent4394c7a030ce7a08c95bd1af2e8c38ffcf972439 (diff)
Rewrote the Value class to be based on boost::variant - this should reduce memory footprint and improve performance
Diffstat (limited to 'src/color.cc')
-rw-r--r--src/color.cc12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/color.cc b/src/color.cc
index e458bfb..4220396 100644
--- a/src/color.cc
+++ b/src/color.cc
@@ -63,11 +63,11 @@ AbstractNode *ColorModule::evaluate(const Context *ctx, const ModuleInstantiatio
c.args(argnames, argexpr, inst->argnames, inst->argvalues);
Value v = c.lookup_variable("c");
- if (v.type == Value::VECTOR) {
+ if (v.type() == Value::VECTOR) {
for (size_t i = 0; i < 4; i++)
- node->color[i] = i < v.vec.size() ? v.vec[i]->num : 1.0;
- } else if (v.type == Value::STRING) {
- std::string colorname = v.text;
+ node->color[i] = i < v.toVector().size() ? v.toVector()[i].toDouble() : 1.0;
+ } else if (v.type() == Value::STRING) {
+ std::string colorname = v.toString();
boost::algorithm::to_lower(colorname);
Color4f color;
if (colormap.find(colorname) != colormap.end()) {
@@ -81,8 +81,8 @@ AbstractNode *ColorModule::evaluate(const Context *ctx, const ModuleInstantiatio
}
}
Value alpha = c.lookup_variable("alpha");
- if (alpha.type == Value::NUMBER) {
- node->color[3] = alpha.num;
+ if (alpha.type() == Value::NUMBER) {
+ node->color[3] = alpha.toDouble();
}
std::vector<AbstractNode *> evaluatednodes = inst->evaluateChildren();
contact: Jan Huwald // Impressum