/** Computes this Spatial's world bounding volume in the most efficient manner possible. */ void checkDoBoundUpdate() { if ((refreshFlags & RF_BOUND) == 0) { return; } checkDoTransformUpdate(); // Go to children recursively and update their bound if (this instanceof Node) { Node node = (Node) this; int len = node.getQuantity(); for (int i = 0; i < len; i++) { Spatial child = node.getChild(i); child.checkDoBoundUpdate(); } } // All children's bounds have been updated. Update my own now. updateWorldBound(); }
/** * Convert a vector (in) from world coordinate space to this spatials' local coordinate space. * * @param in vector to read from * @param store where to write the result * @return the result (store) */ public Vector3f worldToLocal(final Vector3f in, final Vector3f store) { checkDoTransformUpdate(); return worldTransform.transformInverseVector(in, store); }
/** * Convert a vector (in) from this spatials' local coordinate space to world coordinate space. * * @param in vector to read from * @param store where to write the result (null to create a new vector, may be same as in) * @return the result (store) */ public Vector3f localToWorld(final Vector3f in, Vector3f store) { checkDoTransformUpdate(); return worldTransform.transformVector(in, store); }
/** * <code>getWorldTransform</code> retrieves the world transformation of the spatial. * * @return the world transform. */ public Transform getWorldTransform() { checkDoTransformUpdate(); return worldTransform; }
/** * <code>getWorldScale</code> retrieves the absolute scale factor of the spatial. * * @return the Spatial's world scale factor. */ public Vector3f getWorldScale() { checkDoTransformUpdate(); return worldTransform.getScale(); }
/** * <code>getWorldTranslation</code> retrieves the absolute translation of the spatial. * * @return the Spatial's world tranlsation vector. */ public Vector3f getWorldTranslation() { checkDoTransformUpdate(); return worldTransform.getTranslation(); }
/** * <code>getWorldRotation</code> retrieves the absolute rotation of the Spatial. * * @return the Spatial's world rotation quaternion. */ public Quaternion getWorldRotation() { checkDoTransformUpdate(); return worldTransform.getRotation(); }