-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.cpp
More file actions
179 lines (138 loc) · 4.72 KB
/
Copy pathMain.cpp
File metadata and controls
179 lines (138 loc) · 4.72 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
#define WIN32_LEAN_AND_MEAN
#define VC_LEANMEAN
//#define GLEW_STATIC
#include "Globals.h"
/*
#include "fx_test/sigiltest.h"
#include "fx_test/test.h"
#include "fx_test/lightingtest.h"
#include "fx_test/postprocesstesti.h"
#include "fx_test/postprocesstesti2.h"
#include "fx_test/cubemaptesti.h"
#include "fx_test/cubemaptesti2.h"
#include "fx_test/particletesti2.h"
#include "fx_test/particletesti3.h"
#include "scenes/shadowtest.h"
#include "scenes/huuru.h"
*/
//#include "scenes/shadowtest.h"
//#include "scenes/shadowtest2.h"
//#include "scenes/dynamiccubetest.h"
//#include "fx_test/computetest.h"
//#include "fx_test/computetest2.h"
//#include "fx_test/postprocesstesti2.h"
//#include "scenes/fjara.h"
//#include "scenes/midaftann.h"
//#include "scenes/rivers.h"
//#include "scenes/mountain.h"
#include "scenes/tyhjyys.h"
#include "scenes/kasvot.h"
#include "scenes/tunne.h"
#include "scenes/sauhu.h"
#include "scenes/tuli.h"
#include "scenes/korona.h"
#include "scenes/korona2.h"
#include "scenes/maailma.h"
#include "scenes/kauneus.h"
#include "scenes/viimeiset.h"
#include "scenes/kalpeus.h"
democore::Debugger g_debug;
democore::Profiler g_profiler;
democore::ErrorLog g_error;
democore::ErrorLog g_screenText;
glm::vec3 g_clearColor = glm::vec3(0, 0, 0);
const std::string g_prodName = "isolated, in sunlight";
using namespace democore;
using namespace demorender;
/*
demo:
viisi skeneä, pentagrammin muotoinen symboli (ympyrä pentagrammin kärjissä)
skene yksi - musta tausta, hohtava valo, kohinaa. Fokus.
skene kaksi - valkoinen pohja ja musta valo (invertoitu), maassa ympyrä sen ympärillä, ehkä fft. Repivä tyhjyys. Raivo.
skene kolme - Auringonpimennys. Logiikka ja rationaalinen mieli.
skene neljä - Jokin asia, joka hajoaa miljoonaksi pieneksi asiaksi. Katharsis.
skene viisi - symboli
*/
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
MSG msg = {0};
//first initialize system
g_system->init();
//and then the demo
std::string scriptfile("data/script.txt");
DemoContext *context = 0;
context = new Demo(CONTEXT_TYPE_DEMO, scriptfile);
//all ok?
if (context->initOk())
{
g_error.setColor(1.f, 0.f, 0.f);
g_screenText.setColor(1.f, 1.f, 1.f);
g_textures->init();
g_textures->loadImages();
g_meshes->init();
g_meshes->loadMeshes();
Math::init();
g_postProcess->init();
// static_cast<Demo*>(context)->addScene("tyhjyys", new Tyhjyys());
static_cast<Demo*>(context)->addScene("kasvot", new Kasvot());
static_cast<Demo*>(context)->addScene("tunne", new Tunne());
static_cast<Demo*>(context)->addScene("sauhu", new Sauhu());
static_cast<Demo*>(context)->addScene("tuli", new Tuli());
static_cast<Demo*>(context)->addScene("korona", new Korona());
static_cast<Demo*>(context)->addScene("korona2", new Korona2());
static_cast<Demo*>(context)->addScene("maailma", new Maailma());
static_cast<Demo*>(context)->addScene("kauneus", new Kauneus());
static_cast<Demo*>(context)->addScene("viimeiset", new Viimeiset());
// static_cast<Demo*>(context)->addScene("kalpeus", new Kalpeus());
// static_cast<Demo*>(context)->addScene("shadowtest", new ShadowTest());
// static_cast<Demo*>(context)->addScene("shadowtest2", new ShadowTest2());
// static_cast<Demo*>(context)->addScene("dynamiccubetest", new DynamicCubeTest());
//init the prodand play
g_textures->createTextures();
g_shaders->loadShaders();
context->init();
context->start();
demorender::Buffer::debugPrint();
bool running = true;
while (running)
{
g_renderDebug->resetGL();
g_screenText.clear();
g_system->update();
g_sync->update();
std::stringstream ss;
if (g_system->getDeveloperMode())
{
ss << "time = " << g_system->getTime() << " fps = " << g_system->getFPS();
glfwSetWindowTitle(g_system->getWindow(), ss.str().c_str());
}
else
{
glfwSetWindowTitle(g_system->getWindow(), g_prodName.c_str());
}
running = context->isRunning();
context->update();
RenderStatistics::clear();
context->draw();
if (g_system->getDeveloperMode())
{
g_error.draw();
if (g_error.getBuffer().empty())
{
g_screenText.draw();
}
}
g_system->swapBuffers();
if (g_system->exitRequested() || context->isExitRequested())
running = false;
}
context->stop();
demorender::g_textures->dumpUnusedImages();
demorender::g_shaders->dumpUnusedShaders();
}
delete context;
return msg.wParam;
}