Ejemplo n.º 1
0
 /**
  * Atomically Sets the parent of this transform
  *
  * @param parent
  */
 @Threadsafe
 public void setParent(Transform parent) {
   int seq = lock.writeLock();
   try {
     this.parent.set(parent);
   } finally {
     lock.writeUnlock(seq);
   }
 }
Ejemplo n.º 2
0
 /**
  * Atomically sets this point to the given components
  *
  * @param point
  */
 @Threadsafe
 public void set(Point p, Quaternion r, Vector3 s) {
   int seq = lock.writeLock();
   try {
     position.directSet(p);
     rotation.directSet(r);
     scale.directSet(s);
   } finally {
     lock.writeUnlock(seq);
   }
 }
Ejemplo n.º 3
0
 /**
  * Atomically sets the value of this transform to the value of another transform
  *
  * @param transform the other transform
  */
 @Threadsafe
 public void set(Transform transform) {
   if (lock == transform.getLock()) {
     throw new IllegalArgumentException(
         "Attemping to set a transform to another transform with the same lock");
   }
   int seq = lock.writeLock();
   try {
     while (true) {
       int seq2 = transform.getLock().readLock();
       position.directSet(transform.getPosition());
       rotation.directSet(transform.getRotation());
       scale.directSet(transform.getScale());
       if (transform.getLock().readUnlock(seq2)) {
         return;
       }
     }
   } finally {
     lock.writeUnlock(seq);
   }
 }
Ejemplo n.º 4
0
 /**
  * Atomically sets the value of this transform.
  *
  * @param world the world
  * @param px the x coordinate of the position
  * @param py the y coordinate of the position
  * @param pz the z coordinate of the position
  * @param rx the x coordinate of the quaternion
  * @param ry the y coordinate of the quaternion
  * @param rz the z coordinate of the quaternion
  * @param rw the w coordinate of the quaternion
  * @param sx the x coordinate of the scale
  * @param sy the y coordinate of the scale
  * @param sz the z coordinate of the scale
  */
 @Threadsafe
 public void set(
     World world,
     float px,
     float py,
     float pz,
     float rx,
     float ry,
     float rz,
     float rw,
     float sx,
     float sy,
     float sz) {
   int seq = lock.writeLock();
   try {
     position.directSet(world, px, py, pz);
     rotation.directSet(rx, ry, rz, rw);
     scale.directSet(sx, sy, sz);
   } finally {
     lock.writeUnlock(seq);
   }
 }