@Override public Texture createSimpleClone() { Texture3D clone = new Texture3D(); createSimpleClone(clone); return clone; }
/** * Creates a new three-dimensional texture for the purpose of offscreen * rendering. * * @see com.jme3.texture.FrameBuffer * * @param width * @param height * @param format * @param numSamples */ public Texture3D(int width, int height, int depth, int numSamples, Image.Format format) { this(new Image(format, width, height, depth, null, ColorSpace.Linear)); getImage().setMultiSamples(numSamples); }
@Override public boolean equals(Object other) { if (!(other instanceof Texture3D)) { return false; } Texture3D that = (Texture3D) other; if (this.getWrap(WrapAxis.S) != that.getWrap(WrapAxis.S)) { return false; } if (this.getWrap(WrapAxis.T) != that.getWrap(WrapAxis.T)) { return false; } if (this.getWrap(WrapAxis.R) != that.getWrap(WrapAxis.R)) { return false; } return super.equals(other); }
/** * Creates a new three-dimensional texture using the given image. * @param img The image to use. */ public Texture3D(Image img) { super(); setImage(img); if (img.getFormat().isDepthFormat()) { setMagFilter(MagFilter.Nearest); setMinFilter(MinFilter.NearestNoMipMaps); } }
/** * 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)); } }
/** * Creates a new three-dimensional texture using the given image. * @param img The image to use. */ public Texture3D(Image img) { super(); setImage(img); if (img.getFormat().isDepthFormat()) { setMagFilter(MagFilter.Nearest); setMinFilter(MinFilter.NearestNoMipMaps); } }
tex = new Texture3D(); } else { tex = new Texture2D();
/** * Creates a new three-dimensional texture using the given image. * @param img The image to use. */ public Texture3D(Image img) { super(); setImage(img); if (img.getFormat().isDepthFormat()) { setMagFilter(MagFilter.Nearest); setMinFilter(MinFilter.NearestNoMipMaps); } }
@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 boolean equals(Object other) { if (!(other instanceof Texture3D)) { return false; } Texture3D that = (Texture3D) other; if (this.getWrap(WrapAxis.S) != that.getWrap(WrapAxis.S)) { return false; } if (this.getWrap(WrapAxis.T) != that.getWrap(WrapAxis.T)) { return false; } if (this.getWrap(WrapAxis.R) != that.getWrap(WrapAxis.R)) { return false; } return super.equals(other); }
/** * Creates a new three-dimensional texture for the purpose of offscreen * rendering. * * @see com.jme3.texture.FrameBuffer * * @param width * @param height * @param format * @param numSamples */ public Texture3D(int width, int height, int depth, int numSamples, Image.Format format) { this(new Image(format, width, height, depth, null, ColorSpace.Linear)); getImage().setMultiSamples(numSamples); }
@Override public Texture createSimpleClone() { Texture3D clone = new Texture3D(); createSimpleClone(clone); return clone; }
@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; }
@Override public boolean equals(Object other) { if (!(other instanceof Texture3D)) { return false; } Texture3D that = (Texture3D) other; if (this.getWrap(WrapAxis.S) != that.getWrap(WrapAxis.S)) { return false; } if (this.getWrap(WrapAxis.T) != that.getWrap(WrapAxis.T)) { return false; } if (this.getWrap(WrapAxis.R) != that.getWrap(WrapAxis.R)) { return false; } return super.equals(other); }
/** * Creates a new three-dimensional texture for the purpose of offscreen * rendering. * * @see com.jme3.texture.FrameBuffer * * @param width * @param height * @param format * @param numSamples */ public Texture3D(int width, int height, int depth, int numSamples, Image.Format format) { this(new Image(format, width, height, depth, null)); getImage().setMultiSamples(numSamples); }
tex = new Texture3D(); } else { tex = new Texture2D();