@Override public void updateModelTransform(Transform localTransform, Joint parent) { modelTransform.set(localTransform); if (parent != null) { modelTransform.combineWithParent(parent.getModelTransform()); } }
/** * Should only be called from updateGeometricState(). * In most cases should not be subclassed. */ protected void updateWorldTransforms() { if (parent == null) { worldTransform.set(localTransform); refreshFlags &= ~RF_TRANSFORM; } else { // check if transform for parent is updated assert ((parent.refreshFlags & RF_TRANSFORM) == 0); worldTransform.set(localTransform); worldTransform.combineWithParent(parent.worldTransform); refreshFlags &= ~RF_TRANSFORM; } }
@Override public void applyBindPose(Transform localTransform, Matrix4f inverseModelBindMatrix, Joint parent) { localTransform.fromTransformMatrix(inverseModelBindMatrix.invert()); if (parent != null) { localTransform.combineWithParent(parent.getModelTransform().invert()); } }
private static void relocateSpatial(Spatial spatial, Transform originalWorldTransform, Transform newWorldTransform) { Transform localTransform = new Transform(); localTransform.set(originalWorldTransform); localTransform.combineWithParent(newWorldTransform.invert()); spatial.setLocalTransform(localTransform); }
/** * Calculate the correct transform for a collision shape relative to the * ancestor for which the shape was generated. * * @param spat * @param parent * @return a new instance (not null) */ private static Transform getTransform(Spatial spat, Spatial parent) { Transform shapeTransform = new Transform(); Spatial parentNode = spat.getParent() != null ? spat.getParent() : spat; Spatial currentSpatial = spat; //if we have parents combine their transforms while (parentNode != null) { if (parent == currentSpatial) { //real parent -> only apply scale, not transform Transform trans = new Transform(); trans.setScale(currentSpatial.getLocalScale()); shapeTransform.combineWithParent(trans); parentNode = null; } else { shapeTransform.combineWithParent(currentSpatial.getLocalTransform()); parentNode = currentSpatial.getParent(); currentSpatial = parentNode; } } return shapeTransform; }
/** * Calculate the correct transform for a collision shape relative to the * ancestor for which the shape was generated. * * @param spat * @param parent * @return a new instance (not null) */ private static Transform getTransform(Spatial spat, Spatial parent) { Transform shapeTransform = new Transform(); Spatial parentNode = spat.getParent() != null ? spat.getParent() : spat; Spatial currentSpatial = spat; //if we have parents combine their transforms while (parentNode != null) { if (parent == currentSpatial) { //real parent -> only apply scale, not transform Transform trans = new Transform(); trans.setScale(currentSpatial.getLocalScale()); shapeTransform.combineWithParent(trans); parentNode = null; } else { shapeTransform.combineWithParent(currentSpatial.getLocalTransform()); parentNode = currentSpatial.getParent(); currentSpatial = parentNode; } } return shapeTransform; }
case ScaleBeforeChildRotation: jmeWorldNodeTransform.set(jmeLocalNodeTransform); jmeWorldNodeTransform.combineWithParent(jmeParentNodeTransform); break; jmeLocalBindPose.combineWithParent(parentBindPose.invert()); if (parentBindPose != null) { jmeWorldBindPose.set(jmeLocalNodeTransform); jmeWorldBindPose.combineWithParent(parentBindPose); } else { jmeWorldBindPose.set(jmeWorldNodeTransform);
private static void applyInverse(Vector3f translation, Quaternion rotation, Vector3f scale, Transform inverseBindPose) { Transform t = new Transform(); t.setTranslation(translation); t.setRotation(rotation); if (scale != null) { t.setScale(scale); } t.combineWithParent(inverseBindPose); t.getTranslation(translation); t.getRotation(rotation); if (scale != null) { t.getScale(scale); } }
attachNode.setLocalRotation(modelRot); attachNode.setLocalScale(modelScale); attachNode.getLocalTransform().combineWithParent(attachNode.getParent().getWorldTransform().invert()); combined.combineWithParent(localTransform); loopSpatial = loopSpatial.getParent();
combined.combineWithParent(localTransform); loopSpatial = loopSpatial.getParent();
public static void transform(Transform matrixToModify, Transform transformToApply) { matrixToModify.combineWithParent(transformToApply); }
public static void transform(Transform matrixToModify, Transform transformToApply) { matrixToModify.combineWithParent(transformToApply); }
public static void multiply(Transform matrix, Transform transformToApply, Transform result) { result.set(matrix); result.combineWithParent(transformToApply); }
public static void multiply(Transform matrix, Transform transformToApply, Transform result) { result.set(matrix); result.combineWithParent(transformToApply); }
public static Transform multiply(Transform matrix, Transform transformToApply) { Transform temp = new Transform(); temp.set(matrix); temp.combineWithParent(transformToApply); return temp; }
public static Transform multiply(Transform matrix, Transform transformToApply) { Transform temp = new Transform(); temp.set(matrix); temp.combineWithParent(transformToApply); return temp; }
private static void relocateSpatial(Spatial spatial, Transform originalWorldTransform, Transform newWorldTransform) { Transform localTransform = new Transform(); localTransform.set(originalWorldTransform); localTransform.combineWithParent(newWorldTransform.invert()); spatial.setLocalTransform(localTransform); }
private void pushScale(Transform transform, DAENode node, MeasuringUnit unit) { TransformedValue<Vector3f> vector = node.getContent(VECTOR); checkTrue(vector.isDefined()); Transform t = newIdentity(); t.setScale(vector.get()); t.combineWithParent(transform); transform.set(t); }
private static void applyInverse(Vector3f translation, Quaternion rotation, Vector3f scale, Transform inverseBindPose) { Transform t = new Transform(); t.setTranslation(translation); t.setRotation(rotation); if (scale != null) { t.setScale(scale); } t.combineWithParent(inverseBindPose); t.getTranslation(translation); t.getRotation(rotation); if (scale != null) { t.getScale(scale); } }
private void pushTranslate(Transform transform, DAENode node, MeasuringUnit unit) { TransformedValue<Vector3f> data = node.getContent(VECTOR); checkTrue(data.isDefined(), node + " is not a three float container?"); Vector3f vec = data.get().mult(unit.getMeter()); Transform t = newIdentity(); t.setTranslation(vec); t.combineWithParent(transform); transform.set(t); }