- remove useless synchonized statements from physics

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9488 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
nor..67 13 years ago
parent a6033d0193
commit 613d519544
  1. 4
      engine/src/bullet/com/jme3/bullet/PhysicsSpace.java
  2. 4
      engine/src/bullet/com/jme3/bullet/objects/VehicleWheel.java
  3. 4
      engine/src/bullet/com/jme3/bullet/objects/infos/RigidBodyMotionState.java
  4. 4
      engine/src/jbullet/com/jme3/bullet/PhysicsSpace.java
  5. 4
      engine/src/jbullet/com/jme3/bullet/objects/VehicleWheel.java
  6. 6
      engine/src/jbullet/com/jme3/bullet/objects/infos/RigidBodyMotionState.java

@ -352,7 +352,7 @@ public class PhysicsSpace {
public void distributeEvents() { public void distributeEvents() {
//add collision callbacks //add collision callbacks
synchronized (collisionEvents) { // synchronized (collisionEvents) {
for (Iterator<PhysicsCollisionEvent> it = collisionEvents.iterator(); it.hasNext();) { for (Iterator<PhysicsCollisionEvent> it = collisionEvents.iterator(); it.hasNext();) {
PhysicsCollisionEvent physicsCollisionEvent = it.next(); PhysicsCollisionEvent physicsCollisionEvent = it.next();
for (PhysicsCollisionListener listener : collisionListeners) { for (PhysicsCollisionListener listener : collisionListeners) {
@ -362,7 +362,7 @@ public class PhysicsSpace {
eventFactory.recycle(physicsCollisionEvent); eventFactory.recycle(physicsCollisionEvent);
it.remove(); it.remove();
} }
} // }
} }
public static <V> Future<V> enqueueOnThisThread(Callable<V> callable) { public static <V> Future<V> enqueueOnThisThread(Callable<V> callable) {

@ -86,7 +86,7 @@ public class VehicleWheel implements Savable {
this.radius = radius; this.radius = radius;
} }
public synchronized void updatePhysicsState() { public void updatePhysicsState() {
getWheelLocation(wheelId, wheelIndex, wheelWorldLocation); getWheelLocation(wheelId, wheelIndex, wheelWorldLocation);
getWheelRotation(wheelId, wheelIndex, tmp_Matrix); getWheelRotation(wheelId, wheelIndex, tmp_Matrix);
wheelWorldRotation.fromRotationMatrix(tmp_Matrix); wheelWorldRotation.fromRotationMatrix(tmp_Matrix);
@ -96,7 +96,7 @@ public class VehicleWheel implements Savable {
private native void getWheelRotation(long vehicleId, int wheelId, Matrix3f location); private native void getWheelRotation(long vehicleId, int wheelId, Matrix3f location);
public synchronized void applyWheelTransform() { public void applyWheelTransform() {
if (wheelSpatial == null) { if (wheelSpatial == null) {
return; return;
} }

@ -65,7 +65,7 @@ public class RigidBodyMotionState {
* applies the current transform to the given jme Node if the location has been updated on the physics side * applies the current transform to the given jme Node if the location has been updated on the physics side
* @param spatial * @param spatial
*/ */
public synchronized boolean applyTransform(Spatial spatial) { public boolean applyTransform(Spatial spatial) {
Vector3f localLocation = spatial.getLocalTranslation(); Vector3f localLocation = spatial.getLocalTranslation();
Quaternion localRotationQuat = spatial.getLocalRotation(); Quaternion localRotationQuat = spatial.getLocalRotation();
boolean physicsLocationDirty = applyTransform(motionStateId, localLocation, localRotationQuat); boolean physicsLocationDirty = applyTransform(motionStateId, localLocation, localRotationQuat);
@ -94,7 +94,7 @@ public class RigidBodyMotionState {
return true; return true;
} }
private synchronized native boolean applyTransform(long stateId, Vector3f location, Quaternion rotation); private native boolean applyTransform(long stateId, Vector3f location, Quaternion rotation);
/** /**
* @return the worldLocation * @return the worldLocation

@ -326,7 +326,7 @@ public class PhysicsSpace {
public void distributeEvents() { public void distributeEvents() {
//add collision callbacks //add collision callbacks
synchronized (collisionEvents) { // synchronized (collisionEvents) {
for (Iterator<PhysicsCollisionEvent> it = collisionEvents.iterator(); it.hasNext();) { for (Iterator<PhysicsCollisionEvent> it = collisionEvents.iterator(); it.hasNext();) {
PhysicsCollisionEvent physicsCollisionEvent = it.next(); PhysicsCollisionEvent physicsCollisionEvent = it.next();
for (PhysicsCollisionListener listener : collisionListeners) { for (PhysicsCollisionListener listener : collisionListeners) {
@ -336,7 +336,7 @@ public class PhysicsSpace {
eventFactory.recycle(physicsCollisionEvent); eventFactory.recycle(physicsCollisionEvent);
it.remove(); it.remove();
} }
} // }
} }
public static <V> Future<V> enqueueOnThisThread(Callable<V> callable) { public static <V> Future<V> enqueueOnThisThread(Callable<V> callable) {

@ -86,13 +86,13 @@ public class VehicleWheel implements Savable {
this.radius = radius; this.radius = radius;
} }
public synchronized void updatePhysicsState() { public void updatePhysicsState() {
Converter.convert(wheelInfo.worldTransform.origin, wheelWorldLocation); Converter.convert(wheelInfo.worldTransform.origin, wheelWorldLocation);
Converter.convert(wheelInfo.worldTransform.basis, tmp_Matrix); Converter.convert(wheelInfo.worldTransform.basis, tmp_Matrix);
wheelWorldRotation.fromRotationMatrix(tmp_Matrix); wheelWorldRotation.fromRotationMatrix(tmp_Matrix);
} }
public synchronized void applyWheelTransform() { public void applyWheelTransform() {
if (wheelSpatial == null) { if (wheelSpatial == null) {
return; return;
} }

@ -71,7 +71,7 @@ public class RigidBodyMotionState extends MotionState {
* @param t * @param t
* @return * @return
*/ */
public synchronized Transform getWorldTransform(Transform t) { public Transform getWorldTransform(Transform t) {
t.set(motionStateTrans); t.set(motionStateTrans);
return t; return t;
} }
@ -80,7 +80,7 @@ public class RigidBodyMotionState extends MotionState {
* called from bullet when the transform of the rigidbody changes * called from bullet when the transform of the rigidbody changes
* @param worldTrans * @param worldTrans
*/ */
public synchronized void setWorldTransform(Transform worldTrans) { public void setWorldTransform(Transform worldTrans) {
if (jmeLocationDirty) { if (jmeLocationDirty) {
return; return;
} }
@ -102,7 +102,7 @@ public class RigidBodyMotionState extends MotionState {
* applies the current transform to the given jme Node if the location has been updated on the physics side * applies the current transform to the given jme Node if the location has been updated on the physics side
* @param spatial * @param spatial
*/ */
public synchronized boolean applyTransform(Spatial spatial) { public boolean applyTransform(Spatial spatial) {
if (!physicsLocationDirty) { if (!physicsLocationDirty) {
return false; return false;
} }

Loading…
Cancel
Save