@Override public Texture createSimpleClone() { Texture3D clone = new Texture3D(); createSimpleClone(clone); return clone; }
/** * This method creates a RGB8 texture with the sizes of 10x10x10 pixels. */ private Texture getTexture() throws IOException { ArrayList<ByteBuffer> data = new ArrayList<ByteBuffer>(1); ByteBuffer bb = BufferUtils.createByteBuffer(10 * 10 * 10 * 3);//all data must be inside one buffer for (int i = 0; i < 10; ++i) { for (int j = 0; j < 10 * 10; ++j) { bb.put((byte) (255f*i/10f)); bb.put((byte) (255f*i/10f)); bb.put((byte) (255f)); } } bb.rewind(); data.add(bb); return new Texture3D(new Image(Format.RGB8, 10, 10, 10, data, null, ColorSpace.Linear)); } }
tex = new Texture3D(); } else { tex = new Texture2D();
@Override public Texture createSimpleClone() { Texture3D clone = new Texture3D(); createSimpleClone(clone); return clone; }
@Override public Texture createSimpleClone() { Texture3D clone = new Texture3D(); createSimpleClone(clone); return clone; }
public Object postProcess(AssetKey key, Object obj) { TextureKey texKey = (TextureKey) key; Image img = (Image) obj; if (img == null) { return null; } Texture tex; if (texKey.isAsCube()) { if (texKey.isFlipY()) { // also flip -y and +y image in cubemap ByteBuffer pos_y = img.getData(2); img.setData(2, img.getData(3)); img.setData(3, pos_y); } tex = new TextureCubeMap(); } else if (texKey.isAsTexture3D()) { tex = new Texture3D(); } else { tex = new Texture2D(); } // enable mipmaps if image has them // or generate them if requested by user if (img.hasMipmaps() || texKey.isGenerateMips()) { tex.setMinFilter(Texture.MinFilter.Trilinear); } tex.setAnisotropicFilter(texKey.getAnisotropy()); tex.setName(texKey.getName()); tex.setImage(img); return tex; }
@Override public Object postProcess(Object asset) { Image img = (Image) asset; if (img == null) { return null; } Texture tex; if (isAsCube()) { if (isFlipY()) { // also flip -y and +y image in cubemap ByteBuffer pos_y = img.getData(2); img.setData(2, img.getData(3)); img.setData(3, pos_y); } tex = new TextureCubeMap(); } else if (isAsTexture3D()) { tex = new Texture3D(); } else { tex = new Texture2D(); } // enable mipmaps if image has them // or generate them if requested by user if (img.hasMipmaps() || isGenerateMips()) { tex.setMinFilter(Texture.MinFilter.Trilinear); } tex.setAnisotropicFilter(getAnisotropy()); tex.setName(getName()); tex.setImage(img); return tex; }
tex = new Texture3D(); } else { tex = new Texture2D();