Search in sources :

Example 1 with Matrix3f

use of com.mojang.math.Matrix3f in project MinecraftForge by MinecraftForge.

the class ForgeHooksClient method handleCameraTransforms.

public static BakedModel handleCameraTransforms(PoseStack matrixStack, BakedModel model, ItemTransforms.TransformType cameraTransformType, boolean leftHandHackery) {
    PoseStack stack = new PoseStack();
    model = model.handlePerspective(cameraTransformType, stack);
    // If the stack is not empty, the code has added a matrix for us to use.
    if (!stack.clear()) {
        // Apply the transformation to the real matrix stack, flipping for left hand
        Matrix4f tMat = stack.last().pose();
        Matrix3f nMat = stack.last().normal();
        if (leftHandHackery) {
            tMat.multiplyBackward(flipX);
            tMat.multiply(flipX);
            nMat.multiplyBackward(flipXNormal);
            nMat.mul(flipXNormal);
        }
        matrixStack.last().pose().multiply(tMat);
        matrixStack.last().normal().mul(nMat);
    }
    return model;
}
Also used : Matrix4f(com.mojang.math.Matrix4f) Matrix3f(com.mojang.math.Matrix3f)

Aggregations

Matrix3f (com.mojang.math.Matrix3f)1 Matrix4f (com.mojang.math.Matrix4f)1