]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add definition for orthoview accuracy, plus some final cleanup
authorSamual Lenks <samual@xonotic.org>
Thu, 26 Dec 2013 08:23:02 +0000 (03:23 -0500)
committerSamual Lenks <samual@xonotic.org>
Thu, 26 Dec 2013 08:23:02 +0000 (03:23 -0500)
qcsrc/client/View.qc

index b5a6dae7240ca2323e4c433ef15e8b8259e83492..2e539c32a29411cf6852444494891bb42707dee5 100644 (file)
@@ -565,6 +565,7 @@ void CSQC_UpdateView(float w, float h)
        vector ov_worldmax = '0 0 0';
        if(autocvar_cl_orthoview)
        {
+               #define ORTHO_ACCURACY 512 // x^2 resolution accuracy for evaluating fov scaling and distance
                #define FL2VEC(x,y,z) (('1 0 0' * x) + ('0 1 0' * y) + ('0 0 1' * z))
 
                ov_worldmin = mi_picmin;
@@ -572,8 +573,8 @@ void CSQC_UpdateView(float w, float h)
                
                float ov_width = (ov_worldmax_x - ov_worldmin_x);
                float ov_height = (ov_worldmax_y - ov_worldmin_y);
-               float ov_distance = (512 * max(ov_width, ov_height));
-               //if(autocvar_cl_orthoview_distanceoverride) { ov_distance = autocvar_cl_orthoview_distanceoverride; }
+               float ov_distance = (ORTHO_ACCURACY * max(ov_width, ov_height));
+
                ov_mid = ((ov_worldmax + ov_worldmin) * 0.5);
                ov_org = FL2VEC(ov_mid_x, ov_mid_y, (ov_mid_z + ov_distance));
 
@@ -594,12 +595,12 @@ void CSQC_UpdateView(float w, float h)
                if((dist = vlen(FL2VEC(ov_worldmin_x, ov_worldmax_y, ov_worldmax_z) - ov_org)) > ov_furthest) { ov_furthest = dist; }
                if((dist = vlen(FL2VEC(ov_worldmax_x, ov_worldmin_y, ov_worldmax_z) - ov_org)) > ov_furthest) { ov_furthest = dist; }
                if((dist = vlen(FL2VEC(ov_worldmax_x, ov_worldmax_y, ov_worldmax_z) - ov_org)) > ov_furthest) { ov_furthest = dist; }
-               
+
                cvar_set("r_nearclip", ftos(ov_nearest));
                cvar_set("r_farclip_base", ftos(ov_furthest));
                cvar_set("r_farclip_world", "0");
                cvar_set("r_useinfinitefarclip", "0");
-               
+
                setproperty(VF_ORIGIN, ov_org);
                setproperty(VF_ANGLES, '90 0 0');