diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-12-17 03:26:29 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-12-17 03:26:29 +0400 |
commit | e5b1f9c28d52254fd11e226ed4ac7bf07d7259d7 (patch) | |
tree | b3a36c302cf470ed5e7c7a195e760623c82bbc7e /source/gameengine | |
parent | d46712cd298f59405646fc44acef52fbb11d2f82 (diff) | |
parent | 3c8ab559a5bd31fd38e9c5cf9da8505ca28f4887 (diff) |
svn merge ^/trunk/blender -r42660:42669
Diffstat (limited to 'source/gameengine')
-rw-r--r-- | source/gameengine/Ketsji/BL_Texture.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/source/gameengine/Ketsji/BL_Texture.cpp b/source/gameengine/Ketsji/BL_Texture.cpp index a306e059442..6c57776cb60 100644 --- a/source/gameengine/Ketsji/BL_Texture.cpp +++ b/source/gameengine/Ketsji/BL_Texture.cpp @@ -38,11 +38,11 @@ extern "C" { } // (n&(n-1)) zeros the least significant bit of n -static int is_pow2(int num) { +static int is_power_of_2_i(int num) { return ((num)&(num-1))==0; } -static int smaller_pow2(int num) { - while (!is_pow2(num)) +static int power_of_2_min_i(int num) { + while (!is_power_of_2_i(num)) num= num&(num-1); return num; } @@ -159,7 +159,7 @@ bool BL_Texture::InitFromImage(int unit, Image *img, bool mipmap) void BL_Texture::InitGLTex(unsigned int *pix,int x,int y,bool mipmap) { - if (!is_pow2(x) || !is_pow2(y) ) { + if (!is_power_of_2_i(x) || !is_power_of_2_i(y) ) { InitNonPow2Tex(pix, x,y,mipmap); return; } @@ -184,8 +184,8 @@ void BL_Texture::InitGLTex(unsigned int *pix,int x,int y,bool mipmap) void BL_Texture::InitNonPow2Tex(unsigned int *pix,int x,int y,bool mipmap) { - int nx= smaller_pow2(x); - int ny= smaller_pow2(y); + int nx= power_of_2_min_i(x); + int ny= power_of_2_min_i(y); unsigned int *newPixels = (unsigned int *)malloc(nx*ny*sizeof(unsigned int)); @@ -274,7 +274,7 @@ bool BL_Texture::InitCubeMap(int unit, EnvMap *cubemap) my_envmap_split_ima(cubemap, ibuf); - if (!is_pow2(cubemap->cube[0]->x) || !is_pow2(cubemap->cube[0]->y)) + if (!is_power_of_2_i(cubemap->cube[0]->x) || !is_power_of_2_i(cubemap->cube[0]->y)) { spit("invalid envmap size please render with CubeRes @ power of two"); @@ -610,8 +610,8 @@ void BL_Texture::setTexEnv(BL_Material *mat, bool modulate) int BL_Texture::GetPow2(int n) { - if(!is_pow2(n)) - n = smaller_pow2(n); + if(!is_power_of_2_i(n)) + n = power_of_2_min_i(n); return n; } |