- revert ByteBuffer changes for native bullet objects (not asset data!)

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7847 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
nor..67 14 years ago
parent 80ac165e67
commit 7cc3592f0f
  1. 5
      engine/src/bullet/com/jme3/bullet/collision/shapes/GImpactCollisionShape.java
  2. 3
      engine/src/bullet/com/jme3/bullet/collision/shapes/HeightfieldCollisionShape.java
  3. 3
      engine/src/bullet/com/jme3/bullet/collision/shapes/HullCollisionShape.java
  4. 5
      engine/src/bullet/com/jme3/bullet/collision/shapes/MeshCollisionShape.java
  5. 6
      engine/src/bullet/com/jme3/bullet/util/NativeMeshUtil.java

@ -39,7 +39,6 @@ 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;
@ -71,8 +70,8 @@ public class GImpactCollisionShape extends CollisionShape {
}
private void createCollisionMesh(Mesh mesh) {
triangleIndexBase = BufferUtils.createByteBuffer(mesh.getTriangleCount() * 3 * 4);
vertexBase = BufferUtils.createByteBuffer(mesh.getVertexCount() * 3 * 4);
triangleIndexBase = ByteBuffer.allocateDirect(mesh.getTriangleCount() * 3 * 4).order(ByteOrder.nativeOrder());
vertexBase = ByteBuffer.allocateDirect(mesh.getVertexCount() * 3 * 4).order(ByteOrder.nativeOrder());
// triangleIndexBase = ByteBuffer.allocate(mesh.getTriangleCount() * 3 * 4);
// vertexBase = ByteBuffer.allocate(mesh.getVertexCount() * 3 * 4);
numVertices = mesh.getVertexCount();

@ -11,7 +11,6 @@ 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;
@ -95,7 +94,7 @@ public class HeightfieldCollisionShape extends CollisionShape {
}
protected void createShape() {
bbuf = BufferUtils.createByteBuffer(heightfieldData.length * 4);
bbuf = ByteBuffer.allocateDirect(heightfieldData.length * 4).order(ByteOrder.nativeOrder());
// fbuf = bbuf.asFloatBuffer();//FloatBuffer.wrap(heightfieldData);
// fbuf.rewind();
// fbuf.put(heightfieldData);

@ -7,7 +7,6 @@ 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;
@ -67,7 +66,7 @@ public class HullCollisionShape extends CollisionShape {
// objectId = new ConvexHullShape(pointList);
// objectId.setLocalScaling(Converter.convert(getScale()));
// objectId.setMargin(margin);
ByteBuffer bbuf=BufferUtils.createByteBuffer(points.length * 4);
ByteBuffer bbuf=ByteBuffer.allocateDirect(points.length * 4).order(ByteOrder.nativeOrder());
// fbuf = bbuf.asFloatBuffer();
// fbuf.rewind();
// fbuf.put(points);

@ -39,7 +39,6 @@ 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;
@ -69,8 +68,8 @@ public class MeshCollisionShape extends CollisionShape {
}
private void createCollisionMesh(Mesh mesh) {
triangleIndexBase = BufferUtils.createByteBuffer(mesh.getTriangleCount() * 3 * 4);
vertexBase = BufferUtils.createByteBuffer(mesh.getVertexCount() * 3 * 4);
triangleIndexBase = ByteBuffer.allocateDirect(mesh.getTriangleCount() * 3 * 4).order(ByteOrder.nativeOrder());
vertexBase = ByteBuffer.allocateDirect(mesh.getVertexCount() * 3 * 4).order(ByteOrder.nativeOrder());
numVertices = mesh.getVertexCount();
vertexStride = 12; //3 verts * 4 bytes per.
numTriangles = mesh.getTriangleCount();

@ -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 = BufferUtils.createByteBuffer(mesh.getTriangleCount() * 3 * 4);
ByteBuffer vertexBase = BufferUtils.createByteBuffer(mesh.getVertexCount() * 3 * 4);
ByteBuffer triangleIndexBase = ByteBuffer.allocateDirect(mesh.getTriangleCount() * 3 * 4).order(ByteOrder.nativeOrder());
ByteBuffer vertexBase = ByteBuffer.allocateDirect(mesh.getVertexCount() * 3 * 4).order(ByteOrder.nativeOrder());
int numVertices = mesh.getVertexCount();
int vertexStride = 12; //3 verts * 4 bytes per.
int numTriangles = mesh.getTriangleCount();

Loading…
Cancel
Save