patch from Charlie, bug fix (3795) , improves CubeMaps in game engine
authorErwin Coumans <blender@erwincoumans.com>
Thu, 11 May 2006 20:41:28 +0000 (20:41 +0000)
committerErwin Coumans <blender@erwincoumans.com>
Thu, 11 May 2006 20:41:28 +0000 (20:41 +0000)
source/gameengine/Ketsji/BL_Texture.cpp
source/gameengine/Ketsji/KX_BlenderMaterial.cpp

index e63562072257cafe99b76531656d341dd800d454..68d2c3337a7508e091a59a6818d4d0e02f8e96b6 100644 (file)
@@ -250,8 +250,8 @@ bool BL_Texture::InitCubeMap(int unit,  EnvMap *cubemap )
 
        glTexParameteri( GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
        glTexParameteri( GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
-       glTexParameteri( GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_WRAP_S,     GL_REPEAT );
-       glTexParameteri( GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_WRAP_T,     GL_REPEAT );
+       glTexParameteri( GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_WRAP_S,     GL_CLAMP_TO_EDGE );
+       glTexParameteri( GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_WRAP_T,     GL_CLAMP_TO_EDGE );
        
                
        if(needs_split) {
index af1a8ddb568c1e2b046c5fc3d49741fee2f464af..195fd5bd35fd4a200a8fc18917be27e7144a5072 100644 (file)
@@ -470,11 +470,25 @@ void KX_BlenderMaterial::setTexMatrixData(int i)
        glMatrixMode(GL_TEXTURE);
        glLoadIdentity();
 
-       glScalef( 
-               mMaterial->mapping[i].scale[0], 
-               mMaterial->mapping[i].scale[1], 
-               mMaterial->mapping[i].scale[2]
-       );
+#ifdef GL_ARB_texture_cube_map
+       if( RAS_EXT_support._ARB_texture_cube_map && 
+               mTextures[i].GetTextureType() == GL_TEXTURE_CUBE_MAP_ARB && 
+               mMaterial->mapping[i].mapping & USEREFL) {
+               glScalef( 
+                       mMaterial->mapping[i].scale[0], 
+                       -mMaterial->mapping[i].scale[1], 
+                       -mMaterial->mapping[i].scale[2]
+               );
+       }
+       else
+#endif
+       {
+               glScalef( 
+                       mMaterial->mapping[i].scale[0], 
+                       mMaterial->mapping[i].scale[1], 
+                       mMaterial->mapping[i].scale[2]
+               );
+       }
        glTranslatef(
                mMaterial->mapping[i].offsets[0],
                mMaterial->mapping[i].offsets[1],