summaryrefslogtreecommitdiff
path: root/src/state.h
diff options
context:
space:
mode:
authorMarius Kintel <marius@kintel.net>2011-09-02 21:35:10 (GMT)
committerMarius Kintel <marius@kintel.net>2011-09-02 21:35:10 (GMT)
commited8a99ed55d5d1ad043608ed471bb7564403bde9 (patch)
treed0205bc5d22062ba6ddc0bbf87c88e9fafa58536 /src/state.h
parent287c20d2ff1f737acb414b3eda4969356c02c4fe (diff)
Refactoring: Moved color functionality into separate module and node
Diffstat (limited to 'src/state.h')
-rw-r--r--src/state.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/state.h b/src/state.h
index c81575a..69aee87 100644
--- a/src/state.h
+++ b/src/state.h
@@ -9,7 +9,7 @@ public:
State(const class AbstractNode *parent)
: parentnode(parent), isprefix(false), ispostfix(false), numchildren(0) {
for (int i=0;i<16;i++) this->m[i] = i % 5 == 0 ? 1.0 : 0.0;
- for (int i=16;i<20;i++) this->m[i] = -1.0;
+ for (int i=0;i<4;i++) this->c[i] = -1.0;
}
virtual ~State() {}
@@ -17,13 +17,15 @@ public:
void setPostfix(bool on) { this->ispostfix = on; }
void setNumChildren(unsigned int numc) { this->numchildren = numc; }
void setParent(const AbstractNode *parent) { this->parentnode = parent; }
- void setMatrix(const double m[20]) { memcpy(this->m, m, 20*sizeof(m)); }
+ void setMatrix(const double m[16]) { memcpy(this->m, m, 16*sizeof(double)); }
+ void setColor(const double c[4]) { memcpy(this->c, c, 4*sizeof(double)); }
bool isPrefix() const { return this->isprefix; }
bool isPostfix() const { return this->ispostfix; }
unsigned int numChildren() const { return this->numchildren; }
const AbstractNode *parent() const { return this->parentnode; }
const double *matrix() const { return this->m; }
+ const double *color() const { return this->c; }
private:
const AbstractNode * parentnode;
@@ -31,8 +33,9 @@ private:
bool ispostfix;
unsigned int numchildren;
- // Transformation matrix incl. color. FIXME: Generalize such state variables?
- double m[20];
+ // Transformation matrix and color. FIXME: Generalize such state variables?
+ double m[16];
+ double c[4];
};
#endif
contact: Jan Huwald // Impressum