2010-03-02 21:22:31 +03:00
|
|
|
#ifndef STATE_H_
|
|
|
|
#define STATE_H_
|
|
|
|
|
2011-08-25 00:25:15 +04:00
|
|
|
#include <cstring>
|
2011-10-04 05:41:43 +04:00
|
|
|
#include "linalg.h"
|
2011-08-25 00:25:15 +04:00
|
|
|
|
2010-03-02 21:22:31 +03:00
|
|
|
class State
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
State(const class AbstractNode *parent)
|
2010-08-28 19:34:22 +04:00
|
|
|
: parentnode(parent), isprefix(false), ispostfix(false), numchildren(0) {
|
2011-12-26 03:38:03 +04:00
|
|
|
this->matrix_ = Transform3d::Identity();
|
|
|
|
this->color_.fill(-1.0f);
|
2010-08-28 19:34:22 +04:00
|
|
|
}
|
2010-03-02 21:22:31 +03:00
|
|
|
virtual ~State() {}
|
|
|
|
|
|
|
|
void setPrefix(bool on) { this->isprefix = on; }
|
|
|
|
void setPostfix(bool on) { this->ispostfix = on; }
|
|
|
|
void setNumChildren(unsigned int numc) { this->numchildren = numc; }
|
|
|
|
void setParent(const AbstractNode *parent) { this->parentnode = parent; }
|
2011-12-26 03:38:03 +04:00
|
|
|
void setMatrix(const Transform3d &m) { this->matrix_ = m; }
|
|
|
|
void setColor(const Color4f &c) { this->color_ = c; }
|
2010-03-02 21:22:31 +03:00
|
|
|
|
|
|
|
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; }
|
2011-12-26 03:38:03 +04:00
|
|
|
const Transform3d &matrix() const { return this->matrix_; }
|
|
|
|
const Color4f &color() const { return this->color_; }
|
2010-03-02 21:22:31 +03:00
|
|
|
|
|
|
|
private:
|
|
|
|
const AbstractNode * parentnode;
|
|
|
|
bool isprefix;
|
|
|
|
bool ispostfix;
|
|
|
|
unsigned int numchildren;
|
2010-08-28 19:34:22 +04:00
|
|
|
|
2011-09-03 01:35:10 +04:00
|
|
|
// Transformation matrix and color. FIXME: Generalize such state variables?
|
2011-12-26 03:38:03 +04:00
|
|
|
Transform3d matrix_;
|
|
|
|
Color4f color_;
|
2010-03-02 21:22:31 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|