diff --git a/engine/nbproject/project.properties b/engine/nbproject/project.properties index f0bb1feef..2923f7567 100644 --- a/engine/nbproject/project.properties +++ b/engine/nbproject/project.properties @@ -1,114 +1,114 @@ -annotation.processing.enabled=false -annotation.processing.enabled.in.editor=false -annotation.processing.run.all.processors=true -ant.customtasks.libs=JWSAntTasks -application.homepage=http://www.jmonkeyengine.com/ -application.title=jMonkeyEngine 3.0 -application.vendor=jMonkeyEngine -build.classes.dir=${build.dir}/classes -build.classes.excludes=**/*.java,**/*.form -# This directory is removed when the project is cleaned: -build.dir=build -build.generated.dir=${build.dir}/generated -build.generated.sources.dir=${build.dir}/generated-sources -# Only compile against the classpath explicitly listed here: -build.sysclasspath=ignore -build.test.classes.dir=${build.dir}/test/classes -build.test.results.dir=${build.dir}/test/results -# Uncomment to specify the preferred debugger connection transport: -#debug.transport=dt_socket -debug.classpath=\ - ${run.classpath} -debug.test.classpath=\ - ${run.test.classpath} -# This directory is removed when the project is cleaned: -dist.dir=dist -dist.jar=${dist.dir}/jMonkeyEngine3.jar -dist.javadoc.dir=${dist.dir}/javadoc -endorsed.classpath= -excludes= -file.reference.src-test-data=src/test-data -includes=** -jar.archive.disabled=${jnlp.enabled} -jar.compress=true -jar.index=${jnlp.enabled} -javac.classpath=\ - ${libs.jogg.classpath}:\ - ${libs.jbullet.classpath}:\ - ${libs.bullet.classpath}:\ - ${libs.lwjgl.classpath}:\ - ${libs.jheora.classpath}:\ - ${libs.niftygui1.3.classpath}:\ - ${libs.jme3-test-data.classpath}:\ - ${libs.noise.classpath} -# Space-separated list of extra javac options -javac.compilerargs= -javac.deprecation=false -javac.processorpath=\ - ${javac.classpath} -javac.source=1.5 -javac.target=1.5 -javac.test.classpath=\ - ${javac.classpath}:\ - ${build.classes.dir}:\ - ${libs.junit_4.classpath} +annotation.processing.enabled=false +annotation.processing.enabled.in.editor=false +annotation.processing.run.all.processors=true +ant.customtasks.libs=JWSAntTasks +application.homepage=http://www.jmonkeyengine.com/ +application.title=jMonkeyEngine 3.0 +application.vendor=jMonkeyEngine +build.classes.dir=${build.dir}/classes +build.classes.excludes=**/*.java,**/*.form +# This directory is removed when the project is cleaned: +build.dir=build +build.generated.dir=${build.dir}/generated +build.generated.sources.dir=${build.dir}/generated-sources +# Only compile against the classpath explicitly listed here: +build.sysclasspath=ignore +build.test.classes.dir=${build.dir}/test/classes +build.test.results.dir=${build.dir}/test/results +# Uncomment to specify the preferred debugger connection transport: +#debug.transport=dt_socket +debug.classpath=\ + ${run.classpath} +debug.test.classpath=\ + ${run.test.classpath} +# This directory is removed when the project is cleaned: +dist.dir=dist +dist.jar=${dist.dir}/jMonkeyEngine3.jar +dist.javadoc.dir=${dist.dir}/javadoc +endorsed.classpath= +excludes= +file.reference.src-test-data=src/test-data +includes=** +jar.archive.disabled=${jnlp.enabled} +jar.compress=true +jar.index=${jnlp.enabled} +javac.classpath=\ + ${libs.jogg.classpath}:\ + ${libs.jbullet.classpath}:\ + ${libs.bullet.classpath}:\ + ${libs.lwjgl.classpath}:\ + ${libs.jheora.classpath}:\ + ${libs.niftygui1.3.classpath}:\ + ${libs.jme3-test-data.classpath}:\ + ${libs.noise.classpath} +# Space-separated list of extra javac options +javac.compilerargs= +javac.deprecation=false +javac.processorpath=\ + ${javac.classpath} +javac.source=1.5 +javac.target=1.5 +javac.test.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir}:\ + ${libs.junit_4.classpath} javadoc.additionalparam=-public -javadoc.author=false -javadoc.encoding=${source.encoding} -javadoc.noindex=false -javadoc.nonavbar=false -javadoc.notree=false -javadoc.private=false -javadoc.splitindex=true -javadoc.use=true -javadoc.version=false -javadoc.windowtitle=jMonkeyEngine3 -jaxbwiz.endorsed.dirs="${netbeans.home}/../ide12/modules/ext/jaxb/api" -jnlp.applet.class=jme3test.awt.AppHarness -jnlp.applet.height=300 -jnlp.applet.width=300 -jnlp.codebase.type=user -jnlp.codebase.user=http://jmonkeyengine.com/javawebstart/ -jnlp.descriptor=application -jnlp.enabled=false -jnlp.icon=/Users/normenhansen/Pictures/jme/icons/jme-logo48.png -jnlp.mixed.code=default -jnlp.offline-allowed=true -jnlp.signed=true -jnlp.signing=generated -jnlp.signing.alias= -jnlp.signing.keystore= -main.class=jme3test.TestChooser -manifest.file=MANIFEST.MF -meta.inf.dir=${src.dir}/META-INF -mkdist.disabled=false -platform.active=default_platform -run.classpath=\ - ${javac.classpath}:\ - ${build.classes.dir} -run.jvmargs=-Xms30m -Xmx30m -XX:MaxDirectMemorySize=256M -run.test.classpath=\ - ${javac.test.classpath}:\ - ${build.test.classes.dir} -source.encoding=UTF-8 -src.blender.dir=src/blender -src.core-data.dir=src/core-data -src.core-plugins.dir=src/core-plugins -src.core.dir=src/core -src.desktop-fx.dir=src/desktop-fx -src.desktop.dir=src/desktop -src.games.dir=src/games -src.jbullet.dir=src/jbullet -src.jheora.dir=src/jheora -src.jogg.dir=src/jogg -src.lwjgl-oal.dir=src/lwjgl-oal -src.lwjgl-ogl.dir=src/lwjgl-ogl -src.networking.dir=src\\networking -src.niftygui.dir=src/niftygui -src.ogre.dir=src/ogre -src.pack.dir=src/pack -src.terrain.dir=src/terrain -src.test.dir=src/test -src.tools.dir=src/tools -src.xml.dir=src/xml -test.test.dir=test +javadoc.author=false +javadoc.encoding=${source.encoding} +javadoc.noindex=false +javadoc.nonavbar=false +javadoc.notree=false +javadoc.private=false +javadoc.splitindex=true +javadoc.use=true +javadoc.version=false +javadoc.windowtitle=jMonkeyEngine3 +jaxbwiz.endorsed.dirs="${netbeans.home}/../ide12/modules/ext/jaxb/api" +jnlp.applet.class=jme3test.awt.AppHarness +jnlp.applet.height=300 +jnlp.applet.width=300 +jnlp.codebase.type=user +jnlp.codebase.user=http://jmonkeyengine.com/javawebstart/ +jnlp.descriptor=application +jnlp.enabled=false +jnlp.icon=/Users/normenhansen/Pictures/jme/icons/jme-logo48.png +jnlp.mixed.code=default +jnlp.offline-allowed=true +jnlp.signed=true +jnlp.signing=generated +jnlp.signing.alias= +jnlp.signing.keystore= +main.class=jme3test.TestChooser +manifest.file=MANIFEST.MF +meta.inf.dir=${src.dir}/META-INF +mkdist.disabled=false +platform.active=default_platform +run.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +run.jvmargs=-Xbatch -XX:CICompilerCount=1 +run.test.classpath=\ + ${javac.test.classpath}:\ + ${build.test.classes.dir} +source.encoding=UTF-8 +src.blender.dir=src/blender +src.core-data.dir=src/core-data +src.core-plugins.dir=src/core-plugins +src.core.dir=src/core +src.desktop-fx.dir=src/desktop-fx +src.desktop.dir=src/desktop +src.games.dir=src/games +src.jbullet.dir=src/jbullet +src.jheora.dir=src/jheora +src.jogg.dir=src/jogg +src.lwjgl-oal.dir=src/lwjgl-oal +src.lwjgl-ogl.dir=src/lwjgl-ogl +src.networking.dir=src\\networking +src.niftygui.dir=src/niftygui +src.ogre.dir=src/ogre +src.pack.dir=src/pack +src.terrain.dir=src/terrain +src.test.dir=src/test +src.tools.dir=src/tools +src.xml.dir=src/xml +test.test.dir=test diff --git a/engine/src/bullet/com/jme3/bullet/collision/shapes/GImpactCollisionShape.java b/engine/src/bullet/com/jme3/bullet/collision/shapes/GImpactCollisionShape.java index 2e253d1e9..af97983e4 100644 --- a/engine/src/bullet/com/jme3/bullet/collision/shapes/GImpactCollisionShape.java +++ b/engine/src/bullet/com/jme3/bullet/collision/shapes/GImpactCollisionShape.java @@ -39,6 +39,7 @@ import com.jme3.export.InputCapsule; import com.jme3.export.OutputCapsule; import com.jme3.scene.VertexBuffer.Type; import com.jme3.scene.mesh.IndexBuffer; +import com.jme3.util.BufferUtils; import java.io.IOException; import java.nio.ByteBuffer; import java.nio.ByteOrder; @@ -70,8 +71,8 @@ public class GImpactCollisionShape extends CollisionShape { } private void createCollisionMesh(Mesh mesh) { - triangleIndexBase = ByteBuffer.allocateDirect(mesh.getTriangleCount() * 3 * 4).order(ByteOrder.nativeOrder()); - vertexBase = ByteBuffer.allocateDirect(mesh.getVertexCount() * 3 * 4).order(ByteOrder.nativeOrder()); + triangleIndexBase = BufferUtils.createByteBuffer(mesh.getTriangleCount() * 3 * 4); + vertexBase = BufferUtils.createByteBuffer(mesh.getVertexCount() * 3 * 4); // triangleIndexBase = ByteBuffer.allocate(mesh.getTriangleCount() * 3 * 4); // vertexBase = ByteBuffer.allocate(mesh.getVertexCount() * 3 * 4); numVertices = mesh.getVertexCount(); diff --git a/engine/src/bullet/com/jme3/bullet/collision/shapes/HeightfieldCollisionShape.java b/engine/src/bullet/com/jme3/bullet/collision/shapes/HeightfieldCollisionShape.java index 2c2da1323..4a7e43fb2 100644 --- a/engine/src/bullet/com/jme3/bullet/collision/shapes/HeightfieldCollisionShape.java +++ b/engine/src/bullet/com/jme3/bullet/collision/shapes/HeightfieldCollisionShape.java @@ -11,6 +11,7 @@ import com.jme3.export.OutputCapsule; import com.jme3.math.FastMath; import com.jme3.math.Vector3f; import com.jme3.scene.Mesh; +import com.jme3.util.BufferUtils; import java.io.IOException; import java.nio.ByteBuffer; import java.nio.ByteOrder; @@ -94,7 +95,7 @@ public class HeightfieldCollisionShape extends CollisionShape { } protected void createShape() { - bbuf = ByteBuffer.allocateDirect(heightfieldData.length * 4).order(ByteOrder.nativeOrder()); + bbuf = BufferUtils.createByteBuffer(heightfieldData.length * 4); // fbuf = bbuf.asFloatBuffer();//FloatBuffer.wrap(heightfieldData); // fbuf.rewind(); // fbuf.put(heightfieldData); diff --git a/engine/src/bullet/com/jme3/bullet/collision/shapes/HullCollisionShape.java b/engine/src/bullet/com/jme3/bullet/collision/shapes/HullCollisionShape.java index 3f27150ba..c64969f27 100644 --- a/engine/src/bullet/com/jme3/bullet/collision/shapes/HullCollisionShape.java +++ b/engine/src/bullet/com/jme3/bullet/collision/shapes/HullCollisionShape.java @@ -7,6 +7,7 @@ import com.jme3.export.JmeImporter; import com.jme3.export.OutputCapsule; import com.jme3.scene.Mesh; import com.jme3.scene.VertexBuffer.Type; +import com.jme3.util.BufferUtils; import java.io.IOException; import java.nio.ByteBuffer; import java.nio.ByteOrder; @@ -66,7 +67,7 @@ public class HullCollisionShape extends CollisionShape { // objectId = new ConvexHullShape(pointList); // objectId.setLocalScaling(Converter.convert(getScale())); // objectId.setMargin(margin); - ByteBuffer bbuf=ByteBuffer.allocateDirect(points.length * 4).order(ByteOrder.nativeOrder()); + ByteBuffer bbuf=BufferUtils.createByteBuffer(points.length * 4); // fbuf = bbuf.asFloatBuffer(); // fbuf.rewind(); // fbuf.put(points); diff --git a/engine/src/bullet/com/jme3/bullet/collision/shapes/MeshCollisionShape.java b/engine/src/bullet/com/jme3/bullet/collision/shapes/MeshCollisionShape.java index b7813a650..f262b2879 100644 --- a/engine/src/bullet/com/jme3/bullet/collision/shapes/MeshCollisionShape.java +++ b/engine/src/bullet/com/jme3/bullet/collision/shapes/MeshCollisionShape.java @@ -39,6 +39,7 @@ import com.jme3.export.InputCapsule; import com.jme3.export.OutputCapsule; import com.jme3.scene.VertexBuffer.Type; import com.jme3.scene.mesh.IndexBuffer; +import com.jme3.util.BufferUtils; import java.io.IOException; import java.nio.ByteBuffer; import java.nio.ByteOrder; @@ -68,8 +69,8 @@ public class MeshCollisionShape extends CollisionShape { } private void createCollisionMesh(Mesh mesh) { - triangleIndexBase = ByteBuffer.allocateDirect(mesh.getTriangleCount() * 3 * 4).order(ByteOrder.nativeOrder()); - vertexBase = ByteBuffer.allocateDirect(mesh.getVertexCount() * 3 * 4).order(ByteOrder.nativeOrder()); + triangleIndexBase = BufferUtils.createByteBuffer(mesh.getTriangleCount() * 3 * 4); + vertexBase = BufferUtils.createByteBuffer(mesh.getVertexCount() * 3 * 4); numVertices = mesh.getVertexCount(); vertexStride = 12; //3 verts * 4 bytes per. numTriangles = mesh.getTriangleCount(); diff --git a/engine/src/bullet/com/jme3/bullet/util/NativeMeshUtil.java b/engine/src/bullet/com/jme3/bullet/util/NativeMeshUtil.java index 83656d30a..75aa74005 100644 --- a/engine/src/bullet/com/jme3/bullet/util/NativeMeshUtil.java +++ b/engine/src/bullet/com/jme3/bullet/util/NativeMeshUtil.java @@ -34,8 +34,8 @@ package com.jme3.bullet.util; import com.jme3.scene.Mesh; import com.jme3.scene.VertexBuffer.Type; import com.jme3.scene.mesh.IndexBuffer; +import com.jme3.util.BufferUtils; import java.nio.ByteBuffer; -import java.nio.ByteOrder; import java.nio.FloatBuffer; /** @@ -45,8 +45,8 @@ import java.nio.FloatBuffer; public class NativeMeshUtil { public static long getTriangleIndexVertexArray(Mesh mesh){ - ByteBuffer triangleIndexBase = ByteBuffer.allocateDirect(mesh.getTriangleCount() * 3 * 4).order(ByteOrder.nativeOrder()); - ByteBuffer vertexBase = ByteBuffer.allocateDirect(mesh.getVertexCount() * 3 * 4).order(ByteOrder.nativeOrder()); + ByteBuffer triangleIndexBase = BufferUtils.createByteBuffer(mesh.getTriangleCount() * 3 * 4); + ByteBuffer vertexBase = BufferUtils.createByteBuffer(mesh.getVertexCount() * 3 * 4); int numVertices = mesh.getVertexCount(); int vertexStride = 12; //3 verts * 4 bytes per. int numTriangles = mesh.getTriangleCount(); diff --git a/engine/src/core-data/Common/MatDefs/Misc/Sky.frag b/engine/src/core-data/Common/MatDefs/Misc/Sky.frag index 3e36e0af5..7c334f91a 100644 --- a/engine/src/core-data/Common/MatDefs/Misc/Sky.frag +++ b/engine/src/core-data/Common/MatDefs/Misc/Sky.frag @@ -1,6 +1,6 @@ #import "Common/ShaderLib/Optics.glsllib" -uniform ENVMAP m_Texture; +uniform ENVMAP m_Texture2; varying vec3 direction; diff --git a/engine/src/core/com/jme3/light/PointLight.java b/engine/src/core/com/jme3/light/PointLight.java index 93bc9fa7d..abd33f63e 100644 --- a/engine/src/core/com/jme3/light/PointLight.java +++ b/engine/src/core/com/jme3/light/PointLight.java @@ -61,6 +61,7 @@ public class PointLight extends Light { if (owner.getWorldBound() != null){ BoundingVolume bv = owner.getWorldBound(); lastDistance = bv.distanceSquaredTo(position); + System.out.println(lastDistance + ", " + owner); }else{ lastDistance = owner.getWorldTranslation().distanceSquared(position); } diff --git a/engine/src/core/com/jme3/util/TempVars.java b/engine/src/core/com/jme3/util/TempVars.java index d5e69f572..e0a16b6cb 100644 --- a/engine/src/core/com/jme3/util/TempVars.java +++ b/engine/src/core/com/jme3/util/TempVars.java @@ -82,6 +82,13 @@ public class TempVars { return new TempVarsStack(); } }; + + private static final ThreadLocal tempVars = new ThreadLocal(){ + @Override + public TempVars initialValue() { + return new TempVars(); + } + }; /** * This instance of TempVars has been retrieved but not released yet. @@ -91,6 +98,13 @@ public class TempVars { private TempVars() { } + public static TempVars get(){ + return tempVars.get(); + } + + public void release(){ + } + /** * Acquire an instance of the TempVar class. * You have to release the instance after use by calling the @@ -100,6 +114,7 @@ public class TempVars { * * @return A TempVar instance */ + /* public static TempVars get() { TempVarsStack stack = varsLocal.get(); @@ -119,6 +134,7 @@ public class TempVars { return instance; } + */ /** * Releases this instance of TempVars. @@ -127,6 +143,7 @@ public class TempVars { * e.g. Acquiring vars1, then acquiring vars2, vars2 MUST be released * first otherwise an exception will be thrown. */ + /* public void release() { if (!isUsed){ throw new IllegalStateException("This instance of TempVars was already released!"); @@ -143,7 +160,7 @@ public class TempVars { if (stack.tempVars[stack.index] != this){ throw new IllegalStateException("An instance of TempVars has not been released in a called method!"); } - } + }*/ /** * For interfacing with OpenGL in Renderer. diff --git a/engine/src/jbullet/com/jme3/bullet/util/DebugShapeFactory.java b/engine/src/jbullet/com/jme3/bullet/util/DebugShapeFactory.java index c9a89eeb6..7a51c694e 100644 --- a/engine/src/jbullet/com/jme3/bullet/util/DebugShapeFactory.java +++ b/engine/src/jbullet/com/jme3/bullet/util/DebugShapeFactory.java @@ -45,6 +45,7 @@ import com.jme3.scene.Mesh; import com.jme3.scene.Node; import com.jme3.scene.Spatial; import com.jme3.scene.VertexBuffer.Type; +import com.jme3.util.BufferUtils; import com.jme3.util.TempVars; import java.nio.ByteBuffer; import java.nio.ByteOrder; @@ -176,8 +177,7 @@ public class DebugShapeFactory { // The number of bytes needed is: (floats in a vertex) * (vertices in a triangle) * (# of triangles) * (size of float in bytes) final int numberOfFloats = 3 * 3 * numberOfTriangles; - final int byteBufferSize = numberOfFloats * Float.SIZE; - FloatBuffer vertices = ByteBuffer.allocateDirect(byteBufferSize).order(ByteOrder.nativeOrder()).asFloatBuffer(); + FloatBuffer vertices = BufferUtils.createFloatBuffer(numberOfFloats); // Force the limit, set the cap - most number of floats we will use the buffer for vertices.limit(numberOfFloats); @@ -235,8 +235,7 @@ class BufferedTriangleCallback extends TriangleCallback { public FloatBuffer getVertices() { // There are 3 floats needed for each vertex (x,y,z) final int numberOfFloats = vertices.size() * 3; - final int byteBufferSize = numberOfFloats * Float.SIZE; - FloatBuffer verticesBuffer = ByteBuffer.allocateDirect(byteBufferSize).order(ByteOrder.nativeOrder()).asFloatBuffer(); + FloatBuffer verticesBuffer = BufferUtils.createFloatBuffer(numberOfFloats); // Force the limit, set the cap - most number of floats we will use the buffer for verticesBuffer.limit(numberOfFloats); diff --git a/engine/src/lwjgl-oal/com/jme3/audio/lwjgl/LwjglAudioRenderer.java b/engine/src/lwjgl-oal/com/jme3/audio/lwjgl/LwjglAudioRenderer.java index 493e39d3b..b7fcfa783 100644 --- a/engine/src/lwjgl-oal/com/jme3/audio/lwjgl/LwjglAudioRenderer.java +++ b/engine/src/lwjgl-oal/com/jme3/audio/lwjgl/LwjglAudioRenderer.java @@ -77,7 +77,7 @@ public class LwjglAudioRenderer implements AudioRenderer, Runnable { private final static int MAX_NUM_CHANNELS = 64; private IntBuffer ib = BufferUtils.createIntBuffer(1); private final FloatBuffer fb = BufferUtils.createVector3Buffer(2); - private final ByteBuffer nativeBuf = ByteBuffer.allocateDirect(BUFFER_SIZE); + private final ByteBuffer nativeBuf = BufferUtils.createByteBuffer(BUFFER_SIZE); private final byte[] arrayBuf = new byte[BUFFER_SIZE]; private int[] channels; @@ -100,7 +100,6 @@ public class LwjglAudioRenderer implements AudioRenderer, Runnable { private final AtomicBoolean threadLock = new AtomicBoolean(false); public LwjglAudioRenderer(){ - nativeBuf.order(ByteOrder.nativeOrder()); } public void initialize(){ diff --git a/engine/src/terrain/com/jme3/terrain/GeoMap.java b/engine/src/terrain/com/jme3/terrain/GeoMap.java index 223cb139b..241488d3f 100644 --- a/engine/src/terrain/com/jme3/terrain/GeoMap.java +++ b/engine/src/terrain/com/jme3/terrain/GeoMap.java @@ -68,7 +68,7 @@ public class GeoMap implements Savable { } public GeoMap(int width, int height, int maxval) { - this(ByteBuffer.allocateDirect(width*height*4).asFloatBuffer(),null,width,height,maxval); + this(BufferUtils.createFloatBuffer(width*height), null, width,height,maxval); } public FloatBuffer getHeightData(){ @@ -187,7 +187,7 @@ public class GeoMap implements Savable { * Copies a section of this geomap as a new geomap */ public GeoMap copySubGeomap(int x, int y, int w, int h){ - FloatBuffer nhdata = ByteBuffer.allocateDirect(w*h*4).asFloatBuffer(); + FloatBuffer nhdata = BufferUtils.createFloatBuffer(w * h); hdata.position(y*width+x); for (int cy = 0; cy < height; cy++){ hdata.limit(hdata.position()+w); @@ -199,7 +199,7 @@ public class GeoMap implements Savable { ByteBuffer nndata = null; if (ndata!=null){ - nndata = ByteBuffer.allocateDirect(w*h*3); + nndata = BufferUtils.createByteBuffer(w*h*3); ndata.position( (y*width+x)*3 ); for (int cy = 0; cy < height; cy++){ ndata.limit(ndata.position()+w*3);