AnimationChannel.java
net.minecraft.client.animation.AnimationChannel
信息
- 全限定名:net.minecraft.client.animation.AnimationChannel
- 类型:public record
- 包:net.minecraft.client.animation
- 源码路径:src/main/java/net/minecraft/client/animation/AnimationChannel.java
- 起始行号:L11
- 职责:
TODO
字段/常量
- 无
内部类/嵌套类型
-
net.minecraft.client.animation.AnimationChannel.Interpolation- 类型:
interface - 修饰符:
public - 源码定位:
L13 - 说明:
TODO
- 类型:
-
net.minecraft.client.animation.AnimationChannel.Interpolations- 类型:
class - 修饰符:
public static - 源码定位:
L18 - 说明:
TODO
- 类型:
-
net.minecraft.client.animation.AnimationChannel.Target- 类型:
interface - 修饰符:
public - 源码定位:
L39 - 说明:
TODO
- 类型:
-
net.minecraft.client.animation.AnimationChannel.Targets- 类型:
class - 修饰符:
public static - 源码定位:
L44 - 说明:
TODO
- 类型:
构造器
- 无
方法
下面的方法块按源码顺序生成。
- 无
代码
@OnlyIn(Dist.CLIENT)
public record AnimationChannel(AnimationChannel.Target target, Keyframe... keyframes) {
@OnlyIn(Dist.CLIENT)
public interface Interpolation {
Vector3f apply(final Vector3f vector, final float alpha, final Keyframe[] keyframes, final int prev, final int next, final float targetScale);
}
@OnlyIn(Dist.CLIENT)
public static class Interpolations {
public static final AnimationChannel.Interpolation LINEAR = (vector, alpha, keyframes, prev, next, targetScale) -> {
Vector3fc point0 = keyframes[prev].postTarget();
Vector3fc point1 = keyframes[next].preTarget();
return point0.lerp(point1, alpha, vector).mul(targetScale);
};
public static final AnimationChannel.Interpolation CATMULLROM = (vector, alpha, keyframes, prev, next, targetScale) -> {
Vector3fc point0 = keyframes[Math.max(0, prev - 1)].postTarget();
Vector3fc point1 = keyframes[prev].postTarget();
Vector3fc point2 = keyframes[next].postTarget();
Vector3fc point3 = keyframes[Math.min(keyframes.length - 1, next + 1)].postTarget();
vector.set(
Mth.catmullrom(alpha, point0.x(), point1.x(), point2.x(), point3.x()) * targetScale,
Mth.catmullrom(alpha, point0.y(), point1.y(), point2.y(), point3.y()) * targetScale,
Mth.catmullrom(alpha, point0.z(), point1.z(), point2.z(), point3.z()) * targetScale
);
return vector;
};
}
@OnlyIn(Dist.CLIENT)
public interface Target {
void apply(final ModelPart animationBone, final Vector3f target);
}
@OnlyIn(Dist.CLIENT)
public static class Targets {
public static final AnimationChannel.Target POSITION = ModelPart::offsetPos;
public static final AnimationChannel.Target ROTATION = ModelPart::offsetRotation;
public static final AnimationChannel.Target SCALE = ModelPart::offsetScale;
}
}引用的其他类
- Mth
- 引用位置:
方法调用 - 关联成员:
Mth.catmullrom()
- 引用位置: