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:
@@ -60,7 +60,9 @@ public final class GltfLiveBoneReader {
|
||||
* @return array of joint matrices ready for skinning, or null on failure
|
||||
*/
|
||||
public static Matrix4f[] computeJointMatricesFromModel(
|
||||
HumanoidModel<?> model, GltfData data, LivingEntity entity
|
||||
HumanoidModel<?> model,
|
||||
GltfData data,
|
||||
LivingEntity entity
|
||||
) {
|
||||
if (model == null || data == null || entity == null) return null;
|
||||
|
||||
@@ -83,14 +85,19 @@ public final class GltfLiveBoneReader {
|
||||
if (GltfBoneMapper.isLowerBone(boneName)) {
|
||||
// --- Lower bone: reconstruct from bend values ---
|
||||
localRot = computeLowerBoneLocalRotation(
|
||||
boneName, j, restRotations, emote
|
||||
boneName,
|
||||
j,
|
||||
restRotations,
|
||||
emote
|
||||
);
|
||||
} else if (hasUniqueModelPart(boneName)) {
|
||||
// --- Upper bone with a unique ModelPart ---
|
||||
ModelPart part = GltfBoneMapper.getModelPart(model, boneName);
|
||||
if (part != null) {
|
||||
localRot = computeUpperBoneLocalRotation(
|
||||
part, j, restRotations
|
||||
part,
|
||||
j,
|
||||
restRotations
|
||||
);
|
||||
} else {
|
||||
// Fallback: use rest rotation
|
||||
@@ -108,14 +115,17 @@ public final class GltfLiveBoneReader {
|
||||
|
||||
// Compose with parent to get world transform
|
||||
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;
|
||||
@@ -138,11 +148,16 @@ public final class GltfLiveBoneReader {
|
||||
* the frame relationship.
|
||||
*/
|
||||
private static Quaternionf computeUpperBoneLocalRotation(
|
||||
ModelPart part, int jointIndex,
|
||||
ModelPart part,
|
||||
int jointIndex,
|
||||
Quaternionf[] restRotations
|
||||
) {
|
||||
// Reconstruct the MC-frame delta from ModelPart euler angles.
|
||||
Quaternionf delta = new Quaternionf().rotationZYX(part.zRot, part.yRot, part.xRot);
|
||||
Quaternionf delta = new Quaternionf().rotationZYX(
|
||||
part.zRot,
|
||||
part.yRot,
|
||||
part.xRot
|
||||
);
|
||||
// Local rotation = delta applied on top of the local rest rotation.
|
||||
return new Quaternionf(delta).mul(restRotations[jointIndex]);
|
||||
}
|
||||
@@ -160,7 +175,8 @@ public final class GltfLiveBoneReader {
|
||||
* No de-parenting needed — same reasoning as upper bones.
|
||||
*/
|
||||
private static Quaternionf computeLowerBoneLocalRotation(
|
||||
String boneName, int jointIndex,
|
||||
String boneName,
|
||||
int jointIndex,
|
||||
Quaternionf[] restRotations,
|
||||
AnimationApplier emote
|
||||
) {
|
||||
@@ -183,11 +199,16 @@ public final class GltfLiveBoneReader {
|
||||
float halfAngle = bendValue * 0.5f;
|
||||
float s = (float) Math.sin(halfAngle);
|
||||
Quaternionf bendQuat = new Quaternionf(
|
||||
ax * s, 0, az * s, (float) Math.cos(halfAngle)
|
||||
ax * s,
|
||||
0,
|
||||
az * s,
|
||||
(float) Math.cos(halfAngle)
|
||||
);
|
||||
|
||||
// Local rotation = bend delta applied on top of local rest rotation
|
||||
return new Quaternionf(bendQuat).mul(restRotations[jointIndex]);
|
||||
return new Quaternionf(bendQuat).mul(
|
||||
restRotations[jointIndex]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -218,12 +239,12 @@ public final class GltfLiveBoneReader {
|
||||
// LivingEntityRenderer's PoseStack transform, which applies to the entire
|
||||
// mesh uniformly. No need to read body rotation into joint matrices.
|
||||
return switch (boneName) {
|
||||
case "head" -> true;
|
||||
case "head" -> true;
|
||||
case "leftUpperArm" -> true;
|
||||
case "rightUpperArm"-> true;
|
||||
case "rightUpperArm" -> true;
|
||||
case "leftUpperLeg" -> true;
|
||||
case "rightUpperLeg"-> true;
|
||||
default -> false; // body, torso, lower bones, unknown
|
||||
case "rightUpperLeg" -> true;
|
||||
default -> false; // body, torso, lower bones, unknown
|
||||
};
|
||||
}
|
||||
|
||||
@@ -236,8 +257,11 @@ public final class GltfLiveBoneReader {
|
||||
try {
|
||||
return animated.playerAnimator_getAnimation();
|
||||
} catch (Exception e) {
|
||||
LOGGER.debug("[GltfPipeline] Could not get AnimationApplier for {}: {}",
|
||||
entity.getClass().getSimpleName(), e.getMessage());
|
||||
LOGGER.debug(
|
||||
"[GltfPipeline] Could not get AnimationApplier for {}: {}",
|
||||
entity.getClass().getSimpleName(),
|
||||
e.getMessage()
|
||||
);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user