Search in sources :

Example 1 with Transformation

use of net.minecraft.client.render.model.json.Transformation in project fabric by FabricMC.

the class ModelHelper method makeTransform.

/**
 * The vanilla model transformation logic is closely coupled with model deserialization.
 * That does little good for modded model loaders and procedurally generated models.
 * This convenient construction method applies the same scaling factors used for vanilla models.
 * This means you can use values from a vanilla JSON file as inputs to this method.
 */
private static Transformation makeTransform(float rotationX, float rotationY, float rotationZ, float translationX, float translationY, float translationZ, float scaleX, float scaleY, float scaleZ) {
    Vector3f translation = new Vector3f(translationX, translationY, translationZ);
    translation.scale(0.0625f);
    translation.clamp(-5.0F, 5.0F);
    return new Transformation(new Vector3f(rotationX, rotationY, rotationZ), translation, new Vector3f(scaleX, scaleY, scaleZ));
}
Also used : Transformation(net.minecraft.client.render.model.json.Transformation) ModelTransformation(net.minecraft.client.render.model.json.ModelTransformation) Vector3f(net.minecraft.client.util.math.Vector3f)

Aggregations

ModelTransformation (net.minecraft.client.render.model.json.ModelTransformation)1 Transformation (net.minecraft.client.render.model.json.Transformation)1 Vector3f (net.minecraft.client.util.math.Vector3f)1