|
|
@ -565,7 +565,14 @@ public abstract class Texture implements Asset, Savable, Cloneable { |
|
|
|
public void write(JmeExporter e) throws IOException { |
|
|
|
public void write(JmeExporter e) throws IOException { |
|
|
|
OutputCapsule capsule = e.getCapsule(this); |
|
|
|
OutputCapsule capsule = e.getCapsule(this); |
|
|
|
capsule.write(name, "name", null); |
|
|
|
capsule.write(name, "name", null); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (key == null){ |
|
|
|
|
|
|
|
// no texture key is set, try to save image instead then
|
|
|
|
|
|
|
|
capsule.write(image, "image", null); |
|
|
|
|
|
|
|
}else{ |
|
|
|
capsule.write(key, "key", null); |
|
|
|
capsule.write(key, "key", null); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
capsule.write(anisotropicFilter, "anisotropicFilter", 1); |
|
|
|
capsule.write(anisotropicFilter, "anisotropicFilter", 1); |
|
|
|
capsule.write(minificationFilter, "minificationFilter", |
|
|
|
capsule.write(minificationFilter, "minificationFilter", |
|
|
|
MinFilter.BilinearNoMipMaps); |
|
|
|
MinFilter.BilinearNoMipMaps); |
|
|
@ -577,18 +584,26 @@ public abstract class Texture implements Asset, Savable, Cloneable { |
|
|
|
InputCapsule capsule = e.getCapsule(this); |
|
|
|
InputCapsule capsule = e.getCapsule(this); |
|
|
|
name = capsule.readString("name", null); |
|
|
|
name = capsule.readString("name", null); |
|
|
|
key = (TextureKey) capsule.readSavable("key", null); |
|
|
|
key = (TextureKey) capsule.readSavable("key", null); |
|
|
|
// load texture from key
|
|
|
|
|
|
|
|
|
|
|
|
// load texture from key, if available
|
|
|
|
if (key != null) { |
|
|
|
if (key != null) { |
|
|
|
|
|
|
|
// key is available, so try the texture from there.
|
|
|
|
Texture loadedTex = e.getAssetManager().loadTexture(key); |
|
|
|
Texture loadedTex = e.getAssetManager().loadTexture(key); |
|
|
|
if (loadedTex == null) { |
|
|
|
if (loadedTex == null) { |
|
|
|
Logger.getLogger(Texture.class.getName()).log(Level.SEVERE, "Could not load texture: {0}", key.toString()); |
|
|
|
Logger.getLogger(Texture.class.getName()).log(Level.SEVERE, "Could not load texture: {0}", key.toString()); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
image = loadedTex.getImage(); |
|
|
|
image = loadedTex.getImage(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
// no key is set on the texture. Attempt to load an embedded image
|
|
|
|
|
|
|
|
image = (Image) capsule.readSavable("image", null); |
|
|
|
|
|
|
|
if (image == null){ |
|
|
|
|
|
|
|
// TODO: what to print out here? the texture has no key or data, there's no useful information ..
|
|
|
|
|
|
|
|
// assume texture.name is set even though the key is null
|
|
|
|
|
|
|
|
Logger.getLogger(Texture.class.getName()).log(Level.SEVERE, "Could not load embedded image: {0}", toString() ); |
|
|
|
} |
|
|
|
} |
|
|
|
// image = (Image) capsule.readSavable("image", null);
|
|
|
|
} |
|
|
|
// if (image == null) {
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
anisotropicFilter = capsule.readInt("anisotropicFilter", 1); |
|
|
|
anisotropicFilter = capsule.readInt("anisotropicFilter", 1); |
|
|
|
minificationFilter = capsule.readEnum("minificationFilter", |
|
|
|
minificationFilter = capsule.readEnum("minificationFilter", |
|
|
|
MinFilter.class, |
|
|
|
MinFilter.class, |
|
|
|