File: fovhandler.cpp

package info (click to toggle)
amoeba 1.1-26
  • links: PTS
  • area: contrib
  • in suites: jessie, jessie-kfreebsd, wheezy
  • size: 1,256 kB
  • ctags: 1,561
  • sloc: cpp: 8,315; makefile: 173
file content (50 lines) | stat: -rw-r--r-- 977 bytes parent folder | download | duplicates (11)
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
#include <string.h>
#include <math.h>
#include <stdlib.h>

#ifdef WIN32
#include <windows.h>
#endif
#include <GL/gl.h>

#include "main/fovhandler.h"
#include "exception.h"
#include "demolib_prefs.h"

#ifndef M_PI
#define M_PI 3.141592653589793238462643383279502
#endif

#if DEMOLIB_MAINLOOP 

FOVHandler::FOVHandler(MainLoop *ml, const char *title, const char *elem, Hashtable *attr) :
		Event(ml, title, elem, attr, "fov")
{
	this->layer = -900.0f;
}

FOVHandler::~FOVHandler()
{
}

void FOVHandler::start_effect() {}

void FOVHandler::draw_scene(float progress)
{
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
        gluPerspective(this->get_val("fov", progress),
		DEMOLIB_XASPECT / DEMOLIB_YASPECT, 1.0f, 500.0f);
	glMatrixMode(GL_MODELVIEW);
}

/* reset FOV at end */
void FOVHandler::end_effect()
{
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
        gluPerspective(53.0f, DEMOLIB_XASPECT / DEMOLIB_YASPECT, 1.0f, 500.0f);
	glMatrixMode(GL_MODELVIEW);
}

#endif