From 7dd3d52e9ecfd51ef6a5ba5605ad7e8fdd1e13e6 Mon Sep 17 00:00:00 2001 From: "sha..rd" Date: Thu, 14 Apr 2011 03:19:11 +0000 Subject: [PATCH] * Removed many deprecated methods and classes * Fixed various small issues detected by code analyzer git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7240 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- .../com/jme3/audio/QueuedAudioRenderer.java | 189 ------------------ .../src/core/com/jme3/material/MatParam.java | 8 + .../jme3/renderer/queue/OpaqueComparator.java | 5 +- .../com/jme3/renderer/queue/RenderQueue.java | 2 + engine/src/core/com/jme3/scene/Mesh.java | 7 + .../com/jme3/scene/control/CameraControl.java | 23 --- .../jme3/scene/mesh/VirtualIndexBuffer.java | 2 + .../core/com/jme3/scene/shape/Cylinder.java | 25 --- engine/src/core/com/jme3/shader/Uniform.java | 3 + engine/src/core/com/jme3/texture/Image.java | 14 ++ engine/src/core/com/jme3/texture/Texture.java | 105 ++++------ .../src/core/com/jme3/texture/Texture2D.java | 13 +- .../core/com/jme3/texture/TextureCubeMap.java | 10 +- .../com/jme3/post/filters/BloomFilter.java | 39 +--- .../com/jme3/shadow/PssmShadowRenderer.java | 51 ----- .../desktop/com/jme3/system/JmeSystem.java | 5 - .../jme3/renderer/lwjgl/LwjglGL1Renderer.java | 32 +++ .../jme3tools/navigation/Coordinate.java | 1 + .../jme3tools/navigation/NavCalculator.java | 2 + 19 files changed, 135 insertions(+), 401 deletions(-) delete mode 100644 engine/src/core/com/jme3/audio/QueuedAudioRenderer.java diff --git a/engine/src/core/com/jme3/audio/QueuedAudioRenderer.java b/engine/src/core/com/jme3/audio/QueuedAudioRenderer.java deleted file mode 100644 index 1e6121700..000000000 --- a/engine/src/core/com/jme3/audio/QueuedAudioRenderer.java +++ /dev/null @@ -1,189 +0,0 @@ -/* - * Copyright (c) 2009-2010 jMonkeyEngine - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of 'jMonkeyEngine' nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -package com.jme3.audio; - -import java.util.Arrays; -import java.util.LinkedList; -import java.util.Queue; - -@Deprecated -public class QueuedAudioRenderer implements AudioRenderer, Runnable { - - private static final float UPDATE_RATE = 0.01f; - - private AudioRenderer wrapped; - private final Thread thread = new Thread(this, "jME3 Audio Thread"); - private final Queue commandQueue = new LinkedList(); - - public void updateListenerParam(Listener listener, ListenerParam param) { - } - - private enum CmdType { - Cleanup, - SetListenerParams, - SetEnvParams, - PlaySourceInstance, - PlaySource, - PauseSource, - StopSource, - } - - private static class Command { - - private CmdType type; - private Object[] args; - - public Command(CmdType type, Object ... args) { - this.type = type; - this.args = args; - } - - } - - public QueuedAudioRenderer(AudioRenderer toWrap){ - wrapped = toWrap; - } - - public void run(){ - wrapped.initialize(); - long updateRateNanos = (long) (UPDATE_RATE * 1000000000); - mainloop: while (true){ - long startTime = System.nanoTime(); - - // execute commands and update - synchronized (thread){ - while (commandQueue.size() > 0){ - Command cmd = commandQueue.remove(); - if (cmd.type == CmdType.Cleanup) - break mainloop; - - executeCommand(cmd); - } - } - wrapped.update(UPDATE_RATE); - - long endTime = System.nanoTime(); - long diffTime = endTime - startTime; - - if (diffTime < updateRateNanos){ - long desiredEndTime = startTime + updateRateNanos; - while (System.nanoTime() < desiredEndTime){ - try{ - Thread.sleep(1); - }catch (InterruptedException ex){ - } - } - } - } - commandQueue.clear(); - wrapped.cleanup(); - } - - private void enqueueCommand(Command cmd){ - synchronized (thread){ - commandQueue.add(cmd); - } - } - - public void initialize(){ - if (!thread.isAlive()){ - thread.setDaemon(true); - thread.setPriority(Thread.NORM_PRIORITY+1); - thread.start(); - }else{ - throw new IllegalStateException("Initialize already called"); - } - } - - public void cleanup(){ - if (thread.isAlive()){ - enqueueCommand(new Command(CmdType.Cleanup, (Object)null )); - }else{ - throw new IllegalStateException("Already cleaned up or not initialized"); - } - } - - private void executeCommand(Command cmd){ - System.out.println("-> " + cmd.type + Arrays.toString(cmd.args)); - switch (cmd.type){ - case SetListenerParams: - wrapped.setListener( (Listener) cmd.args[0]); - break; - case PlaySource: - wrapped.playSource( (AudioNode) cmd.args[0] ); - break; - case PauseSource: - wrapped.pauseSource( (AudioNode) cmd.args[0] ); - break; - case StopSource: - wrapped.stopSource( (AudioNode) cmd.args[0] ); - break; - } - } - - public void updateSourceParam(AudioNode node, AudioParam param){ - - } - - public void setListener(Listener listener){ - enqueueCommand(new Command(CmdType.SetListenerParams, new Listener(listener))); - } - - public void setEnvironment(Environment env){ - enqueueCommand(new Command(CmdType.SetEnvParams, new Environment(env))); - } - - public void playSourceInstance(AudioNode src){ - enqueueCommand(new Command(CmdType.PlaySourceInstance, src)); - } - - public void playSource(AudioNode src){ - enqueueCommand(new Command(CmdType.PlaySource, src)); - } - - public void pauseSource(AudioNode src){ - enqueueCommand(new Command(CmdType.PauseSource, src)); - } - - public void stopSource(AudioNode src){ - enqueueCommand(new Command(CmdType.StopSource, src)); - } - - public void deleteAudioData(AudioData ad){ - } - - public void update(float tpf){ - // do nothing. updated in thread. - } - -} diff --git a/engine/src/core/com/jme3/material/MatParam.java b/engine/src/core/com/jme3/material/MatParam.java index 127f2809b..8dd89a19b 100644 --- a/engine/src/core/com/jme3/material/MatParam.java +++ b/engine/src/core/com/jme3/material/MatParam.java @@ -213,6 +213,14 @@ public class MatParam implements Savable, Cloneable { otherParam.name.equals(name); } + @Override + public int hashCode() { + int hash = 5; + hash = 17 * hash + (this.type != null ? this.type.hashCode() : 0); + hash = 17 * hash + (this.name != null ? this.name.hashCode() : 0); + return hash; + } + @Override public String toString(){ return type.name()+" "+name; diff --git a/engine/src/core/com/jme3/renderer/queue/OpaqueComparator.java b/engine/src/core/com/jme3/renderer/queue/OpaqueComparator.java index 0657554d3..7f4fef9f5 100644 --- a/engine/src/core/com/jme3/renderer/queue/OpaqueComparator.java +++ b/engine/src/core/com/jme3/renderer/queue/OpaqueComparator.java @@ -40,7 +40,8 @@ import com.jme3.scene.Geometry; public class OpaqueComparator implements GeometryComparator { private Camera cam; - private final Vector3f tempVec = new Vector3f(); + private final Vector3f tempVec = new Vector3f(); + private final Vector3f tempVec2 = new Vector3f(); public void setCamera(Camera cam){ this.cam = cam; @@ -54,7 +55,7 @@ public class OpaqueComparator implements GeometryComparator { return spat.queueDistance; Vector3f camPosition = cam.getLocation(); - Vector3f viewVector = cam.getDirection(); + Vector3f viewVector = cam.getDirection(tempVec2); Vector3f spatPosition = null; if (spat.getWorldBound() != null){ diff --git a/engine/src/core/com/jme3/renderer/queue/RenderQueue.java b/engine/src/core/com/jme3/renderer/queue/RenderQueue.java index 9e1049b1d..29b9a2ec3 100644 --- a/engine/src/core/com/jme3/renderer/queue/RenderQueue.java +++ b/engine/src/core/com/jme3/renderer/queue/RenderQueue.java @@ -194,6 +194,8 @@ public class RenderQueue { case Receive: renderGeometryList(shadowRecv, rm, cam, clear); break; + default: + throw new IllegalArgumentException("Unexpected shadow bucket: " + shadBucket); } } diff --git a/engine/src/core/com/jme3/scene/Mesh.java b/engine/src/core/com/jme3/scene/Mesh.java index e0d2f44e3..056d1ac13 100644 --- a/engine/src/core/com/jme3/scene/Mesh.java +++ b/engine/src/core/com/jme3/scene/Mesh.java @@ -57,6 +57,7 @@ import com.jme3.util.IntMap.Entry; import java.io.IOException; import java.nio.Buffer; import java.nio.ByteBuffer; +import java.nio.DoubleBuffer; import java.nio.FloatBuffer; import java.nio.IntBuffer; import java.nio.ShortBuffer; @@ -336,6 +337,12 @@ public class Mesh implements Savable, Cloneable { dataBuf.putInt(ib.get()); } break; + case Double: + DoubleBuffer db = (DoubleBuffer) vb.getData(); + for (int comp = 0; comp < vb.components; comp++){ + dataBuf.putDouble(db.get()); + } + break; } } } diff --git a/engine/src/core/com/jme3/scene/control/CameraControl.java b/engine/src/core/com/jme3/scene/control/CameraControl.java index 0031b2127..b81a3b819 100644 --- a/engine/src/core/com/jme3/scene/control/CameraControl.java +++ b/engine/src/core/com/jme3/scene/control/CameraControl.java @@ -86,29 +86,6 @@ public class CameraControl extends AbstractControl { this.controlDir = controlDir; } - /** - * @param spatial - * @param camera - * @param controlDir - * @deprecated Use the constructor that doesn't take a spatial argument - */ - public CameraControl(Spatial spatial, Camera camera, ControlDirection controlDir) { - super(spatial); - this.camera = camera; - this.controlDir = controlDir; - } - - /** - * @param spatial The spatial to be synced. - * @param camera The Camera to be synced. - * @deprecated Use the constructor that doesn't take a spatial argument - */ - @Deprecated - public CameraControl(Spatial spatial, Camera camera) { - super(spatial); - this.camera = camera; - } - public Camera getCamera() { return camera; } diff --git a/engine/src/core/com/jme3/scene/mesh/VirtualIndexBuffer.java b/engine/src/core/com/jme3/scene/mesh/VirtualIndexBuffer.java index 1fd4007bd..463e7adce 100644 --- a/engine/src/core/com/jme3/scene/mesh/VirtualIndexBuffer.java +++ b/engine/src/core/com/jme3/scene/mesh/VirtualIndexBuffer.java @@ -34,6 +34,8 @@ public class VirtualIndexBuffer extends IndexBuffer { case Triangles: numIndices = numVerts; return; + case Hybrid: + throw new UnsupportedOperationException(); } } diff --git a/engine/src/core/com/jme3/scene/shape/Cylinder.java b/engine/src/core/com/jme3/scene/shape/Cylinder.java index fa077d8c7..87ae1fee6 100644 --- a/engine/src/core/com/jme3/scene/shape/Cylinder.java +++ b/engine/src/core/com/jme3/scene/shape/Cylinder.java @@ -200,31 +200,6 @@ public class Cylinder extends Mesh { return inverted; } - /** - * Set the half angle of the cone. - * - * @param radians - */ - public void setHalfAngle(float radians) { - updateGeometry(getAxisSamples(), getRadialSamples(), FastMath.tan(radians), getRadius2(), getHeight(), isClosed(), isInverted()); - } - - /** - * Set the bottom radius of the 'cylinder' to differ from the top radius. - * This makes the Geometry be a frustum of pyramid, or if set to 0, a cone. - *

- * Note: this method causes the tri-mesh geometry data - * to be recalculated, see - * the package description for more information about this. - * - * @param radius the second radius to set. - * @see {@link Cone} - * @deprecated use {@link #recomputeGeometry(int, int, float, float, boolean, boolean)}. - */ - public void setRadius2(float radius2) { - updateGeometry(axisSamples, radialSamples, radius, radius2, height, closed, inverted); - } - /** * Rebuilds the cylinder based on a new set of parameters. * diff --git a/engine/src/core/com/jme3/shader/Uniform.java b/engine/src/core/com/jme3/shader/Uniform.java index 26cf941c0..8797437fc 100644 --- a/engine/src/core/com/jme3/shader/Uniform.java +++ b/engine/src/core/com/jme3/shader/Uniform.java @@ -257,6 +257,9 @@ public class Uniform extends ShaderVariable { this.value = Quaternion.ZERO; } break; + default: + break; // won't happen because those are either textures + // or multidata types } } diff --git a/engine/src/core/com/jme3/texture/Image.java b/engine/src/core/com/jme3/texture/Image.java index 6a3cc46a2..e448fee9b 100644 --- a/engine/src/core/com/jme3/texture/Image.java +++ b/engine/src/core/com/jme3/texture/Image.java @@ -172,6 +172,7 @@ public class Image extends GLObject implements Savable /*, Cloneable*/ { return new Image(id); } + @Override public Image clone(){ Image clone = (Image) super.clone(); clone.mipMapSizes = mipMapSizes != null ? mipMapSizes.clone() : null; @@ -585,6 +586,19 @@ public class Image extends GLObject implements Savable /*, Cloneable*/ { return true; } + @Override + public int hashCode() { + int hash = 7; + hash = 97 * hash + (this.format != null ? this.format.hashCode() : 0); + hash = 97 * hash + this.width; + hash = 97 * hash + this.height; + hash = 97 * hash + this.depth; + hash = 97 * hash + Arrays.hashCode(this.mipMapSizes); + hash = 97 * hash + (this.data != null ? this.data.hashCode() : 0); + hash = 97 * hash + this.multiSamples; + return hash; + } + public void write(JmeExporter e) throws IOException { OutputCapsule capsule = e.getCapsule(this); capsule.write(format, "format", Format.RGBA8); diff --git a/engine/src/core/com/jme3/texture/Texture.java b/engine/src/core/com/jme3/texture/Texture.java index 734f5984e..6e5128d23 100644 --- a/engine/src/core/com/jme3/texture/Texture.java +++ b/engine/src/core/com/jme3/texture/Texture.java @@ -515,72 +515,45 @@ public abstract class Texture implements Asset, Savable, Cloneable { return sb.toString(); } -// public boolean equals(Object other) { -// if (other == this) { -// return true; -// } -// if (!(other instanceof Texture)) { -// return false; -// } -//// super.equals(other); -// -// Texture that = (Texture) other; -// if (this.textureId != that.textureId) -// return false; -// if (this.textureId == 0) { -// if (this.getImage() != null -// && !this.getImage().equals(that.getImage())) -// return false; -// if (this.getImage() == null && that.getImage() != null) -// return false; -// if (this.getAnisotropicFilterPercent() != that -// .getAnisotropicFilterPercent()) -// return false; -// if (this.getApply() != that.getApply()) -// return false; -// if (this.getCombineFuncAlpha() != that.getCombineFuncAlpha()) -// return false; -// if (this.getCombineFuncRGB() != that.getCombineFuncRGB()) -// return false; -// if (this.getCombineOp0Alpha() != that.getCombineOp0Alpha()) -// return false; -// if (this.getCombineOp1RGB() != that.getCombineOp1RGB()) -// return false; -// if (this.getCombineOp2Alpha() != that.getCombineOp2Alpha()) -// return false; -// if (this.getCombineOp2RGB() != that.getCombineOp2RGB()) -// return false; -// if (this.getCombineScaleAlpha() != that.getCombineScaleAlpha()) -// return false; -// if (this.getCombineScaleRGB() != that.getCombineScaleRGB()) -// return false; -// if (this.getCombineSrc0Alpha() != that.getCombineSrc0Alpha()) -// return false; -// if (this.getCombineSrc0RGB() != that.getCombineSrc0RGB()) -// return false; -// if (this.getCombineSrc1Alpha() != that.getCombineSrc1Alpha()) -// return false; -// if (this.getCombineSrc1RGB() != that.getCombineSrc1RGB()) -// return false; -// if (this.getCombineSrc2Alpha() != that.getCombineSrc2Alpha()) -// return false; -// if (this.getCombineSrc2RGB() != that.getCombineSrc2RGB()) -// return false; -// if (this.getEnvironmentalMapMode() != that -// .getEnvironmentalMapMode()) -// return false; -// if (this.getMagnificationFilter() != that.getMagnificationFilter()) -// return false; -// if (this.getMinificationFilter() != that.getMinificationFilter()) -// return false; -// if (this.getBlendColor() != null -// && !this.getBlendColor().equals(that.getBlendColor())) -// return false; -// if (this.getBlendColor() == null && that.getBlendColor() != null) -// return false; -// } -// return true; -// } + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final Texture other = (Texture) obj; + if (this.image != other.image && (this.image == null || !this.image.equals(other.image))) { + return false; + } + if (this.minificationFilter != other.minificationFilter) { + return false; + } + if (this.magnificationFilter != other.magnificationFilter) { + return false; + } + if (this.shadowCompareMode != other.shadowCompareMode) { + return false; + } + if (this.anisotropicFilter != other.anisotropicFilter) { + return false; + } + return true; + } + + @Override + public int hashCode() { + int hash = 5; + hash = 67 * hash + (this.image != null ? this.image.hashCode() : 0); + hash = 67 * hash + (this.minificationFilter != null ? this.minificationFilter.hashCode() : 0); + hash = 67 * hash + (this.magnificationFilter != null ? this.magnificationFilter.hashCode() : 0); + hash = 67 * hash + (this.shadowCompareMode != null ? this.shadowCompareMode.hashCode() : 0); + hash = 67 * hash + this.anisotropicFilter; + return hash; + } + + // public abstract Texture createSimpleClone(); diff --git a/engine/src/core/com/jme3/texture/Texture2D.java b/engine/src/core/com/jme3/texture/Texture2D.java index 827446f1c..cb0a733cf 100644 --- a/engine/src/core/com/jme3/texture/Texture2D.java +++ b/engine/src/core/com/jme3/texture/Texture2D.java @@ -134,6 +134,8 @@ public class Texture2D extends Texture { case T: this.wrapT = mode; break; + default: + throw new IllegalArgumentException("Not applicable for 2D textures"); } } @@ -169,8 +171,9 @@ public class Texture2D extends Texture { return wrapS; case T: return wrapT; + default: + throw new IllegalArgumentException("invalid WrapAxis: " + axis); } - throw new IllegalArgumentException("invalid WrapAxis: " + axis); } @Override @@ -191,6 +194,14 @@ public class Texture2D extends Texture { return super.equals(other); } + @Override + public int hashCode() { + int hash = super.hashCode(); + hash = 79 * hash + (this.wrapS != null ? this.wrapS.hashCode() : 0); + hash = 79 * hash + (this.wrapT != null ? this.wrapT.hashCode() : 0); + return hash; + } + @Override public void write(JmeExporter e) throws IOException { super.write(e); diff --git a/engine/src/core/com/jme3/texture/TextureCubeMap.java b/engine/src/core/com/jme3/texture/TextureCubeMap.java index 83b6be281..9b256d66d 100644 --- a/engine/src/core/com/jme3/texture/TextureCubeMap.java +++ b/engine/src/core/com/jme3/texture/TextureCubeMap.java @@ -36,7 +36,6 @@ import com.jme3.export.JmeExporter; import com.jme3.export.JmeImporter; import com.jme3.export.InputCapsule; import com.jme3.export.OutputCapsule; -import com.jme3.renderer.GLObject; import java.io.IOException; /** @@ -178,6 +177,15 @@ public class TextureCubeMap extends Texture { return super.equals(other); } + @Override + public int hashCode() { + int hash = super.hashCode(); + hash = 53 * hash + (this.wrapS != null ? this.wrapS.hashCode() : 0); + hash = 53 * hash + (this.wrapT != null ? this.wrapT.hashCode() : 0); + hash = 53 * hash + (this.wrapR != null ? this.wrapR.hashCode() : 0); + return hash; + } + @Override public void write(JmeExporter e) throws IOException { super.write(e); diff --git a/engine/src/desktop-fx/com/jme3/post/filters/BloomFilter.java b/engine/src/desktop-fx/com/jme3/post/filters/BloomFilter.java index c956a4d8d..af896e918 100644 --- a/engine/src/desktop-fx/com/jme3/post/filters/BloomFilter.java +++ b/engine/src/desktop-fx/com/jme3/post/filters/BloomFilter.java @@ -73,18 +73,7 @@ public class BloomFilter extends Filter { */ SceneAndObjects; } - /**@deprecated use {@link GlowMode} enum */ - public static final int GLOW_SCENE = 0; - /**@deprecated use {@link GlowMode} enum */ - public static final int GLOW_OBJECTS = 1; - /**@deprecated use {@link GlowMode} enum */ - public static final int GLOW_BOTH = 2; - /**@deprecated use GLOW_SCENE instead*/ - public static final int GLOW_MODE_ONLY_EXTRACTED_LIGHTS = 0; - /**@deprecated use GLOW_OBJECTS instead*/ - public static final int GLOW_MODE_ONLY_GLOW_OBJECTS = 1; - /**@deprecated use GLOW_BOTH instead*/ - public static final int GLOW_MODE_BOTH = 2; + private GlowMode glowMode = GlowMode.Scene; //Bloom parameters private float blurScale = 1.5f; @@ -119,32 +108,6 @@ public class BloomFilter extends Filter { this.glowMode = glowMode; } - /** - * - * @param width - * @param height - * @deprecated use BloomFilter() instead - */ - @Deprecated - public BloomFilter(int width, int height) { - super("BloomFilter"); - screenWidth = width; - screenHeight = height; - } - - /** - * - * @param width - * @param height - * @param glowMode - * @deprecated use BloomFilter(GlowMode glowMode) instead - */ - @Deprecated - public BloomFilter(int width, int height, GlowMode glowMode) { - this(width, height); - this.glowMode = glowMode; - } - @Override public void initFilter(AssetManager manager, RenderManager renderManager, ViewPort vp, int w, int h) { screenWidth = (int) (w / downSamplingFactor); diff --git a/engine/src/desktop-fx/com/jme3/shadow/PssmShadowRenderer.java b/engine/src/desktop-fx/com/jme3/shadow/PssmShadowRenderer.java index 5e4e681e0..d6e9b994b 100644 --- a/engine/src/desktop-fx/com/jme3/shadow/PssmShadowRenderer.java +++ b/engine/src/desktop-fx/com/jme3/shadow/PssmShadowRenderer.java @@ -59,21 +59,6 @@ import com.jme3.ui.Picture; public class PssmShadowRenderer implements SceneProcessor { - @Deprecated - public static final String EDGE_FILTERING_PCF = "EDGE_FILTERING_PCF"; - - @Deprecated - public static final String EDGE_FILTERING_DITHER = "EDGE_FILTERING_DITHER"; - - @Deprecated - public enum FILTERING { - PCF4X4, - PCF8X8, - PCF10X10, - PCF16X16, - PCF20X20 - } - /** * FilterMode specifies how shadows are filtered */ @@ -205,16 +190,6 @@ public class PssmShadowRenderer implements SceneProcessor { } } - @Deprecated - public PssmShadowRenderer(AssetManager manager, int size, int nbSplits, String filterMode){ - this(manager, size, nbSplits); - if (filterMode.equals(EDGE_FILTERING_DITHER)){ - setFilterMode(FilterMode.Dither); - }else if (filterMode.equals(EDGE_FILTERING_PCF)){ - setFilterMode(FilterMode.PCF4); - } - } - public void setFilterMode(FilterMode filterMode){ if (filterMode == null) throw new NullPointerException(); @@ -508,31 +483,5 @@ public class PssmShadowRenderer implements SceneProcessor { this.edgesThickness *= 0.1f; postshadowMat.setFloat("PCFEdge", edgesThickness); } - - @Deprecated - public FILTERING getPcfFilter() { - switch (filterMode){ - case PCF4: - return FILTERING.PCF4X4; - case PCF8: - return FILTERING.PCF8X8; - default: - return null; - } - } - - @Deprecated - public void setPcfFilter(FILTERING pcfFilter) { - switch (pcfFilter){ - case PCF4X4: - setFilterMode(FilterMode.PCF4); - break; - case PCF8X8: - setFilterMode(FilterMode.PCF8); - break; - } - } - - } diff --git a/engine/src/desktop/com/jme3/system/JmeSystem.java b/engine/src/desktop/com/jme3/system/JmeSystem.java index d43387368..752ab2907 100644 --- a/engine/src/desktop/com/jme3/system/JmeSystem.java +++ b/engine/src/desktop/com/jme3/system/JmeSystem.java @@ -93,11 +93,6 @@ public class JmeSystem { * Apple Mac OS X 64 bit PowerPC */ MacOSX_PPC64, - - /** - * Google Android Smartphone OS - */ - Android } private static final Logger logger = Logger.getLogger(JmeSystem.class.getName()); diff --git a/engine/src/lwjgl-ogl/com/jme3/renderer/lwjgl/LwjglGL1Renderer.java b/engine/src/lwjgl-ogl/com/jme3/renderer/lwjgl/LwjglGL1Renderer.java index e18e1b27d..c680847d3 100644 --- a/engine/src/lwjgl-ogl/com/jme3/renderer/lwjgl/LwjglGL1Renderer.java +++ b/engine/src/lwjgl-ogl/com/jme3/renderer/lwjgl/LwjglGL1Renderer.java @@ -65,6 +65,7 @@ public class LwjglGL1Renderer implements GL1Renderer { // private Matrix4f projMatrix = new Matrix4f(); private boolean colorSet = false; + private boolean materialSet = false; protected void updateNameBuffer() { int len = stringBuf.length(); @@ -137,6 +138,18 @@ public class LwjglGL1Renderer implements GL1Renderer { glClearColor(color.r, color.g, color.b, color.a); } + private void setMaterialColor(int type, ColorRGBA color){ + if (!materialSet){ + materialSet = true; + glEnable(GL_COLOR_MATERIAL); + } + + fb16.clear(); + fb16.put(color.r).put(color.g).put(color.b).put(color.a); + fb16.clear(); + glMaterial(GL_FRONT_AND_BACK, type, fb16); + } + public void setFixedFuncBinding(FixedFuncBinding ffBinding, Object val){ switch (ffBinding){ case Color: @@ -144,6 +157,18 @@ public class LwjglGL1Renderer implements GL1Renderer { glColor4f(color.r, color.g, color.b, color.a); colorSet = true; break; + case MaterialAmbient: + ColorRGBA ambient = (ColorRGBA) val; + setMaterialColor(GL_AMBIENT, ambient); + break; + case MaterialDiffuse: + ColorRGBA diffuse = (ColorRGBA) val; + setMaterialColor(GL_DIFFUSE, diffuse); + break; + case MaterialSpecular: + ColorRGBA specular = (ColorRGBA) val; + setMaterialColor(GL_SPECULAR, specular); + break; } } @@ -152,6 +177,10 @@ public class LwjglGL1Renderer implements GL1Renderer { glColor4f(1,1,1,1); colorSet = false; } + if (materialSet){ + glDisable(GL_COLOR_MATERIAL); + materialSet = false; // TODO: not efficient + } } public void applyRenderState(RenderState state) { @@ -710,6 +739,9 @@ public class LwjglGL1Renderer implements GL1Renderer { glTexCoordPointer(comps, vb.getStride(), (FloatBuffer)data); break; + default: + // Ignore, this is an unsupported attribute for OpenGL1. + break; } } diff --git a/engine/src/tools/jme3tools/navigation/Coordinate.java b/engine/src/tools/jme3tools/navigation/Coordinate.java index 69feb7c72..53195e8a2 100644 --- a/engine/src/tools/jme3tools/navigation/Coordinate.java +++ b/engine/src/tools/jme3tools/navigation/Coordinate.java @@ -153,6 +153,7 @@ public class Coordinate { } str = su.padNumZero(Math.abs(deg), 3); str += "\u00b0" + su.padNumZero(Math.abs(minsDecMins), 2, MINPRECISION) + "'" + quad; + break; } return str; } diff --git a/engine/src/tools/jme3tools/navigation/NavCalculator.java b/engine/src/tools/jme3tools/navigation/NavCalculator.java index 1a641f086..8e345036f 100644 --- a/engine/src/tools/jme3tools/navigation/NavCalculator.java +++ b/engine/src/tools/jme3tools/navigation/NavCalculator.java @@ -48,8 +48,10 @@ public class NavCalculator { switch (calcType) { case MERCATOR: mercatorSailing(P1, P2); + break; case GC: greatCircleSailing(P1, P2); + break; } }