34
34
35
35
#define MNU_SAVE_BMP 17
36
36
#define MNU_TOGGLE_CLIPPLANE 16
37
- #define MNU_LIGHT_POS_2REL 15
38
- #define MNU_LIGHT_POS_1REL 14
39
- #define MNU_LIGHT_POS_2ABS 13
40
- #define MNU_TOGGLE_LIGHT2 12
41
- #define MNU_TOGGLE_LIGHT1 11
42
37
#define MNU_RESET 10
43
- #define MNU_ORTHO 9
44
- #define MNU_PERSPECTIVE 8
45
- #define MNU_TOGGLE_WIND 7
46
- #define MNU_CHANGE_COLOR 6
47
38
#define MNU_OPENCLOSE_DOOR 5
48
39
#define MNU_STOP_HOUSE_ROTATION 4
49
40
#define MNU_START_HOUSE_ROTATION 3
50
- #define MNU_TOGGLE_WIREFRAME 2
51
- #define MNU_TOGGLE_AXIS 1
52
- #define PROJ_ORTHOGRAPHIC ' a'
53
- #define PROJ_PERSPECTIVE ' p'
54
41
55
42
const int WINDOW_WIDTH = 800 ;
56
43
const int WINDOW_HEIGHT = 600 ;
57
- const int ANIM_MSEC = 50 ;
44
+ const int ANIM_MSEC = 10 ;
58
45
const int WIND_MSEC = 5000 ;
59
46
const char ESCAPE = 27 ;
60
47
@@ -66,7 +53,7 @@ struct AppGlobals {
66
53
// global variables
67
54
GLfloat windAngle = 0.0 ;
68
55
int mainWindowID = 0 ;
69
- GLfloat fovy = 30 ;
56
+ GLfloat fovy = 45 ;
70
57
71
58
Texture texture;
72
59
@@ -93,7 +80,6 @@ void displayCallback() {
93
80
// draw house
94
81
_app->house .draw ();
95
82
96
-
97
83
glClipPlane (GL_CLIP_PLANE0, _app->clip_plane_0 );
98
84
glutSwapBuffers ();
99
85
}
@@ -116,10 +102,14 @@ void animationCallback(int value) {
116
102
117
103
void reshapeCallback (int w, int h) {
118
104
glViewport (0 , 0 , (GLsizei) w, (GLsizei) h);
105
+ reshape (w, h);
106
+ }
107
+
108
+ void reshape (int w, int h) {
119
109
GLfloat aspect = (GLfloat)w/(h==0 ? 1.0 : h);
120
110
// Imposta la matrice di proiezione di tipo prospettica
121
111
// notare che l'angolo va passato in radianti
122
- _app->projection = glm::perspective (_app->fovy / 180 .0f * glm::pi<float >(), aspect, 1 .0f , 10 .0f );
112
+ _app->projection = glm::perspective (_app->fovy / 180 .0f * glm::pi<float >(), aspect, 1 .0f , 100 .0f );
123
113
glUniformMatrix4fv (_app->projectionPos , 1 , GL_FALSE, &_app->projection [0 ][0 ]);
124
114
}
125
115
@@ -176,12 +166,12 @@ void specialKeyCallback(int key, int x, int y) {
176
166
case GLUT_KEY_F9:
177
167
_app->fovy -= 1 ;
178
168
log (" fovy=" + std::to_string (_app->fovy ));
179
- // TODO reshape(glutGet(GLUT_WINDOW_WIDTH), glutGet(GLUT_WINDOW_HEIGHT));
169
+ reshape (glutGet (GLUT_WINDOW_WIDTH), glutGet (GLUT_WINDOW_HEIGHT));
180
170
break ;
181
171
case GLUT_KEY_F10:
182
172
_app->fovy += 1 ;
183
173
log (" fovy=" + std::to_string (_app->fovy ));
184
- // TODO reshape(glutGet(GLUT_WINDOW_WIDTH), glutGet(GLUT_WINDOW_HEIGHT));
174
+ reshape (glutGet (GLUT_WINDOW_WIDTH), glutGet (GLUT_WINDOW_HEIGHT));
185
175
break ;
186
176
187
177
case GLUT_KEY_PAGE_DOWN:
0 commit comments