FBX: fix build errors (missing functions that need to be added)
This commit is contained in:
parent
ed2be5e542
commit
aeb1b547ce
@ -313,6 +313,26 @@ public final class Bone implements Savable {
|
||||
return modelBindInverseScale;
|
||||
}
|
||||
|
||||
public Transform getModelBindInverseTransform() {
|
||||
Transform t = new Transform();
|
||||
t.setTranslation(modelBindInversePos);
|
||||
t.setRotation(modelBindInverseRot);
|
||||
if (modelBindInverseScale != null) {
|
||||
t.setScale(modelBindInverseScale);
|
||||
}
|
||||
return t;
|
||||
}
|
||||
|
||||
public Transform getBindInverseTransform() {
|
||||
Transform t = new Transform();
|
||||
t.setTranslation(bindPos);
|
||||
t.setRotation(bindRot);
|
||||
if (bindScale != null) {
|
||||
t.setScale(bindScale);
|
||||
}
|
||||
return t.invert();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use {@link #getBindPosition()}
|
||||
*/
|
||||
|
@ -902,6 +902,25 @@ final public class FastMath {
|
||||
return clamp(input, 0f, 1f);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if two floats are approximately equal.
|
||||
* This takes into account the magnitude of the floats, since
|
||||
* large numbers will have larger differences be close to each other.
|
||||
*
|
||||
* Should return true for a=100000, b=100001, but false for a=10000, b=10001.
|
||||
*
|
||||
* @param a The first float to compare
|
||||
* @param b The second float to compare
|
||||
* @return True if a and b are approximately equal, false otherwise.
|
||||
*/
|
||||
public static boolean approximateEquals(float a, float b) {
|
||||
if (a == b) {
|
||||
return true;
|
||||
} else {
|
||||
return (abs(a - b) / Math.max(abs(a), abs(b))) <= 0.00001f;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a single precision (32 bit) floating point value
|
||||
* into half precision (16 bit).
|
||||
|
@ -259,6 +259,26 @@ public final class Transform implements Savable, Cloneable, java.io.Serializable
|
||||
return store;
|
||||
}
|
||||
|
||||
public Matrix4f toTransformMatrix() {
|
||||
Matrix4f trans = new Matrix4f();
|
||||
trans.setTranslation(translation);
|
||||
trans.setRotationQuaternion(rot);
|
||||
trans.setScale(scale);
|
||||
return trans;
|
||||
}
|
||||
|
||||
public void fromTransformMatrix(Matrix4f mat) {
|
||||
translation.set(mat.toTranslationVector());
|
||||
rot.set(mat.toRotationQuat());
|
||||
scale.set(mat.toScaleVector());
|
||||
}
|
||||
|
||||
public Transform invert() {
|
||||
Transform t = new Transform();
|
||||
t.fromTransformMatrix(toTransformMatrix().invertLocal());
|
||||
return t;
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the identity. Equal to translation=0,0,0 scale=1,1,1 rot=0,0,0,1.
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user