Remove internal phase comments and format code
Strip all Phase references, TODO/FUTURE roadmap notes, and internal planning comments from the codebase. Run Prettier for consistent formatting across all Java files.
This commit is contained in:
@@ -43,7 +43,9 @@ public final class GltfSkinningEngine {
|
||||
* @return interpolated joint matrices ready for skinning
|
||||
*/
|
||||
public static Matrix4f[] computeJointMatricesAnimated(
|
||||
GltfData data, GltfData.AnimationClip clip, float time
|
||||
GltfData data,
|
||||
GltfData.AnimationClip clip,
|
||||
float time
|
||||
) {
|
||||
int jointCount = data.jointCount();
|
||||
Matrix4f[] jointMatrices = new Matrix4f[jointCount];
|
||||
@@ -59,14 +61,17 @@ public final class GltfSkinningEngine {
|
||||
|
||||
// Compose with parent
|
||||
if (parents[j] >= 0 && worldTransforms[parents[j]] != null) {
|
||||
worldTransforms[j] = new Matrix4f(worldTransforms[parents[j]]).mul(local);
|
||||
worldTransforms[j] = new Matrix4f(
|
||||
worldTransforms[parents[j]]
|
||||
).mul(local);
|
||||
} else {
|
||||
worldTransforms[j] = new Matrix4f(local);
|
||||
}
|
||||
|
||||
// Final joint matrix = worldTransform * inverseBindMatrix
|
||||
jointMatrices[j] = new Matrix4f(worldTransforms[j])
|
||||
.mul(data.inverseBindMatrices()[j]);
|
||||
jointMatrices[j] = new Matrix4f(worldTransforms[j]).mul(
|
||||
data.inverseBindMatrices()[j]
|
||||
);
|
||||
}
|
||||
|
||||
return jointMatrices;
|
||||
@@ -75,7 +80,10 @@ public final class GltfSkinningEngine {
|
||||
/**
|
||||
* Internal: compute joint matrices from a specific animation clip.
|
||||
*/
|
||||
private static Matrix4f[] computeJointMatricesFromClip(GltfData data, GltfData.AnimationClip clip) {
|
||||
private static Matrix4f[] computeJointMatricesFromClip(
|
||||
GltfData data,
|
||||
GltfData.AnimationClip clip
|
||||
) {
|
||||
int jointCount = data.jointCount();
|
||||
Matrix4f[] jointMatrices = new Matrix4f[jointCount];
|
||||
Matrix4f[] worldTransforms = new Matrix4f[jointCount];
|
||||
@@ -90,14 +98,17 @@ public final class GltfSkinningEngine {
|
||||
|
||||
// Compose with parent
|
||||
if (parents[j] >= 0 && worldTransforms[parents[j]] != null) {
|
||||
worldTransforms[j] = new Matrix4f(worldTransforms[parents[j]]).mul(local);
|
||||
worldTransforms[j] = new Matrix4f(
|
||||
worldTransforms[parents[j]]
|
||||
).mul(local);
|
||||
} else {
|
||||
worldTransforms[j] = new Matrix4f(local);
|
||||
}
|
||||
|
||||
// Final joint matrix = worldTransform * inverseBindMatrix
|
||||
jointMatrices[j] = new Matrix4f(worldTransforms[j])
|
||||
.mul(data.inverseBindMatrices()[j]);
|
||||
jointMatrices[j] = new Matrix4f(worldTransforms[j]).mul(
|
||||
data.inverseBindMatrices()[j]
|
||||
);
|
||||
}
|
||||
|
||||
return jointMatrices;
|
||||
@@ -107,9 +118,16 @@ public final class GltfSkinningEngine {
|
||||
* Get the animation rotation for a joint (MC-converted).
|
||||
* Falls back to rest rotation if no animation.
|
||||
*/
|
||||
private static Quaternionf getAnimRotation(GltfData data, GltfData.AnimationClip clip, int jointIndex) {
|
||||
if (clip != null && jointIndex < clip.rotations().length
|
||||
&& clip.rotations()[jointIndex] != null) {
|
||||
private static Quaternionf getAnimRotation(
|
||||
GltfData data,
|
||||
GltfData.AnimationClip clip,
|
||||
int jointIndex
|
||||
) {
|
||||
if (
|
||||
clip != null &&
|
||||
jointIndex < clip.rotations().length &&
|
||||
clip.rotations()[jointIndex] != null
|
||||
) {
|
||||
return clip.rotations()[jointIndex][0]; // first frame
|
||||
}
|
||||
return data.restRotations()[jointIndex];
|
||||
@@ -119,10 +137,17 @@ public final class GltfSkinningEngine {
|
||||
* Get the animation translation for a joint (MC-converted).
|
||||
* Falls back to rest translation if no animation translation exists.
|
||||
*/
|
||||
private static Vector3f getAnimTranslation(GltfData data, GltfData.AnimationClip clip, int jointIndex) {
|
||||
if (clip != null && clip.translations() != null
|
||||
&& jointIndex < clip.translations().length
|
||||
&& clip.translations()[jointIndex] != null) {
|
||||
private static Vector3f getAnimTranslation(
|
||||
GltfData data,
|
||||
GltfData.AnimationClip clip,
|
||||
int jointIndex
|
||||
) {
|
||||
if (
|
||||
clip != null &&
|
||||
clip.translations() != null &&
|
||||
jointIndex < clip.translations().length &&
|
||||
clip.translations()[jointIndex] != null
|
||||
) {
|
||||
return clip.translations()[jointIndex][0]; // first frame
|
||||
}
|
||||
return data.restTranslations()[jointIndex];
|
||||
@@ -144,10 +169,16 @@ public final class GltfSkinningEngine {
|
||||
* @return new Quaternionf with the interpolated rotation (never mutates source data)
|
||||
*/
|
||||
private static Quaternionf getInterpolatedRotation(
|
||||
GltfData data, GltfData.AnimationClip clip, int jointIndex, float time
|
||||
GltfData data,
|
||||
GltfData.AnimationClip clip,
|
||||
int jointIndex,
|
||||
float time
|
||||
) {
|
||||
if (clip == null || jointIndex >= clip.rotations().length
|
||||
|| clip.rotations()[jointIndex] == null) {
|
||||
if (
|
||||
clip == null ||
|
||||
jointIndex >= clip.rotations().length ||
|
||||
clip.rotations()[jointIndex] == null
|
||||
) {
|
||||
// No animation data for this joint -- use rest pose (copy to avoid mutation)
|
||||
Quaternionf rest = data.restRotations()[jointIndex];
|
||||
return new Quaternionf(rest);
|
||||
@@ -187,11 +218,17 @@ public final class GltfSkinningEngine {
|
||||
* @return new Vector3f with the interpolated translation (never mutates source data)
|
||||
*/
|
||||
private static Vector3f getInterpolatedTranslation(
|
||||
GltfData data, GltfData.AnimationClip clip, int jointIndex, float time
|
||||
GltfData data,
|
||||
GltfData.AnimationClip clip,
|
||||
int jointIndex,
|
||||
float time
|
||||
) {
|
||||
if (clip == null || clip.translations() == null
|
||||
|| jointIndex >= clip.translations().length
|
||||
|| clip.translations()[jointIndex] == null) {
|
||||
if (
|
||||
clip == null ||
|
||||
clip.translations() == null ||
|
||||
jointIndex >= clip.translations().length ||
|
||||
clip.translations()[jointIndex] == null
|
||||
) {
|
||||
// No animation data for this joint -- use rest pose (copy to avoid mutation)
|
||||
Vector3f rest = data.restTranslations()[jointIndex];
|
||||
return new Vector3f(rest);
|
||||
@@ -232,9 +269,13 @@ public final class GltfSkinningEngine {
|
||||
* @param tmpNorm pre-allocated scratch Vector4f for normal transforms
|
||||
*/
|
||||
public static void skinVertex(
|
||||
GltfData data, int vertexIdx, Matrix4f[] jointMatrices,
|
||||
float[] outPos, float[] outNormal,
|
||||
Vector4f tmpPos, Vector4f tmpNorm
|
||||
GltfData data,
|
||||
int vertexIdx,
|
||||
Matrix4f[] jointMatrices,
|
||||
float[] outPos,
|
||||
float[] outNormal,
|
||||
Vector4f tmpPos,
|
||||
Vector4f tmpNorm
|
||||
) {
|
||||
float[] positions = data.positions();
|
||||
float[] normals = data.normals();
|
||||
@@ -252,8 +293,12 @@ public final class GltfSkinningEngine {
|
||||
float nz = normals[vertexIdx * 3 + 2];
|
||||
|
||||
// LBS: v_skinned = Σ(w[i] * jointMatrix[j[i]] * v_rest)
|
||||
float sx = 0, sy = 0, sz = 0;
|
||||
float snx = 0, sny = 0, snz = 0;
|
||||
float sx = 0,
|
||||
sy = 0,
|
||||
sz = 0;
|
||||
float snx = 0,
|
||||
sny = 0,
|
||||
snz = 0;
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
int ji = joints[vertexIdx * 4 + i];
|
||||
|
||||
Reference in New Issue
Block a user