absence_thelab
annotate 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 |
rev | line source |
---|---|
nuclear@0 | 1 #include "demonpart.h" |
nuclear@0 | 2 #include "nwt/widget.h" |
nuclear@0 | 3 #include "fmod.h" |
nuclear@0 | 4 |
nuclear@0 | 5 extern Widget *win; |
nuclear@0 | 6 extern FMUSIC_MODULE *mod; |
nuclear@0 | 7 |
nuclear@0 | 8 DemonPart::DemonPart(GraphicsContext *gc) { |
nuclear@0 | 9 this->gc = gc; |
nuclear@0 | 10 |
nuclear@0 | 11 //SceneLoader::SetNormalFileSaving(true); |
nuclear@0 | 12 SceneLoader::SetDataPath("data/textures/"); |
nuclear@0 | 13 SceneLoader::LoadScene("data/geometry/demon.3ds", &scene); |
nuclear@0 | 14 |
nuclear@0 | 15 curve = scene->GetCurve("Line01"); |
nuclear@0 | 16 curve->SetArcParametrization(true); |
nuclear@0 | 17 cam = scene->GetCamera("Camera01"); |
nuclear@0 | 18 cam->SetCameraPath(curve, 0, 0, 1500); |
nuclear@0 | 19 } |
nuclear@0 | 20 |
nuclear@0 | 21 DemonPart::~DemonPart() { |
nuclear@0 | 22 delete scene; |
nuclear@0 | 23 } |
nuclear@0 | 24 |
nuclear@0 | 25 void DemonPart::MainLoop() { |
nuclear@0 | 26 dword msec = timer.GetMilliSec(); |
nuclear@0 | 27 float t = msec / 1000.0f; |
nuclear@0 | 28 |
nuclear@0 | 29 FMUSIC_SetMasterVolume(mod, (1500 - msec) / 6); |
nuclear@0 | 30 |
nuclear@0 | 31 gc->Clear(0); |
nuclear@0 | 32 gc->ClearZBufferStencil(1.0f, 0); |
nuclear@0 | 33 |
nuclear@0 | 34 if(t > 1.5f) { |
nuclear@0 | 35 PostMessage(win, WM_CLOSE, 0, 0); |
nuclear@0 | 36 } |
nuclear@0 | 37 |
nuclear@0 | 38 cam->FollowPath(msec); |
nuclear@0 | 39 scene->Render(); |
nuclear@0 | 40 } |