From 2253b63c979fbfbbb6f06c93ede85d9b9b6caddf Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 16 Dec 2011 09:25:07 +0000 Subject: static functions for getting power of 2 values were being copied about too much, add to the BLI_math api. - is_power_of_2_i - power_of_2_min_i - power_of_2_max_i --- source/blender/editors/space_view3d/drawvolume.c | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) (limited to 'source/blender/editors/space_view3d/drawvolume.c') diff --git a/source/blender/editors/space_view3d/drawvolume.c b/source/blender/editors/space_view3d/drawvolume.c index 6605d488d36..8308a4a9ccf 100644 --- a/source/blender/editors/space_view3d/drawvolume.c +++ b/source/blender/editors/space_view3d/drawvolume.c @@ -158,23 +158,6 @@ static int convex(float *p0, float *up, float *a, float *b) return dot_v3v3(up, tmp) >= 0; } -// copied from gpu_extension.c -static int is_pow2(int n) -{ - return ((n)&(n-1))==0; -} - -static int larger_pow2(int n) -{ - if (is_pow2(n)) - return n; - - while(!is_pow2(n)) - n= n&(n-1); - - return n*2; -} - void draw_volume(ARegion *ar, GPUTexture *tex, float *min, float *max, int res[3], float dx, GPUTexture *tex_shadow) { RegionView3D *rv3d= ar->regiondata; @@ -379,9 +362,9 @@ void draw_volume(ARegion *ar, GPUTexture *tex, float *min, float *max, int res[3 printf("No volume shadow\n"); if (!GPU_non_power_of_two_support()) { - cor[0] = (float)res[0]/(float)larger_pow2(res[0]); - cor[1] = (float)res[1]/(float)larger_pow2(res[1]); - cor[2] = (float)res[2]/(float)larger_pow2(res[2]); + cor[0] = (float)res[0]/(float)power_of_2_max_i(res[0]); + cor[1] = (float)res[1]/(float)power_of_2_max_i(res[1]); + cor[2] = (float)res[2]/(float)power_of_2_max_i(res[2]); } // our slices are defined by the plane equation a*x + b*y +c*z + d = 0 -- cgit v1.2.3