|
@@ -127,7 +127,7 @@ public class PhysicsSpace {
|
|
|
return new ConcurrentLinkedQueue<AppTask<?>>();
|
|
|
}
|
|
|
};
|
|
|
- private ConcurrentLinkedQueue<AppTask<?>> pQueue = new ConcurrentLinkedQueue<AppTask<?>>();
|
|
|
+ private ConcurrentLinkedQueue<AppTask<?>> pQueue = new ConcurrentLinkedQueue<>();
|
|
|
private static ThreadLocal<PhysicsSpace> physicsSpaceTL = new ThreadLocal<PhysicsSpace>();
|
|
|
private DiscreteDynamicsWorld dynamicsWorld = null;
|
|
|
private BroadphaseInterface broadphase;
|
|
@@ -135,19 +135,19 @@ public class PhysicsSpace {
|
|
|
private CollisionDispatcher dispatcher;
|
|
|
private ConstraintSolver solver;
|
|
|
private DefaultCollisionConfiguration collisionConfiguration;
|
|
|
- private Map<PairCachingGhostObject, PhysicsGhostObject> physicsGhostObjects = new ConcurrentHashMap<PairCachingGhostObject, PhysicsGhostObject>();
|
|
|
- private Map<PairCachingGhostObject, PhysicsCharacter> physicsCharacters = new ConcurrentHashMap<PairCachingGhostObject, PhysicsCharacter>();
|
|
|
- private Map<RigidBody, PhysicsRigidBody> physicsBodies = new ConcurrentHashMap<RigidBody, PhysicsRigidBody>();
|
|
|
- private Map<TypedConstraint, PhysicsJoint> physicsJoints = new ConcurrentHashMap<TypedConstraint, PhysicsJoint>();
|
|
|
- private Map<RaycastVehicle, PhysicsVehicle> physicsVehicles = new ConcurrentHashMap<RaycastVehicle, PhysicsVehicle>();
|
|
|
+ private Map<PairCachingGhostObject, PhysicsGhostObject> physicsGhostObjects = new ConcurrentHashMap<>();
|
|
|
+ private Map<PairCachingGhostObject, PhysicsCharacter> physicsCharacters = new ConcurrentHashMap<>();
|
|
|
+ private Map<RigidBody, PhysicsRigidBody> physicsBodies = new ConcurrentHashMap<>();
|
|
|
+ private Map<TypedConstraint, PhysicsJoint> physicsJoints = new ConcurrentHashMap<>();
|
|
|
+ private Map<RaycastVehicle, PhysicsVehicle> physicsVehicles = new ConcurrentHashMap<>();
|
|
|
/**
|
|
|
* map from collision groups to registered group listeners
|
|
|
*/
|
|
|
- private Map<Integer, PhysicsCollisionGroupListener> collisionGroupListeners = new ConcurrentHashMap<Integer, PhysicsCollisionGroupListener>();
|
|
|
+ private Map<Integer, PhysicsCollisionGroupListener> collisionGroupListeners = new ConcurrentHashMap<>();
|
|
|
/**
|
|
|
* queue of registered tick listeners
|
|
|
*/
|
|
|
- private ConcurrentLinkedQueue<PhysicsTickListener> tickListeners = new ConcurrentLinkedQueue<PhysicsTickListener>();
|
|
|
+ private ConcurrentLinkedQueue<PhysicsTickListener> tickListeners = new ConcurrentLinkedQueue<>();
|
|
|
/**
|
|
|
* list of registered collision listeners
|
|
|
*/
|
|
@@ -156,7 +156,7 @@ public class PhysicsSpace {
|
|
|
/**
|
|
|
* queue of collision events not yet distributed to listeners
|
|
|
*/
|
|
|
- private ArrayDeque<PhysicsCollisionEvent> collisionEvents = new ArrayDeque<PhysicsCollisionEvent>();
|
|
|
+ private ArrayDeque<PhysicsCollisionEvent> collisionEvents = new ArrayDeque<>();
|
|
|
private PhysicsCollisionEventFactory eventFactory = new PhysicsCollisionEventFactory();
|
|
|
/**
|
|
|
* copy of minimum coordinate values when using AXIS_SWEEP broadphase
|
|
@@ -405,7 +405,7 @@ public class PhysicsSpace {
|
|
|
}
|
|
|
|
|
|
public static <V> Future<V> enqueueOnThisThread(Callable<V> callable) {
|
|
|
- AppTask<V> task = new AppTask<V>(callable);
|
|
|
+ AppTask<V> task = new AppTask<>(callable);
|
|
|
System.out.println("created apptask");
|
|
|
pQueueTL.get().add(task);
|
|
|
return task;
|
|
@@ -418,7 +418,7 @@ public class PhysicsSpace {
|
|
|
* @return a new AppTask
|
|
|
*/
|
|
|
public <V> Future<V> enqueue(Callable<V> callable) {
|
|
|
- AppTask<V> task = new AppTask<V>(callable);
|
|
|
+ AppTask<V> task = new AppTask<>(callable);
|
|
|
pQueue.add(task);
|
|
|
return task;
|
|
|
}
|
|
@@ -760,7 +760,7 @@ public class PhysicsSpace {
|
|
|
* Performs a ray collision test and returns the results as a list of PhysicsRayTestResults
|
|
|
*/
|
|
|
public List<PhysicsRayTestResult> rayTest(Vector3f from, Vector3f to) {
|
|
|
- List<PhysicsRayTestResult> results = new LinkedList<PhysicsRayTestResult>();
|
|
|
+ List<PhysicsRayTestResult> results = new LinkedList<>();
|
|
|
dynamicsWorld.rayTest(Converter.convert(from, rayVec1), Converter.convert(to, rayVec2), new InternalRayListener(results));
|
|
|
return results;
|
|
|
}
|
|
@@ -796,7 +796,7 @@ public class PhysicsSpace {
|
|
|
* SweepTest will not see a collision if it starts INSIDE an object and is moving AWAY from its center.
|
|
|
*/
|
|
|
public List<PhysicsSweepTestResult> sweepTest(CollisionShape shape, Transform start, Transform end) {
|
|
|
- List<PhysicsSweepTestResult> results = new LinkedList<PhysicsSweepTestResult>();
|
|
|
+ List<PhysicsSweepTestResult> results = new LinkedList<>();
|
|
|
if (!(shape.getCShape() instanceof ConvexShape)) {
|
|
|
logger.log(Level.WARNING, "Trying to sweep test with incompatible mesh shape!");
|
|
|
return results;
|