From 9037e5f16fa5ead8f77b8ce9e6243cf3945c527b Mon Sep 17 00:00:00 2001 From: Samual Lenks Date: Fri, 13 Sep 2013 15:51:18 -0400 Subject: [PATCH] Working on adding orthoview feature for map screenshots from above --- qcsrc/client/View.qc | 22 +++++++++++++++++++++- qcsrc/client/autocvars.qh | 1 + 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/qcsrc/client/View.qc b/qcsrc/client/View.qc index 46920a417..dd245786b 100644 --- a/qcsrc/client/View.qc +++ b/qcsrc/client/View.qc @@ -199,6 +199,17 @@ vector GetCurrentFov(float fov) return '1 0 0' * fovx + '0 1 0' * fovy; } +vector GetOrthoviewFOV(void) +{ + float fovx, fovy; + float width = (mi_picmax_x - mi_picmin_x); + float height = (mi_picmax_y - mi_picmin_y); + float distance_to_middle_of_world = vlen(view_origin); + fovx = atan2(width/2, distance_to_middle_of_world) / M_PI * 360.0; + fovy = atan2(height/2, distance_to_middle_of_world) / M_PI * 360.0; + return '1 0 0' * fovx + '0 1 0' * fovy; +} + // this function must match W_SetupShot! float zoomscript_caught; @@ -548,6 +559,14 @@ void CSQC_UpdateView(float w, float h) WarpZone_FixView(); //WarpZone_FixPMove(); + if(autocvar_cl_orthoview) + { + float width = (mi_picmax_x - mi_picmin_x); + float height = (mi_picmax_y - mi_picmin_y); + setproperty(VF_ORIGIN, '0 0 1' * (512 * max(width, height))); + setproperty(VF_ANGLES, '90 0 0'); + } + // Render the Scene view_origin = getpropertyvec(VF_ORIGIN); view_angles = getpropertyvec(VF_ANGLES); @@ -689,7 +708,8 @@ void CSQC_UpdateView(float w, float h) vid_conheight = autocvar_vid_conheight; vid_pixelheight = autocvar_vid_pixelheight; - setproperty(VF_FOV, GetCurrentFov(fov)); + if(autocvar_cl_orthoview) { setproperty(VF_FOV, GetOrthoviewFOV()); } + else { setproperty(VF_FOV, GetCurrentFov(fov)); } // Camera for demo playback if(camera_active) diff --git a/qcsrc/client/autocvars.qh b/qcsrc/client/autocvars.qh index 8175695ab..c489f1ea1 100644 --- a/qcsrc/client/autocvars.qh +++ b/qcsrc/client/autocvars.qh @@ -54,6 +54,7 @@ float autocvar_cl_gunalign; float autocvar_cl_hidewaypoints; float autocvar_cl_lockview; float autocvar_cl_nogibs; +var float autocvar_cl_orthoview = TRUE; float autocvar_cl_particlegibs; float autocvar_cl_particles_oldnexbeam; float autocvar_cl_particles_quality; -- 2.39.2