public Asset asset;
}
private final WeakHashMap<AssetKey, SmartAssetInfo> smartCache
= new WeakHashMap<AssetKey, SmartAssetInfo>();
- private final HashMap<AssetKey, Object> regularCache = new HashMap<AssetKey, Object>();
/**
- Adds a resource to the cache.
@@ -61,21 +61,18 @@
-
@see #getFromCache(java.lang.String)
*/
public void addToCache(AssetKey key, Object obj){
-
synchronized (regularCache){<br />
-
if (obj instanceof Asset && key.useSmartCache()){<br />
-
// put in smart cache<br />
-
Asset asset = (Asset) obj;<br />
-
asset.setKey(null); // no circular references<br />
-
SmartAssetInfo smartInfo = new SmartAssetInfo();<br />
-
smartInfo.asset = asset;<br />
-
// use the original key as smart key<br />
-
smartInfo.smartKey = new WeakReference<AssetKey>(key);<br />
-
smartCache.put(key, smartInfo);<br />
-
}else{<br />
-
// put in regular cache<br />
-
regularCache.put(key, obj);<br />
-
if (obj instanceof Asset){<br />
-
synchronized(smartCache){<br />
-
// put in smart cache<br />
-
Asset asset = (Asset) obj;<br />
-
asset.setKey(null); // no circular references<br />
-
SmartAssetInfo smartInfo = new SmartAssetInfo();<br />
-
smartInfo.asset = asset;<br />
-
// use the original key as smart key<br />
-
smartInfo.smartKey = new SoftReference<AssetKey>(key);<br />
-
smartCache.put(key, smartInfo);<br />
}
}
/**
@@ -84,13 +81,10 @@
- Thread-safe.
*/
public boolean deleteFromCache(AssetKey key){
-
}
/**
@@ -100,31 +94,18 @@
- public Object getFromCache(AssetKey key){
-
synchronized (regularCache){<br />
-
if (key.useSmartCache()) {<br />
-
return smartCache.get(key).asset;<br />
-
} else {<br />
-
return regularCache.get(key);<br />
-
}<br />
}
}
/**
- Deletes all the assets in the regular cache.
*/
public void deleteAllAssets(){
}
}
}
Index: src/desktop/com/jme3/asset/DesktopAssetManager.java
===================================================================
— src/desktop/com/jme3/asset/DesktopAssetManager.java (revision 7835)
+++ src/desktop/com/jme3/asset/DesktopAssetManager.java (working copy)
@@ -205,17 +205,13 @@
AssetKey smartKey = null;
Object o = null;
if (key.shouldCache()){
-
if (key.useSmartCache()){<br />
-
SmartAssetInfo smartInfo = cache.getFromSmartCache(key);<br />
-
if (smartInfo != null){<br />
-
smartKey = smartInfo.smartKey.get();<br />
-
if (smartKey != null){<br />
-
o = smartInfo.asset;<br />
-
}<br />
-
}<br />
-
}else{<br />
-
o = cache.getFromCache(key);<br />
-
}<br />
-
SmartAssetInfo smartInfo = cache.getFromCache(key);<br />
-
if (smartInfo != null){<br />
-
smartKey = smartInfo.smartKey.get();<br />
-
if (smartKey != null){<br />
-
o = smartInfo.asset;<br />
-
}<br />
-
}<br />
}
if (o == null){
AssetLoader loader = handler.aquireLoader(key);
@@ -264,7 +260,7 @@
// create an instance for user
T clone = (T) key.createClonedInstance(o);
if (smartKey != null){
// smart asset was already cached, use original key
((Asset)clone).setKey(smartKey);
@@ -352,8 +348,9 @@
public Shader loadShader(ShaderKey key){
// cache abuse in method
// that doesn’t use loaders/locators
String vertName = key.getVertName();
String fragName = key.getFragName();
@@ -365,6 +362,8 @@
s.addSource(Shader.ShaderType.Fragment, fragName, fragSource, key.getDefines().getCompiled());
cache.addToCache(key, s);
}
return s;
}
Index: src/networking/com/jme3/network/connection/TCPConnection.java
===================================================================
— src/networking/com/jme3/network/connection/TCPConnection.java (revision 7835)
+++ src/networking/com/jme3/network/connection/TCPConnection.java (working copy)
@@ -35,6 +35,8 @@
import com.jme3.network.message.Message;
import com.jme3.network.queue.MessageQueue;
import com.jme3.network.serializing.Serializer;
+import com.jme3.util.MemoryManager;
+
import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
@@ -72,9 +74,9 @@
{
label = name;
-
readBuffer = ByteBuffer.allocateDirect(16228);<br />
-
writeBuffer = ByteBuffer.allocateDirect(16228);<br />
-
tempWriteBuffer = ByteBuffer.allocateDirect(16228);<br />
-
readBuffer = MemoryManager.allocate(16228);<br />
-
writeBuffer = MemoryManager.allocate(16228);<br />
-
tempWriteBuffer = MemoryManager.allocate(16228);<br />
}
public TCPConnection() { }
Index: src/networking/com/jme3/network/connection/SSLTCPConnection.java
===================================================================
— src/networking/com/jme3/network/connection/SSLTCPConnection.java (revision 7835)
+++ src/networking/com/jme3/network/connection/SSLTCPConnection.java (working copy)
@@ -33,6 +33,9 @@
package com.jme3.network.connection;
import javax.net.ssl.*;
+
+import com.jme3.util.MemoryManager;
+
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
@@ -83,9 +86,9 @@
SSLSession session = sslEngine.getSession();
-
incDataDecrypted = ByteBuffer.allocateDirect(session.getApplicationBufferSize());<br />
-
incDataEncrypted = ByteBuffer.allocateDirect(session.getPacketBufferSize());<br />
-
outDataEncrypted = ByteBuffer.allocateDirect(session.getPacketBufferSize());<br />
-
incDataDecrypted = MemoryManager.allocate(session.getApplicationBufferSize());<br />
-
incDataEncrypted = MemoryManager.allocate(session.getPacketBufferSize());<br />
-
outDataEncrypted = MemoryManager.allocate(session.getPacketBufferSize());<br />
incDataEncrypted.position(incDataEncrypted.limit());
outDataEncrypted.position(outDataEncrypted.limit());
Index: src/networking/com/jme3/network/connection/UDPConnection.java
===================================================================
— src/networking/com/jme3/network/connection/UDPConnection.java (revision 7835)
+++ src/networking/com/jme3/network/connection/UDPConnection.java (working copy)
@@ -35,6 +35,8 @@
import com.jme3.network.message.DiscoverHostMessage;
import com.jme3.network.message.Message;
import com.jme3.network.serializing.Serializer;
+import com.jme3.util.MemoryManager;
+
import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
@@ -61,8 +63,8 @@
public UDPConnection(String label) {
this.label = label;
}
public void connect(SocketAddress address) throws IOException {
Index: src/lwjgl-oal/com/jme3/audio/lwjgl/LwjglAudioRenderer.java
===================================================================
— src/lwjgl-oal/com/jme3/audio/lwjgl/LwjglAudioRenderer.java (revision 7835)
+++ src/lwjgl-oal/com/jme3/audio/lwjgl/LwjglAudioRenderer.java (working copy)
@@ -46,6 +46,8 @@
import com.jme3.audio.LowPassFilter;
import com.jme3.math.Vector3f;
import com.jme3.util.BufferUtils;
+import com.jme3.util.MemoryManager;
+
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.FloatBuffer;
@@ -77,7 +79,7 @@
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 = MemoryManager.allocate(BUFFER_SIZE);
private final byte[] arrayBuf = new byte[BUFFER_SIZE];
private int[] channels;
Index: src/bullet/com/jme3/bullet/util/NativeMeshUtil.java
===================================================================
— src/bullet/com/jme3/bullet/util/NativeMeshUtil.java (revision 7835)
+++ src/bullet/com/jme3/bullet/util/NativeMeshUtil.java (working copy)
@@ -34,6 +34,8 @@
import com.jme3.scene.Mesh;
import com.jme3.scene.VertexBuffer.Type;
import com.jme3.scene.mesh.IndexBuffer;
+import com.jme3.util.MemoryManager;
+
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.FloatBuffer;
@@ -45,8 +47,8 @@
public class NativeMeshUtil {
public static long getTriangleIndexVertexArray(Mesh mesh){
-
ByteBuffer triangleIndexBase = ByteBuffer.allocateDirect(mesh.getTriangleCount() * 3 * 4).order(ByteOrder.nativeOrder());<br />
-
ByteBuffer vertexBase = ByteBuffer.allocateDirect(mesh.getVertexCount() * 3 * 4).order(ByteOrder.nativeOrder());<br />
-
ByteBuffer triangleIndexBase = MemoryManager.allocate(mesh.getTriangleCount() * 3 * 4).order(ByteOrder.nativeOrder());<br />
-
ByteBuffer vertexBase = MemoryManager.allocate(mesh.getVertexCount() * 3 * 4).order(ByteOrder.nativeOrder());<br />
int numVertices = mesh.getVertexCount();
int vertexStride = 12; //3 verts * 4 bytes per.
int numTriangles = mesh.getTriangleCount();
Index: src/bullet/com/jme3/bullet/collision/shapes/MeshCollisionShape.java
===================================================================
— src/bullet/com/jme3/bullet/collision/shapes/MeshCollisionShape.java (revision 7835)
+++ src/bullet/com/jme3/bullet/collision/shapes/MeshCollisionShape.java (working copy)
@@ -39,6 +39,8 @@
import com.jme3.export.OutputCapsule;
import com.jme3.scene.VertexBuffer.Type;
import com.jme3.scene.mesh.IndexBuffer;
+import com.jme3.util.MemoryManager;
+
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
@@ -68,8 +70,8 @@
}
private void createCollisionMesh(Mesh mesh) {
-
triangleIndexBase = ByteBuffer.allocateDirect(mesh.getTriangleCount() * 3 * 4).order(ByteOrder.nativeOrder());<br />
-
vertexBase = ByteBuffer.allocateDirect(mesh.getVertexCount() * 3 * 4).order(ByteOrder.nativeOrder());<br />
-
triangleIndexBase = MemoryManager.allocate(mesh.getTriangleCount() * 3 * 4).order(ByteOrder.nativeOrder());<br />
-
vertexBase = MemoryManager.allocate(mesh.getVertexCount() * 3 * 4).order(ByteOrder.nativeOrder());<br />
numVertices = mesh.getVertexCount();
vertexStride = 12; //3 verts * 4 bytes per.
numTriangles = mesh.getTriangleCount();
Index: src/bullet/com/jme3/bullet/collision/shapes/HeightfieldCollisionShape.java
===================================================================
— src/bullet/com/jme3/bullet/collision/shapes/HeightfieldCollisionShape.java (revision 7835)
+++ src/bullet/com/jme3/bullet/collision/shapes/HeightfieldCollisionShape.java (working copy)
@@ -11,6 +11,8 @@
import com.jme3.math.FastMath;
import com.jme3.math.Vector3f;
import com.jme3.scene.Mesh;
+import com.jme3.util.MemoryManager;
+
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
@@ -94,7 +96,7 @@
}
protected void createShape() {
// fbuf = bbuf.asFloatBuffer();//FloatBuffer.wrap(heightfieldData);
// fbuf.rewind();
// fbuf.put(heightfieldData);
Index: src/bullet/com/jme3/bullet/collision/shapes/GImpactCollisionShape.java
===================================================================
— src/bullet/com/jme3/bullet/collision/shapes/GImpactCollisionShape.java (revision 7835)
+++ src/bullet/com/jme3/bullet/collision/shapes/GImpactCollisionShape.java (working copy)
@@ -39,6 +39,8 @@
import com.jme3.export.OutputCapsule;
import com.jme3.scene.VertexBuffer.Type;
import com.jme3.scene.mesh.IndexBuffer;
+import com.jme3.util.MemoryManager;
+
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
@@ -70,8 +72,8 @@
}
private void createCollisionMesh(Mesh mesh) {
-
triangleIndexBase = ByteBuffer.allocateDirect(mesh.getTriangleCount() * 3 * 4).order(ByteOrder.nativeOrder());<br />
-
vertexBase = ByteBuffer.allocateDirect(mesh.getVertexCount() * 3 * 4).order(ByteOrder.nativeOrder());<br />
-
triangleIndexBase = MemoryManager.allocate(mesh.getTriangleCount() * 3 * 4).order(ByteOrder.nativeOrder());<br />
-
vertexBase = MemoryManager.allocate(mesh.getVertexCount() * 3 * 4).order(ByteOrder.nativeOrder());<br />
// triangleIndexBase = ByteBuffer.allocate(mesh.getTriangleCount() * 3 * 4);
// vertexBase = ByteBuffer.allocate(mesh.getVertexCount() * 3 * 4);
numVertices = mesh.getVertexCount();
Index: src/bullet/com/jme3/bullet/collision/shapes/HullCollisionShape.java
===================================================================
— src/bullet/com/jme3/bullet/collision/shapes/HullCollisionShape.java (revision 7835)
+++ src/bullet/com/jme3/bullet/collision/shapes/HullCollisionShape.java (working copy)
@@ -7,6 +7,8 @@
import com.jme3.export.OutputCapsule;
import com.jme3.scene.Mesh;
import com.jme3.scene.VertexBuffer.Type;
+import com.jme3.util.MemoryManager;
+
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
@@ -66,7 +68,7 @@
// objectId = new ConvexHullShape(pointList);
// objectId.setLocalScaling(Converter.convert(getScale()));
// objectId.setMargin(margin);
// fbuf = bbuf.asFloatBuffer();
// fbuf.rewind();
// fbuf.put(points);
Index: src/core/com/jme3/util/MemoryManager.java
===================================================================
— src/core/com/jme3/util/MemoryManager.java (revision 0)
+++ src/core/com/jme3/util/MemoryManager.java (revision 0)
@@ -0,0 +1,64 @@
+package com.jme3.util;
+
+import java.nio.ByteBuffer;
+import java.nio.ShortBuffer;
+import java.util.ArrayList;
+
+public class MemoryManager {
- private static MemoryManager instance;
+
- private int maxDirectByte;
+
- public static MemoryManager getInstance(){
-
if(instance == null){<br />
-
instance = new MemoryManager();<br />
-
}<br />
-
return instance;<br />
- }
+
+
- public MemoryManager(){
-
//determine max directMemory in a jvm independent Way<br />
-
ArrayList<ByteBuffer> amount = new ArrayList<ByteBuffer>();<br />
-
try{<br />
-
while(true){<br />
-
ByteBuffer buffer = ByteBuffer.allocateDirect(1*1024*1024);<br />
-
amount.add(buffer);<br />
-
}<br />
-
}catch(Throwable e){<br />
-
//leave 5% of all directMemory free for AudioRenderer,Threadhandeling,and other low level stuff<br />
-
maxDirectByte = (int) (amount.size()*1024*1024 * 0.95);<br />
-
System.out.println("Syste has " + amount.size() + " MB direct Memory");<br />
-
System.out.println("Reserved for low level " + (int) (amount.size() * 0.05) + " Mb direct Memory");<br />
-
}<br />
-
amount = null;<br />
-
//clear those buffers<br />
-
System.gc();<br />
+
- }
+
- public static ByteBuffer allocate(int i) {
-
return getInstance().allocate(i,false);<br />
- }
+
- private ByteBuffer allocate(int i,boolean retry) {
-
try{<br />
-
ByteBuffer buffer = ByteBuffer.allocateDirect(i);<br />
-
return buffer;<br />
-
}catch(Exception e){<br />
-
if(retry){<br />
-
BufferUtils.printCurrentDirectMemory(null);<br />
-
throw new OutOfMemoryError("Unable to free enough Direct Memory");<br />
-
}<br />
-
retry(i);<br />
-
}<br />
-
return null;<br />
- }
+
+
- private void retry(int i) {
-
System.out.println("Emergency GC");<br />
-
System.gc();<br />
-
allocate(i,true);<br />
- }
+}
Index: src/core/com/jme3/util/BufferUtils.java
===================================================================
— src/core/com/jme3/util/BufferUtils.java (revision 7835)
+++ src/core/com/jme3/util/BufferUtils.java (working copy)
@@ -700,7 +700,8 @@
-
@return the new DoubleBuffer
*/
public static DoubleBuffer createDoubleBuffer(int size) {
buf.clear();
onBufferAllocated(buf);
return buf;
@@ -763,7 +764,7 @@
-
@return the new FloatBuffer
*/
public static FloatBuffer createFloatBuffer(int size) {
buf.clear();
onBufferAllocated(buf);
return buf;
@@ -825,7 +826,7 @@
-
@return the new IntBuffer
*/
public static IntBuffer createIntBuffer(int size) {
buf.clear();
onBufferAllocated(buf);
return buf;
@@ -888,7 +889,7 @@
-
@return the new IntBuffer
*/
public static ByteBuffer createByteBuffer(int size) {
buf.clear();
onBufferAllocated(buf);
return buf;
@@ -966,7 +967,7 @@
-
@return the new ShortBuffer
*/
public static ShortBuffer createShortBuffer(int size) {
buf.clear();
onBufferAllocated(buf);
return buf;
Index: src/core/com/jme3/font/BitmapFont.java
===================================================================
— src/core/com/jme3/font/BitmapFont.java (revision 7835)
+++ src/core/com/jme3/font/BitmapFont.java (working copy)
@@ -35,6 +35,8 @@
import java.io.IOException;
import java.util.Arrays;
+import com.jme3.asset.Asset;
+import com.jme3.asset.AssetKey;
import com.jme3.export.InputCapsule;
import com.jme3.export.JmeExporter;
import com.jme3.export.JmeImporter;
@@ -46,7 +48,7 @@
- Represents a font within jME that is generated with the AngelCode Bitmap Font Generator
-
@author dhdd
*/
-public class BitmapFont implements Savable {
+public class BitmapFont implements Savable ,Asset{
public enum Align {
Left, Center, Right
@@ -57,6 +59,7 @@
private BitmapCharacterSet charSet;
private Material[] pages;
- private AssetKey key;
public BitmapFont() {
}
@@ -219,4 +222,13 @@
charSet.setStyle(style);
}
-
@Override
- public void setKey(AssetKey key) {
-
this.key = key;<br />
- }
+
-
@Override
- public AssetKey getKey() {
-
return this.key;<br />
- }
}
No newline at end of file
Index: src/core/com/jme3/material/Material.java
===================================================================
— src/core/com/jme3/material/Material.java (revision 7835)
+++ src/core/com/jme3/material/Material.java (working copy)
@@ -31,6 +31,7 @@
*/
package com.jme3.material;
+import com.jme3.asset.Asset;
import com.jme3.asset.AssetKey;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Matrix4f;
@@ -80,7 +81,7 @@
*
-
@author Kirill Vainer
*/
-public class Material implements Cloneable, Savable, Comparable {
+public class Material implements Cloneable, Savable, Comparable,Asset {
private static final Logger logger = Logger.getLogger(Material.class.getName());
private static final RenderState additiveLight = new RenderState();
@@ -109,6 +110,7 @@
private boolean receivesShadows = false;
private int sortingId = -1;
private transient ColorRGBA ambientLightColor = new ColorRGBA(0, 0, 0, 1);
- private AssetKey key;
public Material(MaterialDef def) {
if (def == null) {
@@ -1073,4 +1075,15 @@
setBoolean(“SeparateTexCoord”, true);
}
}
+
+
-
@Override
- public void setKey(AssetKey key) {
-
this.key = key;<br />
- }
+
-
@Override
- public AssetKey getKey() {
-
return this.key;<br />
- }
}
Index: src/core/com/jme3/material/MaterialDef.java
===================================================================
— src/core/com/jme3/material/MaterialDef.java (revision 7835)
+++ src/core/com/jme3/material/MaterialDef.java (working copy)
@@ -32,6 +32,8 @@
package com.jme3.material;
+import com.jme3.asset.Asset;
+import com.jme3.asset.AssetKey;
import com.jme3.asset.AssetManager;
import com.jme3.shader.VarType;
import java.util.ArrayList;
@@ -46,7 +48,7 @@
*
-
@author Kirill Vainer
*/
-public class MaterialDef {
+public class MaterialDef implements Asset{
private static final Logger logger = Logger.getLogger(MaterialDef.class.getName());
@@ -58,6 +60,8 @@
private Map<String, TechniqueDef> techniques;
private Map<String, MatParam> matParams;
- private AssetKey key;
+
/**
- Serialization only. Do not use.
*/
@@ -177,4 +181,14 @@
return techniques.get(name);
}
-
@Override
- public void setKey(AssetKey key) {
-
this.key = key;<br />
- }
+
-
@Override
- public AssetKey getKey() {
-
return this.key;<br />
- }
+
}
Index: src/core/com/jme3/terrain/BufferGeomap.java
===================================================================
— src/core/com/jme3/terrain/BufferGeomap.java (revision 7787)
+++ src/core/com/jme3/terrain/BufferGeomap.java (working copy)
@@ -42,6 +42,8 @@
import com.jme3.scene.VertexBuffer;
import com.jme3.scene.VertexBuffer.Type;
import com.jme3.util.BufferUtils;
+import com.jme3.util.MemoryManager;
+
import java.io.IOException;
import java.nio.BufferUnderflowException;
import java.nio.ByteBuffer;
@@ -67,7 +69,7 @@
}
public BufferGeomap(int width, int height, int maxval) {
-
this(ByteBuffer.allocateDirect(width*height*4).asFloatBuffer(),null,width,height,maxval);<br />
-
this(MemoryManager.allocate(width*height*4).asFloatBuffer(),null,width,height,maxval);<br />
}
public FloatBuffer getHeightData(){
@@ -127,7 +129,7 @@
}
public Geomap copySubGeomap(int x, int y, int w, int h){
hdata.position(y*width+x);
for (int cy = 0; cy < height; cy++){
hdata.limit(hdata.position()+w);
@@ -139,7 +141,7 @@
ByteBuffer nndata = null;
if (ndata!=null){
ndata.position( (y*width+x)3 );
for (int cy = 0; cy < height; cy++){
ndata.limit(ndata.position()+w3);
Index: src/core/com/jme3/asset/TextureKey.java
===================================================================
— src/core/com/jme3/asset/TextureKey.java (revision 7835)
+++ src/core/com/jme3/asset/TextureKey.java (working copy)
@@ -68,15 +68,6 @@
return name + (flipY ? " (Flipped)" : “”) + (asCube ? " (Cube)" : “”) + (generateMips ? " (Mipmaped)" : “”);
}
- /**
-
* Enable smart caching for textures<br />
-
* @return true to enable smart cache<br />
-
*/<br />
-
@Override
- public boolean useSmartCache(){
-
return true;<br />
- }
-
@Override
public Object createClonedInstance(Object asset){
Texture tex = (Texture) asset;
Index: src/core/com/jme3/asset/AssetKey.java
===================================================================
— src/core/com/jme3/asset/AssetKey.java (revision 7835)
+++ src/core/com/jme3/asset/AssetKey.java (working copy)
@@ -128,15 +128,6 @@
public boolean shouldCache(){
return true;
}
-
- /**
-
* @return Should return true, if the asset objects implement the "Asset"<br />
-
* interface and want to be removed from the cache when no longer<br />
-
* referenced in user-code.<br />
-
*/<br />
- public boolean useSmartCache(){
-
return false;<br />
- }
@Override
public boolean equals(Object other){
Index: src/jbullet/com/jme3/bullet/util/DebugShapeFactory.java
===================================================================
— src/jbullet/com/jme3/bullet/util/DebugShapeFactory.java (revision 7835)
+++ src/jbullet/com/jme3/bullet/util/DebugShapeFactory.java (working copy)
@@ -45,6 +45,7 @@
import com.jme3.scene.Node;
import com.jme3.scene.Spatial;
import com.jme3.scene.VertexBuffer.Type;
+import com.jme3.util.MemoryManager;
import com.jme3.util.TempVars;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
@@ -177,7 +178,7 @@
// 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();<br />
// Force the limit, set the cap - most number of floats we will use the buffer for
vertices.limit(numberOfFloats);
@@ -236,7 +237,7 @@
// There are 3 floats needed for each vertex (x,y,z)
final int numberOfFloats = vertices.size() * 3;
final int byteBufferSize = numberOfFloats * Float.SIZE;