public static void flipImage(Image img, int index){ if (img.getFormat().isCompressed()) throw new UnsupportedOperationException("Flipping compressed " + "images is unsupported."); int w = img.getWidth(); int h = img.getHeight(); int halfH = h / 2; // bytes per pixel int bpp = img.getFormat().getBitsPerPixel() / 8; int scanline = w * bpp; ByteBuffer data = img.getData(index); ByteBuffer temp = BufferUtils.createByteBuffer(scanline); data.rewind(); for (int y = 0; y < halfH; y++){ int oppY = h - y - 1; // read in scanline data.position(y * scanline); data.limit(data.position() + scanline); temp.rewind(); temp.put(data); } }
if (jmeFormat.isCompressed()) { throw new UnsupportedOperationException("Updating compressed images is not supported"); } else if (jmeFormat.isDepthFormat()) {
private static boolean supportsColorBuffer(Collection<Caps> caps, RenderBuffer colorBuf){ Format colorFmt = colorBuf.getFormat(); if (colorFmt.isDepthFormat()) return false; if (colorFmt.isCompressed()) return false; switch (colorFmt){ case RGB111110F: return caps.contains(Caps.PackedFloatColorBuffer); case RGB16F_to_RGB111110F: case RGB16F_to_RGB9E5: case RGB9E5: return false; default: if (colorFmt.isFloatingPont()) return caps.contains(Caps.FloatColorBuffer); return true; } }
return false; if (colorFmt.isCompressed()) return false;
if (jmeFormat.isCompressed()) { throw new UnsupportedOperationException("Updating compressed images is not supported"); } else if (jmeFormat.isDepthFormat()) {
public static void flipImage(Image img, int index){ if (img.getFormat().isCompressed()) throw new UnsupportedOperationException("Flipping compressed " + "images is unsupported."); int w = img.getWidth(); int h = img.getHeight(); int halfH = h / 2; // bytes per pixel int bpp = img.getFormat().getBitsPerPixel() / 8; int scanline = w * bpp; ByteBuffer data = img.getData(index); ByteBuffer temp = BufferUtils.createByteBuffer(scanline); data.rewind(); for (int y = 0; y < halfH; y++){ int oppY = h - y - 1; // read in scanline data.position(y * scanline); data.limit(data.position() + scanline); temp.rewind(); temp.put(data); } }
public static void flipImage(Image img, int index){ if (img.getFormat().isCompressed()) throw new UnsupportedOperationException("Flipping compressed " + "images is unsupported."); int w = img.getWidth(); int h = img.getHeight(); int halfH = h / 2; // bytes per pixel int bpp = img.getFormat().getBitsPerPixel() / 8; int scanline = w * bpp; ByteBuffer data = img.getData(index); ByteBuffer temp = BufferUtils.createByteBuffer(scanline); data.rewind(); for (int y = 0; y < halfH; y++){ int oppY = h - y - 1; // read in scanline data.position(y * scanline); data.limit(data.position() + scanline); temp.rewind(); temp.put(data); } }
private static boolean supportsColorBuffer(Collection<Caps> caps, RenderBuffer colorBuf){ Format colorFmt = colorBuf.getFormat(); if (colorFmt.isDepthFormat()) return false; if (colorFmt.isCompressed()) return false; switch (colorFmt){ case RGB111110F: return caps.contains(Caps.PackedFloatColorBuffer); case RGB16F_to_RGB111110F: case RGB16F_to_RGB9E5: case RGB9E5: return false; default: if (colorFmt.isFloatingPont()) return caps.contains(Caps.FloatColorBuffer); return true; } }
for (TextureData textureData : textureDatas) { if (textureDatas.size() > 1 && textureData.texture.getImage().getFormat().isCompressed()) { textureData.texture.setImage(ImageUtils.decompress(textureData.texture.getImage())); textureData.textureBlender = TextureBlenderFactory.alterTextureType(textureData.texture.getImage().getFormat(), textureData.textureBlender);