Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-12-16 13:25:07 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-12-16 13:25:07 +0400
commit2253b63c979fbfbbb6f06c93ede85d9b9b6caddf (patch)
tree6fe58202f96a7edd8448d7fbf17a14df6098d0f7 /source/blender/editors/space_view3d/drawvolume.c
parent91f14ddf3da140156c722e347b6f188210903629 (diff)
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
Diffstat (limited to 'source/blender/editors/space_view3d/drawvolume.c')
-rw-r--r--source/blender/editors/space_view3d/drawvolume.c23
1 files changed, 3 insertions, 20 deletions
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