X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=vid_shared.c;h=30bb057babadadb31dad17c71f1bad389981c635;hb=5d39354b42e1e601bb632b2e96631fad6c410b58;hp=849313b8f32ea962a2e22ec01081a696b16203ba;hpb=1b430471290d5c0a938a6936c3174ab5dab5e804;p=xonotic%2Fdarkplaces.git diff --git a/vid_shared.c b/vid_shared.c index 849313b8..30bb057b 100644 --- a/vid_shared.c +++ b/vid_shared.c @@ -48,6 +48,8 @@ int gl_support_shading_language_100 = false; int gl_support_vertex_shader = false; // GL_ARB_fragment_shader int gl_support_fragment_shader = false; +// GL_NV_half_float +int gl_support_half_float = false; // LordHavoc: if window is hidden, don't update screen qboolean vid_hidden = true; @@ -70,14 +72,9 @@ cvar_t vid_bitsperpixel = {CVAR_SAVE, "vid_bitsperpixel", "32"}; cvar_t vid_vsync = {CVAR_SAVE, "vid_vsync", "0"}; cvar_t vid_mouse = {CVAR_SAVE, "vid_mouse", "1"}; -cvar_t gl_combine = {CVAR_SAVE, "gl_combine", "1"}; +cvar_t gl_combine = {0, "gl_combine", "1"}; cvar_t gl_finish = {0, "gl_finish", "0"}; -cvar_t in_pitch_min = {0, "in_pitch_min", "-90"}; // quake used -70 -cvar_t in_pitch_max = {0, "in_pitch_max", "90"}; // quake used 80 - -cvar_t m_filter = {CVAR_SAVE, "m_filter","0"}; - cvar_t v_gamma = {CVAR_SAVE, "v_gamma", "1"}; cvar_t v_contrast = {CVAR_SAVE, "v_contrast", "1"}; cvar_t v_brightness = {CVAR_SAVE, "v_brightness", "0"}; @@ -678,12 +675,15 @@ void VID_CheckExtensions(void) // COMMANDLINEOPTION: GL: -noshaderobjects disables GL_ARB_shader_objects (required for vertex shader and fragment shader) // COMMANDLINEOPTION: GL: -noshadinglanguage100 disables GL_ARB_shading_language_100 (required for vertex shader and fragment shader) -// COMMANDLINEOPTION: GL: -novertexshader disables GL_ARB_vertex_shader (currently unused, allows vertex shader effects) -// COMMANDLINEOPTION: GL: -nofragmentshader disables GL_ARB_fragment_shader (currently unused, allows pixel shader effects) +// COMMANDLINEOPTION: GL: -novertexshader disables GL_ARB_vertex_shader (allows vertex shader effects) +// COMMANDLINEOPTION: GL: -nofragmentshader disables GL_ARB_fragment_shader (allows pixel shader effects, can improve per pixel lighting performance and capabilities) if ((gl_support_shader_objects = GL_CheckExtension("GL_ARB_shader_objects", shaderobjectsfuncs, "-noshaderobjects", false))) if ((gl_support_shading_language_100 = GL_CheckExtension("GL_ARB_shading_language_100", NULL, "-noshadinglanguage100", false))) if ((gl_support_vertex_shader = GL_CheckExtension("GL_ARB_vertex_shader", vertexshaderfuncs, "-novertexshader", false))) gl_support_fragment_shader = GL_CheckExtension("GL_ARB_fragment_shader", NULL, "-nofragmentshader", false); + +// COMMANDLINEOPTION: GL: -nohalffloat disables GL_NV_half_float extension + gl_support_half_float = GL_CheckExtension("GL_NV_half_float", NULL, "-nohalffloat", false); } qboolean vid_vertexarrays_are_var = false; @@ -723,98 +723,6 @@ void Force_CenterView_f (void) cl.viewangles[PITCH] = 0; } -void IN_PreMove(void) -{ -} - -void CL_AdjustAngles(void); -void IN_PostMove(void) -{ - // clamp after the move as well to prevent messed up rendering angles - CL_AdjustAngles(); -} - -/* -=========== -IN_DoMove -=========== -*/ -void IN_ProcessMove(void) -{ - // get basic movement from keyboard - CL_BaseMove(); - - // OS independent code - IN_PreMove(); - - // allow mice or other external controllers to add to the move - IN_Move(); - - // OS independent code - IN_PostMove(); -} - - -void IN_Mouse(float mx, float my) -{ - int mouselook = (in_mlook.state & 1) || freelook.integer; - float mouse_x, mouse_y; - static float old_mouse_x = 0, old_mouse_y = 0; - - if (m_filter.integer) - { - mouse_x = (mx + old_mouse_x) * 0.5; - mouse_y = (my + old_mouse_y) * 0.5; - } - else - { - mouse_x = mx; - mouse_y = my; - } - - old_mouse_x = mx; - old_mouse_y = my; - - in_mouse_x = (float) mouse_x * vid.conwidth / vid.realwidth; - in_mouse_y = (float) mouse_y * vid.conheight / vid.realheight; - - // AK: eveything else is client stuff - // BTW, this should be seperated somewhen - if(!in_client_mouse) - return; - - if (cl_prydoncursor.integer) - { - cl.cmd.cursor_screen[0] += mouse_x * sensitivity.value / vid.realwidth; - cl.cmd.cursor_screen[1] += mouse_y * sensitivity.value / vid.realheight; - V_StopPitchDrift(); - return; - } - - // LordHavoc: viewzoom affects mouse sensitivity for sniping - mouse_x *= sensitivity.value * cl.viewzoom; - mouse_y *= sensitivity.value * cl.viewzoom; - - // Add mouse X/Y movement to cmd - if ((in_strafe.state & 1) || (lookstrafe.integer && mouselook)) - cl.cmd.sidemove += m_side.value * mouse_x; - else - cl.viewangles[YAW] -= m_yaw.value * mouse_x; - - if (mouselook) - V_StopPitchDrift(); - - if (mouselook && !(in_strafe.state & 1)) - cl.viewangles[PITCH] += m_pitch.value * mouse_y; - else - { - if ((in_strafe.state & 1) && noclip_anglehack) - cl.cmd.upmove -= m_forward.value * mouse_y; - else - cl.cmd.forwardmove -= m_forward.value * mouse_y; - } -} - static float cachegamma, cachebrightness, cachecontrast, cacheblack[3], cachegrey[3], cachewhite[3]; static int cachecolorenable, cachehwgamma; #define BOUNDCVAR(cvar, m1, m2) c = &(cvar);f = bound(m1, c->value, m2);if (c->value != f) Cvar_SetValueQuick(c, f); @@ -978,28 +886,21 @@ void VID_Shared_Init(void) Cvar_RegisterVariable(&vid_mouse); Cvar_RegisterVariable(&gl_combine); Cvar_RegisterVariable(&gl_finish); - Cvar_RegisterVariable(&in_pitch_min); - Cvar_RegisterVariable(&in_pitch_max); - Cvar_RegisterVariable(&m_filter); Cmd_AddCommand("force_centerview", Force_CenterView_f); Cmd_AddCommand("vid_restart", VID_Restart_f); if (gamemode == GAME_GOODVSBAD2) Cvar_Set("gl_combine", "0"); } -int current_vid_fullscreen; -int current_vid_width; -int current_vid_height; -int current_vid_bitsperpixel; int VID_Mode(int fullscreen, int width, int height, int bpp) { Con_Printf("Video: %s %dx%dx%d\n", fullscreen ? "fullscreen" : "window", width, height, bpp); if (VID_InitMode(fullscreen, width, height, bpp)) { - current_vid_fullscreen = fullscreen; - current_vid_width = width; - current_vid_height = height; - current_vid_bitsperpixel = bpp; + vid.fullscreen = fullscreen; + vid.width = width; + vid.height = height; + vid.bitsperpixel = bpp; Cvar_SetValueQuick(&vid_fullscreen, fullscreen); Cvar_SetValueQuick(&vid_width, width); Cvar_SetValueQuick(&vid_height, height); @@ -1031,14 +932,14 @@ void VID_Restart_f(void) return; Con_Printf("VID_Restart: changing from %s %dx%dx%dbpp, to %s %dx%dx%dbpp.\n", - current_vid_fullscreen ? "fullscreen" : "window", current_vid_width, current_vid_height, current_vid_bitsperpixel, + vid.fullscreen ? "fullscreen" : "window", vid.width, vid.height, vid.bitsperpixel, vid_fullscreen.integer ? "fullscreen" : "window", vid_width.integer, vid_height.integer, vid_bitsperpixel.integer); VID_CloseSystems(); VID_Shutdown(); if (!VID_Mode(vid_fullscreen.integer, vid_width.integer, vid_height.integer, vid_bitsperpixel.integer)) { Con_Print("Video mode change failed\n"); - if (!VID_Mode(current_vid_fullscreen, current_vid_width, current_vid_height, current_vid_bitsperpixel)) + if (!VID_Mode(vid.fullscreen, vid.width, vid.height, vid.bitsperpixel)) Sys_Error("Unable to restore to last working video mode\n"); } VID_OpenSystems();