Convert to using jBulletFork

This commit is contained in:
austin 2021-07-24 15:22:13 -04:00
parent afe51eb966
commit b5a0987ea1
10 changed files with 69 additions and 69 deletions

View File

@ -123,9 +123,9 @@
source: https://github.com/jbullet-maven/jbullet/tree/master/src/main/java/com/bulletphysics
-->
<dependency>
<groupId>cz.advel.jbullet</groupId>
<artifactId>jbullet</artifactId>
<version>20101010-1</version>
<groupId>electrosphere</groupId>
<artifactId>jBulletFork</artifactId>
<version>0.1</version>
</dependency>
<!--

View File

@ -1,6 +1,6 @@
package electrosphere.engine;
import com.bulletphysics.collision.dispatch.CollisionObject;
import electrosphere.collision.dispatch.CollisionObject;
import electrosphere.controls.ControlHandler;
import electrosphere.entity.CameraEntityUtils;
import electrosphere.entity.Entity;

View File

@ -1,6 +1,6 @@
package electrosphere.entity.state;
import com.bulletphysics.collision.dispatch.CollisionObject;
import electrosphere.collision.dispatch.CollisionObject;
import electrosphere.entity.Entity;
import electrosphere.entity.EntityUtils;
import electrosphere.entity.state.movement.Impulse;
@ -121,7 +121,7 @@ public class GravityTree {
}
// System.out.println(hitFraction);
bodyTransformMatrix = new javax.vecmath.Matrix4f(PhysicsUtils.jomlToVecmathQuaternionf(rotation),PhysicsUtils.jomlToVecmathVector3f(position),1.0f);
body.setWorldTransform(new com.bulletphysics.linearmath.Transform(bodyTransformMatrix));
body.setWorldTransform(new electrosphere.linearmath.Transform(bodyTransformMatrix));
}
break;
case NOT_ACTIVE:

View File

@ -1,7 +1,7 @@
package electrosphere.entity.state.movement;
import com.bulletphysics.collision.dispatch.CollisionObject;
import com.bulletphysics.dynamics.RigidBody;
import electrosphere.collision.dispatch.CollisionObject;
import electrosphere.dynamics.RigidBody;
import electrosphere.entity.types.creature.CreatureUtils;
import electrosphere.entity.Entity;
import electrosphere.entity.EntityDataStrings;
@ -151,7 +151,7 @@ public class MovementTree {
position.add(impulseForce);
}
bodyTransformMatrix = new javax.vecmath.Matrix4f(PhysicsUtils.jomlToVecmathQuaternionf(rotation),PhysicsUtils.jomlToVecmathVector3f(position),1.0f);
body.setWorldTransform(new com.bulletphysics.linearmath.Transform(bodyTransformMatrix));
body.setWorldTransform(new electrosphere.linearmath.Transform(bodyTransformMatrix));
//state machine
switch(state){
@ -183,7 +183,7 @@ public class MovementTree {
rotation.rotationTo(new Vector3f(0,0,1), movementVector);
bodyTransformMatrix = new javax.vecmath.Matrix4f(PhysicsUtils.jomlToVecmathQuaternionf(rotation),PhysicsUtils.jomlToVecmathVector3f(newPosition),1.0f);
body.setWorldTransform(new com.bulletphysics.linearmath.Transform(bodyTransformMatrix));
body.setWorldTransform(new electrosphere.linearmath.Transform(bodyTransformMatrix));
activateGravityTree();
@ -241,7 +241,7 @@ public class MovementTree {
rotation.rotationTo(new Vector3f(0,0,1), movementVector);
bodyTransformMatrix = new javax.vecmath.Matrix4f(PhysicsUtils.jomlToVecmathQuaternionf(rotation),PhysicsUtils.jomlToVecmathVector3f(newPosition),1.0f);
body.setWorldTransform(new com.bulletphysics.linearmath.Transform(bodyTransformMatrix));
body.setWorldTransform(new electrosphere.linearmath.Transform(bodyTransformMatrix));
activateGravityTree();
@ -303,7 +303,7 @@ public class MovementTree {
rotation.rotationTo(new Vector3f(0,0,1), movementVector);
bodyTransformMatrix = new javax.vecmath.Matrix4f(PhysicsUtils.jomlToVecmathQuaternionf(rotation),PhysicsUtils.jomlToVecmathVector3f(newPosition),1.0f);
body.setWorldTransform(new com.bulletphysics.linearmath.Transform(bodyTransformMatrix));
body.setWorldTransform(new electrosphere.linearmath.Transform(bodyTransformMatrix));
activateGravityTree();

View File

@ -1,7 +1,7 @@
package electrosphere.entity.types.collision;
import com.bulletphysics.collision.dispatch.CollisionObject;
import com.bulletphysics.collision.shapes.CylinderShape;
import electrosphere.collision.dispatch.CollisionObject;
import electrosphere.collision.shapes.CylinderShape;
import electrosphere.entity.Entity;
import electrosphere.entity.EntityDataStrings;
import electrosphere.game.collision.PhysicsUtils;
@ -24,7 +24,7 @@ public class CollisionObjUtils {
PhysicsUtils.jomlToVecmathQuaternionf(rotation),
PhysicsUtils.jomlToVecmathVector3f(position),
1.0f);
planeObject.setWorldTransform(new com.bulletphysics.linearmath.Transform(planeTransform));
planeObject.setWorldTransform(new electrosphere.linearmath.Transform(planeTransform));
Collidable collidable = new Collidable(rVal, Collidable.TYPE_STRUCTURE);
Globals.collisionEngine.registerCollisionObject(planeObject, collidable);
Globals.collisionEngine.registerStructurePhysicsEntity(rVal);
@ -49,7 +49,7 @@ public class CollisionObjUtils {
PhysicsUtils.jomlToVecmathQuaternionf(rotation),
PhysicsUtils.jomlToVecmathVector3f(position),
1.0f);
cubeObject.setWorldTransform(new com.bulletphysics.linearmath.Transform(planeTransform));
cubeObject.setWorldTransform(new electrosphere.linearmath.Transform(planeTransform));
Collidable collidable = new Collidable(rVal, Collidable.TYPE_STRUCTURE);
Globals.collisionEngine.registerCollisionObject(cubeObject, collidable);
Globals.collisionEngine.registerStructurePhysicsEntity(rVal);

View File

@ -1,7 +1,7 @@
package electrosphere.entity.types.creature;
import com.bulletphysics.collision.dispatch.CollisionObject;
import com.bulletphysics.dynamics.RigidBody;
import electrosphere.collision.dispatch.CollisionObject;
import electrosphere.dynamics.RigidBody;
import electrosphere.entity.Entity;
import electrosphere.entity.EntityDataStrings;
import electrosphere.entity.EntityUtils;

View File

@ -1,7 +1,7 @@
package electrosphere.game.client.drawcell;
import com.bulletphysics.collision.dispatch.CollisionObject;
import com.bulletphysics.dynamics.RigidBody;
import electrosphere.collision.dispatch.CollisionObject;
import electrosphere.dynamics.RigidBody;
import electrosphere.entity.Entity;
import electrosphere.entity.EntityUtils;
import electrosphere.game.collision.PhysicsUtils;

View File

@ -1,31 +1,31 @@
package electrosphere.game.collision;
import com.bulletphysics.collision.broadphase.BroadphaseInterface;
import com.bulletphysics.collision.broadphase.BroadphasePair;
import com.bulletphysics.collision.broadphase.BroadphaseProxy;
import com.bulletphysics.collision.broadphase.DbvtBroadphase;
import com.bulletphysics.collision.broadphase.Dispatcher;
import com.bulletphysics.collision.broadphase.OverlappingPairCache;
import com.bulletphysics.collision.dispatch.CollisionDispatcher;
import com.bulletphysics.collision.dispatch.CollisionObject;
import com.bulletphysics.collision.dispatch.CollisionWorld.ClosestConvexResultCallback;
import com.bulletphysics.collision.dispatch.CollisionWorld.ConvexResultCallback;
import com.bulletphysics.collision.dispatch.CollisionWorld.LocalConvexResult;
import com.bulletphysics.collision.dispatch.DefaultCollisionConfiguration;
import com.bulletphysics.collision.narrowphase.ManifoldPoint;
import com.bulletphysics.collision.narrowphase.PersistentManifold;
import com.bulletphysics.collision.shapes.BoxShape;
import com.bulletphysics.collision.shapes.CollisionShape;
import com.bulletphysics.collision.shapes.SphereShape;
import com.bulletphysics.dynamics.DiscreteDynamicsWorld;
import com.bulletphysics.dynamics.DynamicsWorld;
import com.bulletphysics.dynamics.InternalTickCallback;
import com.bulletphysics.dynamics.RigidBody;
import com.bulletphysics.dynamics.RigidBodyConstructionInfo;
import com.bulletphysics.dynamics.constraintsolver.SequentialImpulseConstraintSolver;
import com.bulletphysics.linearmath.DefaultMotionState;
import com.bulletphysics.linearmath.Transform;
import com.bulletphysics.util.ObjectArrayList;
import electrosphere.collision.broadphase.BroadphaseInterface;
import electrosphere.collision.broadphase.BroadphasePair;
import electrosphere.collision.broadphase.BroadphaseProxy;
import electrosphere.collision.broadphase.DbvtBroadphase;
import electrosphere.collision.broadphase.Dispatcher;
import electrosphere.collision.broadphase.OverlappingPairCache;
import electrosphere.collision.dispatch.CollisionDispatcher;
import electrosphere.collision.dispatch.CollisionObject;
import electrosphere.collision.dispatch.CollisionWorld.ClosestConvexResultCallback;
import electrosphere.collision.dispatch.CollisionWorld.ConvexResultCallback;
import electrosphere.collision.dispatch.CollisionWorld.LocalConvexResult;
import electrosphere.collision.dispatch.DefaultCollisionConfiguration;
import electrosphere.collision.narrowphase.ManifoldPoint;
import electrosphere.collision.narrowphase.PersistentManifold;
import electrosphere.collision.shapes.BoxShape;
import electrosphere.collision.shapes.CollisionShape;
import electrosphere.collision.shapes.SphereShape;
import electrosphere.dynamics.DiscreteDynamicsWorld;
import electrosphere.dynamics.DynamicsWorld;
import electrosphere.dynamics.InternalTickCallback;
import electrosphere.dynamics.RigidBody;
import electrosphere.dynamics.RigidBodyConstructionInfo;
import electrosphere.dynamics.constraintsolver.SequentialImpulseConstraintSolver;
import electrosphere.linearmath.DefaultMotionState;
import electrosphere.linearmath.Transform;
import electrosphere.util.ObjectArrayList;
import electrosphere.entity.Entity;
import electrosphere.entity.EntityDataStrings;
import electrosphere.entity.EntityUtils;

View File

@ -1,15 +1,15 @@
package electrosphere.game.collision;
import com.bulletphysics.collision.dispatch.CollisionObject;
import com.bulletphysics.collision.shapes.BoxShape;
import com.bulletphysics.collision.shapes.BvhTriangleMeshShape;
import com.bulletphysics.collision.shapes.CylinderShape;
import com.bulletphysics.collision.shapes.IndexedMesh;
import com.bulletphysics.collision.shapes.TriangleIndexVertexArray;
import com.bulletphysics.dynamics.RigidBody;
import com.bulletphysics.dynamics.RigidBodyConstructionInfo;
import com.bulletphysics.linearmath.DefaultMotionState;
import com.bulletphysics.linearmath.Transform;
import electrosphere.collision.dispatch.CollisionObject;
import electrosphere.collision.shapes.BoxShape;
import electrosphere.collision.shapes.BvhTriangleMeshShape;
import electrosphere.collision.shapes.CylinderShape;
import electrosphere.collision.shapes.IndexedMesh;
import electrosphere.collision.shapes.TriangleIndexVertexArray;
import electrosphere.dynamics.RigidBody;
import electrosphere.dynamics.RigidBodyConstructionInfo;
import electrosphere.linearmath.DefaultMotionState;
import electrosphere.linearmath.Transform;
import electrosphere.entity.Entity;
import electrosphere.entity.EntityDataStrings;
import electrosphere.entity.EntityUtils;
@ -37,7 +37,7 @@ public class PhysicsUtils {
* @param halfDimensions
*/
public static void attachCylinderRigidBody(Entity entity, Vector3f halfDimensions){
new com.bulletphysics.collision.shapes.CylinderShape(new javax.vecmath.Vector3f(halfDimensions.x,halfDimensions.y,halfDimensions.z));
new electrosphere.collision.shapes.CylinderShape(new javax.vecmath.Vector3f(halfDimensions.x,halfDimensions.y,halfDimensions.z));
}
@ -110,7 +110,7 @@ public class PhysicsUtils {
//http://jbullet.advel.cz/javadoc/com/bulletphysics/collision/shapes/IndexedMesh.html
com.bulletphysics.collision.shapes.IndexedMesh indexedMesh = new com.bulletphysics.collision.shapes.IndexedMesh();
electrosphere.collision.shapes.IndexedMesh indexedMesh = new electrosphere.collision.shapes.IndexedMesh();
indexedMesh.numTriangles = indices.length / 3;
indexedMesh.triangleIndexBase = ByteBuffer.allocateDirect(indices.length*Float.BYTES).order(ByteOrder.nativeOrder());
@ -128,14 +128,14 @@ public class PhysicsUtils {
//http://jbullet.advel.cz/javadoc/com/bulletphysics/collision/shpaes/TriangleIndexVertexArray.html
com.bulletphysics.collision.shapes.TriangleIndexVertexArray triangleIndexArray = new com.bulletphysics.collision.shapes.TriangleIndexVertexArray();
electrosphere.collision.shapes.TriangleIndexVertexArray triangleIndexArray = new electrosphere.collision.shapes.TriangleIndexVertexArray();
triangleIndexArray.addIndexedMesh(indexedMesh); //this assumes the scalar type is integer (assumes bytebuffer is actually integer
// triangleIndexArray.calculateAabbBruteForce(aabbMin, aabbMax);
//http://jbullet.advel.cz/javadoc/com/bulletphysics/collision/shapes/BvhTriangleMeshShape.html
com.bulletphysics.collision.shapes.BvhTriangleMeshShape terrainShape = new com.bulletphysics.collision.shapes.BvhTriangleMeshShape(
electrosphere.collision.shapes.BvhTriangleMeshShape terrainShape = new electrosphere.collision.shapes.BvhTriangleMeshShape(
triangleIndexArray,
true // "useQuantizedAabbCompression" -- apparently means better memory usage ( http://jbullet.advel.cz/javadoc/com/bulletphysics/collision/shapes/BvhTriangleMeshShape.html )
);
@ -207,7 +207,7 @@ public class PhysicsUtils {
//http://jbullet.advel.cz/javadoc/com/bulletphysics/collision/shpaes/TriangleIndexVertexArray.html
com.bulletphysics.collision.shapes.TriangleIndexVertexArray triangleIndexArray = new com.bulletphysics.collision.shapes.TriangleIndexVertexArray(
electrosphere.collision.shapes.TriangleIndexVertexArray triangleIndexArray = new electrosphere.collision.shapes.TriangleIndexVertexArray(
// numberTriangles,
// triangleData,
// triangleStride,
@ -221,7 +221,7 @@ public class PhysicsUtils {
//http://jbullet.advel.cz/javadoc/com/bulletphysics/collision/shapes/BvhTriangleMeshShape.html
com.bulletphysics.collision.shapes.BvhTriangleMeshShape terrainShape = new com.bulletphysics.collision.shapes.BvhTriangleMeshShape(
electrosphere.collision.shapes.BvhTriangleMeshShape terrainShape = new electrosphere.collision.shapes.BvhTriangleMeshShape(
triangleIndexArray,
true // "useQuantizedAabbCompression" -- apparently means better memory usage ( http://jbullet.advel.cz/javadoc/com/bulletphysics/collision/shapes/BvhTriangleMeshShape.html )
);
@ -241,13 +241,13 @@ public class PhysicsUtils {
public static Vector3f getRigidBodyPosition(CollisionObject body){
javax.vecmath.Vector3f transform = new javax.vecmath.Vector3f(0,0,0);
body.getWorldTransform(new com.bulletphysics.linearmath.Transform()).transform(transform);
body.getWorldTransform(new electrosphere.linearmath.Transform()).transform(transform);
// body.getMotionState().getWorldTransform(new com.bulletphysics.linearmath.Transform()).transform(transform);
return vecmathToJomlVector3f(transform);
}
public static Quaternionf getRigidBodyRotation(RigidBody body){
return vecmathtoJomlQuaternionf(body.getMotionState().getWorldTransform(new com.bulletphysics.linearmath.Transform()).getRotation(new javax.vecmath.Quat4f()));
return vecmathtoJomlQuaternionf(body.getMotionState().getWorldTransform(new electrosphere.linearmath.Transform()).getRotation(new javax.vecmath.Quat4f()));
}
public static Vector3f vecmathToJomlVector3f(javax.vecmath.Vector3f vector){
@ -266,8 +266,8 @@ public class PhysicsUtils {
return new javax.vecmath.Quat4f(quaternion.x, quaternion.y, quaternion.z, quaternion.w);
}
public static com.bulletphysics.linearmath.Transform jomlVecToTransform(Vector3f vector){
com.bulletphysics.linearmath.Transform transform = new com.bulletphysics.linearmath.Transform();
public static electrosphere.linearmath.Transform jomlVecToTransform(Vector3f vector){
electrosphere.linearmath.Transform transform = new electrosphere.linearmath.Transform();
javax.vecmath.Matrix4f transformMatrix = new javax.vecmath.Matrix4f();
transformMatrix.setIdentity();
@ -279,7 +279,7 @@ public class PhysicsUtils {
}
public static void setRigidBodyTransform(Vector3f position, Quaternionf rotation, CollisionObject body){
com.bulletphysics.linearmath.Transform transform = new com.bulletphysics.linearmath.Transform();
electrosphere.linearmath.Transform transform = new electrosphere.linearmath.Transform();
javax.vecmath.Matrix4f transformMatrix = new javax.vecmath.Matrix4f();
transformMatrix.setIdentity();

View File

@ -1,7 +1,7 @@
package electrosphere.game.collision.collidable;
import com.bulletphysics.collision.shapes.CollisionShape;
import com.bulletphysics.dynamics.RigidBody;
import electrosphere.collision.shapes.CollisionShape;
import electrosphere.dynamics.RigidBody;
import electrosphere.entity.Entity;
import electrosphere.entity.state.movement.Impulse;
import java.util.LinkedList;