-
Notifications
You must be signed in to change notification settings - Fork 1
/
settingWindow.cpp
78 lines (64 loc) · 1.89 KB
/
settingWindow.cpp
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
// vjshader
//
// settingWindow.cpp
//
// Created by Lewis Lepton on 24/04/2020.
// lewislepton.com
//
#include "settingWindow.hpp"
//--------------------------------------------------------------
void settingWindow::setup(){
ofSetWindowTitle("controls");
shapes.setup();
gui.setup();
gui.add(uiAction.set("action", false));
gui.add(uiActionSpeed.set("action speed", 0, 0, 1));
gui.add(uiColor.set("color", ofVec3f(0), ofVec3f(0), ofVec3f(1)));
shapes.shapeParams.setName("Shape Parameters");
shapes.shapeParams.add(shapes.drawBox.set("Box", false));
shapes.shapeParams.add(shapes.decay.set("Decay", 0.0, 0.0, 1.0));
shapes.shapeParams.add(shapes.rotateScene.set("Rotate", ofVec3f(0.0), ofVec3f(-1.0), ofVec3f(1.0)));
shapes.shapeParams.add(shapes.numberOfShapes.set("# Shapes", 50, 0, 100));
gui.add(shapes.shapeParams);
fbo.allocate(640, 360);
fbo.begin();
ofClear(255);
shader.allocate(fbo.getWidth(), fbo.getHeight());
shader.load("color.frag");
fbo.end();
}
//--------------------------------------------------------------
void settingWindow::update(){
fbo.begin();
//update shapes
shapes.update();
shader.setUniform3f("u_color", uiColor->x, uiColor->y, uiColor->z);
fbo.end();
fbo.begin();
shader.render();
// shader.draw(0, 0);
shader.draw(0, 0, ofGetWidth(), ofGetHeight());
fbo.end();
}
//--------------------------------------------------------------
void settingWindow::draw(){
fbo.draw(0, 0);
//draw shapes
camera.begin();
shapes.draw();
camera.end();
if (bHide){
gui.draw();
}
}
//--------------------------------------------------------------
void settingWindow::keyPressed(int key){
if (key == 'h'){
bHide = !bHide;
}
}
//--------------------------------------------------------------
void settingWindow::windowResized(int w, int h){
shader.allocate(w, h);
fbo.allocate(w, h);
}