Search in sources :

Example 1 with IPerspectiveAwareModel

use of net.minecraftforge.client.model.IPerspectiveAwareModel in project MinecraftForge by MinecraftForge.

the class ForgeHooksClient method handleCameraTransforms.

@SuppressWarnings("deprecation")
public static IBakedModel handleCameraTransforms(IBakedModel model, ItemCameraTransforms.TransformType cameraTransformType, boolean leftHandHackery) {
    if (model instanceof IPerspectiveAwareModel) {
        Pair<? extends IBakedModel, Matrix4f> pair = ((IPerspectiveAwareModel) model).handlePerspective(cameraTransformType);
        if (pair.getRight() != null) {
            Matrix4f matrix = new Matrix4f(pair.getRight());
            if (leftHandHackery) {
                matrix.mul(flipX, matrix);
                matrix.mul(matrix, flipX);
            }
            multiplyCurrentGlMatrix(matrix);
        }
        return pair.getLeft();
    } else {
        //if(leftHandHackery) GlStateManager.scale(-1, 1, 1);
        ItemCameraTransforms.applyTransformSide(model.getItemCameraTransforms().getTransform(cameraTransformType), leftHandHackery);
    //if(leftHandHackery) GlStateManager.scale(-1, 1, 1);
    }
    return model;
}
Also used : Matrix4f(javax.vecmath.Matrix4f) IPerspectiveAwareModel(net.minecraftforge.client.model.IPerspectiveAwareModel)

Aggregations

Matrix4f (javax.vecmath.Matrix4f)1 IPerspectiveAwareModel (net.minecraftforge.client.model.IPerspectiveAwareModel)1