diff options
Diffstat (limited to 'source/gameengine/Ketsji/BL_Texture.cpp')
-rw-r--r-- | source/gameengine/Ketsji/BL_Texture.cpp | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/source/gameengine/Ketsji/BL_Texture.cpp b/source/gameengine/Ketsji/BL_Texture.cpp index c3b799b9424..7dac7993b8c 100644 --- a/source/gameengine/Ketsji/BL_Texture.cpp +++ b/source/gameengine/Ketsji/BL_Texture.cpp @@ -56,7 +56,7 @@ extern "C" { void my_free_envmapdata(EnvMap *env); } -// (n&(n-1)) zeros the least significant bit of n +// (n&(n-1)) zeros the least significant bit of n static int is_power_of_2_i(int num) { return ((num)&(num-1))==0; @@ -122,7 +122,7 @@ bool BL_Texture::InitFromImage(int unit, Image *img, bool mipmap) { ImBuf *ibuf; - if (!img || img->ok==0) + if (!img || img->ok==0) { mOk = false; return mOk; @@ -217,7 +217,7 @@ void BL_Texture::InitGLTex(unsigned int *pix,int x,int y,bool mipmap) glTexImage2D(GL_TEXTURE_2D, i, GL_RGBA, mip->x, mip->y, 0, GL_RGBA, GL_UNSIGNED_BYTE, mip->rect); } IMB_freeImBuf(ibuf); - } + } else { glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); @@ -237,7 +237,7 @@ void BL_Texture::InitGLCompressedTex(ImBuf *ibuf, bool mipmap) return; #else glBindTexture(GL_TEXTURE_2D, mTexture); - + if (GPU_upload_dxt_texture(ibuf) == 0) { InitGLTex(ibuf->rect, ibuf->x, ibuf->y, mipmap); return; @@ -289,7 +289,7 @@ bool BL_Texture::InitCubeMap(int unit, EnvMap *cubemap) mOk = false; return mOk; } - else if (!cubemap || cubemap->ima->ok==0) + else if (!cubemap || cubemap->ima->ok==0) { mOk = false; return mOk; @@ -336,7 +336,7 @@ bool BL_Texture::InitCubeMap(int unit, EnvMap *cubemap) bool needs_split = false; - if (!cubemap->cube[0]) + if (!cubemap->cube[0]) { needs_split = true; spit ("Re-Generating texture buffer"); @@ -407,7 +407,7 @@ void BL_Texture::Validate() bool BL_Texture::Ok() { - return (mTexture!= 0); + return (mTexture!= 0); } @@ -518,14 +518,14 @@ void BL_Texture::SetMapping(int mode) return; } - if ( mType == GL_TEXTURE_CUBE_MAP_ARB && + if ( mType == GL_TEXTURE_CUBE_MAP_ARB && GLEW_ARB_texture_cube_map && - mode &USEREFL) + mode &USEREFL) { glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_ARB ); glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_ARB ); glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_ARB ); - + glEnable(GL_TEXTURE_GEN_S); glEnable(GL_TEXTURE_GEN_T); glEnable(GL_TEXTURE_GEN_R); @@ -632,7 +632,7 @@ void BL_Texture::setTexEnv(BL_Material *mat, bool modulate) glTexEnvf( GL_TEXTURE_ENV, op2, alphaOp); }break; - case BLEND_MUL: + case BLEND_MUL: { // ------------------------------ glTexEnvf( GL_TEXTURE_ENV, combiner, GL_MODULATE); @@ -644,7 +644,7 @@ void BL_Texture::setTexEnv(BL_Material *mat, bool modulate) else glTexEnvf( GL_TEXTURE_ENV, op1, blend_operand); }break; - case BLEND_ADD: + case BLEND_ADD: { // ------------------------------ glTexEnvf( GL_TEXTURE_ENV, combiner, GL_ADD_SIGNED_ARB); @@ -656,7 +656,7 @@ void BL_Texture::setTexEnv(BL_Material *mat, bool modulate) else glTexEnvf( GL_TEXTURE_ENV, op1, blend_operand); }break; - case BLEND_SUB: + case BLEND_SUB: { // ------------------------------ glTexEnvf( GL_TEXTURE_ENV, combiner, GL_SUBTRACT_ARB); @@ -665,7 +665,7 @@ void BL_Texture::setTexEnv(BL_Material *mat, bool modulate) glTexEnvf( GL_TEXTURE_ENV, source1, GL_TEXTURE ); glTexEnvf( GL_TEXTURE_ENV, op1, blend_operand); }break; - case BLEND_SCR: + case BLEND_SCR: { // ------------------------------ glTexEnvf( GL_TEXTURE_ENV, combiner, GL_ADD); @@ -708,9 +708,9 @@ extern "C" { void my_envmap_split_ima(EnvMap *env, ImBuf *ibuf) { int dx, part; - + my_free_envmapdata(env); - + dx= ibuf->y; dx/= 2; if (3*dx != ibuf->x) { @@ -722,17 +722,17 @@ void my_envmap_split_ima(EnvMap *env, ImBuf *ibuf) for (part=0; part<6; part++) { env->cube[part] = IMB_allocImBuf(dx, dx, 24, IB_rect); } - IMB_rectcpy(env->cube[0], ibuf, + IMB_rectcpy(env->cube[0], ibuf, 0, 0, 0, 0, dx, dx); - IMB_rectcpy(env->cube[1], ibuf, + IMB_rectcpy(env->cube[1], ibuf, 0, 0, dx, 0, dx, dx); - IMB_rectcpy(env->cube[2], ibuf, + IMB_rectcpy(env->cube[2], ibuf, 0, 0, 2*dx, 0, dx, dx); - IMB_rectcpy(env->cube[3], ibuf, + IMB_rectcpy(env->cube[3], ibuf, 0, 0, 0, dx, dx, dx); - IMB_rectcpy(env->cube[4], ibuf, + IMB_rectcpy(env->cube[4], ibuf, 0, 0, dx, dx, dx, dx); - IMB_rectcpy(env->cube[5], ibuf, + IMB_rectcpy(env->cube[5], ibuf, 0, 0, 2*dx, dx, dx, dx); env->ok= 2;// ENV_OSA @@ -743,7 +743,7 @@ void my_envmap_split_ima(EnvMap *env, ImBuf *ibuf) void my_free_envmapdata(EnvMap *env) { unsigned int part; - + for (part=0; part<6; part++) { ImBuf *ibuf= env->cube[part]; if (ibuf) { |