diff options
author | Joshua Slack <[email protected]> | 2017-04-20 21:12:42 -0500 |
---|---|---|
committer | Joshua Slack <[email protected]> | 2017-04-20 21:12:42 -0500 |
commit | 9e9c406384a5ef51fd777d936932382f8dde0dc4 (patch) | |
tree | 8b925b31021dc24c95bdc4cd0d36660dd4d7d607 /ardor3d-core/src/main/java | |
parent | 2d335b378ab5a4ab98741117230e82d3c7cb8a69 (diff) |
Cleaned up various warnings
Diffstat (limited to 'ardor3d-core/src/main/java')
3 files changed, 121 insertions, 98 deletions
diff --git a/ardor3d-core/src/main/java/com/ardor3d/image/util/ImageUtils.java b/ardor3d-core/src/main/java/com/ardor3d/image/util/ImageUtils.java index f6064f5..c674d85 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/image/util/ImageUtils.java +++ b/ardor3d-core/src/main/java/com/ardor3d/image/util/ImageUtils.java @@ -3,7 +3,7 @@ * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -51,6 +51,8 @@ public abstract class ImageUtils { return TextureStoreFormat.RGBA16F; case Float: return TextureStoreFormat.RGBA32F; + default: + break; } break; case BGR: @@ -71,6 +73,8 @@ public abstract class ImageUtils { return TextureStoreFormat.RGB16F; case Float: return TextureStoreFormat.RGB32F; + default: + break; } break; case RG: @@ -92,6 +96,8 @@ public abstract class ImageUtils { return TextureStoreFormat.RG16F; case Float: return TextureStoreFormat.RG32F; + default: + break; } break; case Luminance: @@ -111,6 +117,8 @@ public abstract class ImageUtils { return TextureStoreFormat.Luminance16F; case Float: return TextureStoreFormat.Luminance32F; + default: + break; } break; case LuminanceAlpha: @@ -131,6 +139,8 @@ public abstract class ImageUtils { return TextureStoreFormat.LuminanceAlpha16F; case Float: return TextureStoreFormat.LuminanceAlpha32F; + default: + break; } break; case Alpha: @@ -147,6 +157,8 @@ public abstract class ImageUtils { return TextureStoreFormat.Alpha16F; case Float: return TextureStoreFormat.Alpha32F; + default: + break; } break; case Red: @@ -168,6 +180,8 @@ public abstract class ImageUtils { return TextureStoreFormat.R16F; case Float: return TextureStoreFormat.R32F; + default: + break; } break; case Intensity: @@ -187,6 +201,8 @@ public abstract class ImageUtils { return TextureStoreFormat.Intensity16F; case Float: return TextureStoreFormat.Intensity32F; + default: + break; } break; case Depth: diff --git a/ardor3d-core/src/main/java/com/ardor3d/image/util/dds/DdsUtils.java b/ardor3d-core/src/main/java/com/ardor3d/image/util/dds/DdsUtils.java index ffcde82..0cfff85 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/image/util/dds/DdsUtils.java +++ b/ardor3d-core/src/main/java/com/ardor3d/image/util/dds/DdsUtils.java @@ -3,7 +3,7 @@ * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -16,7 +16,7 @@ public class DdsUtils { /** * Get the necessary bit shifts needed to align mask with 0. - * + * * @param mask * the bit mask to test * @return number of bits to shift to the right to align mask with 0. @@ -40,7 +40,7 @@ public class DdsUtils { /** * Check a value against a bit mask to see if it is set. - * + * * @param value * the value to check * @param bitMask @@ -53,7 +53,7 @@ public class DdsUtils { /** * Get the string as a dword int value. - * + * * @param string * our string... should only be 1-4 chars long. * @return the int value @@ -64,7 +64,7 @@ public class DdsUtils { /** * Get the byte array as a dword int value. - * + * * @param bytes * our array... should only be 1-4 bytes long. * @return the int value @@ -86,7 +86,7 @@ public class DdsUtils { /** * Flip a dxt mipmap/image. Inspired by similar code in opentk and the nvidia sdk. - * + * * @param rawData * our unflipped image as raw bytes * @param width @@ -101,77 +101,80 @@ public class DdsUtils { final byte[] returnData = new byte[rawData.length]; final int blocksPerColumn = (width + 3) >> 2; - final int blocksPerRow = (height + 3) >> 2; - final int bytesPerBlock = format.getComponents() * 8; - - for (int sourceRow = 0; sourceRow < blocksPerRow; sourceRow++) { - final int targetRow = blocksPerRow - sourceRow - 1; - for (int column = 0; column < blocksPerColumn; column++) { - final int target = (targetRow * blocksPerColumn + column) * bytesPerBlock; - final int source = (sourceRow * blocksPerColumn + column) * bytesPerBlock; - switch (format) { - case PrecompressedDXT1: - case PrecompressedDXT1A: - case PrecompressedLATC_L: - System.arraycopy(rawData, source, returnData, target, 4); - returnData[target + 4] = rawData[source + 7]; - returnData[target + 5] = rawData[source + 6]; - returnData[target + 6] = rawData[source + 5]; - returnData[target + 7] = rawData[source + 4]; - break; - case PrecompressedDXT3: - // Alpha - returnData[target + 0] = rawData[source + 6]; - returnData[target + 1] = rawData[source + 7]; - returnData[target + 2] = rawData[source + 4]; - returnData[target + 3] = rawData[source + 5]; - returnData[target + 4] = rawData[source + 2]; - returnData[target + 5] = rawData[source + 3]; - returnData[target + 6] = rawData[source + 0]; - returnData[target + 7] = rawData[source + 1]; - - // Color - System.arraycopy(rawData, source + 8, returnData, target + 8, 4); - returnData[target + 12] = rawData[source + 15]; - returnData[target + 13] = rawData[source + 14]; - returnData[target + 14] = rawData[source + 13]; - returnData[target + 15] = rawData[source + 12]; - break; - case PrecompressedDXT5: - // Alpha, the first 2 bytes remain - returnData[target + 0] = rawData[source + 0]; - returnData[target + 1] = rawData[source + 1]; - - // extract 3 bits each and flip them - getBytesFromUInt24(returnData, target + 5, flipUInt24(getUInt24(rawData, source + 2))); - getBytesFromUInt24(returnData, target + 2, flipUInt24(getUInt24(rawData, source + 5))); - - // Color - System.arraycopy(rawData, source + 8, returnData, target + 8, 4); - returnData[target + 12] = rawData[source + 15]; - returnData[target + 13] = rawData[source + 14]; - returnData[target + 14] = rawData[source + 13]; - returnData[target + 15] = rawData[source + 12]; - break; - case PrecompressedLATC_LA: - // alpha - System.arraycopy(rawData, source, returnData, target, 4); - returnData[target + 4] = rawData[source + 7]; - returnData[target + 5] = rawData[source + 6]; - returnData[target + 6] = rawData[source + 5]; - returnData[target + 7] = rawData[source + 4]; - - // Color - System.arraycopy(rawData, source + 8, returnData, target + 8, 4); - returnData[target + 12] = rawData[source + 15]; - returnData[target + 13] = rawData[source + 14]; - returnData[target + 14] = rawData[source + 13]; - returnData[target + 15] = rawData[source + 12]; - break; + final int blocksPerRow = (height + 3) >> 2; + final int bytesPerBlock = format.getComponents() * 8; + + for (int sourceRow = 0; sourceRow < blocksPerRow; sourceRow++) { + final int targetRow = blocksPerRow - sourceRow - 1; + for (int column = 0; column < blocksPerColumn; column++) { + final int target = (targetRow * blocksPerColumn + column) * bytesPerBlock; + final int source = (sourceRow * blocksPerColumn + column) * bytesPerBlock; + switch (format) { + case PrecompressedDXT1: + case PrecompressedDXT1A: + case PrecompressedLATC_L: + System.arraycopy(rawData, source, returnData, target, 4); + returnData[target + 4] = rawData[source + 7]; + returnData[target + 5] = rawData[source + 6]; + returnData[target + 6] = rawData[source + 5]; + returnData[target + 7] = rawData[source + 4]; + break; + case PrecompressedDXT3: + // Alpha + returnData[target + 0] = rawData[source + 6]; + returnData[target + 1] = rawData[source + 7]; + returnData[target + 2] = rawData[source + 4]; + returnData[target + 3] = rawData[source + 5]; + returnData[target + 4] = rawData[source + 2]; + returnData[target + 5] = rawData[source + 3]; + returnData[target + 6] = rawData[source + 0]; + returnData[target + 7] = rawData[source + 1]; + + // Color + System.arraycopy(rawData, source + 8, returnData, target + 8, 4); + returnData[target + 12] = rawData[source + 15]; + returnData[target + 13] = rawData[source + 14]; + returnData[target + 14] = rawData[source + 13]; + returnData[target + 15] = rawData[source + 12]; + break; + case PrecompressedDXT5: + // Alpha, the first 2 bytes remain + returnData[target + 0] = rawData[source + 0]; + returnData[target + 1] = rawData[source + 1]; + + // extract 3 bits each and flip them + getBytesFromUInt24(returnData, target + 5, flipUInt24(getUInt24(rawData, source + 2))); + getBytesFromUInt24(returnData, target + 2, flipUInt24(getUInt24(rawData, source + 5))); + + // Color + System.arraycopy(rawData, source + 8, returnData, target + 8, 4); + returnData[target + 12] = rawData[source + 15]; + returnData[target + 13] = rawData[source + 14]; + returnData[target + 14] = rawData[source + 13]; + returnData[target + 15] = rawData[source + 12]; + break; + case PrecompressedLATC_LA: + // alpha + System.arraycopy(rawData, source, returnData, target, 4); + returnData[target + 4] = rawData[source + 7]; + returnData[target + 5] = rawData[source + 6]; + returnData[target + 6] = rawData[source + 5]; + returnData[target + 7] = rawData[source + 4]; + + // Color + System.arraycopy(rawData, source + 8, returnData, target + 8, 4); + returnData[target + 12] = rawData[source + 15]; + returnData[target + 13] = rawData[source + 14]; + returnData[target + 14] = rawData[source + 13]; + returnData[target + 15] = rawData[source + 12]; + break; + default: + // not a format we care about + break; + } } } - } - return returnData; + return returnData; } // DXT5 Alpha block flipping, inspired by code from Evan Hart (nVidia SDK) @@ -205,26 +208,26 @@ public class DdsUtils { uint24 >>= 3; threeBits[0][2] = (byte) (uint24 & ThreeBitMask); uint24 >>= 3; - threeBits[0][3] = (byte) (uint24 & ThreeBitMask); - uint24 >>= 3; - threeBits[1][0] = (byte) (uint24 & ThreeBitMask); - uint24 >>= 3; - threeBits[1][1] = (byte) (uint24 & ThreeBitMask); - uint24 >>= 3; - threeBits[1][2] = (byte) (uint24 & ThreeBitMask); - uint24 >>= 3; - threeBits[1][3] = (byte) (uint24 & ThreeBitMask); - - // stuff 8x 3bits into 3 bytes - int result = 0; - result = result | (threeBits[1][0] << 0); - result = result | (threeBits[1][1] << 3); - result = result | (threeBits[1][2] << 6); - result = result | (threeBits[1][3] << 9); - result = result | (threeBits[0][0] << 12); - result = result | (threeBits[0][1] << 15); - result = result | (threeBits[0][2] << 18); - result = result | (threeBits[0][3] << 21); - return result; + threeBits[0][3] = (byte) (uint24 & ThreeBitMask); + uint24 >>= 3; + threeBits[1][0] = (byte) (uint24 & ThreeBitMask); + uint24 >>= 3; + threeBits[1][1] = (byte) (uint24 & ThreeBitMask); + uint24 >>= 3; + threeBits[1][2] = (byte) (uint24 & ThreeBitMask); + uint24 >>= 3; + threeBits[1][3] = (byte) (uint24 & ThreeBitMask); + + // stuff 8x 3bits into 3 bytes + int result = 0; + result = result | (threeBits[1][0] << 0); + result = result | (threeBits[1][1] << 3); + result = result | (threeBits[1][2] << 6); + result = result | (threeBits[1][3] << 9); + result = result | (threeBits[0][0] << 12); + result = result | (threeBits[0][1] << 15); + result = result | (threeBits[0][2] << 18); + result = result | (threeBits[0][3] << 21); + return result; } } diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/MaterialStateRecord.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/MaterialStateRecord.java index 543649f..a61c5e0 100644 --- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/MaterialStateRecord.java +++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/MaterialStateRecord.java @@ -3,7 +3,7 @@ * * This file is part of Ardor3D. * - * Ardor3D is free software: you can redistribute it and/or modify it + * Ardor3D is free software: you can redistribute it and/or modify it * under the terms of its license which may be found in the accompanying * LICENSE file or at <http://www.ardor3d.com/LICENSE>. */ @@ -153,6 +153,8 @@ public class MaterialStateRecord extends StateRecord { case Specular: frontSpecular.set(-1, -1, -1, -1); break; + case None: + break; } } if (face == MaterialFace.Back || face == MaterialFace.FrontAndBack) { @@ -173,6 +175,8 @@ public class MaterialStateRecord extends StateRecord { case Specular: backSpecular.set(-1, -1, -1, -1); break; + case None: + break; } } } |