Image: fix mipmap generation flags not properly being updated

experimental
Kirill Vainer 10 years ago
parent 9ba04bed8f
commit 73f53931f0
  1. 12
      jme3-core/src/main/java/com/jme3/texture/Image.java

@ -421,7 +421,8 @@ public class Image extends NativeObject implements Savable /*, Cloneable*/ {
/** /**
* @return True if the image needs to have mipmaps generated * @return True if the image needs to have mipmaps generated
* for it (as requested by the texture). * for it (as requested by the texture). This stays true even
* after mipmaps have been generated.
*/ */
public boolean isGeneratedMipmapsRequired() { public boolean isGeneratedMipmapsRequired() {
return needGeneratedMips; return needGeneratedMips;
@ -434,8 +435,9 @@ public class Image extends NativeObject implements Savable /*, Cloneable*/ {
@Override @Override
public void setUpdateNeeded() { public void setUpdateNeeded() {
super.setUpdateNeeded(); super.setUpdateNeeded();
if (!isGeneratedMipmapsRequired() && !hasMipmaps()) { if (isGeneratedMipmapsRequired() && !hasMipmaps()) {
setNeedGeneratedMipmaps(); // Mipmaps are no longer valid, since the image was changed.
setMipmapsGenerated(false);
} }
} }
@ -527,12 +529,14 @@ public class Image extends NativeObject implements Savable /*, Cloneable*/ {
this(); this();
if (mipMapSizes != null && mipMapSizes.length <= 1) { if (mipMapSizes != null) {
if (mipMapSizes.length <= 1) {
mipMapSizes = null; mipMapSizes = null;
} else { } else {
needGeneratedMips = false; needGeneratedMips = false;
mipsWereGenerated = true; mipsWereGenerated = true;
} }
}
setFormat(format); setFormat(format);
this.width = width; this.width = width;

Loading…
Cancel
Save