-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.cpp
More file actions
56 lines (40 loc) · 1.4 KB
/
Main.cpp
File metadata and controls
56 lines (40 loc) · 1.4 KB
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
#include <iostream>
#include <cstdlib>
#include <cmath>
#include "RenderEngine.h"
#include "Viewport.h"
#include "Window.h"
//////////////////////////////////////////////////////////////////////
int main(int argc, char ** argv)
{
glutInit(&argc, argv);
const auto screenWidth = (USHORT)(glutGet(GLUT_SCREEN_WIDTH));
const auto screenHeight = (USHORT)(glutGet(GLUT_SCREEN_HEIGHT));
Scene scene;
scene.LoadScene(Scene_SeaShell);
const uint32_t maxSamples = 100000;
WINDOW_W = (USHORT)(screenWidth * 0.7F);
WINDOW_H = (USHORT)(screenHeight * 0.9F);
RenderSettings rendSett(WINDOW_W, WINDOW_H, maxSamples, SamplingMethod::SOBOL);
ViewportSettings viewSett(WINDOW_W, WINDOW_H);
RenderFunction renderFunc(rendSett, scene, G_RESULT_POINTS);
Viewport viewport(viewSett, renderFunc);
viewport.Draw();
glutInitWindowSize(WINDOW_W, WINDOW_H);
glutInitWindowPosition((screenWidth - WINDOW_W)/2, (screenHeight - WINDOW_H)/2);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
glutCreateWindow("Simple render");
glutReshapeFunc (resize);
glutDisplayFunc (display);
glutIdleFunc (idle);
glutKeyboardFunc(key);
glutMouseFunc (mouse_button);
glutMotionFunc (mouse_motion);
glClearColor(0.0f,0.0f,0.0f,1.0f);
glEnable(GL_CULL_FACE);
glCullFace(GL_BACK);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LESS);
glutMainLoop();
return 0; // never reached
}