* Small fixes in DDSLoader
* Moved ImageFlipper to core-plugins git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7664 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
		
							parent
							
								
									c6d887cf5a
								
							
						
					
					
						commit
						8a9e717ca9
					
				| @ -32,17 +32,20 @@ | ||||
| 
 | ||||
| package com.jme3.texture.plugins; | ||||
| 
 | ||||
| import com.jme3.asset.*; | ||||
| import com.jme3.util.*; | ||||
| import com.jme3.asset.AssetInfo; | ||||
| import com.jme3.asset.AssetLoader; | ||||
| import com.jme3.asset.TextureKey; | ||||
| import com.jme3.texture.Image; | ||||
| import com.jme3.texture.Image.Format; | ||||
| import com.jme3.util.BufferUtils; | ||||
| import com.jme3.util.LittleEndien; | ||||
| import java.io.DataInput; | ||||
| import java.io.IOException; | ||||
| import java.io.InputStream; | ||||
| import java.nio.ByteBuffer; | ||||
| 
 | ||||
| import java.util.ArrayList; | ||||
| import java.util.logging.Level; | ||||
| import java.util.logging.Logger; | ||||
| 
 | ||||
| /** | ||||
| @ -217,7 +220,8 @@ public class DDSLoader implements AssetLoader { | ||||
|             } else if (mipMapCount != expectedMipmaps) { | ||||
|                 // changed to warning- images often do not have the required amount, | ||||
|                 // or specify that they have mipmaps but include only the top level.. | ||||
|                 logger.warning("Got " + mipMapCount + "mipmaps, expected" + expectedMipmaps); | ||||
|                 logger.log(Level.WARNING, "Got {0} mipmaps, expected {1}",  | ||||
|                         new Object[]{mipMapCount, expectedMipmaps}); | ||||
|             } | ||||
|         } else { | ||||
|             mipMapCount = 1; | ||||
| @ -293,7 +297,8 @@ public class DDSLoader implements AssetLoader { | ||||
|                     logger.warning("Must use linear size with fourcc"); | ||||
|                     pitchOrSize = size; | ||||
|                 } else if (pitchOrSize != size) { | ||||
|                     logger.warning("Expected size = " + size + ", real = " + pitchOrSize); | ||||
|                     logger.log(Level.WARNING, "Expected size = {0}, real = {1}",  | ||||
|                             new Object[]{size, pitchOrSize}); | ||||
|                 } | ||||
|             } else { | ||||
|                 pitchOrSize = size; | ||||
| @ -363,7 +368,8 @@ public class DDSLoader implements AssetLoader { | ||||
|                     logger.warning("Linear size said to contain valid value but does not"); | ||||
|                     pitchOrSize = size; | ||||
|                 } else if (pitchOrSize != size) { | ||||
|                     logger.warning("Expected size = " + size + ", real = " + pitchOrSize); | ||||
|                     logger.log(Level.WARNING, "Expected size = {0}, real = {1}",  | ||||
|                             new Object[]{size, pitchOrSize}); | ||||
|                 } | ||||
|             } else { | ||||
|                 pitchOrSize = size; | ||||
| @ -603,7 +609,7 @@ public class DDSLoader implements AssetLoader { | ||||
|     /** | ||||
|      * Checks if flags contains the specified mask | ||||
|      */ | ||||
|     private static final boolean is(int flags, int mask) { | ||||
|     private static boolean is(int flags, int mask) { | ||||
|         return (flags & mask) == mask; | ||||
|     } | ||||
| 
 | ||||
| @ -648,8 +654,8 @@ public class DDSLoader implements AssetLoader { | ||||
|     /** | ||||
|      * Converts a int representing a FourCC into a String | ||||
|      */ | ||||
|     private static final String string(int value) { | ||||
|         StringBuffer buf = new StringBuffer(); | ||||
|     private static String string(int value) { | ||||
|         StringBuilder buf = new StringBuilder(); | ||||
| 
 | ||||
|         buf.append((char) (value & 0xFF)); | ||||
|         buf.append((char) ((value & 0xFF00) >> 8)); | ||||
|  | ||||
| @ -38,7 +38,8 @@ import java.nio.ByteBuffer; | ||||
| import java.nio.ByteOrder; | ||||
| 
 | ||||
| /** | ||||
|  * | ||||
|  * DXTFlipper is a utility class used to flip along Y axis DXT compressed textures. | ||||
|  *  | ||||
|  * @author Kirill Vainer | ||||
|  */ | ||||
| public class DXTFlipper { | ||||
| @ -69,7 +70,7 @@ public class DXTFlipper { | ||||
|         return data; | ||||
|     } | ||||
| 
 | ||||
|     public static void flipDXT5Block(byte[] block, int h){ | ||||
|     private static void flipDXT5Block(byte[] block, int h){ | ||||
|         if (h == 1) | ||||
|             return; | ||||
| 
 | ||||
| @ -122,7 +123,7 @@ public class DXTFlipper { | ||||
|         assert c0 == block[0] && c1 == block[1]; | ||||
|     } | ||||
| 
 | ||||
|     public static void flipDXT3Block(byte[] block, int h){ | ||||
|     private static void flipDXT3Block(byte[] block, int h){ | ||||
|         if (h == 1) | ||||
|             return; | ||||
| 
 | ||||
| @ -164,7 +165,7 @@ public class DXTFlipper { | ||||
|      * @param block | ||||
|      * @param h | ||||
|      */ | ||||
|     public static void flipDXT1Block(byte[] block, int h){ | ||||
|     private static void flipDXT1orDXTA3Block(byte[] block, int h){ | ||||
|         byte tmp; | ||||
|         switch (h){ | ||||
|             case 1: | ||||
| @ -244,7 +245,7 @@ public class DXTFlipper { | ||||
|                 if (type == 4 || type == 5) | ||||
|                     flipDXT5Block(colorBlock, h); | ||||
|                 else | ||||
|                     flipDXT1Block(colorBlock, h); | ||||
|                     flipDXT1orDXTA3Block(colorBlock, h); | ||||
| 
 | ||||
|                 // write block (no need to flip block indexes, only pixels | ||||
|                 // inside block | ||||
| @ -301,7 +302,7 @@ public class DXTFlipper { | ||||
|                     if (type == 4 || type == 5) | ||||
|                         flipDXT5Block(colorBlock, h); | ||||
|                     else | ||||
|                         flipDXT1Block(colorBlock, h); | ||||
|                         flipDXT1orDXTA3Block(colorBlock, h); | ||||
|                      | ||||
|                     retImg.put(colorBlock); | ||||
|                 } | ||||
|  | ||||
| @ -30,11 +30,19 @@ | ||||
|  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
|  */ | ||||
| 
 | ||||
| package com.jme3.texture; | ||||
| package com.jme3.texture.plugins; | ||||
| 
 | ||||
| import com.jme3.texture.Image; | ||||
| import com.jme3.util.BufferUtils; | ||||
| import java.nio.ByteBuffer; | ||||
| 
 | ||||
| /** | ||||
|  * ImageFlipper is a utility class used to flip images across the Y axis. | ||||
|  * Due to the standard of where the image origin is between OpenGL and | ||||
|  * other software, this class is required. | ||||
|  *  | ||||
|  * @author Kirill Vainer | ||||
|  */ | ||||
| public class ImageFlipper { | ||||
| 
 | ||||
|     public static void flipImage(Image img, int index){ | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user