-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathParallaxBarrierApp.h
67 lines (49 loc) · 1.59 KB
/
ParallaxBarrierApp.h
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
#pragma once
#include "ofMain.h"
#include "ofxFensterManager.h"
#include "ParallaxBarrier.h"
class ParallaxBarrierApp;
class BarrierWindow: public ofxFensterListener {
public:
BarrierWindow();
~BarrierWindow();
void setup();
void draw();
void keyReleased(int key, ofxFenster* window);
ofImage* barrierImage;
ParallaxBarrierApp* parallaxBarrierApp;
};
class ParallaxBarrierApp : public ofBaseApp {
public:
ParallaxBarrierApp();
~ParallaxBarrierApp();
// ParallaxBarrier apps only need to implement setupApp
void setup();
virtual void setupApp() {};
// 'initializeParallaxBarrier' method must be called from 'setupApp' method
void initializeParallaxBarrier(float width, float height, int screenResolutionWidth, int screenResolutionHeight, int barrierResolutionWidth, int barrierResolutionHeight, float spacing, ofVec3f const &position, ofVec3f const &viewDirection, ofVec3f const &upDirection, int screenOffsetX = 0, int screenOffsetY = 0);
// ParallaxBarrier apps only need to implement drawLeft and drawRight
void draw();
virtual void drawLeft() {};
virtual void drawRight() {};
int getScreenWidth();
int getScreenHeight();
const ofRectangle& getViewport();
void keyReleased(int key);
bool updateBarrier;
protected:
int screenOffsetX, screenOffsetY;
// Eye positions need to be
// updated in app 'update' method
ofVec3f leftEyePosition;
ofVec3f rightEyePosition;
bool invertBarrier;
int invertCounter;
int invertLimit;
ParallaxBarrier* parallaxBarrier;
ofRectangle viewport;
private:
ofxFenster* barrierWindow;
GLuint frameBufferObject;
GLuint frameBufferDepthTexture;
};