Exemple #1
0
 /**
  * Sets the position of this LOD node. This position is specified in the local coordinates of this
  * node, and is the position from which the distance to the viewer is computed.
  *
  * @param position the new position
  */
 public void setPosition(Point3f position) {
   if (((NodeRetained) retained).staticTransform != null) {
     ((NodeRetained) retained).staticTransform.transform.transform(position, this.position);
   } else {
     this.position.set(position);
   }
 }
  void computeCombineBounds(Bounds bounds) {
    // Issue 514 : NPE in Wonderland : triggered in cached bounds computation
    if (validCachedBounds && boundsAutoCompute) {
      Bounds b = (Bounds) cachedBounds.clone();
      // Should this be lock too ? ( MT safe  ? )
      // Thoughts :
      // Make a temp copy with lock :  transform.getWithLock(trans);, but this will cause gc ...
      synchronized (transform) {
        b.transform(transform);
      }
      bounds.combine(b);
      return;
    }

    NodeRetained child;
    // issue 544
    Bounds boundingObject = null;
    if (VirtualUniverse.mc.useBoxForGroupBounds) {
      boundingObject = new BoundingBox((Bounds) null);
    } else {
      boundingObject = new BoundingSphere();
      ((BoundingSphere) boundingObject).setRadius(-1.0);
    }
    if (boundsAutoCompute) {
      for (int i = children.size() - 1; i >= 0; i--) {
        child = (NodeRetained) children.get(i);
        if (child != null) child.computeCombineBounds(boundingObject);
      }

      if (VirtualUniverse.mc.cacheAutoComputedBounds) {
        cachedBounds = (Bounds) boundingObject.clone();
      }
    } else {
      // Should this be lock too ? ( MT safe  ? )
      synchronized (localBounds) {
        boundingObject.set(localBounds);
      }
    }

    // Should this be lock too ? ( MT safe  ? )
    // Thoughts :
    // Make a temp copy with lock :  transform.getWithLock(trans);, but this will cause gc ...
    synchronized (transform) {
      boundingObject.transform(transform);
    }
    bounds.combine(boundingObject);
  }
  @Override
  void childDoSetLive(NodeRetained child, int childIndex, SetLiveState s) {

    int i;
    s.childSwitchLinks = childrenSwitchLinks.get(childIndex);
    s.switchStates = switchStates;

    if (child != null) child.setLive(s);
  }
  void childCheckSetLive(
      NodeRetained child, int childIndex, SetLiveState s, NodeRetained linkNode) {
    s.currentTransforms = childLocalToVworld;
    s.currentTransformsIndex = childLocalToVworldIndex;
    s.parentTransformLink = this;
    s.childTransformLinks = childTransformLinks;
    s.localToVworld = s.currentTransforms;
    s.localToVworldIndex = s.currentTransformsIndex;

    child.setLive(s);
  }
 void childCheckSetLive(NodeRetained child, int childIndex, SetLiveState s) {
   s.childTransformLinks = childTransformLinks;
   s.parentTransformLink = this;
   child.setLive(s);
 }