1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
#pragma once
#include "Rendering/Renderer.h"
#include "State.h"
namespace StructureSynth {
namespace Model {
class RuleRef; // forward decl.
class Builder; // forward decl.
/// (Abstract) Base class for rules.
class Rule {
public:
/// Every rule must have a name.
Rule(QString name) : name(name) { maxDepth = -1; };
Rule() { maxDepth = -1; };
virtual ~Rule() {};
QString getName() const { return name; }
/// When applied the rule will add new pending rules to the ExecutionStack for execution.
/// Only PrimitiveRules will make use of the renderer.
virtual void apply(Builder* builder) const = 0;
/// Returns a list over rules that this rule references.
virtual QList<RuleRef*> getRuleRefs() const { return QList<RuleRef*>(); }
virtual void setMaxDepth(int maxDepth) { this->maxDepth = maxDepth; }
virtual int getMaxDepth() const { return maxDepth; }
protected:
QString name;
int maxDepth;
};
}
}
|