review vr stuff, fix controller-ui ray casting
This commit is contained in:
22
src/main.cpp
22
src/main.cpp
@@ -164,6 +164,11 @@ void async_unlock()
|
||||
}
|
||||
}
|
||||
|
||||
void win32_render_thread_notify()
|
||||
{
|
||||
render_cv.notify_all();
|
||||
}
|
||||
|
||||
void win32_show_cursor(bool visible)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(main_task_mutex);
|
||||
@@ -551,8 +556,8 @@ bool win32_vr_start()
|
||||
|
||||
const int framerate = (1.f / target_tick_rate) * 1000;
|
||||
const int diff = framerate - (t1 - t0);
|
||||
t0 = t1;
|
||||
hmd_render_cv.wait_for(lock, std::chrono::milliseconds(diff));
|
||||
t0 = t1;
|
||||
}
|
||||
App::I.vr_active = false;
|
||||
App::I.has_vr = false;
|
||||
@@ -817,9 +822,9 @@ int main(int argc, char** argv)
|
||||
WGL_PIXEL_TYPE_ARB, WGL_TYPE_RGBA_ARB,
|
||||
WGL_COLOR_BITS_ARB, 32,
|
||||
WGL_DEPTH_BITS_ARB, 24,
|
||||
WGL_STENCIL_BITS_ARB, 8,
|
||||
WGL_SAMPLE_BUFFERS_ARB, 1, // Number of buffers (must be 1 at time of writing)
|
||||
WGL_SAMPLES_ARB, 4, // Number of samples
|
||||
//WGL_STENCIL_BITS_ARB, 8,
|
||||
//WGL_SAMPLE_BUFFERS_ARB, 1, // Number of buffers (must be 1 at time of writing)
|
||||
//WGL_SAMPLES_ARB, 4, // Number of samples
|
||||
0
|
||||
};
|
||||
UINT numFormat;
|
||||
@@ -844,6 +849,8 @@ int main(int argc, char** argv)
|
||||
return -1; // A negative number because you are a negative one
|
||||
}
|
||||
|
||||
//wglSwapIntervalEXT(1);
|
||||
|
||||
bool start_in_vr = false;
|
||||
if (argc > 1)
|
||||
{
|
||||
@@ -894,7 +901,7 @@ int main(int argc, char** argv)
|
||||
BT_SetTerminate();
|
||||
LOG("start render thread");
|
||||
const float target_fps = 10;
|
||||
const float target_tick_rate = 60;
|
||||
const float target_tick_rate = 10;
|
||||
unsigned long t0 = GetTickCount64();
|
||||
unsigned long t1;
|
||||
bool first_frame = true;
|
||||
@@ -912,7 +919,6 @@ int main(int argc, char** argv)
|
||||
timer_stylus += dt;
|
||||
timer_ink_touch += dt;
|
||||
timer_ink_pen += dt;
|
||||
t0 = t1;
|
||||
|
||||
if (one_sec > 1.f)
|
||||
{
|
||||
@@ -993,20 +999,20 @@ int main(int argc, char** argv)
|
||||
if (App::I.redraw)
|
||||
{
|
||||
async_lock();
|
||||
App::I.redraw = true;
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
App::I.clear();
|
||||
App::I.update(frame_timer);
|
||||
SwapBuffers(hDC);
|
||||
async_unlock();
|
||||
frame_timer = 0;
|
||||
//LOG("swap main");
|
||||
frames++;
|
||||
}
|
||||
|
||||
const int framerate = (1.f / target_tick_rate) * 1000;
|
||||
const int diff = framerate - (t1 - t0);
|
||||
render_cv.wait_for(lock, std::chrono::milliseconds(diff));
|
||||
//std::this_thread::sleep_for(std::chrono::milliseconds(30));
|
||||
t0 = t1;
|
||||
}
|
||||
LOG("renderer terminated");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user