X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=laserbrain_demo;a=blobdiff_plain;f=src%2Fapp.cc;h=60affa003407b41afe7a44b950ea071c2e287a71;hp=d2f947662cf33f43ca29123095559635b4f737e0;hb=3674b7a5b534224cc22551673a9d0ae9b83206c4;hpb=ba339e843c1680b799b7bb9eaf8ec17fc56c8ea6 diff --git a/src/app.cc b/src/app.cc index d2f9476..60affa0 100644 --- a/src/app.cc +++ b/src/app.cc @@ -13,6 +13,8 @@ #include "ui.h" #include "opt.h" #include "post.h" +#include "renderer.h" +#include "exman.h" #include "blob_exhibit.h" #define NEAR_CLIP 5.0 @@ -60,9 +62,12 @@ static unsigned int sdr_post_gamma; static long prev_msec; +static ExhibitManager *exman; static BlobExhibit *blobs; static bool show_blobs; +static Renderer *rend; + bool app_init(int argc, char **argv) { @@ -116,6 +121,11 @@ bool app_init(int argc, char **argv) dir.y = 0; cam_theta = rad_to_deg(acos(dot(dir, Vec3(0, 0, 1)))); + exman = new ExhibitManager; + if(!exman->load(mscn, "data/exhibits")) { + return false; + } + blobs = new BlobExhibit; blobs->node = new SceneNode; blobs->init(); @@ -123,6 +133,8 @@ bool app_init(int argc, char **argv) blobs->node->set_scaling(Vec3(28, 28, 28)); blobs->node->update(0); + exman->add(blobs); + if(!(sdr_ltmap_notex = create_program_load("sdr/lightmap.v.glsl", "sdr/lightmap-notex.p.glsl"))) { return false; } @@ -139,6 +151,9 @@ bool app_init(int argc, char **argv) sdr_post_gamma = create_program_load("sdr/post_gamma.v.glsl", "sdr/post_gamma.p.glsl"); } + rend = new Renderer; + rend->set_scene(mscn); + glUseProgram(0); if(opt.vr || opt.fullscreen) { @@ -154,9 +169,9 @@ void app_cleanup() goatvr_shutdown(); } - blobs->destroy(); - delete blobs->node; - delete blobs; + delete rend; + + delete exman; texman.clear(); sceneman.clear(); @@ -186,9 +201,7 @@ static void update(float dt) sceneman.update(); mscn->update(dt); - if(show_blobs) { - blobs->update(dt); - } + exman->update(dt); float speed = walk_speed * dt; Vec3 dir; @@ -354,7 +367,8 @@ static void draw_scene() set_light(1, lpos[1], Vec3(0.6, 0.7, 1.0) * 0.6); set_light(2, lpos[2], Vec3(0.8, 1.0, 0.8) * 0.3); - mscn->draw(); + rend->draw(); + if(show_blobs) { blobs->draw(); }