diff --git a/engine/src/core-plugins/com/jme3/texture/plugins/DDSLoader.java b/engine/src/core-plugins/com/jme3/texture/plugins/DDSLoader.java index d89767dc9..037b8e01a 100644 --- a/engine/src/core-plugins/com/jme3/texture/plugins/DDSLoader.java +++ b/engine/src/core-plugins/com/jme3/texture/plugins/DDSLoader.java @@ -36,6 +36,7 @@ import com.jme3.asset.AssetLoader; import com.jme3.asset.TextureKey; import com.jme3.texture.Image; import com.jme3.texture.Image.Format; +import com.jme3.texture.Texture.Type; import com.jme3.util.BufferUtils; import com.jme3.util.LittleEndien; import java.io.DataInput; @@ -124,7 +125,11 @@ public class DDSLoader implements AssetLoader { InputStream stream = info.openStream(); in = new LittleEndien(stream); loadHeader(); - + if (texture3D) { + ((TextureKey) info.getKey()).setTextureTypeHint(Type.ThreeDimensional); + } else if (depth > 1) { + ((TextureKey) info.getKey()).setTextureTypeHint(Type.CubeMap); + } ArrayList data = readData(((TextureKey) info.getKey()).isFlipY()); stream.close(); return new Image(pixelFormat, width, height, depth, data, sizes); @@ -189,7 +194,7 @@ public class DDSLoader implements AssetLoader { caps1 = in.readInt(); caps2 = in.readInt(); in.skipBytes(12); - + texture3D = false; if (!directx10) { if (!is(caps1, DDSCAPS_TEXTURE)) { diff --git a/engine/src/core/com/jme3/asset/TextureKey.java b/engine/src/core/com/jme3/asset/TextureKey.java index 7dc9ee071..31f67582d 100644 --- a/engine/src/core/com/jme3/asset/TextureKey.java +++ b/engine/src/core/com/jme3/asset/TextureKey.java @@ -37,6 +37,7 @@ import com.jme3.export.InputCapsule; import com.jme3.export.OutputCapsule; import com.jme3.texture.Image; import com.jme3.texture.Texture; +import com.jme3.texture.Texture.Type; import com.jme3.texture.Texture2D; import com.jme3.texture.Texture3D; import com.jme3.texture.TextureCubeMap; @@ -50,6 +51,7 @@ public class TextureKey extends AssetKey { private boolean asCube; private boolean asTexture3D; private int anisotropy; + private Texture.Type textureTypeHint=Texture.Type.TwoDimensional; public TextureKey(String name, boolean flipY) { super(name); @@ -162,6 +164,15 @@ public class TextureKey extends AssetKey { return super.equals(other) && isFlipY() == ((TextureKey) other).isFlipY(); } + public Type getTextureTypeHint() { + return textureTypeHint; + } + + public void setTextureTypeHint(Type textureTypeHint) { + this.textureTypeHint = textureTypeHint; + } + + public void write(JmeExporter ex) throws IOException { super.write(ex); OutputCapsule oc = ex.getCapsule(this);