aboutsummaryrefslogtreecommitdiffstats
path: root/ardor3d-core/src
diff options
context:
space:
mode:
Diffstat (limited to 'ardor3d-core/src')
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/annotation/GuardedBy.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/annotation/Immutable.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/annotation/MainThread.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/annotation/SavableFactory.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/annotation/ThreadSafe.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/bounding/BoundingBox.java73
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/bounding/BoundingSphere.java82
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/bounding/BoundingVolume.java74
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/bounding/CollisionTree.java38
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/bounding/CollisionTreeController.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/bounding/CollisionTreeManager.java52
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/bounding/OrientedBoundingBox.java73
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/bounding/TreeComparator.java3
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/bounding/UsageTreeController.java3
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/framework/Canvas.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/framework/CanvasRenderer.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/framework/DisplaySettings.java201
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/framework/FrameHandler.java6
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/framework/NativeCanvas.java18
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/framework/Scene.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/framework/Updater.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/image/Image.java14
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/image/ImageDataFormat.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/image/PixelDataType.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/image/Texture.java5
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/image/Texture1D.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/image/Texture2D.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/image/Texture3D.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/image/TextureCubeMap.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/image/TextureStoreFormat.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/image/util/AbiLoader.java3
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/image/util/ColorMipMapGenerator.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/image/util/GeneratedImageFactory.java6
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/image/util/ImageLoader.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/image/util/ImageLoaderUtil.java19
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/image/util/ImageUtils.java227
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/image/util/TextureProjector.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/image/util/TgaLoader.java75
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/image/util/dds/D3d10ResourceDimension.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/image/util/dds/DdsHeader.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/image/util/dds/DdsHeaderDX10.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/image/util/dds/DdsLoader.java58
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/image/util/dds/DdsPixelFormat.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/image/util/dds/DdsUtils.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/image/util/dds/DxgiFormat.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/input/ButtonState.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/input/ControllerEvent.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/input/ControllerInfo.java8
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/input/ControllerState.java25
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/input/ControllerWrapper.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/input/FocusWrapper.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/input/GrabbedState.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/input/InputState.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/input/Key.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/input/KeyEvent.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/input/KeyNotFoundException.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/input/KeyState.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/input/KeyboardState.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/input/KeyboardWrapper.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/input/MouseButton.java39
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/input/MouseCursor.java32
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/input/MouseManager.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/input/MouseState.java7
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/input/MouseWrapper.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/input/PhysicalLayer.java6
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/input/control/FirstPersonControl.java5
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/input/control/OrbitCamControl.java7
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/input/logical/AnyControllerCondition.java3
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/input/logical/AnyKeyCondition.java3
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/input/logical/BasicTriggersApplier.java3
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/input/logical/ControllerComponentActiveCondition.java3
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/input/logical/ControllerComponentCondition.java3
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/input/logical/ControllerCondition.java3
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/input/logical/DummyControllerWrapper.java8
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/input/logical/DummyFocusWrapper.java4
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/input/logical/DummyKeyboardWrapper.java8
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/input/logical/DummyMouseWrapper.java8
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/input/logical/InputTrigger.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/input/logical/KeyHeldCondition.java3
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/input/logical/KeyPressedCondition.java3
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/input/logical/KeyReleasedCondition.java3
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/input/logical/LogicalLayer.java6
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/input/logical/LogicalTriggersApplier.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/input/logical/MouseButtonClickedCondition.java3
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/input/logical/MouseButtonCondition.java33
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/input/logical/MouseButtonPressedCondition.java3
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/input/logical/MouseButtonReleasedCondition.java3
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/input/logical/MouseMovedCondition.java3
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/input/logical/MouseWheelMovedCondition.java3
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/input/logical/TriggerAction.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/input/logical/TriggerConditions.java66
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/input/logical/TwoInputStates.java16
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/intersection/BoundingCollisionResults.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/intersection/BoundingPickResults.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/intersection/CollisionData.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/intersection/CollisionResults.java4
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/intersection/Intersection.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/intersection/IntersectionRecord.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/intersection/PickData.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/intersection/PickResults.java26
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/intersection/Pickable.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/intersection/PickingUtil.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/intersection/PrimitiveCollisionResults.java6
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/intersection/PrimitiveKey.java13
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/intersection/PrimitivePickData.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/intersection/PrimitivePickResults.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/intersection/TriangleTriangleIntersect.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/light/DirectionalLight.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/light/Light.java13
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/light/PointLight.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/light/SpotLight.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/AbstractFBOTextureRenderer.java19
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/AbstractPbufferTextureRenderer.java13
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/AbstractRenderer.java12
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/Camera.java7
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/ContextCapabilities.java52
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/ContextCleanListener.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/ContextManager.java15
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/DrawBufferTarget.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/IndexMode.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/RenderContext.java22
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/RenderLogic.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/Renderer.java6
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/RendererCallable.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/StereoCamera.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/TextureRenderer.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/TextureRendererFactory.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/TextureRendererProvider.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/effect/EffectManager.java10
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/effect/EffectStep.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/effect/EffectStep_RenderScreenOverlay.java10
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/effect/EffectStep_RenderSpatials.java9
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/effect/EffectStep_SetRenderTarget.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/effect/RenderEffect.java7
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/effect/RenderTarget.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/effect/RenderTarget_Framebuffer.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/effect/RenderTarget_Texture2D.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/effect/TextureRendererPool.java6
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/pass/BasicPassManager.java4
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/pass/OutlinePass.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/pass/Pass.java6
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/pass/RenderPass.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/queue/AbstractRenderBucket.java15
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/queue/OpaqueRenderBucket.java23
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/queue/OrthoRenderBucket.java3
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/queue/RenderBucket.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/queue/RenderBucketType.java4
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/queue/RenderQueue.java6
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/queue/TransparentRenderBucket.java7
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/state/BlendState.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/state/ClipState.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/state/ColorMaskState.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/state/CullState.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/state/FogState.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/state/FragmentProgramState.java34
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/state/GLSLShaderDataLogic.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/state/GLSLShaderObjectsState.java244
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/state/LightState.java4
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/state/LightUtil.java3
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/state/MaterialState.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/state/OffsetState.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/state/RenderState.java12
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/state/ShadingState.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/state/StencilState.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/state/TextureState.java4
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/state/VertexProgramState.java34
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/state/WireframeState.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/state/ZBufferState.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/BlendStateRecord.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/ClipStateRecord.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/ColorMaskStateRecord.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/CullStateRecord.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/FogStateRecord.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/FragmentProgramStateRecord.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/LightRecord.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/LightStateRecord.java4
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/LineRecord.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/MaterialStateRecord.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/OffsetStateRecord.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/RendererRecord.java4
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/ShaderObjectsStateRecord.java6
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/ShadingStateRecord.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/StateRecord.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/StencilStateRecord.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/TextureRecord.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/TextureStateRecord.java5
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/TextureUnitRecord.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/VertexProgramStateRecord.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/WireframeStateRecord.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/ZBufferStateRecord.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/scenegraph/AbstractBufferData.java32
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/scenegraph/ByteBufferData.java3
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/scenegraph/FloatBufferData.java3
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/scenegraph/FloatBufferDataUtil.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/scenegraph/IndexBufferData.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/scenegraph/InstancingManager.java6
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/scenegraph/IntBufferData.java3
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/scenegraph/Line.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/scenegraph/Mesh.java9
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/scenegraph/MeshData.java155
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/scenegraph/Node.java4
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/scenegraph/Point.java3
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/scenegraph/Renderable.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/scenegraph/ShortBufferData.java3
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/scenegraph/Spatial.java187
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/scenegraph/controller/ComplexSpatialController.java6
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/scenegraph/controller/SpatialController.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/scenegraph/controller/interpolation/CurveInterpolationController.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/scenegraph/controller/interpolation/CurveLookAtController.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/scenegraph/controller/interpolation/DefaultColorInterpolationController.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/scenegraph/controller/interpolation/InterpolationController.java30
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/scenegraph/controller/interpolation/LinearVector3InterpolationController.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/scenegraph/controller/interpolation/QuaternionInterpolationController.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/scenegraph/controller/interpolation/Vector3InterpolationController.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/scenegraph/event/DirtyEventListener.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/scenegraph/event/DirtyType.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/scenegraph/event/SceneGraphManager.java6
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/scenegraph/extension/BillboardNode.java3
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/scenegraph/extension/CameraNode.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/scenegraph/extension/PassNode.java4
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/scenegraph/extension/PassNodeState.java7
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/scenegraph/extension/QuadImposterNode.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/scenegraph/extension/Skybox.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/scenegraph/extension/SwitchNode.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/scenegraph/hint/CullHint.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/scenegraph/hint/DataMode.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/scenegraph/hint/Hintable.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/scenegraph/hint/NormalsMode.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/scenegraph/hint/PickingHint.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/scenegraph/hint/SceneHints.java5
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/scenegraph/hint/TransparencyType.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Arrow.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/AxisRods.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Box.java23
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Capsule.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Cone.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Cylinder.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Disk.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Dodecahedron.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Dome.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Extrusion.java4
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/GeoSphere.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Hexagon.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Icosahedron.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/MultiFaceBox.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Octahedron.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/OrientedBox.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/PQTorus.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Pyramid.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Quad.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/RoundedBox.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Sphere.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/StripBox.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Teapot.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Torus.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Tube.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/scenegraph/visitor/DeleteVBOsVisitor.java3
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/scenegraph/visitor/SetModelBoundVisitor.java3
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/scenegraph/visitor/UpdateModelBoundVisitor.java3
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/scenegraph/visitor/Visitor.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/spline/ArcLengthTable.java6
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/spline/CatmullRomSpline.java4
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/spline/Curve.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/spline/Spline.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/ui/text/BMFont.java21
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/ui/text/BMFontManager.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/ui/text/BMText.java6
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/ui/text/BasicText.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/ui/text/CopyPasteImpl.java17
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/ui/text/NullCopyPasteImpl.java24
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/Ardor3dException.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/Constants.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/ContextGarbageCollector.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/ContextIdReference.java13
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/DrawableCamera.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/ExtendedCamera.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/GameTask.java7
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/GameTaskQueue.java8
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/GameTaskQueueManager.java4
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/LittleEndianDataInput.java40
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/LittleEndianRandomAccessDataInput.java17
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/ReadOnlyTimer.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/SimpleContextIdReference.java7
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/SortUtil.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/TextureKey.java36
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/TextureManager.java11
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/Timer.java7
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/UrlUtils.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryClassField.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryClassObject.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryCloner.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryExporter.java32
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryIdContentPair.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryImporter.java66
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryInputCapsule.java55
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryOutputCapsule.java50
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/export/xml/DOMInputCapsule.java58
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/export/xml/DOMOutputCapsule.java45
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/export/xml/DOMSerializer.java8
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/export/xml/DOM_PrettyPrint.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/export/xml/XMLExporter.java4
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/export/xml/XMLImporter.java6
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/geom/BufferUtils.java286
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/geom/CopyLogic.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/geom/Debugger.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/geom/GeometryTool.java179
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/geom/MeshCombiner.java17
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/geom/NonIndexedNormalGenerator.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/geom/NormalGenerator.java19
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/geom/SceneCopier.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/geom/SharedCopyLogic.java3
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/geom/TangentUtil.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/geom/VertGroupData.java6
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/geom/VertKey.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/geom/VertMap.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/resource/MultiFormatResourceLocator.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/resource/RelativeResourceLocator.java12
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/resource/ResourceLocator.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/resource/ResourceLocatorTool.java17
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/resource/ResourceSource.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/resource/SimpleResourceLocator.java14
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/resource/StringResourceSource.java9
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/resource/URLResourceSource.java22
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/scenegraph/CompileOptions.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/scenegraph/DisplayListDelegate.java17
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/scenegraph/RenderDelegate.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/scenegraph/SceneCompiler.java3
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/screen/ScreenExportable.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/screen/ScreenExporter.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/shader/ShaderVariable.java41
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableFloat.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableFloat2.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableFloat3.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableFloat4.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableFloatArray.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableInt.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableInt2.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableInt3.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableInt4.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableIntArray.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableMatrix2.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableMatrix3.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableMatrix4.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableMatrix4Array.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariablePointerByte.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariablePointerFloat.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariablePointerFloatMatrix.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariablePointerInt.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariablePointerShort.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/stat/MultiStatSample.java6
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/stat/StatCollector.java12
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/stat/StatListener.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/stat/StatType.java10
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/stat/StatValue.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/stat/graph/AbstractStatGrapher.java19
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/stat/graph/DefColorFadeController.java3
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/stat/graph/GraphFactory.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/stat/graph/LineGrapher.java8
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/stat/graph/TableLinkable.java2
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/stat/graph/TabledLabelGrapher.java5
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/stat/graph/TimedAreaGrapher.java8
-rw-r--r--ardor3d-core/src/test/java/com/ardor3d/bounding/TestBounding.java2
-rw-r--r--ardor3d-core/src/test/java/com/ardor3d/bounding/TestRayBounding.java2
-rw-r--r--ardor3d-core/src/test/java/com/ardor3d/input/TestKeyboardState.java2
-rw-r--r--ardor3d-core/src/test/java/com/ardor3d/input/TestPhysicalLayer.java16
-rw-r--r--ardor3d-core/src/test/java/com/ardor3d/input/logical/TestLogicalLayer.java22
-rw-r--r--ardor3d-core/src/test/java/com/ardor3d/input/logical/TestStandardConditions.java128
-rw-r--r--ardor3d-core/src/test/java/com/ardor3d/renderer/queue/RenderBucketTypeTest.java59
-rw-r--r--ardor3d-core/src/test/java/com/ardor3d/util/MockInputStream.java2
-rw-r--r--ardor3d-core/src/test/java/com/ardor3d/util/TestLittleEndianDataInput.java20
-rw-r--r--ardor3d-core/src/test/java/com/ardor3d/util/TestLittleEndianRandomAccessDataInput.java2
371 files changed, 2861 insertions, 1599 deletions
diff --git a/ardor3d-core/src/main/java/com/ardor3d/annotation/GuardedBy.java b/ardor3d-core/src/main/java/com/ardor3d/annotation/GuardedBy.java
index fadc6b5..91608bd 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/annotation/GuardedBy.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/annotation/GuardedBy.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/annotation/Immutable.java b/ardor3d-core/src/main/java/com/ardor3d/annotation/Immutable.java
index c5433f8..8663f8b 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/annotation/Immutable.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/annotation/Immutable.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/annotation/MainThread.java b/ardor3d-core/src/main/java/com/ardor3d/annotation/MainThread.java
index 6c596d1..2badda4 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/annotation/MainThread.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/annotation/MainThread.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/annotation/SavableFactory.java b/ardor3d-core/src/main/java/com/ardor3d/annotation/SavableFactory.java
index 03e4c7f..f5ede4a 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/annotation/SavableFactory.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/annotation/SavableFactory.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/annotation/ThreadSafe.java b/ardor3d-core/src/main/java/com/ardor3d/annotation/ThreadSafe.java
index 4be6bcc..8c3c3d2 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/annotation/ThreadSafe.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/annotation/ThreadSafe.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/bounding/BoundingBox.java b/ardor3d-core/src/main/java/com/ardor3d/bounding/BoundingBox.java
index c7de5dc..2ad7d96 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/bounding/BoundingBox.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/bounding/BoundingBox.java
@@ -1,9 +1,9 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* 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>.
*/
@@ -12,6 +12,7 @@ package com.ardor3d.bounding;
import java.io.IOException;
import java.nio.FloatBuffer;
+import java.util.Objects;
import com.ardor3d.intersection.IntersectionRecord;
import com.ardor3d.math.MathUtils;
@@ -65,15 +66,33 @@ public class BoundingBox extends BoundingVolume {
}
@Override
- public boolean equals(final Object other) {
- if (other == this) {
+ public int hashCode() {
+ return Objects.hash(Integer.valueOf(super.hashCode()), Double.valueOf(getXExtent()),
+ Double.valueOf(getYExtent()), Double.valueOf(getZExtent()));
+ }
+
+ @Override
+ public boolean equals(final Object obj) {
+ if (this == obj) {
return true;
}
- if (!(other instanceof BoundingBox)) {
+ if (!super.equals(obj)) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ final BoundingBox other = (BoundingBox) obj;
+ if (Double.doubleToLongBits(_xExtent) != Double.doubleToLongBits(other._xExtent)) {
+ return false;
+ }
+ if (Double.doubleToLongBits(_yExtent) != Double.doubleToLongBits(other._yExtent)) {
return false;
}
- final BoundingBox b = (BoundingBox) other;
- return _center.equals(b._center) && _xExtent == b._xExtent && _yExtent == b._yExtent && _zExtent == b._zExtent;
+ if (Double.doubleToLongBits(_zExtent) != Double.doubleToLongBits(other._zExtent)) {
+ return false;
+ }
+ return true;
}
@Override
@@ -217,7 +236,7 @@ public class BoundingBox extends BoundingVolume {
/**
* <code>computeFromPoints</code> creates a new Bounding Box from a given set of points. It uses the
* <code>containAABB</code> method as default.
- *
+ *
* @param points
* the points to contain.
*/
@@ -233,10 +252,10 @@ public class BoundingBox extends BoundingVolume {
return;
}
- final Vector3 min = _compVect1
- .set(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY);
- final Vector3 max = _compVect2
- .set(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY);
+ final Vector3 min = _compVect1.set(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY,
+ Double.POSITIVE_INFINITY);
+ final Vector3 max = _compVect2.set(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY,
+ Double.NEGATIVE_INFINITY);
final int vertsPerPrimitive = data.getIndexMode(section).getVertexCount();
Vector3[] store = new Vector3[vertsPerPrimitive];
@@ -282,7 +301,7 @@ public class BoundingBox extends BoundingVolume {
/**
* <code>containAABB</code> creates a minimum-volume axis-aligned bounding box of the points, then selects the
* smallest enclosing sphere of the box with the sphere centered at the boxes center.
- *
+ *
* @param points
* the list of points.
*/
@@ -333,7 +352,7 @@ public class BoundingBox extends BoundingVolume {
/**
* <code>whichSide</code> takes a plane (typically provided by a view frustum) to determine which side this bound is
* on.
- *
+ *
* @param plane
* the plane to check against.
*/
@@ -357,7 +376,7 @@ public class BoundingBox extends BoundingVolume {
/**
* <code>merge</code> combines this sphere with a second bounding sphere. This new sphere contains both bounding
* spheres and is returned.
- *
+ *
* @param volume
* the sphere to combine with this sphere.
* @return the new sphere
@@ -371,8 +390,8 @@ public class BoundingBox extends BoundingVolume {
switch (volume.getType()) {
case AABB: {
final BoundingBox vBox = (BoundingBox) volume;
- return merge(vBox._center, vBox.getXExtent(), vBox.getYExtent(), vBox.getZExtent(), new BoundingBox(
- new Vector3(0, 0, 0), 0, 0, 0));
+ return merge(vBox._center, vBox.getXExtent(), vBox.getYExtent(), vBox.getZExtent(),
+ new BoundingBox(new Vector3(0, 0, 0), 0, 0, 0));
}
case Sphere: {
@@ -395,7 +414,7 @@ public class BoundingBox extends BoundingVolume {
/**
* <code>mergeLocal</code> combines this sphere with a second bounding sphere locally. Altering this sphere to
* contain both the original and the additional sphere volumes;
- *
+ *
* @param volume
* the sphere to combine with this sphere.
* @return this
@@ -455,7 +474,7 @@ public class BoundingBox extends BoundingVolume {
/**
* Merges this AABB with the given OBB.
- *
+ *
* @param volume
* the OBB to merge this AABB with.
* @return This AABB extended to fit the given OBB.
@@ -518,7 +537,7 @@ public class BoundingBox extends BoundingVolume {
/**
* <code>merge</code> combines this bounding box with another box which is defined by the center, x, y, z extents.
- *
+ *
* @param boxCenter
* the center of the box to merge with
* @param boxX
@@ -580,7 +599,7 @@ public class BoundingBox extends BoundingVolume {
/**
* <code>clone</code> creates a new BoundingBox object containing the same data as this one.
- *
+ *
* @param store
* where to store the cloned information. if null or wrong class, a new store is created.
* @return the new BoundingBox
@@ -604,7 +623,7 @@ public class BoundingBox extends BoundingVolume {
/**
* <code>toString</code> returns the string representation of this object. The form is:
* "Radius: RRR.SSSS Center: <Vector>".
- *
+ *
* @return the string representation of this.
*/
@Override
@@ -742,8 +761,8 @@ public class BoundingBox extends BoundingVolume {
}
final double[] distances = new double[] { t[0] };
- final Vector3[] points = new Vector3[] { new Vector3(ray.getDirection()).multiplyLocal(distances[0])
- .addLocal(ray.getOrigin()), };
+ final Vector3[] points = new Vector3[] {
+ new Vector3(ray.getDirection()).multiplyLocal(distances[0]).addLocal(ray.getOrigin()), };
return new IntersectionRecord(distances, points);
}
@@ -802,7 +821,7 @@ public class BoundingBox extends BoundingVolume {
/**
* Get our corners using the bounding center and extents.
- *
+ *
* @param store
* An optional store. Must be at least length of 8. If null, one will be created for you.
* @return array filled with our corners.
@@ -829,7 +848,7 @@ public class BoundingBox extends BoundingVolume {
/**
* <code>clip</code> determines if a line segment intersects the current test plane.
- *
+ *
* @param denom
* the denominator of the line segment.
* @param numer
@@ -865,7 +884,7 @@ public class BoundingBox extends BoundingVolume {
/**
* Query extent.
- *
+ *
* @param store
* where extent gets stored - null to return a new vector
* @return store / new vector
diff --git a/ardor3d-core/src/main/java/com/ardor3d/bounding/BoundingSphere.java b/ardor3d-core/src/main/java/com/ardor3d/bounding/BoundingSphere.java
index ba685e3..1f8b3e9 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/bounding/BoundingSphere.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/bounding/BoundingSphere.java
@@ -1,9 +1,9 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* 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>.
*/
@@ -12,6 +12,7 @@ package com.ardor3d.bounding;
import java.io.IOException;
import java.nio.FloatBuffer;
+import java.util.Objects;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -55,7 +56,7 @@ public class BoundingSphere extends BoundingVolume {
/**
* Constructor instantiates a new <code>BoundingSphere</code> object.
- *
+ *
* @param r
* the radius of the sphere.
* @param c
@@ -67,6 +68,29 @@ public class BoundingSphere extends BoundingVolume {
}
@Override
+ public int hashCode() {
+ return Objects.hash(Integer.valueOf(super.hashCode()), Double.valueOf(getRadius()));
+ }
+
+ @Override
+ public boolean equals(final Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (!super.equals(obj)) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ final BoundingSphere other = (BoundingSphere) obj;
+ if (Double.doubleToLongBits(_radius) != Double.doubleToLongBits(other._radius)) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
public Type getType() {
return Type.Sphere;
}
@@ -100,7 +124,7 @@ public class BoundingSphere extends BoundingVolume {
/**
* <code>getRadius</code> returns the radius of the bounding sphere.
- *
+ *
* @return the radius of the bounding sphere.
*/
@Override
@@ -110,7 +134,7 @@ public class BoundingSphere extends BoundingVolume {
/**
* <code>setRadius</code> sets the radius of this bounding sphere.
- *
+ *
* @param radius
* the new radius of the bounding sphere.
*/
@@ -121,7 +145,7 @@ public class BoundingSphere extends BoundingVolume {
/**
* <code>computeFromPoints</code> creates a new Bounding Sphere from a given set of points. It uses the
* <code>calcWelzl</code> method as default.
- *
+ *
* @param points
* the points to contain.
*/
@@ -159,7 +183,7 @@ public class BoundingSphere extends BoundingVolume {
* Calculates a minimum bounding sphere for the set of points. The algorithm was originally found at
* http://www.flipcode.com/cgi-bin/msg.cgi?showThread=COTD-SmallestEnclosingSpheres&forum=cotd&id=-1 in C++ and
* translated to java by Cep21
- *
+ *
* @param points
* The points to calculate the minimum bounds from.
*/
@@ -172,7 +196,7 @@ public class BoundingSphere extends BoundingVolume {
/**
* Used from calcWelzl. This function recurses to calculate a minimum bounding sphere a few points at a time.
- *
+ *
* @param points
* The array of points to look through.
* @param p
@@ -225,12 +249,14 @@ public class BoundingSphere extends BoundingVolume {
}
}
+ // FIXME move this method into an helper class
public static void populateFromBuffer(final Vector3 vector, final float[] buf, final int index) {
vector.setX(buf[index * 3]);
vector.setY(buf[index * 3 + 1]);
vector.setZ(buf[index * 3 + 2]);
}
+ // FIXME move this method into an helper class
public static void setInBuffer(final ReadOnlyVector3 vector, final float[] buf, final int index) {
if (buf == null) {
return;
@@ -248,7 +274,7 @@ public class BoundingSphere extends BoundingVolume {
/**
* Calculates the minimum bounding sphere of 4 points. Used in welzl's algorithm.
- *
+ *
* @param O
* The 1st point inside the sphere.
* @param A
@@ -264,8 +290,9 @@ public class BoundingSphere extends BoundingVolume {
final Vector3 b = B.subtract(O, null);
final Vector3 c = C.subtract(O, null);
- final double Denominator = 2.0 * (a.getX() * (b.getY() * c.getZ() - c.getY() * b.getZ()) - b.getX()
- * (a.getY() * c.getZ() - c.getY() * a.getZ()) + c.getX() * (a.getY() * b.getZ() - b.getY() * a.getZ()));
+ final double Denominator = 2.0 * (a.getX() * (b.getY() * c.getZ() - c.getY() * b.getZ())
+ - b.getX() * (a.getY() * c.getZ() - c.getY() * a.getZ())
+ + c.getX() * (a.getY() * b.getZ() - b.getY() * a.getZ()));
if (Denominator == 0) {
_center.set(0, 0, 0);
setRadius(0);
@@ -281,7 +308,7 @@ public class BoundingSphere extends BoundingVolume {
/**
* Calculates the minimum bounding sphere of 3 points. Used in welzl's algorithm.
- *
+ *
* @param O
* The 1st point inside the sphere.
* @param A
@@ -311,7 +338,7 @@ public class BoundingSphere extends BoundingVolume {
/**
* Calculates the minimum bounding sphere of 2 points. Used in welzl's algorithm.
- *
+ *
* @param O
* The 1st point inside the sphere.
* @param A
@@ -319,16 +346,16 @@ public class BoundingSphere extends BoundingVolume {
* @see #calcWelzl(java.nio.FloatBuffer)
*/
private void setSphere(final Vector3 O, final Vector3 A) {
- setRadius(Math.sqrt(((A.getX() - O.getX()) * (A.getX() - O.getX()) + (A.getY() - O.getY())
- * (A.getY() - O.getY()) + (A.getZ() - O.getZ()) * (A.getZ() - O.getZ())) / 4f)
- + radiusEpsilon - 1);
+ setRadius(
+ Math.sqrt(((A.getX() - O.getX()) * (A.getX() - O.getX()) + (A.getY() - O.getY()) * (A.getY() - O.getY())
+ + (A.getZ() - O.getZ()) * (A.getZ() - O.getZ())) / 4f) + radiusEpsilon - 1);
Vector3.lerp(O, A, .5, _center);
}
/**
* <code>averagePoints</code> selects the sphere center to be the average of the points and the sphere radius to be
* the smallest value to enclose all points.
- *
+ *
* @param points
* the list of points to contain.
*/
@@ -358,7 +385,7 @@ public class BoundingSphere extends BoundingVolume {
/**
* <code>whichSide</code> takes a plane (typically provided by a view frustum) to determine which side this bound is
* on.
- *
+ *
* @param plane
* the plane to check against.
* @return side
@@ -379,7 +406,7 @@ public class BoundingSphere extends BoundingVolume {
/**
* <code>merge</code> combines this sphere with a second bounding sphere. This new sphere contains both bounding
* spheres and is returned.
- *
+ *
* @param volume
* the sphere to combine with this sphere.
* @return a new sphere
@@ -423,7 +450,7 @@ public class BoundingSphere extends BoundingVolume {
/**
* <code>mergeLocal</code> combines this sphere with a second bounding sphere locally. Altering this sphere to
* contain both the original and the additional sphere volumes;
- *
+ *
* @param volume
* the sphere to combine with this sphere.
* @return this
@@ -462,7 +489,7 @@ public class BoundingSphere extends BoundingVolume {
/**
* Merges this sphere with the given OBB.
- *
+ *
* @param volume
* The OBB to merge.
* @return This sphere, after merging.
@@ -512,7 +539,8 @@ public class BoundingSphere extends BoundingVolume {
return this;
}
- private BoundingVolume merge(final double otherRadius, final ReadOnlyVector3 otherCenter, final BoundingSphere store) {
+ private BoundingVolume merge(final double otherRadius, final ReadOnlyVector3 otherCenter,
+ final BoundingSphere store) {
// check for infinite bounds... is so, return infinite bounds with center at origin
if (Double.isInfinite(otherRadius) || Double.isInfinite(getRadius())) {
store.setCenter(Vector3.ZERO);
@@ -592,7 +620,7 @@ public class BoundingSphere extends BoundingVolume {
/**
* <code>clone</code> creates a new BoundingSphere object containing the same data as this one.
- *
+ *
* @param store
* where to store the cloned information. if null or wrong class, a new store is created.
* @return the new BoundingSphere
@@ -690,8 +718,8 @@ public class BoundingSphere extends BoundingVolume {
discr = (a1 * a1) - a;
root = Math.sqrt(discr);
final double[] distances = new double[] { root - a1 };
- final Vector3[] points = new Vector3[] { ray.getDirection().multiply(distances[0], new Vector3())
- .addLocal(ray.getOrigin()) };
+ final Vector3[] points = new Vector3[] {
+ ray.getDirection().multiply(distances[0], new Vector3()).addLocal(ray.getOrigin()) };
return new IntersectionRecord(distances, points);
}
@@ -715,8 +743,8 @@ public class BoundingSphere extends BoundingVolume {
}
final double[] distances = new double[] { -a1 };
- final Vector3[] points = new Vector3[] { ray.getDirection().multiply(distances[0], new Vector3())
- .addLocal(ray.getOrigin()) };
+ final Vector3[] points = new Vector3[] {
+ ray.getDirection().multiply(distances[0], new Vector3()).addLocal(ray.getOrigin()) };
return new IntersectionRecord(distances, points);
}
diff --git a/ardor3d-core/src/main/java/com/ardor3d/bounding/BoundingVolume.java b/ardor3d-core/src/main/java/com/ardor3d/bounding/BoundingVolume.java
index 19a9822..e660675 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/bounding/BoundingVolume.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/bounding/BoundingVolume.java
@@ -1,9 +1,9 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* 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>.
*/
@@ -13,6 +13,7 @@ package com.ardor3d.bounding;
import java.io.IOException;
import java.io.Serializable;
import java.nio.FloatBuffer;
+import java.util.Objects;
import com.ardor3d.intersection.IntersectionRecord;
import com.ardor3d.math.Vector3;
@@ -45,9 +46,29 @@ public abstract class BoundingVolume implements Serializable, Savable {
_center.set(center);
}
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(getCenter());
+ }
+
+ @Override
+ public boolean equals(final Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ final BoundingVolume other = (BoundingVolume) obj;
+ return Objects.equals(_center, other._center);
+ }
+
/**
* Grabs the checkplane we should check first.
- *
+ *
*/
public int getCheckPlane() {
return _checkPlane;
@@ -55,7 +76,7 @@ public abstract class BoundingVolume implements Serializable, Savable {
/**
* Sets the index of the plane that should be first checked during rendering.
- *
+ *
* @param value
*/
public final void setCheckPlane(final int value) {
@@ -68,9 +89,9 @@ public abstract class BoundingVolume implements Serializable, Savable {
public abstract Type getType();
/**
- *
+ *
* <code>transform</code> alters the location of the bounding volume by a transform.
- *
+ *
* @param transform
* @param store
* @return
@@ -78,10 +99,10 @@ public abstract class BoundingVolume implements Serializable, Savable {
public abstract BoundingVolume transform(final ReadOnlyTransform transform, final BoundingVolume store);
/**
- *
+ *
* <code>whichSide</code> returns the side on which the bounding volume lies on a plane. Possible values are
* POSITIVE_SIDE, NEGATIVE_SIDE, and NO_SIDE.
- *
+ *
* @param plane
* the plane to check against this bounding volume.
* @return the side on which this bounding volume lies.
@@ -89,9 +110,9 @@ public abstract class BoundingVolume implements Serializable, Savable {
public abstract ReadOnlyPlane.Side whichSide(ReadOnlyPlane plane);
/**
- *
+ *
* <code>computeFromPoints</code> generates a bounding volume that encompasses a collection of points.
- *
+ *
* @param points
* the points to contain.
*/
@@ -100,7 +121,7 @@ public abstract class BoundingVolume implements Serializable, Savable {
/**
* <code>merge</code> combines two bounding volumes into a single bounding volume that contains both this bounding
* volume and the parameter volume.
- *
+ *
* @param volume
* the volume to combine.
* @return the new merged bounding volume.
@@ -110,7 +131,7 @@ public abstract class BoundingVolume implements Serializable, Savable {
/**
* <code>mergeLocal</code> combines two bounding volumes into a single bounding volume that contains both this
* bounding volume and the parameter volume. The result is stored locally.
- *
+ *
* @param volume
* the volume to combine.
* @return this
@@ -119,7 +140,7 @@ public abstract class BoundingVolume implements Serializable, Savable {
/**
* <code>clone</code> creates a new BoundingVolume object containing the same data as this one.
- *
+ *
* @param store
* where to store the cloned information. if null or wrong class, a new store is created.
* @return the new BoundingVolume
@@ -146,7 +167,7 @@ public abstract class BoundingVolume implements Serializable, Savable {
/**
* Find the distance from the center of this Bounding Volume to the given point.
- *
+ *
* @param point
* The point to get the distance to
* @return distance
@@ -157,7 +178,7 @@ public abstract class BoundingVolume implements Serializable, Savable {
/**
* Find the squared distance from the center of this Bounding Volume to the given point.
- *
+ *
* @param point
* The point to get the distance to
* @return distance
@@ -168,7 +189,7 @@ public abstract class BoundingVolume implements Serializable, Savable {
/**
* Find the distance from the nearest edge of this Bounding Volume to the given point.
- *
+ *
* @param point
* The point to get the distance to
* @return distance
@@ -178,7 +199,7 @@ public abstract class BoundingVolume implements Serializable, Savable {
/**
* determines if this bounding volume and a second given volume are intersecting. Intersecting being: one volume
* contains another, one volume overlaps another or one volume touches another.
- *
+ *
* @param bv
* the second volume to test against.
* @return true if this volume intersects the given volume.
@@ -187,7 +208,7 @@ public abstract class BoundingVolume implements Serializable, Savable {
/**
* determines if a ray intersects this bounding volume.
- *
+ *
* @param ray
* the ray to test.
* @return true if this volume is intersected by a given ray.
@@ -196,7 +217,7 @@ public abstract class BoundingVolume implements Serializable, Savable {
/**
* determines if a ray intersects this bounding volume and if so, where.
- *
+ *
* @param ray
* the ray to test.
* @return an IntersectionRecord containing information about any intersections made by the given Ray with this
@@ -206,7 +227,7 @@ public abstract class BoundingVolume implements Serializable, Savable {
/**
* determines if this bounding volume and a given bounding sphere are intersecting.
- *
+ *
* @param bs
* the bounding sphere to test against.
* @return true if this volume intersects the given bounding sphere.
@@ -215,7 +236,7 @@ public abstract class BoundingVolume implements Serializable, Savable {
/**
* determines if this bounding volume and a given bounding box are intersecting.
- *
+ *
* @param bb
* the bounding box to test against.
* @return true if this volume intersects the given bounding box.
@@ -224,7 +245,7 @@ public abstract class BoundingVolume implements Serializable, Savable {
/**
* determines if this bounding volume and a given bounding box are intersecting.
- *
+ *
* @param bb
* the bounding box to test against.
* @return true if this volume intersects the given bounding box.
@@ -232,9 +253,9 @@ public abstract class BoundingVolume implements Serializable, Savable {
public abstract boolean intersectsOrientedBoundingBox(OrientedBoundingBox bb);
/**
- *
+ *
* determines if a given point is contained within this bounding volume.
- *
+ *
* @param point
* the point to check
* @return true if the point lies within this bounding volume.
@@ -243,21 +264,24 @@ public abstract class BoundingVolume implements Serializable, Savable {
/**
* Convert this bounding volume to another, given bounding type.
- *
+ *
* @param newType
* the type of bounding volume to convert to.
* @return a new bounding volume of the given type, containing this bounding volume.
*/
public abstract BoundingVolume asType(Type newType);
+ @Override
public void write(final OutputCapsule capsule) throws IOException {
capsule.write(_center, "center", new Vector3(Vector3.ZERO));
}
+ @Override
public void read(final InputCapsule capsule) throws IOException {
_center.set((Vector3) capsule.readSavable("center", new Vector3(Vector3.ZERO)));
}
+ @Override
public Class<? extends BoundingVolume> getClassTag() {
return this.getClass();
}
diff --git a/ardor3d-core/src/main/java/com/ardor3d/bounding/CollisionTree.java b/ardor3d-core/src/main/java/com/ardor3d/bounding/CollisionTree.java
index b623327..297616e 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/bounding/CollisionTree.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/bounding/CollisionTree.java
@@ -1,9 +1,9 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* 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>.
*/
@@ -42,7 +42,7 @@ import com.ardor3d.scenegraph.Spatial;
* intersection tests, but increases the creation time for the tree. The number of triangles a leaf node is responsible
* for is defined in CollisionTreeManager. It is actually recommended to allow CollisionTreeManager to maintain the
* collision trees for a scene.
- *
+ *
* @see com.ardor3d.bounding.CollisionTreeManager
*/
public class CollisionTree implements Serializable {
@@ -87,7 +87,7 @@ public class CollisionTree implements Serializable {
/**
* Constructor creates a new instance of CollisionTree.
- *
+ *
* @param type
* the type of collision tree to make
* @see Type
@@ -98,7 +98,7 @@ public class CollisionTree implements Serializable {
/**
* Recreate this Collision Tree for the given Node and child index.
- *
+ *
* @param childIndex
* the index of the child to generate the tree for.
* @param parent
@@ -120,7 +120,7 @@ public class CollisionTree implements Serializable {
/**
* Recreate this Collision Tree for the given mesh.
- *
+ *
* @param mesh
* The mesh that this tree should represent.
* @param doSort
@@ -199,7 +199,7 @@ public class CollisionTree implements Serializable {
/**
* Creates a Collision Tree by recursively creating children nodes, splitting the primitives this node is
* responsible for in half until the desired primitive count is reached.
- *
+ *
* @param start
* The start index of the primitivesArray, inclusive.
* @param end
@@ -224,6 +224,8 @@ public class CollisionTree implements Serializable {
// check to see if we are a leaf, if the number of primitives we reference is less than or equal to the maximum
// defined by the CollisionTreeManager we are done.
if (_end - _start + 1 <= CollisionTreeManager.getInstance().getMaxPrimitivesPerLeaf()) {
+ _left = null;
+ _right = null;
return;
}
@@ -254,7 +256,7 @@ public class CollisionTree implements Serializable {
/**
* Tests if the world bounds of the node at this level intersects a provided bounding volume. If an intersection
* occurs, true is returned, otherwise false is returned. If the provided volume is invalid, false is returned.
- *
+ *
* @param volume
* the volume to intersect with.
* @return true if there is an intersect, false otherwise.
@@ -276,7 +278,7 @@ public class CollisionTree implements Serializable {
/**
* Determines if this Collision Tree intersects the given CollisionTree. If a collision occurs, true is returned,
* otherwise false is returned. If the provided collisionTree is invalid, false is returned.
- *
+ *
* @param collisionTree
* The Tree to test.
* @return True if they intersect, false otherwise.
@@ -355,7 +357,7 @@ public class CollisionTree implements Serializable {
* otherwise false is returned. If the provided collisionTree is invalid, false is returned. All collisions that
* occur are stored in lists as an integer index into the mesh's triangle buffer. where aList is the primitives for
* this mesh and bList is the primitives for the test tree.
- *
+ *
* @param collisionTree
* The Tree to test.
* @param aList
@@ -437,7 +439,7 @@ public class CollisionTree implements Serializable {
* intersect checks for collisions between this collision tree and a provided Ray. Any collisions are stored in a
* provided list as primitive index values. The ray is assumed to have a normalized direction for accurate
* calculations.
- *
+ *
* @param ray
* the ray to test for intersections.
* @param store
@@ -447,7 +449,7 @@ public class CollisionTree implements Serializable {
public List<PrimitiveKey> intersect(final Ray3 ray, final List<PrimitiveKey> store) {
List<PrimitiveKey> result = store;
if (result == null) {
- result = new ArrayList<PrimitiveKey>();
+ result = new ArrayList<>();
}
// if our ray doesn't hit the bounds, then it must not hit a primitive.
@@ -487,7 +489,7 @@ public class CollisionTree implements Serializable {
/**
* Returns the bounding volume for this tree node in local space.
- *
+ *
* @return the bounding volume for this tree node in local space.
*/
public BoundingVolume getBounds() {
@@ -496,7 +498,7 @@ public class CollisionTree implements Serializable {
/**
* Returns the bounding volume for this tree node in world space.
- *
+ *
* @return the bounding volume for this tree node in world space.
*/
public BoundingVolume getWorldBounds() {
@@ -551,13 +553,15 @@ public class CollisionTree implements Serializable {
case OBB:
// determine the longest length of the box, this axis will be best for sorting.
if (((OrientedBoundingBox) _bounds)._extent.getX() > ((OrientedBoundingBox) _bounds)._extent.getY()) {
- if (((OrientedBoundingBox) _bounds)._extent.getX() > ((OrientedBoundingBox) _bounds)._extent.getZ()) {
+ if (((OrientedBoundingBox) _bounds)._extent.getX() > ((OrientedBoundingBox) _bounds)._extent
+ .getZ()) {
_comparator.setAxis(TreeComparator.Axis.X);
} else {
_comparator.setAxis(TreeComparator.Axis.Z);
}
} else {
- if (((OrientedBoundingBox) _bounds)._extent.getY() > ((OrientedBoundingBox) _bounds)._extent.getZ()) {
+ if (((OrientedBoundingBox) _bounds)._extent.getY() > ((OrientedBoundingBox) _bounds)._extent
+ .getZ()) {
_comparator.setAxis(TreeComparator.Axis.Y);
} else {
_comparator.setAxis(TreeComparator.Axis.Z);
@@ -590,6 +594,6 @@ public class CollisionTree implements Serializable {
* @return a new reference to the given mesh.
*/
private WeakReference<Mesh> makeRef(final Mesh mesh) {
- return new WeakReference<Mesh>(mesh);
+ return new WeakReference<>(mesh);
}
}
diff --git a/ardor3d-core/src/main/java/com/ardor3d/bounding/CollisionTreeController.java b/ardor3d-core/src/main/java/com/ardor3d/bounding/CollisionTreeController.java
index 840b3af..95c4066 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/bounding/CollisionTreeController.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/bounding/CollisionTreeController.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/bounding/CollisionTreeManager.java b/ardor3d-core/src/main/java/com/ardor3d/bounding/CollisionTreeManager.java
index bfe0c1d..c655b78 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/bounding/CollisionTreeManager.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/bounding/CollisionTreeManager.java
@@ -1,9 +1,9 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* 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>.
*/
@@ -14,12 +14,12 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
+import java.util.WeakHashMap;
import com.ardor3d.scenegraph.Mesh;
import com.ardor3d.scenegraph.Node;
import com.ardor3d.scenegraph.Spatial;
import com.google.common.collect.ImmutableList;
-import com.google.common.collect.MapMaker;
/**
* CollisionTreeManager is an automated system for handling the creation and deletion of CollisionTrees. The manager
@@ -46,7 +46,7 @@ import com.google.common.collect.MapMaker;
* default, the manager will use the UsageTreeController for removing trees, but any other CollisionTreeController is
* acceptable. You can create protected tree manually. These are collision trees that you request the manager to create
* and not allow them to be removed by the CollisionTreeController.
- *
+ *
* @see com.ardor3d.bounding.CollisionTree
* @see com.ardor3d.bounding.CollisionTreeController
*/
@@ -80,14 +80,14 @@ public enum CollisionTreeManager {
* private constructor for the Singleton. Initializes the cache.
*/
private CollisionTreeManager() {
- _cache = new MapMaker().weakKeys().makeMap();
+ _cache = new WeakHashMap<>();
_protectedList = Collections.synchronizedList(new ArrayList<Mesh>(1));
setCollisionTreeController(new UsageTreeController());
}
/**
* retrieves the singleton instance of the CollisionTreeManager.
- *
+ *
* @return the singleton instance of the manager.
*/
public static CollisionTreeManager getInstance() {
@@ -108,7 +108,7 @@ public enum CollisionTreeManager {
/**
* sets the CollisionTreeController used for cleaning the cache when the maximum number of elements is reached.
- *
+ *
* @param treeRemover
* the controller used to clean the cache.
*/
@@ -119,7 +119,7 @@ public enum CollisionTreeManager {
/**
* getCollisionTree obtains a collision tree that is assigned to a supplied Mesh. The cache is checked for a
* pre-existing tree, if none is available and generateTrees is true, a new tree is created and returned.
- *
+ *
* @param mesh
* the mesh to use as the key for the tree to obtain.
* @return the tree associated with a given mesh
@@ -148,7 +148,7 @@ public enum CollisionTreeManager {
* creates a new collision tree for the provided spatial. If the spatial is a node, it recursively calls
* generateCollisionTree for each child. If it is a Mesh, a call to generateCollisionTree is made for each mesh. If
* this tree(s) is to be protected, i.e. not deleted by the CollisionTreeController, set protect to true.
- *
+ *
* @param type
* the type of collision tree to generate.
* @param object
@@ -174,7 +174,7 @@ public enum CollisionTreeManager {
* The tree is placed in the cache. If the cache's size then becomes too large, the cache is sent to the
* CollisionTreeController for clean-up. If this tree is to be protected, i.e. protected from the
* CollisionTreeController, set protect to true.
- *
+ *
* @param type
* the type of collision tree to generate.
* @param mesh
@@ -200,7 +200,7 @@ public enum CollisionTreeManager {
* placed in the cache. If the cache's size then becomes too large, the cache is sent to the CollisionTreeController
* for clean-up. If this tree is to be protected, i.e. protected from the CollisionTreeController, set protect to
* true.
- *
+ *
* @param tree
* the tree to use for generation
* @param mesh
@@ -226,7 +226,7 @@ public enum CollisionTreeManager {
/**
* removes a collision tree from the manager based on the mesh supplied.
- *
+ *
* @param mesh
* the mesh to remove the corresponding collision tree.
*/
@@ -237,7 +237,7 @@ public enum CollisionTreeManager {
/**
* removes all collision trees associated with a Spatial object.
- *
+ *
* @param object
* the spatial to remove all collision trees from.
*/
@@ -255,7 +255,7 @@ public enum CollisionTreeManager {
/**
* updates the existing tree for a supplied mesh. If this tree does not exist, the tree is not updated. If the tree
* is not in the cache, no further operations are handled.
- *
+ *
* @param mesh
* the mesh key for the tree to update.
*/
@@ -269,7 +269,7 @@ public enum CollisionTreeManager {
/**
* updates the existing tree(s) for a supplied spatial. If this tree does not exist, the tree is not updated. If the
* tree is not in the cache, no further operations are handled.
- *
+ *
* @param object
* the object on which to update the tree.
*/
@@ -286,7 +286,7 @@ public enum CollisionTreeManager {
/**
* returns true if the manager is set to sort new generated trees. False otherwise.
- *
+ *
* @return true to sort tree, false otherwise.
*/
public boolean isDoSort() {
@@ -295,7 +295,7 @@ public enum CollisionTreeManager {
/**
* set if this manager should have newly generated trees sort primitives.
- *
+ *
* @param doSort
* true to sort trees, false otherwise.
*/
@@ -305,7 +305,7 @@ public enum CollisionTreeManager {
/**
* returns true if the manager will automatically generate new trees as needed, false otherwise.
- *
+ *
* @return true if this manager is generating trees, false otherwise.
*/
public boolean isGenerateTrees() {
@@ -314,7 +314,7 @@ public enum CollisionTreeManager {
/**
* set if this manager should generate new trees as needed.
- *
+ *
* @param generateTrees
* true to generate trees, false otherwise.
*/
@@ -341,7 +341,7 @@ public enum CollisionTreeManager {
/**
* returns the maximum number of primitives a leaf of the collision tree may contain.
- *
+ *
* @return the maximum number of primitives a leaf may contain.
*/
public int getMaxPrimitivesPerLeaf() {
@@ -350,7 +350,7 @@ public enum CollisionTreeManager {
/**
* set the maximum number of primitives a leaf of the collision tree may contain.
- *
+ *
* @param maxPrimitivesPerLeaf
* the maximum number of primitives a leaf may contain.
*/
@@ -360,7 +360,7 @@ public enum CollisionTreeManager {
/**
* returns the maximum number of CollisionTree elements this manager will hold on to before starting to clear some.
- *
+ *
* @return the maximum number of CollisionTree elements.
*/
public int getMaxElements() {
@@ -369,7 +369,7 @@ public enum CollisionTreeManager {
/**
* set the maximum number of CollisionTree elements this manager will hold on to before starting to clear some.
- *
+ *
* @param maxElements
* the maximum number of CollisionTree elements.
*/
@@ -381,7 +381,7 @@ public enum CollisionTreeManager {
* Add the given mesh to our "protected" list. This will signal to our cleanup operation that when deciding which
* trees to trim in an effort to keep our cache size to a certain desired size, do not trim the tree associated with
* this mesh.
- *
+ *
* @param meshToProtect
* the mesh whose CollisionTree we want to protect.
*/
@@ -393,7 +393,7 @@ public enum CollisionTreeManager {
/**
* Removes the supplied mesh from the "protected" list.
- *
+ *
* @param mesh
*/
public void removeProtected(final Mesh mesh) {
@@ -401,7 +401,7 @@ public enum CollisionTreeManager {
}
/**
- *
+ *
* @return an immutable copy of the list of protected meshes.
*/
public List<Mesh> getProtectedMeshes() {
diff --git a/ardor3d-core/src/main/java/com/ardor3d/bounding/OrientedBoundingBox.java b/ardor3d-core/src/main/java/com/ardor3d/bounding/OrientedBoundingBox.java
index 20dd515..c68a246 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/bounding/OrientedBoundingBox.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/bounding/OrientedBoundingBox.java
@@ -1,9 +1,9 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* 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>.
*/
@@ -12,6 +12,8 @@ package com.ardor3d.bounding;
import java.io.IOException;
import java.nio.FloatBuffer;
+import java.util.Arrays;
+import java.util.Objects;
import com.ardor3d.intersection.IntersectionRecord;
import com.ardor3d.math.Matrix3;
@@ -61,6 +63,61 @@ public class OrientedBoundingBox extends BoundingVolume {
}
@Override
+ public int hashCode() {
+ return Objects.hash(Integer.valueOf(super.hashCode()), getExtent(),
+ Integer.valueOf(Arrays.hashCode(_vectorStore)), getXAxis(), getYAxis(), getZAxis());
+ }
+
+ @Override
+ public boolean equals(final Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (!super.equals(obj)) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ final OrientedBoundingBox other = (OrientedBoundingBox) obj;
+ if (_extent == null) {
+ if (other._extent != null) {
+ return false;
+ }
+ } else if (!_extent.equals(other._extent)) {
+ return false;
+ }
+ if (!Arrays.equals(_vectorStore, other._vectorStore)) {
+ return false;
+ }
+ if (_xAxis == null) {
+ if (other._xAxis != null) {
+ return false;
+ }
+ } else if (!_xAxis.equals(other._xAxis)) {
+ return false;
+ }
+ if (_yAxis == null) {
+ if (other._yAxis != null) {
+ return false;
+ }
+ } else if (!_yAxis.equals(other._yAxis)) {
+ return false;
+ }
+ if (_zAxis == null) {
+ if (other._zAxis != null) {
+ return false;
+ }
+ } else if (!_zAxis.equals(other._zAxis)) {
+ return false;
+ }
+ if (correctCorners != other.correctCorners) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
public Type getType() {
return Type.OBB;
}
@@ -120,7 +177,7 @@ public class OrientedBoundingBox extends BoundingVolume {
/**
* Calculates an AABB of the given point values for this OBB.
- *
+ *
* @param points
* The points this OBB should contain.
*/
@@ -537,10 +594,10 @@ public class OrientedBoundingBox extends BoundingVolume {
final int vertsPerPrimitive = data.getIndexMode(section).getVertexCount();
Vector3[] store = new Vector3[vertsPerPrimitive];
- final Vector3 min = _compVect1
- .set(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY);
- final Vector3 max = _compVect2
- .set(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY);
+ final Vector3 min = _compVect1.set(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY,
+ Double.POSITIVE_INFINITY);
+ final Vector3 max = _compVect2.set(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY,
+ Double.NEGATIVE_INFINITY);
Vector3 point;
for (int i = start; i < end; i++) {
@@ -1305,7 +1362,7 @@ public class OrientedBoundingBox extends BoundingVolume {
/**
* <code>clip</code> determines if a line segment intersects the current test plane.
- *
+ *
* @param denom
* the denominator of the line segment.
* @param numer
diff --git a/ardor3d-core/src/main/java/com/ardor3d/bounding/TreeComparator.java b/ardor3d-core/src/main/java/com/ardor3d/bounding/TreeComparator.java
index 9f4626e..9173ac9 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/bounding/TreeComparator.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/bounding/TreeComparator.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -37,6 +37,7 @@ public class TreeComparator implements Comparator<PrimitiveKey> {
_mesh = mesh;
}
+ @Override
public int compare(final PrimitiveKey o1, final PrimitiveKey o2) {
if (o1.equals(o2)) {
diff --git a/ardor3d-core/src/main/java/com/ardor3d/bounding/UsageTreeController.java b/ardor3d-core/src/main/java/com/ardor3d/bounding/UsageTreeController.java
index ba4d285..cb1ef49 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/bounding/UsageTreeController.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/bounding/UsageTreeController.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -34,6 +34,7 @@ public class UsageTreeController implements CollisionTreeController {
* @param desiredSize
* the final size of the cache to attempt to reach.
*/
+ @Override
public void clean(final Map<Mesh, CollisionTree> cache, final List<Mesh> protectedList, final int desiredSize) {
// get the ordered keyset (this will be ordered with oldest to newest).
diff --git a/ardor3d-core/src/main/java/com/ardor3d/framework/Canvas.java b/ardor3d-core/src/main/java/com/ardor3d/framework/Canvas.java
index 444a3ce..2c1cc3a 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/framework/Canvas.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/framework/Canvas.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/framework/CanvasRenderer.java b/ardor3d-core/src/main/java/com/ardor3d/framework/CanvasRenderer.java
index 8ec45a9..62f35a2 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/framework/CanvasRenderer.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/framework/CanvasRenderer.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/framework/DisplaySettings.java b/ardor3d-core/src/main/java/com/ardor3d/framework/DisplaySettings.java
index 19aed1c..1df08b1 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/framework/DisplaySettings.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/framework/DisplaySettings.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -11,55 +11,105 @@
package com.ardor3d.framework;
public class DisplaySettings {
+ /** canvas (unrotated) width */
private final int _width;
+ /** canvas (unrotated) height */
private final int _height;
+ /** number of color bits used to represent the color of a single pixel */
private final int _colorDepth;
private final int _frequency;
private final int _alphaBits;
private final int _depthBits;
private final int _stencilBits;
+ /** number of samples used to anti-alias */
private final int _samples;
+ /** true if the canvas should assume exclusive access to the screen */
private final boolean _fullScreen;
+ /** true if the canvas should be rendered stereoscopically (for 3D glasses) */
private final boolean _stereo;
+ /** OpenGL shared canvas renderer, can be null */
private final CanvasRenderer _shareContext;
+ /** rotation in degrees, can be equal to 0, 90, 180 or 270 */
+ private final int _rotation;
/**
- * Convenience method equivalent to <code>DisplaySettings(width, height, 0, 0, 0, 8, 0, 0,
- * false, false, null)</code>
- *
+ * Creates a new <code>DisplaySettings</code> object.
+ *
* @param width
- * the canvas width
+ * the canvas (unrotated) width
* @param height
- * the canvas height
+ * the canvas (unrotated) height
+ * @param colorDepth
+ * the number of color bits used to represent the color of a single pixel
+ * @param frequency
+ * the number of times per second to repaint the canvas
+ * @param alphaBits
+ * the numner of bits used to represent the translucency of a single pixel
* @param depthBits
* the number of bits making up the z-buffer
+ * @param stencilBits
+ * the number of bits making up the stencil buffer
* @param samples
* the number of samples used to anti-alias
+ * @param fullScreen
+ * true if the canvas should assume exclusive access to the screen
+ * @param stereo
+ * true if the canvas should be rendered stereoscopically (for 3D glasses)
+ * @param shareContext
+ * the renderer used to render the canvas (see "ardor3d.useMultipleContexts" property)
+ * @param rotation
+ * the rotation of the first monitor
* @see http://en.wikipedia.org/wiki/Z-buffering
* @see http://en.wikipedia.org/wiki/Multisample_anti-aliasing
+ * @see http://en.wikipedia.org/wiki/Refresh_rate
+ * @see http://en.wikipedia.org/wiki/Alpha_compositing
+ * @see http://en.wikipedia.org/wiki/Stencil_buffer
+ * @see http://en.wikipedia.org/wiki/Stereoscopy
+ * @see http://www.ardor3d.com/forums/viewtopic.php?f=13&t=318&p=2311&hilit=ardor3d.useMultipleContexts#p2311
*/
- public DisplaySettings(final int width, final int height, final int depthBits, final int samples) {
+ public DisplaySettings(final int width, final int height, final int colorDepth, final int frequency,
+ final int alphaBits, final int depthBits, final int stencilBits, final int samples,
+ final boolean fullScreen, final boolean stereo, final CanvasRenderer shareContext, final int rotation) {
+ super();
_width = width;
_height = height;
- _colorDepth = 0;
- _frequency = 0;
- _alphaBits = 0;
+ _colorDepth = colorDepth;
+ _frequency = frequency;
+ _alphaBits = alphaBits;
_depthBits = depthBits;
- _stencilBits = 0;
+ _stencilBits = stencilBits;
_samples = samples;
- _fullScreen = false;
- _stereo = false;
- _shareContext = null;
+ _fullScreen = fullScreen;
+ _stereo = stereo;
+ _shareContext = shareContext;
+ _rotation = rotation;
+ }
+
+ /**
+ * Convenience method
+ *
+ * @param width
+ * the canvas (unrotated) width
+ * @param height
+ * the canvas (unrotated) height
+ * @param depthBits
+ * the number of bits making up the z-buffer
+ * @param samples
+ * the number of samples used to anti-alias
+ * @see http://en.wikipedia.org/wiki/Z-buffering
+ * @see http://en.wikipedia.org/wiki/Multisample_anti-aliasing
+ */
+ public DisplaySettings(final int width, final int height, final int depthBits, final int samples) {
+ this(width, height, 0, 0, 0, depthBits, 0, samples, false, false, null, 0);
}
/**
- * Convenience method equivalent to <code>DisplaySettings(width, height, colorDepth, frequency,
- * 0, 8, 0, 0, fullScreen, false, null)</code>
- *
+ * Convenience method
+ *
* @param width
- * the canvas width
+ * the canvas (unrotated) width
* @param height
- * the canvas height
+ * the canvas (unrotated) height
* @param colorDepth
* the number of color bits used to represent the color of a single pixel
* @param frequency
@@ -70,27 +120,17 @@ public class DisplaySettings {
*/
public DisplaySettings(final int width, final int height, final int colorDepth, final int frequency,
final boolean fullScreen) {
- _width = width;
- _height = height;
- _colorDepth = colorDepth;
- _frequency = frequency;
- _alphaBits = 0;
- _depthBits = 8;
- _stencilBits = 0;
- _samples = 0;
- _fullScreen = fullScreen;
- _stereo = false;
- _shareContext = null;
+ this(width, height, colorDepth, frequency, 0, 8, 0, 0, fullScreen, false, null, 0);
}
/**
- * Convenience method equivalent to <code>DisplaySettings(width, height, colorDepth, frequency,
- * alphaBits, depthBits, stencilBits, samples, fullScreen, stereo, null)</code>
- *
+ * Convenience method equivalent to <code>DisplaySettings(width, height, colorDepth, frequency,
+ * alphaBits, depthBits, stencilBits, samples, fullScreen, stereo, null, 0)</code>
+ *
* @param width
- * the canvas width
+ * the canvas (unrotated) width
* @param height
- * the canvas height
+ * the canvas (unrotated) height
* @param colorDepth
* the number of color bits used to represent the color of a single pixel
* @param frequency
@@ -115,26 +155,17 @@ public class DisplaySettings {
public DisplaySettings(final int width, final int height, final int colorDepth, final int frequency,
final int alphaBits, final int depthBits, final int stencilBits, final int samples,
final boolean fullScreen, final boolean stereo) {
- _width = width;
- _height = height;
- _colorDepth = colorDepth;
- _frequency = frequency;
- _alphaBits = alphaBits;
- _depthBits = depthBits;
- _stencilBits = stencilBits;
- _samples = samples;
- _fullScreen = fullScreen;
- _stereo = stereo;
- _shareContext = null;
+ this(width, height, colorDepth, frequency, alphaBits, depthBits, stencilBits, samples, fullScreen, stereo,
+ null, 0);
}
/**
- * Creates a new <code>DisplaySettings</code> object.
- *
+ * Creates a new <code>DisplaySettings</code> object with no rotation.
+ *
* @param width
- * the canvas width
+ * the canvas (unrotated) width
* @param height
- * the canvas height
+ * the canvas (unrotated) height
* @param colorDepth
* the number of color bits used to represent the color of a single pixel
* @param frequency
@@ -164,17 +195,8 @@ public class DisplaySettings {
public DisplaySettings(final int width, final int height, final int colorDepth, final int frequency,
final int alphaBits, final int depthBits, final int stencilBits, final int samples,
final boolean fullScreen, final boolean stereo, final CanvasRenderer shareContext) {
- _width = width;
- _height = height;
- _colorDepth = colorDepth;
- _frequency = frequency;
- _alphaBits = alphaBits;
- _depthBits = depthBits;
- _stencilBits = stencilBits;
- _samples = samples;
- _fullScreen = fullScreen;
- _stereo = stereo;
- _shareContext = shareContext;
+ this(width, height, colorDepth, frequency, alphaBits, depthBits, stencilBits, samples, fullScreen, stereo,
+ shareContext, 0);
}
public CanvasRenderer getShareContext() {
@@ -221,6 +243,42 @@ public class DisplaySettings {
return _stereo;
}
+ public int getRotation() {
+ return _rotation;
+ }
+
+ public int getRotatedWidth() {
+ switch (_rotation) {
+ case 0:
+ case 180: {
+ return getWidth();
+ }
+ case 90:
+ case 270: {
+ return getHeight();
+ }
+ default:
+ throw new IllegalStateException("The rotation is invalid: " + _rotation
+ + " There is no valid rotated width");
+ }
+ }
+
+ public int getRotatedHeight() {
+ switch (_rotation) {
+ case 0:
+ case 180: {
+ return getHeight();
+ }
+ case 90:
+ case 270: {
+ return getWidth();
+ }
+ default:
+ throw new IllegalStateException("The rotation is invalid: " + _rotation
+ + " There is no valid rotated height");
+ }
+ }
+
@Override
public boolean equals(final Object o) {
if (this == o) {
@@ -234,16 +292,16 @@ public class DisplaySettings {
return _colorDepth == that._colorDepth
&& _frequency == that._frequency
- && _fullScreen != that._fullScreen
- && _height != that._height
- && _width != that._width
- && _alphaBits != that._alphaBits
- && _depthBits != that._depthBits
- && _stencilBits != that._stencilBits
- && _samples != that._samples
- && _stereo != that._stereo
+ && _fullScreen == that._fullScreen
+ && _height == that._height
+ && _width == that._width
+ && _alphaBits == that._alphaBits
+ && _depthBits == that._depthBits
+ && _stencilBits == that._stencilBits
+ && _samples == that._samples
+ && _stereo == that._stereo
&& ((_shareContext == that._shareContext) || (_shareContext != null && _shareContext
- .equals(that._shareContext)));
+ .equals(that._shareContext))) && _rotation == that._rotation;
}
@Override
@@ -260,7 +318,8 @@ public class DisplaySettings {
result = 31 * result + _samples;
result = 31 * result + (_fullScreen ? 1 : 0);
result = 31 * result + (_stereo ? 1 : 0);
- result = 31 * result + (_shareContext != null ? _shareContext.hashCode() : 0);
+ result = 31 * result + (_shareContext == null ? 0 : _shareContext.hashCode());
+ result = 31 * result + _rotation;
return result;
}
}
diff --git a/ardor3d-core/src/main/java/com/ardor3d/framework/FrameHandler.java b/ardor3d-core/src/main/java/com/ardor3d/framework/FrameHandler.java
index c5465cf..67ce66a 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/framework/FrameHandler.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/framework/FrameHandler.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -48,8 +48,8 @@ public final class FrameHandler {
public FrameHandler(final Timer timer) {
_timer = timer;
- _updaters = new CopyOnWriteArrayList<Updater>();
- _canvases = new CopyOnWriteArrayList<Canvas>();
+ _updaters = new CopyOnWriteArrayList<>();
+ _canvases = new CopyOnWriteArrayList<>();
}
@MainThread
diff --git a/ardor3d-core/src/main/java/com/ardor3d/framework/NativeCanvas.java b/ardor3d-core/src/main/java/com/ardor3d/framework/NativeCanvas.java
index 1e912f6..21ef3c7 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/framework/NativeCanvas.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/framework/NativeCanvas.java
@@ -1,9 +1,9 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* 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>.
*/
@@ -21,7 +21,7 @@ public interface NativeCanvas extends Canvas {
/**
* <code>isActive</code> returns true if the display is active.
- *
+ *
* @return whether the display system is active.
*/
boolean isActive();
@@ -29,7 +29,7 @@ public interface NativeCanvas extends Canvas {
/**
* <code>isClosing</code> notifies if the window is currently closing. This could be caused via the application
* itself or external interrupts such as alt-f4 etc.
- *
+ *
* @return true if the window is closing, false otherwise.
*/
boolean isClosing();
@@ -38,7 +38,7 @@ public interface NativeCanvas extends Canvas {
* <code>setVSyncEnabled</code> attempts to enable or disable monitor vertical synchronization. The method is a
* "best attempt" to change the monitor vertical refresh synchronization, and is <b>not </b> guaranteed to be
* successful. This is dependent on OS.
- *
+ *
* @param enabled
* <code>true</code> to synchronize, <code>false</code> to ignore synchronization
*/
@@ -46,7 +46,7 @@ public interface NativeCanvas extends Canvas {
/**
* Sets the title of the display system. This is usually reflected by the renderer as text in the menu bar.
- *
+ *
* @param title
* The new display title.
*/
@@ -66,15 +66,15 @@ public interface NativeCanvas extends Canvas {
* Images should be in format RGBA8888. If they are not ardor3d will try to convert them using ImageUtils. If that
* fails a <code>Ardor3dException</code> could be thrown.
* </p>
- *
+ *
* @param iconImages
* Array of Images to be used as icons.
*/
void setIcon(Image[] iconImages);
/**
- * If running in windowed mode, move the window's position to the given display coordinates.
- *
+ * If running in windowed mode, move the window's position to the given display coordinates in window units.
+ *
* @param locX
* @param locY
*/
diff --git a/ardor3d-core/src/main/java/com/ardor3d/framework/Scene.java b/ardor3d-core/src/main/java/com/ardor3d/framework/Scene.java
index ba31d74..3e21e73 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/framework/Scene.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/framework/Scene.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/framework/Updater.java b/ardor3d-core/src/main/java/com/ardor3d/framework/Updater.java
index 5789ac0..1f1df22 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/framework/Updater.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/framework/Updater.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/image/Image.java b/ardor3d-core/src/main/java/com/ardor3d/image/Image.java
index 28765af..b7e2783 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/image/Image.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/image/Image.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -20,7 +20,6 @@ import java.util.List;
import com.ardor3d.util.export.InputCapsule;
import com.ardor3d.util.export.OutputCapsule;
import com.ardor3d.util.export.Savable;
-import com.google.common.collect.Lists;
/**
* <code>Image</code> defines a data format for a graphical image. The image is defined by a format, a height and width,
@@ -43,7 +42,7 @@ public class Image implements Serializable, Savable {
* Constructor instantiates a new <code>Image</code> object. All values are undefined.
*/
public Image() {
- _data = new ArrayList<ByteBuffer>(1);
+ _data = new ArrayList<>(1);
}
/**
@@ -98,7 +97,7 @@ public class Image implements Serializable, Savable {
*/
public Image(final ImageDataFormat format, final PixelDataType type, final int width, final int height,
final ByteBuffer data, final int[] mipMapSizes) {
- this(format, type, width, height, Lists.newArrayList(data), mipMapSizes);
+ this(format, type, width, height, new ArrayList<>(Arrays.asList(data)), mipMapSizes);
}
/**
@@ -123,7 +122,7 @@ public class Image implements Serializable, Savable {
* the data that contains the image information.
*/
public void setData(final ByteBuffer data) {
- _data = Lists.newArrayList(data);
+ _data = new ArrayList<>(Arrays.asList(data));
}
/**
@@ -134,7 +133,7 @@ public class Image implements Serializable, Savable {
*/
public void addData(final ByteBuffer data) {
if (_data == null) {
- _data = new ArrayList<ByteBuffer>(1);
+ _data = new ArrayList<>(1);
}
_data.add(data);
}
@@ -351,6 +350,7 @@ public class Image implements Serializable, Savable {
return true;
}
+ @Override
public void write(final OutputCapsule capsule) throws IOException {
capsule.write(_format, "dataformat", ImageDataFormat.RGBA);
capsule.write(_type, "datatype", PixelDataType.UnsignedByte);
@@ -361,6 +361,7 @@ public class Image implements Serializable, Savable {
capsule.writeByteBufferList(_data, "data", null);
}
+ @Override
public void read(final InputCapsule capsule) throws IOException {
_format = capsule.readEnum("dataformat", ImageDataFormat.class, ImageDataFormat.RGBA);
_type = capsule.readEnum("datatype", PixelDataType.class, PixelDataType.UnsignedByte);
@@ -371,6 +372,7 @@ public class Image implements Serializable, Savable {
_data = capsule.readByteBufferList("data", null);
}
+ @Override
public Class<? extends Image> getClassTag() {
return this.getClass();
}
diff --git a/ardor3d-core/src/main/java/com/ardor3d/image/ImageDataFormat.java b/ardor3d-core/src/main/java/com/ardor3d/image/ImageDataFormat.java
index e1f8c7c..20232bd 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/image/ImageDataFormat.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/image/ImageDataFormat.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/image/PixelDataType.java b/ardor3d-core/src/main/java/com/ardor3d/image/PixelDataType.java
index c465d4b..537931c 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/image/PixelDataType.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/image/PixelDataType.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/image/Texture.java b/ardor3d-core/src/main/java/com/ardor3d/image/Texture.java
index add9847..241b16a 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/image/Texture.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/image/Texture.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -1409,6 +1409,7 @@ public abstract class Texture implements Savable {
_texMatrix.set(matrix);
}
+ @Override
public void write(final OutputCapsule capsule) throws IOException {
if (_storeImage) {
capsule.write(_image, "image", null);
@@ -1448,6 +1449,7 @@ public abstract class Texture implements Savable {
capsule.write(_key, "textureKey", null);
}
+ @Override
public void read(final InputCapsule capsule) throws IOException {
_minificationFilter = capsule.readEnum("minificationFilter", MinificationFilter.class,
MinificationFilter.NearestNeighborNoMipMaps);
@@ -1506,6 +1508,7 @@ public abstract class Texture implements Savable {
_rttPixelDataType = capsule.readEnum("rttPixelDataType", PixelDataType.class, PixelDataType.UnsignedByte);
}
+ @Override
public Class<? extends Texture> getClassTag() {
return this.getClass();
}
diff --git a/ardor3d-core/src/main/java/com/ardor3d/image/Texture1D.java b/ardor3d-core/src/main/java/com/ardor3d/image/Texture1D.java
index 5ba42cd..14a0047 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/image/Texture1D.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/image/Texture1D.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/image/Texture2D.java b/ardor3d-core/src/main/java/com/ardor3d/image/Texture2D.java
index dc54a94..ddd01ba 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/image/Texture2D.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/image/Texture2D.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/image/Texture3D.java b/ardor3d-core/src/main/java/com/ardor3d/image/Texture3D.java
index 8258e5e..bbd240e 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/image/Texture3D.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/image/Texture3D.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/image/TextureCubeMap.java b/ardor3d-core/src/main/java/com/ardor3d/image/TextureCubeMap.java
index 0253976..c0e99e2 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/image/TextureCubeMap.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/image/TextureCubeMap.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/image/TextureStoreFormat.java b/ardor3d-core/src/main/java/com/ardor3d/image/TextureStoreFormat.java
index fab3b58..4d3f8e5 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/image/TextureStoreFormat.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/image/TextureStoreFormat.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/image/util/AbiLoader.java b/ardor3d-core/src/main/java/com/ardor3d/image/util/AbiLoader.java
index b69ffa8..8011dad 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/image/util/AbiLoader.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/image/util/AbiLoader.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -33,6 +33,7 @@ public final class AbiLoader implements ImageLoader {
* @throws IOException
* if an error occurs during read.
*/
+ @Override
public Image load(final InputStream is, final boolean flip) throws IOException {
return (Image) new BinaryImporter().load(is);
}
diff --git a/ardor3d-core/src/main/java/com/ardor3d/image/util/ColorMipMapGenerator.java b/ardor3d-core/src/main/java/com/ardor3d/image/util/ColorMipMapGenerator.java
index 5035392..f02a8d1 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/image/util/ColorMipMapGenerator.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/image/util/ColorMipMapGenerator.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/image/util/GeneratedImageFactory.java b/ardor3d-core/src/main/java/com/ardor3d/image/util/GeneratedImageFactory.java
index 6316b57..1d03d01 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/image/util/GeneratedImageFactory.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/image/util/GeneratedImageFactory.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -144,7 +144,7 @@ public abstract class GeneratedImageFactory {
double val;
final double rangeDiv = 1.0 / (rangeEnd - rangeStart);
// prepare list of image slices.
- final List<ByteBuffer> dataList = new ArrayList<ByteBuffer>(depth);
+ final List<ByteBuffer> dataList = new ArrayList<>(depth);
final byte[] data = new byte[width * height];
for (double z = 0; z < depth; z++) {
@@ -199,7 +199,7 @@ public abstract class GeneratedImageFactory {
final ReadOnlyColorRGBA... colorTable) {
assert (colorTable.length == 256) : "color table must be size 256.";
- final List<ByteBuffer> dataList = new ArrayList<ByteBuffer>(lumImage.getDepth());
+ final List<ByteBuffer> dataList = new ArrayList<>(lumImage.getDepth());
ReadOnlyColorRGBA c;
for (int i = 0; i < lumImage.getDepth(); i++) {
final ByteBuffer src = lumImage.getData(i);
diff --git a/ardor3d-core/src/main/java/com/ardor3d/image/util/ImageLoader.java b/ardor3d-core/src/main/java/com/ardor3d/image/util/ImageLoader.java
index 4a5bd94..e179341 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/image/util/ImageLoader.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/image/util/ImageLoader.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/image/util/ImageLoaderUtil.java b/ardor3d-core/src/main/java/com/ardor3d/image/util/ImageLoaderUtil.java
index b12475a..197ae45 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/image/util/ImageLoaderUtil.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/image/util/ImageLoaderUtil.java
@@ -1,9 +1,9 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* 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>.
*/
@@ -47,21 +47,12 @@ public abstract class ImageLoaderUtil {
return TextureState.getDefaultTextureImage();
}
- InputStream is = null;
- try {
- is = src.openStream();
+ try (final InputStream is = src.openStream()) {
logger.log(Level.FINER, "loadImage(ResourceSource, boolean) opened stream: {0}", src);
return loadImage(type, is, flipped);
} catch (final IOException e) {
logger.log(Level.WARNING, "loadImage(ResourceSource, boolean): defaultTexture used", e);
return TextureState.getDefaultTextureImage();
- } finally {
- if (is != null) {
- try {
- is.close();
- } catch (final IOException ioe) {
- } // ignore
- }
}
}
@@ -69,7 +60,7 @@ public abstract class ImageLoaderUtil {
Image imageData = null;
try {
- ImageLoader loader = loaders.get(type.toLowerCase());
+ ImageLoader loader = type == null ? null : loaders.get(type.toLowerCase());
if (loader == null) {
loader = defaultLoader;
}
@@ -92,7 +83,7 @@ public abstract class ImageLoaderUtil {
/**
* Register an ImageLoader to handle all files with a specific type. An ImageLoader can be registered to handle
* several formats without problems.
- *
+ *
* @param handler
* the handler to use
* @param types
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 c674d85..55f9d75 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
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -10,10 +10,13 @@
package com.ardor3d.image.util;
+import java.nio.ByteBuffer;
+
import com.ardor3d.image.Image;
import com.ardor3d.image.ImageDataFormat;
import com.ardor3d.image.PixelDataType;
import com.ardor3d.image.TextureStoreFormat;
+import com.ardor3d.math.ColorRGBA;
public abstract class ImageUtils {
@@ -22,7 +25,8 @@ public abstract class ImageUtils {
}
public static final TextureStoreFormat getTextureStoreFormat(final TextureStoreFormat format, final Image image) {
- if (format != TextureStoreFormat.GuessCompressedFormat && format != TextureStoreFormat.GuessNoCompressedFormat) {
+ if (format != TextureStoreFormat.GuessCompressedFormat
+ && format != TextureStoreFormat.GuessNoCompressedFormat) {
return format;
}
if (image == null) {
@@ -224,4 +228,223 @@ public abstract class ImageUtils {
throw new Error("Unhandled type / format combination: " + type + " / " + dataFormat);
}
+
+ public static ColorRGBA getRGBA(final Image img, final int x, final int y, final ColorRGBA store) {
+ return getRGBA(img, 0, x, y, store);
+ }
+
+ public static ColorRGBA getRGBA(final Image img, final int index, final int x, final int y, final ColorRGBA store) {
+ final ColorRGBA result = store == null ? new ColorRGBA() : store;
+ final int rgba = getRGBA(img, index, x, y);
+ return (result.fromIntRGBA(rgba));
+ }
+
+ public static int getARGB(final Image img, final int x, final int y) {
+ return getARGB(img, 0, x, y);
+ }
+
+ public static int getARGB(final Image img, final int index, final int x, final int y) {
+ final ByteBuffer imgData = img.getData(index);
+ final int bytesPerPixel = ImageUtils.getPixelByteSize(img.getDataFormat(), img.getDataType());
+ final int dataIndex = bytesPerPixel * (x + (y * img.getWidth()));
+ final int argb;
+ switch (img.getDataFormat()) {
+ case Alpha:
+ argb = ((imgData.get(dataIndex) & 0xFF) << 24);
+ break;
+ case Red:
+ argb = (0xFF << 24) | ((imgData.get(dataIndex) & 0xFF) << 16);
+ break;
+ case Green:
+ argb = (0xFF << 24) | ((imgData.get(dataIndex) & 0xFF) << 8);
+ break;
+ case Blue:
+ argb = (0xFF << 24) | (imgData.get(dataIndex) & 0xFF);
+ break;
+ case RG:
+ argb = (0xFF << 24) | ((imgData.get(dataIndex) & 0xFF) << 16)
+ | ((imgData.get(dataIndex + 1) & 0xFF) << 8) | (0x00);
+ break;
+ case RGB:
+ argb = (0xFF << 24) | ((imgData.get(dataIndex) & 0xFF) << 16)
+ | ((imgData.get(dataIndex + 1) & 0xFF) << 8) | (imgData.get(dataIndex + 2) & 0xFF);
+ break;
+ case BGR:
+ argb = (0xFF << 24) | ((imgData.get(dataIndex + 2) & 0xFF) << 16)
+ | ((imgData.get(dataIndex + 1) & 0xFF) << 8) | (imgData.get(dataIndex) & 0xFF);
+ break;
+ case RGBA:
+ argb = ((imgData.get(dataIndex + 3) & 0xFF) << 24) | ((imgData.get(dataIndex) & 0xFF) << 16)
+ | ((imgData.get(dataIndex + 1) & 0xFF) << 8) | (imgData.get(dataIndex + 2) & 0xFF);
+ break;
+ case BGRA:
+ argb = ((imgData.get(dataIndex + 3) & 0xFF) << 24) | ((imgData.get(dataIndex + 2) & 0xFF) << 16)
+ | ((imgData.get(dataIndex + 1) & 0xFF) << 8) | (imgData.get(dataIndex) & 0xFF);
+ break;
+ default:
+ throw new UnsupportedOperationException("Image data format " + img.getDataFormat() + " not supported!");
+ }
+ return (argb);
+ }
+
+ public static int getRGBA(final Image img, final int x, final int y) {
+ return getRGBA(img, 0, x, y);
+ }
+
+ public static int getRGBA(final Image img, final int index, final int x, final int y) {
+ final ByteBuffer imgData = img.getData(index);
+ final int bytesPerPixel = ImageUtils.getPixelByteSize(img.getDataFormat(), img.getDataType());
+ final int dataIndex = bytesPerPixel * (x + (y * img.getWidth()));
+ final int rgba;
+ switch (img.getDataFormat()) {
+ case Alpha:
+ rgba = (imgData.get(dataIndex) & 0xFF);
+ break;
+ case Red:
+ rgba = (0xFF << 24) | ((imgData.get(dataIndex) & 0xFF) << 24);
+ break;
+ case Green:
+ rgba = (0xFF << 24) | ((imgData.get(dataIndex) & 0xFF) << 16);
+ break;
+ case Blue:
+ rgba = (0xFF << 24) | (imgData.get(dataIndex) & 0xFF << 8);
+ break;
+ case RG:
+ rgba = ((imgData.get(dataIndex) & 0xFF) << 24) | ((imgData.get(dataIndex + 1) & 0xFF) << 16)
+ | (0x00 << 8) | (0xFF);
+ break;
+ case RGB:
+ rgba = ((imgData.get(dataIndex) & 0xFF) << 24) | ((imgData.get(dataIndex + 1) & 0xFF) << 16)
+ | ((imgData.get(dataIndex + 2) & 0xFF) << 8) | (0xFF);
+ break;
+ case BGR:
+ rgba = ((imgData.get(dataIndex + 2) & 0xFF) << 24) | ((imgData.get(dataIndex + 1) & 0xFF) << 16)
+ | ((imgData.get(dataIndex) & 0xFF) << 8) | (0xFF);
+ break;
+ case RGBA:
+ rgba = ((imgData.get(dataIndex) & 0xFF) << 24) | ((imgData.get(dataIndex + 1) & 0xFF) << 16)
+ | ((imgData.get(dataIndex + 2) & 0xFF) << 8) | (imgData.get(dataIndex + 3) & 0xFF);
+ break;
+ case BGRA:
+ rgba = ((imgData.get(dataIndex + 2) & 0xFF) << 24) | ((imgData.get(dataIndex + 1) & 0xFF) << 16)
+ | ((imgData.get(dataIndex) & 0xFF) << 8) | (imgData.get(dataIndex + 3) & 0xFF);
+ break;
+ default:
+ throw new UnsupportedOperationException("Image data format " + img.getDataFormat() + " not supported!");
+ }
+ return (rgba);
+ }
+
+ public static void setARGB(final Image img, final int x, final int y, final int argb) {
+ setARGB(img, 0, x, y, argb);
+ }
+
+ public static void setARGB(final Image img, final int index, final int x, final int y, final int argb) {
+ final ByteBuffer imgData = img.getData(index);
+ final int bytesPerPixel = ImageUtils.getPixelByteSize(img.getDataFormat(), img.getDataType());
+ final int dataIndex = bytesPerPixel * (x + (y * img.getWidth()));
+ switch (img.getDataFormat()) {
+ case Alpha:
+ imgData.put(dataIndex, (byte) ((argb >> 24) & 0xFF));
+ break;
+ case Red:
+ imgData.put(dataIndex, (byte) ((argb >> 16) & 0xFF));
+ break;
+ case Green:
+ imgData.put(dataIndex, (byte) ((argb >> 8) & 0xFF));
+ break;
+ case Blue:
+ imgData.put(dataIndex, (byte) (argb & 0xFF));
+ break;
+ case RG:
+ imgData.put(dataIndex, (byte) ((argb >> 16) & 0xFF));
+ imgData.put(dataIndex + 1, (byte) ((argb >> 8) & 0xFF));
+ break;
+ case RGB:
+ imgData.put(dataIndex, (byte) ((argb >> 16) & 0xFF));
+ imgData.put(dataIndex + 1, (byte) ((argb >> 8) & 0xFF));
+ imgData.put(dataIndex + 2, (byte) (argb & 0xFF));
+ break;
+ case BGR:
+ imgData.put(dataIndex + 2, (byte) ((argb >> 16) & 0xFF));
+ imgData.put(dataIndex + 1, (byte) ((argb >> 8) & 0xFF));
+ imgData.put(dataIndex, (byte) (argb & 0xFF));
+ break;
+ case RGBA:
+ imgData.put(dataIndex, (byte) ((argb >> 16) & 0xFF));
+ imgData.put(dataIndex + 1, (byte) ((argb >> 8) & 0xFF));
+ imgData.put(dataIndex + 2, (byte) (argb & 0xFF));
+ imgData.put(dataIndex + 3, (byte) ((argb >> 24) & 0xFF));
+ break;
+ case BGRA:
+ imgData.put(dataIndex + 2, (byte) ((argb >> 16) & 0xFF));
+ imgData.put(dataIndex + 1, (byte) ((argb >> 8) & 0xFF));
+ imgData.put(dataIndex, (byte) (argb & 0xFF));
+ imgData.put(dataIndex + 3, (byte) ((argb >> 24) & 0xFF));
+ break;
+ default:
+ throw new UnsupportedOperationException("Image data format " + img.getDataFormat() + " not supported!");
+ }
+ }
+
+ public static void setRGBA(final Image img, final int x, final int y, final ColorRGBA color) {
+ setRGBA(img, 0, x, y, color);
+ }
+
+ public static void setRGBA(final Image img, final int index, final int x, final int y, final ColorRGBA color) {
+ final int rgba = color.asIntRGBA();
+ setRGBA(img, index, x, y, rgba);
+ }
+
+ public static void setRGBA(final Image img, final int x, final int y, final int rgba) {
+ setRGBA(img, 0, x, y, rgba);
+ }
+
+ public static void setRGBA(final Image img, final int index, final int x, final int y, final int rgba) {
+ final ByteBuffer imgData = img.getData(index);
+ final int bytesPerPixel = ImageUtils.getPixelByteSize(img.getDataFormat(), img.getDataType());
+ final int dataIndex = bytesPerPixel * (x + (y * img.getWidth()));
+ switch (img.getDataFormat()) {
+ case Alpha:
+ imgData.put(dataIndex, (byte) ((rgba) & 0xFF));
+ break;
+ case Red:
+ imgData.put(dataIndex, (byte) ((rgba >> 24) & 0xFF));
+ break;
+ case Green:
+ imgData.put(dataIndex, (byte) ((rgba >> 16) & 0xFF));
+ break;
+ case Blue:
+ imgData.put(dataIndex, (byte) ((rgba >> 8) & 0xFF));
+ break;
+ case RG:
+ imgData.put(dataIndex, (byte) ((rgba >> 24) & 0xFF));
+ imgData.put(dataIndex + 1, (byte) ((rgba >> 16) & 0xFF));
+ break;
+ case RGB:
+ imgData.put(dataIndex, (byte) ((rgba >> 24) & 0xFF));
+ imgData.put(dataIndex + 1, (byte) ((rgba >> 16) & 0xFF));
+ imgData.put(dataIndex + 2, (byte) ((rgba >> 8) & 0xFF));
+ break;
+ case BGR:
+ imgData.put(dataIndex + 2, (byte) ((rgba >> 24) & 0xFF));
+ imgData.put(dataIndex + 1, (byte) ((rgba >> 16) & 0xFF));
+ imgData.put(dataIndex, (byte) ((rgba >> 8) & 0xFF));
+ break;
+ case RGBA:
+ imgData.put(dataIndex, (byte) ((rgba >> 24) & 0xFF));
+ imgData.put(dataIndex + 1, (byte) ((rgba >> 16) & 0xFF));
+ imgData.put(dataIndex + 2, (byte) ((rgba >> 8) & 0xFF));
+ imgData.put(dataIndex + 3, (byte) (rgba & 0xFF));
+ break;
+ case BGRA:
+ imgData.put(dataIndex + 2, (byte) ((rgba >> 24) & 0xFF));
+ imgData.put(dataIndex + 1, (byte) ((rgba >> 16) & 0xFF));
+ imgData.put(dataIndex, (byte) ((rgba >> 8) & 0xFF));
+ imgData.put(dataIndex + 3, (byte) (rgba & 0xFF));
+ break;
+ default:
+ throw new UnsupportedOperationException("Image data format " + img.getDataFormat() + " not supported!");
+ }
+ }
}
diff --git a/ardor3d-core/src/main/java/com/ardor3d/image/util/TextureProjector.java b/ardor3d-core/src/main/java/com/ardor3d/image/util/TextureProjector.java
index b166cca..aaff340 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/image/util/TextureProjector.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/image/util/TextureProjector.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/image/util/TgaLoader.java b/ardor3d-core/src/main/java/com/ardor3d/image/util/TgaLoader.java
index 8068501..dddb9bf 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/image/util/TgaLoader.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/image/util/TgaLoader.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -63,6 +63,7 @@ public final class TgaLoader implements ImageLoader {
* @throws IOException
* if an error occurs during read.
*/
+ @Override
public Image load(final InputStream is, boolean flip) throws IOException {
boolean flipH = false;
// open a stream to the file
@@ -377,49 +378,51 @@ public final class TgaLoader implements ImageLoader {
}
} else if (imageType == TYPE_COLORMAPPED) {
- final int bytesPerIndex = pixelDepth / 8;
+ if (cMapEntries != null) {
+ final int bytesPerIndex = pixelDepth / 8;
- if (bytesPerIndex == 1) {
- for (int i = 0; i <= (height - 1); i++) {
- if (!flip) {
- rawDataIndex = (height - 1 - i) * width * dl;
- }
- for (int j = 0; j < width; j++) {
- final int index = dis.readUnsignedByte();
- if (index >= cMapEntries.length || index < 0) {
- throw new Ardor3dException("TGA: Invalid color map entry referenced: " + index);
- }
- final ColorMapEntry entry = cMapEntries[index];
- rawData[rawDataIndex++] = entry.red;
- rawData[rawDataIndex++] = entry.green;
- rawData[rawDataIndex++] = entry.blue;
- if (dl == 4) {
- rawData[rawDataIndex++] = entry.alpha;
+ if (bytesPerIndex == 1) {
+ for (int i = 0; i <= (height - 1); i++) {
+ if (!flip) {
+ rawDataIndex = (height - 1 - i) * width * dl;
}
+ for (int j = 0; j < width; j++) {
+ final int index = dis.readUnsignedByte();
+ if (index >= cMapEntries.length || index < 0) {
+ throw new Ardor3dException("TGA: Invalid color map entry referenced: " + index);
+ }
+ final ColorMapEntry entry = cMapEntries[index];
+ rawData[rawDataIndex++] = entry.red;
+ rawData[rawDataIndex++] = entry.green;
+ rawData[rawDataIndex++] = entry.blue;
+ if (dl == 4) {
+ rawData[rawDataIndex++] = entry.alpha;
+ }
+ }
}
- }
- } else if (bytesPerIndex == 2) {
- for (int i = 0; i <= (height - 1); i++) {
- if (!flip) {
- rawDataIndex = (height - 1 - i) * width * dl;
- }
- for (int j = 0; j < width; j++) {
- final int index = flipEndian(dis.readShort());
- if (index >= cMapEntries.length || index < 0) {
- throw new Ardor3dException("TGA: Invalid color map entry referenced: " + index);
+ } else if (bytesPerIndex == 2) {
+ for (int i = 0; i <= (height - 1); i++) {
+ if (!flip) {
+ rawDataIndex = (height - 1 - i) * width * dl;
}
- final ColorMapEntry entry = cMapEntries[index];
- rawData[rawDataIndex++] = entry.red;
- rawData[rawDataIndex++] = entry.green;
- rawData[rawDataIndex++] = entry.blue;
- if (dl == 4) {
- rawData[rawDataIndex++] = entry.alpha;
+ for (int j = 0; j < width; j++) {
+ final int index = flipEndian(dis.readShort());
+ if (index >= cMapEntries.length || index < 0) {
+ throw new Ardor3dException("TGA: Invalid color map entry referenced: " + index);
+ }
+ final ColorMapEntry entry = cMapEntries[index];
+ rawData[rawDataIndex++] = entry.red;
+ rawData[rawDataIndex++] = entry.green;
+ rawData[rawDataIndex++] = entry.blue;
+ if (dl == 4) {
+ rawData[rawDataIndex++] = entry.alpha;
+ }
}
}
+ } else {
+ throw new Ardor3dException("TGA: unknown colormap indexing size used: " + bytesPerIndex);
}
- } else {
- throw new Ardor3dException("TGA: unknown colormap indexing size used: " + bytesPerIndex);
}
}
diff --git a/ardor3d-core/src/main/java/com/ardor3d/image/util/dds/D3d10ResourceDimension.java b/ardor3d-core/src/main/java/com/ardor3d/image/util/dds/D3d10ResourceDimension.java
index b777d12..e4d75fe 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/image/util/dds/D3d10ResourceDimension.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/image/util/dds/D3d10ResourceDimension.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/image/util/dds/DdsHeader.java b/ardor3d-core/src/main/java/com/ardor3d/image/util/dds/DdsHeader.java
index e624f2f..00afd41 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/image/util/dds/DdsHeader.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/image/util/dds/DdsHeader.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/image/util/dds/DdsHeaderDX10.java b/ardor3d-core/src/main/java/com/ardor3d/image/util/dds/DdsHeaderDX10.java
index 7ef5c62..400b5ad 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/image/util/dds/DdsHeaderDX10.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/image/util/dds/DdsHeaderDX10.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/image/util/dds/DdsLoader.java b/ardor3d-core/src/main/java/com/ardor3d/image/util/dds/DdsLoader.java
index 8d551ac..48f7ce1 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/image/util/dds/DdsLoader.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/image/util/dds/DdsLoader.java
@@ -1,9 +1,9 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* 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>.
*/
@@ -18,6 +18,7 @@ import static com.ardor3d.image.util.dds.DdsUtils.shiftCount;
import java.io.IOException;
import java.io.InputStream;
import java.nio.ByteBuffer;
+import java.util.ArrayList;
import java.util.List;
import java.util.logging.Logger;
@@ -28,7 +29,6 @@ import com.ardor3d.image.util.ImageLoader;
import com.ardor3d.image.util.ImageUtils;
import com.ardor3d.util.LittleEndianDataInput;
import com.ardor3d.util.geom.BufferUtils;
-import com.google.common.collect.Lists;
/**
* <p>
@@ -56,40 +56,42 @@ import com.google.common.collect.Lists;
public class DdsLoader implements ImageLoader {
private static final Logger logger = Logger.getLogger(DdsLoader.class.getName());
+ @Override
public Image load(final InputStream is, final boolean flipVertically) throws IOException {
- final LittleEndianDataInput in = new LittleEndianDataInput(is);
+ try (final LittleEndianDataInput in = new LittleEndianDataInput(is)) {
- // Read and check magic word...
- final int dwMagic = in.readInt();
- if (dwMagic != getInt("DDS ")) {
- throw new Error("Not a dds file.");
- }
- logger.finest("Reading DDS file.");
+ // Read and check magic word...
+ final int dwMagic = in.readInt();
+ if (dwMagic != getInt("DDS ")) {
+ throw new Error("Not a dds file.");
+ }
+ logger.finest("Reading DDS file.");
- // Create our data store;
- final DdsImageInfo info = new DdsImageInfo();
+ // Create our data store;
+ final DdsImageInfo info = new DdsImageInfo();
- info.flipVertically = flipVertically;
+ info.flipVertically = flipVertically;
- // Read standard dds header
- info.header = DdsHeader.read(in);
+ // Read standard dds header
+ info.header = DdsHeader.read(in);
- // if applicable, read DX10 header
- info.headerDX10 = info.header.ddpf.dwFourCC == getInt("DX10") ? DdsHeaderDX10.read(in) : null;
+ // if applicable, read DX10 header
+ info.headerDX10 = info.header.ddpf.dwFourCC == getInt("DX10") ? DdsHeaderDX10.read(in) : null;
- // Create our new image
- final Image image = new Image();
- image.setWidth(info.header.dwWidth);
- image.setHeight(info.header.dwHeight);
+ // Create our new image
+ final Image image = new Image();
+ image.setWidth(info.header.dwWidth);
+ image.setHeight(info.header.dwHeight);
- // update depth based on flags / header
- updateDepth(image, info);
+ // update depth based on flags / header
+ updateDepth(image, info);
- // add our format and image data.
- populateImage(image, info, in);
+ // add our format and image data.
+ populateImage(image, info, in);
- // return the loaded image
- return image;
+ // return the loaded image
+ return image;
+ }
}
private static final void updateDepth(final Image image, final DdsImageInfo info) {
@@ -253,7 +255,7 @@ public class DdsLoader implements ImageLoader {
}
// Go through and load in image data
- final List<ByteBuffer> imageData = Lists.newArrayList();
+ final List<ByteBuffer> imageData = new ArrayList<>();
for (int i = 0; i < image.getDepth(); i++) {
// read in compressed data
if (compressedFormat) {
diff --git a/ardor3d-core/src/main/java/com/ardor3d/image/util/dds/DdsPixelFormat.java b/ardor3d-core/src/main/java/com/ardor3d/image/util/dds/DdsPixelFormat.java
index 71ee4b0..843ba3a 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/image/util/dds/DdsPixelFormat.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/image/util/dds/DdsPixelFormat.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
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 0cfff85..373adbb 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
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/image/util/dds/DxgiFormat.java b/ardor3d-core/src/main/java/com/ardor3d/image/util/dds/DxgiFormat.java
index 3c99126..13306e6 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/image/util/dds/DxgiFormat.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/image/util/dds/DxgiFormat.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/ButtonState.java b/ardor3d-core/src/main/java/com/ardor3d/input/ButtonState.java
index 9699db2..f2fa597 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/input/ButtonState.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/input/ButtonState.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/ControllerEvent.java b/ardor3d-core/src/main/java/com/ardor3d/input/ControllerEvent.java
index c257b32..ec429f3 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/input/ControllerEvent.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/input/ControllerEvent.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/ControllerInfo.java b/ardor3d-core/src/main/java/com/ardor3d/input/ControllerInfo.java
index a7e7c92..f8298c6 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/input/ControllerInfo.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/input/ControllerInfo.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -13,8 +13,6 @@ package com.ardor3d.input;
import java.util.ArrayList;
import java.util.List;
-import com.google.common.collect.Lists;
-
public class ControllerInfo {
private final String _controllerName;
@@ -23,8 +21,8 @@ public class ControllerInfo {
public ControllerInfo(final String controllerName, final List<String> axisNames, final List<String> buttonNames) {
_controllerName = controllerName;
- _axisNames = Lists.newArrayList(axisNames);
- _buttonNames = Lists.newArrayList(buttonNames);
+ _axisNames = new ArrayList<>(axisNames);
+ _buttonNames = new ArrayList<>(buttonNames);
}
public String getControllerName() {
diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/ControllerState.java b/ardor3d-core/src/main/java/com/ardor3d/input/ControllerState.java
index 15d3106..da1c7fe 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/input/ControllerState.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/input/ControllerState.java
@@ -1,9 +1,9 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* 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>.
*/
@@ -17,18 +17,17 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
+import java.util.Objects;
import com.ardor3d.annotation.Immutable;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
@Immutable
public class ControllerState {
public static final ControllerState NOTHING = new ControllerState(0);
- protected final Map<String, Map<String, Float>> _controllerStates = Maps.newLinkedHashMap();
- protected final List<ControllerEvent> _eventsSinceLastState = Lists.newArrayList();
+ protected final Map<String, Map<String, Float>> _controllerStates = new LinkedHashMap<>();
+ protected final List<ControllerEvent> _eventsSinceLastState = new ArrayList<>();
protected ControllerState(final int ignore) {}
@@ -52,7 +51,7 @@ public class ControllerState {
if (_controllerStates.containsKey(controllerName)) {
controllerState = _controllerStates.get(controllerName);
} else {
- controllerState = new LinkedHashMap<String, Float>();
+ controllerState = new LinkedHashMap<>();
_controllerStates.put(controllerName, controllerState);
}
@@ -70,6 +69,11 @@ public class ControllerState {
}
@Override
+ public int hashCode() {
+ return Objects.hashCode(_controllerStates);
+ }
+
+ @Override
public String toString() {
final StringBuilder stateString = new StringBuilder("ControllerState: ");
@@ -96,7 +100,7 @@ public class ControllerState {
private void duplicateStates(final Map<String, Map<String, Float>> store) {
store.clear();
for (final Entry<String, Map<String, Float>> entry : _controllerStates.entrySet()) {
- store.put(entry.getKey(), Maps.newLinkedHashMap(entry.getValue()));
+ store.put(entry.getKey(), new LinkedHashMap<>(entry.getValue()));
}
}
@@ -107,6 +111,7 @@ public class ControllerState {
public List<ControllerEvent> getEvents() {
Collections.sort(_eventsSinceLastState, new Comparator<ControllerEvent>() {
+ @Override
public int compare(final ControllerEvent o1, final ControllerEvent o2) {
return (int) (o2.getNanos() - o1.getNanos());
}
@@ -120,11 +125,11 @@ public class ControllerState {
}
public List<String> getControllerNames() {
- return new ArrayList<String>(_controllerStates.keySet());
+ return new ArrayList<>(_controllerStates.keySet());
}
public List<String> getControllerComponentNames(final String controller) {
- return new ArrayList<String>(_controllerStates.get(controller).keySet());
+ return new ArrayList<>(_controllerStates.get(controller).keySet());
}
public Map<String, Float> getControllerComponentValues(final String controller) {
diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/ControllerWrapper.java b/ardor3d-core/src/main/java/com/ardor3d/input/ControllerWrapper.java
index ab4a408..4b2ee59 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/input/ControllerWrapper.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/input/ControllerWrapper.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/FocusWrapper.java b/ardor3d-core/src/main/java/com/ardor3d/input/FocusWrapper.java
index a0db729..975445b 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/input/FocusWrapper.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/input/FocusWrapper.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/GrabbedState.java b/ardor3d-core/src/main/java/com/ardor3d/input/GrabbedState.java
index 9a3716b..3c34eb7 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/input/GrabbedState.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/input/GrabbedState.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/InputState.java b/ardor3d-core/src/main/java/com/ardor3d/input/InputState.java
index 2b8e33e..263d4a3 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/input/InputState.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/input/InputState.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/Key.java b/ardor3d-core/src/main/java/com/ardor3d/input/Key.java
index d9a2c28..73aaa90 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/input/Key.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/input/Key.java
@@ -1,5 +1,5 @@
/**
- * Copyright 2008-2012 Ardor Labs, Inc.
+ * Copyright 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/KeyEvent.java b/ardor3d-core/src/main/java/com/ardor3d/input/KeyEvent.java
index 3a13675..a2a49d8 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/input/KeyEvent.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/input/KeyEvent.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/KeyNotFoundException.java b/ardor3d-core/src/main/java/com/ardor3d/input/KeyNotFoundException.java
index 7a0383c..a65d038 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/input/KeyNotFoundException.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/input/KeyNotFoundException.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/KeyState.java b/ardor3d-core/src/main/java/com/ardor3d/input/KeyState.java
index ffdac8c..f12a848 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/input/KeyState.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/input/KeyState.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/KeyboardState.java b/ardor3d-core/src/main/java/com/ardor3d/input/KeyboardState.java
index d5f73bb..35fe07d 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/input/KeyboardState.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/input/KeyboardState.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/KeyboardWrapper.java b/ardor3d-core/src/main/java/com/ardor3d/input/KeyboardWrapper.java
index 4d0d64b..1ccc49a 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/input/KeyboardWrapper.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/input/KeyboardWrapper.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/MouseButton.java b/ardor3d-core/src/main/java/com/ardor3d/input/MouseButton.java
index 6d2e378..ab09893 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/input/MouseButton.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/input/MouseButton.java
@@ -1,9 +1,9 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* 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>.
*/
@@ -12,13 +12,18 @@ package com.ardor3d.input;
import java.util.EnumMap;
-import com.google.common.collect.Maps;
-
public enum MouseButton {
LEFT, RIGHT, MIDDLE, FOUR, FIVE, SIX, SEVEN, EIGHT, NINE;
public static EnumMap<MouseButton, ButtonState> makeMap(final ButtonState left, final ButtonState right,
final ButtonState middle) {
+ return makeMap(left, right, middle, ButtonState.UNDEFINED, ButtonState.UNDEFINED, ButtonState.UNDEFINED,
+ ButtonState.UNDEFINED, ButtonState.UNDEFINED, ButtonState.UNDEFINED);
+ }
+
+ public static EnumMap<MouseButton, ButtonState> makeMap(final ButtonState left, final ButtonState right,
+ final ButtonState middle, final ButtonState four, final ButtonState five, final ButtonState six,
+ final ButtonState seven, final ButtonState eight, final ButtonState nine) {
if (left == null) {
throw new NullPointerException("left");
}
@@ -28,10 +33,34 @@ public enum MouseButton {
if (middle == null) {
throw new NullPointerException("middle");
}
- final EnumMap<MouseButton, ButtonState> map = Maps.newEnumMap(MouseButton.class);
+ if (four == null) {
+ throw new NullPointerException("four");
+ }
+ if (five == null) {
+ throw new NullPointerException("five");
+ }
+ if (six == null) {
+ throw new NullPointerException("six");
+ }
+ if (seven == null) {
+ throw new NullPointerException("seven");
+ }
+ if (eight == null) {
+ throw new NullPointerException("eight");
+ }
+ if (nine == null) {
+ throw new NullPointerException("nine");
+ }
+ final EnumMap<MouseButton, ButtonState> map = new EnumMap<>(MouseButton.class);
map.put(LEFT, left);
map.put(RIGHT, right);
map.put(MIDDLE, middle);
+ map.put(FOUR, four);
+ map.put(FIVE, five);
+ map.put(SIX, six);
+ map.put(SEVEN, seven);
+ map.put(EIGHT, eight);
+ map.put(NINE, nine);
return map;
}
}
diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/MouseCursor.java b/ardor3d-core/src/main/java/com/ardor3d/input/MouseCursor.java
index e24e4ce..e7fbf20 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/input/MouseCursor.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/input/MouseCursor.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -12,6 +12,8 @@ package com.ardor3d.input;
import static com.google.common.base.Preconditions.checkArgument;
+import java.util.Objects;
+
import com.ardor3d.annotation.Immutable;
import com.ardor3d.image.Image;
import com.ardor3d.image.ImageDataFormat;
@@ -21,7 +23,7 @@ import com.ardor3d.util.geom.BufferUtils;
/**
* An immutable representation of a mouse cursor. A mouse cursor consists of an image and a hotspot where clicking is
* done.
- *
+ *
*/
@Immutable
public class MouseCursor {
@@ -29,8 +31,9 @@ public class MouseCursor {
* This constant is used to identify that the native operating system's default cursor should be used. It is not a
* valid mouse cursor in itself.
*/
- public static final MouseCursor SYSTEM_DEFAULT = new MouseCursor("system default", new Image(ImageDataFormat.RGBA,
- PixelDataType.UnsignedByte, 1, 1, BufferUtils.createByteBuffer(4), null), 0, 0);
+ public static final MouseCursor SYSTEM_DEFAULT = new MouseCursor("system default",
+ new Image(ImageDataFormat.RGBA, PixelDataType.UnsignedByte, 1, 1, BufferUtils.createByteBuffer(4), null), 0,
+ 0);
private final String _name;
private final Image _image;
@@ -39,7 +42,7 @@ public class MouseCursor {
/**
* Instantiates a MouseCursor.
- *
+ *
* @param name
* the name of this cursor, for debugging purposes.
* @param image
@@ -55,10 +58,10 @@ public class MouseCursor {
_hotspotX = hotspotX;
_hotspotY = hotspotY;
- checkArgument(hotspotX >= 0 && hotspotX < image.getWidth(), "hotspot X is out of bounds: 0 <= %s < "
- + image.getWidth(), hotspotX);
- checkArgument(hotspotY >= 0 && hotspotY < image.getHeight(), "hotspot Y is out of bounds: 0 <= %s < "
- + image.getHeight(), hotspotY);
+ checkArgument(hotspotX >= 0 && hotspotX < image.getWidth(),
+ "hotspot X is out of bounds: 0 <= %s < " + image.getWidth(), hotspotX);
+ checkArgument(hotspotY >= 0 && hotspotY < image.getHeight(),
+ "hotspot Y is out of bounds: 0 <= %s < " + image.getHeight(), hotspotY);
}
public String getName() {
@@ -102,11 +105,10 @@ public class MouseCursor {
if (_hotspotY != that._hotspotY) {
return false;
}
- if (_image != null ? !_image.equals(that._image) : that._image != null) {
+ if (!Objects.equals(_image, that._image)) {
return false;
}
- // noinspection RedundantIfStatement
- if (_name != null ? !_name.equals(that._name) : that._name != null) {
+ if (!Objects.equals(_name, that._name)) {
return false;
}
@@ -115,10 +117,6 @@ public class MouseCursor {
@Override
public int hashCode() {
- int result = _name != null ? _name.hashCode() : 0;
- result = 31 * result + (_image != null ? _image.hashCode() : 0);
- result = 31 * result + _hotspotX;
- result = 31 * result + _hotspotY;
- return result;
+ return Objects.hash(getName(), getImage(), Integer.valueOf(getHotspotX()), Integer.valueOf(getHotspotY()));
}
}
diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/MouseManager.java b/ardor3d-core/src/main/java/com/ardor3d/input/MouseManager.java
index 641df06..f4d0751 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/input/MouseManager.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/input/MouseManager.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/MouseState.java b/ardor3d-core/src/main/java/com/ardor3d/input/MouseState.java
index 8ee44ce..e05ea87 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/input/MouseState.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/input/MouseState.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -17,9 +17,8 @@ import com.ardor3d.annotation.Immutable;
import com.google.common.collect.EnumMultiset;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableMultiset;
-import com.google.common.collect.Maps;
-import com.google.common.collect.Multiset;
import com.google.common.collect.ImmutableMultiset.Builder;
+import com.google.common.collect.Multiset;
/**
* Describes the mouse state at some point in time.
@@ -139,7 +138,7 @@ public class MouseState {
public EnumMap<MouseButton, ButtonState> getButtonStates(final EnumMap<MouseButton, ButtonState> store) {
EnumMap<MouseButton, ButtonState> rVal = store;
if (store == null) {
- rVal = Maps.newEnumMap(MouseButton.class);
+ rVal = new EnumMap<>(MouseButton.class);
}
rVal.clear();
rVal.putAll(_buttonStates);
diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/MouseWrapper.java b/ardor3d-core/src/main/java/com/ardor3d/input/MouseWrapper.java
index bc8d663..b74e367 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/input/MouseWrapper.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/input/MouseWrapper.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/PhysicalLayer.java b/ardor3d-core/src/main/java/com/ardor3d/input/PhysicalLayer.java
index 5948094..ba5b18d 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/input/PhysicalLayer.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/input/PhysicalLayer.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -67,7 +67,7 @@ public class PhysicalLayer {
_mouseWrapper = mouseWrapper;
_focusWrapper = focusWrapper;
_controllerWrapper = controllerWrapper;
- _stateQueue = new LinkedBlockingQueue<InputState>();
+ _stateQueue = new LinkedBlockingQueue<>();
_currentKeyboardState = KeyboardState.NOTHING;
_currentMouseState = MouseState.NOTHING;
@@ -189,7 +189,7 @@ public class PhysicalLayer {
return EMPTY_LIST;
}
- final LinkedList<InputState> result = new LinkedList<InputState>();
+ final LinkedList<InputState> result = new LinkedList<>();
_stateQueue.drainTo(result);
diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/control/FirstPersonControl.java b/ardor3d-core/src/main/java/com/ardor3d/input/control/FirstPersonControl.java
index d93f9c0..ddb773e 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/input/control/FirstPersonControl.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/input/control/FirstPersonControl.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -227,6 +227,7 @@ public class FirstPersonControl {
// Test boolean to allow us to ignore first mouse event. First event can wildly vary based on platform.
private boolean firstPing = true;
+ @Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
final MouseState mouse = inputStates.getCurrent().getMouseState();
if (mouse.getDx() != 0 || mouse.getDy() != 0) {
@@ -249,6 +250,7 @@ public class FirstPersonControl {
final Predicate<TwoInputStates> keysHeld = new Predicate<TwoInputStates>() {
Key[] keys = new Key[] { Key.W, Key.A, Key.S, Key.D, Key.LEFT, Key.RIGHT, Key.UP, Key.DOWN };
+ @Override
public boolean apply(final TwoInputStates states) {
for (final Key k : keys) {
if (states.getCurrent() != null && states.getCurrent().getKeyboardState().isDown(k)) {
@@ -260,6 +262,7 @@ public class FirstPersonControl {
};
final TriggerAction moveAction = new TriggerAction() {
+ @Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
FirstPersonControl.this.move(source.getCanvasRenderer().getCamera(), inputStates.getCurrent()
.getKeyboardState(), tpf);
diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/control/OrbitCamControl.java b/ardor3d-core/src/main/java/com/ardor3d/input/control/OrbitCamControl.java
index 2be9c8b..60afb21 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/input/control/OrbitCamControl.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/input/control/OrbitCamControl.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -349,8 +349,8 @@ public class OrbitCamControl {
public void setupMouseTriggers(final LogicalLayer layer, final boolean dragOnly) {
// Mouse look
- final Predicate<TwoInputStates> someMouseDown = Predicates.or(TriggerConditions.leftButtonDown(), Predicates
- .or(TriggerConditions.rightButtonDown(), TriggerConditions.middleButtonDown()));
+ final Predicate<TwoInputStates> someMouseDown = Predicates.or(TriggerConditions.leftButtonDown(),
+ Predicates.or(TriggerConditions.rightButtonDown(), TriggerConditions.middleButtonDown()));
final Predicate<TwoInputStates> scrollWheelMoved = new MouseWheelMovedCondition();
final Predicate<TwoInputStates> dragged = Predicates.and(TriggerConditions.mouseMoved(), someMouseDown);
final TriggerAction mouseAction = new TriggerAction() {
@@ -358,6 +358,7 @@ public class OrbitCamControl {
// Test boolean to allow us to ignore first mouse event. First event can wildly vary based on platform.
private boolean firstPing = true;
+ @Override
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
final MouseState mouse = inputStates.getCurrent().getMouseState();
if (mouse.getDx() != 0 || mouse.getDy() != 0) {
diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/logical/AnyControllerCondition.java b/ardor3d-core/src/main/java/com/ardor3d/input/logical/AnyControllerCondition.java
index 8626a5f..4819f48 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/input/logical/AnyControllerCondition.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/input/logical/AnyControllerCondition.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -15,6 +15,7 @@ import com.google.common.base.Predicate;
public final class AnyControllerCondition implements Predicate<TwoInputStates> {
+ @Override
public boolean apply(final TwoInputStates states) {
final ControllerState oldState = states.getPrevious().getControllerState();
final ControllerState currentState = states.getCurrent().getControllerState();
diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/logical/AnyKeyCondition.java b/ardor3d-core/src/main/java/com/ardor3d/input/logical/AnyKeyCondition.java
index 5ab407f..b114357 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/input/logical/AnyKeyCondition.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/input/logical/AnyKeyCondition.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -17,6 +17,7 @@ import com.google.common.base.Predicate;
* Applicable whenever 'any' key has been pressed.
*/
public class AnyKeyCondition implements Predicate<TwoInputStates> {
+ @Override
public boolean apply(final TwoInputStates twoInputStates) {
final InputState currentState = twoInputStates.getCurrent();
final InputState previousState = twoInputStates.getPrevious();
diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/logical/BasicTriggersApplier.java b/ardor3d-core/src/main/java/com/ardor3d/input/logical/BasicTriggersApplier.java
index 5b77235..1a94132 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/input/logical/BasicTriggersApplier.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/input/logical/BasicTriggersApplier.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -16,6 +16,7 @@ import com.ardor3d.framework.Canvas;
public class BasicTriggersApplier implements LogicalTriggersApplier {
+ @Override
public void checkAndPerformTriggers(final Set<InputTrigger> triggers, final Canvas source,
final TwoInputStates states, final double tpf) {
for (final InputTrigger trigger : triggers) {
diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/logical/ControllerComponentActiveCondition.java b/ardor3d-core/src/main/java/com/ardor3d/input/logical/ControllerComponentActiveCondition.java
index 6289c88..cfe1cbf 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/input/logical/ControllerComponentActiveCondition.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/input/logical/ControllerComponentActiveCondition.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -24,6 +24,7 @@ public final class ControllerComponentActiveCondition implements Predicate<TwoIn
componentNames = components;
}
+ @Override
public boolean apply(final TwoInputStates states) {
final Map<String, Float> currentStates = states.getCurrent().getControllerState()
.getControllerComponentValues(controllerName);
diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/logical/ControllerComponentCondition.java b/ardor3d-core/src/main/java/com/ardor3d/input/logical/ControllerComponentCondition.java
index a088149..d3ee877 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/input/logical/ControllerComponentCondition.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/input/logical/ControllerComponentCondition.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -33,6 +33,7 @@ public final class ControllerComponentCondition implements Predicate<TwoInputSta
componentName = component;
}
+ @Override
public boolean apply(final TwoInputStates states) {
boolean apply = false;
final ControllerState currentState = states.getCurrent().getControllerState();
diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/logical/ControllerCondition.java b/ardor3d-core/src/main/java/com/ardor3d/input/logical/ControllerCondition.java
index 757b2b6..59a32fd 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/input/logical/ControllerCondition.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/input/logical/ControllerCondition.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -29,6 +29,7 @@ public final class ControllerCondition implements Predicate<TwoInputStates> {
controllerName = controller;
}
+ @Override
public boolean apply(final TwoInputStates states) {
boolean apply = false;
final ControllerState currentState = states.getCurrent().getControllerState();
diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/logical/DummyControllerWrapper.java b/ardor3d-core/src/main/java/com/ardor3d/input/logical/DummyControllerWrapper.java
index 2194704..c1cce53 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/input/logical/DummyControllerWrapper.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/input/logical/DummyControllerWrapper.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -19,25 +19,31 @@ public class DummyControllerWrapper implements ControllerWrapper {
public static final DummyControllerWrapper INSTANCE = new DummyControllerWrapper();
PeekingIterator<ControllerEvent> empty = new PeekingIterator<ControllerEvent>() {
+ @Override
public boolean hasNext() {
return false;
}
+ @Override
public void remove() {}
+ @Override
public ControllerEvent peek() {
return null;
}
+ @Override
public ControllerEvent next() {
return null;
}
};
+ @Override
public PeekingIterator<ControllerEvent> getEvents() {
return empty;
}
+ @Override
public void init() {
; // ignore, does nothing
}
diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/logical/DummyFocusWrapper.java b/ardor3d-core/src/main/java/com/ardor3d/input/logical/DummyFocusWrapper.java
index 7ff0c3e..24be667 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/input/logical/DummyFocusWrapper.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/input/logical/DummyFocusWrapper.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -18,10 +18,12 @@ import com.ardor3d.input.FocusWrapper;
public class DummyFocusWrapper implements FocusWrapper {
public static final DummyFocusWrapper INSTANCE = new DummyFocusWrapper();
+ @Override
public void init() {
; // ignore, does nothing
}
+ @Override
public boolean getAndClearFocusLost() {
return false;
}
diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/logical/DummyKeyboardWrapper.java b/ardor3d-core/src/main/java/com/ardor3d/input/logical/DummyKeyboardWrapper.java
index 3de004e..9d5102f 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/input/logical/DummyKeyboardWrapper.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/input/logical/DummyKeyboardWrapper.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -22,25 +22,31 @@ public class DummyKeyboardWrapper implements KeyboardWrapper {
PeekingIterator<KeyEvent> empty = new PeekingIterator<KeyEvent>() {
+ @Override
public boolean hasNext() {
return false;
}
+ @Override
public void remove() {}
+ @Override
public KeyEvent peek() {
return null;
}
+ @Override
public KeyEvent next() {
return null;
}
};
+ @Override
public PeekingIterator<KeyEvent> getEvents() {
return empty;
}
+ @Override
public void init() {
; // ignore, does nothing.
}
diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/logical/DummyMouseWrapper.java b/ardor3d-core/src/main/java/com/ardor3d/input/logical/DummyMouseWrapper.java
index dc47f24..a46e80d 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/input/logical/DummyMouseWrapper.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/input/logical/DummyMouseWrapper.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -22,25 +22,31 @@ public class DummyMouseWrapper implements MouseWrapper {
PeekingIterator<MouseState> empty = new PeekingIterator<MouseState>() {
+ @Override
public boolean hasNext() {
return false;
}
+ @Override
public void remove() {}
+ @Override
public MouseState peek() {
return null;
}
+ @Override
public MouseState next() {
return null;
}
};
+ @Override
public PeekingIterator<MouseState> getEvents() {
return empty;
}
+ @Override
public void init() {
; // ignore, does nothing
}
diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/logical/InputTrigger.java b/ardor3d-core/src/main/java/com/ardor3d/input/logical/InputTrigger.java
index 5c126f4..5a2d34d 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/input/logical/InputTrigger.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/input/logical/InputTrigger.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/logical/KeyHeldCondition.java b/ardor3d-core/src/main/java/com/ardor3d/input/logical/KeyHeldCondition.java
index ce2b600..188093f 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/input/logical/KeyHeldCondition.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/input/logical/KeyHeldCondition.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -37,6 +37,7 @@ public final class KeyHeldCondition implements Predicate<TwoInputStates> {
this.key = key;
}
+ @Override
public boolean apply(final TwoInputStates states) {
return states.getCurrent().getKeyboardState().isDown(key);
}
diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/logical/KeyPressedCondition.java b/ardor3d-core/src/main/java/com/ardor3d/input/logical/KeyPressedCondition.java
index cdb19d6..ebfa102 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/input/logical/KeyPressedCondition.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/input/logical/KeyPressedCondition.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -38,6 +38,7 @@ public final class KeyPressedCondition implements Predicate<TwoInputStates> {
this.key = key;
}
+ @Override
public boolean apply(final TwoInputStates states) {
final InputState currentState = states.getCurrent();
final InputState previousState = states.getPrevious();
diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/logical/KeyReleasedCondition.java b/ardor3d-core/src/main/java/com/ardor3d/input/logical/KeyReleasedCondition.java
index b08f5ef..15dd2ba 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/input/logical/KeyReleasedCondition.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/input/logical/KeyReleasedCondition.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -38,6 +38,7 @@ public final class KeyReleasedCondition implements Predicate<TwoInputStates> {
this.key = key;
}
+ @Override
public boolean apply(final TwoInputStates states) {
final InputState currentState = states.getCurrent();
final InputState previousState = states.getPrevious();
diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/logical/LogicalLayer.java b/ardor3d-core/src/main/java/com/ardor3d/input/logical/LogicalLayer.java
index ed57f8c..5e5bc7d 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/input/logical/LogicalLayer.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/input/logical/LogicalLayer.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -27,8 +27,8 @@ import com.ardor3d.input.PhysicalLayer;
*/
@ThreadSafe
public final class LogicalLayer {
- private final Set<InputSource> _inputs = new CopyOnWriteArraySet<InputSource>();
- private final Set<InputTrigger> _triggers = new CopyOnWriteArraySet<InputTrigger>();
+ private final Set<InputSource> _inputs = new CopyOnWriteArraySet<>();
+ private final Set<InputTrigger> _triggers = new CopyOnWriteArraySet<>();
private LogicalTriggersApplier _applier = new BasicTriggersApplier();
public LogicalLayer() {}
diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/logical/LogicalTriggersApplier.java b/ardor3d-core/src/main/java/com/ardor3d/input/logical/LogicalTriggersApplier.java
index d034ce8..83f070d 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/input/logical/LogicalTriggersApplier.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/input/logical/LogicalTriggersApplier.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/logical/MouseButtonClickedCondition.java b/ardor3d-core/src/main/java/com/ardor3d/input/logical/MouseButtonClickedCondition.java
index 4c2a5ff..d8cf4a1 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/input/logical/MouseButtonClickedCondition.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/input/logical/MouseButtonClickedCondition.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -39,6 +39,7 @@ public final class MouseButtonClickedCondition implements Predicate<TwoInputStat
_button = button;
}
+ @Override
public boolean apply(final TwoInputStates states) {
final InputState currentState = states.getCurrent();
diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/logical/MouseButtonCondition.java b/ardor3d-core/src/main/java/com/ardor3d/input/logical/MouseButtonCondition.java
index af19920..107d26a 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/input/logical/MouseButtonCondition.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/input/logical/MouseButtonCondition.java
@@ -1,9 +1,9 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* 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>.
*/
@@ -17,20 +17,26 @@ import com.ardor3d.input.ButtonState;
import com.ardor3d.input.InputState;
import com.ardor3d.input.MouseButton;
import com.google.common.base.Predicate;
-import com.google.common.collect.Maps;
/**
* A condition that checks the state of the two most commonly used mouse buttons.
*/
@Immutable
public final class MouseButtonCondition implements Predicate<TwoInputStates> {
- private final EnumMap<MouseButton, ButtonState> _states = Maps.newEnumMap(MouseButton.class);
+ private final EnumMap<MouseButton, ButtonState> _states = new EnumMap<>(MouseButton.class);
public MouseButtonCondition(final EnumMap<MouseButton, ButtonState> states) {
_states.putAll(states);
}
public MouseButtonCondition(final ButtonState left, final ButtonState right, final ButtonState middle) {
+ this(left, right, middle, ButtonState.UNDEFINED, ButtonState.UNDEFINED, ButtonState.UNDEFINED,
+ ButtonState.UNDEFINED, ButtonState.UNDEFINED, ButtonState.UNDEFINED);
+ }
+
+ public MouseButtonCondition(final ButtonState left, final ButtonState right, final ButtonState middle,
+ final ButtonState four, final ButtonState five, final ButtonState six, final ButtonState seven,
+ final ButtonState eight, final ButtonState nine) {
if (left != ButtonState.UNDEFINED) {
_states.put(MouseButton.LEFT, left);
}
@@ -40,8 +46,27 @@ public final class MouseButtonCondition implements Predicate<TwoInputStates> {
if (middle != ButtonState.UNDEFINED) {
_states.put(MouseButton.MIDDLE, middle);
}
+ if (four != ButtonState.UNDEFINED) {
+ _states.put(MouseButton.FOUR, four);
+ }
+ if (five != ButtonState.UNDEFINED) {
+ _states.put(MouseButton.FIVE, five);
+ }
+ if (six != ButtonState.UNDEFINED) {
+ _states.put(MouseButton.SIX, six);
+ }
+ if (seven != ButtonState.UNDEFINED) {
+ _states.put(MouseButton.SEVEN, seven);
+ }
+ if (eight != ButtonState.UNDEFINED) {
+ _states.put(MouseButton.EIGHT, eight);
+ }
+ if (nine != ButtonState.UNDEFINED) {
+ _states.put(MouseButton.NINE, nine);
+ }
}
+ @Override
public boolean apply(final TwoInputStates states) {
final InputState currentState = states.getCurrent();
diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/logical/MouseButtonPressedCondition.java b/ardor3d-core/src/main/java/com/ardor3d/input/logical/MouseButtonPressedCondition.java
index a460517..2d4bee6 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/input/logical/MouseButtonPressedCondition.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/input/logical/MouseButtonPressedCondition.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -39,6 +39,7 @@ public final class MouseButtonPressedCondition implements Predicate<TwoInputStat
_button = button;
}
+ @Override
public boolean apply(final TwoInputStates states) {
final InputState currentState = states.getCurrent();
final InputState previousState = states.getPrevious();
diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/logical/MouseButtonReleasedCondition.java b/ardor3d-core/src/main/java/com/ardor3d/input/logical/MouseButtonReleasedCondition.java
index f9b0ebb..69310db 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/input/logical/MouseButtonReleasedCondition.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/input/logical/MouseButtonReleasedCondition.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -39,6 +39,7 @@ public final class MouseButtonReleasedCondition implements Predicate<TwoInputSta
_button = button;
}
+ @Override
public boolean apply(final TwoInputStates states) {
final InputState currentState = states.getCurrent();
final InputState previousState = states.getPrevious();
diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/logical/MouseMovedCondition.java b/ardor3d-core/src/main/java/com/ardor3d/input/logical/MouseMovedCondition.java
index cf3b47d..acbd2d2 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/input/logical/MouseMovedCondition.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/input/logical/MouseMovedCondition.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -19,6 +19,7 @@ import com.google.common.base.Predicate;
*/
@Immutable
public final class MouseMovedCondition implements Predicate<TwoInputStates> {
+ @Override
public boolean apply(final TwoInputStates states) {
final InputState currentState = states.getCurrent();
final InputState previousState = states.getPrevious();
diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/logical/MouseWheelMovedCondition.java b/ardor3d-core/src/main/java/com/ardor3d/input/logical/MouseWheelMovedCondition.java
index 59ccb97..283ca22 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/input/logical/MouseWheelMovedCondition.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/input/logical/MouseWheelMovedCondition.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -19,6 +19,7 @@ import com.google.common.base.Predicate;
*/
@Immutable
public final class MouseWheelMovedCondition implements Predicate<TwoInputStates> {
+ @Override
public boolean apply(final TwoInputStates states) {
final InputState currentState = states.getCurrent();
final InputState previousState = states.getPrevious();
diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/logical/TriggerAction.java b/ardor3d-core/src/main/java/com/ardor3d/input/logical/TriggerAction.java
index 216c28e..407aa41 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/input/logical/TriggerAction.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/input/logical/TriggerAction.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/logical/TriggerConditions.java b/ardor3d-core/src/main/java/com/ardor3d/input/logical/TriggerConditions.java
index a36e8a5..cc0036d 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/input/logical/TriggerConditions.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/input/logical/TriggerConditions.java
@@ -1,9 +1,9 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* 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>.
*/
@@ -27,6 +27,12 @@ public final class TriggerConditions {
private static final MouseButtonCondition RIGHT_DOWN_CONDITION = makeCondition(MouseButton.RIGHT, ButtonState.DOWN);
private static final MouseButtonCondition MIDDLE_DOWN_CONDITION = makeCondition(MouseButton.MIDDLE,
ButtonState.DOWN);
+ private static final MouseButtonCondition FOUR_DOWN_CONDITION = makeCondition(MouseButton.FOUR, ButtonState.DOWN);
+ private static final MouseButtonCondition FIVE_DOWN_CONDITION = makeCondition(MouseButton.FIVE, ButtonState.DOWN);
+ private static final MouseButtonCondition SIX_DOWN_CONDITION = makeCondition(MouseButton.SIX, ButtonState.DOWN);
+ private static final MouseButtonCondition SEVEN_DOWN_CONDITION = makeCondition(MouseButton.SEVEN, ButtonState.DOWN);
+ private static final MouseButtonCondition EIGHT_DOWN_CONDITION = makeCondition(MouseButton.EIGHT, ButtonState.DOWN);
+ private static final MouseButtonCondition NINE_DOWN_CONDITION = makeCondition(MouseButton.NINE, ButtonState.DOWN);
private static final Predicate<TwoInputStates> ALWAYS_TRUE = new Predicate<TwoInputStates>() {
@Override
@@ -43,7 +49,7 @@ public final class TriggerConditions {
};
private static MouseButtonCondition makeCondition(final MouseButton button, final ButtonState state) {
- final EnumMap<MouseButton, ButtonState> map = new EnumMap<MouseButton, ButtonState>(MouseButton.class);
+ final EnumMap<MouseButton, ButtonState> map = new EnumMap<>(MouseButton.class);
for (final MouseButton b : MouseButton.values()) {
map.put(b, button != b ? ButtonState.UNDEFINED : state);
}
@@ -63,7 +69,7 @@ public final class TriggerConditions {
}
/**
- *
+ *
* @return a condition that is true if the left button is down
*/
public static MouseButtonCondition leftButtonDown() {
@@ -71,7 +77,7 @@ public final class TriggerConditions {
}
/**
- *
+ *
* @return a condition that is true if the right button is down
*/
public static MouseButtonCondition rightButtonDown() {
@@ -79,7 +85,7 @@ public final class TriggerConditions {
}
/**
- *
+ *
* @return a condition that is true if the middle button is down
*/
public static MouseButtonCondition middleButtonDown() {
@@ -87,6 +93,54 @@ public final class TriggerConditions {
}
/**
+ *
+ * @return a condition that is true if the fourth button is down
+ */
+ public static MouseButtonCondition fourButtonDown() {
+ return FOUR_DOWN_CONDITION;
+ }
+
+ /**
+ *
+ * @return a condition that is true if the fifth button is down
+ */
+ public static MouseButtonCondition fiveButtonDown() {
+ return FIVE_DOWN_CONDITION;
+ }
+
+ /**
+ *
+ * @return a condition that is true if the sixth button is down
+ */
+ public static MouseButtonCondition sixButtonDown() {
+ return SIX_DOWN_CONDITION;
+ }
+
+ /**
+ *
+ * @return a condition that is true if the seventh button is down
+ */
+ public static MouseButtonCondition sevenButtonDown() {
+ return SEVEN_DOWN_CONDITION;
+ }
+
+ /**
+ *
+ * @return a condition that is true if the eighth button is down
+ */
+ public static MouseButtonCondition eightButtonDown() {
+ return EIGHT_DOWN_CONDITION;
+ }
+
+ /**
+ *
+ * @return a condition that is true if the ninth button is down
+ */
+ public static MouseButtonCondition nineButtonDown() {
+ return NINE_DOWN_CONDITION;
+ }
+
+ /**
* @return a condition that is always true.
*/
public static Predicate<TwoInputStates> alwaysTrue() {
diff --git a/ardor3d-core/src/main/java/com/ardor3d/input/logical/TwoInputStates.java b/ardor3d-core/src/main/java/com/ardor3d/input/logical/TwoInputStates.java
index 2e058e1..76cff2e 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/input/logical/TwoInputStates.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/input/logical/TwoInputStates.java
@@ -1,9 +1,9 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* 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>.
*/
@@ -12,6 +12,8 @@ package com.ardor3d.input.logical;
import static com.google.common.base.Preconditions.checkNotNull;
+import java.util.Objects;
+
import com.ardor3d.annotation.Immutable;
import com.ardor3d.input.InputState;
@@ -27,12 +29,12 @@ public final class TwoInputStates {
/**
* Instantiates a new TwoInputStates. It is safe for both parameters to point to the same instance, but they cannot
* be null.
- *
+ *
* @param previous
* the previous input state
* @param current
* the current input state
- *
+ *
* @throws NullPointerException
* if either parameter is null
*/
@@ -51,9 +53,7 @@ public final class TwoInputStates {
@Override
public int hashCode() {
- // we don't expect this to be used in a map.
- assert false : "hashCode not designed";
- return 42;
+ return Objects.hash(getPrevious(), getCurrent());
}
@Override
@@ -65,6 +65,6 @@ public final class TwoInputStates {
return false;
}
final TwoInputStates comp = (TwoInputStates) o;
- return _previous == comp._previous && _current == comp._current;
+ return Objects.equals(_previous, comp._previous) && Objects.equals(_current, comp._current);
}
}
diff --git a/ardor3d-core/src/main/java/com/ardor3d/intersection/BoundingCollisionResults.java b/ardor3d-core/src/main/java/com/ardor3d/intersection/BoundingCollisionResults.java
index b90a7eb..f9b73ba 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/intersection/BoundingCollisionResults.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/intersection/BoundingCollisionResults.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/intersection/BoundingPickResults.java b/ardor3d-core/src/main/java/com/ardor3d/intersection/BoundingPickResults.java
index ac3b284..04cd113 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/intersection/BoundingPickResults.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/intersection/BoundingPickResults.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/intersection/CollisionData.java b/ardor3d-core/src/main/java/com/ardor3d/intersection/CollisionData.java
index bd616a8..f912009 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/intersection/CollisionData.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/intersection/CollisionData.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/intersection/CollisionResults.java b/ardor3d-core/src/main/java/com/ardor3d/intersection/CollisionResults.java
index 0d4d693..2f4933b 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/intersection/CollisionResults.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/intersection/CollisionResults.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -26,7 +26,7 @@ public abstract class CollisionResults {
* Constructor instantiates a new <code>PickResults</code> object.
*/
public CollisionResults() {
- _nodeList = new ArrayList<CollisionData>();
+ _nodeList = new ArrayList<>();
}
/**
diff --git a/ardor3d-core/src/main/java/com/ardor3d/intersection/Intersection.java b/ardor3d-core/src/main/java/com/ardor3d/intersection/Intersection.java
index 8245aa4..643e3f4 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/intersection/Intersection.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/intersection/Intersection.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/intersection/IntersectionRecord.java b/ardor3d-core/src/main/java/com/ardor3d/intersection/IntersectionRecord.java
index eb5fb3f..11e1360 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/intersection/IntersectionRecord.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/intersection/IntersectionRecord.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/intersection/PickData.java b/ardor3d-core/src/main/java/com/ardor3d/intersection/PickData.java
index 4e2de16..f250dd3 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/intersection/PickData.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/intersection/PickData.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/intersection/PickResults.java b/ardor3d-core/src/main/java/com/ardor3d/intersection/PickResults.java
index 402b934..4f3ec5c 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/intersection/PickResults.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/intersection/PickResults.java
@@ -1,9 +1,9 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* 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>.
*/
@@ -32,7 +32,7 @@ public abstract class PickResults {
* Constructor instantiates a new <code>PickResults</code> object.
*/
public PickResults() {
- _nodeList = new ArrayList<PickData>();
+ _nodeList = new ArrayList<>();
}
/**
@@ -42,7 +42,7 @@ public abstract class PickResults {
/**
* Places a new geometry (enclosed in PickData) into the results list.
- *
+ *
* @param data
* the PickData to be placed in the results list.
*/
@@ -53,7 +53,7 @@ public abstract class PickResults {
/**
* <code>getNumber</code> retrieves the number of geometries that have been placed in the results.
- *
+ *
* @return the number of Mesh objects in the list.
*/
public int getNumber() {
@@ -62,7 +62,7 @@ public abstract class PickResults {
/**
* Retrieves a geometry (enclosed in PickData) from a specific index.
- *
+ *
* @param i
* the index requested.
* @return the data at the specified index.
@@ -87,7 +87,7 @@ public abstract class PickResults {
/**
* <code>addPick</code> generates an entry to be added to the list of picked objects. If checkDistance is true, the
* implementing class should order the object.
- *
+ *
* @param ray
* the ray that was cast for the pick calculation.
* @param p
@@ -98,13 +98,13 @@ public abstract class PickResults {
/**
* Optional method that can be implemented by sub classes to define methods for handling picked objects. After
* calculating all pick results this method is called.
- *
+ *
*/
public void processPick() {}
/**
* Reports if these pick results will order the data by distance from the origin of the Ray.
- *
+ *
* @return true if objects will be ordered by distance, false otherwise.
*/
public boolean willCheckDistance() {
@@ -113,7 +113,7 @@ public abstract class PickResults {
/**
* Sets if these pick results will order the data by distance from the origin of the Ray.
- *
+ *
* @param checkDistance
* true if objects will be ordered by distance, false otherwise.
*/
@@ -129,8 +129,12 @@ public abstract class PickResults {
*/
private static class DistanceComparator implements Comparator<PickData> {
+ @Override
public int compare(final PickData o1, final PickData o2) {
- if (o1.getIntersectionRecord().getClosestDistance() <= o2.getIntersectionRecord().getClosestDistance()) {
+ if (o1.getIntersectionRecord().getClosestDistance() == o2.getIntersectionRecord().getClosestDistance()) {
+ return 0;
+ }
+ if (o1.getIntersectionRecord().getClosestDistance() < o2.getIntersectionRecord().getClosestDistance()) {
return -1;
}
diff --git a/ardor3d-core/src/main/java/com/ardor3d/intersection/Pickable.java b/ardor3d-core/src/main/java/com/ardor3d/intersection/Pickable.java
index 832162b..8c50057 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/intersection/Pickable.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/intersection/Pickable.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/intersection/PickingUtil.java b/ardor3d-core/src/main/java/com/ardor3d/intersection/PickingUtil.java
index 0c3c066..d657eeb 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/intersection/PickingUtil.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/intersection/PickingUtil.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/intersection/PrimitiveCollisionResults.java b/ardor3d-core/src/main/java/com/ardor3d/intersection/PrimitiveCollisionResults.java
index 133312d..8318e09 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/intersection/PrimitiveCollisionResults.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/intersection/PrimitiveCollisionResults.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -34,8 +34,8 @@ public class PrimitiveCollisionResults extends CollisionResults {
public void addCollision(final Mesh s, final Mesh t) {
// find the triangle that is being hit.
// add this node and the triangle to the CollisionResults list.
- final List<PrimitiveKey> a = new ArrayList<PrimitiveKey>();
- final List<PrimitiveKey> b = new ArrayList<PrimitiveKey>();
+ final List<PrimitiveKey> a = new ArrayList<>();
+ final List<PrimitiveKey> b = new ArrayList<>();
PickingUtil.findPrimitiveCollision(s, t, a, b);
final CollisionData data = new CollisionData(s, t, a, b);
addCollisionData(data);
diff --git a/ardor3d-core/src/main/java/com/ardor3d/intersection/PrimitiveKey.java b/ardor3d-core/src/main/java/com/ardor3d/intersection/PrimitiveKey.java
index c23d085..b209bc8 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/intersection/PrimitiveKey.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/intersection/PrimitiveKey.java
@@ -1,15 +1,17 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* 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>.
*/
package com.ardor3d.intersection;
+import java.util.Objects;
+
public class PrimitiveKey {
private final int _primitiveIndex;
private final int _section;
@@ -35,12 +37,7 @@ public class PrimitiveKey {
@Override
public int hashCode() {
- int result = 17;
-
- result += 31 * result + _primitiveIndex;
- result += 31 * result + _section;
-
- return result;
+ return Objects.hash(Integer.valueOf(getPrimitiveIndex()), Integer.valueOf(getSection()));
}
@Override
diff --git a/ardor3d-core/src/main/java/com/ardor3d/intersection/PrimitivePickData.java b/ardor3d-core/src/main/java/com/ardor3d/intersection/PrimitivePickData.java
index 33fd1f5..23f9c5c 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/intersection/PrimitivePickData.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/intersection/PrimitivePickData.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/intersection/PrimitivePickResults.java b/ardor3d-core/src/main/java/com/ardor3d/intersection/PrimitivePickResults.java
index 76fb345..7a9bcdd 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/intersection/PrimitivePickResults.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/intersection/PrimitivePickResults.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/intersection/TriangleTriangleIntersect.java b/ardor3d-core/src/main/java/com/ardor3d/intersection/TriangleTriangleIntersect.java
index 972c3fb..04cb32f 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/intersection/TriangleTriangleIntersect.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/intersection/TriangleTriangleIntersect.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/light/DirectionalLight.java b/ardor3d-core/src/main/java/com/ardor3d/light/DirectionalLight.java
index 6bd3c58..95dab25 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/light/DirectionalLight.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/light/DirectionalLight.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/light/Light.java b/ardor3d-core/src/main/java/com/ardor3d/light/Light.java
index cf1a9cd..5c17840 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/light/Light.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/light/Light.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -202,7 +202,7 @@ public abstract class Light implements Serializable, Savable {
* the specular color value of the light.
*/
public void setSpecular(final ReadOnlyColorRGBA specular) {
- this._specular.set(specular);
+ _specular.set(specular);
}
/**
@@ -221,7 +221,7 @@ public abstract class Light implements Serializable, Savable {
* the diffuse color value for this light.
*/
public void setDiffuse(final ReadOnlyColorRGBA diffuse) {
- this._diffuse.set(diffuse);
+ _diffuse.set(diffuse);
}
/**
@@ -240,7 +240,7 @@ public abstract class Light implements Serializable, Savable {
* the ambient color value for this light.
*/
public void setAmbient(final ReadOnlyColorRGBA ambient) {
- this._ambient.set(ambient);
+ _ambient.set(ambient);
}
/**
@@ -316,9 +316,10 @@ public abstract class Light implements Serializable, Savable {
}
public void setName(final String name) {
- this._name = name;
+ _name = name;
}
+ @Override
public void write(final OutputCapsule capsule) throws IOException {
capsule.write(_ambient, "ambient", new ColorRGBA(DEFAULT_AMBIENT));
capsule.write(_diffuse, "diffuse", new ColorRGBA(DEFAULT_DIFFUSE));
@@ -334,6 +335,7 @@ public abstract class Light implements Serializable, Savable {
capsule.write(_name, "name", null);
}
+ @Override
public void read(final InputCapsule capsule) throws IOException {
_ambient.set((ColorRGBA) capsule.readSavable("ambient", new ColorRGBA(DEFAULT_AMBIENT)));
_diffuse.set((ColorRGBA) capsule.readSavable("diffuse", new ColorRGBA(DEFAULT_DIFFUSE)));
@@ -349,6 +351,7 @@ public abstract class Light implements Serializable, Savable {
_name = capsule.readString("name", null);
}
+ @Override
public Class<? extends Light> getClassTag() {
return this.getClass();
}
diff --git a/ardor3d-core/src/main/java/com/ardor3d/light/PointLight.java b/ardor3d-core/src/main/java/com/ardor3d/light/PointLight.java
index beace3f..49dfc8f 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/light/PointLight.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/light/PointLight.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/light/SpotLight.java b/ardor3d-core/src/main/java/com/ardor3d/light/SpotLight.java
index f44e2a3..72c9a0f 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/light/SpotLight.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/light/SpotLight.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/AbstractFBOTextureRenderer.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/AbstractFBOTextureRenderer.java
index f7a8c2e..ce4c339 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/AbstractFBOTextureRenderer.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/AbstractFBOTextureRenderer.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -30,7 +30,7 @@ public abstract class AbstractFBOTextureRenderer implements TextureRenderer {
private static final Logger logger = Logger.getLogger(AbstractFBOTextureRenderer.class.getName());
/** List of states that override any set states on a spatial if not null. */
- protected final EnumMap<RenderState.StateType, RenderState> _enforcedStates = new EnumMap<RenderState.StateType, RenderState>(
+ protected final EnumMap<RenderState.StateType, RenderState> _enforcedStates = new EnumMap<>(
RenderState.StateType.class);
protected final Camera _camera = new Camera(1, 1);
@@ -102,18 +102,22 @@ public abstract class AbstractFBOTextureRenderer implements TextureRenderer {
*
* @return the camera this renderer is using.
*/
+ @Override
public Camera getCamera() {
return _camera;
}
+ @Override
public void setBackgroundColor(final ReadOnlyColorRGBA c) {
_backgroundColor.set(c);
}
+ @Override
public ReadOnlyColorRGBA getBackgroundColor() {
return _backgroundColor;
}
+ @Override
public void render(final Spatial toDraw, final Texture tex, final int clear) {
try {
ContextManager.getCurrentContext().pushFBOTextureRenderer(this);
@@ -140,6 +144,7 @@ public abstract class AbstractFBOTextureRenderer implements TextureRenderer {
}
}
+ @Override
public void render(final Scene toDraw, final Texture tex, final int clear) {
try {
ContextManager.getCurrentContext().pushFBOTextureRenderer(this);
@@ -166,6 +171,7 @@ public abstract class AbstractFBOTextureRenderer implements TextureRenderer {
}
}
+ @Override
public void render(final List<? extends Spatial> toDraw, final Texture tex, final int clear) {
try {
ContextManager.getCurrentContext().pushFBOTextureRenderer(this);
@@ -257,10 +263,12 @@ public abstract class AbstractFBOTextureRenderer implements TextureRenderer {
toDraw.renderUnto(_parentRenderer);
}
+ @Override
public int getWidth() {
return _width;
}
+ @Override
public int getHeight() {
return _height;
}
@@ -269,22 +277,27 @@ public abstract class AbstractFBOTextureRenderer implements TextureRenderer {
return _parentRenderer;
}
+ @Override
public void setMultipleTargets(final boolean multi) {
- // ignore. Does not matter to FBO.
+ // ignore. Does not matter to FBO.
}
+ @Override
public void enforceState(final RenderState state) {
_enforcedStates.put(state.getType(), state);
}
+ @Override
public void enforceStates(final EnumMap<StateType, RenderState> states) {
_enforcedStates.putAll(states);
}
+ @Override
public void clearEnforcedState(final StateType type) {
_enforcedStates.remove(type);
}
+ @Override
public void clearEnforcedStates() {
_enforcedStates.clear();
}
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/AbstractPbufferTextureRenderer.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/AbstractPbufferTextureRenderer.java
index a428526..82966c5 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/AbstractPbufferTextureRenderer.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/AbstractPbufferTextureRenderer.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -28,7 +28,7 @@ public abstract class AbstractPbufferTextureRenderer implements TextureRenderer
private static final Logger logger = Logger.getLogger(AbstractPbufferTextureRenderer.class.getName());
/** List of states that override any set states on a spatial if not null. */
- protected final EnumMap<RenderState.StateType, RenderState> _enforcedStates = new EnumMap<RenderState.StateType, RenderState>(
+ protected final EnumMap<RenderState.StateType, RenderState> _enforcedStates = new EnumMap<>(
RenderState.StateType.class);
protected final Camera _camera = new Camera(1, 1);
@@ -139,39 +139,48 @@ public abstract class AbstractPbufferTextureRenderer implements TextureRenderer
*
* @return the camera this renderer is using.
*/
+ @Override
public Camera getCamera() {
return _camera;
}
+ @Override
public void setBackgroundColor(final ReadOnlyColorRGBA c) {
_backgroundColor.set(c);
_bgColorDirty = true;
}
+ @Override
public ReadOnlyColorRGBA getBackgroundColor() {
return _backgroundColor;
}
+ @Override
public int getWidth() {
return _width;
}
+ @Override
public int getHeight() {
return _height;
}
+ @Override
public void enforceState(final RenderState state) {
_enforcedStates.put(state.getType(), state);
}
+ @Override
public void enforceStates(final EnumMap<StateType, RenderState> states) {
_enforcedStates.putAll(states);
}
+ @Override
public void clearEnforcedState(final StateType type) {
_enforcedStates.remove(type);
}
+ @Override
public void clearEnforcedStates() {
_enforcedStates.clear();
}
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/AbstractRenderer.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/AbstractRenderer.java
index 8aa7f94..18f1347 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/AbstractRenderer.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/AbstractRenderer.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -47,7 +47,7 @@ public abstract class AbstractRenderer implements Renderer {
protected RenderLogic renderLogic;
/** List of default rendering states for this specific renderer type */
- protected final EnumMap<RenderState.StateType, RenderState> defaultStateList = new EnumMap<RenderState.StateType, RenderState>(
+ protected final EnumMap<RenderState.StateType, RenderState> defaultStateList = new EnumMap<>(
RenderState.StateType.class);
public AbstractRenderer() {
@@ -58,22 +58,27 @@ public abstract class AbstractRenderer implements Renderer {
}
}
+ @Override
public boolean isInOrthoMode() {
return _inOrthoMode;
}
+ @Override
public ReadOnlyColorRGBA getBackgroundColor() {
return _backgroundColor;
}
+ @Override
public RenderQueue getQueue() {
return _queue;
}
+ @Override
public boolean isProcessingQueue() {
return _processingQueue;
}
+ @Override
public void applyState(final StateType type, final RenderState state) {
if (Constants.stats) {
StatCollector.startStat(StatType.STAT_STATES_TIMER);
@@ -165,12 +170,14 @@ public abstract class AbstractRenderer implements Renderer {
_stencilClearValue = stencilClearValue;
}
+ @Override
public boolean isClipTestEnabled() {
final RenderContext context = ContextManager.getCurrentContext();
final RendererRecord record = context.getRendererRecord();
return record.isClippingTestEnabled();
}
+ @Override
public RenderState getProperRenderState(final StateType type, final RenderState current) {
final RenderContext context = ContextManager.getCurrentContext();
@@ -189,6 +196,7 @@ public abstract class AbstractRenderer implements Renderer {
}
}
+ @Override
public void setRenderLogic(final RenderLogic renderLogic) {
this.renderLogic = renderLogic;
}
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/Camera.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/Camera.java
index 3b72a92..3012d90 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/Camera.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/Camera.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -1498,6 +1498,7 @@ public class Camera implements Savable, Externalizable {
renderer.setModelViewMatrix(_matrixBuffer);
}
+ @Override
public void write(final OutputCapsule capsule) throws IOException {
capsule.write(_location, "location", new Vector3(Vector3.ZERO));
capsule.write(_left, "left", new Vector3(Vector3.UNIT_X));
@@ -1524,6 +1525,7 @@ public class Camera implements Savable, Externalizable {
capsule.write(_depthRangeFar, "depthRangeFar", 1.0);
}
+ @Override
public void read(final InputCapsule capsule) throws IOException {
_location.set((Vector3) capsule.readSavable("location", new Vector3(Vector3.ZERO)));
_left.set((Vector3) capsule.readSavable("left", new Vector3(Vector3.UNIT_X)));
@@ -1550,6 +1552,7 @@ public class Camera implements Savable, Externalizable {
_depthRangeFar = capsule.readDouble("depthRangeFar", 1.0);
}
+ @Override
public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException {
_location.set((Vector3) in.readObject());
_left.set((Vector3) in.readObject());
@@ -1576,6 +1579,7 @@ public class Camera implements Savable, Externalizable {
_depthRangeFar = in.readDouble();
}
+ @Override
public void writeExternal(final ObjectOutput out) throws IOException {
out.writeObject(_location);
out.writeObject(_left);
@@ -1609,6 +1613,7 @@ public class Camera implements Savable, Externalizable {
+ " left - " + Arrays.toString(getLeft().toArray(null));
}
+ @Override
public Class<? extends Camera> getClassTag() {
return getClass();
}
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/ContextCapabilities.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/ContextCapabilities.java
index 9599e0e..3d65cda 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/ContextCapabilities.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/ContextCapabilities.java
@@ -1,9 +1,9 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* 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>.
*/
@@ -40,6 +40,7 @@ public class ContextCapabilities {
protected boolean _geometryShader4Supported = false;
protected boolean _geometryInstancingSupported = false;
protected boolean _tessellationShadersSupported = false;
+ protected boolean _computeShaderSupported = false;
protected int _maxGLSLVertexAttribs;
protected boolean _pbufferSupported = false;
@@ -153,6 +154,7 @@ public class ContextCapabilities {
_glslSupported = source._glslSupported;
_geometryInstancingSupported = source._geometryInstancingSupported;
_tessellationShadersSupported = source._tessellationShadersSupported;
+ _computeShaderSupported = source._computeShaderSupported;
_maxAnisotropic = source._maxAnisotropic;
_maxFBOColorAttachments = source._maxFBOColorAttachments;
_maxFBOSamples = source._maxFBOSamples;
@@ -338,6 +340,14 @@ public class ContextCapabilities {
}
/**
+ * @return <code>true</code> if the GLSL is supported and GL_ARB_compute_shader is supported by current graphics
+ * configuration
+ */
+ public boolean isComputeShaderSupported() {
+ return _computeShaderSupported;
+ }
+
+ /**
* @return true if the ARB_shader_objects extension is supported by current graphics configuration.
*/
public boolean isGLSLSupported() {
@@ -391,7 +401,7 @@ public class ContextCapabilities {
/**
* <code>getNumberOfAuxiliaryDrawBuffers</code> returns the total number of available auxiliary draw buffers this
* context supports.
- *
+ *
* @return the number of available auxiliary draw buffers supported by the context.
*/
public int getNumberOfAuxiliaryDrawBuffers() {
@@ -400,7 +410,7 @@ public class ContextCapabilities {
/**
* <code>getTotalNumberOfUnits</code> returns the total number of texture units this context supports.
- *
+ *
* @return the total number of texture units supported by the context.
*/
public int getTotalNumberOfUnits() {
@@ -410,7 +420,7 @@ public class ContextCapabilities {
/**
* <code>getNumberOfFixedUnits</code> returns the number of texture units this context supports, for use in the
* fixed pipeline.
- *
+ *
* @return the number units.
*/
public int getNumberOfFixedTextureUnits() {
@@ -420,7 +430,7 @@ public class ContextCapabilities {
/**
* <code>getNumberOfVertexUnits</code> returns the number of texture units available to a vertex shader that this
* context supports.
- *
+ *
* @return the number of units.
*/
public int getNumberOfVertexUnits() {
@@ -430,7 +440,7 @@ public class ContextCapabilities {
/**
* <code>getNumberOfFragmentUnits</code> returns the number of texture units available to a fragment shader that
* this context supports.
- *
+ *
* @return the number of units.
*/
public int getNumberOfFragmentTextureUnits() {
@@ -440,7 +450,7 @@ public class ContextCapabilities {
/**
* <code>getNumberOfFragmentTexCoordUnits</code> returns the number of texture coordinate sets available that this
* context supports.
- *
+ *
* @return the number of units.
*/
public int getNumberOfFragmentTexCoordUnits() {
@@ -456,7 +466,7 @@ public class ContextCapabilities {
/**
* <code>getNumberOfTotalUnits</code> returns the number of texture units this context supports.
- *
+ *
* @return the number of units.
*/
public int getNumberOfTotalTextureUnits() {
@@ -465,7 +475,7 @@ public class ContextCapabilities {
/**
* <code>getMaxFBOColorAttachments</code> returns the MAX_COLOR_ATTACHMENTS for FBOs that this context supports.
- *
+ *
* @return the number of buffers.
*/
public int getMaxFBOColorAttachments() {
@@ -474,7 +484,7 @@ public class ContextCapabilities {
/**
* Returns the maximum anisotropic filter.
- *
+ *
* @return The maximum anisotropic filter.
*/
public float getMaxAnisotropic() {
@@ -525,7 +535,7 @@ public class ContextCapabilities {
/**
* Returns if S3TC compression is available for textures.
- *
+ *
* @return true if S3TC is available.
*/
public boolean isS3TCSupported() {
@@ -534,7 +544,7 @@ public class ContextCapabilities {
/**
* Returns if LATC compression is available for textures.
- *
+ *
* @return true if LATC is available.
*/
public boolean isLATCSupported() {
@@ -543,7 +553,7 @@ public class ContextCapabilities {
/**
* Returns if generic (non-specific) compression is available for textures.
- *
+ *
* @return true if available.
*/
public boolean isGenericTCSupported() {
@@ -552,7 +562,7 @@ public class ContextCapabilities {
/**
* Returns if Texture3D is available for textures.
- *
+ *
* @return true if Texture3D is available.
*/
public boolean isTexture3DSupported() {
@@ -561,7 +571,7 @@ public class ContextCapabilities {
/**
* Returns if TextureCubeMap is available for textures.
- *
+ *
* @return true if TextureCubeMap is available.
*/
public boolean isTextureCubeMapSupported() {
@@ -570,7 +580,7 @@ public class ContextCapabilities {
/**
* Returns if AutomaticMipmap generation is available for textures.
- *
+ *
* @return true if AutomaticMipmap generation is available.
*/
public boolean isAutomaticMipmapsSupported() {
@@ -652,7 +662,7 @@ public class ContextCapabilities {
/**
* Returns the vendor of the graphics adapter
- *
+ *
* @return The vendor of the graphics adapter
*/
public String getDisplayVendor() {
@@ -661,7 +671,7 @@ public class ContextCapabilities {
/**
* Returns renderer details of the adapter
- *
+ *
* @return The adapter details
*/
public String getDisplayRenderer() {
@@ -670,7 +680,7 @@ public class ContextCapabilities {
/**
* Returns the version supported
- *
+ *
* @return The version supported
*/
public String getDisplayVersion() {
@@ -679,7 +689,7 @@ public class ContextCapabilities {
/**
* Returns the supported shading language version. Needs OpenGL 2.0 support to query.
- *
+ *
* @return The shading language version supported
*/
public String getShadingLanguageVersion() {
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/ContextCleanListener.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/ContextCleanListener.java
index 839ac23..735bfb5 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/ContextCleanListener.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/ContextCleanListener.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/ContextManager.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/ContextManager.java
index a72ffd5..658f4a2 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/ContextManager.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/ContextManager.java
@@ -1,28 +1,27 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* 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>.
*/
package com.ardor3d.renderer;
+import java.util.ArrayList;
import java.util.List;
import java.util.Map;
-
-import com.google.common.collect.Lists;
-import com.google.common.collect.MapMaker;
+import java.util.WeakHashMap;
public class ContextManager {
protected static RenderContext currentContext = null;
- private static List<ContextCleanListener> _cleanListeners = Lists.newArrayList();
+ private static List<ContextCleanListener> _cleanListeners = new ArrayList<>();
- protected static final Map<Object, RenderContext> contextStore = new MapMaker().weakKeys().makeMap();
+ protected static final Map<Object, RenderContext> contextStore = new WeakHashMap<>();
/**
* @return a RenderContext object representing the current OpenGL context.
@@ -53,7 +52,7 @@ public class ContextManager {
/**
* Find the first context we manage that uses the given shared opengl context.
- *
+ *
* @param glref
* @return
*/
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/DrawBufferTarget.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/DrawBufferTarget.java
index 0dba3b5..5818377 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/DrawBufferTarget.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/DrawBufferTarget.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/IndexMode.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/IndexMode.java
index 305e914..cef4761 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/IndexMode.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/IndexMode.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/RenderContext.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/RenderContext.java
index eaaeb57..7676e67 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/RenderContext.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/RenderContext.java
@@ -1,9 +1,9 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* 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>.
*/
@@ -26,18 +26,18 @@ import com.ardor3d.renderer.state.record.StateRecord;
public class RenderContext {
/** List of states that override any set states on a spatial if not null. */
- protected final EnumMap<RenderState.StateType, RenderState> _enforcedStates = new EnumMap<RenderState.StateType, RenderState>(
+ protected final EnumMap<RenderState.StateType, RenderState> _enforcedStates = new EnumMap<>(
RenderState.StateType.class);
- protected final Stack<EnumMap<StateType, RenderState>> _enforcedBackStack = new Stack<EnumMap<StateType, RenderState>>();
+ protected final Stack<EnumMap<StateType, RenderState>> _enforcedBackStack = new Stack<>();
- protected final Stack<AbstractFBOTextureRenderer> _textureRenderers = new Stack<AbstractFBOTextureRenderer>();
+ protected final Stack<AbstractFBOTextureRenderer> _textureRenderers = new Stack<>();
/** RenderStates a Spatial contains during rendering. */
- protected final EnumMap<RenderState.StateType, RenderState> _currentStates = new EnumMap<RenderState.StateType, RenderState>(
+ protected final EnumMap<RenderState.StateType, RenderState> _currentStates = new EnumMap<>(
RenderState.StateType.class);
- protected final EnumMap<RenderState.StateType, StateRecord> _stateRecords = new EnumMap<RenderState.StateType, StateRecord>(
+ protected final EnumMap<RenderState.StateType, StateRecord> _stateRecords = new EnumMap<>(
RenderState.StateType.class);
protected final LineRecord _lineRecord = new LineRecord();
@@ -105,7 +105,7 @@ public class RenderContext {
* Enforce a particular state. In other words, the given state will override any state of the same type set on a
* scene object. Remember to clear the state when done enforcing. Very useful for multipass techniques where
* multiple sets of states need to be applied to a scenegraph drawn multiple times.
- *
+ *
* @param state
* state to enforce
*/
@@ -122,7 +122,7 @@ public class RenderContext {
/**
* Clears an enforced render state index by setting it to null. This allows object specific states to be used.
- *
+ *
* @param type
* The type of RenderState to clear enforcement on.
*/
@@ -188,12 +188,12 @@ public class RenderContext {
* Saves the currently set states to a stack. Does not changes the currently enforced states.
*/
public void pushEnforcedStates() {
- _enforcedBackStack.push(new EnumMap<StateType, RenderState>(_enforcedStates));
+ _enforcedBackStack.push(new EnumMap<>(_enforcedStates));
}
/**
* Restores the enforced states from the stack. Any states enforced or cleared since the last push are reverted.
- *
+ *
* @throws EmptyStackException
* if this method is called without first calling {@link #pushEnforcedStates()}
*/
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/RenderLogic.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/RenderLogic.java
index 1cd4869..6ff5135 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/RenderLogic.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/RenderLogic.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/Renderer.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/Renderer.java
index a5b0e10..bad2af3 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/Renderer.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/Renderer.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -472,7 +472,7 @@ public interface Renderer {
/**
* This is a workaround until we make shared Record classes, or open up lower level opengl calls abstracted from
- * lwjgl/jogl.
+ * jogl.
*
* @param lineWidth
* @param stippleFactor
@@ -483,7 +483,7 @@ public interface Renderer {
/**
* This is a workaround until we make shared Record classes, or open up lower level opengl calls abstracted from
- * lwjgl/jogl.
+ * jogl.
*
* @param pointSize
* @param antialiased
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/RendererCallable.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/RendererCallable.java
index 665317d..138055c 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/RendererCallable.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/RendererCallable.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/StereoCamera.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/StereoCamera.java
index cf3eb10..fa4d2ba 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/StereoCamera.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/StereoCamera.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/TextureRenderer.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/TextureRenderer.java
index 7972f98..41b334b 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/TextureRenderer.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/TextureRenderer.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/TextureRendererFactory.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/TextureRendererFactory.java
index 31bace1..17604c4 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/TextureRendererFactory.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/TextureRendererFactory.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/TextureRendererProvider.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/TextureRendererProvider.java
index b775643..3522eec 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/TextureRendererProvider.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/TextureRendererProvider.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/EffectManager.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/EffectManager.java
index c5780bd..41fb48d 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/EffectManager.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/EffectManager.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -10,7 +10,9 @@
package com.ardor3d.renderer.effect;
+import java.util.ArrayList;
import java.util.EnumMap;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -27,14 +29,12 @@ import com.ardor3d.scenegraph.Mesh;
import com.ardor3d.scenegraph.hint.CullHint;
import com.ardor3d.scenegraph.hint.LightCombineMode;
import com.ardor3d.util.geom.BufferUtils;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
public class EffectManager {
protected final DisplaySettings _canvasSettings;
- protected final List<RenderEffect> _effects = Lists.newArrayList();
- protected final Map<String, RenderTarget> _renderTargetMap = Maps.newHashMap();
+ protected final List<RenderEffect> _effects = new ArrayList<>();
+ protected final Map<String, RenderTarget> _renderTargetMap = new HashMap<>();
protected Renderer _currentRenderer = null;
protected RenderTarget _currentRenderTarget = null;
protected Camera _fsqCamera, _sceneCamera;
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/EffectStep.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/EffectStep.java
index 4971d58..8831b6d 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/EffectStep.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/EffectStep.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/EffectStep_RenderScreenOverlay.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/EffectStep_RenderScreenOverlay.java
index 777daee..651984f 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/EffectStep_RenderScreenOverlay.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/EffectStep_RenderScreenOverlay.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -11,18 +11,18 @@
package com.ardor3d.renderer.effect;
import java.util.EnumMap;
+import java.util.HashMap;
import java.util.Map;
import com.ardor3d.renderer.state.RenderState;
-import com.ardor3d.renderer.state.TextureState;
import com.ardor3d.renderer.state.RenderState.StateType;
-import com.google.common.collect.Maps;
+import com.ardor3d.renderer.state.TextureState;
public class EffectStep_RenderScreenOverlay implements EffectStep {
- private final EnumMap<StateType, RenderState> _states = Maps.newEnumMap(StateType.class);
+ private final EnumMap<StateType, RenderState> _states = new EnumMap<>(StateType.class);
private final TextureState _texState = new TextureState();
- private final Map<String, Integer> _targetMap = Maps.newHashMap();
+ private final Map<String, Integer> _targetMap = new HashMap<>();
public EffectStep_RenderScreenOverlay() {
_states.put(StateType.Texture, _texState);
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/EffectStep_RenderSpatials.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/EffectStep_RenderSpatials.java
index ee03266..72d7f35 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/EffectStep_RenderSpatials.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/EffectStep_RenderSpatials.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -10,6 +10,7 @@
package com.ardor3d.renderer.effect;
+import java.util.ArrayList;
import java.util.EnumMap;
import java.util.List;
@@ -17,12 +18,10 @@ import com.ardor3d.renderer.Camera;
import com.ardor3d.renderer.state.RenderState;
import com.ardor3d.renderer.state.RenderState.StateType;
import com.ardor3d.scenegraph.Spatial;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
public class EffectStep_RenderSpatials implements EffectStep {
- private final EnumMap<StateType, RenderState> _states = Maps.newEnumMap(StateType.class);
- private final List<Spatial> _spatials = Lists.newArrayList();
+ private final EnumMap<StateType, RenderState> _states = new EnumMap<>(StateType.class);
+ private final List<Spatial> _spatials = new ArrayList<>();
private final Camera _trackedCamera;
public EffectStep_RenderSpatials(final Camera trackedCamera) {
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/EffectStep_SetRenderTarget.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/EffectStep_SetRenderTarget.java
index 8b36d29..cbc6e63 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/EffectStep_SetRenderTarget.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/EffectStep_SetRenderTarget.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/RenderEffect.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/RenderEffect.java
index 6fda5a9..6c77243 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/RenderEffect.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/RenderEffect.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -10,10 +10,9 @@
package com.ardor3d.renderer.effect;
+import java.util.ArrayList;
import java.util.List;
-import com.google.common.collect.Lists;
-
/**
* A RenderEffect object represents a complete set of instructions necessary for applying a specific effect to our
* render output. Each effect is comprised of a set of 1 or more steps (EffectStep).
@@ -21,7 +20,7 @@ import com.google.common.collect.Lists;
public abstract class RenderEffect {
/** A list of logical steps that comprise our effect. */
- protected final List<EffectStep> _steps = Lists.newArrayList();
+ protected final List<EffectStep> _steps = new ArrayList<>();
/** Is this render effect active? */
protected boolean _enabled = true;
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/RenderTarget.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/RenderTarget.java
index 7a4a55f..df5987d 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/RenderTarget.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/RenderTarget.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/RenderTarget_Framebuffer.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/RenderTarget_Framebuffer.java
index 54eec7f..1b03307 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/RenderTarget_Framebuffer.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/RenderTarget_Framebuffer.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/RenderTarget_Texture2D.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/RenderTarget_Texture2D.java
index 338bda8..b78f16b 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/RenderTarget_Texture2D.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/RenderTarget_Texture2D.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/TextureRendererPool.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/TextureRendererPool.java
index 4f42df3..3cfcd32 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/TextureRendererPool.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/effect/TextureRendererPool.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -11,18 +11,18 @@
package com.ardor3d.renderer.effect;
import java.util.Iterator;
+import java.util.LinkedList;
import java.util.List;
import com.ardor3d.renderer.ContextManager;
import com.ardor3d.renderer.Renderer;
import com.ardor3d.renderer.TextureRenderer;
import com.ardor3d.renderer.TextureRendererFactory;
-import com.google.common.collect.Lists;
public enum TextureRendererPool {
INSTANCE;
- private final List<TextureRenderer> renderers = Lists.newLinkedList();
+ private final List<TextureRenderer> renderers = new LinkedList<>();
public static TextureRenderer fetch(final int width, final int height, final Renderer renderer) {
for (final Iterator<TextureRenderer> it = INSTANCE.renderers.iterator(); it.hasNext();) {
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/pass/BasicPassManager.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/pass/BasicPassManager.java
index 6597e59..894a600 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/pass/BasicPassManager.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/pass/BasicPassManager.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -22,7 +22,7 @@ import com.ardor3d.renderer.TextureRenderer;
*/
public class BasicPassManager {
- protected List<Pass> _passes = new ArrayList<Pass>();
+ protected List<Pass> _passes = new ArrayList<>();
public void add(final Pass toAdd) {
if (toAdd != null) {
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/pass/OutlinePass.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/pass/OutlinePass.java
index e4896fc..d4674a5 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/pass/OutlinePass.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/pass/OutlinePass.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/pass/Pass.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/pass/Pass.java
index 12fadf3..d2395fb 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/pass/Pass.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/pass/Pass.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -38,7 +38,7 @@ public abstract class Pass implements Serializable {
private static final long serialVersionUID = 1L;
/** list of Spatial objects registered with this pass. */
- protected List<Spatial> _spatials = new ArrayList<Spatial>();
+ protected List<Spatial> _spatials = new ArrayList<>();
/** if false, pass will not be updated or rendered. */
protected boolean _enabled = true;
@@ -47,7 +47,7 @@ public abstract class Pass implements Serializable {
* RenderStates registered with this pass - if a given state is not null it overrides the corresponding state set
* during rendering.
*/
- protected final EnumMap<RenderState.StateType, RenderState> _passStates = new EnumMap<RenderState.StateType, RenderState>(
+ protected final EnumMap<RenderState.StateType, RenderState> _passStates = new EnumMap<>(
RenderState.StateType.class);
protected RenderContext _context = null;
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/pass/RenderPass.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/pass/RenderPass.java
index e814a54..10fdc29 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/pass/RenderPass.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/pass/RenderPass.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/queue/AbstractRenderBucket.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/queue/AbstractRenderBucket.java
index 3350df3..a049906 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/queue/AbstractRenderBucket.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/queue/AbstractRenderBucket.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -28,15 +28,16 @@ public class AbstractRenderBucket implements RenderBucket {
protected Spatial[] _currentList, _tempList;
protected int _currentListSize;
- protected Stack<Spatial[]> _listStack = new Stack<Spatial[]>();
- protected Stack<Spatial[]> _listStackPool = new Stack<Spatial[]>();
- protected Stack<Integer> _listSizeStack = new Stack<Integer>();
+ protected Stack<Spatial[]> _listStack = new Stack<>();
+ protected Stack<Spatial[]> _listStackPool = new Stack<>();
+ protected Stack<Integer> _listSizeStack = new Stack<>();
public AbstractRenderBucket() {
_currentList = new Spatial[32];
_tempList = new Spatial[_currentList.length];
}
+ @Override
public void add(final Spatial spatial) {
spatial._queueDistance = Double.NEGATIVE_INFINITY;
if (_currentListSize >= _currentList.length) {
@@ -51,6 +52,7 @@ public class AbstractRenderBucket implements RenderBucket {
_currentList[_currentListSize++] = spatial;
}
+ @Override
public void remove(final Spatial spatial) {
int index = 0;
for (int i = 0; i < _currentListSize; i++) {
@@ -66,6 +68,7 @@ public class AbstractRenderBucket implements RenderBucket {
_currentListSize--;
}
+ @Override
public void clear() {
if (_currentListSize > 0) {
Arrays.fill(_currentList, 0, _currentListSize, null);
@@ -73,12 +76,14 @@ public class AbstractRenderBucket implements RenderBucket {
}
}
+ @Override
public void render(final Renderer renderer) {
for (int i = 0; i < _currentListSize; i++) {
_currentList[i].draw(renderer);
}
}
+ @Override
public void sort() {
// only sort if we have more than one item in our bucket.
if (_currentListSize > 1) {
@@ -98,6 +103,7 @@ public class AbstractRenderBucket implements RenderBucket {
}
}
+ @Override
public void pushBucket() {
_listStack.push(_currentList);
if (_listStackPool.isEmpty()) {
@@ -110,6 +116,7 @@ public class AbstractRenderBucket implements RenderBucket {
_currentListSize = 0;
}
+ @Override
public void popBucket() {
if (_currentList != null) {
_listStackPool.push(_currentList);
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/queue/OpaqueRenderBucket.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/queue/OpaqueRenderBucket.java
index f74e9a3..2f1483c 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/queue/OpaqueRenderBucket.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/queue/OpaqueRenderBucket.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -27,6 +27,7 @@ public class OpaqueRenderBucket extends AbstractRenderBucket {
}
private class OpaqueComparator implements Comparator<Spatial> {
+ @Override
public int compare(final Spatial o1, final Spatial o2) {
if (o1 instanceof Mesh && o2 instanceof Mesh) {
return compareByStates((Mesh) o1, (Mesh) o2);
@@ -50,12 +51,20 @@ public class OpaqueRenderBucket extends AbstractRenderBucket {
private int compareByStates(final Mesh mesh1, final Mesh mesh2) {
final TextureState ts1 = (TextureState) mesh1.getWorldRenderState(RenderState.StateType.Texture);
final TextureState ts2 = (TextureState) mesh2.getWorldRenderState(RenderState.StateType.Texture);
- if (ts1 == ts2) {
- return 0;
- } else if (ts1 == null && ts2 != null) {
- return -1;
- } else if (ts2 == null && ts1 != null) {
- return 1;
+ if (ts1 == null) {
+ if (ts2 == null) {
+ return 0;
+ } else {
+ return -1;
+ }
+ } else {
+ if (ts2 == null) {
+ return 1;
+ } else {
+ if (ts1 == ts2) {
+ return 0;
+ }
+ }
}
for (int x = 0, maxIndex = Math.min(ts1.getMaxTextureIndexUsed(), ts2.getMaxTextureIndexUsed()); x <= maxIndex; x++) {
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/queue/OrthoRenderBucket.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/queue/OrthoRenderBucket.java
index fa4f8c3..f21d82c 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/queue/OrthoRenderBucket.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/queue/OrthoRenderBucket.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -38,6 +38,7 @@ public class OrthoRenderBucket extends AbstractRenderBucket {
}
private static class OrthoComparator implements Comparator<Spatial> {
+ @Override
public int compare(final Spatial o1, final Spatial o2) {
if (o2.getSceneHints().getOrthoOrder() == o1.getSceneHints().getOrthoOrder()) {
return 0;
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/queue/RenderBucket.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/queue/RenderBucket.java
index d3a4c53..c2c69c4 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/queue/RenderBucket.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/queue/RenderBucket.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/queue/RenderBucketType.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/queue/RenderBucketType.java
index d5f881d..a5547dd 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/queue/RenderBucketType.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/queue/RenderBucketType.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -28,7 +28,7 @@ public final class RenderBucketType {
return bucketType;
}
- private static final Map<String, RenderBucketType> bucketTypeMap = new HashMap<String, RenderBucketType>();
+ private static final Map<String, RenderBucketType> bucketTypeMap = new HashMap<>();
private final String name;
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/queue/RenderQueue.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/queue/RenderQueue.java
index facd51c..7f333fd 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/queue/RenderQueue.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/queue/RenderQueue.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -10,6 +10,7 @@
package com.ardor3d.renderer.queue;
+import java.util.LinkedHashMap;
import java.util.Map;
import com.ardor3d.renderer.Renderer;
@@ -18,11 +19,10 @@ import com.ardor3d.scenegraph.Mesh;
import com.ardor3d.scenegraph.Spatial;
import com.ardor3d.util.Ardor3dException;
import com.ardor3d.util.Constants;
-import com.google.common.collect.Maps;
public class RenderQueue {
- private final Map<RenderBucketType, RenderBucket> renderBuckets = Maps.newLinkedHashMap();
+ private final Map<RenderBucketType, RenderBucket> renderBuckets = new LinkedHashMap<>();
public RenderQueue() {
setupDefaultBuckets();
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/queue/TransparentRenderBucket.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/queue/TransparentRenderBucket.java
index fe3e73d..c655941 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/queue/TransparentRenderBucket.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/queue/TransparentRenderBucket.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -16,10 +16,10 @@ import com.ardor3d.renderer.ContextManager;
import com.ardor3d.renderer.RenderContext;
import com.ardor3d.renderer.Renderer;
import com.ardor3d.renderer.state.CullState;
-import com.ardor3d.renderer.state.RenderState;
-import com.ardor3d.renderer.state.ZBufferState;
import com.ardor3d.renderer.state.CullState.Face;
+import com.ardor3d.renderer.state.RenderState;
import com.ardor3d.renderer.state.RenderState.StateType;
+import com.ardor3d.renderer.state.ZBufferState;
import com.ardor3d.scenegraph.Mesh;
import com.ardor3d.scenegraph.Spatial;
import com.ardor3d.scenegraph.hint.TransparencyType;
@@ -120,6 +120,7 @@ public class TransparentRenderBucket extends AbstractRenderBucket {
}
private class TransparentComparator implements Comparator<Spatial> {
+ @Override
public int compare(final Spatial o1, final Spatial o2) {
final double d1 = distanceToCam(o1);
final double d2 = distanceToCam(o2);
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/BlendState.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/BlendState.java
index a8a638b..44ab9cc 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/BlendState.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/BlendState.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/ClipState.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/ClipState.java
index 5d9adb8..281cdf5 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/ClipState.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/ClipState.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/ColorMaskState.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/ColorMaskState.java
index 1ca3504..6dac657 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/ColorMaskState.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/ColorMaskState.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/CullState.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/CullState.java
index 62d47fc..35629b2 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/CullState.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/CullState.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/FogState.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/FogState.java
index 610742e..c2ffb0e 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/FogState.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/FogState.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/FragmentProgramState.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/FragmentProgramState.java
index 13b6f6d..e5cba5e 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/FragmentProgramState.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/FragmentProgramState.java
@@ -1,9 +1,9 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* 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>.
*/
@@ -39,7 +39,7 @@ public class FragmentProgramState extends RenderState {
/**
* <code>setEnvParameter</code> sets an environmental fragment program parameter that is accessable by all fragment
* programs in memory.
- *
+ *
* @param param
* four-element array of floating point numbers
* @param paramID
@@ -50,7 +50,7 @@ public class FragmentProgramState extends RenderState {
* public static void setEnvParameter(float[] param, int paramID){ if (paramID < 0 || paramID > 95) throw new
* IllegalArgumentException("Invalid parameter ID"); if (param != null && param.length != 4) throw new
* IllegalArgumentException("Vertex program parameters must be of type float[4]");
- *
+ *
* envparameters[paramID] = param; }
*/
@@ -60,7 +60,7 @@ public class FragmentProgramState extends RenderState {
/**
* <code>setParameter</code> sets a parameter for this fragment program.
- *
+ *
* @param paramID
* identity number of the parameter, ranging from 0 to 23
* @param param
@@ -86,14 +86,12 @@ public class FragmentProgramState extends RenderState {
/**
* Loads the fragment program into a byte array.
- *
+ *
* @see com.ardor3d.renderer.state.FragmentProgramState#load(java.net.URL)
*/
public void load(final java.net.URL file) {
- InputStream inputStream = null;
- try {
- final ByteArrayOutputStream outputStream = new ByteArrayOutputStream(16 * 1024);
- inputStream = new BufferedInputStream(file.openStream());
+ try (final ByteArrayOutputStream outputStream = new ByteArrayOutputStream(16 * 1024);
+ final InputStream inputStream = new BufferedInputStream(file.openStream())) {
final byte[] buffer = new byte[1024];
int byteCount = -1;
@@ -107,7 +105,6 @@ public class FragmentProgramState extends RenderState {
// Release resources
inputStream.close();
- outputStream.close();
program = BufferUtils.createByteBuffer(data.length);
program.put(data);
@@ -117,21 +114,12 @@ public class FragmentProgramState extends RenderState {
} catch (final Exception e) {
logger.severe("Could not load fragment program: " + e);
logger.logp(Level.SEVERE, getClass().getName(), "load(URL)", "Exception", e);
- } finally {
- // Ensure that the stream is closed, even if there is an exception.
- if (inputStream != null) {
- try {
- inputStream.close();
- } catch (final IOException closeFailure) {
- logger.log(Level.WARNING, "Failed to close the fragment program", closeFailure);
- }
- }
}
}
/**
* Loads the fragment program into a byte array.
- *
+ *
* @see com.ardor3d.renderer.state.FragmentProgramState#load(java.net.URL)
*/
public void load(final String programContents) {
@@ -170,7 +158,7 @@ public class FragmentProgramState extends RenderState {
/**
* Used with Serialization. Do not call this directly.
- *
+ *
* @param s
* @throws IOException
* @see java.io.Serializable
@@ -190,7 +178,7 @@ public class FragmentProgramState extends RenderState {
/**
* Used with Serialization. Do not call this directly.
- *
+ *
* @param s
* @throws IOException
* @throws ClassNotFoundException
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/GLSLShaderDataLogic.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/GLSLShaderDataLogic.java
index a2a5036..e514e63 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/GLSLShaderDataLogic.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/GLSLShaderDataLogic.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/GLSLShaderObjectsState.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/GLSLShaderObjectsState.java
index ce4c799..d9ababd 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/GLSLShaderObjectsState.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/GLSLShaderObjectsState.java
@@ -1,9 +1,9 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* 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,11 +70,11 @@ public class GLSLShaderObjectsState extends RenderState {
private static final Logger logger = Logger.getLogger(GLSLShaderObjectsState.class.getName());
/** Storage for shader uniform values */
- protected List<ShaderVariable> _shaderUniforms = new ArrayList<ShaderVariable>();
+ protected List<ShaderVariable> _shaderUniforms = new ArrayList<>();
/** Storage for shader attribute values */
- protected List<ShaderVariable> _shaderAttributes = new ArrayList<ShaderVariable>();
+ protected List<ShaderVariable> _shaderAttributes = new ArrayList<>();
- protected ByteBuffer _vertShader, _fragShader, _geomShader, _tessControlShader, _tessEvalShader;
+ protected ByteBuffer _vertShader, _fragShader, _geomShader, _tessControlShader, _tessEvalShader, _compShader;
// XXX: The below fields are public for brevity mostly as a way to remember that this class needs revisiting.
@@ -107,6 +107,9 @@ public class GLSLShaderObjectsState extends RenderState {
/** OpenGL id for the attached tessellation evaluation shader. */
public int _tessellationEvaluationShaderID = -1;
+ /** OpenGL id for the attached compute shader. */
+ public int _computeShaderID = -1;
+
/** if true, we'll send our vertex attributes to the shader via vbo */
private boolean _useAttributeVBO;
@@ -125,9 +128,12 @@ public class GLSLShaderObjectsState extends RenderState {
/** optional name for our tessellation evaluation shader, used for debugging details. */
public String _tessellationEvaluationShaderName;
+ /** optional name for our compute shader, used for debugging details. */
+ public String _computeShaderName;
+
/**
* Gets the currently loaded vertex shader.
- *
+ *
* @return
*/
public ByteBuffer getVertexShader() {
@@ -136,7 +142,7 @@ public class GLSLShaderObjectsState extends RenderState {
/**
* Gets the currently loaded fragment shader.
- *
+ *
* @return
*/
public ByteBuffer getFragmentShader() {
@@ -145,7 +151,7 @@ public class GLSLShaderObjectsState extends RenderState {
/**
* Gets the currently loaded geometry shader.
- *
+ *
* @return
*/
public ByteBuffer getGeometryShader() {
@@ -154,7 +160,7 @@ public class GLSLShaderObjectsState extends RenderState {
/**
* Gets the currently loaded tessellation control shader.
- *
+ *
* @return
*/
public ByteBuffer getTessellationControlShader() {
@@ -163,13 +169,22 @@ public class GLSLShaderObjectsState extends RenderState {
/**
* Gets the currently loaded tessellation evaluation shader.
- *
+ *
* @return
*/
public ByteBuffer getTessellationEvaluationShader() {
return _tessEvalShader;
}
+ /**
+ * Gets the currently loaded compute shader.
+ *
+ * @return
+ */
+ public ByteBuffer getComputeShader() {
+ return _compShader;
+ }
+
public void setVertexShader(final InputStream stream) throws IOException {
setVertexShader(stream, "");
}
@@ -215,35 +230,30 @@ public class GLSLShaderObjectsState extends RenderState {
_tessellationEvaluationShaderName = name;
}
+ public void setComputeShader(final InputStream stream) throws IOException {
+ setComputeShader(stream, "");
+ }
+
+ public void setComputeShader(final InputStream stream, final String name) throws IOException {
+ setComputeShader(load(stream));
+ _computeShaderName = name;
+ }
+
protected ByteBuffer load(final InputStream in) throws IOException {
- DataInputStream dataStream = null;
- try {
- final BufferedInputStream bufferedInputStream = new BufferedInputStream(in);
- dataStream = new DataInputStream(bufferedInputStream);
+ try (final BufferedInputStream bufferedInputStream = new BufferedInputStream(in);
+ final DataInputStream dataStream = new DataInputStream(bufferedInputStream)) {
final byte shaderCode[] = new byte[bufferedInputStream.available()];
dataStream.readFully(shaderCode);
- bufferedInputStream.close();
- dataStream.close();
final ByteBuffer shaderByteBuffer = BufferUtils.createByteBuffer(shaderCode.length);
shaderByteBuffer.put(shaderCode);
shaderByteBuffer.rewind();
-
return shaderByteBuffer;
- } finally {
- // Ensure that the stream is closed, even if there is an exception.
- if (dataStream != null) {
- try {
- dataStream.close();
- } catch (final IOException closeFailure) {
- logger.log(Level.WARNING, "Failed to close the shader object", closeFailure);
- }
- }
}
}
/**
* Set the contents for our vertex shader
- *
+ *
* @param shader
* the shader contents.
*/
@@ -253,7 +263,7 @@ public class GLSLShaderObjectsState extends RenderState {
/**
* Set the contents for our vertex shader
- *
+ *
* @param shader
* the shader contents.
* @param name
@@ -266,7 +276,7 @@ public class GLSLShaderObjectsState extends RenderState {
/**
* Set the contents for our fragment shader
- *
+ *
* @param shader
* the shader contents.
*/
@@ -276,7 +286,7 @@ public class GLSLShaderObjectsState extends RenderState {
/**
* Set the contents for our fragment shader
- *
+ *
* @param shader
* the shader contents.
* @param name
@@ -289,7 +299,7 @@ public class GLSLShaderObjectsState extends RenderState {
/**
* Set the contents for our geometry shader
- *
+ *
* @param shader
* the shader contents.
*/
@@ -299,7 +309,7 @@ public class GLSLShaderObjectsState extends RenderState {
/**
* Set the contents for our geometry shader
- *
+ *
* @param shader
* the shader contents.
* @param name
@@ -312,7 +322,7 @@ public class GLSLShaderObjectsState extends RenderState {
/**
* Set the contents for our tessellation control shader
- *
+ *
* @param shader
* the shader contents.
*/
@@ -322,7 +332,7 @@ public class GLSLShaderObjectsState extends RenderState {
/**
* Set the contents for our tessellation control shader
- *
+ *
* @param shader
* the shader contents.
* @param name
@@ -335,7 +345,7 @@ public class GLSLShaderObjectsState extends RenderState {
/**
* Set the contents for our tessellation evaluation shader
- *
+ *
* @param shader
* the shader contents.
*/
@@ -345,7 +355,7 @@ public class GLSLShaderObjectsState extends RenderState {
/**
* Set the contents for our tessellation evaluation shader
- *
+ *
* @param shader
* the shader contents.
* @param name
@@ -357,8 +367,31 @@ public class GLSLShaderObjectsState extends RenderState {
}
/**
+ * Set the contents for our compute shader
+ *
+ * @param shader
+ * the shader contents.
+ */
+ public void setComputeShader(final ByteBuffer shader) {
+ setComputeShader(shader, "");
+ }
+
+ /**
+ * Set the contents for our compute shader
+ *
+ * @param shader
+ * the shader contents.
+ * @param name
+ * a label for this shader, displayer upon shader errors.
+ */
+ public void setComputeShader(final ByteBuffer shader, final String name) {
+ _compShader = shader;
+ _computeShaderName = name;
+ }
+
+ /**
* Set the contents for our vertex shader
- *
+ *
* @param shader
* the shader contents.
*/
@@ -368,7 +401,7 @@ public class GLSLShaderObjectsState extends RenderState {
/**
* Set the contents for our vertex shader
- *
+ *
* @param shader
* the shader contents.
* @param name
@@ -381,7 +414,7 @@ public class GLSLShaderObjectsState extends RenderState {
/**
* Set the contents for our fragment shader
- *
+ *
* @param shader
* the shader contents.
*/
@@ -391,7 +424,7 @@ public class GLSLShaderObjectsState extends RenderState {
/**
* Set the contents for our fragment shader
- *
+ *
* @param shader
* the shader contents.
* @param name
@@ -404,7 +437,7 @@ public class GLSLShaderObjectsState extends RenderState {
/**
* Set the contents for our geometry shader
- *
+ *
* @param shader
* the shader contents.
*/
@@ -414,7 +447,7 @@ public class GLSLShaderObjectsState extends RenderState {
/**
* Set the contents for our geometry shader
- *
+ *
* @param shader
* the shader contents.
* @param name
@@ -427,7 +460,7 @@ public class GLSLShaderObjectsState extends RenderState {
/**
* Set the contents for our tessellation control shader
- *
+ *
* @param shader
* the shader contents.
*/
@@ -437,7 +470,7 @@ public class GLSLShaderObjectsState extends RenderState {
/**
* Set the contents for our tessellation control shader
- *
+ *
* @param shader
* the shader contents.
* @param name
@@ -450,7 +483,7 @@ public class GLSLShaderObjectsState extends RenderState {
/**
* Set the contents for our tessellation evaluation shader
- *
+ *
* @param shader
* the shader contents.
*/
@@ -460,7 +493,7 @@ public class GLSLShaderObjectsState extends RenderState {
/**
* Set the contents for our tessellation evaluation shader
- *
+ *
* @param shader
* the shader contents.
* @param name
@@ -471,6 +504,29 @@ public class GLSLShaderObjectsState extends RenderState {
_tessellationEvaluationShaderName = name;
}
+ /**
+ * Set the contents for our compute shader
+ *
+ * @param shader
+ * the shader contents.
+ */
+ public void setComputeShader(final String shader) {
+ setComputeShader(shader, "");
+ }
+
+ /**
+ * Set the contents for our compute shader
+ *
+ * @param shader
+ * the shader contents.
+ * @param name
+ * a label for this shader, displayer upon shader errors.
+ */
+ public void setComputeShader(final String shader, final String name) {
+ _compShader = stringToByteBuffer(shader);
+ _computeShaderName = name;
+ }
+
private ByteBuffer stringToByteBuffer(final String str) {
final byte[] bytes = str.getBytes();
final ByteBuffer buf = BufferUtils.createByteBuffer(bytes.length);
@@ -481,7 +537,7 @@ public class GLSLShaderObjectsState extends RenderState {
/**
* Gets all shader uniforms variables.
- *
+ *
* @return
*/
public List<ShaderVariable> getShaderUniforms() {
@@ -490,7 +546,7 @@ public class GLSLShaderObjectsState extends RenderState {
/**
* Retrieves a shader uniform by name.
- *
+ *
* @param uniformName
* @return
*/
@@ -506,7 +562,7 @@ public class GLSLShaderObjectsState extends RenderState {
/**
* Gets all shader attribute variables.
- *
+ *
* @return
*/
public List<ShaderVariable> getShaderAttributes() {
@@ -515,7 +571,7 @@ public class GLSLShaderObjectsState extends RenderState {
/**
* Retrieves a shader attribute by name.
- *
+ *
* @param uniformName
* @return
*/
@@ -530,7 +586,7 @@ public class GLSLShaderObjectsState extends RenderState {
}
/**
- *
+ *
* @param meshData
*/
public void setMesh(final Mesh mesh) {
@@ -539,7 +595,7 @@ public class GLSLShaderObjectsState extends RenderState {
/**
* Logic to handle setting mesh-specific data to a shader before rendering
- *
+ *
* @param shaderDataLogic
*/
public void setShaderDataLogic(final GLSLShaderDataLogic shaderDataLogic) {
@@ -564,7 +620,7 @@ public class GLSLShaderObjectsState extends RenderState {
/**
* Set an uniform value for this shader object.
- *
+ *
* @param name
* uniform variable to change
* @param value
@@ -579,7 +635,7 @@ public class GLSLShaderObjectsState extends RenderState {
/**
* Set an uniform value for this shader object.
- *
+ *
* @param name
* uniform variable to change
* @param value
@@ -594,7 +650,7 @@ public class GLSLShaderObjectsState extends RenderState {
/**
* Set an uniform value for this shader object.
- *
+ *
* @param name
* uniform variable to change
* @param value
@@ -609,7 +665,7 @@ public class GLSLShaderObjectsState extends RenderState {
/**
* Set an uniform value for this shader object.
- *
+ *
* @param name
* uniform variable to change
* @param value1
@@ -627,7 +683,7 @@ public class GLSLShaderObjectsState extends RenderState {
/**
* Set an uniform value for this shader object.
- *
+ *
* @param name
* uniform variable to change
* @param value1
@@ -645,7 +701,7 @@ public class GLSLShaderObjectsState extends RenderState {
/**
* Set an uniform value for this shader object.
- *
+ *
* @param name
* uniform variable to change
* @param value1
@@ -663,7 +719,7 @@ public class GLSLShaderObjectsState extends RenderState {
/**
* Set an uniform value for this shader object.
- *
+ *
* @param name
* uniform variable to change
* @param value1
@@ -684,7 +740,7 @@ public class GLSLShaderObjectsState extends RenderState {
/**
* Set an uniform value for this shader object.
- *
+ *
* @param name
* uniform variable to change
* @param value1
@@ -705,7 +761,7 @@ public class GLSLShaderObjectsState extends RenderState {
/**
* Set an uniform value for this shader object.
- *
+ *
* @param name
* uniform variable to change
* @param value1
@@ -726,7 +782,7 @@ public class GLSLShaderObjectsState extends RenderState {
/**
* Set an uniform value for this shader object.
- *
+ *
* @param name
* uniform variable to change
* @param value1
@@ -751,7 +807,7 @@ public class GLSLShaderObjectsState extends RenderState {
/**
* Set an uniform value for this shader object.
- *
+ *
* @param name
* uniform variable to change
* @param value1
@@ -775,7 +831,7 @@ public class GLSLShaderObjectsState extends RenderState {
/**
* Set an uniform value for this shader object.
- *
+ *
* @param name
* uniform variable to change
* @param value1
@@ -800,7 +856,7 @@ public class GLSLShaderObjectsState extends RenderState {
/**
* Set an uniform value for this shader object.
- *
+ *
* @param name
* uniform variable to change
* @param value
@@ -819,7 +875,7 @@ public class GLSLShaderObjectsState extends RenderState {
/**
* Set an uniform value for this shader object.
- *
+ *
* @param name
* uniform variable to change
* @param value
@@ -834,7 +890,7 @@ public class GLSLShaderObjectsState extends RenderState {
/**
* Set an uniform value for this shader object.
- *
+ *
* @param name
* uniform variable to change
* @param value
@@ -849,7 +905,7 @@ public class GLSLShaderObjectsState extends RenderState {
/**
* Set an uniform value for this shader object.
- *
+ *
* @param name
* uniform variable to change
* @param value
@@ -864,7 +920,7 @@ public class GLSLShaderObjectsState extends RenderState {
/**
* Set an uniform value for this shader object.
- *
+ *
* @param name
* uniform variable to change
* @param value
@@ -880,7 +936,7 @@ public class GLSLShaderObjectsState extends RenderState {
/**
* Set an uniform value for this shader object.
- *
+ *
* @param name
* uniform variable to change
* @param value
@@ -897,7 +953,7 @@ public class GLSLShaderObjectsState extends RenderState {
/**
* Set an uniform value for this shader object.
- *
+ *
* @param name
* uniform variable to change
* @param value
@@ -915,7 +971,7 @@ public class GLSLShaderObjectsState extends RenderState {
/**
* Set an uniform value for this shader object.
- *
+ *
* @param name
* uniform variable to change
* @param value
@@ -933,7 +989,7 @@ public class GLSLShaderObjectsState extends RenderState {
/**
* Set an uniform value for this shader object.
- *
+ *
* @param name
* uniform variable to change
* @param value
@@ -951,7 +1007,7 @@ public class GLSLShaderObjectsState extends RenderState {
/**
* Set an uniform value for this shader object.
- *
+ *
* @param name
* uniform variable to change
* @param value
@@ -973,7 +1029,7 @@ public class GLSLShaderObjectsState extends RenderState {
/**
* Set an uniform value for this shader object.
- *
+ *
* @param name
* uniform variable to change
* @param value
@@ -995,7 +1051,7 @@ public class GLSLShaderObjectsState extends RenderState {
/**
* Set an uniform value for this shader object.
- *
+ *
* @param name
* uniform Matrix4 variable to change
* @param value
@@ -1015,7 +1071,7 @@ public class GLSLShaderObjectsState extends RenderState {
/**
* Set an uniform value for this shader object.
- *
+ *
* @param name
* uniform variable to change
* @param value
@@ -1051,7 +1107,7 @@ public class GLSLShaderObjectsState extends RenderState {
/**
* Set an attribute pointer value for this shader object.
- *
+ *
* @param name
* attribute variable to change
* @param size
@@ -1079,7 +1135,7 @@ public class GLSLShaderObjectsState extends RenderState {
/**
* Set an attribute pointer value for this shader object.
- *
+ *
* @param name
* attribute variable to change
* @param size
@@ -1103,7 +1159,7 @@ public class GLSLShaderObjectsState extends RenderState {
/**
* Set an attribute pointer value for this shader object.
- *
+ *
* @param name
* attribute variable to change
* @param size
@@ -1120,8 +1176,8 @@ public class GLSLShaderObjectsState extends RenderState {
* @param data
* The actual data to use as attribute pointer
*/
- public void setAttributePointer(final String name, final int size, final boolean normalized,
- final boolean unsigned, final int stride, final ByteBufferData data) {
+ public void setAttributePointer(final String name, final int size, final boolean normalized, final boolean unsigned,
+ final int stride, final ByteBufferData data) {
final ShaderVariablePointerByte shaderUniform = getShaderAttribute(name, ShaderVariablePointerByte.class);
shaderUniform.size = size;
shaderUniform.normalized = normalized;
@@ -1134,7 +1190,7 @@ public class GLSLShaderObjectsState extends RenderState {
/**
* Set an attribute pointer value for this shader object.
- *
+ *
* @param name
* attribute variable to change
* @param size
@@ -1151,8 +1207,8 @@ public class GLSLShaderObjectsState extends RenderState {
* @param data
* The actual data to use as attribute pointer
*/
- public void setAttributePointer(final String name, final int size, final boolean normalized,
- final boolean unsigned, final int stride, final IntBufferData data) {
+ public void setAttributePointer(final String name, final int size, final boolean normalized, final boolean unsigned,
+ final int stride, final IntBufferData data) {
final ShaderVariablePointerInt shaderUniform = getShaderAttribute(name, ShaderVariablePointerInt.class);
shaderUniform.size = size;
shaderUniform.normalized = normalized;
@@ -1165,7 +1221,7 @@ public class GLSLShaderObjectsState extends RenderState {
/**
* Set an attribute pointer value for this shader object.
- *
+ *
* @param name
* attribute variable to change
* @param size
@@ -1182,8 +1238,8 @@ public class GLSLShaderObjectsState extends RenderState {
* @param data
* The actual data to use as attribute pointer
*/
- public void setAttributePointer(final String name, final int size, final boolean normalized,
- final boolean unsigned, final int stride, final ShortBufferData data) {
+ public void setAttributePointer(final String name, final int size, final boolean normalized, final boolean unsigned,
+ final int stride, final ShortBufferData data) {
final ShaderVariablePointerShort shaderUniform = getShaderAttribute(name, ShaderVariablePointerShort.class);
shaderUniform.size = size;
shaderUniform.normalized = normalized;
@@ -1208,7 +1264,7 @@ public class GLSLShaderObjectsState extends RenderState {
/**
* Creates or retrieves a uniform shadervariable.
- *
+ *
* @param name
* Name of the uniform shadervariable to retrieve or create
* @param classz
@@ -1222,7 +1278,7 @@ public class GLSLShaderObjectsState extends RenderState {
/**
* Creates or retrieves a attribute shadervariable.
- *
+ *
* @param name
* Name of the attribute shadervariable to retrieve or create
* @param classz
@@ -1262,11 +1318,11 @@ public class GLSLShaderObjectsState extends RenderState {
return shaderUniform;
} catch (final InstantiationException e) {
- logger.logp(Level.SEVERE, this.getClass().toString(),
- "getShaderVariable(name, classz, shaderVariableList)", "Exception", e);
+ logger.logp(Level.SEVERE, this.getClass().toString(), "getShaderVariable(name, classz, shaderVariableList)",
+ "Exception", e);
} catch (final IllegalAccessException e) {
- logger.logp(Level.SEVERE, this.getClass().toString(),
- "getShaderVariable(name, classz, shaderVariableList)", "Exception", e);
+ logger.logp(Level.SEVERE, this.getClass().toString(), "getShaderVariable(name, classz, shaderVariableList)",
+ "Exception", e);
}
return null;
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/LightState.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/LightState.java
index a5ce713..5224c13 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/LightState.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/LightState.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -95,7 +95,7 @@ public class LightState extends RenderState {
* Constructor instantiates a new <code>LightState</code> object. Initially there are no lights set.
*/
public LightState() {
- lightList = new ArrayList<Light>();
+ lightList = new ArrayList<>();
}
@Override
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/LightUtil.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/LightUtil.java
index 112a955..291ab3e 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/LightUtil.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/LightUtil.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -32,6 +32,7 @@ public abstract class LightUtil {
_sp = sp;
}
+ @Override
public int compare(final Light l1, final Light l2) {
final double v1 = getValueFor(l1, _sp.getWorldBound());
final double v2 = getValueFor(l2, _sp.getWorldBound());
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/MaterialState.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/MaterialState.java
index 5591212..eb361da 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/MaterialState.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/MaterialState.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/OffsetState.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/OffsetState.java
index b6d0699..5279f25 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/OffsetState.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/OffsetState.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/RenderState.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/RenderState.java
index 560daf7..62267b3 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/RenderState.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/RenderState.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -24,7 +24,6 @@ import com.ardor3d.util.Constants;
import com.ardor3d.util.export.InputCapsule;
import com.ardor3d.util.export.OutputCapsule;
import com.ardor3d.util.export.Savable;
-import com.google.common.collect.Maps;
/**
* <code>RenderState</code> is the base class for all states that affect the rendering of a piece of geometry. They
@@ -96,8 +95,8 @@ public abstract class RenderState implements Savable {
static public class StateStack implements Poolable {
- private final EnumMap<RenderState.StateType, Stack<RenderState>> stacks = Maps
- .newEnumMap(RenderState.StateType.class);
+ private final EnumMap<RenderState.StateType, Stack<RenderState>> stacks = new EnumMap<>(
+ RenderState.StateType.class);
public StateStack() {}
@@ -123,7 +122,7 @@ public abstract class RenderState implements Savable {
public void push(final RenderState state) {
Stack<RenderState> stack = stacks.get(state.getType());
if (stack == null) {
- stack = new Stack<RenderState>();
+ stack = new Stack<>();
stacks.put(state.getType(), stack);
}
stack.push(state);
@@ -196,14 +195,17 @@ public abstract class RenderState implements Savable {
return stack.peek();
}
+ @Override
public void write(final OutputCapsule capsule) throws IOException {
capsule.write(_enabled, "enabled", true);
}
+ @Override
public void read(final InputCapsule capsule) throws IOException {
_enabled = capsule.readBoolean("enabled", true);
}
+ @Override
public Class<? extends RenderState> getClassTag() {
return this.getClass();
}
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/ShadingState.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/ShadingState.java
index c0fa922..9827dfb 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/ShadingState.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/ShadingState.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/StencilState.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/StencilState.java
index 55b2b9d..586243f 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/StencilState.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/StencilState.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/TextureState.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/TextureState.java
index 9b8d4ea..37a0653 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/TextureState.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/TextureState.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -62,7 +62,7 @@ public class TextureState extends RenderState {
}
/** The texture(s). */
- protected List<Texture> _texture = new ArrayList<Texture>(1);
+ protected List<Texture> _texture = new ArrayList<>(1);
/**
* Perspective correction to use for the object rendered with this texture state. Default is
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/VertexProgramState.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/VertexProgramState.java
index 44e49b4..e5eafa6 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/VertexProgramState.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/VertexProgramState.java
@@ -1,9 +1,9 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* 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 VertexProgramState extends RenderState {
/**
* <code>setEnvParameter</code> sets an environmental vertex program parameter that is accessible by all vertex
* programs in memory.
- *
+ *
* @param param
* four-element array of floating point numbers
* @param paramID
@@ -72,7 +72,7 @@ public class VertexProgramState extends RenderState {
/**
* <code>setParameter</code> sets a parameter for this vertex program.
- *
+ *
* @param paramID
* identity number of the parameter, ranging from 0 to 95
* @param param
@@ -97,10 +97,8 @@ public class VertexProgramState extends RenderState {
}
public void load(final java.net.URL file) {
- InputStream inputStream = null;
- try {
- final ByteArrayOutputStream outputStream = new ByteArrayOutputStream(16 * 1024);
- inputStream = new BufferedInputStream(file.openStream());
+ try (final ByteArrayOutputStream outputStream = new ByteArrayOutputStream(16 * 1024);
+ final InputStream inputStream = new BufferedInputStream(file.openStream())) {
final byte[] buffer = new byte[1024];
int byteCount = -1;
@@ -112,10 +110,6 @@ public class VertexProgramState extends RenderState {
// Set data with byte content from stream
final byte[] data = outputStream.toByteArray();
- // Release resources
- inputStream.close();
- outputStream.close();
-
_program = BufferUtils.createByteBuffer(data.length);
_program.put(data);
_program.rewind();
@@ -125,22 +119,12 @@ public class VertexProgramState extends RenderState {
} catch (final Exception e) {
logger.severe("Could not load vertex program: " + e);
logger.logp(Level.SEVERE, getClass().getName(), "load(URL)", "Exception", e);
- } finally {
- // Ensure that the stream is closed, even if there is an exception.
- if (inputStream != null) {
- try {
- inputStream.close();
- } catch (final IOException closeFailure) {
- logger.log(Level.WARNING, "Failed to close the vertex program", closeFailure);
- }
- }
-
}
}
/**
* Loads the vertex program into a byte array.
- *
+ *
* @see com.ardor3d.renderer.state.VertexProgramState#load(java.net.URL)
*/
public void load(final String programContents) {
@@ -184,7 +168,7 @@ public class VertexProgramState extends RenderState {
/**
* Used with Serialization. Do not call this directly.
- *
+ *
* @param s
* @throws IOException
* @see java.io.Serializable
@@ -204,7 +188,7 @@ public class VertexProgramState extends RenderState {
/**
* Used with Serialization. Do not call this directly.
- *
+ *
* @param s
* @throws IOException
* @throws ClassNotFoundException
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/WireframeState.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/WireframeState.java
index db92612..27a67a4 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/WireframeState.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/WireframeState.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/ZBufferState.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/ZBufferState.java
index b3ee5d8..84449e5 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/ZBufferState.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/ZBufferState.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/BlendStateRecord.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/BlendStateRecord.java
index 4687bba..dc1ee42 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/BlendStateRecord.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/BlendStateRecord.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/ClipStateRecord.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/ClipStateRecord.java
index 2c5a5ad..3d006a2 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/ClipStateRecord.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/ClipStateRecord.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/ColorMaskStateRecord.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/ColorMaskStateRecord.java
index 559050a..00ef738 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/ColorMaskStateRecord.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/ColorMaskStateRecord.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/CullStateRecord.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/CullStateRecord.java
index 55a39f8..b496aa5 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/CullStateRecord.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/CullStateRecord.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/FogStateRecord.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/FogStateRecord.java
index 7217f88..6617c90 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/FogStateRecord.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/FogStateRecord.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/FragmentProgramStateRecord.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/FragmentProgramStateRecord.java
index 3c5e6bc..1ecdbe8 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/FragmentProgramStateRecord.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/FragmentProgramStateRecord.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/LightRecord.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/LightRecord.java
index cee7c73..6702554 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/LightRecord.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/LightRecord.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/LightStateRecord.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/LightStateRecord.java
index 3a04e45..f640f51 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/LightStateRecord.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/LightStateRecord.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -18,7 +18,7 @@ import com.ardor3d.math.ColorRGBA;
import com.ardor3d.util.geom.BufferUtils;
public class LightStateRecord extends StateRecord {
- private final List<LightRecord> lightList = new ArrayList<LightRecord>();
+ private final List<LightRecord> lightList = new ArrayList<>();
private int lightMask;
private int backLightMask;
private boolean twoSidedOn;
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/LineRecord.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/LineRecord.java
index 64a1c1b..7804a59 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/LineRecord.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/LineRecord.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
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 a61c5e0..c1a12e2 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
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/OffsetStateRecord.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/OffsetStateRecord.java
index b982024..75052ab 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/OffsetStateRecord.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/OffsetStateRecord.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/RendererRecord.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/RendererRecord.java
index 9f51cbc..e66f591 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/RendererRecord.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/RendererRecord.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -26,7 +26,7 @@ public class RendererRecord extends StateRecord {
private boolean _clippingTestEnabled;
private transient final ColorRGBA _tempColor = new ColorRGBA();
private DrawBufferTarget _drawBufferTarget = null;
- private final Stack<ReadOnlyRectangle2> _clips = new Stack<ReadOnlyRectangle2>();
+ private final Stack<ReadOnlyRectangle2> _clips = new Stack<>();
private int _normalMode = -1; // signifies disabled
private int _enabledTextures = 0;
private boolean _texturesValid = false;
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/ShaderObjectsStateRecord.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/ShaderObjectsStateRecord.java
index b542051..dc012ef 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/ShaderObjectsStateRecord.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/ShaderObjectsStateRecord.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -10,11 +10,11 @@
package com.ardor3d.renderer.state.record;
+import java.util.ArrayList;
import java.util.List;
import com.ardor3d.renderer.state.GLSLShaderObjectsState;
import com.ardor3d.util.shader.ShaderVariable;
-import com.google.common.collect.Lists;
public class ShaderObjectsStateRecord extends StateRecord {
// XXX NOTE: This is non-standard. Due to the fact that shader implementations
@@ -22,7 +22,7 @@ public class ShaderObjectsStateRecord extends StateRecord {
// XXX checking system.
GLSLShaderObjectsState reference = null;
- public List<ShaderVariable> enabledAttributes = Lists.newArrayList();
+ public List<ShaderVariable> enabledAttributes = new ArrayList<>();
public int shaderId = -1;
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/ShadingStateRecord.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/ShadingStateRecord.java
index a561eed..0ada9b3 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/ShadingStateRecord.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/ShadingStateRecord.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/StateRecord.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/StateRecord.java
index 1c6aead..1b47cd1 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/StateRecord.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/StateRecord.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/StencilStateRecord.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/StencilStateRecord.java
index de76d39..7e2362a 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/StencilStateRecord.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/StencilStateRecord.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/TextureRecord.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/TextureRecord.java
index 3baf5d5..7ed8ac2 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/TextureRecord.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/TextureRecord.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/TextureStateRecord.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/TextureStateRecord.java
index 062c555..095744f 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/TextureStateRecord.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/TextureStateRecord.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -20,7 +20,6 @@ import com.ardor3d.math.Vector3;
import com.ardor3d.math.type.ReadOnlyVector4;
import com.ardor3d.renderer.state.TextureState;
import com.ardor3d.util.geom.BufferUtils;
-import com.google.common.collect.Maps;
public class TextureStateRecord extends StateRecord {
@@ -47,7 +46,7 @@ public class TextureStateRecord extends StateRecord {
public final DoubleBuffer tmp_matrixBuffer = BufferUtils.createDoubleBuffer(16);
public TextureStateRecord() {
- textures = Maps.newHashMap();
+ textures = new HashMap<>();
units = new TextureUnitRecord[TextureState.MAX_TEXTURES];
for (int i = 0; i < units.length; i++) {
units[i] = new TextureUnitRecord();
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/TextureUnitRecord.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/TextureUnitRecord.java
index 64a0133..0a33b6b 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/TextureUnitRecord.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/TextureUnitRecord.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/VertexProgramStateRecord.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/VertexProgramStateRecord.java
index f630739..366db9d 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/VertexProgramStateRecord.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/VertexProgramStateRecord.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/WireframeStateRecord.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/WireframeStateRecord.java
index 1f27367..ebcb6b9 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/WireframeStateRecord.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/WireframeStateRecord.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/ZBufferStateRecord.java b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/ZBufferStateRecord.java
index 88c63c1..1e881bd 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/ZBufferStateRecord.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/renderer/state/record/ZBufferStateRecord.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/AbstractBufferData.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/AbstractBufferData.java
index 9274fb0..817a8df 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/AbstractBufferData.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/AbstractBufferData.java
@@ -1,9 +1,9 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* 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>.
*/
@@ -15,6 +15,7 @@ import java.lang.ref.ReferenceQueue;
import java.nio.Buffer;
import java.util.Map;
import java.util.Set;
+import java.util.WeakHashMap;
import com.ardor3d.renderer.ContextCleanListener;
import com.ardor3d.renderer.ContextManager;
@@ -27,18 +28,18 @@ import com.ardor3d.util.GameTaskQueueManager;
import com.ardor3d.util.export.InputCapsule;
import com.ardor3d.util.export.OutputCapsule;
import com.google.common.collect.ArrayListMultimap;
-import com.google.common.collect.MapMaker;
import com.google.common.collect.Multimap;
public abstract class AbstractBufferData<T extends Buffer> {
- private static Map<AbstractBufferData<?>, Object> _identityCache = new MapMaker().weakKeys().makeMap();
+ private static Map<AbstractBufferData<?>, Object> _identityCache = new WeakHashMap<>();
private static final Object STATIC_REF = new Object();
- private static ReferenceQueue<AbstractBufferData<?>> _vboRefQueue = new ReferenceQueue<AbstractBufferData<?>>();
+ private static ReferenceQueue<AbstractBufferData<?>> _vboRefQueue = new ReferenceQueue<>();
static {
ContextManager.addContextCleanListener(new ContextCleanListener() {
+ @Override
public void cleanForContext(final RenderContext renderContext) {
AbstractBufferData.cleanAllVBOs(null, renderContext);
}
@@ -72,7 +73,7 @@ public abstract class AbstractBufferData<T extends Buffer> {
/**
* Gets the count.
- *
+ *
* @return the count
*/
public int getBufferLimit() {
@@ -85,7 +86,7 @@ public abstract class AbstractBufferData<T extends Buffer> {
/**
* Gets the count.
- *
+ *
* @return the count
*/
public int getBufferCapacity() {
@@ -98,7 +99,7 @@ public abstract class AbstractBufferData<T extends Buffer> {
/**
* Get the buffer holding the data.
- *
+ *
* @return the buffer
*/
public T getBuffer() {
@@ -107,7 +108,7 @@ public abstract class AbstractBufferData<T extends Buffer> {
/**
* Set the buffer holding the data.
- *
+ *
* @param buffer
* the buffer to set
*/
@@ -133,7 +134,7 @@ public abstract class AbstractBufferData<T extends Buffer> {
/**
* Removes any vbo id from this buffer's data for the given OpenGL context.
- *
+ *
* @param glContext
* the object representing the OpenGL context a vbo would belong to. See
* {@link RenderContext#getGlContextRep()}
@@ -149,7 +150,7 @@ public abstract class AbstractBufferData<T extends Buffer> {
/**
* Sets the id for a vbo based on this buffer's data in regards to the given OpenGL context.
- *
+ *
* @param glContextRep
* the object representing the OpenGL context a vbo belongs to. See
* {@link RenderContext#getGlContextRep()}
@@ -164,7 +165,7 @@ public abstract class AbstractBufferData<T extends Buffer> {
}
if (_vboIdCache == null) {
- _vboIdCache = new ContextIdReference<AbstractBufferData<T>>(this, _vboRefQueue);
+ _vboIdCache = new ContextIdReference<>(this, _vboRefQueue);
}
_vboIdCache.put(glContextRep, vboId);
}
@@ -234,7 +235,7 @@ public abstract class AbstractBufferData<T extends Buffer> {
/**
* Clean any VBO ids from the hardware, using the given Renderer object to do the work immediately, if given. If
* not, we will delete in the next execution of the appropriate context's game task render queue.
- *
+ *
* @param deleter
* the Renderer to use. If null, execution will not occur immediately.
*/
@@ -299,8 +300,9 @@ public abstract class AbstractBufferData<T extends Buffer> {
}
// Otherwise, add a delete request to that context's render task queue.
else {
- GameTaskQueueManager.getManager(ContextManager.getContextForRef(glref)).render(
- new RendererCallable<Void>() {
+ GameTaskQueueManager.getManager(ContextManager.getContextForRef(glref))
+ .render(new RendererCallable<Void>() {
+ @Override
public Void call() throws Exception {
getRenderer().deleteVBOs(idMap.get(glref));
return null;
diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/ByteBufferData.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/ByteBufferData.java
index 4091e06..15120e0 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/ByteBufferData.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/ByteBufferData.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -50,6 +50,7 @@ public class ByteBufferData extends IndexBufferData<ByteBuffer> implements Savab
_buffer = buffer;
}
+ @Override
public Class<? extends ByteBufferData> getClassTag() {
return getClass();
}
diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/FloatBufferData.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/FloatBufferData.java
index 19d0a16..a354372 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/FloatBufferData.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/FloatBufferData.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -126,6 +126,7 @@ public class FloatBufferData extends AbstractBufferData<FloatBuffer> implements
return copy;
}
+ @Override
public Class<? extends FloatBufferData> getClassTag() {
return getClass();
}
diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/FloatBufferDataUtil.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/FloatBufferDataUtil.java
index b0afc37..25a74dd 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/FloatBufferDataUtil.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/FloatBufferDataUtil.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/IndexBufferData.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/IndexBufferData.java
index 4ca77b5..1b4654e 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/IndexBufferData.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/IndexBufferData.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/InstancingManager.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/InstancingManager.java
index e6673a5..e788161 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/InstancingManager.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/InstancingManager.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2010 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -11,6 +11,7 @@
package com.ardor3d.scenegraph;
import java.nio.FloatBuffer;
+import java.util.ArrayList;
import java.util.List;
import com.ardor3d.math.Matrix4;
@@ -21,12 +22,11 @@ import com.ardor3d.renderer.Renderer;
import com.ardor3d.renderer.state.GLSLShaderObjectsState;
import com.ardor3d.util.Ardor3dException;
import com.ardor3d.util.geom.BufferUtils;
-import com.google.common.collect.Lists;
public class InstancingManager {
private int _maxBatchSize = 30;
- private final List<Mesh> _visibleMeshes = Lists.newArrayListWithCapacity(_maxBatchSize);
+ private final List<Mesh> _visibleMeshes = new ArrayList<>(_maxBatchSize);
private FloatBuffer _transformBuffer;
private int _primCount;
private int _meshesToDraw = 0;
diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/IntBufferData.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/IntBufferData.java
index 219a729..3cb43d3 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/IntBufferData.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/IntBufferData.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -49,6 +49,7 @@ public class IntBufferData extends IndexBufferData<IntBuffer> implements Savable
_buffer = buffer;
}
+ @Override
public Class<? extends IntBufferData> getClassTag() {
return getClass();
}
diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/Line.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/Line.java
index 164f769..7267232 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/Line.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/Line.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/Mesh.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/Mesh.java
index 3822eae..18a6086 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/Mesh.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/Mesh.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -12,6 +12,7 @@ package com.ardor3d.scenegraph;
import java.io.IOException;
import java.nio.FloatBuffer;
+import java.util.ArrayList;
import java.util.EnumMap;
import java.util.List;
@@ -47,7 +48,6 @@ import com.ardor3d.util.geom.BufferUtils;
import com.ardor3d.util.scenegraph.RenderDelegate;
import com.ardor3d.util.stat.StatCollector;
import com.ardor3d.util.stat.StatType;
-import com.google.common.collect.Lists;
/**
* A Mesh is a spatial describing a renderable geometric object. Data about the mesh is stored locally using MeshData.
@@ -66,7 +66,7 @@ public class Mesh extends Spatial implements Renderable, Pickable {
* The compiled list of renderstates for this mesh, taking into account ancestors states - updated with
* updateRenderStates()
*/
- protected final EnumMap<RenderState.StateType, RenderState> _states = new EnumMap<RenderState.StateType, RenderState>(
+ protected final EnumMap<RenderState.StateType, RenderState> _states = new EnumMap<>(
RenderState.StateType.class);
/** The compiled lightState for this mesh */
@@ -238,6 +238,7 @@ public class Mesh extends Spatial implements Renderable, Pickable {
return store;
}
+ @Override
public void render(final Renderer renderer) {
if (isVisible()) {
render(renderer, getMeshData());
@@ -570,7 +571,7 @@ public class Mesh extends Spatial implements Renderable, Pickable {
@Override
public IntersectionRecord intersectsPrimitivesWhere(final Ray3 ray) {
- final List<PrimitiveKey> primitives = Lists.newArrayList();
+ final List<PrimitiveKey> primitives = new ArrayList<>();
// What about Lines and Points?
final CollisionTree ct = CollisionTreeManager.getInstance().getCollisionTree(this);
diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/MeshData.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/MeshData.java
index 3c02967..7a86fb3 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/MeshData.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/MeshData.java
@@ -1,9 +1,9 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* 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>.
*/
@@ -19,6 +19,7 @@ import java.nio.ShortBuffer;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
+import java.util.WeakHashMap;
import java.util.logging.Logger;
import com.ardor3d.math.MathUtils;
@@ -32,8 +33,6 @@ import com.ardor3d.util.export.InputCapsule;
import com.ardor3d.util.export.OutputCapsule;
import com.ardor3d.util.export.Savable;
import com.ardor3d.util.geom.BufferUtils;
-import com.google.common.collect.Lists;
-import com.google.common.collect.MapMaker;
/**
* MeshData contains all the commonly used buffers for rendering a mesh.
@@ -58,7 +57,7 @@ public class MeshData implements Savable {
protected FloatBufferData _colorCoords;
protected FloatBufferData _fogCoords;
protected FloatBufferData _tangentCoords;
- protected List<FloatBufferData> _textureCoords = Lists.newArrayListWithCapacity(1);
+ protected List<FloatBufferData> _textureCoords = new ArrayList<>(1);
/** Interleaved data (for VBO id use). */
protected FloatBufferData _interleaved;
@@ -72,7 +71,7 @@ public class MeshData implements Savable {
/**
* Gets the vertex count.
- *
+ *
* @return the vertex count
*/
public int getVertexCount() {
@@ -81,7 +80,7 @@ public class MeshData implements Savable {
/**
* Gets the vertex buffer.
- *
+ *
* @return the vertex buffer
*/
public FloatBuffer getVertexBuffer() {
@@ -93,7 +92,7 @@ public class MeshData implements Savable {
/**
* Sets the vertex buffer.
- *
+ *
* @param vertexBuffer
* the new vertex buffer
*/
@@ -108,7 +107,7 @@ public class MeshData implements Savable {
/**
* Gets the vertex coords.
- *
+ *
* @return the vertex coords
*/
public FloatBufferData getVertexCoords() {
@@ -123,7 +122,7 @@ public class MeshData implements Savable {
/**
* Sets the vertex coords.
- *
+ *
* @param bufferData
* the new vertex coords
*/
@@ -135,7 +134,7 @@ public class MeshData implements Savable {
/**
* Gets the normal buffer.
- *
+ *
* @return the normal buffer
*/
public FloatBuffer getNormalBuffer() {
@@ -147,7 +146,7 @@ public class MeshData implements Savable {
/**
* Sets the normal buffer.
- *
+ *
* @param normalBuffer
* the new normal buffer
*/
@@ -162,7 +161,7 @@ public class MeshData implements Savable {
/**
* Gets the normal coords.
- *
+ *
* @return the normal coords
*/
public FloatBufferData getNormalCoords() {
@@ -171,7 +170,7 @@ public class MeshData implements Savable {
/**
* Sets the normal coords.
- *
+ *
* @param bufferData
* the new normal coords
*/
@@ -182,7 +181,7 @@ public class MeshData implements Savable {
/**
* Gets the color buffer.
- *
+ *
* @return the color buffer
*/
public FloatBuffer getColorBuffer() {
@@ -194,7 +193,7 @@ public class MeshData implements Savable {
/**
* Sets the color buffer.
- *
+ *
* @param colorBuffer
* the new color buffer
*/
@@ -209,7 +208,7 @@ public class MeshData implements Savable {
/**
* Gets the color coords.
- *
+ *
* @return the color coords
*/
public FloatBufferData getColorCoords() {
@@ -218,7 +217,7 @@ public class MeshData implements Savable {
/**
* Sets the color coords.
- *
+ *
* @param bufferData
* the new color coords
*/
@@ -229,7 +228,7 @@ public class MeshData implements Savable {
/**
* Gets the fog buffer.
- *
+ *
* @return the fog buffer
*/
public FloatBuffer getFogBuffer() {
@@ -241,7 +240,7 @@ public class MeshData implements Savable {
/**
* Sets the fog buffer.
- *
+ *
* @param fogBuffer
* the new fog buffer
*/
@@ -255,7 +254,7 @@ public class MeshData implements Savable {
/**
* Gets the fog coords.
- *
+ *
* @return the fog coords
*/
public FloatBufferData getFogCoords() {
@@ -264,7 +263,7 @@ public class MeshData implements Savable {
/**
* Sets the fog coords.
- *
+ *
* @param bufferData
* the new fog coords
*/
@@ -274,7 +273,7 @@ public class MeshData implements Savable {
/**
* Gets the tangent buffer.
- *
+ *
* @return the tangent buffer
*/
public FloatBuffer getTangentBuffer() {
@@ -286,7 +285,7 @@ public class MeshData implements Savable {
/**
* Sets the tangent buffer.
- *
+ *
* @param tangentBuffer
* the new tangent buffer
*/
@@ -300,7 +299,7 @@ public class MeshData implements Savable {
/**
* Gets the tangent coords.
- *
+ *
* @return the tangent coords
*/
public FloatBufferData getTangentCoords() {
@@ -309,7 +308,7 @@ public class MeshData implements Savable {
/**
* Sets the tangent coords.
- *
+ *
* @param bufferData
* the new tangent coords
*/
@@ -319,10 +318,10 @@ public class MeshData implements Savable {
/**
* Gets the FloatBuffer of the FloatBufferData set on a given texture unit.
- *
+ *
* @param index
* the unit index
- *
+ *
* @return the texture buffer for the given index, or null if none was set.
*/
public FloatBuffer getTextureBuffer(final int index) {
@@ -339,7 +338,7 @@ public class MeshData implements Savable {
/**
* Sets the texture buffer for a given texture unit index. Interprets it as a 2 component float buffer data. If you
* need other sizes, use setTextureCoords instead.
- *
+ *
* @param textureBuffer
* the texture buffer
* @param index
@@ -360,7 +359,7 @@ public class MeshData implements Savable {
/**
* Gets the texture coords.
- *
+ *
* @return the texture coords
*/
public List<FloatBufferData> getTextureCoords() {
@@ -369,10 +368,10 @@ public class MeshData implements Savable {
/**
* Gets the texture coords assigned to a specific texture unit index of this MeshData.
- *
+ *
* @param index
* the texture unit index
- *
+ *
* @return the texture coords
*/
public FloatBufferData getTextureCoords(final int index) {
@@ -384,7 +383,7 @@ public class MeshData implements Savable {
/**
* Sets all texture coords on this MeshData.
- *
+ *
* @param textureCoords
* the new texture coords
*/
@@ -395,7 +394,7 @@ public class MeshData implements Savable {
/**
* Sets the texture coords of a specific texture unit index to the given FloatBufferData.
- *
+ *
* @param textureCoords
* the texture coords
* @param index
@@ -411,7 +410,7 @@ public class MeshData implements Savable {
/**
* Retrieves the interleaved buffer, if set or created through packInterleaved.
- *
+ *
* @return the interleaved buffer
*/
public FloatBuffer getInterleavedBuffer() {
@@ -423,7 +422,7 @@ public class MeshData implements Savable {
/**
* Gets the interleaved data.
- *
+ *
* @return the interleaved data
*/
public FloatBufferData getInterleavedData() {
@@ -432,7 +431,7 @@ public class MeshData implements Savable {
/**
* Sets the interleaved data.
- *
+ *
* @param interleavedData
* the interleaved data
*/
@@ -459,7 +458,7 @@ public class MeshData implements Savable {
/**
* <code>copyTextureCoords</code> copies the texture coordinates of a given texture unit to another location. If the
* texture unit is not valid, then the coordinates are ignored. Coords are multiplied by the given factor.
- *
+ *
* @param fromIndex
* the coordinates to copy.
* @param toIndex
@@ -505,7 +504,7 @@ public class MeshData implements Savable {
/**
* <code>copyTextureCoords</code> copies the texture coordinates of a given texture unit to another location. If the
* texture unit is not valid, then the coordinates are ignored. Coords are multiplied by the given S and T factors.
- *
+ *
* @param fromIndex
* the coordinates to copy.
* @param toIndex
@@ -556,7 +555,7 @@ public class MeshData implements Savable {
/**
* <code>getNumberOfUnits</code> returns the number of texture units this geometry is currently using.
- *
+ *
* @return the number of texture units in use.
*/
public int getNumberOfUnits() {
@@ -568,7 +567,7 @@ public class MeshData implements Savable {
/**
* Gets the index buffer.
- *
+ *
* @return the index buffer
*/
public Buffer getIndexBuffer() {
@@ -580,7 +579,7 @@ public class MeshData implements Savable {
/**
* Sets the index buffer.
- *
+ *
* @param indices
* the new index buffer
*/
@@ -596,7 +595,7 @@ public class MeshData implements Savable {
/**
* Sets the index buffer.
- *
+ *
* @param indices
* the new index buffer
*/
@@ -612,7 +611,7 @@ public class MeshData implements Savable {
/**
* Sets the index buffer.
- *
+ *
* @param indices
* the new index buffer
*/
@@ -628,7 +627,7 @@ public class MeshData implements Savable {
/**
* Gets the indices.
- *
+ *
* @return the indices
*/
public IndexBufferData<?> getIndices() {
@@ -637,7 +636,7 @@ public class MeshData implements Savable {
/**
* Sets the indices
- *
+ *
* @param bufferData
* the new indices
*/
@@ -649,7 +648,7 @@ public class MeshData implements Savable {
/**
* Gets the index mode.
- *
+ *
* @return the IndexMode of the first section of this MeshData.
* @deprecated Please switch to {@link #getIndexMode(int)}
*/
@@ -660,7 +659,7 @@ public class MeshData implements Savable {
/**
* Sets the index mode.
- *
+ *
* @param indexMode
* the new IndexMode to use for the first section of this MeshData.
*/
@@ -672,7 +671,7 @@ public class MeshData implements Savable {
/**
* Gets the index lengths.
- *
+ *
* @return the index lengths
*/
public int[] getIndexLengths() {
@@ -681,7 +680,7 @@ public class MeshData implements Savable {
/**
* Sets the index lengths.
- *
+ *
* @param indexLengths
* the new index lengths
*/
@@ -693,7 +692,7 @@ public class MeshData implements Savable {
/**
* Gets the index modes.
- *
+ *
* @return the index modes
*/
public IndexMode[] getIndexModes() {
@@ -702,10 +701,10 @@ public class MeshData implements Savable {
/**
* Gets the index mode.
- *
+ *
* @param sectionIndex
* the section index
- *
+ *
* @return the index mode
*/
public IndexMode getIndexMode(final int sectionIndex) {
@@ -717,7 +716,7 @@ public class MeshData implements Savable {
/**
* Note: Also updates primitive counts.
- *
+ *
* @param indexModes
* the index modes to use for this MeshData.
*/
@@ -729,7 +728,7 @@ public class MeshData implements Savable {
/**
* Gets the section count.
- *
+ *
* @return the number of sections (lengths, indexModes, etc.) this MeshData contains.
*/
public int getSectionCount() {
@@ -738,7 +737,7 @@ public class MeshData implements Savable {
/**
* Gets the total primitive count.
- *
+ *
* @return the sum of the primitive counts on all sections of this mesh data.
*/
public int getTotalPrimitiveCount() {
@@ -751,10 +750,10 @@ public class MeshData implements Savable {
/**
* Gets the primitive count.
- *
+ *
* @param section
* the section
- *
+ *
* @return the number of primitives (triangles, quads, lines, points, etc.) on a given section of this mesh data.
*/
public int getPrimitiveCount(final int section) {
@@ -763,7 +762,7 @@ public class MeshData implements Savable {
/**
* Returns the vertex indices of a specified primitive.
- *
+ *
* @param primitiveIndex
* which triangle, quad, etc
* @param section
@@ -771,9 +770,9 @@ public class MeshData implements Savable {
* @param store
* an int array to store the results in. if null, or the length < the size of the primitive, a new array
* is created and returned.
- *
+ *
* @return the primitive's vertex indices as an array
- *
+ *
* @throws IndexOutOfBoundsException
* if primitiveIndex is outside of range [0, count-1] where count is the number of primitives in the
* given section.
@@ -807,14 +806,14 @@ public class MeshData implements Savable {
/**
* Gets the vertices that make up the given primitive.
- *
+ *
* @param primitiveIndex
* the primitive index
* @param section
* the section
* @param store
* the store. If null or the wrong size, we'll make a new array and return that instead.
- *
+ *
* @return the primitive
*/
public Vector3[] getPrimitiveVertices(final int primitiveIndex, final int section, final Vector3[] store) {
@@ -841,7 +840,7 @@ public class MeshData implements Savable {
} else {
// non-indexed geometry
BufferUtils
- .populateFromBuffer(result[i], getVertexBuffer(), getVertexIndex(primitiveIndex, i, section));
+ .populateFromBuffer(result[i], getVertexBuffer(), getVertexIndex(primitiveIndex, i, section));
}
}
@@ -850,7 +849,7 @@ public class MeshData implements Savable {
/**
* Gets the texture coordinates of the primitive.
- *
+ *
* @param primitiveIndex
* the primitive index
* @param section
@@ -859,7 +858,7 @@ public class MeshData implements Savable {
* the texture index
* @param store
* the store
- *
+ *
* @return the texture coordinates of the primitive
*/
public Vector2[] getPrimitiveTextureCoords(final int primitiveIndex, final int section, final int textureIndex,
@@ -895,14 +894,14 @@ public class MeshData implements Savable {
/**
* Gets the vertex index.
- *
+ *
* @param primitiveIndex
* which triangle, quad, etc.
* @param point
* which point on the triangle, quad, etc. (triangle has three points, so this would be 0-2, etc.)
* @param section
* which section to pull from (corresponds to array position in indexmodes and lengths)
- *
+ *
* @return the position you would expect to find the given point in the index buffer
*/
public int getVertexIndex(final int primitiveIndex, final int point, final int section) {
@@ -957,10 +956,10 @@ public class MeshData implements Savable {
/**
* Random vertex.
- *
+ *
* @param store
* the vector object to store the result in. if null, a new one is created.
- *
+ *
* @return a random vertex from the vertices stored in this MeshData. null is returned if there are no vertices.
*/
public Vector3 randomVertex(final Vector3 store) {
@@ -981,10 +980,10 @@ public class MeshData implements Savable {
/**
* Random point on primitives.
- *
+ *
* @param store
* the vector object to store the result in. if null, a new one is created.
- *
+ *
* @return a random point from the surface of a primitive stored in this MeshData. null is returned if there are no
* vertices or indices.
*/
@@ -1083,7 +1082,7 @@ public class MeshData implements Savable {
/**
* Translate points.
- *
+ *
* @param x
* the x
* @param y
@@ -1097,7 +1096,7 @@ public class MeshData implements Savable {
/**
* Translate points.
- *
+ *
* @param amount
* the amount
*/
@@ -1130,7 +1129,7 @@ public class MeshData implements Savable {
/**
* Rotate points.
- *
+ *
* @param rotate
* the rotate
*/
@@ -1145,7 +1144,7 @@ public class MeshData implements Savable {
/**
* Rotate normals.
- *
+ *
* @param rotate
* the rotate
*/
@@ -1190,7 +1189,7 @@ public class MeshData implements Savable {
/**
* Sets the id for a vbo based on interleaving this MeshData's buffer, in regards to the given OpenGL context.
- *
+ *
* @param glContext
* the object representing the OpenGL context a vbo belongs to. See
* {@link RenderContext#getGlContextRep()}
@@ -1205,7 +1204,7 @@ public class MeshData implements Savable {
}
if (_vboIdCache == null) {
- _vboIdCache = new MapMaker().initialCapacity(1).weakKeys().makeMap();
+ _vboIdCache = new WeakHashMap<>(1);
}
_vboIdCache.put(glContext, vboId);
}
diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/Node.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/Node.java
index f03c447..1518f8d 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/Node.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/Node.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -494,7 +494,7 @@ public class Node extends Spatial {
@Override
public void write(final OutputCapsule capsule) throws IOException {
super.write(capsule);
- capsule.writeSavableList(new ArrayList<Spatial>(_children), "children", null);
+ capsule.writeSavableList(new ArrayList<>(_children), "children", null);
}
@Override
diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/Point.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/Point.java
index c23330d..6fac9d2 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/Point.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/Point.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -40,7 +40,6 @@ public class Point extends Mesh {
/**
* Distance Attenuation fields.
*/
- // XXX: LWJGL requires 4 floats, but only 3 coefficients are mentioned in the specification?
// JOGL works fine with 3.
private final FloatBuffer _attenuationCoefficients = BufferUtils.createFloatBuffer(new float[] { 0.0f, 0f,
0.000004f, 0f });
diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/Renderable.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/Renderable.java
index 369b7d2..e8b77ea 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/Renderable.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/Renderable.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/ShortBufferData.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/ShortBufferData.java
index 5d8f8f8..92f9cda 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/ShortBufferData.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/ShortBufferData.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -50,6 +50,7 @@ public class ShortBufferData extends IndexBufferData<ShortBuffer> implements Sav
_buffer = buffer;
}
+ @Override
public Class<? extends ShortBufferData> getClassTag() {
return getClass();
}
diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/Spatial.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/Spatial.java
index 6f636ff..0aab2e2 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/Spatial.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/Spatial.java
@@ -1,9 +1,9 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* 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>.
*/
@@ -17,6 +17,7 @@ import java.util.EnumMap;
import java.util.EnumSet;
import java.util.List;
import java.util.Map;
+import java.util.WeakHashMap;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -52,7 +53,6 @@ import com.ardor3d.util.export.InputCapsule;
import com.ardor3d.util.export.OutputCapsule;
import com.ardor3d.util.export.Savable;
import com.ardor3d.util.scenegraph.RenderDelegate;
-import com.google.common.collect.MapMaker;
/**
* Base class for all scenegraph objects.
@@ -79,7 +79,7 @@ public abstract class Spatial implements Savable, Hintable {
protected List<SpatialController<?>> _controllers;
/** The render states of this spatial. */
- protected EnumMap<RenderState.StateType, RenderState> _renderStateList = new EnumMap<RenderState.StateType, RenderState>(
+ protected EnumMap<RenderState.StateType, RenderState> _renderStateList = new EnumMap<>(
RenderState.StateType.class);
/** Listener for dirty events. */
@@ -124,7 +124,7 @@ public abstract class Spatial implements Savable, Hintable {
/**
* Constructs a new <code>Spatial</code> with a given name.
- *
+ *
* @param name
* the name of the spatial. This is required for identification purposes.
*/
@@ -135,7 +135,7 @@ public abstract class Spatial implements Savable, Hintable {
/**
* Returns the name of this spatial.
- *
+ *
* @return This spatial's name.
*/
public String getName() {
@@ -144,7 +144,7 @@ public abstract class Spatial implements Savable, Hintable {
/**
* Sets the name of this Spatial.
- *
+ *
* @param name
* new name
*/
@@ -154,7 +154,7 @@ public abstract class Spatial implements Savable, Hintable {
/**
* Sets the render delegate.
- *
+ *
* @param delegate
* the new delegate, or null for default behavior
* @param glContextRef
@@ -166,7 +166,7 @@ public abstract class Spatial implements Savable, Hintable {
if (delegate == null) {
return;
} else {
- _delegateMap = new MapMaker().weakKeys().makeMap();
+ _delegateMap = new WeakHashMap<>();
}
}
if (delegate != null) {
@@ -189,7 +189,7 @@ public abstract class Spatial implements Savable, Hintable {
/**
* Gets the render delegate.
- *
+ *
* @param glContextRef
* if null, retrieve the default render delegate for this spatial. Otherwise, retrieve the delegate used
* when this Spatial is rendered in a RenderContext tied to the given glContextRef.
@@ -208,7 +208,7 @@ public abstract class Spatial implements Savable, Hintable {
/**
* <code>getParent</code> retrieve's this node's parent. If the parent is null this is the root node.
- *
+ *
* @return the parent of this node.
*/
public Node getParent() {
@@ -218,7 +218,7 @@ public abstract class Spatial implements Savable, Hintable {
/**
* Called by {@link Node#attachChild(Spatial)} and {@link Node#detachChild(Spatial)} - don't call directly.
* <code>setParent</code> sets the parent of this node.
- *
+ *
* @param parent
* the parent of this node.
*/
@@ -228,7 +228,7 @@ public abstract class Spatial implements Savable, Hintable {
/**
* <code>removeFromParent</code> removes this Spatial from it's parent.
- *
+ *
* @return true if it has a parent and performed the remove.
*/
public boolean removeFromParent() {
@@ -241,7 +241,7 @@ public abstract class Spatial implements Savable, Hintable {
/**
* determines if the provided Node is the parent, or parent's parent, etc. of this Spatial.
- *
+ *
* @param ancestor
* the ancestor object to look for.
* @return true if the ancestor is found, false otherwise.
@@ -259,22 +259,24 @@ public abstract class Spatial implements Savable, Hintable {
/**
* @see Hintable#getParentHintable()
*/
+ @Override
public Hintable getParentHintable() {
return _parent;
}
/**
* Gets the scene hints.
- *
+ *
* @return the scene hints set on this Spatial
*/
+ @Override
public SceneHints getSceneHints() {
return _sceneHints;
}
/**
* Returns the listener for dirty events on this node, if set.
- *
+ *
* @return the listener
*/
public DirtyEventListener getListener() {
@@ -283,7 +285,7 @@ public abstract class Spatial implements Savable, Hintable {
/**
* Sets the listener for dirty events on this node.
- *
+ *
* @param listener
* listener to use.
*/
@@ -293,7 +295,7 @@ public abstract class Spatial implements Savable, Hintable {
/**
* Mark this node as dirty. Can be marked as Transform, Bounding, Attached, Detached, Destroyed or RenderState
- *
+ *
* @param dirtyType
* the dirty type
*/
@@ -303,7 +305,7 @@ public abstract class Spatial implements Savable, Hintable {
/**
* Mark this node as dirty. Can be marked as Transform, Bounding, Attached, Detached, Destroyed or RenderState
- *
+ *
* @param caller
* the spatial where the marking was initiated
* @param dirtyType
@@ -345,7 +347,7 @@ public abstract class Spatial implements Savable, Hintable {
/**
* Test if this spatial is marked as dirty in respect to the supplied DirtyType.
- *
+ *
* @param dirtyType
* dirty type to test against
* @return true if spatial marked dirty against the supplied dirty type
@@ -356,7 +358,7 @@ public abstract class Spatial implements Savable, Hintable {
/**
* Clears the dirty flag set at this spatial for the supplied dirty type.
- *
+ *
* @param dirtyType
* dirty type to clear flag for
*/
@@ -366,7 +368,7 @@ public abstract class Spatial implements Savable, Hintable {
/**
* Clears the dirty flag set at this spatial for the supplied dirty type.
- *
+ *
* @param caller
* the spatial where the clearing was initiated
* @param dirtyType
@@ -380,7 +382,7 @@ public abstract class Spatial implements Savable, Hintable {
/**
* Propagate the dirty mark up the tree hierarchy.
- *
+ *
* @param dirtyTypes
* the dirty types
*/
@@ -394,7 +396,7 @@ public abstract class Spatial implements Savable, Hintable {
/**
* Propagate the dirty mark down the tree hierarchy.
- *
+ *
* @param dirtyTypes
* the dirty types
*/
@@ -405,7 +407,7 @@ public abstract class Spatial implements Savable, Hintable {
/**
* Propagate the dirty event up the hierarchy. If a listener is found on the spatial the event is fired and the
* propagation is stopped.
- *
+ *
* @param spatial
* the spatial
* @param dirtyType
@@ -430,7 +432,7 @@ public abstract class Spatial implements Savable, Hintable {
/**
* Gets the local rotation matrix.
- *
+ *
* @return the rotation
*/
public ReadOnlyMatrix3 getRotation() {
@@ -439,7 +441,7 @@ public abstract class Spatial implements Savable, Hintable {
/**
* Gets the local scale vector.
- *
+ *
* @return the scale
*/
public ReadOnlyVector3 getScale() {
@@ -448,7 +450,7 @@ public abstract class Spatial implements Savable, Hintable {
/**
* Gets the local translation vector.
- *
+ *
* @return the translation
*/
public ReadOnlyVector3 getTranslation() {
@@ -457,7 +459,7 @@ public abstract class Spatial implements Savable, Hintable {
/**
* Gets the local transform.
- *
+ *
* @return the transform
*/
public ReadOnlyTransform getTransform() {
@@ -466,7 +468,7 @@ public abstract class Spatial implements Savable, Hintable {
/**
* Sets the local transform.
- *
+ *
* @param transform
* the new transform
*/
@@ -477,7 +479,7 @@ public abstract class Spatial implements Savable, Hintable {
/**
* Sets the world rotation matrix.
- *
+ *
* @param rotation
* the new world rotation
*/
@@ -487,7 +489,7 @@ public abstract class Spatial implements Savable, Hintable {
/**
* Sets the world rotation quaternion.
- *
+ *
* @param rotation
* the new world rotation
*/
@@ -497,7 +499,7 @@ public abstract class Spatial implements Savable, Hintable {
/**
* Sets the world scale.
- *
+ *
* @param scale
* the new world scale vector
*/
@@ -507,7 +509,7 @@ public abstract class Spatial implements Savable, Hintable {
/**
* Sets the world scale.
- *
+ *
* @param x
* the x coordinate
* @param y
@@ -521,7 +523,7 @@ public abstract class Spatial implements Savable, Hintable {
/**
* Sets the world scale.
- *
+ *
* @param scale
* the new world scale
*/
@@ -531,7 +533,7 @@ public abstract class Spatial implements Savable, Hintable {
/**
* Sets the world translation vector.
- *
+ *
* @param translation
* the new world translation
*/
@@ -541,7 +543,7 @@ public abstract class Spatial implements Savable, Hintable {
/**
* Sets the world translation.
- *
+ *
* @param x
* the x coordinate
* @param y
@@ -555,7 +557,7 @@ public abstract class Spatial implements Savable, Hintable {
/**
* Sets the world transform.
- *
+ *
* @param transform
* the new world transform
*/
@@ -565,7 +567,7 @@ public abstract class Spatial implements Savable, Hintable {
/**
* Sets the rotation of this spatial. This marks the spatial as DirtyType.Transform.
- *
+ *
* @param rotation
* the new rotation of this spatial
* @see Transform#setRotation(Matrix3)
@@ -577,7 +579,7 @@ public abstract class Spatial implements Savable, Hintable {
/**
* Sets the rotation of this spatial. This marks the spatial as DirtyType.Transform.
- *
+ *
* @param rotation
* the new rotation of this spatial
* @see Transform#setRotation(Quaternion)
@@ -589,7 +591,7 @@ public abstract class Spatial implements Savable, Hintable {
/**
* <code>setScale</code> sets the scale of this spatial. This marks the spatial as DirtyType.Transform.
- *
+ *
* @param scale
* the new scale of this spatial
*/
@@ -600,7 +602,7 @@ public abstract class Spatial implements Savable, Hintable {
/**
* <code>setScale</code> sets the scale of this spatial. This marks the spatial as DirtyType.Transform.
- *
+ *
* @param scale
* the new scale of this spatial
*/
@@ -611,7 +613,7 @@ public abstract class Spatial implements Savable, Hintable {
/**
* sets the scale of this spatial. This marks the spatial as DirtyType.Transform.
- *
+ *
* @param x
* the x scale factor
* @param y
@@ -626,7 +628,7 @@ public abstract class Spatial implements Savable, Hintable {
/**
* <code>setTranslation</code> sets the translation of this spatial. This marks the spatial as DirtyType.Transform.
- *
+ *
* @param translation
* the new translation of this spatial
*/
@@ -637,7 +639,7 @@ public abstract class Spatial implements Savable, Hintable {
/**
* sets the translation of this spatial. This marks the spatial as DirtyType.Transform.
- *
+ *
* @param x
* the x coordinate
* @param y
@@ -653,7 +655,7 @@ public abstract class Spatial implements Savable, Hintable {
/**
* <code>addTranslation</code> adds the given translation to the translation of this spatial. This marks the spatial
* as DirtyType.Transform.
- *
+ *
* @param translation
* the translation vector
*/
@@ -663,7 +665,7 @@ public abstract class Spatial implements Savable, Hintable {
/**
* adds to the current translation of this spatial. This marks the spatial as DirtyType.Transform.
- *
+ *
* @param x
* the x amount
* @param y
@@ -678,7 +680,7 @@ public abstract class Spatial implements Savable, Hintable {
/**
* Gets the world rotation matrix.
- *
+ *
* @return the world rotation
*/
public ReadOnlyMatrix3 getWorldRotation() {
@@ -687,7 +689,7 @@ public abstract class Spatial implements Savable, Hintable {
/**
* Gets the world scale vector.
- *
+ *
* @return the world scale
*/
public ReadOnlyVector3 getWorldScale() {
@@ -696,7 +698,7 @@ public abstract class Spatial implements Savable, Hintable {
/**
* Gets the world translation vector.
- *
+ *
* @return the world translation
*/
public ReadOnlyVector3 getWorldTranslation() {
@@ -705,7 +707,7 @@ public abstract class Spatial implements Savable, Hintable {
/**
* Gets the world transform.
- *
+ *
* @return the world transform
*/
public ReadOnlyTransform getWorldTransform() {
@@ -714,7 +716,7 @@ public abstract class Spatial implements Savable, Hintable {
/**
* <code>getWorldBound</code> retrieves the world bound at this level.
- *
+ *
* @return the world bound at this level.
*/
public BoundingVolume getWorldBound() {
@@ -726,7 +728,7 @@ public abstract class Spatial implements Savable, Hintable {
* method is called.
* <p>
* This method is called by the renderer. Usually it should not be called directly.
- *
+ *
* @param r
* the renderer used for display.
*/
@@ -761,7 +763,7 @@ public abstract class Spatial implements Savable, Hintable {
/**
* <code>draw</code> abstract method that handles drawing data to the renderer if it is geometry and passing the
* call to it's children if it is a node.
- *
+ *
* @param renderer
* the renderer used for display.
*/
@@ -769,7 +771,7 @@ public abstract class Spatial implements Savable, Hintable {
/**
* Grab the render delegate for this spatial based on the currently set RenderContext.
- *
+ *
* @return the delegate or null if a delegate was not found.
*/
protected RenderDelegate getCurrentRenderDelegate() {
@@ -793,7 +795,7 @@ public abstract class Spatial implements Savable, Hintable {
/**
* Update geometric state.
- *
+ *
* @param time
* The time in seconds between the last two consecutive frames (time per frame). See
* {@link ReadOnlyTimer#getTimePerFrame()}
@@ -805,7 +807,7 @@ public abstract class Spatial implements Savable, Hintable {
/**
* <code>updateGeometricState</code> updates all the geometry information for the node.
- *
+ *
* @param time
* The time in seconds between the last two consecutive frames (time per frame). See
* {@link ReadOnlyTimer#getTimePerFrame()}
@@ -840,7 +842,7 @@ public abstract class Spatial implements Savable, Hintable {
/**
* Override to allow objects like Node to update their children.
- *
+ *
* @param time
* The time in seconds between the last two consecutive frames (time per frame). See
* {@link ReadOnlyTimer#getTimePerFrame()}
@@ -849,7 +851,7 @@ public abstract class Spatial implements Savable, Hintable {
/**
* Update all controllers set on this spatial.
- *
+ *
* @param time
* The time in seconds between the last two consecutive frames (time per frame). See
* {@link ReadOnlyTimer#getTimePerFrame()}
@@ -874,7 +876,7 @@ public abstract class Spatial implements Savable, Hintable {
/**
* Updates the worldTransform.
- *
+ *
* @param recurse
* usually false when updating the tree. Set to true when you just want to update the world transforms
* for a branch without updating geometric state.
@@ -890,7 +892,7 @@ public abstract class Spatial implements Savable, Hintable {
/**
* Convert a vector (in) from this spatial's local coordinate space to world coordinate space.
- *
+ *
* @param in
* vector to read from
* @param store
@@ -907,7 +909,7 @@ public abstract class Spatial implements Savable, Hintable {
/**
* Convert a vector (in) from world coordinate space to this spatial's local coordinate space.
- *
+ *
* @param in
* vector to read from
* @param store
@@ -925,7 +927,7 @@ public abstract class Spatial implements Savable, Hintable {
/**
* Updates the render state values of this Spatial and and children it has. Should be called whenever render states
* change.
- *
+ *
* @param recurse
* true to recurse down the scenegraph tree
*/
@@ -935,7 +937,7 @@ public abstract class Spatial implements Savable, Hintable {
/**
* Called internally. Updates the render states of this Spatial. The stack contains parent render states.
- *
+ *
* @param recurse
* true to recurse down the scenegraph tree
* @param stateStack
@@ -966,7 +968,7 @@ public abstract class Spatial implements Savable, Hintable {
/**
* The method actually implements how the render states are applied to this spatial and (if recurse is true) any
* children it may have. By default, this function does nothing.
- *
+ *
* @param recurse
* true to recurse down the scenegraph tree
* @param stack
@@ -981,7 +983,7 @@ public abstract class Spatial implements Savable, Hintable {
/**
* Retrieves the complete renderstate list.
- *
+ *
* @return the list of renderstates
*/
public EnumMap<StateType, RenderState> getLocalRenderStates() {
@@ -992,7 +994,7 @@ public abstract class Spatial implements Savable, Hintable {
* <code>setRenderState</code> sets a render state for this node. Note, there can only be one render state per type
* per node. That is, there can only be a single BlendState a single TextureState, etc. If there is already a render
* state for a type set the old render state will be returned. Otherwise, null is returned.
- *
+ *
* @param rs
* the render state to add.
* @return the old render state.
@@ -1013,7 +1015,7 @@ public abstract class Spatial implements Savable, Hintable {
/**
* Returns the requested RenderState that this Spatial currently has set or null if none is set.
- *
+ *
* @param type
* the state type to retrieve
* @return a render state at the given position or null
@@ -1024,7 +1026,7 @@ public abstract class Spatial implements Savable, Hintable {
/**
* Clears a given render state index by setting it to null.
- *
+ *
* @param type
* The type of RenderState to clear
*/
@@ -1036,7 +1038,7 @@ public abstract class Spatial implements Savable, Hintable {
/**
* Called during updateRenderState(Stack[]), this function goes up the scene graph tree until the parent is null and
* pushes RenderStates onto the states Stack array.
- *
+ *
* @param stack
* The stack to push any parent states onto.
*/
@@ -1056,7 +1058,7 @@ public abstract class Spatial implements Savable, Hintable {
* updates the bounding volume of the world. Abstract, geometry transforms the bound while node merges the
* children's bound. In most cases, users will want to call updateModelBound() and let this function be called
* automatically during updateGeometricState().
- *
+ *
* @param recurse
* true to recurse down the scenegraph tree
*/
@@ -1074,7 +1076,7 @@ public abstract class Spatial implements Savable, Hintable {
/**
* Gets the Spatial specific user data.
- *
+ *
* @return the user data
*/
public Object getUserData() {
@@ -1083,7 +1085,7 @@ public abstract class Spatial implements Savable, Hintable {
/**
* Sets the Spatial specific user data.
- *
+ *
* @param userData
* Some Spatial specific user data. Note: If this object is not explicitly of type Savable, it will be
* ignored during read/write.
@@ -1094,21 +1096,21 @@ public abstract class Spatial implements Savable, Hintable {
/**
* Adds a SpatialController to this Spatial's list of controllers.
- *
+ *
* @param controller
* The SpatialController to add
* @see com.ardor3d.scenegraph.controller.SpatialController
*/
public void addController(final SpatialController<?> controller) {
if (_controllers == null) {
- _controllers = new ArrayList<SpatialController<?>>(1);
+ _controllers = new ArrayList<>(1);
}
_controllers.add(controller);
}
/**
* Removes a SpatialController from this Spatial's list of controllers, if it exist.
- *
+ *
* @param controller
* The SpatialController to remove
* @return True if the SpatialController was in the list to remove.
@@ -1123,7 +1125,7 @@ public abstract class Spatial implements Savable, Hintable {
/**
* Removes a SpatialController from this Spatial's list of controllers by index.
- *
+ *
* @param index
* The index of the controller to remove
* @return The SpatialController removed or null if nothing was removed.
@@ -1138,7 +1140,7 @@ public abstract class Spatial implements Savable, Hintable {
/**
* Removes all Controllers from this Spatial's list of controllers.
- *
+ *
* @see com.ardor3d.scenegraph.controller.SpatialController
*/
public void clearControllers() {
@@ -1149,7 +1151,7 @@ public abstract class Spatial implements Savable, Hintable {
/**
* Returns the controller in this list of controllers at index i.
- *
+ *
* @param i
* The index to get a controller from.
* @return The controller at index i.
@@ -1157,26 +1159,26 @@ public abstract class Spatial implements Savable, Hintable {
*/
public SpatialController<?> getController(final int i) {
if (_controllers == null) {
- _controllers = new ArrayList<SpatialController<?>>(1);
+ _controllers = new ArrayList<>(1);
}
return _controllers.get(i);
}
/**
* Returns the ArrayList that contains this spatial's SpatialControllers.
- *
+ *
* @return This spatial's _controllers.
*/
public List<SpatialController<?>> getControllers() {
if (_controllers == null) {
- _controllers = new ArrayList<SpatialController<?>>(1);
+ _controllers = new ArrayList<>(1);
}
return _controllers;
}
/**
* Gets the controller count.
- *
+ *
* @return the number of controllers set on this Spatial.
*/
public int getControllerCount() {
@@ -1190,7 +1192,7 @@ public abstract class Spatial implements Savable, Hintable {
* Returns this spatial's last frustum intersection result. This int is set when a check is made to determine if the
* bounds of the object fall inside a camera's frustum. If a parent is found to fall outside the frustum, the value
* for this spatial will not be updated.
- *
+ *
* @return The spatial's last frustum intersection result.
*/
public Camera.FrustumIntersect getLocalLastFrustumIntersection() {
@@ -1200,7 +1202,7 @@ public abstract class Spatial implements Savable, Hintable {
/**
* Tries to find the most accurate last frustum intersection for this spatial by checking the parent for possible
* Outside value.
- *
+ *
* @return Outside, if this, or any ancestor was Outside, otherwise the local intersect value.
*/
public Camera.FrustumIntersect getLastFrustumIntersection() {
@@ -1217,7 +1219,7 @@ public abstract class Spatial implements Savable, Hintable {
* Overrides the last intersection result. This is useful for operations that want to start rendering at the middle
* of a scene tree and don't want the parent of that node to influence culling. (See texture renderer code for
* example.)
- *
+ *
* @param frustumIntersects
* the new frustum intersection value
*/
@@ -1227,7 +1229,7 @@ public abstract class Spatial implements Savable, Hintable {
/**
* Execute the given Visitor on this Spatial, and any Spatials managed by this Spatial as appropriate.
- *
+ *
* @param visitor
* the Visitor object to use.
* @param preexecute
@@ -1241,7 +1243,7 @@ public abstract class Spatial implements Savable, Hintable {
/**
* Returns the Spatial's name followed by the class of the spatial <br>
* Example: "MyNode (com.ardor3d.scene.Spatial)
- *
+ *
* @return Spatial's name followed by the class of the Spatial
*/
@Override
@@ -1251,7 +1253,7 @@ public abstract class Spatial implements Savable, Hintable {
/**
* Create a copy of this spatial.
- *
+ *
* @param shareGeometricData
* if true, reuse any data fields describing the geometric shape of the spatial, as applicable.
* @return the copy as described.
@@ -1318,7 +1320,7 @@ public abstract class Spatial implements Savable, Hintable {
* Creates and returns a new instance of this spatial. Used for instanced rendering. All instances visible on the
* screen will be drawn in one draw call. The new instance will share all data (meshData and renderStates) with the
* current mesh and all other instances created from this spatial.
- *
+ *
* @return an instanced copy of this node
*/
public Spatial makeInstanced() {
@@ -1350,6 +1352,7 @@ public abstract class Spatial implements Savable, Hintable {
/**
* @see Savable#getClassTag()
*/
+ @Override
public Class<? extends Spatial> getClassTag() {
return this.getClass();
}
@@ -1361,6 +1364,7 @@ public abstract class Spatial implements Savable, Hintable {
* Signals that an I/O exception has occurred.
* @see Savable#read(InputCapsule)
*/
+ @Override
public void read(final InputCapsule capsule) throws IOException {
_name = capsule.readString("name", null);
@@ -1399,6 +1403,7 @@ public abstract class Spatial implements Savable, Hintable {
* Signals that an I/O exception has occurred.
* @see Savable#write(OutputCapsule)
*/
+ @Override
public void write(final OutputCapsule capsule) throws IOException {
capsule.write(_name, "name", null);
@@ -1412,7 +1417,7 @@ public abstract class Spatial implements Savable, Hintable {
}
if (_controllers != null) {
- final List<Savable> list = new ArrayList<Savable>();
+ final List<Savable> list = new ArrayList<>();
for (final SpatialController<?> sc : _controllers) {
if (sc instanceof Savable) {
list.add((Savable) sc);
diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/controller/ComplexSpatialController.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/controller/ComplexSpatialController.java
index 909a004..366e9f9 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/controller/ComplexSpatialController.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/controller/ComplexSpatialController.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -199,8 +199,10 @@ public abstract class ComplexSpatialController<T extends Spatial> implements Spa
return RepeatType.CYCLE.equals(getRepeatType());
}
+ @Override
public abstract void update(double time, T caller);
+ @Override
public void write(final OutputCapsule capsule) throws IOException {
capsule.write(_repeatType, "repeatType", RepeatType.CLAMP);
capsule.write(_minTime, "minTime", 0);
@@ -209,6 +211,7 @@ public abstract class ComplexSpatialController<T extends Spatial> implements Spa
capsule.write(_active, "active", true);
}
+ @Override
public void read(final InputCapsule capsule) throws IOException {
_repeatType = capsule.readEnum("repeatType", RepeatType.class, RepeatType.CLAMP);
_minTime = capsule.readDouble("minTime", 0);
@@ -217,6 +220,7 @@ public abstract class ComplexSpatialController<T extends Spatial> implements Spa
_active = capsule.readBoolean("active", true);
}
+ @Override
@SuppressWarnings("rawtypes")
public Class<? extends ComplexSpatialController> getClassTag() {
return this.getClass();
diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/controller/SpatialController.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/controller/SpatialController.java
index 7a3881e..2c060f4 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/controller/SpatialController.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/controller/SpatialController.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/controller/interpolation/CurveInterpolationController.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/controller/interpolation/CurveInterpolationController.java
index cd04c05..e9758f3 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/controller/interpolation/CurveInterpolationController.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/controller/interpolation/CurveInterpolationController.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/controller/interpolation/CurveLookAtController.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/controller/interpolation/CurveLookAtController.java
index ef322fc..2c1bf29 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/controller/interpolation/CurveLookAtController.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/controller/interpolation/CurveLookAtController.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/controller/interpolation/DefaultColorInterpolationController.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/controller/interpolation/DefaultColorInterpolationController.java
index d268600..7b8875c 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/controller/interpolation/DefaultColorInterpolationController.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/controller/interpolation/DefaultColorInterpolationController.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/controller/interpolation/InterpolationController.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/controller/interpolation/InterpolationController.java
index 0baf1d5..c8b0658 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/controller/interpolation/InterpolationController.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/controller/interpolation/InterpolationController.java
@@ -1,9 +1,9 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* 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>.
*/
@@ -23,7 +23,7 @@ import com.ardor3d.scenegraph.controller.ComplexSpatialController;
* Implementation note: This class is comprised of quite a few protected methods, this is mainly to allow maximum
* flexibility for overriding classes.
* </p>
- *
+ *
* @param <C>
* The control 'points' being interpolated, for example Vectors or Quaternions.
* @param <T>
@@ -54,7 +54,7 @@ public abstract class InterpolationController<C, T extends Spatial> extends Comp
/**
* This method is automatically called by {@link #update(double, Spatial)} from this controller.
- *
+ *
* @param from
* The control to interpolate from.
* @param to
@@ -73,7 +73,7 @@ public abstract class InterpolationController<C, T extends Spatial> extends Comp
* It will only update the given object if this controller is {@link #isActive() active}, caller isn't
* <code>null</code> and it's {@link #getSpeed() speed} is greater than zero.
* </p>
- *
+ *
* @param time
* The passed since this controller was last called.
* @param caller
@@ -92,7 +92,8 @@ public abstract class InterpolationController<C, T extends Spatial> extends Comp
clampIndex();
- assert (getIndex() < getControls().size()) : "_index was greater than the number of controls, clampIndex() has probably been overriden incorrectly";
+ assert (getIndex() < getControls()
+ .size()) : "_index was greater than the number of controls, clampIndex() has probably been overriden incorrectly";
assert (getIndex() >= 0) : "_index was negative, clampIndex() has probably been overriden incorrectly";
interpolate(getControlFrom(), getControlTo(), getDelta(), caller);
@@ -139,7 +140,7 @@ public abstract class InterpolationController<C, T extends Spatial> extends Comp
* The new values to set, can not be <code>null</code> or size 0.
* @see #getControls()
*/
- public void setControls(final C... controlArray) {
+ public void setControls(@SuppressWarnings("unchecked") final C... controlArray) {
if (null == controlArray) {
throw new IllegalArgumentException("controlArray can not be null!");
}
@@ -153,14 +154,15 @@ public abstract class InterpolationController<C, T extends Spatial> extends Comp
*/
public List<C> getControls() {
assert (null != _controls) : "_controls was null, it must be set before use!";
- assert (!_controls.isEmpty()) : "_controls was empty, it must contain at least 1 element for this class to work!";
+ assert (!_controls
+ .isEmpty()) : "_controls was empty, it must contain at least 1 element for this class to work!";
return _controls;
}
/**
* Updates the {@link #getDelta() delta} and {@link #getIndex() index}.
- *
+ *
* @param time
* The raw time since this was last called.
*/
@@ -224,7 +226,7 @@ public abstract class InterpolationController<C, T extends Spatial> extends Comp
/**
* This method assumes the {@link #getIndex() index} has already been {@link #clampIndex() clamped} correctly.
- *
+ *
* @return The control to interpolate from, will not be <code>null</code>.
* @see #getControlTo()
*/
@@ -254,7 +256,7 @@ public abstract class InterpolationController<C, T extends Spatial> extends Comp
/**
* This method assumes the {@link #getIndex() index} has already been {@link #clampIndex() clamped} correctly.
- *
+ *
* @return The control to interpolate to, will not be <code>null</code>.
* @see #getControlFrom()
*/
@@ -288,7 +290,7 @@ public abstract class InterpolationController<C, T extends Spatial> extends Comp
/**
* Increments the index by 1.
- *
+ *
* @return The new index value as a convenience.
*/
protected int incrementIndex() {
@@ -297,7 +299,7 @@ public abstract class InterpolationController<C, T extends Spatial> extends Comp
/**
* Decrements the index by 1.
- *
+ *
* @return The new index value as a convenience.
*/
protected int decrementIndex() {
@@ -386,7 +388,7 @@ public abstract class InterpolationController<C, T extends Spatial> extends Comp
/**
* Also {@link #reset() resets} this controller for safety, because changing the repeat type part way through an
* interpolation can cause problems.
- *
+ *
* @param repeatType
* The new repeat type to use.
*/
diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/controller/interpolation/LinearVector3InterpolationController.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/controller/interpolation/LinearVector3InterpolationController.java
index 3784db9..60e0b6f 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/controller/interpolation/LinearVector3InterpolationController.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/controller/interpolation/LinearVector3InterpolationController.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/controller/interpolation/QuaternionInterpolationController.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/controller/interpolation/QuaternionInterpolationController.java
index 06d6c82..fb9e5d5 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/controller/interpolation/QuaternionInterpolationController.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/controller/interpolation/QuaternionInterpolationController.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/controller/interpolation/Vector3InterpolationController.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/controller/interpolation/Vector3InterpolationController.java
index 44ad32a..9740177 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/controller/interpolation/Vector3InterpolationController.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/controller/interpolation/Vector3InterpolationController.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/event/DirtyEventListener.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/event/DirtyEventListener.java
index fdf5bd6..da56324 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/event/DirtyEventListener.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/event/DirtyEventListener.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/event/DirtyType.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/event/DirtyType.java
index 2c81ad9..3aa1ea1 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/event/DirtyType.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/event/DirtyType.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/event/SceneGraphManager.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/event/SceneGraphManager.java
index 3300c6d..8a08412 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/event/SceneGraphManager.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/event/SceneGraphManager.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -24,7 +24,7 @@ public class SceneGraphManager implements DirtyEventListener {
private final List<DirtyEventListener> _listeners;
private SceneGraphManager() {
- _listeners = new ArrayList<DirtyEventListener>();
+ _listeners = new ArrayList<>();
}
public static SceneGraphManager getSceneGraphManager() {
@@ -47,6 +47,7 @@ public class SceneGraphManager implements DirtyEventListener {
_listeners.remove(listener);
}
+ @Override
public boolean spatialDirty(final Spatial spatial, final DirtyType dirtyType) {
for (final DirtyEventListener listener : _listeners) {
listener.spatialDirty(spatial, dirtyType);
@@ -54,6 +55,7 @@ public class SceneGraphManager implements DirtyEventListener {
return false;
}
+ @Override
public boolean spatialClean(final Spatial spatial, final DirtyType dirtyType) {
for (final DirtyEventListener listener : _listeners) {
listener.spatialClean(spatial, dirtyType);
diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/extension/BillboardNode.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/extension/BillboardNode.java
index 4ce8c3d..7c29fc8 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/extension/BillboardNode.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/extension/BillboardNode.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -235,6 +235,7 @@ public class BillboardNode extends Node {
_left.setX(_left.getX() * invLength);
_left.setY(0.0);
_left.setZ(_left.getZ() * invLength);
+ _left.normalizeLocal();
// compute the local orientation matrix for the billboard
_orient.setValue(0, 0, _left.getZ());
diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/extension/CameraNode.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/extension/CameraNode.java
index fb965b8..1181f25 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/extension/CameraNode.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/extension/CameraNode.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/extension/PassNode.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/extension/PassNode.java
index 8d2377d..6a24957 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/extension/PassNode.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/extension/PassNode.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -24,7 +24,7 @@ import com.ardor3d.util.export.OutputCapsule;
public class PassNode extends Node {
- private List<PassNodeState> _passNodeStates = new ArrayList<PassNodeState>();
+ private List<PassNodeState> _passNodeStates = new ArrayList<>();
public PassNode(final String name) {
super(name);
diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/extension/PassNodeState.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/extension/PassNodeState.java
index c34d4f9..473a70b 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/extension/PassNodeState.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/extension/PassNodeState.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -33,7 +33,7 @@ public class PassNodeState implements Savable, Serializable {
* RenderStates registered with this pass - if a given state is not null it overrides the corresponding state set
* during rendering.
*/
- protected final EnumMap<RenderState.StateType, RenderState> _passStates = new EnumMap<RenderState.StateType, RenderState>(
+ protected final EnumMap<RenderState.StateType, RenderState> _passStates = new EnumMap<>(
RenderState.StateType.class);
/**
@@ -99,16 +99,19 @@ public class PassNodeState implements Savable, Serializable {
_enabled = enabled;
}
+ @Override
public Class<? extends PassNodeState> getClassTag() {
return this.getClass();
}
+ @Override
public void write(final OutputCapsule capsule) throws IOException {
final OutputCapsule oc = capsule;
oc.write(_enabled, "enabled", true);
oc.write(_passStates.values().toArray(new RenderState[0]), "passStates", null);
}
+ @Override
public void read(final InputCapsule capsule) throws IOException {
final InputCapsule ic = capsule;
_enabled = ic.readBoolean("enabled", true);
diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/extension/QuadImposterNode.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/extension/QuadImposterNode.java
index 1500c5d..5ea9c5c 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/extension/QuadImposterNode.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/extension/QuadImposterNode.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/extension/Skybox.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/extension/Skybox.java
index c396e0b..3567b54 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/extension/Skybox.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/extension/Skybox.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/extension/SwitchNode.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/extension/SwitchNode.java
index 34b3ff4..88bb6f6 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/extension/SwitchNode.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/extension/SwitchNode.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/hint/CullHint.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/hint/CullHint.java
index 74a9399..d391914 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/hint/CullHint.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/hint/CullHint.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/hint/DataMode.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/hint/DataMode.java
index ba4673d..c2ea681 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/hint/DataMode.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/hint/DataMode.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/hint/Hintable.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/hint/Hintable.java
index 0df2795..fd68b8a 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/hint/Hintable.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/hint/Hintable.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/hint/NormalsMode.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/hint/NormalsMode.java
index 84b6a9c..870dd38 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/hint/NormalsMode.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/hint/NormalsMode.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/hint/PickingHint.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/hint/PickingHint.java
index 54e4098..f07b844 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/hint/PickingHint.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/hint/PickingHint.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/hint/SceneHints.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/hint/SceneHints.java
index 36a239c..a56d106 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/hint/SceneHints.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/hint/SceneHints.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -448,10 +448,12 @@ public class SceneHints implements Savable {
// Methods for Savable
// /////////////////
+ @Override
public Class<? extends SceneHints> getClassTag() {
return this.getClass();
}
+ @Override
public void read(final InputCapsule capsule) throws IOException {
_orthoOrder = capsule.readInt("orthoOrder", 0);
_cullHint = capsule.readEnum("cullMode", CullHint.class, CullHint.Inherit);
@@ -478,6 +480,7 @@ public class SceneHints implements Savable {
}
}
+ @Override
public void write(final OutputCapsule capsule) throws IOException {
capsule.write(_orthoOrder, "orthoOrder", 0);
capsule.write(_cullHint, "cullMode", CullHint.Inherit);
diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/hint/TransparencyType.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/hint/TransparencyType.java
index 71520a4..f92c1d4 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/hint/TransparencyType.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/hint/TransparencyType.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Arrow.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Arrow.java
index e1e8e7d..0c48c7d 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Arrow.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Arrow.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/AxisRods.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/AxisRods.java
index 3d2914b..c717311 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/AxisRods.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/AxisRods.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Box.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Box.java
index 11acbfd..c9a12aa 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Box.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Box.java
@@ -1,9 +1,9 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* 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>.
*/
@@ -40,7 +40,7 @@ public class Box extends Mesh implements Cloneable {
/**
* Constructs a new 1x1x1 <code>Box</code> with the given name.
- *
+ *
* @param name
* the name to give this new box. This is required for identification and comparison purposes.
*/
@@ -52,7 +52,7 @@ public class Box extends Mesh implements Cloneable {
/**
* Constructs a new <code>Box</code> object using the given two points as opposite corners of the box. These two
* points may be in any order.
- *
+ *
* @param name
* the name to give this new box. This is required for identification and comparison purposes.
* @param pntA
@@ -68,7 +68,7 @@ public class Box extends Mesh implements Cloneable {
/**
* Constructs a new <code>Box</code> object using the given center and extents. Since the extents represent the
* distance from the center of the box to the edge, the full length of a side is actually 2 * extent.
- *
+ *
* @param name
* the name to give this new box. This is required for identification and comparison purposes.
* @param center
@@ -117,7 +117,7 @@ public class Box extends Mesh implements Cloneable {
/**
* Updates the center point and extents of this box to match an axis-aligned box defined by the two given opposite
* corners.
- *
+ *
* @param pntA
* the first point
* @param pntB
@@ -134,7 +134,7 @@ public class Box extends Mesh implements Cloneable {
/**
* Updates the center point and extents of this box using the defined values.
- *
+ *
* @param center
* The center of the box.
* @param xExtent
@@ -144,7 +144,8 @@ public class Box extends Mesh implements Cloneable {
* @param zExtent
* z extent of the box
*/
- public void setData(final ReadOnlyVector3 center, final double xExtent, final double yExtent, final double zExtent) {
+ public void setData(final ReadOnlyVector3 center, final double xExtent, final double yExtent,
+ final double zExtent) {
if (center != null) {
_center.set(center);
}
@@ -244,12 +245,13 @@ public class Box extends Mesh implements Cloneable {
for (int i = 0; i < 4; i++) {
_meshData.getNormalBuffer().put(0).put(-1).put(0);
}
+ _meshData.getNormalBuffer().rewind();
}
}
/**
* <code>setTextureData</code> sets the points that define the texture of the box. It's a one-to-one ratio, where
- * each plane of the box has it's own copy of the texture. That is, the texture is repeated one time for each six
+ * each plane of the box has its own copy of the texture. That is, the texture is repeated one time for each six
* faces.
*/
private void setTextureData() {
@@ -263,6 +265,7 @@ public class Box extends Mesh implements Cloneable {
tex.put(0).put(1);
tex.put(1).put(1);
}
+ tex.rewind();
}
}
@@ -283,7 +286,7 @@ public class Box extends Mesh implements Cloneable {
/**
* <code>clone</code> creates a new Box object containing the same data as this one.
- *
+ *
* @return the new Box
*/
@Override
diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Capsule.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Capsule.java
index 7dce5dd..ccffa38 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Capsule.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Capsule.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Cone.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Cone.java
index 1e5b6c4..3db1709 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Cone.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Cone.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Cylinder.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Cylinder.java
index fd56cb6..f29beec 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Cylinder.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Cylinder.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Disk.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Disk.java
index 3ada7d3..bc03418 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Disk.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Disk.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Dodecahedron.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Dodecahedron.java
index adf1ce5..7c65392 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Dodecahedron.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Dodecahedron.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Dome.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Dome.java
index 121f33c..a7031de 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Dome.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Dome.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Extrusion.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Extrusion.java
index 6fb83ae..ea6e3ee 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Extrusion.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Extrusion.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -266,7 +266,7 @@ public class Extrusion extends Mesh {
final double d[][] = new double[3][np]; // Newton form coefficients
final double x[] = new double[np]; // x-coordinates of nodes
- final List<ReadOnlyVector3> path = new ArrayList<ReadOnlyVector3>();
+ final List<ReadOnlyVector3> path = new ArrayList<>();
for (int i = 0; i < np; i++) {
ReadOnlyVector3 p;
diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/GeoSphere.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/GeoSphere.java
index eaa2580..d5b3be8 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/GeoSphere.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/GeoSphere.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Hexagon.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Hexagon.java
index 5aaecc3..7082250 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Hexagon.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Hexagon.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Icosahedron.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Icosahedron.java
index 4725e36..b399d03 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Icosahedron.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Icosahedron.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/MultiFaceBox.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/MultiFaceBox.java
index 4698562..473c71f 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/MultiFaceBox.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/MultiFaceBox.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Octahedron.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Octahedron.java
index b4e1785..7971281 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Octahedron.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Octahedron.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/OrientedBox.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/OrientedBox.java
index 6983a9c..82c485b 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/OrientedBox.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/OrientedBox.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/PQTorus.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/PQTorus.java
index f1380a0..4aa3af5 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/PQTorus.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/PQTorus.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Pyramid.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Pyramid.java
index 9a008f6..db75d76 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Pyramid.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Pyramid.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Quad.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Quad.java
index e2036fd..84c7493 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Quad.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Quad.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/RoundedBox.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/RoundedBox.java
index 31b52d1..267cbfc 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/RoundedBox.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/RoundedBox.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Sphere.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Sphere.java
index 46e1e18..8c9ff84 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Sphere.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Sphere.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/StripBox.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/StripBox.java
index 72bc15a..4d5f2c9 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/StripBox.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/StripBox.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Teapot.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Teapot.java
index 06945f2..82057ad 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Teapot.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Teapot.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Torus.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Torus.java
index 6f36c28..25d236e 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Torus.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Torus.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Tube.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Tube.java
index 898f9e9..b48bb4d 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Tube.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/shape/Tube.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/visitor/DeleteVBOsVisitor.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/visitor/DeleteVBOsVisitor.java
index 03c075a..d2b1500 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/visitor/DeleteVBOsVisitor.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/visitor/DeleteVBOsVisitor.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -22,6 +22,7 @@ public class DeleteVBOsVisitor implements Visitor {
_deleter = deleter;
}
+ @Override
public void visit(final Spatial spatial) {
if (spatial instanceof Mesh) {
final Mesh mesh = (Mesh) spatial;
diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/visitor/SetModelBoundVisitor.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/visitor/SetModelBoundVisitor.java
index 9e809df..a6a263a 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/visitor/SetModelBoundVisitor.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/visitor/SetModelBoundVisitor.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -21,6 +21,7 @@ public class SetModelBoundVisitor implements Visitor {
_bound = bound;
}
+ @Override
public void visit(final Spatial spatial) {
if (spatial instanceof Mesh) {
((Mesh) spatial).setModelBound(_bound.clone(null));
diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/visitor/UpdateModelBoundVisitor.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/visitor/UpdateModelBoundVisitor.java
index b313613..931b2d9 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/visitor/UpdateModelBoundVisitor.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/visitor/UpdateModelBoundVisitor.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -14,6 +14,7 @@ import com.ardor3d.scenegraph.Mesh;
import com.ardor3d.scenegraph.Spatial;
public class UpdateModelBoundVisitor implements Visitor {
+ @Override
public void visit(final Spatial spatial) {
if (spatial instanceof Mesh) {
((Mesh) spatial).updateModelBound();
diff --git a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/visitor/Visitor.java b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/visitor/Visitor.java
index d861a5c..ea22b8e 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/scenegraph/visitor/Visitor.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/scenegraph/visitor/Visitor.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/spline/ArcLengthTable.java b/ardor3d-core/src/main/java/com/ardor3d/spline/ArcLengthTable.java
index df2fc6c..73e9784 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/spline/ArcLengthTable.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/spline/ArcLengthTable.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -172,7 +172,7 @@ public class ArcLengthTable {
throw new IllegalArgumentException("step must be > 0! step=" + step);
}
- _lookupTable = new HashMap<Integer, List<ArcLengthEntry>>();
+ _lookupTable = new HashMap<>();
final Vector3 target = Vector3.fetchTempInstance();
final Vector3 previous = Vector3.fetchTempInstance();
@@ -187,7 +187,7 @@ public class ArcLengthTable {
previous.set(_curve.getControlPoints().get(i));
- final ArrayList<ArcLengthEntry> entries = new ArrayList<ArcLengthEntry>();
+ final ArrayList<ArcLengthEntry> entries = new ArrayList<>();
entries.add(new ArcLengthEntry(0f, 0));
final int endIndex = reverse ? startIndex - 1 : startIndex + 1;
diff --git a/ardor3d-core/src/main/java/com/ardor3d/spline/CatmullRomSpline.java b/ardor3d-core/src/main/java/com/ardor3d/spline/CatmullRomSpline.java
index 14ceb0c..020c89a 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/spline/CatmullRomSpline.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/spline/CatmullRomSpline.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -32,6 +32,7 @@ public class CatmullRomSpline implements Spline {
/**
* @see #interpolate(ReadOnlyVector3, ReadOnlyVector3, ReadOnlyVector3, ReadOnlyVector3, double, Vector3)
*/
+ @Override
public Vector3 interpolate(final ReadOnlyVector3 p0, final ReadOnlyVector3 p1, final ReadOnlyVector3 p2,
final ReadOnlyVector3 p3, final double t) {
@@ -56,6 +57,7 @@ public class CatmullRomSpline implements Spline {
* The results from the interpolation will be stored in this vector.
* @return The result vector as a convenience.
*/
+ @Override
public Vector3 interpolate(final ReadOnlyVector3 p0, final ReadOnlyVector3 p1, final ReadOnlyVector3 p2,
final ReadOnlyVector3 p3, final double t, final Vector3 result) {
diff --git a/ardor3d-core/src/main/java/com/ardor3d/spline/Curve.java b/ardor3d-core/src/main/java/com/ardor3d/spline/Curve.java
index 07121a6..76b1c40 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/spline/Curve.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/spline/Curve.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/spline/Spline.java b/ardor3d-core/src/main/java/com/ardor3d/spline/Spline.java
index 963b0c5..f7dcff0 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/spline/Spline.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/spline/Spline.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/ui/text/BMFont.java b/ardor3d-core/src/main/java/com/ardor3d/ui/text/BMFont.java
index 9878f92..8aeda6a 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/ui/text/BMFont.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/ui/text/BMFont.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -14,6 +14,7 @@ import java.io.IOException;
import java.io.OutputStream;
import java.net.MalformedURLException;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -42,8 +43,6 @@ import com.ardor3d.util.export.InputCapsule;
import com.ardor3d.util.export.OutputCapsule;
import com.ardor3d.util.export.Savable;
import com.ardor3d.util.resource.ResourceSource;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
/**
* Loads a font generated by BMFont ({@link http://www.angelcode.com/products/bmfont/}).
@@ -56,11 +55,11 @@ import com.google.common.collect.Maps;
public class BMFont implements Savable {
private static Logger logger = Logger.getLogger(BMFont.class.getName());
- private final Map<Integer, Char> _charMap = Maps.newHashMap();
- private final Map<Integer, Map<Integer, Integer>> _kernMap = Maps.newHashMap();
+ private final Map<Integer, Char> _charMap = new HashMap<>();
+ private final Map<Integer, Map<Integer, Integer>> _kernMap = new HashMap<>();
private String _styleName; // e.g. "Courier-12-bold"
- private final List<Page> _pages = Lists.newArrayList();
+ private final ArrayList<Page> _pages = new ArrayList<>();
private Texture _pageTexture;
private RenderStateSetter _blendStateSetter = null;
private RenderStateSetter _alphaStateSetter = null;
@@ -430,7 +429,7 @@ public class BMFont implements Savable {
}
public List<Integer> getMappedChars() {
- return Lists.newArrayList(_charMap.keySet());
+ return new ArrayList<>(_charMap.keySet());
}
public Map<Integer, Integer> getKerningsForCharacter(final int val) {
@@ -562,7 +561,7 @@ public class BMFont implements Savable {
Map<Integer, Integer> amtHash;
amtHash = _kernMap.get(first);
if (amtHash == null) {
- amtHash = Maps.newHashMap();
+ amtHash = new HashMap<>();
_kernMap.put(first, amtHash);
}
amtHash.put(second, amount);
@@ -890,10 +889,10 @@ public class BMFont implements Savable {
// Pages
capsule.writeSavableList(_pages, "pages", _pages);
// Chars
- capsule.writeSavableList(new ArrayList<Char>(_charMap.values()), "charMap", null);
+ capsule.writeSavableList(new ArrayList<>(_charMap.values()), "charMap", null);
// Kernings
- final List<Kerning> kernings = new ArrayList<Kerning>();
+ final List<Kerning> kernings = new ArrayList<>();
for (final Iterator<Integer> iterator = _kernMap.keySet().iterator(); iterator.hasNext();) {
final Integer first = iterator.next();
final Map<Integer, Integer> amtHash = _kernMap.get(first);
@@ -944,7 +943,7 @@ public class BMFont implements Savable {
Map<Integer, Integer> amtHash;
amtHash = _kernMap.get(k.first);
if (amtHash == null) {
- amtHash = Maps.newHashMap();
+ amtHash = new HashMap<>();
_kernMap.put(k.first, amtHash);
}
amtHash.put(k.second, k.amount);
diff --git a/ardor3d-core/src/main/java/com/ardor3d/ui/text/BMFontManager.java b/ardor3d-core/src/main/java/com/ardor3d/ui/text/BMFontManager.java
index 9287193..3578eec 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/ui/text/BMFontManager.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/ui/text/BMFontManager.java
@@ -25,7 +25,7 @@ public class BMFontManager {
private static final BMFontManager INSTANCE = new BMFontManager();
- private final HashMap<String, BMFont> _loadedFonts = new HashMap<String, BMFont>();
+ private final HashMap<String, BMFont> _loadedFonts = new HashMap<>();
public enum FontStyle {
ArialMedium("arial-24-bold-regular"), //
diff --git a/ardor3d-core/src/main/java/com/ardor3d/ui/text/BMText.java b/ardor3d-core/src/main/java/com/ardor3d/ui/text/BMText.java
index b00cf26..b357e54 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/ui/text/BMText.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/ui/text/BMText.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -11,6 +11,7 @@
package com.ardor3d.ui.text;
import java.nio.FloatBuffer;
+import java.util.ArrayList;
import java.util.List;
import java.util.logging.Logger;
@@ -30,7 +31,6 @@ import com.ardor3d.scenegraph.Mesh;
import com.ardor3d.scenegraph.hint.LightCombineMode;
import com.ardor3d.scenegraph.hint.TextureCombineMode;
import com.ardor3d.util.geom.BufferUtils;
-import com.google.common.collect.Lists;
/**
* Text spatial which uses textures generated by BMFont
@@ -55,7 +55,7 @@ public class BMText extends Mesh {
protected ColorRGBA _textClr = new ColorRGBA(1, 1, 1, 1);
protected ColorRGBA _tempClr = new ColorRGBA(1, 1, 1, 1);
- final protected List<BMTextChangeListener> _listeners = Lists.newArrayList();
+ final protected List<BMTextChangeListener> _listeners = new ArrayList<>();
public enum AutoScale {
/**
diff --git a/ardor3d-core/src/main/java/com/ardor3d/ui/text/BasicText.java b/ardor3d-core/src/main/java/com/ardor3d/ui/text/BasicText.java
index 36c9e27..325f9ac 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/ui/text/BasicText.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/ui/text/BasicText.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/ui/text/CopyPasteImpl.java b/ardor3d-core/src/main/java/com/ardor3d/ui/text/CopyPasteImpl.java
new file mode 100644
index 0000000..e80b667
--- /dev/null
+++ b/ardor3d-core/src/main/java/com/ardor3d/ui/text/CopyPasteImpl.java
@@ -0,0 +1,17 @@
+/**
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
+ *
+ * This file is part of Ardor3D.
+ *
+ * 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>.
+ */
+
+package com.ardor3d.ui.text;
+
+public interface CopyPasteImpl {
+ String getClipBoardContents();
+
+ void setClipBoardContents(String contents);
+}
diff --git a/ardor3d-core/src/main/java/com/ardor3d/ui/text/NullCopyPasteImpl.java b/ardor3d-core/src/main/java/com/ardor3d/ui/text/NullCopyPasteImpl.java
new file mode 100644
index 0000000..132671c
--- /dev/null
+++ b/ardor3d-core/src/main/java/com/ardor3d/ui/text/NullCopyPasteImpl.java
@@ -0,0 +1,24 @@
+/**
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
+ *
+ * This file is part of Ardor3D.
+ *
+ * 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>.
+ */
+
+package com.ardor3d.ui.text;
+
+
+public class NullCopyPasteImpl implements CopyPasteImpl {
+
+ @Override
+ public String getClipBoardContents() {
+ return null;
+ }
+
+ @Override
+ public void setClipBoardContents(final String contents) {}
+
+}
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/Ardor3dException.java b/ardor3d-core/src/main/java/com/ardor3d/util/Ardor3dException.java
index d851b96..50e20fd 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/Ardor3dException.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/Ardor3dException.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/Constants.java b/ardor3d-core/src/main/java/com/ardor3d/util/Constants.java
index cc8a793..71210ac 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/Constants.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/Constants.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/ContextGarbageCollector.java b/ardor3d-core/src/main/java/com/ardor3d/util/ContextGarbageCollector.java
index 8ee7111..89d32ea 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/ContextGarbageCollector.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/ContextGarbageCollector.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/ContextIdReference.java b/ardor3d-core/src/main/java/com/ardor3d/util/ContextIdReference.java
index 427b6cd..b613b1b 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/ContextIdReference.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/ContextIdReference.java
@@ -1,9 +1,9 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* 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>.
*/
@@ -12,19 +12,18 @@ package com.ardor3d.util;
import java.lang.ref.PhantomReference;
import java.lang.ref.ReferenceQueue;
+import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
-
-import com.google.common.collect.Lists;
-import com.google.common.collect.MapMaker;
+import java.util.WeakHashMap;
public class ContextIdReference<T> extends PhantomReference<T> {
/**
* Keep a strong reference to these objects until their reference is cleared.
*/
- private static final List<ContextIdReference<?>> REFS = Lists.newLinkedList();
+ private static final List<ContextIdReference<?>> REFS = new LinkedList<>();
private final Map<Object, Integer> _idCache;
private Integer _singleContextId;
@@ -32,7 +31,7 @@ public class ContextIdReference<T> extends PhantomReference<T> {
public ContextIdReference(final T reference, final ReferenceQueue<? super T> queue) {
super(reference, queue);
if (Constants.useMultipleContexts) {
- _idCache = new MapMaker().initialCapacity(2).weakKeys().makeMap();
+ _idCache = new WeakHashMap<>(2);
} else {
_idCache = null;
}
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/DrawableCamera.java b/ardor3d-core/src/main/java/com/ardor3d/util/DrawableCamera.java
index e4ca2a8..6c7101b 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/DrawableCamera.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/DrawableCamera.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/ExtendedCamera.java b/ardor3d-core/src/main/java/com/ardor3d/util/ExtendedCamera.java
index 23833f2..41db466 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/ExtendedCamera.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/ExtendedCamera.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/GameTask.java b/ardor3d-core/src/main/java/com/ardor3d/util/GameTask.java
index 6811d5c..46e4e4c 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/GameTask.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/GameTask.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -42,6 +42,7 @@ public class GameTask<V> implements Future<V> {
* @param mayInterruptIfRunning
* ignored by this implementation.
*/
+ @Override
public boolean cancel(final boolean mayInterruptIfRunning) {
_stateLock.lock();
try {
@@ -58,6 +59,7 @@ public class GameTask<V> implements Future<V> {
}
}
+ @Override
public V get() throws InterruptedException, ExecutionException {
_stateLock.lock();
try {
@@ -73,6 +75,7 @@ public class GameTask<V> implements Future<V> {
}
}
+ @Override
public V get(final long timeout, final TimeUnit unit) throws InterruptedException, ExecutionException,
TimeoutException {
_stateLock.lock();
@@ -92,6 +95,7 @@ public class GameTask<V> implements Future<V> {
}
}
+ @Override
public boolean isCancelled() {
_stateLock.lock();
try {
@@ -101,6 +105,7 @@ public class GameTask<V> implements Future<V> {
}
}
+ @Override
public boolean isDone() {
_stateLock.lock();
try {
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/GameTaskQueue.java b/ardor3d-core/src/main/java/com/ardor3d/util/GameTaskQueue.java
index 2a0e17c..130f6b1 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/GameTaskQueue.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/GameTaskQueue.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -38,13 +38,13 @@ public class GameTaskQueue {
public static final String RENDER = "render";
public static final String UPDATE = "update";
- private final ConcurrentLinkedQueue<GameTask<?>> _queue = new ConcurrentLinkedQueue<GameTask<?>>();
+ private final ConcurrentLinkedQueue<GameTask<?>> _queue = new ConcurrentLinkedQueue<>();
private final AtomicBoolean _executeMultiple = new AtomicBoolean();
// Default execution time is 0, which means only 1 task will be executed at a time.
private long _executionTime = 0;
- private final List<ExecutionExceptionListener> _executionExceptionListeners = new LinkedList<ExecutionExceptionListener>();
+ private final List<ExecutionExceptionListener> _executionExceptionListeners = new LinkedList<>();
public void addExecutionExceptionListener(final ExecutionExceptionListener l) {
_executionExceptionListeners.add(l);
@@ -111,7 +111,7 @@ public class GameTaskQueue {
* @return
*/
public <V> Future<V> enqueue(final Callable<V> callable) {
- final GameTask<V> task = new GameTask<V>(callable);
+ final GameTask<V> task = new GameTask<>(callable);
_queue.add(task);
return task;
}
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/GameTaskQueueManager.java b/ardor3d-core/src/main/java/com/ardor3d/util/GameTaskQueueManager.java
index 4f57874..3000bd1 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/GameTaskQueueManager.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/GameTaskQueueManager.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -25,7 +25,7 @@ public final class GameTaskQueueManager {
private static final Object MAP_LOCK = new Object();
private static final ConcurrentMap<Object, GameTaskQueueManager> _managers = new MapMaker().weakKeys().makeMap();
- private final ConcurrentMap<String, GameTaskQueue> _managedQueues = new ConcurrentHashMap<String, GameTaskQueue>(2);
+ private final ConcurrentMap<String, GameTaskQueue> _managedQueues = new ConcurrentHashMap<>(2);
public static GameTaskQueueManager getManager(final Object key) {
synchronized (MAP_LOCK) {
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/LittleEndianDataInput.java b/ardor3d-core/src/main/java/com/ardor3d/util/LittleEndianDataInput.java
index c3c8ec4..4f32a19 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/LittleEndianDataInput.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/LittleEndianDataInput.java
@@ -1,9 +1,9 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* 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>.
*/
@@ -20,7 +20,7 @@ import java.io.InputStream;
* LittleEndianDataInput is a class to read little-endian stored data via a InputStream. All functions work as defined
* in DataInput, but assume they come from a LittleEndian input stream.
*/
-public class LittleEndianDataInput implements DataInput {
+public class LittleEndianDataInput implements DataInput, AutoCloseable {
private final BufferedInputStream _stream;
@@ -33,7 +33,7 @@ public class LittleEndianDataInput implements DataInput {
/**
* Creates a new LittleEndian reader from the given input stream. The stream is wrapped in a BufferedInputStream
* automatically.
- *
+ *
* @param in
* The input stream to read from.
*/
@@ -41,6 +41,7 @@ public class LittleEndianDataInput implements DataInput {
_stream = new BufferedInputStream(in);
}
+ @Override
public final int readUnsignedShort() throws IOException {
return (_stream.read() & 0xff) | ((_stream.read() & 0xff) << 8);
}
@@ -49,54 +50,65 @@ public class LittleEndianDataInput implements DataInput {
* read an unsigned int as a long
*/
public final long readUnsignedInt() throws IOException {
- return ((_stream.read() & 0xff) | ((_stream.read() & 0xff) << 8) | ((_stream.read() & 0xff) << 16) | (((long) (_stream
- .read() & 0xff)) << 24));
+ return ((_stream.read() & 0xff) | ((_stream.read() & 0xff) << 8) | ((_stream.read() & 0xff) << 16)
+ | (((long) (_stream.read() & 0xff)) << 24));
}
+ @Override
public final boolean readBoolean() throws IOException {
return (_stream.read() != 0);
}
+ @Override
public final byte readByte() throws IOException {
return (byte) _stream.read();
}
+ @Override
public final int readUnsignedByte() throws IOException {
return _stream.read();
}
+ @Override
public final short readShort() throws IOException {
return (short) readUnsignedShort();
}
+ @Override
public final char readChar() throws IOException {
return (char) readUnsignedShort();
}
+ @Override
public final int readInt() throws IOException {
- return ((_stream.read() & 0xff) | ((_stream.read() & 0xff) << 8) | ((_stream.read() & 0xff) << 16) | ((_stream
- .read() & 0xff) << 24));
+ return ((_stream.read() & 0xff) | ((_stream.read() & 0xff) << 8) | ((_stream.read() & 0xff) << 16)
+ | ((_stream.read() & 0xff) << 24));
}
+ @Override
public final long readLong() throws IOException {
- return ((_stream.read() & 0xff) | ((long) (_stream.read() & 0xff) << 8)
- | ((long) (_stream.read() & 0xff) << 16) | ((long) (_stream.read() & 0xff) << 24)
- | ((long) (_stream.read() & 0xff) << 32) | ((long) (_stream.read() & 0xff) << 40)
- | ((long) (_stream.read() & 0xff) << 48) | ((long) (_stream.read() & 0xff) << 56));
+ return ((_stream.read() & 0xff) | ((long) (_stream.read() & 0xff) << 8) | ((long) (_stream.read() & 0xff) << 16)
+ | ((long) (_stream.read() & 0xff) << 24) | ((long) (_stream.read() & 0xff) << 32)
+ | ((long) (_stream.read() & 0xff) << 40) | ((long) (_stream.read() & 0xff) << 48)
+ | ((long) (_stream.read() & 0xff) << 56));
}
+ @Override
public final float readFloat() throws IOException {
return Float.intBitsToFloat(readInt());
}
+ @Override
public final double readDouble() throws IOException {
return Double.longBitsToDouble(readLong());
}
+ @Override
public final void readFully(final byte b[]) throws IOException {
readFully(b, 0, b.length);
}
+ @Override
public final void readFully(final byte b[], final int off, final int len) throws IOException {
// this may look over-complicated, but the problem is that the InputStream.read() methods are
// not guaranteed to fill up the buffer you pass to it. So we need to loop until we have filled
@@ -114,18 +126,22 @@ public class LittleEndianDataInput implements DataInput {
}
}
+ @Override
public final int skipBytes(final int n) throws IOException {
return (int) _stream.skip(n);
}
+ @Override
public final String readLine() throws IOException {
throw new IOException("Unsupported operation");
}
+ @Override
public final String readUTF() throws IOException {
throw new IOException("Unsupported operation");
}
+ @Override
public final void close() throws IOException {
_stream.close();
}
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/LittleEndianRandomAccessDataInput.java b/ardor3d-core/src/main/java/com/ardor3d/util/LittleEndianRandomAccessDataInput.java
index 33ced8f..a53312e 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/LittleEndianRandomAccessDataInput.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/LittleEndianRandomAccessDataInput.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -59,6 +59,7 @@ public class LittleEndianRandomAccessDataInput implements DataInput {
_contents = contents;
}
+ @Override
public final int readUnsignedShort() throws IOException {
return (readByte() & 0xff) | ((readByte() & 0xff) << 8);
}
@@ -67,48 +68,59 @@ public class LittleEndianRandomAccessDataInput implements DataInput {
return ((readByte() & 0xff) | ((readByte() & 0xff) << 8) | ((readByte() & 0xff) << 16) | (((long) (readByte() & 0xff)) << 24));
}
+ @Override
public final boolean readBoolean() throws IOException {
return (readByte() != 0);
}
+ @Override
public final byte readByte() throws IOException {
return _contents.get();
}
+ @Override
public final int readUnsignedByte() throws IOException {
return readByte() & 0xff;
}
+ @Override
public final short readShort() throws IOException {
return (short) readUnsignedShort();
}
+ @Override
public final char readChar() throws IOException {
return (char) readUnsignedShort();
}
+ @Override
public final int readInt() throws IOException {
return ((readByte() & 0xff) | ((readByte() & 0xff) << 8) | ((readByte() & 0xff) << 16) | ((readByte() & 0xff) << 24));
}
+ @Override
public final long readLong() throws IOException {
return ((readByte() & 0xff) | ((long) (readByte() & 0xff) << 8) | ((long) (readByte() & 0xff) << 16)
| ((long) (readByte() & 0xff) << 24) | ((long) (readByte() & 0xff) << 32)
| ((long) (readByte() & 0xff) << 40) | ((long) (readByte() & 0xff) << 48) | ((long) (readByte() & 0xff) << 56));
}
+ @Override
public final float readFloat() throws IOException {
return Float.intBitsToFloat(readInt());
}
+ @Override
public final double readDouble() throws IOException {
return Double.longBitsToDouble(readLong());
}
+ @Override
public final void readFully(final byte b[]) throws IOException {
readFully(b, 0, b.length);
}
+ @Override
public final void readFully(final byte b[], final int off, final int len) throws IOException {
if (len - off + _contents.position() > _contents.capacity()) {
throw new EOFException("EOF reached");
@@ -117,6 +129,7 @@ public class LittleEndianRandomAccessDataInput implements DataInput {
}
}
+ @Override
public final int skipBytes(final int n) throws IOException {
if (_contents.remaining() >= n) {
_contents.position(_contents.position() + n);
@@ -155,6 +168,7 @@ public class LittleEndianRandomAccessDataInput implements DataInput {
* @throws IOException
* if this method is called.
*/
+ @Override
public final String readLine() throws IOException {
throw new IOException("operation unsupported.");
}
@@ -165,6 +179,7 @@ public class LittleEndianRandomAccessDataInput implements DataInput {
* @throws IOException
* if this method is called.
*/
+ @Override
public final String readUTF() throws IOException {
throw new IOException("operation unsupported.");
}
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/ReadOnlyTimer.java b/ardor3d-core/src/main/java/com/ardor3d/util/ReadOnlyTimer.java
index 281add4..e5840f4 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/ReadOnlyTimer.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/ReadOnlyTimer.java
@@ -1,5 +1,5 @@
/**
-/ * Copyright (c) 2008-2012 Ardor Labs, Inc.
+/ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/SimpleContextIdReference.java b/ardor3d-core/src/main/java/com/ardor3d/util/SimpleContextIdReference.java
index 74adc79..f573051 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/SimpleContextIdReference.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/SimpleContextIdReference.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -12,16 +12,15 @@ package com.ardor3d.util;
import java.lang.ref.PhantomReference;
import java.lang.ref.ReferenceQueue;
+import java.util.LinkedList;
import java.util.List;
-import com.google.common.collect.Lists;
-
public class SimpleContextIdReference<T> extends PhantomReference<T> {
/**
* Keep a string reference to these objects until their reference is cleared.
*/
- private static final List<SimpleContextIdReference<?>> REFS = Lists.newLinkedList();
+ private static final List<SimpleContextIdReference<?>> REFS = new LinkedList<>();
private final int _id;
private final Object _glContext;
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/SortUtil.java b/ardor3d-core/src/main/java/com/ardor3d/util/SortUtil.java
index da15d1b..d669ea1 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/SortUtil.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/SortUtil.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/TextureKey.java b/ardor3d-core/src/main/java/com/ardor3d/util/TextureKey.java
index a8b7bb9..ce08108 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/TextureKey.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/TextureKey.java
@@ -1,9 +1,9 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* 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>.
*/
@@ -12,8 +12,11 @@ package com.ardor3d.util;
import java.io.IOException;
import java.lang.ref.WeakReference;
+import java.util.ArrayList;
import java.util.Iterator;
+import java.util.LinkedList;
import java.util.List;
+import java.util.Objects;
import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;
@@ -26,7 +29,6 @@ import com.ardor3d.util.export.InputCapsule;
import com.ardor3d.util.export.OutputCapsule;
import com.ardor3d.util.export.Savable;
import com.ardor3d.util.resource.ResourceSource;
-import com.google.common.collect.Lists;
/**
* <code>TextureKey</code> provides a way for the TextureManager to cache and retrieve <code>Texture</code> objects.
@@ -66,14 +68,14 @@ final public class TextureKey implements Savable {
private boolean _dirty;
/** cache of OpenGL context specific texture ids for the associated texture. */
- protected final transient ContextIdReference<TextureKey> _idCache = new ContextIdReference<TextureKey>(this,
+ protected final transient ContextIdReference<TextureKey> _idCache = new ContextIdReference<>(this,
TextureManager.getRefQueue());
/** cached hashcode value. */
protected transient int _code = Integer.MAX_VALUE;
/** cache of texturekey objects allowing us to find an existing texture key. */
- protected static final List<WeakReference<TextureKey>> _keyCache = Lists.newLinkedList();
+ protected static final List<WeakReference<TextureKey>> _keyCache = new LinkedList<>();
private static final Integer ZERO = new Integer(0);
@@ -83,7 +85,7 @@ final public class TextureKey implements Savable {
/** DO NOT USE. FOR INTERNAL USE ONLY */
protected TextureKey() {
if (Constants.useMultipleContexts) {
- _dirtyContexts = Lists.newArrayList();
+ _dirtyContexts = new ArrayList<>();
} else {
_dirtyContexts = null;
}
@@ -100,7 +102,7 @@ final public class TextureKey implements Savable {
_dirtyContexts.clear();
// grab all contexts we currently have ids for and add them all as dirty
for (final Object context : _idCache.getContextObjects()) {
- final WeakReference<Object> ref = new WeakReference<Object>(context);
+ final WeakReference<Object> ref = new WeakReference<>(context);
_dirtyContexts.add(ref);
}
}
@@ -165,7 +167,7 @@ final public class TextureKey implements Savable {
/**
* Get a new unique TextureKey. This is meant for use by RTT and other situations where we know we are making a
* unique texture.
- *
+ *
* @param minFilter
* our minification filter value.
* @return the new TextureKey
@@ -215,7 +217,7 @@ final public class TextureKey implements Savable {
}
// not found
- _keyCache.add(new WeakReference<TextureKey>(key));
+ _keyCache.add(new WeakReference<>(key));
return key;
}
@@ -263,7 +265,7 @@ final public class TextureKey implements Savable {
* Note: This does not remove the texture from the card and is provided for use by code that does remove textures
* from the card.
* </p>
- *
+ *
* @param glContext
* the object representing the OpenGL context this texture belongs to. See
* {@link RenderContext#getGlContextRep()}
@@ -287,7 +289,7 @@ final public class TextureKey implements Savable {
/**
* Sets the id for a texture in regards to the given OpenGL context.
- *
+ *
* @param glContext
* the object representing the OpenGL context a texture belongs to. See
* {@link RenderContext#getGlContextRep()}
@@ -346,13 +348,8 @@ final public class TextureKey implements Savable {
@Override
public int hashCode() {
if (_code == Integer.MAX_VALUE) {
- _code = 17;
-
- _code += 31 * _code + (_source != null ? _source.hashCode() : 0);
- _code += 31 * _code + (_id != null ? _id.hashCode() : 0);
- _code += 31 * _code + _minFilter.hashCode();
- _code += 31 * _code + _format.hashCode();
- _code += 31 * _code + (_flipped ? 1 : 0);
+ _code = Objects.hash(getSource(), getId(), getMinificationFilter(), getFormat(),
+ Boolean.valueOf(isFlipped()));
}
return _code;
}
@@ -394,10 +391,12 @@ final public class TextureKey implements Savable {
// Methods for Savable
// /////////////////
+ @Override
public Class<? extends TextureKey> getClassTag() {
return this.getClass();
}
+ @Override
public void write(final OutputCapsule capsule) throws IOException {
capsule.write(_source, "source", null);
capsule.write(_flipped, "flipped", false);
@@ -406,6 +405,7 @@ final public class TextureKey implements Savable {
capsule.write(_id, "id", null);
}
+ @Override
public void read(final InputCapsule capsule) throws IOException {
_source = (ResourceSource) capsule.readSavable("source", null);
_flipped = capsule.readBoolean("flipped", false);
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/TextureManager.java b/ardor3d-core/src/main/java/com/ardor3d/util/TextureManager.java
index 8a39852..d8c5315 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/TextureManager.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/TextureManager.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -46,10 +46,11 @@ final public class TextureManager {
private static Map<TextureKey, Texture> _tCache = new MapMaker().weakKeys().weakValues().makeMap();
- private static ReferenceQueue<TextureKey> _textureRefQueue = new ReferenceQueue<TextureKey>();
+ private static ReferenceQueue<TextureKey> _textureRefQueue = new ReferenceQueue<>();
static {
ContextManager.addContextCleanListener(new ContextCleanListener() {
+ @Override
public void cleanForContext(final RenderContext renderContext) {
TextureManager.cleanAllTextures(null, renderContext, null);
}
@@ -438,9 +439,12 @@ final public class TextureManager {
private static void handleTextureDelete(final Renderer deleter, final Multimap<Object, Integer> idMap,
final Map<Object, Future<Void>> futureStore) {
+ if (deleter == null) {
+ return;
+ }
Object currentGLRef = null;
// Grab the current context, if any.
- if (deleter != null && ContextManager.getCurrentContext() != null) {
+ if (ContextManager.getCurrentContext() != null) {
currentGLRef = ContextManager.getCurrentContext().getGlContextRep();
}
// For each affected context...
@@ -453,6 +457,7 @@ final public class TextureManager {
else {
final Future<Void> future = GameTaskQueueManager.getManager(ContextManager.getContextForRef(glref))
.render(new RendererCallable<Void>() {
+ @Override
public Void call() throws Exception {
getRenderer().deleteTextureIds(idMap.get(glref));
return null;
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/Timer.java b/ardor3d-core/src/main/java/com/ardor3d/util/Timer.java
index 4f99a60..1268066 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/Timer.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/Timer.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -27,22 +27,27 @@ public class Timer implements ReadOnlyTimer {
_startTime = System.nanoTime();
}
+ @Override
public double getTimeInSeconds() {
return getTime() * INVERSE_TIMER_RESOLUTION;
}
+ @Override
public long getTime() {
return System.nanoTime() - _startTime;
}
+ @Override
public long getResolution() {
return TIMER_RESOLUTION;
}
+ @Override
public double getFrameRate() {
return _fps;
}
+ @Override
public double getTimePerFrame() {
return _tpf;
}
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/UrlUtils.java b/ardor3d-core/src/main/java/com/ardor3d/util/UrlUtils.java
index d504892..7690b35 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/UrlUtils.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/UrlUtils.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryClassField.java b/ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryClassField.java
index d76d5fa..c71b664 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryClassField.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryClassField.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryClassObject.java b/ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryClassObject.java
index 06e2595..ad5c953 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryClassObject.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryClassObject.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryCloner.java b/ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryCloner.java
index c2fbc08..c30e166 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryCloner.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryCloner.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryExporter.java b/ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryExporter.java
index 1c3359c..f8d1fc8 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryExporter.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryExporter.java
@@ -1,9 +1,9 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* 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>.
*/
@@ -17,6 +17,7 @@ import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.IdentityHashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
@@ -28,8 +29,6 @@ import com.ardor3d.math.MathUtils;
import com.ardor3d.util.export.Ardor3dExporter;
import com.ardor3d.util.export.ByteUtils;
import com.ardor3d.util.export.Savable;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
/**
* Exports to the ardor3d Binary Format. Format descriptor: (each numbered item denotes a series of bytes that follows
@@ -124,14 +123,14 @@ public class BinaryExporter implements Ardor3dExporter {
protected int _aliasCount = 1;
protected int _idCount = 1;
- protected final Map<Savable, BinaryIdContentPair> _contentTable = Maps.newIdentityHashMap();
+ protected final Map<Savable, BinaryIdContentPair> _contentTable = new IdentityHashMap<>();
- protected final Map<Integer, Integer> _locationTable = Maps.newHashMap();
+ protected final Map<Integer, Integer> _locationTable = new HashMap<>();
// key - class name, value = bco
- protected final Map<String, BinaryClassObject> _classes = Maps.newHashMap();
+ protected final Map<String, BinaryClassObject> _classes = new HashMap<>();
- protected final List<Savable> _contentKeys = Lists.newArrayList();
+ protected final List<Savable> _contentKeys = new ArrayList<>();
public BinaryExporter() {
this(DEFAULT_COMPRESSION);
@@ -139,7 +138,7 @@ public class BinaryExporter implements Ardor3dExporter {
/**
* Construct a new exporter, specifying some options.
- *
+ *
* @param compression
* the compression type to use. One of the constants from {@link java.util.zip.Deflater}
*/
@@ -147,6 +146,7 @@ public class BinaryExporter implements Ardor3dExporter {
_compression = compression;
}
+ @Override
public void save(final Savable object, final OutputStream os) throws IOException {
try {
GZIPOutputStream zos = new GZIPOutputStream(os) {
@@ -196,8 +196,7 @@ public class BinaryExporter implements Ardor3dExporter {
// write out data to a seperate stream
int location = 0;
// keep track of location for each piece
- final HashMap<String, List<BinaryIdContentPair>> alreadySaved = new HashMap<String, List<BinaryIdContentPair>>(
- _contentTable.size());
+ final HashMap<String, List<BinaryIdContentPair>> alreadySaved = new HashMap<>(_contentTable.size());
for (final Savable savable : _contentKeys) {
// look back at previous written data for matches
final String savableName = savable.getClassTag().getName();
@@ -211,7 +210,7 @@ public class BinaryExporter implements Ardor3dExporter {
_locationTable.put(pair.getId(), location);
if (bucket == null) {
- bucket = new ArrayList<BinaryIdContentPair>();
+ bucket = new ArrayList<>();
alreadySaved.put(savableName + getChunk(pair), bucket);
}
bucket.add(pair);
@@ -297,15 +296,16 @@ public class BinaryExporter implements Ardor3dExporter {
return bytes;
}
+ @Override
public void save(final Savable object, final File file) throws IOException {
final File parentDirectory = file.getParentFile();
if (parentDirectory != null && !parentDirectory.exists()) {
parentDirectory.mkdirs();
}
- final FileOutputStream fos = new FileOutputStream(file);
- save(object, fos);
- fos.close();
+ try (final FileOutputStream fos = new FileOutputStream(file)) {
+ save(object, fos);
+ }
}
public int processBinarySavable(final Savable object) throws IOException {
@@ -317,7 +317,7 @@ public class BinaryExporter implements Ardor3dExporter {
if (bco == null) {
bco = new BinaryClassObject();
bco._alias = generateTag();
- bco._nameFields = new HashMap<String, BinaryClassField>();
+ bco._nameFields = new HashMap<>();
_classes.put(object.getClassTag().getName(), bco);
}
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryIdContentPair.java b/ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryIdContentPair.java
index 228f314..f82bf23 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryIdContentPair.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryIdContentPair.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryImporter.java b/ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryImporter.java
index 6e2c847..f77c220 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryImporter.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryImporter.java
@@ -1,9 +1,9 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* 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>.
*/
@@ -19,6 +19,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.util.HashMap;
+import java.util.IdentityHashMap;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -31,25 +32,25 @@ import com.ardor3d.util.export.Ardor3dImporter;
import com.ardor3d.util.export.ByteUtils;
import com.ardor3d.util.export.ReadListener;
import com.ardor3d.util.export.Savable;
-import com.google.common.collect.Maps;
public class BinaryImporter implements Ardor3dImporter {
private static final Logger logger = Logger.getLogger(BinaryImporter.class.getName());
// Key - alias, object - bco
- protected final Map<String, BinaryClassObject> _classes = Maps.newHashMap();
+ protected final Map<String, BinaryClassObject> _classes = new HashMap<>();
// Key - id, object - the savable
- protected final Map<Integer, Savable> _contentTable = Maps.newHashMap();
+ protected final Map<Integer, Savable> _contentTable = new HashMap<>();
// Key - savable, object - capsule
- protected final Map<Savable, BinaryInputCapsule> _capsuleTable = Maps.newIdentityHashMap();
+ protected final Map<Savable, BinaryInputCapsule> _capsuleTable = new IdentityHashMap<>();
// Key - id, opject - location in the file
- protected final Map<Integer, Integer> _locationTable = Maps.newHashMap();
+ protected final Map<Integer, Integer> _locationTable = new HashMap<>();
protected byte[] _dataArray = null;
protected int _aliasWidth = 0;
public BinaryImporter() {}
+ @Override
public Savable load(final InputStream is) throws IOException {
return load(is, null, null);
}
@@ -78,8 +79,8 @@ public class BinaryImporter implements Ardor3dImporter {
final int fields = ByteUtils.readInt(bis);
bytes += (8 + _aliasWidth + classLength);
- bco._nameFields = new HashMap<String, BinaryClassField>(fields);
- bco._aliasFields = new HashMap<Byte, BinaryClassField>(fields);
+ bco._nameFields = new HashMap<>(fields);
+ bco._aliasFields = new HashMap<>(fields);
for (int x = 0; x < fields; x++) {
final byte fieldAlias = (byte) bis.read();
final byte fieldType = (byte) bis.read();
@@ -155,33 +156,36 @@ public class BinaryImporter implements Ardor3dImporter {
}
}
+ @Override
public Savable load(final URL url) throws IOException {
return load(url, null);
}
public Savable load(final URL url, final ReadListener listener) throws IOException {
- final InputStream is = url.openStream();
- final Savable rVal = load(is, listener);
- is.close();
- return rVal;
+ try (final InputStream is = url.openStream()) {
+ final Savable rVal = load(is, listener);
+ return rVal;
+ }
}
+ @Override
public Savable load(final File file) throws IOException {
return load(file, null);
}
public Savable load(final File file, final ReadListener listener) throws IOException {
- final FileInputStream fis = new FileInputStream(file);
- final Savable rVal = load(fis, listener);
- fis.close();
- return rVal;
+ try (final FileInputStream fis = new FileInputStream(file)) {
+ final Savable rVal = load(fis, listener);
+ return rVal;
+ }
}
+ @Override
public Savable load(final byte[] data) throws IOException {
- final ByteArrayInputStream bais = new ByteArrayInputStream(data);
- final Savable rVal = load(bais);
- bais.close();
- return rVal;
+ try (final ByteArrayInputStream bais = new ByteArrayInputStream(data)) {
+ final Savable rVal = load(bais);
+ return rVal;
+ }
}
protected String readString(final InputStream is, final int length) throws IOException {
@@ -214,8 +218,8 @@ public class BinaryImporter implements Ardor3dImporter {
final BinaryClassObject bco = _classes.get(alias);
if (bco == null) {
- logger.logp(Level.SEVERE, this.getClass().toString(), "readObject(int id)", "NULL class object: "
- + alias);
+ logger.logp(Level.SEVERE, this.getClass().toString(), "readObject(int id)",
+ "NULL class object: " + alias);
return null;
}
@@ -240,18 +244,14 @@ public class BinaryImporter implements Ardor3dImporter {
} catch (final InstantiationException e) {
logger.logp(Level.SEVERE, this.getClass().toString(), "readObject(int)",
"Could not access constructor of class '" + bco._className + "'! \n"
- + "Some types may require the annotation SavableFactory. Please double check.", e);
+ + "Some types may require the annotation SavableFactory. Please double check.",
+ e);
throw new Ardor3dException(e);
} catch (final NoSuchMethodException e) {
- logger
- .logp(
- Level.SEVERE,
- this.getClass().toString(),
- "readObject(int)",
- e.getMessage()
- + " \n"
- + "Method specified in annotation does not appear to exist or has an invalid method signature.",
- e);
+ logger.logp(Level.SEVERE, this.getClass().toString(), "readObject(int)",
+ e.getMessage() + " \n"
+ + "Method specified in annotation does not appear to exist or has an invalid method signature.",
+ e);
throw new Ardor3dException(e);
}
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryInputCapsule.java b/ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryInputCapsule.java
index ade60ff..7580c62 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryInputCapsule.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryInputCapsule.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -46,7 +46,7 @@ public class BinaryInputCapsule implements InputCapsule {
}
public void setContent(final byte[] content, final int start, final int limit) {
- _fieldData = new HashMap<Byte, Object>();
+ _fieldData = new HashMap<>();
for (_index = start; _index < limit;) {
final byte alias = content[_index];
@@ -227,6 +227,7 @@ public class BinaryInputCapsule implements InputCapsule {
}
}
+ @Override
public BitSet readBitSet(final String name, final BitSet defVal) throws IOException {
final BinaryClassField field = _cObj._nameFields.get(name);
if (field == null || !_fieldData.containsKey(field._alias)) {
@@ -235,6 +236,7 @@ public class BinaryInputCapsule implements InputCapsule {
return (BitSet) _fieldData.get(field._alias);
}
+ @Override
public boolean readBoolean(final String name, final boolean defVal) throws IOException {
final BinaryClassField field = _cObj._nameFields.get(name);
if (field == null || !_fieldData.containsKey(field._alias)) {
@@ -243,6 +245,7 @@ public class BinaryInputCapsule implements InputCapsule {
return ((Boolean) _fieldData.get(field._alias)).booleanValue();
}
+ @Override
public boolean[] readBooleanArray(final String name, final boolean[] defVal) throws IOException {
final BinaryClassField field = _cObj._nameFields.get(name);
if (field == null || !_fieldData.containsKey(field._alias)) {
@@ -251,6 +254,7 @@ public class BinaryInputCapsule implements InputCapsule {
return (boolean[]) _fieldData.get(field._alias);
}
+ @Override
public boolean[][] readBooleanArray2D(final String name, final boolean[][] defVal) throws IOException {
final BinaryClassField field = _cObj._nameFields.get(name);
if (field == null || !_fieldData.containsKey(field._alias)) {
@@ -259,6 +263,7 @@ public class BinaryInputCapsule implements InputCapsule {
return (boolean[][]) _fieldData.get(field._alias);
}
+ @Override
public byte readByte(final String name, final byte defVal) throws IOException {
final BinaryClassField field = _cObj._nameFields.get(name);
if (field == null || !_fieldData.containsKey(field._alias)) {
@@ -267,6 +272,7 @@ public class BinaryInputCapsule implements InputCapsule {
return ((Byte) _fieldData.get(field._alias)).byteValue();
}
+ @Override
public byte[] readByteArray(final String name, final byte[] defVal) throws IOException {
final BinaryClassField field = _cObj._nameFields.get(name);
if (field == null || !_fieldData.containsKey(field._alias)) {
@@ -275,6 +281,7 @@ public class BinaryInputCapsule implements InputCapsule {
return (byte[]) _fieldData.get(field._alias);
}
+ @Override
public byte[][] readByteArray2D(final String name, final byte[][] defVal) throws IOException {
final BinaryClassField field = _cObj._nameFields.get(name);
if (field == null || !_fieldData.containsKey(field._alias)) {
@@ -283,6 +290,7 @@ public class BinaryInputCapsule implements InputCapsule {
return (byte[][]) _fieldData.get(field._alias);
}
+ @Override
public ByteBuffer readByteBuffer(final String name, final ByteBuffer defVal) throws IOException {
final BinaryClassField field = _cObj._nameFields.get(name);
if (field == null || !_fieldData.containsKey(field._alias)) {
@@ -291,6 +299,7 @@ public class BinaryInputCapsule implements InputCapsule {
return (ByteBuffer) _fieldData.get(field._alias);
}
+ @Override
@SuppressWarnings("unchecked")
public List<ByteBuffer> readByteBufferList(final String name, final List<ByteBuffer> defVal) throws IOException {
final BinaryClassField field = _cObj._nameFields.get(name);
@@ -300,6 +309,7 @@ public class BinaryInputCapsule implements InputCapsule {
return (List<ByteBuffer>) _fieldData.get(field._alias);
}
+ @Override
public double readDouble(final String name, final double defVal) throws IOException {
final BinaryClassField field = _cObj._nameFields.get(name);
if (field == null || !_fieldData.containsKey(field._alias)) {
@@ -308,6 +318,7 @@ public class BinaryInputCapsule implements InputCapsule {
return ((Double) _fieldData.get(field._alias)).doubleValue();
}
+ @Override
public double[] readDoubleArray(final String name, final double[] defVal) throws IOException {
final BinaryClassField field = _cObj._nameFields.get(name);
if (field == null || !_fieldData.containsKey(field._alias)) {
@@ -316,6 +327,7 @@ public class BinaryInputCapsule implements InputCapsule {
return (double[]) _fieldData.get(field._alias);
}
+ @Override
public double[][] readDoubleArray2D(final String name, final double[][] defVal) throws IOException {
final BinaryClassField field = _cObj._nameFields.get(name);
if (field == null || !_fieldData.containsKey(field._alias)) {
@@ -324,6 +336,7 @@ public class BinaryInputCapsule implements InputCapsule {
return (double[][]) _fieldData.get(field._alias);
}
+ @Override
public float readFloat(final String name, final float defVal) throws IOException {
final BinaryClassField field = _cObj._nameFields.get(name);
if (field == null || !_fieldData.containsKey(field._alias)) {
@@ -332,6 +345,7 @@ public class BinaryInputCapsule implements InputCapsule {
return ((Float) _fieldData.get(field._alias)).floatValue();
}
+ @Override
public float[] readFloatArray(final String name, final float[] defVal) throws IOException {
final BinaryClassField field = _cObj._nameFields.get(name);
if (field == null || !_fieldData.containsKey(field._alias)) {
@@ -340,6 +354,7 @@ public class BinaryInputCapsule implements InputCapsule {
return (float[]) _fieldData.get(field._alias);
}
+ @Override
public float[][] readFloatArray2D(final String name, final float[][] defVal) throws IOException {
final BinaryClassField field = _cObj._nameFields.get(name);
if (field == null || !_fieldData.containsKey(field._alias)) {
@@ -348,6 +363,7 @@ public class BinaryInputCapsule implements InputCapsule {
return (float[][]) _fieldData.get(field._alias);
}
+ @Override
public FloatBuffer readFloatBuffer(final String name, final FloatBuffer defVal) throws IOException {
final BinaryClassField field = _cObj._nameFields.get(name);
if (field == null || !_fieldData.containsKey(field._alias)) {
@@ -356,6 +372,7 @@ public class BinaryInputCapsule implements InputCapsule {
return (FloatBuffer) _fieldData.get(field._alias);
}
+ @Override
@SuppressWarnings("unchecked")
public List<FloatBuffer> readFloatBufferList(final String name, final List<FloatBuffer> defVal) throws IOException {
final BinaryClassField field = _cObj._nameFields.get(name);
@@ -365,6 +382,7 @@ public class BinaryInputCapsule implements InputCapsule {
return (List<FloatBuffer>) _fieldData.get(field._alias);
}
+ @Override
public int readInt(final String name, final int defVal) throws IOException {
final BinaryClassField field = _cObj._nameFields.get(name);
if (field == null || !_fieldData.containsKey(field._alias)) {
@@ -373,6 +391,7 @@ public class BinaryInputCapsule implements InputCapsule {
return ((Integer) _fieldData.get(field._alias)).intValue();
}
+ @Override
public int[] readIntArray(final String name, final int[] defVal) throws IOException {
final BinaryClassField field = _cObj._nameFields.get(name);
if (field == null || !_fieldData.containsKey(field._alias)) {
@@ -381,6 +400,7 @@ public class BinaryInputCapsule implements InputCapsule {
return (int[]) _fieldData.get(field._alias);
}
+ @Override
public int[][] readIntArray2D(final String name, final int[][] defVal) throws IOException {
final BinaryClassField field = _cObj._nameFields.get(name);
if (field == null || !_fieldData.containsKey(field._alias)) {
@@ -389,6 +409,7 @@ public class BinaryInputCapsule implements InputCapsule {
return (int[][]) _fieldData.get(field._alias);
}
+ @Override
public IntBuffer readIntBuffer(final String name, final IntBuffer defVal) throws IOException {
final BinaryClassField field = _cObj._nameFields.get(name);
if (field == null || !_fieldData.containsKey(field._alias)) {
@@ -397,6 +418,7 @@ public class BinaryInputCapsule implements InputCapsule {
return (IntBuffer) _fieldData.get(field._alias);
}
+ @Override
public long readLong(final String name, final long defVal) throws IOException {
final BinaryClassField field = _cObj._nameFields.get(name);
if (field == null || !_fieldData.containsKey(field._alias)) {
@@ -405,6 +427,7 @@ public class BinaryInputCapsule implements InputCapsule {
return ((Long) _fieldData.get(field._alias)).longValue();
}
+ @Override
public long[] readLongArray(final String name, final long[] defVal) throws IOException {
final BinaryClassField field = _cObj._nameFields.get(name);
if (field == null || !_fieldData.containsKey(field._alias)) {
@@ -413,6 +436,7 @@ public class BinaryInputCapsule implements InputCapsule {
return (long[]) _fieldData.get(field._alias);
}
+ @Override
public long[][] readLongArray2D(final String name, final long[][] defVal) throws IOException {
final BinaryClassField field = _cObj._nameFields.get(name);
if (field == null || !_fieldData.containsKey(field._alias)) {
@@ -421,6 +445,7 @@ public class BinaryInputCapsule implements InputCapsule {
return (long[][]) _fieldData.get(field._alias);
}
+ @Override
public Savable readSavable(final String name, final Savable defVal) throws IOException {
final BinaryClassField field = _cObj._nameFields.get(name);
if (field == null || !_fieldData.containsKey(field._alias)) {
@@ -438,6 +463,7 @@ public class BinaryInputCapsule implements InputCapsule {
}
}
+ @Override
public Savable[] readSavableArray(final String name, final Savable[] defVal) throws IOException {
final BinaryClassField field = _cObj._nameFields.get(name);
if (field == null || !_fieldData.containsKey(field._alias)) {
@@ -466,6 +492,7 @@ public class BinaryInputCapsule implements InputCapsule {
}
}
+ @Override
public Savable[][] readSavableArray2D(final String name, final Savable[][] defVal) throws IOException {
final BinaryClassField field = _cObj._nameFields.get(name);
if (field == null || !_fieldData.containsKey(field._alias)) {
@@ -516,7 +543,7 @@ public class BinaryInputCapsule implements InputCapsule {
if (savables == null) {
return null;
}
- final List<Savable> list = new ArrayList<Savable>(savables.length);
+ final List<Savable> list = new ArrayList<>(savables.length);
for (int x = 0; x < savables.length; x++) {
list.add(savables[x]);
}
@@ -528,7 +555,7 @@ public class BinaryInputCapsule implements InputCapsule {
if (savables == null) {
return null;
}
- final Map<Savable, Savable> map = new HashMap<Savable, Savable>(savables.length);
+ final Map<Savable, Savable> map = new HashMap<>(savables.length);
for (int x = 0; x < savables.length; x++) {
map.put(savables[x][0], savables[x][1]);
}
@@ -540,7 +567,7 @@ public class BinaryInputCapsule implements InputCapsule {
return null;
}
- final Map<String, Savable> map = new HashMap<String, Savable>(keys.length);
+ final Map<String, Savable> map = new HashMap<>(keys.length);
for (int x = 0; x < keys.length; x++) {
map.put(keys[x], values[x]);
}
@@ -548,6 +575,7 @@ public class BinaryInputCapsule implements InputCapsule {
return map;
}
+ @Override
@SuppressWarnings("unchecked")
public <E extends Savable> List<E> readSavableList(final String name, final List<E> defVal) throws IOException {
final BinaryClassField field = _cObj._nameFields.get(name);
@@ -564,6 +592,7 @@ public class BinaryInputCapsule implements InputCapsule {
return (List<E>) value;
}
+ @Override
@SuppressWarnings("unchecked")
public <E extends Savable> List<E>[] readSavableListArray(final String name, final List<E>[] defVal)
throws IOException {
@@ -589,6 +618,7 @@ public class BinaryInputCapsule implements InputCapsule {
return (List<E>[]) value;
}
+ @Override
@SuppressWarnings("unchecked")
public <E extends Savable> List<E>[][] readSavableListArray2D(final String name, final List<E>[][] defVal)
throws IOException {
@@ -617,6 +647,7 @@ public class BinaryInputCapsule implements InputCapsule {
return (List<E>[][]) value;
}
+ @Override
@SuppressWarnings("unchecked")
public <K extends Savable, V extends Savable> Map<K, V> readSavableMap(final String name, final Map<K, V> defVal)
throws IOException {
@@ -634,6 +665,7 @@ public class BinaryInputCapsule implements InputCapsule {
return (Map<K, V>) value;
}
+ @Override
@SuppressWarnings("unchecked")
public <V extends Savable> Map<String, V> readStringSavableMap(final String name, final Map<String, V> defVal)
throws IOException {
@@ -652,6 +684,7 @@ public class BinaryInputCapsule implements InputCapsule {
return (Map<String, V>) value;
}
+ @Override
public short readShort(final String name, final short defVal) throws IOException {
final BinaryClassField field = _cObj._nameFields.get(name);
if (field == null || !_fieldData.containsKey(field._alias)) {
@@ -660,6 +693,7 @@ public class BinaryInputCapsule implements InputCapsule {
return ((Short) _fieldData.get(field._alias)).shortValue();
}
+ @Override
public short[] readShortArray(final String name, final short[] defVal) throws IOException {
final BinaryClassField field = _cObj._nameFields.get(name);
if (field == null || !_fieldData.containsKey(field._alias)) {
@@ -668,6 +702,7 @@ public class BinaryInputCapsule implements InputCapsule {
return (short[]) _fieldData.get(field._alias);
}
+ @Override
public short[][] readShortArray2D(final String name, final short[][] defVal) throws IOException {
final BinaryClassField field = _cObj._nameFields.get(name);
if (field == null || !_fieldData.containsKey(field._alias)) {
@@ -676,6 +711,7 @@ public class BinaryInputCapsule implements InputCapsule {
return (short[][]) _fieldData.get(field._alias);
}
+ @Override
public ShortBuffer readShortBuffer(final String name, final ShortBuffer defVal) throws IOException {
final BinaryClassField field = _cObj._nameFields.get(name);
if (field == null || !_fieldData.containsKey(field._alias)) {
@@ -684,6 +720,7 @@ public class BinaryInputCapsule implements InputCapsule {
return (ShortBuffer) _fieldData.get(field._alias);
}
+ @Override
public String readString(final String name, final String defVal) throws IOException {
final BinaryClassField field = _cObj._nameFields.get(name);
if (field == null || !_fieldData.containsKey(field._alias)) {
@@ -692,6 +729,7 @@ public class BinaryInputCapsule implements InputCapsule {
return (String) _fieldData.get(field._alias);
}
+ @Override
public String[] readStringArray(final String name, final String[] defVal) throws IOException {
final BinaryClassField field = _cObj._nameFields.get(name);
if (field == null || !_fieldData.containsKey(field._alias)) {
@@ -700,6 +738,7 @@ public class BinaryInputCapsule implements InputCapsule {
return (String[]) _fieldData.get(field._alias);
}
+ @Override
public String[][] readStringArray2D(final String name, final String[][] defVal) throws IOException {
final BinaryClassField field = _cObj._nameFields.get(name);
if (field == null || !_fieldData.containsKey(field._alias)) {
@@ -1200,7 +1239,7 @@ public class BinaryInputCapsule implements InputCapsule {
if (length == BinaryOutputCapsule.NULL_OBJECT) {
return null;
}
- final List<FloatBuffer> rVal = new ArrayList<FloatBuffer>(length);
+ final List<FloatBuffer> rVal = new ArrayList<>(length);
for (int x = 0; x < length; x++) {
rVal.add(readFloatBuffer(content));
}
@@ -1214,7 +1253,7 @@ public class BinaryInputCapsule implements InputCapsule {
if (length == BinaryOutputCapsule.NULL_OBJECT) {
return null;
}
- final List<ByteBuffer> rVal = new ArrayList<ByteBuffer>(length);
+ final List<ByteBuffer> rVal = new ArrayList<>(length);
for (int x = 0; x < length; x++) {
rVal.add(readByteBuffer(content));
}
@@ -1389,6 +1428,7 @@ public class BinaryInputCapsule implements InputCapsule {
public ID[] values;
}
+ @Override
public <T extends Enum<T>> T readEnum(final String name, final Class<T> enumType, final T defVal)
throws IOException {
final String eVal = readString(name, defVal != null ? defVal.name() : null);
@@ -1399,6 +1439,7 @@ public class BinaryInputCapsule implements InputCapsule {
}
}
+ @Override
@SuppressWarnings("unchecked")
public <T extends Enum<T>> T[] readEnumArray(final String name, final Class<T> enumType, final T[] defVal)
throws IOException {
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryOutputCapsule.java b/ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryOutputCapsule.java
index 82a14dd..0eecb51 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryOutputCapsule.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/export/binary/BinaryOutputCapsule.java
@@ -1,9 +1,9 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* 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>.
*/
@@ -53,6 +53,7 @@ public class BinaryOutputCapsule implements OutputCapsule {
_forceDirectNioBuffers = forceDirectNioBuffers;
}
+ @Override
public void write(final byte value, final String name, final byte defVal) throws IOException {
if (value == defVal) {
return;
@@ -61,6 +62,7 @@ public class BinaryOutputCapsule implements OutputCapsule {
write(value);
}
+ @Override
public void write(final byte[] value, final String name, final byte[] defVal) throws IOException {
if (value == defVal) {
return;
@@ -69,6 +71,7 @@ public class BinaryOutputCapsule implements OutputCapsule {
write(value);
}
+ @Override
public void write(final byte[][] value, final String name, final byte[][] defVal) throws IOException {
if (value == defVal) {
return;
@@ -77,6 +80,7 @@ public class BinaryOutputCapsule implements OutputCapsule {
write(value);
}
+ @Override
public void write(final int value, final String name, final int defVal) throws IOException {
if (value == defVal) {
return;
@@ -85,6 +89,7 @@ public class BinaryOutputCapsule implements OutputCapsule {
write(value);
}
+ @Override
public void write(final int[] value, final String name, final int[] defVal) throws IOException {
if (value == defVal) {
return;
@@ -93,6 +98,7 @@ public class BinaryOutputCapsule implements OutputCapsule {
write(value);
}
+ @Override
public void write(final int[][] value, final String name, final int[][] defVal) throws IOException {
if (value == defVal) {
return;
@@ -101,6 +107,7 @@ public class BinaryOutputCapsule implements OutputCapsule {
write(value);
}
+ @Override
public void write(final float value, final String name, final float defVal) throws IOException {
if (value == defVal) {
return;
@@ -109,6 +116,7 @@ public class BinaryOutputCapsule implements OutputCapsule {
write(value);
}
+ @Override
public void write(final float[] value, final String name, final float[] defVal) throws IOException {
if (value == defVal) {
return;
@@ -117,6 +125,7 @@ public class BinaryOutputCapsule implements OutputCapsule {
write(value);
}
+ @Override
public void write(final float[][] value, final String name, final float[][] defVal) throws IOException {
if (value == defVal) {
return;
@@ -125,6 +134,7 @@ public class BinaryOutputCapsule implements OutputCapsule {
write(value);
}
+ @Override
public void write(final double value, final String name, final double defVal) throws IOException {
if (value == defVal) {
return;
@@ -133,6 +143,7 @@ public class BinaryOutputCapsule implements OutputCapsule {
write(value);
}
+ @Override
public void write(final double[] value, final String name, final double[] defVal) throws IOException {
if (value == defVal) {
return;
@@ -141,6 +152,7 @@ public class BinaryOutputCapsule implements OutputCapsule {
write(value);
}
+ @Override
public void write(final double[][] value, final String name, final double[][] defVal) throws IOException {
if (value == defVal) {
return;
@@ -149,6 +161,7 @@ public class BinaryOutputCapsule implements OutputCapsule {
write(value);
}
+ @Override
public void write(final long value, final String name, final long defVal) throws IOException {
if (value == defVal) {
return;
@@ -157,6 +170,7 @@ public class BinaryOutputCapsule implements OutputCapsule {
write(value);
}
+ @Override
public void write(final long[] value, final String name, final long[] defVal) throws IOException {
if (value == defVal) {
return;
@@ -165,6 +179,7 @@ public class BinaryOutputCapsule implements OutputCapsule {
write(value);
}
+ @Override
public void write(final long[][] value, final String name, final long[][] defVal) throws IOException {
if (value == defVal) {
return;
@@ -173,6 +188,7 @@ public class BinaryOutputCapsule implements OutputCapsule {
write(value);
}
+ @Override
public void write(final short value, final String name, final short defVal) throws IOException {
if (value == defVal) {
return;
@@ -181,6 +197,7 @@ public class BinaryOutputCapsule implements OutputCapsule {
write(value);
}
+ @Override
public void write(final short[] value, final String name, final short[] defVal) throws IOException {
if (value == defVal) {
return;
@@ -189,6 +206,7 @@ public class BinaryOutputCapsule implements OutputCapsule {
write(value);
}
+ @Override
public void write(final short[][] value, final String name, final short[][] defVal) throws IOException {
if (value == defVal) {
return;
@@ -197,6 +215,7 @@ public class BinaryOutputCapsule implements OutputCapsule {
write(value);
}
+ @Override
public void write(final boolean value, final String name, final boolean defVal) throws IOException {
if (value == defVal) {
return;
@@ -205,6 +224,7 @@ public class BinaryOutputCapsule implements OutputCapsule {
write(value);
}
+ @Override
public void write(final boolean[] value, final String name, final boolean[] defVal) throws IOException {
if (value == defVal) {
return;
@@ -213,6 +233,7 @@ public class BinaryOutputCapsule implements OutputCapsule {
write(value);
}
+ @Override
public void write(final boolean[][] value, final String name, final boolean[][] defVal) throws IOException {
if (value == defVal) {
return;
@@ -221,6 +242,7 @@ public class BinaryOutputCapsule implements OutputCapsule {
write(value);
}
+ @Override
public void write(final String value, final String name, final String defVal) throws IOException {
if (value == null ? defVal == null : value.equals(defVal)) {
return;
@@ -229,6 +251,7 @@ public class BinaryOutputCapsule implements OutputCapsule {
write(value);
}
+ @Override
public void write(final String[] value, final String name, final String[] defVal) throws IOException {
if (value == defVal) {
return;
@@ -237,6 +260,7 @@ public class BinaryOutputCapsule implements OutputCapsule {
write(value);
}
+ @Override
public void write(final String[][] value, final String name, final String[][] defVal) throws IOException {
if (value == defVal) {
return;
@@ -245,6 +269,7 @@ public class BinaryOutputCapsule implements OutputCapsule {
write(value);
}
+ @Override
public void write(final BitSet value, final String name, final BitSet defVal) throws IOException {
if (value == defVal) {
return;
@@ -253,6 +278,7 @@ public class BinaryOutputCapsule implements OutputCapsule {
write(value);
}
+ @Override
public void write(final Savable object, final String name, final Savable defVal) throws IOException {
if (object == defVal) {
return;
@@ -261,6 +287,7 @@ public class BinaryOutputCapsule implements OutputCapsule {
write(object);
}
+ @Override
public void write(final Savable[] objects, final String name, final Savable[] defVal) throws IOException {
if (objects == defVal) {
return;
@@ -269,6 +296,7 @@ public class BinaryOutputCapsule implements OutputCapsule {
write(objects);
}
+ @Override
public void write(final Savable[][] objects, final String name, final Savable[][] defVal) throws IOException {
if (objects == defVal) {
return;
@@ -277,6 +305,7 @@ public class BinaryOutputCapsule implements OutputCapsule {
write(objects);
}
+ @Override
public void write(final FloatBuffer value, final String name, final FloatBuffer defVal) throws IOException {
if (value == defVal) {
return;
@@ -285,6 +314,7 @@ public class BinaryOutputCapsule implements OutputCapsule {
write(value);
}
+ @Override
public void write(final IntBuffer value, final String name, final IntBuffer defVal) throws IOException {
if (value == defVal) {
return;
@@ -293,6 +323,7 @@ public class BinaryOutputCapsule implements OutputCapsule {
write(value);
}
+ @Override
public void write(final ByteBuffer value, final String name, final ByteBuffer defVal) throws IOException {
if (value == defVal) {
return;
@@ -301,6 +332,7 @@ public class BinaryOutputCapsule implements OutputCapsule {
write(value);
}
+ @Override
public void write(final ShortBuffer value, final String name, final ShortBuffer defVal) throws IOException {
if (value == defVal) {
return;
@@ -309,6 +341,7 @@ public class BinaryOutputCapsule implements OutputCapsule {
write(value);
}
+ @Override
public void writeFloatBufferList(final List<FloatBuffer> array, final String name, final List<FloatBuffer> defVal)
throws IOException {
if (array == defVal) {
@@ -318,6 +351,7 @@ public class BinaryOutputCapsule implements OutputCapsule {
writeFloatBufferArrayList(array);
}
+ @Override
public void writeByteBufferList(final List<ByteBuffer> array, final String name, final List<ByteBuffer> defVal)
throws IOException {
if (array == defVal) {
@@ -327,6 +361,7 @@ public class BinaryOutputCapsule implements OutputCapsule {
writeByteBufferArrayList(array);
}
+ @Override
public void writeSavableList(final List<? extends Savable> array, final String name,
final List<? extends Savable> defVal) throws IOException {
if (array == defVal) {
@@ -336,6 +371,7 @@ public class BinaryOutputCapsule implements OutputCapsule {
writeSavableArrayList(array);
}
+ @Override
public void writeSavableListArray(final List<? extends Savable>[] array, final String name,
final List<? extends Savable>[] defVal) throws IOException {
if (array == defVal) {
@@ -345,6 +381,7 @@ public class BinaryOutputCapsule implements OutputCapsule {
writeSavableArrayListArray(array);
}
+ @Override
public void writeSavableListArray2D(final List<? extends Savable>[][] array, final String name,
final List<? extends Savable>[][] defVal) throws IOException {
if (array == defVal) {
@@ -354,6 +391,7 @@ public class BinaryOutputCapsule implements OutputCapsule {
writeSavableArrayListArray2D(array);
}
+ @Override
public void writeSavableMap(final Map<? extends Savable, ? extends Savable> map, final String name,
final Map<? extends Savable, ? extends Savable> defVal) throws IOException {
if (map == defVal) {
@@ -363,6 +401,7 @@ public class BinaryOutputCapsule implements OutputCapsule {
writeSavableMap(map);
}
+ @Override
public void writeStringSavableMap(final Map<String, ? extends Savable> map, final String name,
final Map<String, ? extends Savable> defVal) throws IOException {
if (map == defVal) {
@@ -402,6 +441,11 @@ public class BinaryOutputCapsule implements OutputCapsule {
return Arrays.equals(_bytes, other);
}
+ @Override
+ public int hashCode() {
+ return Arrays.hashCode(_bytes);
+ }
+
public void finish() {
// renamed to finish as 'finalize' in java.lang.Object should not be
// overridden like this
@@ -987,6 +1031,7 @@ public class BinaryOutputCapsule implements OutputCapsule {
_baos.write(array);
}
+ @Override
public void write(final Enum<?> value, final String name, final Enum<?> defVal) throws IOException {
if (value == defVal) {
return;
@@ -998,6 +1043,7 @@ public class BinaryOutputCapsule implements OutputCapsule {
}
}
+ @Override
public void write(final Enum<?>[] value, final String name) throws IOException {
if (value == null) {
write(NULL_OBJECT);
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/export/xml/DOMInputCapsule.java b/ardor3d-core/src/main/java/com/ardor3d/util/export/xml/DOMInputCapsule.java
index 00babb9..0cbeea8 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/export/xml/DOMInputCapsule.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/export/xml/DOMInputCapsule.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -39,7 +39,6 @@ import com.ardor3d.util.TextureManager;
import com.ardor3d.util.export.InputCapsule;
import com.ardor3d.util.export.Savable;
import com.ardor3d.util.geom.BufferUtils;
-import com.google.common.collect.Lists;
/**
* Part of the ardor3d XML IO system
@@ -49,7 +48,7 @@ public class DOMInputCapsule implements InputCapsule {
private final Document _doc;
private Element _currentElem;
private boolean _isAtRoot = true;
- private final Map<String, Savable> _referencedSavables = new HashMap<String, Savable>();
+ private final Map<String, Savable> _referencedSavables = new HashMap<>();
public DOMInputCapsule(final Document doc) {
_doc = doc;
@@ -94,6 +93,7 @@ public class DOMInputCapsule implements InputCapsule {
return null;
}
+ @Override
public byte readByte(final String name, final byte defVal) throws IOException {
byte ret = defVal;
try {
@@ -106,6 +106,7 @@ public class DOMInputCapsule implements InputCapsule {
return ret;
}
+ @Override
public byte[] readByteArray(final String name, final byte[] defVal) throws IOException {
byte[] ret = defVal;
try {
@@ -133,6 +134,7 @@ public class DOMInputCapsule implements InputCapsule {
return ret;
}
+ @Override
public byte[][] readByteArray2D(final String name, final byte[][] defVal) throws IOException {
byte[][] ret = defVal;
try {
@@ -169,6 +171,7 @@ public class DOMInputCapsule implements InputCapsule {
return ret;
}
+ @Override
public int readInt(final String name, final int defVal) throws IOException {
int ret = defVal;
try {
@@ -184,6 +187,7 @@ public class DOMInputCapsule implements InputCapsule {
return ret;
}
+ @Override
public int[] readIntArray(final String name, final int[] defVal) throws IOException {
int[] ret = defVal;
try {
@@ -211,6 +215,7 @@ public class DOMInputCapsule implements InputCapsule {
return ret;
}
+ @Override
public int[][] readIntArray2D(final String name, final int[][] defVal) throws IOException {
int[][] ret = defVal;
try {
@@ -247,6 +252,7 @@ public class DOMInputCapsule implements InputCapsule {
return ret;
}
+ @Override
public float readFloat(final String name, final float defVal) throws IOException {
float ret = defVal;
try {
@@ -262,6 +268,7 @@ public class DOMInputCapsule implements InputCapsule {
return ret;
}
+ @Override
public float[] readFloatArray(final String name, final float[] defVal) throws IOException {
float[] ret = defVal;
try {
@@ -289,6 +296,7 @@ public class DOMInputCapsule implements InputCapsule {
return ret;
}
+ @Override
public float[][] readFloatArray2D(final String name, final float[][] defVal) throws IOException {
float[][] ret = defVal;
try {
@@ -322,6 +330,7 @@ public class DOMInputCapsule implements InputCapsule {
return ret;
}
+ @Override
public double readDouble(final String name, final double defVal) throws IOException {
double ret = defVal;
try {
@@ -337,6 +346,7 @@ public class DOMInputCapsule implements InputCapsule {
return ret;
}
+ @Override
public double[] readDoubleArray(final String name, final double[] defVal) throws IOException {
double[] ret = defVal;
try {
@@ -364,6 +374,7 @@ public class DOMInputCapsule implements InputCapsule {
return ret;
}
+ @Override
public double[][] readDoubleArray2D(final String name, final double[][] defVal) throws IOException {
double[][] ret = defVal;
try {
@@ -400,6 +411,7 @@ public class DOMInputCapsule implements InputCapsule {
return ret;
}
+ @Override
public long readLong(final String name, final long defVal) throws IOException {
long ret = defVal;
try {
@@ -415,6 +427,7 @@ public class DOMInputCapsule implements InputCapsule {
return ret;
}
+ @Override
public long[] readLongArray(final String name, final long[] defVal) throws IOException {
long[] ret = defVal;
try {
@@ -442,6 +455,7 @@ public class DOMInputCapsule implements InputCapsule {
return ret;
}
+ @Override
public long[][] readLongArray2D(final String name, final long[][] defVal) throws IOException {
long[][] ret = defVal;
try {
@@ -478,6 +492,7 @@ public class DOMInputCapsule implements InputCapsule {
return ret;
}
+ @Override
public short readShort(final String name, final short defVal) throws IOException {
short ret = defVal;
try {
@@ -493,6 +508,7 @@ public class DOMInputCapsule implements InputCapsule {
return ret;
}
+ @Override
public short[] readShortArray(final String name, final short[] defVal) throws IOException {
short[] ret = defVal;
try {
@@ -520,6 +536,7 @@ public class DOMInputCapsule implements InputCapsule {
return ret;
}
+ @Override
public short[][] readShortArray2D(final String name, final short[][] defVal) throws IOException {
short[][] ret = defVal;
try {
@@ -556,6 +573,7 @@ public class DOMInputCapsule implements InputCapsule {
return ret;
}
+ @Override
public boolean readBoolean(final String name, final boolean defVal) throws IOException {
boolean ret = defVal;
try {
@@ -571,6 +589,7 @@ public class DOMInputCapsule implements InputCapsule {
return ret;
}
+ @Override
public boolean[] readBooleanArray(final String name, final boolean[] defVal) throws IOException {
boolean[] ret = defVal;
try {
@@ -598,6 +617,7 @@ public class DOMInputCapsule implements InputCapsule {
return ret;
}
+ @Override
public boolean[][] readBooleanArray2D(final String name, final boolean[][] defVal) throws IOException {
boolean[][] ret = defVal;
try {
@@ -634,6 +654,7 @@ public class DOMInputCapsule implements InputCapsule {
return ret;
}
+ @Override
public String readString(final String name, final String defVal) throws IOException {
String ret = defVal;
try {
@@ -646,6 +667,7 @@ public class DOMInputCapsule implements InputCapsule {
return ret;
}
+ @Override
public String[] readStringArray(final String name, final String[] defVal) throws IOException {
String[] ret = defVal;
try {
@@ -682,6 +704,7 @@ public class DOMInputCapsule implements InputCapsule {
return ret;
}
+ @Override
public String[][] readStringArray2D(final String name, final String[][] defVal) throws IOException {
String[][] ret = defVal;
try {
@@ -718,6 +741,7 @@ public class DOMInputCapsule implements InputCapsule {
return ret;
}
+ @Override
public BitSet readBitSet(final String name, final BitSet defVal) throws IOException {
BitSet ret = defVal;
try {
@@ -739,6 +763,7 @@ public class DOMInputCapsule implements InputCapsule {
return ret;
}
+ @Override
public Savable readSavable(final String name, final Savable defVal) throws IOException {
Savable ret = defVal;
@@ -857,7 +882,7 @@ public class DOMInputCapsule implements InputCapsule {
private Savable[] readRenderStateList(final Element fromElement, final Savable[] defVal) {
Savable[] ret = defVal;
try {
- final List<RenderState> tmp = new ArrayList<RenderState>();
+ final List<RenderState> tmp = new ArrayList<>();
_currentElem = findFirstChildElement(fromElement);
while (_currentElem != null) {
final Element el = _currentElem;
@@ -880,6 +905,7 @@ public class DOMInputCapsule implements InputCapsule {
return ret;
}
+ @Override
public Savable[] readSavableArray(final String name, final Savable[] defVal) throws IOException {
Savable[] ret = defVal;
try {
@@ -912,6 +938,7 @@ public class DOMInputCapsule implements InputCapsule {
return ret;
}
+ @Override
public Savable[][] readSavableArray2D(final String name, final Savable[][] defVal) throws IOException {
Savable[][] ret = defVal;
try {
@@ -944,6 +971,7 @@ public class DOMInputCapsule implements InputCapsule {
return ret;
}
+ @Override
@SuppressWarnings("unchecked")
public <E extends Savable> List<E> readSavableList(final String name, final List<E> defVal) throws IOException {
List<E> ret = defVal;
@@ -956,7 +984,7 @@ public class DOMInputCapsule implements InputCapsule {
final String s = tmpEl.getAttribute("size");
final int size = Integer.parseInt(s);
@SuppressWarnings("rawtypes")
- final List tmp = Lists.newArrayList();
+ final List tmp = new ArrayList();
_currentElem = findFirstChildElement(tmpEl);
for (int i = 0; i < size; i++) {
tmp.add(readSavableFromCurrentElem(null));
@@ -975,6 +1003,7 @@ public class DOMInputCapsule implements InputCapsule {
return ret;
}
+ @Override
@SuppressWarnings("unchecked")
public <E extends Savable> List<E>[] readSavableListArray(final String name, final List<E>[] defVal)
throws IOException {
@@ -1007,6 +1036,7 @@ public class DOMInputCapsule implements InputCapsule {
return ret;
}
+ @Override
@SuppressWarnings({ "unchecked", "rawtypes" })
public <E extends Savable> List<E>[][] readSavableListArray2D(final String name, final List<E>[][] defVal)
throws IOException {
@@ -1034,6 +1064,7 @@ public class DOMInputCapsule implements InputCapsule {
return ret;
}
+ @Override
public List<FloatBuffer> readFloatBufferList(final String name, final List<FloatBuffer> defVal) throws IOException {
List<FloatBuffer> ret = defVal;
try {
@@ -1043,7 +1074,7 @@ public class DOMInputCapsule implements InputCapsule {
}
final int size = Integer.parseInt(tmpEl.getAttribute("size"));
- final List<FloatBuffer> tmp = new ArrayList<FloatBuffer>(size);
+ final List<FloatBuffer> tmp = new ArrayList<>(size);
_currentElem = findFirstChildElement(tmpEl);
for (int i = 0; i < size; i++) {
tmp.add(readFloatBuffer(null, null));
@@ -1062,6 +1093,7 @@ public class DOMInputCapsule implements InputCapsule {
return ret;
}
+ @Override
@SuppressWarnings("unchecked")
public <K extends Savable, V extends Savable> Map<K, V> readSavableMap(final String name, final Map<K, V> defVal)
throws IOException {
@@ -1073,7 +1105,7 @@ public class DOMInputCapsule implements InputCapsule {
} else {
tempEl = _currentElem;
}
- ret = new HashMap<K, V>();
+ ret = new HashMap<>();
final NodeList nodes = tempEl.getChildNodes();
for (int i = 0; i < nodes.getLength(); i++) {
@@ -1090,6 +1122,7 @@ public class DOMInputCapsule implements InputCapsule {
return ret;
}
+ @Override
@SuppressWarnings("unchecked")
public <V extends Savable> Map<String, V> readStringSavableMap(final String name, final Map<String, V> defVal)
throws IOException {
@@ -1102,7 +1135,7 @@ public class DOMInputCapsule implements InputCapsule {
tempEl = _currentElem;
}
if (tempEl != null) {
- ret = new HashMap<String, V>();
+ ret = new HashMap<>();
final NodeList nodes = tempEl.getChildNodes();
for (int i = 0; i < nodes.getLength(); i++) {
@@ -1125,6 +1158,7 @@ public class DOMInputCapsule implements InputCapsule {
/**
* reads from currentElem if name is null
*/
+ @Override
public FloatBuffer readFloatBuffer(final String name, final FloatBuffer defVal) throws IOException {
FloatBuffer ret = defVal;
try {
@@ -1155,6 +1189,7 @@ public class DOMInputCapsule implements InputCapsule {
return ret;
}
+ @Override
public IntBuffer readIntBuffer(final String name, final IntBuffer defVal) throws IOException {
IntBuffer ret = defVal;
try {
@@ -1181,6 +1216,7 @@ public class DOMInputCapsule implements InputCapsule {
return ret;
}
+ @Override
public ByteBuffer readByteBuffer(final String name, final ByteBuffer defVal) throws IOException {
ByteBuffer ret = defVal;
try {
@@ -1207,6 +1243,7 @@ public class DOMInputCapsule implements InputCapsule {
return ret;
}
+ @Override
public ShortBuffer readShortBuffer(final String name, final ShortBuffer defVal) throws IOException {
ShortBuffer ret = defVal;
try {
@@ -1233,6 +1270,7 @@ public class DOMInputCapsule implements InputCapsule {
return ret;
}
+ @Override
public List<ByteBuffer> readByteBufferList(final String name, final List<ByteBuffer> defVal) throws IOException {
List<ByteBuffer> ret = defVal;
try {
@@ -1242,7 +1280,7 @@ public class DOMInputCapsule implements InputCapsule {
}
final int size = Integer.parseInt(tmpEl.getAttribute("size"));
- final List<ByteBuffer> tmp = new ArrayList<ByteBuffer>(size);
+ final List<ByteBuffer> tmp = new ArrayList<>(size);
_currentElem = findFirstChildElement(tmpEl);
for (int i = 0; i < size; i++) {
tmp.add(readByteBuffer(null, null));
@@ -1261,6 +1299,7 @@ public class DOMInputCapsule implements InputCapsule {
return ret;
}
+ @Override
public <T extends Enum<T>> T readEnum(final String name, final Class<T> enumType, final T defVal)
throws IOException {
T ret = defVal;
@@ -1277,6 +1316,7 @@ public class DOMInputCapsule implements InputCapsule {
return ret;
}
+ @Override
@SuppressWarnings("unchecked")
public <T extends Enum<T>> T[] readEnumArray(final String name, final Class<T> enumType, final T[] defVal)
throws IOException {
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/export/xml/DOMOutputCapsule.java b/ardor3d-core/src/main/java/com/ardor3d/util/export/xml/DOMOutputCapsule.java
index ce2e9c7..911f2f2 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/export/xml/DOMOutputCapsule.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/export/xml/DOMOutputCapsule.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -37,7 +37,7 @@ public class DOMOutputCapsule implements OutputCapsule {
private static final String _dataAttributeName = "data";
private final Document _doc;
private Element _currentElement;
- private final Map<Savable, Element> _writtenSavables = new IdentityHashMap<Savable, Element>();
+ private final Map<Savable, Element> _writtenSavables = new IdentityHashMap<>();
public DOMOutputCapsule(final Document doc) {
_doc = doc;
@@ -72,6 +72,7 @@ public class DOMOutputCapsule implements OutputCapsule {
return s;
}
+ @Override
public void write(final byte value, final String name, final byte defVal) throws IOException {
if (value == defVal) {
return;
@@ -79,6 +80,7 @@ public class DOMOutputCapsule implements OutputCapsule {
_currentElement.setAttribute(name, String.valueOf(value));
}
+ @Override
public void write(byte[] value, final String name, final byte[] defVal) throws IOException {
final StringBuilder buf = new StringBuilder();
if (value == null) {
@@ -97,6 +99,7 @@ public class DOMOutputCapsule implements OutputCapsule {
_currentElement = (Element) _currentElement.getParentNode();
}
+ @Override
public void write(byte[][] value, final String name, final byte[][] defVal) throws IOException {
final StringBuilder buf = new StringBuilder();
if (value == null) {
@@ -119,6 +122,7 @@ public class DOMOutputCapsule implements OutputCapsule {
_currentElement = (Element) _currentElement.getParentNode();
}
+ @Override
public void write(final int value, final String name, final int defVal) throws IOException {
if (value == defVal) {
return;
@@ -126,6 +130,7 @@ public class DOMOutputCapsule implements OutputCapsule {
_currentElement.setAttribute(name, String.valueOf(value));
}
+ @Override
public void write(final int[] value, final String name, final int[] defVal) throws IOException {
final StringBuilder buf = new StringBuilder();
if (value == null) {
@@ -148,6 +153,7 @@ public class DOMOutputCapsule implements OutputCapsule {
_currentElement = (Element) _currentElement.getParentNode();
}
+ @Override
public void write(final int[][] value, final String name, final int[][] defVal) throws IOException {
if (value == null) {
return;
@@ -166,6 +172,7 @@ public class DOMOutputCapsule implements OutputCapsule {
_currentElement = (Element) el.getParentNode();
}
+ @Override
public void write(final float value, final String name, final float defVal) throws IOException {
if (value == defVal) {
return;
@@ -173,6 +180,7 @@ public class DOMOutputCapsule implements OutputCapsule {
_currentElement.setAttribute(name, String.valueOf(value));
}
+ @Override
public void write(float[] value, final String name, final float[] defVal) throws IOException {
final StringBuilder buf = new StringBuilder();
if (value == null) {
@@ -191,6 +199,7 @@ public class DOMOutputCapsule implements OutputCapsule {
_currentElement = (Element) _currentElement.getParentNode();
}
+ @Override
public void write(final float[][] value, final String name, final float[][] defVal) throws IOException {
final StringBuilder buf = new StringBuilder();
if (value == null) {
@@ -216,6 +225,7 @@ public class DOMOutputCapsule implements OutputCapsule {
_currentElement = (Element) _currentElement.getParentNode();
}
+ @Override
public void write(final double value, final String name, final double defVal) throws IOException {
if (value == defVal) {
return;
@@ -223,6 +233,7 @@ public class DOMOutputCapsule implements OutputCapsule {
_currentElement.setAttribute(name, String.valueOf(value));
}
+ @Override
public void write(double[] value, final String name, final double[] defVal) throws IOException {
final StringBuilder buf = new StringBuilder();
if (value == null) {
@@ -241,6 +252,7 @@ public class DOMOutputCapsule implements OutputCapsule {
_currentElement = (Element) _currentElement.getParentNode();
}
+ @Override
public void write(final double[][] value, final String name, final double[][] defVal) throws IOException {
if (value == null) {
return;
@@ -259,6 +271,7 @@ public class DOMOutputCapsule implements OutputCapsule {
_currentElement = (Element) el.getParentNode();
}
+ @Override
public void write(final long value, final String name, final long defVal) throws IOException {
if (value == defVal) {
return;
@@ -266,6 +279,7 @@ public class DOMOutputCapsule implements OutputCapsule {
_currentElement.setAttribute(name, String.valueOf(value));
}
+ @Override
public void write(long[] value, final String name, final long[] defVal) throws IOException {
final StringBuilder buf = new StringBuilder();
if (value == null) {
@@ -284,6 +298,7 @@ public class DOMOutputCapsule implements OutputCapsule {
_currentElement = (Element) _currentElement.getParentNode();
}
+ @Override
public void write(final long[][] value, final String name, final long[][] defVal) throws IOException {
if (value == null) {
return;
@@ -302,6 +317,7 @@ public class DOMOutputCapsule implements OutputCapsule {
_currentElement = (Element) el.getParentNode();
}
+ @Override
public void write(final short value, final String name, final short defVal) throws IOException {
if (value == defVal) {
return;
@@ -309,6 +325,7 @@ public class DOMOutputCapsule implements OutputCapsule {
_currentElement.setAttribute(name, String.valueOf(value));
}
+ @Override
public void write(short[] value, final String name, final short[] defVal) throws IOException {
final StringBuilder buf = new StringBuilder();
if (value == null) {
@@ -327,6 +344,7 @@ public class DOMOutputCapsule implements OutputCapsule {
_currentElement = (Element) _currentElement.getParentNode();
}
+ @Override
public void write(final short[][] value, final String name, final short[][] defVal) throws IOException {
if (value == null) {
return;
@@ -345,6 +363,7 @@ public class DOMOutputCapsule implements OutputCapsule {
_currentElement = (Element) el.getParentNode();
}
+ @Override
public void write(final boolean value, final String name, final boolean defVal) throws IOException {
if (value == defVal) {
return;
@@ -352,6 +371,7 @@ public class DOMOutputCapsule implements OutputCapsule {
_currentElement.setAttribute(name, String.valueOf(value));
}
+ @Override
public void write(boolean[] value, final String name, final boolean[] defVal) throws IOException {
final StringBuilder buf = new StringBuilder();
if (value == null) {
@@ -370,6 +390,7 @@ public class DOMOutputCapsule implements OutputCapsule {
_currentElement = (Element) _currentElement.getParentNode();
}
+ @Override
public void write(final boolean[][] value, final String name, final boolean[][] defVal) throws IOException {
if (value == null) {
return;
@@ -388,6 +409,7 @@ public class DOMOutputCapsule implements OutputCapsule {
_currentElement = (Element) el.getParentNode();
}
+ @Override
public void write(final String value, final String name, final String defVal) throws IOException {
if (value == null || value.equals(defVal)) {
return;
@@ -395,6 +417,7 @@ public class DOMOutputCapsule implements OutputCapsule {
_currentElement.setAttribute(name, encodeString(value));
}
+ @Override
public void write(String[] value, final String name, final String[] defVal) throws IOException {
final Element el = appendElement(name);
@@ -414,6 +437,7 @@ public class DOMOutputCapsule implements OutputCapsule {
_currentElement = (Element) _currentElement.getParentNode();
}
+ @Override
public void write(final String[][] value, final String name, final String[][] defVal) throws IOException {
if (value == null) {
return;
@@ -432,6 +456,7 @@ public class DOMOutputCapsule implements OutputCapsule {
_currentElement = (Element) el.getParentNode();
}
+ @Override
public void write(final BitSet value, final String name, final BitSet defVal) throws IOException {
if (value == null || value.equals(defVal)) {
return;
@@ -446,6 +471,7 @@ public class DOMOutputCapsule implements OutputCapsule {
}
+ @Override
public void write(final Savable object, String name, final Savable defVal) throws IOException {
if (object == null) {
return;
@@ -488,6 +514,7 @@ public class DOMOutputCapsule implements OutputCapsule {
_currentElement = old;
}
+ @Override
public void write(final Savable[] objects, final String name, final Savable[] defVal) throws IOException {
if (objects == null) {
return;
@@ -515,6 +542,7 @@ public class DOMOutputCapsule implements OutputCapsule {
_currentElement = old;
}
+ @Override
public void write(final Savable[][] value, final String name, final Savable[][] defVal) throws IOException {
if (value == null) {
return;
@@ -534,6 +562,7 @@ public class DOMOutputCapsule implements OutputCapsule {
_currentElement = (Element) _currentElement.getParentNode();
}
+ @Override
public void writeSavableList(final List<? extends Savable> array, final String name,
final List<? extends Savable> defVal) throws IOException {
if (array == null) {
@@ -559,6 +588,7 @@ public class DOMOutputCapsule implements OutputCapsule {
_currentElement = old;
}
+ @Override
public void writeSavableListArray(final List<? extends Savable>[] objects, final String name,
final List<? extends Savable>[] defVal) throws IOException {
if (objects == null) {
@@ -586,6 +616,7 @@ public class DOMOutputCapsule implements OutputCapsule {
_currentElement = old;
}
+ @Override
public void writeSavableListArray2D(final List<? extends Savable>[][] value, final String name,
final List<? extends Savable>[][] defVal) throws IOException {
if (value == null) {
@@ -606,6 +637,7 @@ public class DOMOutputCapsule implements OutputCapsule {
_currentElement = (Element) el.getParentNode();
}
+ @Override
public void writeFloatBufferList(final List<FloatBuffer> array, final String name, final List<FloatBuffer> defVal)
throws IOException {
if (array == null) {
@@ -622,6 +654,7 @@ public class DOMOutputCapsule implements OutputCapsule {
_currentElement = (Element) el.getParentNode();
}
+ @Override
public void writeSavableMap(final Map<? extends Savable, ? extends Savable> map, final String name,
final Map<? extends Savable, ? extends Savable> defVal) throws IOException {
if (map == null) {
@@ -645,6 +678,7 @@ public class DOMOutputCapsule implements OutputCapsule {
_currentElement = (Element) stringMap.getParentNode();
}
+ @Override
public void writeStringSavableMap(final Map<String, ? extends Savable> map, final String name,
final Map<String, ? extends Savable> defVal) throws IOException {
if (map == null) {
@@ -668,6 +702,7 @@ public class DOMOutputCapsule implements OutputCapsule {
_currentElement = (Element) stringMap.getParentNode();
}
+ @Override
public void write(final FloatBuffer value, final String name, final FloatBuffer defVal) throws IOException {
if (value == null) {
return;
@@ -688,6 +723,7 @@ public class DOMOutputCapsule implements OutputCapsule {
_currentElement = (Element) el.getParentNode();
}
+ @Override
public void write(final IntBuffer value, final String name, final IntBuffer defVal) throws IOException {
if (value == null) {
return;
@@ -711,6 +747,7 @@ public class DOMOutputCapsule implements OutputCapsule {
_currentElement = (Element) el.getParentNode();
}
+ @Override
public void write(final ByteBuffer value, final String name, final ByteBuffer defVal) throws IOException {
if (value == null) {
return;
@@ -734,6 +771,7 @@ public class DOMOutputCapsule implements OutputCapsule {
_currentElement = (Element) el.getParentNode();
}
+ @Override
public void write(final ShortBuffer value, final String name, final ShortBuffer defVal) throws IOException {
if (value == null) {
return;
@@ -757,6 +795,7 @@ public class DOMOutputCapsule implements OutputCapsule {
_currentElement = (Element) el.getParentNode();
}
+ @Override
public void writeByteBufferList(final List<ByteBuffer> array, final String name, final List<ByteBuffer> defVal)
throws IOException {
if (array == null) {
@@ -774,6 +813,7 @@ public class DOMOutputCapsule implements OutputCapsule {
}
+ @Override
public void write(final Enum<?> value, final String name, final Enum<?> defVal) throws IOException {
if (value == defVal || value == null) {
return;
@@ -781,6 +821,7 @@ public class DOMOutputCapsule implements OutputCapsule {
_currentElement.setAttribute(name, String.valueOf(value));
}
+ @Override
public void write(final Enum<?>[] value, final String name) throws IOException {
if (value == null) {
return;
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/export/xml/DOMSerializer.java b/ardor3d-core/src/main/java/com/ardor3d/util/export/xml/DOMSerializer.java
index 34000f0..41943bb 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/export/xml/DOMSerializer.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/export/xml/DOMSerializer.java
@@ -1,9 +1,9 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* 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>.
*/
@@ -26,7 +26,7 @@ import org.w3c.dom.NodeList;
/**
* The DOMSerializer was based primarily off the DOMSerializer.java class from the "Java and XML" 3rd Edition book by
* Brett McLaughlin, and Justin Edelson. Some modifications were made to support formatting of elements and attributes.
- *
+ *
*/
public class DOMSerializer {
@@ -51,7 +51,7 @@ public class DOMSerializer {
}
public void setIndent(final int numSpaces) {
- final StringBuffer buffer = new StringBuffer();
+ final StringBuilder buffer = new StringBuilder();
for (int i = 0; i < numSpaces; i++) {
buffer.append('\t');
}
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/export/xml/DOM_PrettyPrint.java b/ardor3d-core/src/main/java/com/ardor3d/util/export/xml/DOM_PrettyPrint.java
index 03d3818..73c3c4c 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/export/xml/DOM_PrettyPrint.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/export/xml/DOM_PrettyPrint.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/export/xml/XMLExporter.java b/ardor3d-core/src/main/java/com/ardor3d/util/export/xml/XMLExporter.java
index e23bf32..93d356a 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/export/xml/XMLExporter.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/export/xml/XMLExporter.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -34,6 +34,7 @@ public class XMLExporter implements Ardor3dExporter {
}
+ @Override
public void save(final Savable object, final OutputStream os) throws IOException {
try {
// Initialize Document when saving so we don't retain state of previous exports
@@ -49,6 +50,7 @@ public class XMLExporter implements Ardor3dExporter {
}
}
+ @Override
public void save(final Savable object, final File f) throws IOException {
save(object, new FileOutputStream(f));
}
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/export/xml/XMLImporter.java b/ardor3d-core/src/main/java/com/ardor3d/util/export/xml/XMLImporter.java
index a5caa2a..18e9f65 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/export/xml/XMLImporter.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/export/xml/XMLImporter.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -32,6 +32,7 @@ public class XMLImporter implements Ardor3dImporter {
public XMLImporter() {}
+ @Override
public Savable load(final InputStream is) throws IOException {
try {
final DOMInputCapsule _domIn = new DOMInputCapsule(DocumentBuilderFactory.newInstance()
@@ -48,14 +49,17 @@ public class XMLImporter implements Ardor3dImporter {
}
}
+ @Override
public Savable load(final URL url) throws IOException {
return load(url.openStream());
}
+ @Override
public Savable load(final File f) throws IOException {
return load(new FileInputStream(f));
}
+ @Override
public Savable load(final byte[] data) throws IOException {
return load(new ByteArrayInputStream(data));
}
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/geom/BufferUtils.java b/ardor3d-core/src/main/java/com/ardor3d/util/geom/BufferUtils.java
index a0a3478..17f7c2c 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/geom/BufferUtils.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/geom/BufferUtils.java
@@ -1,9 +1,9 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* 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>.
*/
@@ -20,6 +20,7 @@ import java.nio.ShortBuffer;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
+import java.util.WeakHashMap;
import com.ardor3d.math.ColorRGBA;
import com.ardor3d.math.Vector2;
@@ -36,7 +37,6 @@ import com.ardor3d.scenegraph.IntBufferData;
import com.ardor3d.scenegraph.ShortBufferData;
import com.ardor3d.util.Ardor3dException;
import com.ardor3d.util.Constants;
-import com.google.common.collect.MapMaker;
/**
* <code>BufferUtils</code> is a helper class for generating nio buffers from ardor3d data classes such as Vectors and
@@ -45,7 +45,7 @@ import com.google.common.collect.MapMaker;
public final class BufferUtils {
// // -- TRACKER HASH -- ////
- private static final Map<Buffer, Object> trackingHash = new MapMaker().weakKeys().makeMap();
+ private static final Map<Buffer, Object> trackingHash = new WeakHashMap<>();
private static final Object ref = new Object();
// // -- COLORRGBA METHODS -- ////
@@ -53,7 +53,7 @@ public final class BufferUtils {
/**
* Generate a new FloatBuffer using the given array of ColorRGBA objects. The FloatBuffer will be 4 * data.length
* long and contain the color data as data[0].r, data[0].g, data[0].b, data[0].a, data[1].r... etc.
- *
+ *
* @param data
* array of ColorRGBA objects to place into a new FloatBuffer
*/
@@ -67,7 +67,7 @@ public final class BufferUtils {
/**
* Generate a new FloatBuffer using the given array of ColorRGBA objects. The FloatBuffer will be 4 * data.length
* long and contain the color data as data[0].r, data[0].g, data[0].b, data[0].a, data[1].r... etc.
- *
+ *
* @param offset
* the starting index to read from in our data array
* @param length
@@ -93,7 +93,7 @@ public final class BufferUtils {
/**
* Create a new FloatBuffer of an appropriate size to hold the specified number of ColorRGBA object data.
- *
+ *
* @param colors
* number of colors that need to be held by the newly created buffer
* @return the requested new FloatBuffer
@@ -105,7 +105,7 @@ public final class BufferUtils {
/**
* Sets the data contained in the given color into the FloatBuffer at the specified index.
- *
+ *
* @param color
* the data to insert
* @param buf
@@ -123,7 +123,7 @@ public final class BufferUtils {
/**
* Updates the values of the given color from the specified buffer at the index provided.
- *
+ *
* @param store
* the color to set data on
* @param buf
@@ -140,7 +140,7 @@ public final class BufferUtils {
/**
* Generates a ColorRGBA array from the given FloatBuffer.
- *
+ *
* @param buff
* the FloatBuffer to read from
* @return a newly generated array of ColorRGBA objects
@@ -157,7 +157,7 @@ public final class BufferUtils {
/**
* Generates a ColorRGBA array from the given FloatBufferData.
- *
+ *
* @param buff
* the FloatBufferData to read from
* @param defaults
@@ -193,7 +193,7 @@ public final class BufferUtils {
/**
* Copies a ColorRGBA from one position in the buffer to another. The index values are in terms of color number (eg,
* color number 0 is positions 0-3 in the FloatBuffer.)
- *
+ *
* @param buf
* the buffer to copy from/to
* @param fromPos
@@ -207,7 +207,7 @@ public final class BufferUtils {
/**
* Checks to see if the given ColorRGBA is equals to the data stored in the buffer at the given data index.
- *
+ *
* @param check
* the color to check against - null will return false.
* @param buf
@@ -227,7 +227,7 @@ public final class BufferUtils {
/**
* Generate a new FloatBuffer using the given array of Vector4 objects. The FloatBuffer will be 4 * data.length long
* and contain the vector data as data[0].x, data[0].y, data[0].z, data[0].w, data[1].x... etc.
- *
+ *
* @param offset
* the starting index to read from in our data array
* @param length
@@ -245,7 +245,7 @@ public final class BufferUtils {
/**
* Generate a new FloatBuffer using the given array of Vector4 objects. The FloatBuffer will be 4 * data.length long
* and contain the vector data as data[0].x, data[0].y, data[0].z, data[0].w, data[1].x... etc.
- *
+ *
* @param data
* array of Vector4 objects to place into a new FloatBuffer
*/
@@ -267,7 +267,7 @@ public final class BufferUtils {
/**
* Create a new FloatBuffer of an appropriate size to hold the specified number of Vector4 object data.
- *
+ *
* @param vertices
* number of vertices that need to be held by the newly created buffer
* @return the requested new FloatBuffer
@@ -280,7 +280,7 @@ public final class BufferUtils {
/**
* Create a new FloatBuffer of an appropriate size to hold the specified number of Vector4 object data only if the
* given buffer if not already the right size.
- *
+ *
* @param buf
* the buffer to first check and rewind
* @param vertices
@@ -298,7 +298,7 @@ public final class BufferUtils {
/**
* Sets the data contained in the given Vector4 into the FloatBuffer at the specified index.
- *
+ *
* @param vector
* the data to insert
* @param buf
@@ -325,7 +325,7 @@ public final class BufferUtils {
/**
* Updates the values of the given vector from the specified buffer at the index provided.
- *
+ *
* @param vector
* the vector to set data on
* @param buf
@@ -342,7 +342,7 @@ public final class BufferUtils {
/**
* Generates a Vector4 array from the given FloatBuffer.
- *
+ *
* @param buff
* the FloatBuffer to read from
* @return a newly generated array of Vector3 objects
@@ -359,7 +359,7 @@ public final class BufferUtils {
/**
* Generates a Vector4 array from the given FloatBufferData.
- *
+ *
* @param buff
* the FloatBufferData to read from
* @param defaults
@@ -395,7 +395,7 @@ public final class BufferUtils {
/**
* Copies a Vector3 from one position in the buffer to another. The index values are in terms of vector number (eg,
* vector number 0 is positions 0-2 in the FloatBuffer.)
- *
+ *
* @param buf
* the buffer to copy from/to
* @param fromPos
@@ -409,7 +409,7 @@ public final class BufferUtils {
/**
* Normalize a Vector4 in-buffer.
- *
+ *
* @param buf
* the buffer to find the Vector4 within
* @param index
@@ -425,7 +425,7 @@ public final class BufferUtils {
/**
* Add to a Vector4 in-buffer.
- *
+ *
* @param toAdd
* the vector to add from
* @param buf
@@ -443,7 +443,7 @@ public final class BufferUtils {
/**
* Multiply and store a Vector3 in-buffer.
- *
+ *
* @param toMult
* the vector to multiply against
* @param buf
@@ -461,7 +461,7 @@ public final class BufferUtils {
/**
* Checks to see if the given Vector3 is equals to the data stored in the buffer at the given data index.
- *
+ *
* @param check
* the vector to check against - null will return false.
* @param buf
@@ -483,7 +483,7 @@ public final class BufferUtils {
/**
* Generate a new FloatBuffer using the given array of Vector3 objects. The FloatBuffer will be 3 * data.length long
* and contain the vector data as data[0].x, data[0].y, data[0].z, data[1].x... etc.
- *
+ *
* @param data
* array of Vector3 objects to place into a new FloatBuffer
*/
@@ -497,7 +497,7 @@ public final class BufferUtils {
/**
* Generate a new FloatBuffer using the given array of Vector3 objects. The FloatBuffer will be 3 * data.length long
* and contain the vector data as data[0].x, data[0].y, data[0].z, data[1].x... etc.
- *
+ *
* @param offset
* the starting index to read from in our data array
* @param length
@@ -523,7 +523,7 @@ public final class BufferUtils {
/**
* Create a new FloatBuffer of an appropriate size to hold the specified number of Vector3 object data.
- *
+ *
* @param vertices
* number of vertices that need to be held by the newly created buffer
* @return the requested new FloatBuffer
@@ -536,7 +536,7 @@ public final class BufferUtils {
/**
* Create a new FloatBuffer of an appropriate size to hold the specified number of Vector3 object data only if the
* given buffer is not already the right size.
- *
+ *
* @param buf
* the buffer to first check and rewind
* @param vertices
@@ -554,7 +554,7 @@ public final class BufferUtils {
/**
* Sets the data contained in the given Vector3 into the FloatBuffer at the specified index.
- *
+ *
* @param vector
* the data to insert
* @param buf
@@ -579,7 +579,7 @@ public final class BufferUtils {
/**
* Updates the values of the given vector from the specified buffer at the index provided.
- *
+ *
* @param vector
* the vector to set data on
* @param buf
@@ -595,7 +595,7 @@ public final class BufferUtils {
/**
* Generates a Vector3 array from the given FloatBuffer.
- *
+ *
* @param buff
* the FloatBuffer to read from
* @return a newly generated array of Vector3 objects
@@ -612,7 +612,7 @@ public final class BufferUtils {
/**
* Generates a Vector3 array from the given FloatBufferData.
- *
+ *
* @param buff
* the FloatBufferData to read from
* @param defaults
@@ -645,7 +645,7 @@ public final class BufferUtils {
/**
* Copies a Vector3 from one position in the buffer to another. The index values are in terms of vector number (eg,
* vector number 0 is positions 0-2 in the FloatBuffer.)
- *
+ *
* @param buf
* the buffer to copy from/to
* @param fromPos
@@ -659,7 +659,7 @@ public final class BufferUtils {
/**
* Normalize a Vector3 in-buffer.
- *
+ *
* @param buf
* the buffer to find the Vector3 within
* @param index
@@ -675,7 +675,7 @@ public final class BufferUtils {
/**
* Add to a Vector3 in-buffer.
- *
+ *
* @param toAdd
* the vector to add from
* @param buf
@@ -693,7 +693,7 @@ public final class BufferUtils {
/**
* Multiply and store a Vector3 in-buffer.
- *
+ *
* @param toMult
* the vector to multiply against
* @param buf
@@ -711,7 +711,7 @@ public final class BufferUtils {
/**
* Checks to see if the given Vector3 is equals to the data stored in the buffer at the given data index.
- *
+ *
* @param check
* the vector to check against - null will return false.
* @param buf
@@ -733,7 +733,7 @@ public final class BufferUtils {
/**
* Generate a new FloatBuffer using the given array of Vector2 objects. The FloatBuffer will be 2 * data.length long
* and contain the vector data as data[0].x, data[0].y, data[1].x... etc.
- *
+ *
* @param data
* array of Vector2 objects to place into a new FloatBuffer
*/
@@ -747,7 +747,7 @@ public final class BufferUtils {
/**
* Generate a new FloatBuffer using the given array of Vector2 objects. The FloatBuffer will be 2 * data.length long
* and contain the vector data as data[0].x, data[0].y, data[1].x... etc.
- *
+ *
* @param offset
* the starting index to read from in our data array
* @param length
@@ -773,7 +773,7 @@ public final class BufferUtils {
/**
* Create a new FloatBuffer of an appropriate size to hold the specified number of Vector2 object data.
- *
+ *
* @param vertices
* number of vertices that need to be held by the newly created buffer
* @return the requested new FloatBuffer
@@ -786,7 +786,7 @@ public final class BufferUtils {
/**
* Create a new FloatBuffer of an appropriate size to hold the specified number of Vector2 object data only if the
* given buffer if not already the right size.
- *
+ *
* @param buf
* the buffer to first check and rewind
* @param vertices
@@ -804,7 +804,7 @@ public final class BufferUtils {
/**
* Sets the data contained in the given Vector2 into the FloatBuffer at the specified index.
- *
+ *
* @param vector
* the data to insert
* @param buf
@@ -819,7 +819,7 @@ public final class BufferUtils {
/**
* Updates the values of the given vector from the specified buffer at the index provided.
- *
+ *
* @param vector
* the vector to set data on
* @param buf
@@ -834,7 +834,7 @@ public final class BufferUtils {
/**
* Generates a Vector2 array from the given FloatBuffer.
- *
+ *
* @param buff
* the FloatBuffer to read from
* @return a newly generated array of Vector2 objects
@@ -851,7 +851,7 @@ public final class BufferUtils {
/**
* Generates a Vector2 array from the given FloatBufferData.
- *
+ *
* @param buff
* the FloatBufferData to read from
* @param defaults
@@ -881,7 +881,7 @@ public final class BufferUtils {
/**
* Copies a Vector2 from one position in the buffer to another. The index values are in terms of vector number (eg,
* vector number 0 is positions 0-1 in the FloatBuffer.)
- *
+ *
* @param buf
* the buffer to copy from/to
* @param fromPos
@@ -895,7 +895,7 @@ public final class BufferUtils {
/**
* Normalize a Vector2 in-buffer.
- *
+ *
* @param buf
* the buffer to find the Vector2 within
* @param index
@@ -911,7 +911,7 @@ public final class BufferUtils {
/**
* Add to a Vector2 in-buffer.
- *
+ *
* @param toAdd
* the vector to add from
* @param buf
@@ -929,7 +929,7 @@ public final class BufferUtils {
/**
* Multiply and store a Vector2 in-buffer.
- *
+ *
* @param toMult
* the vector to multiply against
* @param buf
@@ -947,7 +947,7 @@ public final class BufferUtils {
/**
* Checks to see if the given Vector2 is equals to the data stored in the buffer at the given data index.
- *
+ *
* @param check
* the vector to check against - null will return false.
* @param buf
@@ -969,7 +969,7 @@ public final class BufferUtils {
/**
* Generate a new IntBuffer using the given array of ints. The IntBuffer will be data.length long and contain the
* int data as data[0], data[1]... etc.
- *
+ *
* @param data
* array of ints to place into a new IntBuffer
*/
@@ -986,7 +986,7 @@ public final class BufferUtils {
/**
* Create a new int[] array and populate it with the given IntBuffer's contents.
- *
+ *
* @param buff
* the IntBuffer to read from
* @return a new int array populated from the IntBuffer
@@ -1005,7 +1005,7 @@ public final class BufferUtils {
/**
* Create a new int[] array and populate it with the given IndexBufferData's contents.
- *
+ *
* @param buff
* the IndexBufferData to read from
* @return a new int array populated from the IndexBufferData
@@ -1024,7 +1024,7 @@ public final class BufferUtils {
/**
* Create a new float[] array and populate it with the given FloatBuffer's contents.
- *
+ *
* @param buff
* the FloatBuffer to read from
* @return a new float array populated from the FloatBuffer
@@ -1045,7 +1045,7 @@ public final class BufferUtils {
/**
* Create a new DoubleBuffer of the specified size.
- *
+ *
* @param size
* required number of double to store.
* @return the new DoubleBuffer
@@ -1058,7 +1058,7 @@ public final class BufferUtils {
/**
* Create a new DoubleBuffer of the specified size.
- *
+ *
* @param size
* required number of double to store.
* @return the new DoubleBuffer
@@ -1075,7 +1075,7 @@ public final class BufferUtils {
/**
* Create a new DoubleBuffer of an appropriate size to hold the specified number of doubles only if the given buffer
* if not already the right size.
- *
+ *
* @param buf
* the buffer to first check and rewind
* @param size
@@ -1096,7 +1096,7 @@ public final class BufferUtils {
* Creates a new DoubleBuffer with the same contents as the given DoubleBuffer. The new DoubleBuffer is seperate
* from the old one and changes are not reflected across. If you want to reflect changes, consider using
* Buffer.duplicate().
- *
+ *
* @param buf
* the DoubleBuffer to copy
* @return the copy
@@ -1122,7 +1122,7 @@ public final class BufferUtils {
/**
* Create a new FloatBuffer of the specified size.
- *
+ *
* @param size
* required number of floats to store.
* @return the new FloatBuffer
@@ -1138,7 +1138,7 @@ public final class BufferUtils {
/**
* Create a new FloatBuffer of the specified size.
- *
+ *
* @param size
* required number of floats to store.
* @return the new FloatBuffer
@@ -1151,7 +1151,7 @@ public final class BufferUtils {
/**
* Generate a new FloatBuffer using the given array of float primitives.
- *
+ *
* @param data
* array of float primitives to place into a new FloatBuffer
*/
@@ -1161,7 +1161,7 @@ public final class BufferUtils {
/**
* Generate a new FloatBuffer using the given array of float primitives.
- *
+ *
* @param data
* array of float primitives to place into a new FloatBuffer
*/
@@ -1182,6 +1182,88 @@ public final class BufferUtils {
return buff;
}
+ /**
+ * Generate a new FloatBuffer using the given array of Vector2 objects. The FloatBuffer will be 2 * data.length long
+ * and contain the vector data as data[0].x, data[0].y, data[1].x... etc.
+ *
+ * @param offset
+ * the starting index to read from in our data array
+ * @param length
+ * the number of vectors to read
+ * @param data
+ * array of Vector2 objects to place into a new FloatBuffer
+ */
+ public static FloatBuffer createFloatBufferOnHeap(final int offset, final int length, final ReadOnlyVector2... data) {
+ if (data == null) {
+ return null;
+ }
+ final FloatBuffer buff = BufferUtils.createFloatBufferOnHeap(2 * length);
+ for (int x = offset; x < length; x++) {
+ if (data[x] != null) {
+ buff.put(data[x].getXf()).put(data[x].getYf());
+ } else {
+ buff.put(0).put(0);
+ }
+ }
+ buff.flip();
+ return buff;
+ }
+
+ /**
+ * Generate a new FloatBuffer using the given array of Vector3 objects. The FloatBuffer will be 3 * data.length long
+ * and contain the vector data as data[0].x, data[0].y, data[0].z, data[1].x... etc.
+ *
+ * @param offset
+ * the starting index to read from in our data array
+ * @param length
+ * the number of vectors to read
+ * @param data
+ * array of Vector3 objects to place into a new FloatBuffer
+ */
+ public static FloatBuffer createFloatBufferOnHeap(final int offset, final int length, final ReadOnlyVector3... data) {
+ if (data == null) {
+ return null;
+ }
+ final FloatBuffer buff = BufferUtils.createFloatBufferOnHeap(3 * length);
+ for (int x = offset; x < length; x++) {
+ if (data[x] != null) {
+ buff.put(data[x].getXf()).put(data[x].getYf()).put(data[x].getZf());
+ } else {
+ buff.put(0).put(0).put(0);
+ }
+ }
+ buff.flip();
+ return buff;
+ }
+
+ /**
+ * Generate a new FloatBuffer using the given array of ColorRGBA objects. The FloatBuffer will be 4 * data.length
+ * long and contain the color data as data[0].r, data[0].g, data[0].b, data[0].a, data[1].r... etc.
+ *
+ * @param offset
+ * the starting index to read from in our data array
+ * @param length
+ * the number of colors to read
+ * @param data
+ * array of ColorRGBA objects to place into a new FloatBuffer
+ */
+ public static FloatBuffer createFloatBufferOnHeap(final int offset, final int length,
+ final ReadOnlyColorRGBA... data) {
+ if (data == null) {
+ return null;
+ }
+ final FloatBuffer buff = BufferUtils.createFloatBufferOnHeap(4 * length);
+ for (int x = offset; x < length; x++) {
+ if (data[x] != null) {
+ buff.put(data[x].getRed()).put(data[x].getGreen()).put(data[x].getBlue()).put(data[x].getAlpha());
+ } else {
+ buff.put(0).put(0).put(0).put(0);
+ }
+ }
+ buff.flip();
+ return buff;
+ }
+
public static IntBuffer createIntBuffer(final IntBuffer reuseStore, final int... data) {
if (data == null) {
return null;
@@ -1201,7 +1283,7 @@ public final class BufferUtils {
/**
* Copies floats from one buffer to another.
- *
+ *
* @param source
* the buffer to copy from
* @param fromPos
@@ -1225,7 +1307,7 @@ public final class BufferUtils {
/**
* Copies floats from one position in the buffer to another.
- *
+ *
* @param buf
* the buffer to copy from/to
* @param fromPos
@@ -1247,7 +1329,7 @@ public final class BufferUtils {
* Creates a new FloatBuffer with the same contents as the given FloatBuffer. The new FloatBuffer is seperate from
* the old one and changes are not reflected across. If you want to reflect changes, consider using
* Buffer.duplicate().
- *
+ *
* @param buf
* the FloatBuffer to copy
* @return the copy
@@ -1273,7 +1355,7 @@ public final class BufferUtils {
/**
* Create a new IntBuffer of the specified size.
- *
+ *
* @param size
* required number of ints to store.
* @return the new IntBuffer
@@ -1286,7 +1368,7 @@ public final class BufferUtils {
/**
* Create a new IntBuffer of the specified size.
- *
+ *
* @param size
* required number of ints to store.
* @return the new IntBuffer
@@ -1303,7 +1385,7 @@ public final class BufferUtils {
/**
* Create a new IntBuffer of an appropriate size to hold the specified number of ints only if the given buffer if
* not already the right size.
- *
+ *
* @param buf
* the buffer to first check and rewind
* @param size
@@ -1323,7 +1405,7 @@ public final class BufferUtils {
/**
* Creates a new IntBuffer with the same contents as the given IntBuffer. The new IntBuffer is seperate from the old
* one and changes are not reflected across. If you want to reflect changes, consider using Buffer.duplicate().
- *
+ *
* @param buf
* the IntBuffer to copy
* @return the copy
@@ -1349,7 +1431,7 @@ public final class BufferUtils {
/**
* Create a new ByteBuffer of the specified size.
- *
+ *
* @param size
* required number of ints to store.
* @return the new IntBuffer
@@ -1366,7 +1448,7 @@ public final class BufferUtils {
/**
* Create a new ByteBuffer of an appropriate size to hold the specified number of ints only if the given buffer if
* not already the right size.
- *
+ *
* @param buf
* the buffer to first check and rewind
* @param size
@@ -1386,7 +1468,7 @@ public final class BufferUtils {
/**
* Creates a new ByteBuffer with the same contents as the given ByteBuffer. The new ByteBuffer is seperate from the
* old one and changes are not reflected across. If you want to reflect changes, consider using Buffer.duplicate().
- *
+ *
* @param buf
* the ByteBuffer to copy
* @return the copy
@@ -1412,7 +1494,7 @@ public final class BufferUtils {
/**
* Create a new ShortBuffer of the specified size.
- *
+ *
* @param size
* required number of shorts to store.
* @return the new ShortBuffer
@@ -1425,7 +1507,7 @@ public final class BufferUtils {
/**
* Create a new ShortBuffer of the specified size.
- *
+ *
* @param size
* required number of shorts to store.
* @return the new ShortBuffer
@@ -1441,7 +1523,7 @@ public final class BufferUtils {
/**
* Generate a new ShortBuffer using the given array of short primitives.
- *
+ *
* @param data
* array of short primitives to place into a new ShortBuffer
*/
@@ -1459,7 +1541,7 @@ public final class BufferUtils {
/**
* Create a new ShortBuffer of an appropriate size to hold the specified number of shorts only if the given buffer
* if not already the right size.
- *
+ *
* @param buf
* the buffer to first check and rewind
* @param size
@@ -1480,7 +1562,7 @@ public final class BufferUtils {
* Creates a new ShortBuffer with the same contents as the given ShortBuffer. The new ShortBuffer is seperate from
* the old one and changes are not reflected across. If you want to reflect changes, consider using
* Buffer.duplicate().
- *
+ *
* @param buf
* the ShortBuffer to copy
* @return the copy
@@ -1505,7 +1587,7 @@ public final class BufferUtils {
/**
* Ensures there is at least the <code>required</code> number of entries left after the current position of the
* buffer. If the buffer is too small a larger one is created and the old one copied to the new buffer.
- *
+ *
* @param buffer
* buffer that should be checked/copied (may be null)
* @param required
@@ -1533,7 +1615,7 @@ public final class BufferUtils {
* Create a new IndexBufferData of the specified size. The specific implementation will be chosen based on the max
* value you need to store in your buffer. If that value is less than 2^8, a ByteBufferData is used. If it is less
* than 2^16, a ShortBufferData is used. Otherwise an IntBufferData is used.
- *
+ *
* @param size
* required number of values to store.
* @param maxValue
@@ -1552,10 +1634,32 @@ public final class BufferUtils {
}
/**
+ * Create a new IndexBufferData of the specified size. The specific implementation will be chosen based on the max
+ * value you need to store in your buffer. If that value is less than 2^8, a ByteBufferData is used. If it is less
+ * than 2^16, a ShortBufferData is used. Otherwise an IntBufferData is used.
+ *
+ * @param size
+ * required number of values to store.
+ * @param maxValue
+ * the largest value you will need to store in your buffer. Often this is equal to
+ * ("size of vertex buffer" - 1).
+ * @return the new IndexBufferData
+ */
+ public static IndexBufferData<?> createIndexBufferDataOnHeap(final int size, final int maxValue) {
+ if (maxValue < 256) { // 2^8
+ return new ByteBufferData(BufferUtils.createByteBufferOnHeap(size));
+ } else if (maxValue < 65536) { // 2^16
+ return new ShortBufferData(BufferUtils.createShortBufferOnHeap(size));
+ } else {
+ return new IntBufferData(BufferUtils.createIntBufferOnHeap(size));
+ }
+ }
+
+ /**
* Create a new IndexBufferData large enough to fit the contents of the given array. The specific implementation
* will be chosen based on the max value you need to store in your buffer. If that value is less than 2^8, a
* ByteBufferData is used. If it is less than 2^16, a ShortBufferData is used. Otherwise an IntBufferData is used.
- *
+ *
* @param contents
* an array of index values to store in your newly created IndexBufferData.
* @param maxValue
@@ -1578,7 +1682,7 @@ public final class BufferUtils {
/**
* Create a new IndexBufferData of the specified size and class.
- *
+ *
* @param size
* required number of values to store.
* @param clazz
@@ -1597,7 +1701,7 @@ public final class BufferUtils {
/**
* Creates a new IndexBufferData with the same contents as the given IndexBufferData. The new IndexBufferData is
* separate from the old one and changes are not reflected across.
- *
+ *
* @param buf
* the IndexBufferData to copy
* @return the copy
@@ -1624,7 +1728,7 @@ public final class BufferUtils {
/**
* Create a new ByteBuffer of the specified size.
- *
+ *
* @param size
* required number of ints to store.
* @return the new IntBuffer
@@ -1638,7 +1742,7 @@ public final class BufferUtils {
/**
* Create a new ByteBuffer of an appropriate size to hold the specified number of ints only if the given buffer if
* not already the right size.
- *
+ *
* @param buf
* the buffer to first check and rewind
* @param size
@@ -1658,7 +1762,7 @@ public final class BufferUtils {
/**
* Creates a new ByteBuffer with the same contents as the given ByteBuffer. The new ByteBuffer is seperate from the
* old one and changes are not reflected across. If you want to reflect changes, consider using Buffer.duplicate().
- *
+ *
* @param buf
* the ByteBuffer to copy
* @return the copy
@@ -1678,7 +1782,7 @@ public final class BufferUtils {
public static void printCurrentDirectMemory(StringBuilder store) {
long totalHeld = 0;
// make a new set to hold the keys to prevent concurrency issues.
- final List<Buffer> bufs = new ArrayList<Buffer>(trackingHash.keySet());
+ final List<Buffer> bufs = new ArrayList<>(trackingHash.keySet());
int fBufs = 0, bBufs = 0, iBufs = 0, sBufs = 0, dBufs = 0;
int fBufsM = 0, bBufsM = 0, iBufsM = 0, sBufsM = 0, dBufsM = 0;
for (final Buffer b : bufs) {
@@ -1710,11 +1814,11 @@ public final class BufferUtils {
}
store.append("Existing buffers: ").append(bufs.size()).append('\n');
store.append("(b: ").append(bBufs).append(" f: ").append(fBufs).append(" i: ").append(iBufs).append(" s: ")
- .append(sBufs).append(" d: ").append(dBufs).append(')').append('\n');
+ .append(sBufs).append(" d: ").append(dBufs).append(')').append('\n');
store.append("Total direct memory held: ").append(totalHeld / 1024).append("kb\n");
store.append("(b: ").append(bBufsM / 1024).append("kb f: ").append(fBufsM / 1024).append("kb i: ")
- .append(iBufsM / 1024).append("kb s: ").append(sBufsM / 1024).append("kb d: ").append(dBufsM / 1024)
- .append("kb)").append('\n');
+ .append(iBufsM / 1024).append("kb s: ").append(sBufsM / 1024).append("kb d: ").append(dBufsM / 1024)
+ .append("kb)").append('\n');
if (printStout) {
System.out.println(store.toString());
}
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/geom/CopyLogic.java b/ardor3d-core/src/main/java/com/ardor3d/util/geom/CopyLogic.java
index f581103..4d8dd4f 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/geom/CopyLogic.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/geom/CopyLogic.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/geom/Debugger.java b/ardor3d-core/src/main/java/com/ardor3d/util/geom/Debugger.java
index 56b2fbe..c81dd94 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/geom/Debugger.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/geom/Debugger.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/geom/GeometryTool.java b/ardor3d-core/src/main/java/com/ardor3d/util/geom/GeometryTool.java
index a9f4f3f..7676b88 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/geom/GeometryTool.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/geom/GeometryTool.java
@@ -1,31 +1,36 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* 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>.
*/
package com.ardor3d.util.geom;
+import java.nio.FloatBuffer;
+import java.util.ArrayList;
import java.util.EnumSet;
+import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import java.util.logging.Logger;
import com.ardor3d.math.ColorRGBA;
import com.ardor3d.math.Vector2;
import com.ardor3d.math.Vector3;
+import com.ardor3d.scenegraph.FloatBufferData;
import com.ardor3d.scenegraph.IndexBufferData;
import com.ardor3d.scenegraph.Mesh;
+import com.ardor3d.scenegraph.MeshData;
import com.ardor3d.scenegraph.Node;
import com.ardor3d.scenegraph.Spatial;
-import com.google.common.collect.Maps;
/**
* This tool assists in reducing geometry information.<br>
- *
+ *
* Note: Does not work with geometry using texcoords other than 2d coords. <br>
* TODO: Consider adding an option for "close enough" vertex matches... ie, smaller than X distance apart.<br>
*/
@@ -33,6 +38,11 @@ public class GeometryTool {
private static final Logger logger = Logger.getLogger(GeometryTool.class.getName());
/**
+ * flag indicating whether the NIO buffers are allocated on the heap
+ */
+ private final boolean nioBuffersAllocationOnHeapEnabled;
+
+ /**
* Condition options for determining if one vertex is "equal" to another.
*/
public enum MatchCondition {
@@ -47,14 +57,19 @@ public class GeometryTool {
}
public GeometryTool() {
+ this(false);
+ }
+
+ public GeometryTool(final boolean nioBuffersAllocationOnHeapEnabled) {
super();
+ this.nioBuffersAllocationOnHeapEnabled = nioBuffersAllocationOnHeapEnabled;
}
/**
* Attempt to collapse duplicate vertex data in a given mesh. Vertices are considered duplicate if they occupy the
* same place in space and match the supplied conditions. All vertices in the mesh are considered part of the same
* vertex "group".
- *
+ *
* @param mesh
* the mesh to reduce
* @param conditions
@@ -70,7 +85,7 @@ public class GeometryTool {
/**
* Attempt to collapse duplicate vertex data in a given mesh. Vertices are consider duplicate if they occupy the
* same place in space and match the supplied conditions. The conditions are supplied per vertex group.
- *
+ *
* @param mesh
* the mesh to reduce
* @param groupData
@@ -111,14 +126,14 @@ public class GeometryTool {
}
}
- final Map<VertKey, Integer> store = Maps.newHashMap();
- final Map<Integer, Integer> indexRemap = Maps.newHashMap();
+ final Map<VertKey, Integer> store = new HashMap<>();
+ final Map<Integer, Integer> indexRemap = new HashMap<>();
int good = 0;
long group;
for (int x = 0, max = verts.length; x < max; x++) {
group = groupData.getGroupForVertex(x);
- final VertKey vkey = new VertKey(verts[x], norms != null ? norms[x] : null, colors != null ? colors[x]
- : null, getTexs(tex, x), groupData.getGroupConditions(group), group);
+ final VertKey vkey = new VertKey(verts[x], norms != null ? norms[x] : null,
+ colors != null ? colors[x] : null, getTexs(tex, x), groupData.getGroupConditions(group), group);
// if we've already seen it, swap it for the max, and decrease max.
if (store.containsKey(vkey)) {
final int newInd = store.get(vkey);
@@ -163,22 +178,33 @@ public class GeometryTool {
}
}
- mesh.getMeshData().setVertexBuffer(BufferUtils.createFloatBuffer(0, good, verts));
+ mesh.getMeshData().setVertexBuffer(
+ nioBuffersAllocationOnHeapEnabled ? BufferUtils.createFloatBufferOnHeap(0, good, verts)
+ : BufferUtils.createFloatBuffer(0, good, verts));
if (norms != null) {
- mesh.getMeshData().setNormalBuffer(BufferUtils.createFloatBuffer(0, good, norms));
+ mesh.getMeshData().setNormalBuffer(
+ nioBuffersAllocationOnHeapEnabled ? BufferUtils.createFloatBufferOnHeap(0, good, norms)
+ : BufferUtils.createFloatBuffer(0, good, norms));
}
if (colors != null) {
- mesh.getMeshData().setColorBuffer(BufferUtils.createFloatBuffer(0, good, colors));
+ mesh.getMeshData().setColorBuffer(
+ nioBuffersAllocationOnHeapEnabled ? BufferUtils.createFloatBufferOnHeap(0, good, colors)
+ : BufferUtils.createFloatBuffer(0, good, colors));
}
for (int x = 0; x < tex.length; x++) {
if (tex[x] != null) {
- mesh.getMeshData().setTextureBuffer(BufferUtils.createFloatBuffer(0, good, tex[x]), x);
+ mesh.getMeshData()
+ .setTextureBuffer(nioBuffersAllocationOnHeapEnabled
+ ? BufferUtils.createFloatBufferOnHeap(0, good, tex[x])
+ : BufferUtils.createFloatBuffer(0, good, tex[x]), x);
}
}
if (mesh.getMeshData().getIndices() == null || mesh.getMeshData().getIndices().getBufferCapacity() == 0) {
- final IndexBufferData<?> indexBuffer = BufferUtils.createIndexBufferData(oldCount, oldCount);
+ final IndexBufferData<?> indexBuffer = nioBuffersAllocationOnHeapEnabled
+ ? BufferUtils.createIndexBufferDataOnHeap(oldCount, oldCount)
+ : BufferUtils.createIndexBufferData(oldCount, oldCount);
mesh.getMeshData().setIndices(indexBuffer);
for (int i = 0; i < oldCount; i++) {
if (indexRemap.containsKey(i)) {
@@ -230,4 +256,127 @@ public class GeometryTool {
}
}
}
+
+ /**
+ * Converts an indexed geometry into a non indexed geometry
+ *
+ *
+ * @param meshData
+ * mesh data
+ */
+ public void convertIndexedGeometryIntoNonIndexedGeometry(final MeshData meshData) {
+ final IndexBufferData<?> indices = meshData.getIndices();
+ if (indices != null) {
+ final FloatBuffer previousVertexBuffer = meshData.getVertexBuffer();
+ if (previousVertexBuffer != null) {
+ final int valuesPerVertexTuple = meshData.getVertexCoords().getValuesPerTuple();
+ final FloatBuffer nextVertexBuffer = nioBuffersAllocationOnHeapEnabled
+ ? BufferUtils.createFloatBufferOnHeap(indices.capacity() * valuesPerVertexTuple)
+ : BufferUtils.createFloatBuffer(indices.capacity() * valuesPerVertexTuple);
+ for (int indexIndex = 0; indexIndex < indices.capacity(); indexIndex++) {
+ final int vertexIndex = indices.get(indexIndex);
+ for (int coordIndex = 0; coordIndex < valuesPerVertexTuple; coordIndex++) {
+ final float vertexCoordValue = previousVertexBuffer
+ .get((vertexIndex * valuesPerVertexTuple) + coordIndex);
+ nextVertexBuffer.put((indexIndex * valuesPerVertexTuple) + coordIndex, vertexCoordValue);
+ }
+ }
+ meshData.setVertexCoords(new FloatBufferData(nextVertexBuffer, valuesPerVertexTuple));
+ }
+ final FloatBuffer previousNormalBuffer = meshData.getNormalBuffer();
+ if (previousNormalBuffer != null) {
+ final int valuesPerNormalTuple = meshData.getNormalCoords().getValuesPerTuple();
+ final FloatBuffer nextNormalBuffer = nioBuffersAllocationOnHeapEnabled
+ ? BufferUtils.createFloatBufferOnHeap(indices.capacity() * valuesPerNormalTuple)
+ : BufferUtils.createFloatBuffer(indices.capacity() * valuesPerNormalTuple);
+ for (int indexIndex = 0; indexIndex < indices.capacity(); indexIndex++) {
+ final int vertexIndex = indices.get(indexIndex);
+ for (int coordIndex = 0; coordIndex < valuesPerNormalTuple; coordIndex++) {
+ final float normalCoordValue = previousNormalBuffer
+ .get((vertexIndex * valuesPerNormalTuple) + coordIndex);
+ nextNormalBuffer.put((indexIndex * valuesPerNormalTuple) + coordIndex, normalCoordValue);
+ }
+ }
+ meshData.setNormalCoords(new FloatBufferData(nextNormalBuffer, valuesPerNormalTuple));
+ }
+ final FloatBuffer previousColorBuffer = meshData.getColorBuffer();
+ if (previousColorBuffer != null) {
+ final int valuesPerColorTuple = meshData.getColorCoords().getValuesPerTuple();
+ final FloatBuffer nextColorBuffer = nioBuffersAllocationOnHeapEnabled
+ ? BufferUtils.createFloatBufferOnHeap(indices.capacity() * valuesPerColorTuple)
+ : BufferUtils.createFloatBuffer(indices.capacity() * valuesPerColorTuple);
+ for (int indexIndex = 0; indexIndex < indices.capacity(); indexIndex++) {
+ final int vertexIndex = indices.get(indexIndex);
+ for (int coordIndex = 0; coordIndex < valuesPerColorTuple; coordIndex++) {
+ final float colorCoordValue = previousColorBuffer
+ .get((vertexIndex * valuesPerColorTuple) + coordIndex);
+ nextColorBuffer.put((indexIndex * valuesPerColorTuple) + coordIndex, colorCoordValue);
+ }
+ }
+ meshData.setColorCoords(new FloatBufferData(nextColorBuffer, valuesPerColorTuple));
+ }
+ final FloatBuffer previousFogBuffer = meshData.getFogBuffer();
+ if (previousFogBuffer != null) {
+ final int valuesPerFogTuple = meshData.getFogCoords().getValuesPerTuple();
+ final FloatBuffer nextFogBuffer = nioBuffersAllocationOnHeapEnabled
+ ? BufferUtils.createFloatBufferOnHeap(indices.capacity() * valuesPerFogTuple)
+ : BufferUtils.createFloatBuffer(indices.capacity() * valuesPerFogTuple);
+ for (int indexIndex = 0; indexIndex < indices.capacity(); indexIndex++) {
+ final int vertexIndex = indices.get(indexIndex);
+ for (int coordIndex = 0; coordIndex < valuesPerFogTuple; coordIndex++) {
+ final float fogCoordValue = previousFogBuffer
+ .get((vertexIndex * valuesPerFogTuple) + coordIndex);
+ nextFogBuffer.put((indexIndex * valuesPerFogTuple) + coordIndex, fogCoordValue);
+ }
+ }
+ meshData.setFogCoords(new FloatBufferData(nextFogBuffer, valuesPerFogTuple));
+ }
+ final FloatBuffer previousTangentBuffer = meshData.getTangentBuffer();
+ if (previousTangentBuffer != null) {
+ final int valuesPerTangentTuple = meshData.getTangentCoords().getValuesPerTuple();
+ final FloatBuffer nextTangentBuffer = nioBuffersAllocationOnHeapEnabled
+ ? BufferUtils.createFloatBufferOnHeap(indices.capacity() * valuesPerTangentTuple)
+ : BufferUtils.createFloatBuffer(indices.capacity() * valuesPerTangentTuple);
+ for (int indexIndex = 0; indexIndex < indices.capacity(); indexIndex++) {
+ final int vertexIndex = indices.get(indexIndex);
+ for (int coordIndex = 0; coordIndex < valuesPerTangentTuple; coordIndex++) {
+ final float tangentCoordValue = previousTangentBuffer
+ .get((vertexIndex * valuesPerTangentTuple) + coordIndex);
+ nextTangentBuffer.put((indexIndex * valuesPerTangentTuple) + coordIndex, tangentCoordValue);
+ }
+ }
+ meshData.setTangentCoords(new FloatBufferData(nextTangentBuffer, valuesPerTangentTuple));
+ }
+ final int numberOfUnits = meshData.getNumberOfUnits();
+ if (numberOfUnits > 0) {
+ final List<FloatBufferData> previousTextureCoordsList = meshData.getTextureCoords();
+ final List<FloatBufferData> nextTextureCoordsList = new ArrayList<>();
+ for (int unitIndex = 0; unitIndex < numberOfUnits; unitIndex++) {
+ final FloatBufferData previousTextureCoords = previousTextureCoordsList.get(unitIndex);
+ if (previousTextureCoords == null) {
+ nextTextureCoordsList.add(null);
+ } else {
+ final FloatBuffer previousTextureBuffer = previousTextureCoords.getBuffer();
+ final int valuesPerTextureTuple = previousTextureCoords.getValuesPerTuple();
+ final FloatBuffer nextTextureBuffer = nioBuffersAllocationOnHeapEnabled
+ ? BufferUtils.createFloatBufferOnHeap(indices.capacity() * valuesPerTextureTuple)
+ : BufferUtils.createFloatBuffer(indices.capacity() * valuesPerTextureTuple);
+ for (int indexIndex = 0; indexIndex < indices.capacity(); indexIndex++) {
+ final int vertexIndex = indices.get(indexIndex);
+ for (int coordIndex = 0; coordIndex < valuesPerTextureTuple; coordIndex++) {
+ final float textureCoordValue = previousTextureBuffer
+ .get((vertexIndex * valuesPerTextureTuple) + coordIndex);
+ nextTextureBuffer.put((indexIndex * valuesPerTextureTuple) + coordIndex,
+ textureCoordValue);
+ }
+ }
+ nextTextureCoordsList.add(new FloatBufferData(nextTextureBuffer, valuesPerTextureTuple));
+ }
+ }
+ meshData.setTextureCoords(nextTextureCoordsList);
+ }
+ // removes the index buffer
+ meshData.setIndices(null);
+ }
+ }
}
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/geom/MeshCombiner.java b/ardor3d-core/src/main/java/com/ardor3d/util/geom/MeshCombiner.java
index fdc3f7c..8e27e45 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/geom/MeshCombiner.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/geom/MeshCombiner.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -12,6 +12,8 @@ package com.ardor3d.util.geom;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;
+import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collection;
import java.util.EnumMap;
import java.util.List;
@@ -28,7 +30,6 @@ import com.ardor3d.scenegraph.Node;
import com.ardor3d.scenegraph.Spatial;
import com.ardor3d.scenegraph.visitor.Visitor;
import com.google.common.collect.ArrayListMultimap;
-import com.google.common.collect.Lists;
import com.google.common.collect.Multimap;
/**
@@ -62,7 +63,7 @@ public class MeshCombiner {
}
public final static Mesh combine(final Spatial source, final MeshCombineLogic logic) {
- final List<Mesh> sources = Lists.newArrayList();
+ final List<Mesh> sources = new ArrayList<>();
source.acceptVisitor(new Visitor() {
@Override
public void visit(final Spatial spatial) {
@@ -85,7 +86,7 @@ public class MeshCombiner {
* @return the combined Mesh.
*/
public final static Mesh combine(final Mesh... sources) {
- return combine(Lists.newArrayList(sources));
+ return combine(new ArrayList<>(Arrays.asList(sources)));
}
/**
@@ -128,7 +129,7 @@ public class MeshCombiner {
protected EnumMap<StateType, RenderState> states = null;
protected MeshData data = new MeshData();
protected BoundingVolume volumeType = null;
- protected List<Mesh> sources = Lists.newArrayList();
+ protected List<Mesh> sources = new ArrayList<>();
private FloatBufferData vertices;
private FloatBufferData colors;
private FloatBufferData normals;
@@ -236,7 +237,7 @@ public class MeshCombiner {
normals = useNormals ? new FloatBufferData(totalVertices * 3, 3) : null;
data.setNormalCoords(normals);
- texCoordsList = Lists.newArrayListWithCapacity(maxTextures);
+ texCoordsList = new ArrayList<>(maxTextures);
for (int i = 0; i < maxTextures; i++) {
texCoordsList.add(new FloatBufferData(totalVertices * texCoords, texCoords));
}
@@ -358,8 +359,8 @@ class IndexCombiner {
}
public void saveTo(final MeshData data) {
- final List<IntBuffer> sections = Lists.newArrayList();
- final List<IndexMode> modes = Lists.newArrayList();
+ final List<IntBuffer> sections = new ArrayList<>();
+ final List<IndexMode> modes = new ArrayList<>();
int max = 0;
// walk through index modes and combine those we can.
for (final IndexMode mode : sectionMap.keySet()) {
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/geom/NonIndexedNormalGenerator.java b/ardor3d-core/src/main/java/com/ardor3d/util/geom/NonIndexedNormalGenerator.java
index 78ef6d2..bc10271 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/geom/NonIndexedNormalGenerator.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/geom/NonIndexedNormalGenerator.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/geom/NormalGenerator.java b/ardor3d-core/src/main/java/com/ardor3d/util/geom/NormalGenerator.java
index 8eb80a4..3efa843 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/geom/NormalGenerator.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/geom/NormalGenerator.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2018 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -250,12 +250,12 @@ public class NormalGenerator {
*/
private void initialize() {
// Copy the source vertices as a base for the normal generation
- _destVerts = new ArrayList<Vector3>(_sourceVerts.length);
+ _destVerts = new ArrayList<>(_sourceVerts.length);
for (int i = 0; i < _sourceVerts.length; i++) {
_destVerts.add(_sourceVerts[i]);
}
if (_sourceColors != null) {
- _destColors = new ArrayList<ColorRGBA>(_sourceColors.length);
+ _destColors = new ArrayList<>(_sourceColors.length);
for (int i = 0; i < _sourceColors.length; i++) {
_destColors.add(_sourceColors[i]);
}
@@ -263,7 +263,7 @@ public class NormalGenerator {
_destColors = null;
}
if (_sourceTexCoords != null) {
- _destTexCoords = new ArrayList<Vector2>(_sourceTexCoords.length);
+ _destTexCoords = new ArrayList<>(_sourceTexCoords.length);
for (int i = 0; i < _sourceTexCoords.length; i++) {
_destTexCoords.add(_sourceTexCoords[i]);
}
@@ -272,7 +272,7 @@ public class NormalGenerator {
}
// Set up the base triangles of the mesh and their face normals
- _triangles = new LinkedList<Triangle>();
+ _triangles = new LinkedList<>();
for (int i = 0; i * 3 < _sourceInds.length; i++) {
final Triangle tri = new Triangle(_sourceInds[i * 3 + 0], _sourceInds[i * 3 + 1], _sourceInds[i * 3 + 2]);
tri.computeNormal(_sourceVerts);
@@ -281,12 +281,12 @@ public class NormalGenerator {
// Set up the lists to store the created mesh split data
if (_splitMeshes == null) {
- _splitMeshes = new LinkedList<LinkedList<Triangle>>();
+ _splitMeshes = new LinkedList<>();
} else {
_splitMeshes.clear();
}
if (_splitMeshBorders == null) {
- _splitMeshBorders = new LinkedList<LinkedList<Edge>>();
+ _splitMeshBorders = new LinkedList<>();
} else {
_splitMeshBorders.clear();
}
@@ -298,8 +298,8 @@ public class NormalGenerator {
* border of the split mesh in splitMeshBorders.
*/
private void createMeshSplit() {
- _destTris = new LinkedList<Triangle>();
- _edges = new LinkedList<Edge>();
+ _destTris = new LinkedList<>();
+ _edges = new LinkedList<>();
final Triangle tri = _triangles.removeFirst();
_destTris.addLast(tri);
_edges.addLast(tri.edges[0]);
@@ -322,6 +322,7 @@ public class NormalGenerator {
*
* @return The triangle, if one was found, or <code>null</code> otherwise
*/
+ @SuppressWarnings("null")
private Triangle insertTriangle() {
final ListIterator<Triangle> triIt = _triangles.listIterator();
ListIterator<Edge> edgeIt = null;
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/geom/SceneCopier.java b/ardor3d-core/src/main/java/com/ardor3d/util/geom/SceneCopier.java
index cb018e6..58d1596 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/geom/SceneCopier.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/geom/SceneCopier.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/geom/SharedCopyLogic.java b/ardor3d-core/src/main/java/com/ardor3d/util/geom/SharedCopyLogic.java
index 048086f..21fcdc4 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/geom/SharedCopyLogic.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/geom/SharedCopyLogic.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -27,6 +27,7 @@ import com.ardor3d.scenegraph.Spatial;
public class SharedCopyLogic implements CopyLogic {
private static final Logger logger = Logger.getLogger(SharedCopyLogic.class.getName());
+ @Override
public Spatial copy(final Spatial source, final AtomicBoolean recurse) {
recurse.set(false);
if (source instanceof Node) {
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/geom/TangentUtil.java b/ardor3d-core/src/main/java/com/ardor3d/util/geom/TangentUtil.java
index afa63c8..a907213 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/geom/TangentUtil.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/geom/TangentUtil.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/geom/VertGroupData.java b/ardor3d-core/src/main/java/com/ardor3d/util/geom/VertGroupData.java
index 91bc14a..e5d1746 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/geom/VertGroupData.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/geom/VertGroupData.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -11,16 +11,16 @@
package com.ardor3d.util.geom;
import java.util.EnumSet;
+import java.util.HashMap;
import java.util.Map;
import com.ardor3d.util.geom.GeometryTool.MatchCondition;
-import com.google.common.collect.Maps;
public class VertGroupData {
public static final int DEFAULT_GROUP = 0;
- private final Map<Long, EnumSet<MatchCondition>> _groupConditions = Maps.newHashMap();
+ private final Map<Long, EnumSet<MatchCondition>> _groupConditions = new HashMap<>();
private long[] _vertGroups = null;
public VertGroupData() {}
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/geom/VertKey.java b/ardor3d-core/src/main/java/com/ardor3d/util/geom/VertKey.java
index 2d0621b..f398d32 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/geom/VertKey.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/geom/VertKey.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/geom/VertMap.java b/ardor3d-core/src/main/java/com/ardor3d/util/geom/VertMap.java
index bb33c38..dc89242 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/geom/VertMap.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/geom/VertMap.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/resource/MultiFormatResourceLocator.java b/ardor3d-core/src/main/java/com/ardor3d/util/resource/MultiFormatResourceLocator.java
index 7ed7ce2..e84e64f 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/resource/MultiFormatResourceLocator.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/resource/MultiFormatResourceLocator.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/resource/RelativeResourceLocator.java b/ardor3d-core/src/main/java/com/ardor3d/util/resource/RelativeResourceLocator.java
index 5f959f9..3ed501f 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/resource/RelativeResourceLocator.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/resource/RelativeResourceLocator.java
@@ -1,9 +1,9 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* 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>.
*/
@@ -20,7 +20,7 @@ public class RelativeResourceLocator implements ResourceLocator {
/**
* Construct a new RelativeResourceLocator using the given source as our base.
- *
+ *
* @param resource
* our base source.
*/
@@ -34,6 +34,7 @@ public class RelativeResourceLocator implements ResourceLocator {
return _baseSource;
}
+ @Override
public ResourceSource locateResource(String resourceName) {
// Trim off any prepended local dir.
while (resourceName.startsWith("./") && resourceName.length() > 2) {
@@ -53,4 +54,9 @@ public class RelativeResourceLocator implements ResourceLocator {
}
return false;
}
+
+ @Override
+ public int hashCode() {
+ return _baseSource.hashCode();
+ }
}
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/resource/ResourceLocator.java b/ardor3d-core/src/main/java/com/ardor3d/util/resource/ResourceLocator.java
index 8353527..235caab 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/resource/ResourceLocator.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/resource/ResourceLocator.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/resource/ResourceLocatorTool.java b/ardor3d-core/src/main/java/com/ardor3d/util/resource/ResourceLocatorTool.java
index 2fdc2cc..85185fc 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/resource/ResourceLocatorTool.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/resource/ResourceLocatorTool.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -18,14 +18,13 @@ import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
-import com.google.common.collect.Sets;
-
/**
* Manager class for locator utility classes used to find various assets. (XXX: Needs more documentation)
*/
@@ -38,7 +37,7 @@ public class ResourceLocatorTool {
public static final String TYPE_AUDIO = "audio";
public static final String TYPE_SHADER = "shader";
- private static final Map<String, List<ResourceLocator>> _locatorMap = new HashMap<String, List<ResourceLocator>>();
+ private static final Map<String, List<ResourceLocator>> _locatorMap = new HashMap<>();
public static ResourceSource locateResource(final String resourceType, String resourceName) {
if (resourceName == null) {
@@ -69,11 +68,11 @@ public class ResourceLocatorTool {
return new URLResourceSource(u);
}
} catch (final Exception e) {
- logger.logp(Level.WARNING, ResourceLocatorTool.class.getName(), "locateResource(String, String)", e
- .getMessage(), e);
+ logger.logp(Level.WARNING, ResourceLocatorTool.class.getName(), "locateResource(String, String)",
+ e.getMessage(), e);
}
- logger.warning("Unable to locate: " + resourceName);
+ logger.warning("Unable to locate: " + resourceName + " of type " + resourceType);
return null;
}
}
@@ -85,7 +84,7 @@ public class ResourceLocatorTool {
synchronized (_locatorMap) {
List<ResourceLocator> bases = _locatorMap.get(resourceType);
if (bases == null) {
- bases = new ArrayList<ResourceLocator>();
+ bases = new ArrayList<>();
_locatorMap.put(resourceType, bases);
}
@@ -163,7 +162,7 @@ public class ResourceLocatorTool {
* @return a set containing the located URLs of the named resource.
*/
public static Set<URL> getClassPathResources(final Class<?> clazz, final String name) {
- final Set<URL> results = Sets.newHashSet();
+ final Set<URL> results = new HashSet<>();
Enumeration<URL> urls = null;
try {
urls = Thread.currentThread().getContextClassLoader().getResources(name);
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/resource/ResourceSource.java b/ardor3d-core/src/main/java/com/ardor3d/util/resource/ResourceSource.java
index 0e6f024..895c186 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/resource/ResourceSource.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/resource/ResourceSource.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/resource/SimpleResourceLocator.java b/ardor3d-core/src/main/java/com/ardor3d/util/resource/SimpleResourceLocator.java
index 580f408..b7a73c3 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/resource/SimpleResourceLocator.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/resource/SimpleResourceLocator.java
@@ -1,9 +1,9 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* 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>.
*/
@@ -27,7 +27,7 @@ public class SimpleResourceLocator implements ResourceLocator {
/**
* Construct a new SimpleResourceLocator using the given URI as our context.
- *
+ *
* @param baseDir
* our base context. This is meant to be a "directory" wherein we will search for resources. Therefore,
* if it does not end in /, a / will be added to ensure we are talking about children of the given
@@ -52,7 +52,7 @@ public class SimpleResourceLocator implements ResourceLocator {
/**
* Construct a new SimpleResourceLocator using the given URL as our context.
- *
+ *
* @param baseDir
* our base context. This is converted to a URI. This is meant to be a "directory" wherein we will search
* for resources. Therefore, if it does not end in /, a / will be added to ensure we are talking about
@@ -71,6 +71,7 @@ public class SimpleResourceLocator implements ResourceLocator {
return _baseDir;
}
+ @Override
public ResourceSource locateResource(final String resourceName) {
return doRecursiveLocate(cleanup(resourceName));
}
@@ -135,4 +136,9 @@ public class SimpleResourceLocator implements ResourceLocator {
}
return false;
}
+
+ @Override
+ public int hashCode() {
+ return _baseDir.hashCode();
+ }
}
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/resource/StringResourceSource.java b/ardor3d-core/src/main/java/com/ardor3d/util/resource/StringResourceSource.java
index 69a2339..e0c1432 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/resource/StringResourceSource.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/resource/StringResourceSource.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -60,6 +60,7 @@ public class StringResourceSource implements ResourceSource {
/**
* Returns "string resource" as strings have no name.
*/
+ @Override
public String getName() {
return "string resource";
}
@@ -67,6 +68,7 @@ public class StringResourceSource implements ResourceSource {
/**
* Returns null and logs a warning as this is not supported.
*/
+ @Override
public ResourceSource getRelativeSource(final String name) {
if (logger.isLoggable(Level.WARNING)) {
logger.logp(Level.WARNING, getClass().getName(), "getRelativeSource(String)",
@@ -75,6 +77,7 @@ public class StringResourceSource implements ResourceSource {
return null;
}
+ @Override
public String getType() {
return _type;
}
@@ -82,6 +85,7 @@ public class StringResourceSource implements ResourceSource {
/**
* Grabs our data as a UTF8 byte array and returns it in a ByteArrayInputStream.
*/
+ @Override
public InputStream openStream() throws IOException {
return new ByteArrayInputStream(_data.getBytes("UTF8"));
}
@@ -90,15 +94,18 @@ public class StringResourceSource implements ResourceSource {
// Methods for Savable
// /////////////////
+ @Override
public Class<?> getClassTag() {
return StringResourceSource.class;
}
+ @Override
public void read(final InputCapsule capsule) throws IOException {
_data = capsule.readString("data", null);
_type = capsule.readString("type", null);
}
+ @Override
public void write(final OutputCapsule capsule) throws IOException {
capsule.write(_data, "data", null);
capsule.write(_type, "type", null);
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/resource/URLResourceSource.java b/ardor3d-core/src/main/java/com/ardor3d/util/resource/URLResourceSource.java
index 9bcc3c0..ae1885c 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/resource/URLResourceSource.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/resource/URLResourceSource.java
@@ -1,9 +1,9 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* 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>.
*/
@@ -15,6 +15,7 @@ import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLDecoder;
+import java.util.Objects;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -38,7 +39,7 @@ public class URLResourceSource implements ResourceSource {
/**
* Construct a new URLResourceSource from a specific URL.
- *
+ *
* @param sourceUrl
* The url to load the resource from. Must not be null. If the URL has a valid URL filename (see
* {@link URL#getFile()}) and an extension (eg. http://url/myFile.png) then the extension (.png in this
@@ -62,7 +63,7 @@ public class URLResourceSource implements ResourceSource {
/**
* Construct a new URLResourceSource from a specific URL and type.
- *
+ *
* @param sourceUrl
* The url to load the resource from. Must not be null.
* @param type
@@ -76,6 +77,7 @@ public class URLResourceSource implements ResourceSource {
_type = type;
}
+ @Override
public ResourceSource getRelativeSource(final String name) {
try {
final URL srcURL = UrlUtils.resolveRelativeURL(_url, "./" + name);
@@ -106,10 +108,12 @@ public class URLResourceSource implements ResourceSource {
return _url;
}
+ @Override
public String getName() {
return _urlToString;
}
+ @Override
public String getType() {
return _type;
}
@@ -118,6 +122,7 @@ public class URLResourceSource implements ResourceSource {
_type = type;
}
+ @Override
public InputStream openStream() throws IOException {
return _url.openStream();
}
@@ -132,11 +137,7 @@ public class URLResourceSource implements ResourceSource {
@Override
public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((_type == null) ? 0 : _type.hashCode());
- result = prime * result + ((_urlToString == null) ? 0 : _urlToString.hashCode());
- return result;
+ return Objects.hash(getType(), getName());
}
@Override
@@ -168,10 +169,12 @@ public class URLResourceSource implements ResourceSource {
return true;
}
+ @Override
public Class<?> getClassTag() {
return URLResourceSource.class;
}
+ @Override
public void read(final InputCapsule capsule) throws IOException {
final String protocol = capsule.readString("protocol", null);
final String host = capsule.readString("host", null);
@@ -194,6 +197,7 @@ public class URLResourceSource implements ResourceSource {
_type = capsule.readString("type", null);
}
+ @Override
public void write(final OutputCapsule capsule) throws IOException {
capsule.write(_url.getProtocol(), "protocol", null);
capsule.write(_url.getHost(), "host", null);
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/scenegraph/CompileOptions.java b/ardor3d-core/src/main/java/com/ardor3d/util/scenegraph/CompileOptions.java
index 3f9af0e..7782137 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/scenegraph/CompileOptions.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/scenegraph/CompileOptions.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/scenegraph/DisplayListDelegate.java b/ardor3d-core/src/main/java/com/ardor3d/util/scenegraph/DisplayListDelegate.java
index b8f5680..64f569b 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/scenegraph/DisplayListDelegate.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/scenegraph/DisplayListDelegate.java
@@ -1,9 +1,9 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* 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>.
*/
@@ -12,6 +12,7 @@ package com.ardor3d.util.scenegraph;
import java.lang.ref.ReferenceQueue;
import java.util.Map;
+import java.util.WeakHashMap;
import com.ardor3d.renderer.ContextCleanListener;
import com.ardor3d.renderer.ContextManager;
@@ -22,20 +23,20 @@ import com.ardor3d.scenegraph.Spatial;
import com.ardor3d.util.GameTaskQueueManager;
import com.ardor3d.util.SimpleContextIdReference;
import com.google.common.collect.ArrayListMultimap;
-import com.google.common.collect.MapMaker;
import com.google.common.collect.Multimap;
public class DisplayListDelegate implements RenderDelegate {
- private static Map<DisplayListDelegate, Object> _identityCache = new MapMaker().weakKeys().makeMap();
+ private static Map<DisplayListDelegate, Object> _identityCache = new WeakHashMap<>();
private static final Object STATIC_REF = new Object();
- private static ReferenceQueue<DisplayListDelegate> _refQueue = new ReferenceQueue<DisplayListDelegate>();
+ private static ReferenceQueue<DisplayListDelegate> _refQueue = new ReferenceQueue<>();
static {
ContextManager.addContextCleanListener(new ContextCleanListener() {
+ @Override
public void cleanForContext(final RenderContext renderContext) {
- // TODO: Need a way to call back to the creator of the display list?
+ // TODO: Need a way to call back to the creator of the display list?
}
});
}
@@ -43,10 +44,11 @@ public class DisplayListDelegate implements RenderDelegate {
private final SimpleContextIdReference<DisplayListDelegate> _id;
public DisplayListDelegate(final int id, final Object glContext) {
- _id = new SimpleContextIdReference<DisplayListDelegate>(this, _refQueue, id, glContext);
+ _id = new SimpleContextIdReference<>(this, _refQueue, id, glContext);
_identityCache.put(this, STATIC_REF);
}
+ @Override
public void render(final Spatial spatial, final Renderer renderer) {
// do transforms
final boolean transformed = renderer.doTransforms(spatial.getWorldTransform());
@@ -118,6 +120,7 @@ public class DisplayListDelegate implements RenderDelegate {
else {
GameTaskQueueManager.getManager(ContextManager.getContextForRef(glref)).render(
new RendererCallable<Void>() {
+ @Override
public Void call() throws Exception {
getRenderer().deleteDisplayLists(idMap.get(glref));
return null;
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/scenegraph/RenderDelegate.java b/ardor3d-core/src/main/java/com/ardor3d/util/scenegraph/RenderDelegate.java
index 3b43e29..76597ee 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/scenegraph/RenderDelegate.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/scenegraph/RenderDelegate.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/scenegraph/SceneCompiler.java b/ardor3d-core/src/main/java/com/ardor3d/util/scenegraph/SceneCompiler.java
index 285806e..9b4d34b 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/scenegraph/SceneCompiler.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/scenegraph/SceneCompiler.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -75,6 +75,7 @@ public class SceneCompiler {
_renderer = renderer;
}
+ @Override
public void visit(final Spatial spatial) {
if (spatial instanceof Mesh) {
final Mesh mesh = (Mesh) spatial;
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/screen/ScreenExportable.java b/ardor3d-core/src/main/java/com/ardor3d/util/screen/ScreenExportable.java
index 2031798..3125ae2 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/screen/ScreenExportable.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/screen/ScreenExportable.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/screen/ScreenExporter.java b/ardor3d-core/src/main/java/com/ardor3d/util/screen/ScreenExporter.java
index 1b50d69..68545b5 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/screen/ScreenExporter.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/screen/ScreenExporter.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/shader/ShaderVariable.java b/ardor3d-core/src/main/java/com/ardor3d/util/shader/ShaderVariable.java
index a425753..bd88b4b 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/shader/ShaderVariable.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/shader/ShaderVariable.java
@@ -1,9 +1,9 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* 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>.
*/
@@ -11,6 +11,7 @@
package com.ardor3d.util.shader;
import java.io.IOException;
+import java.util.Objects;
import com.ardor3d.util.export.InputCapsule;
import com.ardor3d.util.export.OutputCapsule;
@@ -40,33 +41,53 @@ public class ShaderVariable implements Savable {
}
@Override
- public boolean equals(final Object o) {
- if (this == o) {
+ public int hashCode() {
+ return Objects.hash(name, Integer.valueOf(variableID));
+ }
+
+ @Override
+ public boolean equals(final Object obj) {
+ if (this == obj) {
return true;
}
- if (!(o instanceof ShaderVariable)) {
+ if (obj == null) {
return false;
}
- final ShaderVariable comp = (ShaderVariable) o;
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ final ShaderVariable other = (ShaderVariable) obj;
if (variableID != -1) {
- return comp.variableID == variableID;
- } else if (comp.variableID != -1) {
- return comp.variableID == variableID;
+ return other.variableID == variableID;
+ } else if (other.variableID != -1) {
+ return other.variableID == variableID;
} else {
- return (name.equals(comp.name));
+ return (equals(name, other.name));
}
}
+ // TODO replace it by java.util.Objects.equals(Object, Object)
+ private boolean equals(final Object a, final Object b) {
+ if (a == b) {
+ return true;
+ } else {
+ return a != null && a.equals(b);
+ }
+ }
+
+ @Override
public void write(final OutputCapsule capsule) throws IOException {
capsule.write(name, "name", "");
capsule.write(variableID, "variableID", -1);
}
+ @Override
public void read(final InputCapsule capsule) throws IOException {
name = capsule.readString("name", "");
variableID = capsule.readInt("variableID", -1);
}
+ @Override
public Class<? extends ShaderVariable> getClassTag() {
return this.getClass();
}
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableFloat.java b/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableFloat.java
index ea380fa..4c2de57 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableFloat.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableFloat.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableFloat2.java b/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableFloat2.java
index ff6f7b1..28a821c 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableFloat2.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableFloat2.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableFloat3.java b/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableFloat3.java
index 076f5de..e263986 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableFloat3.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableFloat3.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableFloat4.java b/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableFloat4.java
index 2aef387..02891ad 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableFloat4.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableFloat4.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableFloatArray.java b/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableFloatArray.java
index fbbd891..25193ef 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableFloatArray.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableFloatArray.java
@@ -1 +1 @@
-/** * Copyright (c) 2008-2012 Ardor Labs, Inc. * * This file is part of Ardor3D. * * 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>. */ package com.ardor3d.util.shader.uniformtypes; import java.io.IOException; import java.nio.FloatBuffer; import com.ardor3d.util.export.InputCapsule; import com.ardor3d.util.export.OutputCapsule; import com.ardor3d.util.shader.ShaderVariable; /** ShaderVariableFloatArray */ public class ShaderVariableFloatArray extends ShaderVariable { public FloatBuffer value; /** * Specifies the number of values for each element of the array. Must be 1, 2, 3, or 4. */ public int size = 1; @Override public boolean hasData() { return value != null; } @Override public void write(final OutputCapsule capsule) throws IOException { super.write(capsule); capsule.write(value, "value", null); capsule.write(size, "size", 1); } @Override public void read(final InputCapsule capsule) throws IOException { super.read(capsule); value = capsule.readFloatBuffer("value", null); size = capsule.readInt("size", 1); } } \ No newline at end of file
+/** * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * * 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>. */ package com.ardor3d.util.shader.uniformtypes; import java.io.IOException; import java.nio.FloatBuffer; import com.ardor3d.util.export.InputCapsule; import com.ardor3d.util.export.OutputCapsule; import com.ardor3d.util.shader.ShaderVariable; /** ShaderVariableFloatArray */ public class ShaderVariableFloatArray extends ShaderVariable { public FloatBuffer value; /** * Specifies the number of values for each element of the array. Must be 1, 2, 3, or 4. */ public int size = 1; @Override public boolean hasData() { return value != null; } @Override public void write(final OutputCapsule capsule) throws IOException { super.write(capsule); capsule.write(value, "value", null); capsule.write(size, "size", 1); } @Override public void read(final InputCapsule capsule) throws IOException { super.read(capsule); value = capsule.readFloatBuffer("value", null); size = capsule.readInt("size", 1); } } \ No newline at end of file
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableInt.java b/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableInt.java
index d3f09a9..021b22b 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableInt.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableInt.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableInt2.java b/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableInt2.java
index fc9e4ca..b9b00d3 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableInt2.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableInt2.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableInt3.java b/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableInt3.java
index ac859cd..665a02f 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableInt3.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableInt3.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableInt4.java b/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableInt4.java
index 52184bc..487423d 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableInt4.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableInt4.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableIntArray.java b/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableIntArray.java
index ca3f21b..9c85dfb 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableIntArray.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableIntArray.java
@@ -1 +1 @@
-/** * Copyright (c) 2008-2012 Ardor Labs, Inc. * * This file is part of Ardor3D. * * 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>. */ package com.ardor3d.util.shader.uniformtypes; import java.io.IOException; import java.nio.IntBuffer; import com.ardor3d.util.export.InputCapsule; import com.ardor3d.util.export.OutputCapsule; import com.ardor3d.util.shader.ShaderVariable; /** ShaderVariableIntArray */ public class ShaderVariableIntArray extends ShaderVariable { public IntBuffer value; /** * Specifies the number of values for each element of the array. Must be 1, 2, 3, or 4. */ public int size = 1; @Override public boolean hasData() { return value != null; } @Override public void write(final OutputCapsule capsule) throws IOException { super.write(capsule); capsule.write(value, "value", null); capsule.write(size, "size", 1); } @Override public void read(final InputCapsule capsule) throws IOException { super.read(capsule); value = capsule.readIntBuffer("value", null); size = capsule.readInt("size", 1); } } \ No newline at end of file
+/** * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * * 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>. */ package com.ardor3d.util.shader.uniformtypes; import java.io.IOException; import java.nio.IntBuffer; import com.ardor3d.util.export.InputCapsule; import com.ardor3d.util.export.OutputCapsule; import com.ardor3d.util.shader.ShaderVariable; /** ShaderVariableIntArray */ public class ShaderVariableIntArray extends ShaderVariable { public IntBuffer value; /** * Specifies the number of values for each element of the array. Must be 1, 2, 3, or 4. */ public int size = 1; @Override public boolean hasData() { return value != null; } @Override public void write(final OutputCapsule capsule) throws IOException { super.write(capsule); capsule.write(value, "value", null); capsule.write(size, "size", 1); } @Override public void read(final InputCapsule capsule) throws IOException { super.read(capsule); value = capsule.readIntBuffer("value", null); size = capsule.readInt("size", 1); } } \ No newline at end of file
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableMatrix2.java b/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableMatrix2.java
index 2727fad..66acda2 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableMatrix2.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableMatrix2.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableMatrix3.java b/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableMatrix3.java
index ab2320c..a3a74b6 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableMatrix3.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableMatrix3.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableMatrix4.java b/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableMatrix4.java
index eb2a4d0..486187f 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableMatrix4.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableMatrix4.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableMatrix4Array.java b/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableMatrix4Array.java
index a638270..a6d71bc 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableMatrix4Array.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariableMatrix4Array.java
@@ -1 +1 @@
-/** * Copyright (c) 2008-2012 Ardor Labs, Inc. * * This file is part of Ardor3D. * * 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>. */ package com.ardor3d.util.shader.uniformtypes; import java.io.IOException; import java.nio.FloatBuffer; import com.ardor3d.util.export.InputCapsule; import com.ardor3d.util.export.OutputCapsule; import com.ardor3d.util.shader.ShaderVariable; /** ShaderVariableMatrix4Array */ public class ShaderVariableMatrix4Array extends ShaderVariable { public FloatBuffer matrixBuffer; public boolean rowMajor; @Override public boolean hasData() { return matrixBuffer != null; } @Override public void write(final OutputCapsule capsule) throws IOException { super.write(capsule); capsule.write(matrixBuffer, "matrixBuffer", null); capsule.write(rowMajor, "rowMajor", false); } @Override public void read(final InputCapsule capsule) throws IOException { super.read(capsule); matrixBuffer = capsule.readFloatBuffer("matrixBuffer", null); rowMajor = capsule.readBoolean("rowMajor", false); } } \ No newline at end of file
+/** * Copyright (c) 2008-2014 Ardor Labs, Inc. * * This file is part of Ardor3D. * * 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>. */ package com.ardor3d.util.shader.uniformtypes; import java.io.IOException; import java.nio.FloatBuffer; import com.ardor3d.util.export.InputCapsule; import com.ardor3d.util.export.OutputCapsule; import com.ardor3d.util.shader.ShaderVariable; /** ShaderVariableMatrix4Array */ public class ShaderVariableMatrix4Array extends ShaderVariable { public FloatBuffer matrixBuffer; public boolean rowMajor; @Override public boolean hasData() { return matrixBuffer != null; } @Override public void write(final OutputCapsule capsule) throws IOException { super.write(capsule); capsule.write(matrixBuffer, "matrixBuffer", null); capsule.write(rowMajor, "rowMajor", false); } @Override public void read(final InputCapsule capsule) throws IOException { super.read(capsule); matrixBuffer = capsule.readFloatBuffer("matrixBuffer", null); rowMajor = capsule.readBoolean("rowMajor", false); } } \ No newline at end of file
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariablePointerByte.java b/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariablePointerByte.java
index 4c8e7bf..dda2961 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariablePointerByte.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariablePointerByte.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariablePointerFloat.java b/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariablePointerFloat.java
index 6da1c17..c5aa956 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariablePointerFloat.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariablePointerFloat.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariablePointerFloatMatrix.java b/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariablePointerFloatMatrix.java
index 6f5a5f7..8e3c802 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariablePointerFloatMatrix.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariablePointerFloatMatrix.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariablePointerInt.java b/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariablePointerInt.java
index eaa90cb..f835a7c 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariablePointerInt.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariablePointerInt.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariablePointerShort.java b/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariablePointerShort.java
index 48a0d37..3f901df 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariablePointerShort.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/shader/uniformtypes/ShaderVariablePointerShort.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/stat/MultiStatSample.java b/ardor3d-core/src/main/java/com/ardor3d/util/stat/MultiStatSample.java
index 1674c86..d3d6295 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/stat/MultiStatSample.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/stat/MultiStatSample.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -13,10 +13,8 @@ package com.ardor3d.util.stat;
import java.util.HashMap;
import java.util.Set;
-import com.google.common.collect.Maps;
-
public class MultiStatSample {
- private final HashMap<StatType, StatValue> _values = Maps.newHashMap();
+ private final HashMap<StatType, StatValue> _values = new HashMap<>();
private double _elapsedTime = 0.0;
public static MultiStatSample createNew(final HashMap<StatType, StatValue> current) {
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/stat/StatCollector.java b/ardor3d-core/src/main/java/com/ardor3d/util/stat/StatCollector.java
index 51e3432..52af43a 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/stat/StatCollector.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/stat/StatCollector.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -10,6 +10,7 @@
package com.ardor3d.util.stat;
+import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
@@ -19,7 +20,6 @@ import java.util.Stack;
import java.util.logging.Logger;
import com.ardor3d.util.Timer;
-import com.google.common.collect.Lists;
/**
* This class acts as a centralized data store for statistics. As data is added to the collector, a sum total is kept as
@@ -38,7 +38,7 @@ public abstract class StatCollector {
* Our map of current stat values. Current means values that have been collected within the current time sample. For
* example, if sampleRate = 1.0, then current will hold values collected since the last 1 second ping.
*/
- protected static HashMap<StatType, StatValue> current = new HashMap<StatType, StatValue>();
+ protected static HashMap<StatType, StatValue> current = new HashMap<>();
protected static List<MultiStatSample> historical = Collections.synchronizedList(new LinkedList<MultiStatSample>());
@@ -51,14 +51,14 @@ public abstract class StatCollector {
protected static double lastTimeCheckMS = 0;
- protected static List<StatListener> listeners = Lists.newArrayList();
+ protected static List<StatListener> listeners = new ArrayList<>();
protected static double startOffset = 0;
protected static boolean ignoreStats = false;
- protected static Stack<StatType> timeStatStack = new Stack<StatType>();
- protected static HashSet<StatType> timedStats = new HashSet<StatType>();
+ protected static Stack<StatType> timeStatStack = new Stack<>();
+ protected static HashSet<StatType> timedStats = new HashSet<>();
protected static Timer timer = new Timer();
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/stat/StatListener.java b/ardor3d-core/src/main/java/com/ardor3d/util/stat/StatListener.java
index 845b681..7818fa9 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/stat/StatListener.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/stat/StatListener.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/stat/StatType.java b/ardor3d-core/src/main/java/com/ardor3d/util/stat/StatType.java
index 2d4436f..6fba998 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/stat/StatType.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/stat/StatType.java
@@ -1,15 +1,17 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* 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>.
*/
package com.ardor3d.util.stat;
+import java.util.Objects;
+
public class StatType implements Comparable<StatType> {
public static final StatType STAT_FRAMES = new StatType("_frames");
@@ -56,10 +58,10 @@ public class StatType implements Comparable<StatType> {
@Override
public int hashCode() {
- final int hash = _statName.hashCode();
- return hash;
+ return Objects.hashCode(getStatName());
}
+ @Override
public int compareTo(final StatType obj) {
final StatType other = obj;
return _statName.compareTo(other._statName);
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/stat/StatValue.java b/ardor3d-core/src/main/java/com/ardor3d/util/stat/StatValue.java
index 6e748cf..591c849 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/stat/StatValue.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/stat/StatValue.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/stat/graph/AbstractStatGrapher.java b/ardor3d-core/src/main/java/com/ardor3d/util/stat/graph/AbstractStatGrapher.java
index 10dc3b9..5e901de 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/stat/graph/AbstractStatGrapher.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/stat/graph/AbstractStatGrapher.java
@@ -1,9 +1,9 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* 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>.
*/
@@ -31,14 +31,21 @@ public abstract class AbstractStatGrapher implements StatListener {
protected Texture2D _texture;
protected int _gWidth, _gHeight;
- protected TreeMap<StatType, HashMap<String, Object>> _config = new TreeMap<StatType, HashMap<String, Object>>();
+ protected TreeMap<StatType, HashMap<String, Object>> _config = new TreeMap<>();
protected boolean _enabled = true;
/**
* Must be constructed in the GL thread.
- *
- * @param factory
+ *
+ * @param width
+ * width
+ * @param height
+ * height
+ * @param renderer
+ * GL renderer
+ * @param caps
+ * context capabilities
*/
public AbstractStatGrapher(final int width, final int height, final Renderer renderer,
final ContextCapabilities caps) {
@@ -85,7 +92,7 @@ public abstract class AbstractStatGrapher implements StatListener {
public void addConfig(final StatType type, final String key, final Object value) {
HashMap<String, Object> vals = _config.get(type);
if (vals == null) {
- vals = new HashMap<String, Object>();
+ vals = new HashMap<>();
_config.put(type, vals);
}
vals.put(key, value);
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/stat/graph/DefColorFadeController.java b/ardor3d-core/src/main/java/com/ardor3d/util/stat/graph/DefColorFadeController.java
index c69b02f..6b12247 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/stat/graph/DefColorFadeController.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/stat/graph/DefColorFadeController.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -61,6 +61,7 @@ public class DefColorFadeController implements SpatialController<Spatial> {
_rate = rate;
}
+ @Override
public void update(final double time, final Spatial caller) {
if (_target == null) {
return;
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/stat/graph/GraphFactory.java b/ardor3d-core/src/main/java/com/ardor3d/util/stat/graph/GraphFactory.java
index a93c02e..949594d 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/stat/graph/GraphFactory.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/stat/graph/GraphFactory.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/stat/graph/LineGrapher.java b/ardor3d-core/src/main/java/com/ardor3d/util/stat/graph/LineGrapher.java
index 544b530..3d7943a 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/stat/graph/LineGrapher.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/stat/graph/LineGrapher.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -53,7 +53,7 @@ public class LineGrapher extends AbstractStatGrapher implements TableLinkable {
private static final int majorHBar = 20;
private static final int majorVBar = 10;
- private final HashMap<StatType, LineEntry> _entries = new HashMap<StatType, LineEntry>();
+ private final HashMap<StatType, LineEntry> _entries = new HashMap<>();
private BlendState _defBlendState = null;
@@ -72,6 +72,7 @@ public class LineGrapher extends AbstractStatGrapher implements TableLinkable {
_graphRoot.getSceneHints().setCullHint(CullHint.Never);
}
+ @Override
public void statsUpdated() {
if (!isEnabled() || !Constants.updateGraphs) {
return;
@@ -266,7 +267,7 @@ public class LineGrapher extends AbstractStatGrapher implements TableLinkable {
}
class LineEntry {
- public List<Vector3> verts = new ArrayList<Vector3>();
+ public List<Vector3> verts = new ArrayList<>();
public int maxSamples;
public double min = 0;
public double max = 10;
@@ -301,6 +302,7 @@ public class LineGrapher extends AbstractStatGrapher implements TableLinkable {
}
}
+ @Override
public Line updateLineKey(final StatType type, Line lineKey) {
if (lineKey == null) {
lineKey = new Line("lk", BufferUtils.createVector3Buffer(2), null, null, null);
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/stat/graph/TableLinkable.java b/ardor3d-core/src/main/java/com/ardor3d/util/stat/graph/TableLinkable.java
index 2cdd290..91ef72e 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/stat/graph/TableLinkable.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/stat/graph/TableLinkable.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/stat/graph/TabledLabelGrapher.java b/ardor3d-core/src/main/java/com/ardor3d/util/stat/graph/TabledLabelGrapher.java
index bd32181..82371f1 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/stat/graph/TabledLabelGrapher.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/stat/graph/TabledLabelGrapher.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -48,7 +48,7 @@ public class TabledLabelGrapher extends AbstractStatGrapher {
protected BlendState _defBlendState = null;
- private final HashMap<StatType, LabelEntry> _entries = new HashMap<StatType, LabelEntry>();
+ private final HashMap<StatType, LabelEntry> _entries = new HashMap<>();
private boolean _minimalBackground;
@@ -69,6 +69,7 @@ public class TabledLabelGrapher extends AbstractStatGrapher {
_graphRoot.getSceneHints().setCullHint(CullHint.Never);
}
+ @Override
public void statsUpdated() {
if (!isEnabled() || !Constants.updateGraphs) {
return;
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/stat/graph/TimedAreaGrapher.java b/ardor3d-core/src/main/java/com/ardor3d/util/stat/graph/TimedAreaGrapher.java
index bc336d5..0d6cfb6 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/stat/graph/TimedAreaGrapher.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/stat/graph/TimedAreaGrapher.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -53,7 +53,7 @@ public class TimedAreaGrapher extends AbstractStatGrapher implements TableLinkab
private static final int majorHBar = 20;
private static final int majorVBar = 10;
- private final HashMap<StatType, AreaEntry> _entries = new HashMap<StatType, AreaEntry>();
+ private final HashMap<StatType, AreaEntry> _entries = new HashMap<>();
private BlendState _defBlendState = null;
@@ -72,6 +72,7 @@ public class TimedAreaGrapher extends AbstractStatGrapher implements TableLinkab
_graphRoot.getSceneHints().setCullHint(CullHint.Never);
}
+ @Override
public void statsUpdated() {
if (!isEnabled() || !Constants.updateGraphs) {
return;
@@ -262,7 +263,7 @@ public class TimedAreaGrapher extends AbstractStatGrapher implements TableLinkab
}
class AreaEntry {
- public List<Vector3> verts = new ArrayList<Vector3>();
+ public List<Vector3> verts = new ArrayList<>();
public int maxSamples;
public boolean visited;
public Mesh area;
@@ -282,6 +283,7 @@ public class TimedAreaGrapher extends AbstractStatGrapher implements TableLinkab
}
}
+ @Override
public Line updateLineKey(final StatType type, Line lineKey) {
if (lineKey == null) {
lineKey = new Line("lk", BufferUtils.createVector3Buffer(2), null, null, null);
diff --git a/ardor3d-core/src/test/java/com/ardor3d/bounding/TestBounding.java b/ardor3d-core/src/test/java/com/ardor3d/bounding/TestBounding.java
index 5a9fbab..3201975 100644
--- a/ardor3d-core/src/test/java/com/ardor3d/bounding/TestBounding.java
+++ b/ardor3d-core/src/test/java/com/ardor3d/bounding/TestBounding.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/test/java/com/ardor3d/bounding/TestRayBounding.java b/ardor3d-core/src/test/java/com/ardor3d/bounding/TestRayBounding.java
index 9c28b6c..2db251d 100644
--- a/ardor3d-core/src/test/java/com/ardor3d/bounding/TestRayBounding.java
+++ b/ardor3d-core/src/test/java/com/ardor3d/bounding/TestRayBounding.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/test/java/com/ardor3d/input/TestKeyboardState.java b/ardor3d-core/src/test/java/com/ardor3d/input/TestKeyboardState.java
index b5b40e8..eafd591 100644
--- a/ardor3d-core/src/test/java/com/ardor3d/input/TestKeyboardState.java
+++ b/ardor3d-core/src/test/java/com/ardor3d/input/TestKeyboardState.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/test/java/com/ardor3d/input/TestPhysicalLayer.java b/ardor3d-core/src/test/java/com/ardor3d/input/TestPhysicalLayer.java
index cc0dbb8..002fb97 100644
--- a/ardor3d-core/src/test/java/com/ardor3d/input/TestPhysicalLayer.java
+++ b/ardor3d-core/src/test/java/com/ardor3d/input/TestPhysicalLayer.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -38,15 +38,15 @@ public class TestPhysicalLayer {
Object[] mocks;
- List<KeyEvent> noKeys = new LinkedList<KeyEvent>();
- List<KeyEvent> Adown = new LinkedList<KeyEvent>();
- List<KeyEvent> AdownBdown = new LinkedList<KeyEvent>();
- List<KeyEvent> AdownAup = new LinkedList<KeyEvent>();
+ List<KeyEvent> noKeys = new LinkedList<>();
+ List<KeyEvent> Adown = new LinkedList<>();
+ List<KeyEvent> AdownBdown = new LinkedList<>();
+ List<KeyEvent> AdownAup = new LinkedList<>();
- List<ControllerEvent> nothing = new LinkedList<ControllerEvent>();
+ List<ControllerEvent> nothing = new LinkedList<>();
- List<MouseState> buttonDown = new LinkedList<MouseState>();
- List<MouseState> noMice = new LinkedList<MouseState>();
+ List<MouseState> buttonDown = new LinkedList<>();
+ List<MouseState> noMice = new LinkedList<>();
List<InputState> inputStates;
InputState is;
diff --git a/ardor3d-core/src/test/java/com/ardor3d/input/logical/TestLogicalLayer.java b/ardor3d-core/src/test/java/com/ardor3d/input/logical/TestLogicalLayer.java
index dc13728..3ae0237 100644
--- a/ardor3d-core/src/test/java/com/ardor3d/input/logical/TestLogicalLayer.java
+++ b/ardor3d-core/src/test/java/com/ardor3d/input/logical/TestLogicalLayer.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -91,8 +91,8 @@ public class TestLogicalLayer {
final double tpf = 14;
- final LinkedList<InputState> states1 = new LinkedList<InputState>();
- final LinkedList<InputState> states2 = new LinkedList<InputState>();
+ final LinkedList<InputState> states1 = new LinkedList<>();
+ final LinkedList<InputState> states2 = new LinkedList<>();
states1.add(state1);
states2.add(state2);
@@ -120,8 +120,8 @@ public class TestLogicalLayer {
final double tpf = 14;
- final LinkedList<InputState> states1 = new LinkedList<InputState>();
- final LinkedList<InputState> states2 = new LinkedList<InputState>();
+ final LinkedList<InputState> states1 = new LinkedList<>();
+ final LinkedList<InputState> states2 = new LinkedList<>();
states1.add(state1);
states2.add(state2);
@@ -154,8 +154,8 @@ public class TestLogicalLayer {
final double tpf = 14;
- final LinkedList<InputState> states1 = new LinkedList<InputState>();
- final LinkedList<InputState> states2 = new LinkedList<InputState>();
+ final LinkedList<InputState> states1 = new LinkedList<>();
+ final LinkedList<InputState> states2 = new LinkedList<>();
states1.add(state1);
states2.add(state2);
@@ -188,8 +188,8 @@ public class TestLogicalLayer {
final double tpf = 14;
- final LinkedList<InputState> states1 = new LinkedList<InputState>();
- final LinkedList<InputState> states2 = new LinkedList<InputState>();
+ final LinkedList<InputState> states1 = new LinkedList<>();
+ final LinkedList<InputState> states2 = new LinkedList<>();
states1.add(state1);
@@ -223,8 +223,8 @@ public class TestLogicalLayer {
final double tpf = 14;
- final LinkedList<InputState> states1 = new LinkedList<InputState>();
- final LinkedList<InputState> states2 = new LinkedList<InputState>();
+ final LinkedList<InputState> states1 = new LinkedList<>();
+ final LinkedList<InputState> states2 = new LinkedList<>();
states1.add(state1);
states2.add(InputState.LOST_FOCUS);
diff --git a/ardor3d-core/src/test/java/com/ardor3d/input/logical/TestStandardConditions.java b/ardor3d-core/src/test/java/com/ardor3d/input/logical/TestStandardConditions.java
index 2fde296..b9350a2 100644
--- a/ardor3d-core/src/test/java/com/ardor3d/input/logical/TestStandardConditions.java
+++ b/ardor3d-core/src/test/java/com/ardor3d/input/logical/TestStandardConditions.java
@@ -1,21 +1,19 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* 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>.
*/
package com.ardor3d.input.logical;
-import static junit.framework.Assert.assertFalse;
-import static junit.framework.Assert.assertTrue;
-
import java.util.EnumMap;
import java.util.EnumSet;
+import org.junit.Assert;
import org.junit.Test;
import com.ardor3d.input.ButtonState;
@@ -29,8 +27,8 @@ import com.ardor3d.input.MouseState;
public class TestStandardConditions {
final KeyboardState ks = new KeyboardState(EnumSet.noneOf(Key.class), KeyEvent.NOTHING);
- final MouseState ms = new MouseState(0, 0, 0, 0, 0, MouseButton.makeMap(ButtonState.UP, ButtonState.UP,
- ButtonState.UP), null);
+ final MouseState ms = new MouseState(0, 0, 0, 0, 0,
+ MouseButton.makeMap(ButtonState.UP, ButtonState.UP, ButtonState.UP), null);
final ControllerState cs = new ControllerState();
InputState is1, is2, is3, is4, is5;
@@ -40,8 +38,8 @@ public class TestStandardConditions {
EnumMap<MouseButton, ButtonState> bothUp = MouseButton.makeMap(ButtonState.UP, ButtonState.UP, ButtonState.UP);
EnumMap<MouseButton, ButtonState> upDown = MouseButton.makeMap(ButtonState.UP, ButtonState.DOWN, ButtonState.UP);
EnumMap<MouseButton, ButtonState> downUp = MouseButton.makeMap(ButtonState.DOWN, ButtonState.UP, ButtonState.UP);
- EnumMap<MouseButton, ButtonState> bothDown = MouseButton
- .makeMap(ButtonState.DOWN, ButtonState.DOWN, ButtonState.UP);
+ EnumMap<MouseButton, ButtonState> bothDown = MouseButton.makeMap(ButtonState.DOWN, ButtonState.DOWN,
+ ButtonState.UP);
@Test
public void testKeyHeld1() throws Exception {
@@ -51,16 +49,16 @@ public class TestStandardConditions {
is2 = new InputState(aDown, ms, cs);
is3 = new InputState(bDown, ms, cs);
- assertFalse("not down", kh.apply(new TwoInputStates(is1, is1)));
- assertTrue("down", kh.apply(new TwoInputStates(is1, is2)));
- assertFalse("not down", kh.apply(new TwoInputStates(is1, is3)));
- assertFalse("not down", kh.apply(new TwoInputStates(is2, is3)));
- assertTrue("not down", kh.apply(new TwoInputStates(is2, is2)));
+ Assert.assertFalse("not down", kh.apply(new TwoInputStates(is1, is1)));
+ Assert.assertTrue("down", kh.apply(new TwoInputStates(is1, is2)));
+ Assert.assertFalse("not down", kh.apply(new TwoInputStates(is1, is3)));
+ Assert.assertFalse("not down", kh.apply(new TwoInputStates(is2, is3)));
+ Assert.assertTrue("not down", kh.apply(new TwoInputStates(is2, is2)));
- assertFalse("empty1", kh.apply(new TwoInputStates(InputState.EMPTY, InputState.EMPTY)));
- assertFalse("empty2", kh.apply(new TwoInputStates(is1, InputState.EMPTY)));
- assertFalse("empty3", kh.apply(new TwoInputStates(InputState.EMPTY, is1)));
- assertTrue("empty4", kh.apply(new TwoInputStates(InputState.EMPTY, is2)));
+ Assert.assertFalse("empty1", kh.apply(new TwoInputStates(InputState.EMPTY, InputState.EMPTY)));
+ Assert.assertFalse("empty2", kh.apply(new TwoInputStates(is1, InputState.EMPTY)));
+ Assert.assertFalse("empty3", kh.apply(new TwoInputStates(InputState.EMPTY, is1)));
+ Assert.assertTrue("empty4", kh.apply(new TwoInputStates(InputState.EMPTY, is2)));
}
@Test(expected = NullPointerException.class)
@@ -76,16 +74,16 @@ public class TestStandardConditions {
is2 = new InputState(aDown, ms, cs);
is3 = new InputState(bDown, ms, cs);
- assertFalse("not down", kh.apply(new TwoInputStates(is1, is1)));
- assertTrue("down", kh.apply(new TwoInputStates(is1, is2)));
- assertFalse("not down", kh.apply(new TwoInputStates(is1, is3)));
- assertFalse("not down", kh.apply(new TwoInputStates(is2, is3)));
- assertFalse("not down", kh.apply(new TwoInputStates(is2, is2)));
+ Assert.assertFalse("not down", kh.apply(new TwoInputStates(is1, is1)));
+ Assert.assertTrue("down", kh.apply(new TwoInputStates(is1, is2)));
+ Assert.assertFalse("not down", kh.apply(new TwoInputStates(is1, is3)));
+ Assert.assertFalse("not down", kh.apply(new TwoInputStates(is2, is3)));
+ Assert.assertFalse("not down", kh.apply(new TwoInputStates(is2, is2)));
- assertFalse("empty1", kh.apply(new TwoInputStates(InputState.EMPTY, InputState.EMPTY)));
- assertFalse("empty2", kh.apply(new TwoInputStates(is1, InputState.EMPTY)));
- assertFalse("empty3", kh.apply(new TwoInputStates(InputState.EMPTY, is1)));
- assertTrue("empty4", kh.apply(new TwoInputStates(InputState.EMPTY, is2)));
+ Assert.assertFalse("empty1", kh.apply(new TwoInputStates(InputState.EMPTY, InputState.EMPTY)));
+ Assert.assertFalse("empty2", kh.apply(new TwoInputStates(is1, InputState.EMPTY)));
+ Assert.assertFalse("empty3", kh.apply(new TwoInputStates(InputState.EMPTY, is1)));
+ Assert.assertTrue("empty4", kh.apply(new TwoInputStates(InputState.EMPTY, is2)));
}
@Test(expected = NullPointerException.class)
@@ -101,16 +99,16 @@ public class TestStandardConditions {
is2 = new InputState(aDown, ms, cs);
is3 = new InputState(bDown, ms, cs);
- assertFalse("not down", kh.apply(new TwoInputStates(is1, is1)));
- assertFalse("not down", kh.apply(new TwoInputStates(is1, is2)));
- assertFalse("not down", kh.apply(new TwoInputStates(is1, is3)));
- assertTrue("not down", kh.apply(new TwoInputStates(is2, is3)));
- assertFalse("not down", kh.apply(new TwoInputStates(is2, is2)));
+ Assert.assertFalse("not down", kh.apply(new TwoInputStates(is1, is1)));
+ Assert.assertFalse("not down", kh.apply(new TwoInputStates(is1, is2)));
+ Assert.assertFalse("not down", kh.apply(new TwoInputStates(is1, is3)));
+ Assert.assertTrue("not down", kh.apply(new TwoInputStates(is2, is3)));
+ Assert.assertFalse("not down", kh.apply(new TwoInputStates(is2, is2)));
- assertFalse("empty1", kh.apply(new TwoInputStates(InputState.EMPTY, InputState.EMPTY)));
- assertFalse("empty2", kh.apply(new TwoInputStates(is1, InputState.EMPTY)));
- assertFalse("empty3", kh.apply(new TwoInputStates(InputState.EMPTY, is1)));
- assertFalse("empty4", kh.apply(new TwoInputStates(InputState.EMPTY, is2)));
+ Assert.assertFalse("empty1", kh.apply(new TwoInputStates(InputState.EMPTY, InputState.EMPTY)));
+ Assert.assertFalse("empty2", kh.apply(new TwoInputStates(is1, InputState.EMPTY)));
+ Assert.assertFalse("empty3", kh.apply(new TwoInputStates(InputState.EMPTY, is1)));
+ Assert.assertFalse("empty4", kh.apply(new TwoInputStates(InputState.EMPTY, is2)));
}
@Test(expected = NullPointerException.class)
@@ -133,17 +131,17 @@ public class TestStandardConditions {
is4 = new InputState(ks, ms4, cs);
is5 = new InputState(ks, ms5, cs);
- assertFalse("mm1", mm.apply(new TwoInputStates(is1, is1)));
- assertTrue("mm2", mm.apply(new TwoInputStates(is1, is2)));
- assertFalse("mm3", mm.apply(new TwoInputStates(is2, is3)));
- assertTrue("mm4", mm.apply(new TwoInputStates(is3, is4)));
- assertTrue("mm5", mm.apply(new TwoInputStates(is4, is5)));
- assertFalse("mm6", mm.apply(new TwoInputStates(is2, is2)));
-
- assertFalse("empty1", mm.apply(new TwoInputStates(InputState.EMPTY, InputState.EMPTY)));
- assertFalse("empty2", mm.apply(new TwoInputStates(is1, InputState.EMPTY)));
- assertFalse("empty3", mm.apply(new TwoInputStates(InputState.EMPTY, is1)));
- assertTrue("empty4", mm.apply(new TwoInputStates(InputState.EMPTY, is2)));
+ Assert.assertFalse("mm1", mm.apply(new TwoInputStates(is1, is1)));
+ Assert.assertTrue("mm2", mm.apply(new TwoInputStates(is1, is2)));
+ Assert.assertFalse("mm3", mm.apply(new TwoInputStates(is2, is3)));
+ Assert.assertTrue("mm4", mm.apply(new TwoInputStates(is3, is4)));
+ Assert.assertTrue("mm5", mm.apply(new TwoInputStates(is4, is5)));
+ Assert.assertFalse("mm6", mm.apply(new TwoInputStates(is2, is2)));
+
+ Assert.assertFalse("empty1", mm.apply(new TwoInputStates(InputState.EMPTY, InputState.EMPTY)));
+ Assert.assertFalse("empty2", mm.apply(new TwoInputStates(is1, InputState.EMPTY)));
+ Assert.assertFalse("empty3", mm.apply(new TwoInputStates(InputState.EMPTY, is1)));
+ Assert.assertTrue("empty4", mm.apply(new TwoInputStates(InputState.EMPTY, is2)));
}
@Test
@@ -161,16 +159,16 @@ public class TestStandardConditions {
is4 = new InputState(ks, ms4, cs);
is5 = new InputState(ks, ms5, cs);
- assertFalse("mm1", mm.apply(new TwoInputStates(is1, is1)));
- assertFalse("mm2", mm.apply(new TwoInputStates(is1, is2)));
- assertTrue("mm3", mm.apply(new TwoInputStates(is2, is3)));
- assertFalse("mm4", mm.apply(new TwoInputStates(is3, is4)));
- assertTrue("mm5", mm.apply(new TwoInputStates(is4, is5)));
+ Assert.assertFalse("mm1", mm.apply(new TwoInputStates(is1, is1)));
+ Assert.assertFalse("mm2", mm.apply(new TwoInputStates(is1, is2)));
+ Assert.assertTrue("mm3", mm.apply(new TwoInputStates(is2, is3)));
+ Assert.assertFalse("mm4", mm.apply(new TwoInputStates(is3, is4)));
+ Assert.assertTrue("mm5", mm.apply(new TwoInputStates(is4, is5)));
- assertFalse("empty1", mm.apply(new TwoInputStates(InputState.EMPTY, InputState.EMPTY)));
- assertFalse("empty2", mm.apply(new TwoInputStates(is1, InputState.EMPTY)));
- assertFalse("empty3", mm.apply(new TwoInputStates(InputState.EMPTY, is1)));
- assertTrue("empty4", mm.apply(new TwoInputStates(InputState.EMPTY, is3)));
+ Assert.assertFalse("empty1", mm.apply(new TwoInputStates(InputState.EMPTY, InputState.EMPTY)));
+ Assert.assertFalse("empty2", mm.apply(new TwoInputStates(is1, InputState.EMPTY)));
+ Assert.assertFalse("empty3", mm.apply(new TwoInputStates(InputState.EMPTY, is1)));
+ Assert.assertTrue("empty4", mm.apply(new TwoInputStates(InputState.EMPTY, is3)));
}
@Test
@@ -188,15 +186,15 @@ public class TestStandardConditions {
is4 = new InputState(ks, ms4, cs);
is5 = new InputState(ks, ms5, cs);
- assertFalse("mm1", mm.apply(new TwoInputStates(is1, is1)));
- assertFalse("mm2", mm.apply(new TwoInputStates(is1, is2)));
- assertTrue("mm3", mm.apply(new TwoInputStates(is2, is3)));
- assertTrue("mm4", mm.apply(new TwoInputStates(is3, is4)));
- assertFalse("mm5", mm.apply(new TwoInputStates(is4, is5)));
+ Assert.assertFalse("mm1", mm.apply(new TwoInputStates(is1, is1)));
+ Assert.assertFalse("mm2", mm.apply(new TwoInputStates(is1, is2)));
+ Assert.assertTrue("mm3", mm.apply(new TwoInputStates(is2, is3)));
+ Assert.assertTrue("mm4", mm.apply(new TwoInputStates(is3, is4)));
+ Assert.assertFalse("mm5", mm.apply(new TwoInputStates(is4, is5)));
- assertFalse("empty1", mm.apply(new TwoInputStates(InputState.EMPTY, InputState.EMPTY)));
- assertFalse("empty2", mm.apply(new TwoInputStates(is1, InputState.EMPTY)));
- assertFalse("empty3", mm.apply(new TwoInputStates(InputState.EMPTY, is1)));
- assertTrue("empty4", mm.apply(new TwoInputStates(InputState.EMPTY, is3)));
+ Assert.assertFalse("empty1", mm.apply(new TwoInputStates(InputState.EMPTY, InputState.EMPTY)));
+ Assert.assertFalse("empty2", mm.apply(new TwoInputStates(is1, InputState.EMPTY)));
+ Assert.assertFalse("empty3", mm.apply(new TwoInputStates(InputState.EMPTY, is1)));
+ Assert.assertTrue("empty4", mm.apply(new TwoInputStates(InputState.EMPTY, is3)));
}
}
diff --git a/ardor3d-core/src/test/java/com/ardor3d/renderer/queue/RenderBucketTypeTest.java b/ardor3d-core/src/test/java/com/ardor3d/renderer/queue/RenderBucketTypeTest.java
index 93e0786..8faf1c7 100644
--- a/ardor3d-core/src/test/java/com/ardor3d/renderer/queue/RenderBucketTypeTest.java
+++ b/ardor3d-core/src/test/java/com/ardor3d/renderer/queue/RenderBucketTypeTest.java
@@ -1,38 +1,39 @@
-package com.ardor3d.renderer.queue;
-import org.junit.Test;
+package com.ardor3d.renderer.queue;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.fail;
+import org.junit.Test;
+
public class RenderBucketTypeTest {
- @Test
- public void getPrebucket() throws Exception {
- RenderBucketType preBucket = RenderBucketType.getRenderBucketType("PreBucket");
- assertNotNull(preBucket);
-
- RenderBucketType preBucket2 = RenderBucketType.getRenderBucketType("PreBucket");
- assertSame(preBucket, preBucket2);
- assertSame(RenderBucketType.PreBucket, preBucket);
- }
-
- @Test
- public void getUserDefined() throws Exception {
- RenderBucketType myBucket = RenderBucketType.getRenderBucketType("MyBucket");
- assertNotNull(myBucket);
-
- RenderBucketType myBucket2 = RenderBucketType.getRenderBucketType("MyBucket");
- assertSame(myBucket, myBucket2);
- }
-
- @Test
- public void getWithNull() throws Exception {
- try {
- RenderBucketType nullBucket = RenderBucketType.getRenderBucketType(null);
- fail();
- } catch (IllegalArgumentException e) {
- }
- }
+ @Test
+ public void getPrebucket() throws Exception {
+ final RenderBucketType preBucket = RenderBucketType.getRenderBucketType("PreBucket");
+ assertNotNull(preBucket);
+
+ final RenderBucketType preBucket2 = RenderBucketType.getRenderBucketType("PreBucket");
+ assertSame(preBucket, preBucket2);
+ assertSame(RenderBucketType.PreBucket, preBucket);
+ }
+
+ @Test
+ public void getUserDefined() throws Exception {
+ final RenderBucketType myBucket = RenderBucketType.getRenderBucketType("MyBucket");
+ assertNotNull(myBucket);
+
+ final RenderBucketType myBucket2 = RenderBucketType.getRenderBucketType("MyBucket");
+ assertSame(myBucket, myBucket2);
+ }
+
+ @Test
+ public void getWithNull() throws Exception {
+ try {
+ RenderBucketType.getRenderBucketType(null);
+ fail();
+ } catch (final IllegalArgumentException e) {
+ }
+ }
}
diff --git a/ardor3d-core/src/test/java/com/ardor3d/util/MockInputStream.java b/ardor3d-core/src/test/java/com/ardor3d/util/MockInputStream.java
index c0525b4..e6f1050 100644
--- a/ardor3d-core/src/test/java/com/ardor3d/util/MockInputStream.java
+++ b/ardor3d-core/src/test/java/com/ardor3d/util/MockInputStream.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
diff --git a/ardor3d-core/src/test/java/com/ardor3d/util/TestLittleEndianDataInput.java b/ardor3d-core/src/test/java/com/ardor3d/util/TestLittleEndianDataInput.java
index b779190..dd94e56 100644
--- a/ardor3d-core/src/test/java/com/ardor3d/util/TestLittleEndianDataInput.java
+++ b/ardor3d-core/src/test/java/com/ardor3d/util/TestLittleEndianDataInput.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*
@@ -20,17 +20,15 @@ import org.junit.Before;
import org.junit.Test;
/**
- * These tests are fairly brittle, since they rely on the implementation of BufferedInputStream.
- * It is necessary for the bytes available to always be larger than the buffer size of the buffered
- * input stream for the tests to work. This size is currently 8192, but if it changes, or if the
- * implementation changes, these tests can break.
+ * These tests are fairly brittle, since they rely on the implementation of BufferedInputStream. It is necessary for the
+ * bytes available to always be larger than the buffer size of the buffered input stream for the tests to work. This
+ * size is currently 8192, but if it changes, or if the implementation changes, these tests can break.
*/
public class TestLittleEndianDataInput {
MockInputStream in;
byte[] array;
LittleEndianDataInput littleEndien;
-
@Before
public void setup() throws Exception {
in = new MockInputStream();
@@ -40,7 +38,6 @@ public class TestLittleEndianDataInput {
littleEndien = new LittleEndianDataInput(in);
}
-
@Test
public void testReadFully1() throws Exception {
in.addBytesAvailable(11111);
@@ -53,7 +50,7 @@ public class TestLittleEndianDataInput {
@Test
public void testReadFully2() throws Exception {
in.addBytesAvailable(11240);
-
+
littleEndien.readFully(array, 0, 4);
// not caring about whether the bytes were actually copied successfully in this test
@@ -63,11 +60,12 @@ public class TestLittleEndianDataInput {
public void testReadFully3() throws Exception {
array = new byte[30003];
- Thread testThread = new Thread(new Runnable() {
+ final Thread testThread = new Thread(new Runnable() {
+ @Override
public void run() {
try {
littleEndien.readFully(array);
- } catch (IOException e) {
+ } catch (final IOException e) {
e.printStackTrace();
fail("ioexception");
}
@@ -92,7 +90,7 @@ public class TestLittleEndianDataInput {
// not caring about whether the bytes were actually copied successfully in this test
}
- @Test (expected = EOFException.class)
+ @Test(expected = EOFException.class)
public void testReadFully4() throws Exception {
in.setEof(true);
diff --git a/ardor3d-core/src/test/java/com/ardor3d/util/TestLittleEndianRandomAccessDataInput.java b/ardor3d-core/src/test/java/com/ardor3d/util/TestLittleEndianRandomAccessDataInput.java
index dee87f2..24002f1 100644
--- a/ardor3d-core/src/test/java/com/ardor3d/util/TestLittleEndianRandomAccessDataInput.java
+++ b/ardor3d-core/src/test/java/com/ardor3d/util/TestLittleEndianRandomAccessDataInput.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008-2012 Ardor Labs, Inc.
+ * Copyright (c) 2008-2014 Ardor Labs, Inc.
*
* This file is part of Ardor3D.
*