File: Transformation.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 (66 lines) | stat: -rw-r--r-- 1,738 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
#pragma once

#include <QString>
#include <QColor>
#include "State.h"
#include "ColorPool.h"
#include "../../SyntopiaCore/Math/Matrix4.h"

namespace StructureSynth {
	namespace Model {	

		class Transformation  {
		public:
			Transformation();
			~Transformation();

			/// 'Applies' the transformation 'T' to this transformation.
			/// (For the matrix this corresponds to matrix multiplication).
			void append(const Transformation& T);
			State apply(const State& s, ColorPool* colorPool) const;

			// The predefined operators
			// Translations
			static Transformation createX(double offset);
			static Transformation createY(double offset);
			static Transformation createZ(double offset);
			
			// Rotations
			static Transformation createRX(double angle);
			static Transformation createRY(double angle);
			static Transformation createRZ(double angle);

			// Plane reflection
			static Transformation createPlaneReflection(SyntopiaCore::Math::Vector3f normal);
			
			// Scaling 
			static Transformation createScale(double x, double y, double z);
		
			// Free transformation 
			static Transformation createMatrix(QVector<double> vals);
		
			// Color stuff
			static Transformation createHSV(float h, float s, float v, float a);
			static Transformation createColor(QString color);
			static Transformation createBlend(QString color, double strength);
		
		
		private:
			// Matrix and Color transformations here.
			SyntopiaCore::Math::Matrix4f matrix;

			// For color alterations
			float deltaH;
			float scaleS;
			float scaleV;
			float scaleAlpha;
			bool absoluteColor;

			// For color blends.
			QColor blendColor;
			double strength;
		};

	}
}