long time_msec;
int win_width, win_height;
+int vp_width, vp_height;
float win_aspect;
bool fb_srgb;
bool opt_gear_wireframe;
avatar.body_rot = rad_to_deg(acos(dot(dir, Vec3(0, 0, 1))));
exman = new ExhibitManager;
- /*
- if(!exman->load(mscn, "data/exhibits")) {
- //return false;
- }
- */
+ // exhibits are loaded in post_scene_init, because they need access to the scene graph
+
if(!exui_init()) {
error_log("failed to initialize exhibit ui system\n");
return false;
}
rend = new Renderer;
+ if(!rend->init()) {
+ return false;
+ }
rend->set_scene(mscn);
glUseProgram(0);
return true;
}
+// post_scene_init is called after the scene has completed loading
static void post_scene_init()
{
+ mscn->update(0); // update once to calculate node matrices
+
int num_mir = mscn->calc_mirror_planes();
info_log("found %d mirror planes\n", num_mir);
for(int i=0; i<2; i++) {
// for each eye
goatvr_draw_eye(i);
+ vp_width = goatvr_get_fb_eye_width(i);
+ vp_height = goatvr_get_fb_eye_height(i);
proj_matrix = goatvr_projection_matrix(i, NEAR_CLIP, FAR_CLIP);
glMatrixMode(GL_PROJECTION);
}
goatvr_draw_done();
+ vp_width = win_width;
+ vp_height = win_height;
+
if(should_swap) {
app_swap_buffers();
}
glViewport(0, 0, x, y);
goatvr_set_fb_size(x, y, 1.0f);
debug_gui_reshape(x, y);
+
+ vp_width = x;
+ vp_height = y;
}
void app_keyboard(int key, bool pressed)