refactoring vr code

This commit is contained in:
2019-05-31 23:02:53 +02:00
parent d2a62df5c7
commit 20582dafa8
6 changed files with 138 additions and 117 deletions

View File

@@ -601,10 +601,6 @@ static int engine_init_display(struct engine* engine) {
//LOG("PROP: %s", os_props[""].c_str());
//LOG("PROP: %s", os_props[""].c_str());
#ifdef __QUEST__
oculus_init_vr(display, context, engine->app->window);
#endif
// Initialize GL state.
android_async_lock(engine);
@@ -628,7 +624,14 @@ static int engine_init_display(struct engine* engine) {
App::I.height = h;
App::I.redraw = true;
App::I.init();
#ifdef __QUEST__
App::I.resize(w, h);
oculus_init_vr(display, context, engine->app->window);
App::I.vr_active = true;
App::I.has_vr = true;
App::I.vr_only = true;
#endif
LOG("All ready");
engine->animating = 1;
@@ -669,35 +672,20 @@ static void engine_draw_frame(struct engine* engine) {
return;
rendered_frames++;
elapsed = 0;
#ifdef __QUEST__
App::I.vr_draw_ui();
App::I.update(elapsed);
oculus_draw();
#else
/*
int w, h;
eglQuerySurface(engine->display, engine->surface, EGL_WIDTH, &w);
eglQuerySurface(engine->display, engine->surface, EGL_HEIGHT, &h);
if (w != engine->width || h != engine->height) {
engine->width = w;
engine->height = h;
App::I.resize(w, h);
App::I.redraw = true;
LOG("resize window to %d %d", w, h);
}
*/
if (!(App::I.redraw || App::I.animate))
return;
App::I.clear();
App::I.update(elapsed);
elapsed = 0;
eglSwapBuffers(engine->display, engine->surface);
#endif
elapsed = 0;
}
/**