summaryrefslogtreecommitdiff
path: root/src/primitives.cc
diff options
context:
space:
mode:
authorMarius Kintel <marius@kintel.net>2013-04-18 22:34:14 (GMT)
committerMarius Kintel <marius@kintel.net>2013-04-18 22:34:14 (GMT)
commit58bd9c9e3f4454d055bf51d63463a9965a9dcbd7 (patch)
tree732cd423858685365a4115d44a52f85ae90866a1 /src/primitives.cc
parent73c2a45af6afca253159d2cf9c1ecf5747f0217e (diff)
Cleaned up argument list handling, related to #116
Diffstat (limited to 'src/primitives.cc')
-rw-r--r--src/primitives.cc19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/primitives.cc b/src/primitives.cc
index 40e7e0b..184b40c 100644
--- a/src/primitives.cc
+++ b/src/primitives.cc
@@ -112,37 +112,36 @@ AbstractNode *PrimitiveModule::evaluate(const Context *ctx, const ModuleInstanti
node->center = false;
node->x = node->y = node->z = node->h = node->r1 = node->r2 = 1;
- std::vector<std::string> argnames;
- std::vector<Expression*> argexpr;
+ AssignmentList args;
switch (this->type) {
case CUBE:
- argnames += "size", "center";
+ args += Assignment("size", NULL), Assignment("center", NULL);
break;
case SPHERE:
- argnames += "r";
+ args += Assignment("r", NULL);
break;
case CYLINDER:
- argnames += "h", "r1", "r2", "center";
+ args += Assignment("h", NULL), Assignment("r1", NULL), Assignment("r2", NULL), Assignment("center", NULL);
break;
case POLYHEDRON:
- argnames += "points", "triangles", "convexity";
+ args += Assignment("points", NULL), Assignment("triangles", NULL), Assignment("convexity", NULL);
break;
case SQUARE:
- argnames += "size", "center";
+ args += Assignment("size", NULL), Assignment("center", NULL);
break;
case CIRCLE:
- argnames += "r";
+ args += Assignment("r", NULL);
break;
case POLYGON:
- argnames += "points", "paths", "convexity";
+ args += Assignment("points", NULL), Assignment("paths", NULL), Assignment("convexity", NULL);
break;
default:
assert(false && "PrimitiveModule::evaluate(): Unknown node type");
}
Context c(ctx);
- c.setVariables(argnames, argexpr, evalctx);
+ c.setVariables(args, evalctx);
node->fn = c.lookup_variable("$fn").toDouble();
node->fs = c.lookup_variable("$fs").toDouble();
contact: Jan Huwald // Impressum