Added a test case for KTX loading

define_list_fix
Nehon 10 years ago
parent 8a96772ae3
commit 8f129ec727
  1. 112
      jme3-examples/src/main/java/jme3test/texture/ktx/TestLoadKtx.java
  2. BIN
      jme3-testdata/src/main/resources/Textures/ktx/down-reference.ktx
  3. BIN
      jme3-testdata/src/main/resources/Textures/ktx/irrMap.ktx
  4. BIN
      jme3-testdata/src/main/resources/Textures/ktx/prefilteredMap.ktx
  5. BIN
      jme3-testdata/src/main/resources/Textures/ktx/rgb-amg-reference.ktx
  6. BIN
      jme3-testdata/src/main/resources/Textures/ktx/rgb-mipmap-reference.ktx
  7. BIN
      jme3-testdata/src/main/resources/Textures/ktx/rgba-reference.ktx
  8. BIN
      jme3-testdata/src/main/resources/Textures/ktx/up-reference.ktx

@ -0,0 +1,112 @@
/*
* Copyright (c) 2009-2015 jMonkeyEngine
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of 'jMonkeyEngine' nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package jme3test.texture.ktx;
import com.jme3.app.SimpleApplication;
import com.jme3.asset.TextureKey;
import com.jme3.math.ColorRGBA;
import com.jme3.renderer.RenderManager;
import com.jme3.scene.Node;
import com.jme3.texture.Texture;
import com.jme3.texture.Texture2D;
import com.jme3.texture.TextureCubeMap;
import com.jme3.texture.plugins.ktx.KTXLoader;
import com.jme3.ui.Picture;
/**
* test
* @author nehon
*/
public class TestLoadKtx extends SimpleApplication {
public static void main(String[] args) {
TestLoadKtx app = new TestLoadKtx();
//app.setShowSettings(false);
app.start();
}
@Override
public void simpleInitApp() {
viewPort.setBackgroundColor(ColorRGBA.DarkGray);
assetManager.registerLoader(KTXLoader.class, "ktx");
Texture2D t = (Texture2D)assetManager.loadTexture("Textures/ktx/down-reference.ktx");
Picture p = new Picture("bla", false);
p.setTexture(assetManager, t, false);
p.setLocalTranslation(200, 200, 0);
p.setWidth(t.getImage().getWidth());
p.setHeight(t.getImage().getHeight());
guiNode.attachChild(p);
Texture2D t2 = (Texture2D)assetManager.loadTexture("Textures/ktx/up-reference.ktx");
Picture p2 = new Picture("bla", false);
p2.setTexture(assetManager, t2, false);
p2.setLocalTranslation(400, 200, 0);
p2.setWidth(t2.getImage().getWidth());
p2.setHeight(t2.getImage().getHeight());
guiNode.attachChild(p2);
Texture2D t3 = (Texture2D)assetManager.loadTexture("Textures/ktx/rgba-reference.ktx");
Picture p3 = new Picture("bla", false);
p3.setTexture(assetManager, t3, false);
p3.setLocalTranslation(200, 400, 0);
p3.setWidth(t3.getImage().getWidth());
p3.setHeight(t3.getImage().getHeight());
guiNode.attachChild(p3);
Texture2D t4 = (Texture2D)assetManager.loadTexture("Textures/ktx/rgb-amg-reference.ktx");
Picture p4 = new Picture("bla", false);
p4.setTexture(assetManager, t4, false);
p4.setLocalTranslation(400, 400, 0);
p4.setWidth(t4.getImage().getWidth());
p4.setHeight(t4.getImage().getHeight());
guiNode.attachChild(p4);
flyCam.setDragToRotate(true);
}
@Override
public void simpleUpdate(float tpf) {
//TODO: add update code
}
@Override
public void simpleRender(RenderManager rm) {
//TODO: add render code
}
}
Loading…
Cancel
Save