-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathScene.cpp
64 lines (49 loc) · 1.68 KB
/
Scene.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
#include "Scene.h"
Scene::Scene()
{
m_hra = new GameWorld();
m_lights = new Lights();
campos=500;
glClearColor (0.0, 0.0, 0.0, 0.0);
glClearDepth(1.0);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LESS);
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
glShadeModel(GL_SMOOTH);
/*
//MLHA
GLfloat fogColor[4]= {0.5, 0.5, 0.5, 0.2}; // Fog Color
glClearColor(0.5,0.5,0.5,1.0f);
glFogi(GL_FOG_MODE, GL_LINEAR); // Fog Mode
glFogfv(GL_FOG_COLOR, fogColor); // Set Fog Color
glFogf(GL_FOG_DENSITY, 0.5); // How Dense Will The Fog Be
glHint(GL_FOG_HINT, GL_NICEST); // Fog Hint Value
glFogf(GL_FOG_START, -1000.0); // Fog Start Depth
glFogf(GL_FOG_END,1000); // Fog End Depth
glEnable(GL_FOG); // Enables GL_FOG
*/
}
void Scene::drawScene()
{
//nastaeni sceny a pohyb kamery
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(20.0, 1.3 , 1, 20000.0);
gluLookAt(m_hra->m_player->m_x+300+m_hra->rozdil_x, m_hra->m_player->m_y+campos, m_hra->m_player->m_z-400+m_hra->rozdil_z,m_hra->m_player->m_x+m_hra->rozdil_x, m_hra->m_player->m_y,m_hra->m_player->m_z+m_hra->rozdil_z,0.0, 1.0, 0.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
//vykreleni hry
m_hra->drawGame();
}
//prepinanani pohledu
void Scene::camSwitch(){
//switch kamery
if(campos==500){campos=350;}
else if(campos==350){campos=750;}
else if(campos==750){campos=500;};
}
Scene::~Scene()
{
delete m_hra;
delete m_lights;
}