* Fixed issue where using images with pregenerated mips would cause performance loss due to them being generated again and again

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9703 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
ShA..Rd 13 years ago
parent 96c4b31e0f
commit 9ad757596b
  1. 20
      engine/src/core/com/jme3/texture/Image.java

@ -433,6 +433,9 @@ public class Image extends NativeObject implements Savable /*, Cloneable*/ {
if (mipMapSizes != null && mipMapSizes.length <= 1) {
mipMapSizes = null;
} else {
needGeneratedMips = false;
mipsWereGenerated = true;
}
setFormat(format);
@ -465,6 +468,9 @@ public class Image extends NativeObject implements Savable /*, Cloneable*/ {
if (mipMapSizes != null && mipMapSizes.length <= 1) {
mipMapSizes = null;
} else {
needGeneratedMips = false;
mipsWereGenerated = true;
}
setFormat(format);
@ -616,6 +622,15 @@ public class Image extends NativeObject implements Savable /*, Cloneable*/ {
mipMapSizes = null;
this.mipMapSizes = mipMapSizes;
if (mipMapSizes != null) {
needGeneratedMips = false;
mipsWereGenerated = false;
} else {
needGeneratedMips = false;
mipsWereGenerated = true;
}
setUpdateNeeded();
}
@ -837,6 +852,11 @@ public class Image extends NativeObject implements Savable /*, Cloneable*/ {
mipMapSizes = capsule.readIntArray("mipMapSizes", null);
multiSamples = capsule.readInt("multiSamples", 1);
data = (ArrayList<ByteBuffer>) capsule.readByteBufferArrayList("data", null);
if (mipMapSizes != null) {
needGeneratedMips = false;
mipsWereGenerated = true;
}
}
}

Loading…
Cancel
Save