mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-29 16:20:11 -04:00
showbase: Don't return same texture object if loaded with different settings
Follow-up to #1105
This commit is contained in:
parent
fed5865645
commit
c076d5ad08
@ -718,23 +718,24 @@ class Loader(DirectObject):
|
|||||||
flags &= ~LoaderOptions.TFMultiview
|
flags &= ~LoaderOptions.TFMultiview
|
||||||
loaderOptions.setTextureFlags(flags)
|
loaderOptions.setTextureFlags(flags)
|
||||||
|
|
||||||
|
sampler = SamplerState()
|
||||||
|
if minfilter is not None:
|
||||||
|
sampler.setMinfilter(minfilter)
|
||||||
|
if magfilter is not None:
|
||||||
|
sampler.setMagfilter(magfilter)
|
||||||
|
if anisotropicDegree is not None:
|
||||||
|
sampler.setAnisotropicDegree(anisotropicDegree)
|
||||||
|
|
||||||
if alphaPath is None:
|
if alphaPath is None:
|
||||||
assert Loader.notify.debug("Loading texture: %s" % (texturePath))
|
assert Loader.notify.debug("Loading texture: %s" % (texturePath))
|
||||||
texture = TexturePool.loadTexture(texturePath, 0, readMipmaps, loaderOptions)
|
texture = TexturePool.loadTexture(texturePath, 0, readMipmaps, loaderOptions, sampler)
|
||||||
else:
|
else:
|
||||||
assert Loader.notify.debug("Loading texture: %s %s" % (texturePath, alphaPath))
|
assert Loader.notify.debug("Loading texture: %s %s" % (texturePath, alphaPath))
|
||||||
texture = TexturePool.loadTexture(texturePath, alphaPath, 0, 0, readMipmaps, loaderOptions)
|
texture = TexturePool.loadTexture(texturePath, alphaPath, 0, 0, readMipmaps, loaderOptions, sampler)
|
||||||
if not texture and not okMissing:
|
if not texture and not okMissing:
|
||||||
message = 'Could not load texture: %s' % (texturePath)
|
message = 'Could not load texture: %s' % (texturePath)
|
||||||
raise IOError(message)
|
raise IOError(message)
|
||||||
|
|
||||||
if minfilter is not None:
|
|
||||||
texture.setMinfilter(minfilter)
|
|
||||||
if magfilter is not None:
|
|
||||||
texture.setMagfilter(magfilter)
|
|
||||||
if anisotropicDegree is not None:
|
|
||||||
texture.setAnisotropicDegree(anisotropicDegree)
|
|
||||||
|
|
||||||
return texture
|
return texture
|
||||||
|
|
||||||
def load3DTexture(self, texturePattern, readMipmaps = False, okMissing = False,
|
def load3DTexture(self, texturePattern, readMipmaps = False, okMissing = False,
|
||||||
@ -780,18 +781,19 @@ class Loader(DirectObject):
|
|||||||
loaderOptions.setTextureFlags(flags)
|
loaderOptions.setTextureFlags(flags)
|
||||||
loaderOptions.setTextureNumViews(numViews)
|
loaderOptions.setTextureNumViews(numViews)
|
||||||
|
|
||||||
texture = TexturePool.load3dTexture(texturePattern, readMipmaps, loaderOptions)
|
sampler = SamplerState()
|
||||||
|
if minfilter is not None:
|
||||||
|
sampler.setMinfilter(minfilter)
|
||||||
|
if magfilter is not None:
|
||||||
|
sampler.setMagfilter(magfilter)
|
||||||
|
if anisotropicDegree is not None:
|
||||||
|
sampler.setAnisotropicDegree(anisotropicDegree)
|
||||||
|
|
||||||
|
texture = TexturePool.load3dTexture(texturePattern, readMipmaps, loaderOptions, sampler)
|
||||||
if not texture and not okMissing:
|
if not texture and not okMissing:
|
||||||
message = 'Could not load 3-D texture: %s' % (texturePattern)
|
message = 'Could not load 3-D texture: %s' % (texturePattern)
|
||||||
raise IOError(message)
|
raise IOError(message)
|
||||||
|
|
||||||
if minfilter is not None:
|
|
||||||
texture.setMinfilter(minfilter)
|
|
||||||
if magfilter is not None:
|
|
||||||
texture.setMagfilter(magfilter)
|
|
||||||
if anisotropicDegree is not None:
|
|
||||||
texture.setAnisotropicDegree(anisotropicDegree)
|
|
||||||
|
|
||||||
return texture
|
return texture
|
||||||
|
|
||||||
def load2DTextureArray(self, texturePattern, readMipmaps = False, okMissing = False,
|
def load2DTextureArray(self, texturePattern, readMipmaps = False, okMissing = False,
|
||||||
@ -837,18 +839,19 @@ class Loader(DirectObject):
|
|||||||
loaderOptions.setTextureFlags(flags)
|
loaderOptions.setTextureFlags(flags)
|
||||||
loaderOptions.setTextureNumViews(numViews)
|
loaderOptions.setTextureNumViews(numViews)
|
||||||
|
|
||||||
texture = TexturePool.load2dTextureArray(texturePattern, readMipmaps, loaderOptions)
|
sampler = SamplerState()
|
||||||
|
if minfilter is not None:
|
||||||
|
sampler.setMinfilter(minfilter)
|
||||||
|
if magfilter is not None:
|
||||||
|
sampler.setMagfilter(magfilter)
|
||||||
|
if anisotropicDegree is not None:
|
||||||
|
sampler.setAnisotropicDegree(anisotropicDegree)
|
||||||
|
|
||||||
|
texture = TexturePool.load2dTextureArray(texturePattern, readMipmaps, loaderOptions, sampler)
|
||||||
if not texture and not okMissing:
|
if not texture and not okMissing:
|
||||||
message = 'Could not load 2-D texture array: %s' % (texturePattern)
|
message = 'Could not load 2-D texture array: %s' % (texturePattern)
|
||||||
raise IOError(message)
|
raise IOError(message)
|
||||||
|
|
||||||
if minfilter is not None:
|
|
||||||
texture.setMinfilter(minfilter)
|
|
||||||
if magfilter is not None:
|
|
||||||
texture.setMagfilter(magfilter)
|
|
||||||
if anisotropicDegree is not None:
|
|
||||||
texture.setAnisotropicDegree(anisotropicDegree)
|
|
||||||
|
|
||||||
return texture
|
return texture
|
||||||
|
|
||||||
def loadCubeMap(self, texturePattern, readMipmaps = False, okMissing = False,
|
def loadCubeMap(self, texturePattern, readMipmaps = False, okMissing = False,
|
||||||
@ -890,18 +893,19 @@ class Loader(DirectObject):
|
|||||||
flags &= ~LoaderOptions.TFMultiview
|
flags &= ~LoaderOptions.TFMultiview
|
||||||
loaderOptions.setTextureFlags(flags)
|
loaderOptions.setTextureFlags(flags)
|
||||||
|
|
||||||
texture = TexturePool.loadCubeMap(texturePattern, readMipmaps, loaderOptions)
|
sampler = SamplerState()
|
||||||
|
if minfilter is not None:
|
||||||
|
sampler.setMinfilter(minfilter)
|
||||||
|
if magfilter is not None:
|
||||||
|
sampler.setMagfilter(magfilter)
|
||||||
|
if anisotropicDegree is not None:
|
||||||
|
sampler.setAnisotropicDegree(anisotropicDegree)
|
||||||
|
|
||||||
|
texture = TexturePool.loadCubeMap(texturePattern, readMipmaps, loaderOptions, sampler)
|
||||||
if not texture and not okMissing:
|
if not texture and not okMissing:
|
||||||
message = 'Could not load cube map: %s' % (texturePattern)
|
message = 'Could not load cube map: %s' % (texturePattern)
|
||||||
raise IOError(message)
|
raise IOError(message)
|
||||||
|
|
||||||
if minfilter is not None:
|
|
||||||
texture.setMinfilter(minfilter)
|
|
||||||
if magfilter is not None:
|
|
||||||
texture.setMagfilter(magfilter)
|
|
||||||
if anisotropicDegree is not None:
|
|
||||||
texture.setAnisotropicDegree(anisotropicDegree)
|
|
||||||
|
|
||||||
return texture
|
return texture
|
||||||
|
|
||||||
def unloadTexture(self, texture):
|
def unloadTexture(self, texture):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user