#include "datamap.h"
#include "ui.h"
#include "opt.h"
+#include "post.h"
#define NEAR_CLIP 5.0
#define FAR_CLIP 10000.0
long time_msec;
int win_width, win_height;
float win_aspect;
+bool fb_srgb;
bool opt_gear_wireframe;
static float cam_dist = 0.0;
static float user_eye_height = 165;
static float walk_speed = 300.0f;
+static float mouse_speed = 1.0f;
static bool show_walk_mesh, noclip = false;
static bool have_headtracking, should_swap;
static Mat4 view_matrix, mouse_view_matrix, proj_matrix;
static TextureSet texman;
static Scene *scn;
-static unsigned int sdr;
+static unsigned int sdr, sdr_post_gamma;
static long prev_msec;
goatvr_recenter();
}
+ int srgb_capable;
+ glGetIntegerv(GL_FRAMEBUFFER_SRGB_CAPABLE_EXT, &srgb_capable);
+ printf("Framebuffer %s sRGB-capable\n", srgb_capable ? "is" : "is not");
+ fb_srgb = srgb_capable != 0;
glEnable(GL_FRAMEBUFFER_SRGB);
+
glEnable(GL_MULTISAMPLE);
glEnable(GL_DEPTH_TEST);
glEnable(GL_CULL_FACE);
set_uniform_int(sdr, "texmap", 0);
set_uniform_int(sdr, "lightmap", 1);
+ if(!fb_srgb) {
+ sdr_post_gamma = create_program_load("sdr/post_gamma.v.glsl", "sdr/post_gamma.p.glsl");
+ }
+
glUseProgram(0);
if(opt.vr || opt.fullscreen) {
draw_scene();
+ if(!fb_srgb && sdr_post_gamma) {
+ slow_post(sdr_post_gamma);
+ glUseProgram(0);
+ }
app_swap_buffers();
}
assert(glGetError() == GL_NO_ERROR);
}
break;
+ case 'p':
+ if(mod & MOD_CTRL) {
+ fb_srgb = !fb_srgb;
+ show_message("gamma correction for non-sRGB framebuffers: %s\n", fb_srgb ? "off" : "on");
+ }
+ break;
+
case '=':
walk_speed *= 1.25;
show_message("walk speed: %g", walk_speed);
walk_speed *= 0.75;
show_message("walk speed: %g", walk_speed);
break;
+
+ case ']':
+ mouse_speed *= 1.2;
+ show_message("mouse speed: %g", mouse_speed);
+ break;
+
+ case '[':
+ mouse_speed *= 0.8;
+ show_message("mouse speed: %g", mouse_speed);
+ break;
}
}
static inline void mouse_look(int dx, int dy)
{
- cam_theta += dx * 0.5;
- cam_phi += dy * 0.5;
+ float scrsz = (float)win_height;
+ cam_theta += dx * 512.0 / scrsz;
+ cam_phi += dy * 512.0 / scrsz;
if(cam_phi < -90) cam_phi = -90;
if(cam_phi > 90) cam_phi = 90;
void app_mouse_delta(int dx, int dy)
{
if(bnstate[2]) {
- mouse_zoom(dx, dy);
+ mouse_zoom(dx * mouse_speed, dy * mouse_speed);
} else {
- mouse_look(dx, dy);
+ mouse_look(dx * mouse_speed, dy * mouse_speed);
}
}