Engine : added texture type hint to the texture key
git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8012 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
parent
c77f1c6cfb
commit
70af91d981
@ -36,6 +36,7 @@ import com.jme3.asset.AssetLoader;
|
|||||||
import com.jme3.asset.TextureKey;
|
import com.jme3.asset.TextureKey;
|
||||||
import com.jme3.texture.Image;
|
import com.jme3.texture.Image;
|
||||||
import com.jme3.texture.Image.Format;
|
import com.jme3.texture.Image.Format;
|
||||||
|
import com.jme3.texture.Texture.Type;
|
||||||
import com.jme3.util.BufferUtils;
|
import com.jme3.util.BufferUtils;
|
||||||
import com.jme3.util.LittleEndien;
|
import com.jme3.util.LittleEndien;
|
||||||
import java.io.DataInput;
|
import java.io.DataInput;
|
||||||
@ -124,7 +125,11 @@ public class DDSLoader implements AssetLoader {
|
|||||||
InputStream stream = info.openStream();
|
InputStream stream = info.openStream();
|
||||||
in = new LittleEndien(stream);
|
in = new LittleEndien(stream);
|
||||||
loadHeader();
|
loadHeader();
|
||||||
|
if (texture3D) {
|
||||||
|
((TextureKey) info.getKey()).setTextureTypeHint(Type.ThreeDimensional);
|
||||||
|
} else if (depth > 1) {
|
||||||
|
((TextureKey) info.getKey()).setTextureTypeHint(Type.CubeMap);
|
||||||
|
}
|
||||||
ArrayList<ByteBuffer> data = readData(((TextureKey) info.getKey()).isFlipY());
|
ArrayList<ByteBuffer> data = readData(((TextureKey) info.getKey()).isFlipY());
|
||||||
stream.close();
|
stream.close();
|
||||||
return new Image(pixelFormat, width, height, depth, data, sizes);
|
return new Image(pixelFormat, width, height, depth, data, sizes);
|
||||||
@ -189,7 +194,7 @@ public class DDSLoader implements AssetLoader {
|
|||||||
caps1 = in.readInt();
|
caps1 = in.readInt();
|
||||||
caps2 = in.readInt();
|
caps2 = in.readInt();
|
||||||
in.skipBytes(12);
|
in.skipBytes(12);
|
||||||
|
texture3D = false;
|
||||||
|
|
||||||
if (!directx10) {
|
if (!directx10) {
|
||||||
if (!is(caps1, DDSCAPS_TEXTURE)) {
|
if (!is(caps1, DDSCAPS_TEXTURE)) {
|
||||||
|
@ -37,6 +37,7 @@ import com.jme3.export.InputCapsule;
|
|||||||
import com.jme3.export.OutputCapsule;
|
import com.jme3.export.OutputCapsule;
|
||||||
import com.jme3.texture.Image;
|
import com.jme3.texture.Image;
|
||||||
import com.jme3.texture.Texture;
|
import com.jme3.texture.Texture;
|
||||||
|
import com.jme3.texture.Texture.Type;
|
||||||
import com.jme3.texture.Texture2D;
|
import com.jme3.texture.Texture2D;
|
||||||
import com.jme3.texture.Texture3D;
|
import com.jme3.texture.Texture3D;
|
||||||
import com.jme3.texture.TextureCubeMap;
|
import com.jme3.texture.TextureCubeMap;
|
||||||
@ -50,6 +51,7 @@ public class TextureKey extends AssetKey<Texture> {
|
|||||||
private boolean asCube;
|
private boolean asCube;
|
||||||
private boolean asTexture3D;
|
private boolean asTexture3D;
|
||||||
private int anisotropy;
|
private int anisotropy;
|
||||||
|
private Texture.Type textureTypeHint=Texture.Type.TwoDimensional;
|
||||||
|
|
||||||
public TextureKey(String name, boolean flipY) {
|
public TextureKey(String name, boolean flipY) {
|
||||||
super(name);
|
super(name);
|
||||||
@ -162,6 +164,15 @@ public class TextureKey extends AssetKey<Texture> {
|
|||||||
return super.equals(other) && isFlipY() == ((TextureKey) other).isFlipY();
|
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 {
|
public void write(JmeExporter ex) throws IOException {
|
||||||
super.write(ex);
|
super.write(ex);
|
||||||
OutputCapsule oc = ex.getCapsule(this);
|
OutputCapsule oc = ex.getCapsule(this);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user