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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
#include "ofApp.h"
#include "glew.h"
#include "pluginpanel.h"
//--------------------------------------------------------------
void ofApp::setup(){
ofSetFrameRate(60);
plugingui.setup("chaos","",10,10);
testsettings.setup("test","",10,160);
}
#define STEPS_X 8
#define STEPS_Y 6
#define NUM_FRAMES 10
void ofApp::update(){
plugingui.update();
//seed the pipeline of drawing for the chaos algorithm
/*
n-> delete
n-1 -> chaos -> n
n-2 -> chaos -> n-1
. . .
1 -> chaos -> 2
new frame -> chaos -> 1
*/
vector<colourPolyline> frame;
for (int i=ofGetWidth()/STEPS_X;i<ofGetWidth();i+=ofGetWidth()/STEPS_X){
for (int j=ofGetHeight()/STEPS_Y;j<ofGetHeight();j+=ofGetHeight()/STEPS_Y){
colourPolyline poly;
poly.addVertex(i,j,ofColor(255,255,255));
poly.addVertex(i+1,j,ofColor(255,255,255));
frame.push_back(poly);
}
}
drawing.push_front(frame);
if (drawing.size()>NUM_FRAMES){
drawing.pop_back();
}
}
void ofApp::draw(){
ofBackground(0);
ofSetColor(255);
ofNoFill();
plugingui.draw();
testsettings.draw();
glLineWidth(2);
for (auto i=drawing.begin();i!=drawing.end();i++){
for (auto j=i->begin();j!=i->end();j++){
for (int k=0;k<j->size();k++){
(*j)[k]=plugingui.calc((*j)[k]);
}
j->draw();
}
}
ofSetWindowTitle(ofToString(ofGetFrameRate(), 2)+" fps");
}
void ofApp::exit() {
}
void ofApp::keyPressed(ofKeyEventArgs &args){
}
void ofApp::keyReleased(ofKeyEventArgs &args){
}
void ofApp::mouseMoved(int x, int y ){
}
void ofApp::mouseDragged(int x, int y, int button){
}
void ofApp::mousePressed(int x, int y, int button){
}
void ofApp::mouseReleased(int x, int y, int button){
}
void ofApp::mouseEntered(int x, int y){
}
void ofApp::mouseExited(int x, int y){
}
void ofApp::windowResized(int w, int h){
}
void ofApp::dragEvent(ofDragInfo dragInfo){
}
|