File: Builder.h

package info (click to toggle)
structure-synth 1.5.0-2
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 2,268 kB
  • ctags: 1,966
  • sloc: cpp: 10,209; python: 164; makefile: 71; sh: 15
file content (73 lines) | stat: -rw-r--r-- 1,956 bytes parent folder | download | duplicates (9)
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#pragma once

#include <QString>
#include <QProgressDialog>
#include "Rendering/Renderer.h"
#include "RuleSet.h"
#include "State.h"
#include "ColorPool.h"
#include "ExecutionStack.h"

#include "../../SyntopiaCore/Math/Matrix4.h"
#include "../../SyntopiaCore/GLEngine/EngineWidget.h"


namespace StructureSynth {
	namespace Model {	


		using namespace SyntopiaCore;

		/// A Builder executes the rule set on a Renderer object
		class Builder {
		public:
			Builder(Rendering::Renderer* renderTarget, RuleSet* ruleSet, bool verbose);
			~Builder();
			void build();

			void setCommand(QString command, QString param);
			ExecutionStack& getNextStack();
			State& getState() { return state; };
			Rendering::Renderer* getRenderer() { return renderTarget; };
			void increaseObjectCount() { objects++; };

			// True, if the random seed was changed by the builder (by 'set seed <int>')
			bool seedChanged() { return hasSeedChanged; }
			int getNewSeed() { return newSeed; }
			ColorPool* getColorPool() { return colorPool; }
			QVector<GLEngine::Command> getRaytracerCommands() { return raytracerCommands; };
			bool wasCancelled() { return userCancelled; }

		private:
			void recurseBreadthFirst(QProgressDialog& progressDialog, int& maxTerminated, int& minTerminated, int& generationCounter);
			void recurseDepthFirst(QProgressDialog& progressDialog, int& maxTerminated, int& minTerminated, int& generationCounter);
		
			State state;

			bool userCancelled;
			
			ExecutionStack stack;
			ExecutionStack nextStack;
			Rendering::Renderer* renderTarget;
			RuleSet* ruleSet;
			bool verbose;
			int maxGenerations;
			int maxObjects;
			int objects;
			int newSeed;
			bool hasSeedChanged;
			float minDim;
			float maxDim;
			bool syncRandom;
			int initialSeed;
			State* currentState;
			ColorPool* colorPool;
			QVector<GLEngine::Command> raytracerCommands;
		};

		


	}
}