Package com.jme3.texture.plugins
Class DDSLoader
java.lang.Object
com.jme3.texture.plugins.DDSLoader
- All Implemented Interfaces:
- AssetLoader
DDSLoader is an image loader that reads in a DirectX DDS file.
 Supports DXT1, DXT3, DXT5, RGB, RGBA, Grayscale, Alpha pixel formats.
 2D images, mipmapped 2D images, and cubemaps.- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionbyte[]flipData(byte[] data, int scanlineSize, int height) Flips the given image data on the Y axis.Loads asset from the given input stream, parsing it into an application-usable object.load(InputStream stream) readData(boolean flip) Reads the image data from the InputStream in the required format.readDXT2D(boolean flip, int totalSize) Reads a DXT compressed image from the InputStreamreadDXT3D(boolean flip, int totalSize) Reads a DXT compressed image from the InputStreamreadGrayscale2D(boolean flip, int totalSize) Reads a grayscale image with mipmaps from the InputStreamreadGrayscale3D(boolean flip, int totalSize) Reads a grayscale image with mipmaps from the InputStreamreadRGB2D(boolean flip, int totalSize) Reads an uncompressed RGB or RGBA image.readRGB3D(boolean flip, int totalSize) Reads an uncompressed RGB or RGBA image.
- 
Constructor Details- 
DDSLoaderpublic DDSLoader()
 
- 
- 
Method Details- 
loadDescription copied from interface:AssetLoaderLoads asset from the given input stream, parsing it into an application-usable object.- Specified by:
- loadin interface- AssetLoader
- Parameters:
- info- the located asset
- Returns:
- An object representing the resource.
- Throws:
- IOException- If an I/O error occurs while loading
 
- 
load- Throws:
- IOException
 
- 
flipDatapublic byte[] flipData(byte[] data, int scanlineSize, int height) Flips the given image data on the Y axis.- Parameters:
- data- Data array containing image data (without mipmaps)
- scanlineSize- Size of a single scanline = width * bytesPerPixel
- height- Height of the image in pixels
- Returns:
- The new data flipped by the Y axis
 
- 
readGrayscale2DReads a grayscale image with mipmaps from the InputStream- Parameters:
- flip- Flip the loaded image by Y axis
- totalSize- Total size of the image in bytes including the mipmaps
- Returns:
- A ByteBuffer containing the grayscale image data with mips.
- Throws:
- IOException- If an error occurred while reading from InputStream
 
- 
readRGB2DReads an uncompressed RGB or RGBA image.- Parameters:
- flip- Flip the image on the Y axis
- totalSize- Size of the image in bytes including mipmaps
- Returns:
- ByteBuffer containing image data with mipmaps in the format specified by pixelFormat_
- Throws:
- IOException- If an error occurred while reading from InputStream
 
- 
readDXT2DReads a DXT compressed image from the InputStream- Parameters:
- flip- true→flip image along the Y axis, false→don't flip
- totalSize- Total size of the image in bytes, including mipmaps
- Returns:
- ByteBuffer containing compressed DXT image in the format specified by pixelFormat_
- Throws:
- IOException- If an error occurred while reading from InputStream
 
- 
readGrayscale3DReads a grayscale image with mipmaps from the InputStream- Parameters:
- flip- Flip the loaded image by Y axis
- totalSize- Total size of the image in bytes including the mipmaps
- Returns:
- A ByteBuffer containing the grayscale image data with mips.
- Throws:
- IOException- If an error occurred while reading from InputStream
 
- 
readRGB3DReads an uncompressed RGB or RGBA image.- Parameters:
- flip- Flip the image on the Y axis
- totalSize- Size of the image in bytes including mipmaps
- Returns:
- ByteBuffer containing image data with mipmaps in the format specified by pixelFormat_
- Throws:
- IOException- If an error occurred while reading from InputStream
 
- 
readDXT3DReads a DXT compressed image from the InputStream- Parameters:
- flip- true→flip image along the Y axis, false→don't flip
- totalSize- Total size of the image in bytes, including mipmaps
- Returns:
- ByteBuffer containing compressed DXT image in the format specified by pixelFormat_
- Throws:
- IOException- If an error occurred while reading from InputStream
 
- 
readDataReads the image data from the InputStream in the required format. If the file contains a cubemap image, it is loaded as 6 ByteBuffers (potentially containing mipmaps if they were specified), otherwise a single ByteBuffer is returned for a 2D image.- Parameters:
- flip- Flip the image data or not. For cubemaps, each of the cubemap faces is flipped individually. If the image is DXT compressed, no flipping is done.
- Returns:
- An ArrayList containing a single ByteBuffer for a 2D image, or 6 ByteBuffers for a cubemap. The cubemap ByteBuffer order is PositiveX, NegativeX, PositiveY, NegativeY, PositiveZ, NegativeZ.
- Throws:
- IOException- If an error occurred while reading from the stream.
 
 
-