diff options
14 files changed, 226 insertions, 205 deletions
diff --git a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaAnimUtils.java b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaAnimUtils.java index d20278c..55dadff 100644 --- a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaAnimUtils.java +++ b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaAnimUtils.java @@ -90,7 +90,7 @@ public class ColladaAnimUtils { /** * Retrieve a name to use for the skin node based on the element names. - * + * * @param ic * instance_controller element. * @param controller @@ -101,17 +101,17 @@ public class ColladaAnimUtils { private String getSkinStoreName(final Element ic, final Element controller) { final String controllerName = controller.getAttributeValue("name", (String) null) != null ? controller .getAttributeValue("name", (String) null) : controller.getAttributeValue("id", (String) null); - final String instanceControllerName = ic.getAttributeValue("name", (String) null) != null ? ic - .getAttributeValue("name", (String) null) : ic.getAttributeValue("sid", (String) null); - final String storeName = (controllerName != null ? controllerName : "") - + (controllerName != null && instanceControllerName != null ? " : " : "") - + (instanceControllerName != null ? instanceControllerName : ""); - return storeName; + final String instanceControllerName = ic.getAttributeValue("name", (String) null) != null ? ic + .getAttributeValue("name", (String) null) : ic.getAttributeValue("sid", (String) null); + final String storeName = (controllerName != null ? controllerName : "") + + (controllerName != null && instanceControllerName != null ? " : " : "") + + (instanceControllerName != null ? instanceControllerName : ""); + return storeName; } /** * Copy the render states from our source Spatial to the destination Spatial. Does not recurse. - * + * * @param source * @param target */ @@ -124,7 +124,7 @@ public class ColladaAnimUtils { /** * Clone the given MeshData object via deep copy using the Ardor3D BinaryExporter and BinaryImporter. - * + * * @param meshData * the source to clone. * @return the clone. @@ -144,7 +144,7 @@ public class ColladaAnimUtils { /** * Builds data based on an instance controller element. - * + * * @param node * Ardor3D parent Node * @param instanceController @@ -171,7 +171,7 @@ public class ColladaAnimUtils { /** * Construct skin mesh(es) from the skin element and attach them (under a single new Node) to the given parent Node. - * + * * @param ardorParentNode * Ardor3D Node to attach our skin node to. * @param instanceController @@ -181,7 +181,6 @@ public class ColladaAnimUtils { * @param skin * our <skin> element. */ - @SuppressWarnings("unchecked") private void buildSkinMeshes(final Node ardorParentNode, final Element instanceController, final Element controller, final Element skin) { final String skinSource = skin.getAttributeValue("source"); @@ -579,10 +578,10 @@ public class ColladaAnimUtils { /** * Construct morph mesh(es) from the <morph> element and attach them (under a single new Node) to the given parent * Node. - * + * * Note: This method current does not do anything but attach the referenced mesh since Ardor3D does not yet support * morph target animation. - * + * * @param ardorParentNode * Ardor3D Node to attach our morph mesh to. * @param controller @@ -616,7 +615,7 @@ public class ColladaAnimUtils { /** * Parse all animations in library_animations - * + * * @param colladaRoot */ public void parseLibraryAnimations(final Element colladaRoot) { @@ -643,10 +642,9 @@ public class ColladaAnimUtils { /** * Merge all animation channels into Ardor jointchannels - * + * * @param entry */ - @SuppressWarnings("unchecked") private void buildAnimations(final Element parentElement, final Collection<TargetChannel> targetList) { final List<Element> elementTransforms = new ArrayList<Element>(); @@ -831,12 +829,11 @@ public class ColladaAnimUtils { /** * Gather up all animation channels based on what nodes they affect. - * + * * @param channelMap * @param animationRoot * @param animationItemRoot */ - @SuppressWarnings("unchecked") private void parseAnimations(final Multimap<Element, TargetChannel> channelMap, final Element animationRoot, final AnimationItem animationItemRoot) { if (animationRoot.getChild("animation") != null) { @@ -889,7 +886,7 @@ public class ColladaAnimUtils { /** * Find a target node based on collada target format. - * + * * @param target * @return */ @@ -954,7 +951,7 @@ public class ColladaAnimUtils { /** * Break up a target uri string into id, sids and accessors - * + * * @param targetString * @return */ @@ -1019,7 +1016,7 @@ public class ColladaAnimUtils { /** * Convert a list of collada elements into a list of TransformElements - * + * * @param transforms * @return */ @@ -1051,7 +1048,7 @@ public class ColladaAnimUtils { /** * Bake a list of TransformElements into an Ardor3D Transform object. - * + * * @param transforms * @return */ @@ -1101,7 +1098,7 @@ public class ColladaAnimUtils { /** * Util for making a readable string out of a xml element hierarchy - * + * * @param e * @param maxDepth * @return @@ -1116,7 +1113,6 @@ public class ColladaAnimUtils { return str.toString(); } - @SuppressWarnings("unchecked") private static void getElementString(final Element e, final StringBuilder str, final int depth, final int maxDepth, final boolean showDots) { addSpacing(str, depth); @@ -1138,7 +1134,7 @@ public class ColladaAnimUtils { str.append('>'); if (depth < maxDepth) { str.append('\n'); - for (final Element child : (List<Element>) e.getChildren()) { + for (final Element child : e.getChildren()) { getElementString(child, str, depth + 1, maxDepth, showDots); } if (!"".equals(e.getText())) { @@ -1184,7 +1180,7 @@ public class ColladaAnimUtils { return "Target [accessorType=" + accessorType + ", id=" + id + ", sids=" + sids + "]"; } return "Target [accessorType=" + accessorType + ", accessorIndexX=" + accessorIndexX + ", accessorIndexY=" - + accessorIndexY + ", id=" + id + ", sids=" + sids + "]"; + + accessorIndexY + ", id=" + id + ", sids=" + sids + "]"; } } } diff --git a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaDOMUtil.java b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaDOMUtil.java index 2bff121..42360dc 100644 --- a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaDOMUtil.java +++ b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaDOMUtil.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>. */ @@ -46,7 +46,7 @@ public class ColladaDOMUtil { /** * Find element with specific id - * + * * @param baseUrl * url specifying target id * @return element with specific id or null if not found @@ -57,7 +57,7 @@ public class ColladaDOMUtil { /** * Find element with specific sid - * + * * @param baseUrl * url specifying target sid * @return element with specific id or null if not found @@ -68,7 +68,7 @@ public class ColladaDOMUtil { /** * Select nodes through an XPath query and return all hits as a List - * + * * @param element * root element to start search on * @param query @@ -89,7 +89,7 @@ public class ColladaDOMUtil { /** * Select nodes through an XPath query and returns the first hit - * + * * @param element * root element to start search on * @param query @@ -121,7 +121,7 @@ public class ColladaDOMUtil { /** * Compiles and return an XPath expression. Expressions are cached. - * + * * @param query * XPath query to compile * @return new XPath expression object @@ -146,7 +146,7 @@ public class ColladaDOMUtil { /** * Parses the text under a node and returns it as a float array. - * + * * @param node * node to parse content from * @return parsed float array @@ -176,7 +176,7 @@ public class ColladaDOMUtil { /** * Parses the text under a node and returns it as a double array. - * + * * @param node * node to parse content from * @return parsed double array @@ -206,7 +206,7 @@ public class ColladaDOMUtil { /** * Parses the text under a node and returns it as an int array. - * + * * @param node * node to parse content from * @return parsed int array @@ -236,7 +236,7 @@ public class ColladaDOMUtil { /** * Parses the text under a node and returns it as a boolean array. - * + * * @param node * node to parse content from * @return parsed boolean array @@ -266,7 +266,7 @@ public class ColladaDOMUtil { /** * Parses the text under a node and returns it as a string array. - * + * * @param node * node to parse content from * @return parsed string array @@ -292,14 +292,13 @@ public class ColladaDOMUtil { /** * Strips the namespace from all nodes in a tree. - * + * * @param rootElement * Root of strip operation */ public void stripNamespace(final Element rootElement) { rootElement.setNamespace(null); - @SuppressWarnings("unchecked") final List<Element> children = rootElement.getChildren(); final Iterator<Element> i = children.iterator(); while (i.hasNext()) { @@ -310,7 +309,7 @@ public class ColladaDOMUtil { /** * Parse an int value in an attribute. - * + * * @param input * Element containing the attribute * @param attributeName @@ -331,7 +330,7 @@ public class ColladaDOMUtil { /** * Convert a Collada color description into an Ardor3D ColorRGBA - * + * * @param colorDescription * Collada color description * @return Ardor3d ColorRGBA @@ -358,11 +357,10 @@ public class ColladaDOMUtil { /** * Find Element with semantic POSITION under an element with inputs - * + * * @param v * @return */ - @SuppressWarnings("unchecked") public Element getPositionSource(final Element v) { for (final Element input : v.getChildren("input")) { if ("POSITION".equals(input.getAttributeValue("semantic"))) { diff --git a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaInputPipe.java b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaInputPipe.java index d883756..0505c10 100644 --- a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaInputPipe.java +++ b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaInputPipe.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>. */ @@ -77,7 +77,6 @@ public class ColladaInputPipe { float_param, bool_param, int_param, name_param, idref_param } - @SuppressWarnings("unchecked") public ColladaInputPipe(final ColladaDOMUtil colladaDOMUtil, final Element input) { // Setup our type try { @@ -201,10 +200,10 @@ public class ColladaInputPipe { _buffer = BufferUtils.createFloatBuffer(size); meshData.setTangentCoords(new FloatBufferData(_buffer, _paramCount)); break; - // case TEXBINORMAL: - // _buffer = BufferUtils.createFloatBuffer(size); - // meshData.setTangentBuffer(_buffer); - // break; + // case TEXBINORMAL: + // _buffer = BufferUtils.createFloatBuffer(size); + // meshData.setTangentBuffer(_buffer); + // break; default: } } diff --git a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaMaterialUtils.java b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaMaterialUtils.java index e4572ff..9c2ccc6 100644 --- a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaMaterialUtils.java +++ b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaMaterialUtils.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>. */ @@ -60,7 +60,7 @@ public class ColladaMaterialUtils { /** * Find and apply the given material to the given Mesh. - * + * * @param materialName * our material name * @param mesh @@ -345,7 +345,7 @@ public class ColladaMaterialUtils { /** * Function to searches an xml node for <texture> elements and adds them to the texture state of the mesh. - * + * * @param mesh * the Ardor3D Mesh to add the Texture to. * @param element @@ -359,7 +359,6 @@ public class ColladaMaterialUtils { if ("texture".equals(element.getName()) && _loadTextures) { populateTextureState(mesh, element, effect, loadedTextures, info, null); } - @SuppressWarnings("unchecked") final List<Element> children = element.getChildren(); if (children != null) { for (final Element child : children) { @@ -371,7 +370,7 @@ public class ColladaMaterialUtils { /** * Convert a <texture> element to an Ardor3D representation and store in the given state. - * + * * @param mesh * the Ardor3D Mesh to add the Texture to. * @param daeTexture @@ -535,7 +534,6 @@ public class ColladaMaterialUtils { } } - @SuppressWarnings("unchecked") public void bindMaterials(final Element bindMaterial) { if (bindMaterial == null || bindMaterial.getChildren().isEmpty()) { return; @@ -553,7 +551,6 @@ public class ColladaMaterialUtils { } } - @SuppressWarnings("unchecked") public void unbindMaterials(final Element bindMaterial) { if (bindMaterial == null || bindMaterial.getChildren().isEmpty()) { return; diff --git a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaNodeUtils.java b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaNodeUtils.java index 165ad89..6db31ec 100644 --- a/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaNodeUtils.java +++ b/ardor3d-collada/src/main/java/com/ardor3d/extension/model/collada/jdom/ColladaNodeUtils.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>. */ @@ -59,12 +59,11 @@ public class ColladaNodeUtils { /** * Retrieves the scene and returns it as an Ardor3D Node. - * + * * @param colladaRoot * The collada root element * @return Scene as an Node or null if not found */ - @SuppressWarnings("unchecked") public Node getVisualScene(final Element colladaRoot) { if (colladaRoot.getChild("scene") == null) { logger.warning("No scene found in collada file!"); @@ -155,11 +154,10 @@ public class ColladaNodeUtils { /** * Parse an asset element into an AssetData object. - * + * * @param asset * @return */ - @SuppressWarnings("unchecked") public AssetData parseAsset(final Element asset) { final AssetData assetData = new AssetData(); @@ -202,7 +200,6 @@ public class ColladaNodeUtils { return assetData; } - @SuppressWarnings("unchecked") private void parseContributor(final AssetData assetData, final Element contributor) { for (final Element child : contributor.getChildren()) { if ("author".equals(child.getName())) { @@ -236,11 +233,10 @@ public class ColladaNodeUtils { /** * Recursively parse the node hierarcy. - * + * * @param dNode * @return a new Ardor3D node, created from the given <node> element */ - @SuppressWarnings("unchecked") private Node buildNode(final Element dNode, JointNode jointNode) { final NodeType nodeType = getNodeType(dNode); final JointNode jointChildNode; @@ -352,7 +348,7 @@ public class ColladaNodeUtils { /** * Combines a list of transform elements into an Ardor3D Transform object. - * + * * @param transforms * List of transform elements * @return an Ardor3D Transform object 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; } } } diff --git a/ardor3d-examples/src/main/java/com/ardor3d/example/PropertiesDialog.java b/ardor3d-examples/src/main/java/com/ardor3d/example/PropertiesDialog.java index 6d4a7ed..6392202 100644 --- a/ardor3d-examples/src/main/java/com/ardor3d/example/PropertiesDialog.java +++ b/ardor3d-examples/src/main/java/com/ardor3d/example/PropertiesDialog.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>. */ @@ -70,15 +70,15 @@ public final class PropertiesDialog extends JDialog { // UI components private JCheckBox fullscreenBox = null; - private JComboBox displayResCombo = null; + private JComboBox<String> displayResCombo = null; - private JComboBox samplesCombo = null; + private JComboBox<String> samplesCombo = null; - private JComboBox colorDepthCombo = null; + private JComboBox<String> colorDepthCombo = null; - private JComboBox displayFreqCombo = null; + private JComboBox<String> displayFreqCombo = null; - private JComboBox rendererCombo = null; + private JComboBox<String> rendererCombo = null; private JLabel icon = null; @@ -89,7 +89,7 @@ public final class PropertiesDialog extends JDialog { /** * Constructor for the <code>PropertiesDialog</code>. Creates a properties dialog initialized for the primary * display. - * + * * @param source * the <code>GameSettings</code> object to use for working with the properties file. * @param imageFile @@ -105,7 +105,7 @@ public final class PropertiesDialog extends JDialog { /** * Constructor for the <code>PropertiesDialog</code>. Creates a properties dialog initialized for the primary * display. - * + * * @param source * the <code>GameSettings</code> object to use for working with the properties file. * @param imageFile @@ -121,7 +121,7 @@ public final class PropertiesDialog extends JDialog { /** * Constructor for the <code>PropertiesDialog</code>. Creates a properties dialog initialized for the primary * display. - * + * * @param source * the <code>GameSettings</code> object to use for working with the properties file. * @param imageFile @@ -138,7 +138,7 @@ public final class PropertiesDialog extends JDialog { /** * Constructor for the <code>PropertiesDialog</code>. Creates a properties dialog initialized for the primary * display. - * + * * @param source * the <code>GameSettings</code> object to use for working with the properties file. * @param imageFile @@ -172,7 +172,7 @@ public final class PropertiesDialog extends JDialog { /** * <code>setImage</code> sets the background image of the dialog. - * + * * @param image * <code>String</code> representing the image file. */ @@ -188,7 +188,7 @@ public final class PropertiesDialog extends JDialog { /** * <code>setImage</code> sets the background image of this dialog. - * + * * @param image * <code>URL</code> pointing to the image file. */ @@ -266,9 +266,9 @@ public final class PropertiesDialog extends JDialog { displayResCombo.addKeyListener(aListener); samplesCombo = setUpSamplesChooser(); samplesCombo.addKeyListener(aListener); - colorDepthCombo = new JComboBox(); + colorDepthCombo = new JComboBox<String>(); colorDepthCombo.addKeyListener(aListener); - displayFreqCombo = new JComboBox(); + displayFreqCombo = new JComboBox<String>(); displayFreqCombo.addKeyListener(aListener); fullscreenBox = new JCheckBox("Fullscreen?"); fullscreenBox.setSelected(source.isFullscreen()); @@ -330,7 +330,7 @@ public final class PropertiesDialog extends JDialog { /** * <code>verifyAndSaveCurrentSelection</code> first verifies that the display mode is valid for this system, and * then saves the current selection as a properties.cfg file. - * + * * @return if the selection is valid */ private boolean verifyAndSaveCurrentSelection() { @@ -405,12 +405,12 @@ public final class PropertiesDialog extends JDialog { /** * <code>setUpChooser</code> retrieves all available display modes and places them in a <code>JComboBox</code>. The * resolution specified by GameSettings is used as the default value. - * + * * @return the combo box of display modes. */ - private JComboBox setUpResolutionChooser() { + private JComboBox<String> setUpResolutionChooser() { final String[] res = getResolutions(modes); - final JComboBox resolutionBox = new JComboBox(res); + final JComboBox<String> resolutionBox = new JComboBox<String>(res); resolutionBox.setSelectedItem(source.getWidth() + " x " + source.getHeight()); resolutionBox.addActionListener(new ActionListener() { @@ -425,11 +425,11 @@ public final class PropertiesDialog extends JDialog { /** * <code>setUpRendererChooser</code> sets the list of available renderers. The renderer specified by GameSettings is * used as the default value. - * + * * @return the list of renderers. */ - private JComboBox setUpRendererChooser() { - final JComboBox nameBox = new JComboBox(new String[] { "LWJGL 2.8.4", "JOGL 2.0rc11" }); + private JComboBox<String> setUpRendererChooser() { + final JComboBox<String> nameBox = new JComboBox<String>(new String[] { "LWJGL 2.8.4", "JOGL 2.0rc11" }); final String old = source.getRenderer(); if (old != null) { if (old.startsWith("LWJGL")) { @@ -441,8 +441,8 @@ public final class PropertiesDialog extends JDialog { return nameBox; } - private JComboBox setUpSamplesChooser() { - final JComboBox nameBox = new JComboBox(samples); + private JComboBox<String> setUpSamplesChooser() { + final JComboBox<String> nameBox = new JComboBox<String>(samples); nameBox.setSelectedItem(source.getRenderer()); return nameBox; } @@ -468,11 +468,11 @@ public final class PropertiesDialog extends JDialog { // grab available depths final String[] depths = getDepths(resolution, modes); - colorDepthCombo.setModel(new DefaultComboBoxModel(depths)); + colorDepthCombo.setModel(new DefaultComboBoxModel<String>(depths)); colorDepthCombo.setSelectedItem(colorDepth); // grab available frequencies final String[] freqs = getFrequencies(resolution, modes); - displayFreqCombo.setModel(new DefaultComboBoxModel(freqs)); + displayFreqCombo.setModel(new DefaultComboBoxModel<String>(freqs)); // Try to reset freq displayFreqCombo.setSelectedItem(displayFreq); } @@ -484,12 +484,12 @@ public final class PropertiesDialog extends JDialog { */ private void updateResolutionChoices() { if (!fullscreenBox.isSelected()) { - displayResCombo.setModel(new DefaultComboBoxModel(windowedResolutions)); - colorDepthCombo.setModel(new DefaultComboBoxModel(new String[] { "24 bpp", "16 bpp" })); - displayFreqCombo.setModel(new DefaultComboBoxModel(new String[] { "n/a" })); + displayResCombo.setModel(new DefaultComboBoxModel<String>(windowedResolutions)); + colorDepthCombo.setModel(new DefaultComboBoxModel<String>(new String[] { "24 bpp", "16 bpp" })); + displayFreqCombo.setModel(new DefaultComboBoxModel<String>(new String[] { "n/a" })); displayFreqCombo.setEnabled(false); } else { - displayResCombo.setModel(new DefaultComboBoxModel(getResolutions(modes))); + displayResCombo.setModel(new DefaultComboBoxModel<String>(getResolutions(modes))); displayFreqCombo.setEnabled(true); updateDisplayChoices(); } @@ -502,7 +502,7 @@ public final class PropertiesDialog extends JDialog { /** * Utility method for converting a String denoting a file into a URL. - * + * * @return a URL pointing to the file or null */ private static URL getURL(final String file) { diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/JoglPbufferTextureRenderer.java b/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/JoglPbufferTextureRenderer.java index 119a6e7..1a74c24 100644 --- a/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/JoglPbufferTextureRenderer.java +++ b/ardor3d-jogl/src/main/java/com/ardor3d/renderer/jogl/JoglPbufferTextureRenderer.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>. */ @@ -50,7 +50,7 @@ import com.ardor3d.util.geom.jogl.DirectNioBuffersSet; * </p> * N.B: This class can't work without a complete implementation of GLOffscreenAutoDrawable.PBuffer, which is currently * missing from JOGL - * + * * @see TextureRendererFactory */ public class JoglPbufferTextureRenderer extends AbstractPbufferTextureRenderer { @@ -298,7 +298,7 @@ public class JoglPbufferTextureRenderer extends AbstractPbufferTextureRenderer { caps.setDoubleBuffered(false); caps.setOnscreen(false); caps.setPBuffer(true); - _offscreenDrawable = fac.createOffscreenAutoDrawable(null, caps, null, _width, _height, _parentContext); + _offscreenDrawable = fac.createOffscreenAutoDrawable(null, caps, null, _width, _height); _context = _offscreenDrawable.getContext(); _context.makeCurrent(); diff --git a/ardor3d-lwjgl/src/main/java/com/ardor3d/scene/state/lwjgl/LwjglTextureStateUtil.java b/ardor3d-lwjgl/src/main/java/com/ardor3d/scene/state/lwjgl/LwjglTextureStateUtil.java index de21789..9affd9e 100644 --- a/ardor3d-lwjgl/src/main/java/com/ardor3d/scene/state/lwjgl/LwjglTextureStateUtil.java +++ b/ardor3d-lwjgl/src/main/java/com/ardor3d/scene/state/lwjgl/LwjglTextureStateUtil.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>. */ @@ -477,6 +477,9 @@ public abstract class LwjglTextureStateUtil { case OneDimensional: GL11.glTexParameteri(GL11.GL_TEXTURE_1D, GL12.GL_TEXTURE_MAX_LEVEL, max - 1); break; + case CubeMap: + // handled above + break; } if (type == Type.ThreeDimensional) { @@ -1323,7 +1326,7 @@ public abstract class LwjglTextureStateUtil { /** * Check if the filter settings of this particular texture have been changed and apply as needed. - * + * * @param texture * our texture object * @param texRecord @@ -1365,7 +1368,7 @@ public abstract class LwjglTextureStateUtil { /** * Check if the filter settings of this particular texture have been changed and apply as needed. - * + * * @param texture * our texture object * @param texRecord @@ -1406,7 +1409,7 @@ public abstract class LwjglTextureStateUtil { /** * Check if the wrap mode of this particular texture has been changed and apply as needed. - * + * * @param texture * our texture object * @param texRecord @@ -1443,7 +1446,7 @@ public abstract class LwjglTextureStateUtil { /** * Check if the wrap mode of this particular texture has been changed and apply as needed. - * + * * @param texture * our texture object * @param texRecord @@ -1463,7 +1466,7 @@ public abstract class LwjglTextureStateUtil { /** * Check if the wrap mode of this particular texture has been changed and apply as needed. - * + * * @param texture * our texture object * @param texRecord @@ -1485,7 +1488,7 @@ public abstract class LwjglTextureStateUtil { /** * Check if the wrap mode of this particular texture has been changed and apply as needed. - * + * * @param texture * our texture object * @param texRecord @@ -1512,7 +1515,7 @@ public abstract class LwjglTextureStateUtil { /** * Check if the wrap mode of this particular texture has been changed and apply as needed. - * + * * @param cubeMap * our texture object * @param texRecord diff --git a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/functions/CacheFunctionUtil.java b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/functions/CacheFunctionUtil.java index 6421ac9..0553ea8 100644 --- a/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/functions/CacheFunctionUtil.java +++ b/ardor3d-terrain/src/main/java/com/ardor3d/extension/terrain/client/functions/CacheFunctionUtil.java @@ -42,6 +42,9 @@ public class CacheFunctionUtil { tileSize); return; } + default: + System.err.println("CacheFunctionUtil.applyFunction: Unhandled format: " + format); + break; } } else { function.doConversion(sourceData, store, destX, destY, dataSize, tileSize); diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/DefaultLatinTextAreaKeyHandler.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/DefaultLatinTextAreaKeyHandler.java index b0160bb..af850ee 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/DefaultLatinTextAreaKeyHandler.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/DefaultLatinTextAreaKeyHandler.java @@ -243,6 +243,9 @@ public class DefaultLatinTextAreaKeyHandler implements UIKeyHandler { _textArea.fireComponentDirty(); return true; } + default: + // not special, ignore + break; } if (_textArea.isEditable()) { diff --git a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/DefaultLatinTextFieldKeyHandler.java b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/DefaultLatinTextFieldKeyHandler.java index 86ba8da..5efe4ba 100644 --- a/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/DefaultLatinTextFieldKeyHandler.java +++ b/ardor3d-ui/src/main/java/com/ardor3d/extension/ui/text/DefaultLatinTextFieldKeyHandler.java @@ -242,6 +242,9 @@ public class DefaultLatinTextFieldKeyHandler implements UIKeyHandler { _textField.fireComponentDirty(); return true; } + default: + // not special, ignore + break; } if (_textField.isEditable()) { |