absence_thelab

view src/demonpart.cpp @ 1:4d5933c261c3

todo and .hgignore
author John Tsiombikas <nuclear@member.fsf.org>
date Thu, 23 Oct 2014 02:18:43 +0300
parents
children
line source
1 #include "demonpart.h"
2 #include "nwt/widget.h"
3 #include "fmod.h"
5 extern Widget *win;
6 extern FMUSIC_MODULE *mod;
8 DemonPart::DemonPart(GraphicsContext *gc) {
9 this->gc = gc;
11 //SceneLoader::SetNormalFileSaving(true);
12 SceneLoader::SetDataPath("data/textures/");
13 SceneLoader::LoadScene("data/geometry/demon.3ds", &scene);
15 curve = scene->GetCurve("Line01");
16 curve->SetArcParametrization(true);
17 cam = scene->GetCamera("Camera01");
18 cam->SetCameraPath(curve, 0, 0, 1500);
19 }
21 DemonPart::~DemonPart() {
22 delete scene;
23 }
25 void DemonPart::MainLoop() {
26 dword msec = timer.GetMilliSec();
27 float t = msec / 1000.0f;
29 FMUSIC_SetMasterVolume(mod, (1500 - msec) / 6);
31 gc->Clear(0);
32 gc->ClearZBufferStencil(1.0f, 0);
34 if(t > 1.5f) {
35 PostMessage(win, WM_CLOSE, 0, 0);
36 }
38 cam->FollowPath(msec);
39 scene->Render();
40 }