|
@@ -19659,14 +19659,12 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
|
|
|
}
|
|
|
|
|
|
- function generateMipmap( texture, target ) {
|
|
|
+ function generateMipmap( target, texture, width, height ) {
|
|
|
|
|
|
_gl.generateMipmap( target );
|
|
|
|
|
|
- // We assume images for cube map have the same size.
|
|
|
- var image = Array.isArray( texture.image ) ? texture.image[ 0 ] : texture.image;
|
|
|
var textureProperties = properties.get( texture );
|
|
|
- textureProperties.__maxMipLevel = Math.log2( Math.max( image.width, image.height ) );
|
|
|
+ textureProperties.__maxMipLevel = Math.log2( Math.max( width, height ) );
|
|
|
|
|
|
}
|
|
|
|
|
@@ -19926,7 +19924,8 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
|
|
|
if ( textureNeedsGenerateMipmaps( texture, isPowerOfTwoImage ) ) {
|
|
|
|
|
|
- generateMipmap( texture, _gl.TEXTURE_CUBE_MAP );
|
|
|
+ // We assume images for cube map have the same size.
|
|
|
+ generateMipmap( _gl.TEXTURE_CUBE_MAP, texture, image.width, image.height );
|
|
|
|
|
|
}
|
|
|
|
|
@@ -20181,7 +20180,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
|
|
|
if ( textureNeedsGenerateMipmaps( texture, isPowerOfTwoImage ) ) {
|
|
|
|
|
|
- generateMipmap( texture, _gl.TEXTURE_2D );
|
|
|
+ generateMipmap( _gl.TEXTURE_2D, texture, image.width, image.height );
|
|
|
|
|
|
}
|
|
|
|
|
@@ -20365,7 +20364,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
|
|
|
if ( textureNeedsGenerateMipmaps( renderTarget.texture, isTargetPowerOfTwo ) ) {
|
|
|
|
|
|
- generateMipmap( renderTarget.texture, _gl.TEXTURE_CUBE_MAP );
|
|
|
+ generateMipmap( _gl.TEXTURE_CUBE_MAP, renderTarget.texture, renderTarget.width, renderTarget.height );
|
|
|
|
|
|
}
|
|
|
|
|
@@ -20379,7 +20378,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
|
|
|
if ( textureNeedsGenerateMipmaps( renderTarget.texture, isTargetPowerOfTwo ) ) {
|
|
|
|
|
|
- generateMipmap( renderTarget.texture, _gl.TEXTURE_2D );
|
|
|
+ generateMipmap( _gl.TEXTURE_2D, renderTarget.texture, renderTarget.width, renderTarget.height );
|
|
|
|
|
|
}
|
|
|
|
|
@@ -20408,7 +20407,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
var webglTexture = properties.get( texture ).__webglTexture;
|
|
|
|
|
|
state.bindTexture( target, webglTexture );
|
|
|
- generateMipmap( texture, target );
|
|
|
+ generateMipmap( target, texture, renderTarget.width, renderTarget.height );
|
|
|
state.bindTexture( target, null );
|
|
|
|
|
|
}
|