summaryrefslogtreecommitdiff
path: root/src/transform.cc
diff options
context:
space:
mode:
authorMarius Kintel <marius@kintel.net>2011-09-03 04:10:36 (GMT)
committerMarius Kintel <marius@kintel.net>2011-09-03 04:10:36 (GMT)
commit6f632190a05417d44193e3b16a7b3000b2cc1145 (patch)
tree9ddccef57c10361a7019274f79f1d86edb7630d3 /src/transform.cc
parent3129189342f3da7322efa0b860ff3ff676ba7b77 (diff)
Ported a bunch of stuff from Qt to STL
Diffstat (limited to 'src/transform.cc')
-rw-r--r--src/transform.cc20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/transform.cc b/src/transform.cc
index 07aaee8..8975fd5 100644
--- a/src/transform.cc
+++ b/src/transform.cc
@@ -37,6 +37,8 @@
#include <sstream>
#include <vector>
#include <assert.h>
+#include <boost/assign/std/vector.hpp>
+using namespace boost::assign; // bring 'operator+=()' into scope
enum transform_type_e {
SCALE,
@@ -86,24 +88,24 @@ AbstractNode *TransformModule::evaluate(const Context *ctx, const ModuleInstanti
for (int i = 0; i < 16; i++)
node->matrix[i] = i % 5 == 0 ? 1.0 : 0.0;
- QVector<QString> argnames;
- QVector<Expression*> argexpr;
+ std::vector<std::string> argnames;
+ std::vector<Expression*> argexpr;
switch (this->type) {
case SCALE:
- argnames = QVector<QString>() << "v";
+ argnames += "v";
break;
case ROTATE:
- argnames = QVector<QString>() << "a" << "v";
+ argnames += "a", "v";
break;
case MIRROR:
- argnames = QVector<QString>() << "v";
+ argnames += "v";
break;
case TRANSLATE:
- argnames = QVector<QString>() << "v";
+ argnames += "v";
break;
case MULTMATRIX:
- argnames = QVector<QString>() << "m";
+ argnames += "m";
break;
default:
assert(false);
@@ -127,7 +129,7 @@ AbstractNode *TransformModule::evaluate(const Context *ctx, const ModuleInstanti
Value val_a = c.lookup_variable("a");
if (val_a.type == Value::VECTOR)
{
- for (int i = 0; i < 3 && i < val_a.vec.size(); i++) {
+ for (size_t i = 0; i < 3 && i < val_a.vec.size(); i++) {
double a;
val_a.vec[i]->getnum(a);
double c = cos(a*M_PI/180.0);
@@ -230,7 +232,7 @@ AbstractNode *TransformModule::evaluate(const Context *ctx, const ModuleInstanti
Value v = c.lookup_variable("m");
if (v.type == Value::VECTOR) {
for (int i = 0; i < 16; i++) {
- int x = i / 4, y = i % 4;
+ size_t x = i / 4, y = i % 4;
if (y < v.vec.size() && v.vec[y]->type == Value::VECTOR && x < v.vec[y]->vec.size())
v.vec[y]->vec[x]->getnum(node->matrix[i]);
}
contact: Jan Huwald // Impressum