Search in sources :

Example 1 with TRSRTransformation

use of net.minecraftforge.common.model.TRSRTransformation in project MinecraftForge by MinecraftForge.

the class ForgeHooksClient method applyUVLock.

public static BlockFaceUV applyUVLock(BlockFaceUV blockFaceUV, EnumFacing originalSide, ITransformation rotation) {
    TRSRTransformation global = new TRSRTransformation(rotation.getMatrix());
    Matrix4f uv = global.getUVLockTransform(originalSide).getMatrix();
    Vector4f vec = new Vector4f(0, 0, 0, 1);
    vec.x = blockFaceUV.getVertexU(blockFaceUV.getVertexRotatedRev(0)) / 16;
    vec.y = blockFaceUV.getVertexV(blockFaceUV.getVertexRotatedRev(0)) / 16;
    uv.transform(vec);
    // / vec.w;
    float uMin = 16 * vec.x;
    // / vec.w;
    float vMin = 16 * vec.y;
    vec.x = blockFaceUV.getVertexU(blockFaceUV.getVertexRotatedRev(2)) / 16;
    vec.y = blockFaceUV.getVertexV(blockFaceUV.getVertexRotatedRev(2)) / 16;
    vec.z = 0;
    vec.w = 1;
    uv.transform(vec);
    // / vec.w;
    float uMax = 16 * vec.x;
    // / vec.w;
    float vMax = 16 * vec.y;
    if (uMin > uMax) {
        float t = uMin;
        uMin = uMax;
        uMax = t;
    }
    if (vMin > vMax) {
        float t = vMin;
        vMin = vMax;
        vMax = t;
    }
    float a = (float) Math.toRadians(blockFaceUV.rotation);
    Vector3f rv = new Vector3f(MathHelper.cos(a), MathHelper.sin(a), 0);
    Matrix3f rot = new Matrix3f();
    uv.getRotationScale(rot);
    rot.transform(rv);
    int angle = MathHelper.normalizeAngle(-(int) Math.round(Math.toDegrees(Math.atan2(rv.y, rv.x)) / 90) * 90, 360);
    return new BlockFaceUV(new float[] { uMin, vMin, uMax, vMax }, angle);
}
Also used : TRSRTransformation(net.minecraftforge.common.model.TRSRTransformation) Matrix4f(javax.vecmath.Matrix4f) Vector4f(javax.vecmath.Vector4f) Matrix3f(javax.vecmath.Matrix3f) Vector3f(javax.vecmath.Vector3f) BlockFaceUV(net.minecraft.client.renderer.block.model.BlockFaceUV)

Example 2 with TRSRTransformation

use of net.minecraftforge.common.model.TRSRTransformation in project MinecraftForge by MinecraftForge.

the class ModelBlockAnimation method getPartTransform.

@Nullable
public TRSRTransformation getPartTransform(IModelState state, BlockPart part, int i) {
    ImmutableCollection<MBJointWeight> infos = getJoint(i);
    if (!infos.isEmpty()) {
        Matrix4f m = new Matrix4f(), tmp;
        float weight = 0;
        for (MBJointWeight info : infos) {
            if (info.getWeights().containsKey(i)) {
                ModelBlockAnimation.MBJoint joint = new ModelBlockAnimation.MBJoint(info.getName(), part);
                Optional<TRSRTransformation> trOp = state.apply(Optional.of(joint));
                if (trOp.isPresent() && trOp.get() != TRSRTransformation.identity()) {
                    float w = info.getWeights().get(i)[0];
                    tmp = trOp.get().getMatrix();
                    tmp.mul(w);
                    m.add(tmp);
                    weight += w;
                }
            }
        }
        if (weight > 1e-5) {
            m.mul(1f / weight);
            return new TRSRTransformation(m);
        }
    }
    return null;
}
Also used : TRSRTransformation(net.minecraftforge.common.model.TRSRTransformation) Matrix4f(javax.vecmath.Matrix4f) Nullable(javax.annotation.Nullable)

Example 3 with TRSRTransformation

use of net.minecraftforge.common.model.TRSRTransformation in project ImmersiveEngineering by BluSunrize.

the class TileEntityBreakerSwitch method applyTransformations.

@Override
public Optional<TRSRTransformation> applyTransformations(IBlockState object, String group, Optional<TRSRTransformation> transform) {
    Matrix4 mat = transform.isPresent() ? new Matrix4(transform.get().getMatrix()) : new Matrix4();
    mat = mat.translate(.5, 0, .5).rotate(Math.PI / 2 * rotation, 0, 1, 0).translate(-.5, 0, -.5);
    transform = Optional.of(new TRSRTransformation(mat.toMatrix4f()));
    return transform;
}
Also used : TRSRTransformation(net.minecraftforge.common.model.TRSRTransformation) Matrix4(blusunrize.immersiveengineering.common.util.chickenbones.Matrix4)

Example 4 with TRSRTransformation

use of net.minecraftforge.common.model.TRSRTransformation in project ImmersiveEngineering by BluSunrize.

the class TileEntityFluidPipe method getStateFromKey.

//	@Override
//	public HashMap<String, String> getTextureReplacements()
//	{
//		if(pipeCover!=null)
//		{
//			HashMap<String,String> map = new HashMap<String,String>();
////			map.put("cover","minecraft:blocks/stone");
//			Block b = Block.getBlockFromItem(pipeCover.getItem());
//			IBlockState state = b!=null?b.getStateFromMeta(pipeCover.getMetadata()): Blocks.STONE.getDefaultState();
//			IBakedModel model = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getModelForState(state);
//			if(model!=null && model.getParticleTexture()!=null)
//				map.put("cover", model.getParticleTexture().getIconName());
//
//			return map;
//		}
//		return null;
//	}
public static OBJState getStateFromKey(String key) {
    if (!cachedOBJStates.containsKey(key)) {
        ArrayList<String> parts = new ArrayList();
        //new Matrix4();
        Matrix4 rotationMatrix = new Matrix4(TRSRTransformation.identity().getMatrix());
        byte connections = (byte) Integer.parseInt(key.replace("2", "1"), 2);
        int totalConnections = Integer.bitCount(connections);
        boolean straightY = (connections & 3) == 3;
        boolean straightZ = (connections & 12) == 12;
        boolean straightX = (connections & 48) == 48;
        switch(totalConnections) {
            case //stub
            0:
                parts.add("center");
                break;
            case //stopper
            1:
                parts.add("stopper");
                //default: y-
                if (//y+
                (connections & 2) != 0)
                    rotationMatrix.rotate(Math.PI, 0, 0, 1);
                else if (//z-
                (connections & 4) != 0)
                    rotationMatrix.rotate(Math.PI / 2, 1, 0, 0);
                else if (//z+
                (connections & 8) != 0)
                    rotationMatrix.rotate(-Math.PI / 2, 1, 0, 0);
                else if (//x-
                (connections & 16) != 0)
                    rotationMatrix.rotate(-Math.PI / 2, 0, 0, 1);
                else if (//x+
                (connections & 32) != 0)
                    rotationMatrix.rotate(Math.PI / 2, 0, 0, 1);
                parts.add("con_yMin");
                break;
            case //straight or curve
            2:
                if (straightY) {
                    parts.add("pipe_y");
                    if (key.charAt(5) == '2')
                        parts.add("con_yMin");
                    if (key.charAt(4) == 1)
                        parts.add("con_yMax");
                } else if (straightZ) {
                    parts.add("pipe_z");
                    if (key.charAt(3) == '2')
                        parts.add("con_zMin");
                    if (key.charAt(2) == '2')
                        parts.add("con_zMax");
                } else if (straightX) {
                    parts.add("pipe_x");
                    if (key.charAt(1) == '2')
                        parts.add("con_xMin");
                    if (key.charAt(0) == '2')
                        parts.add("con_xMax");
                } else {
                    parts.add("curve");
                    parts.add("con_yMin");
                    parts.add("con_zMin");
                    byte connectTo = (byte) (connections & 60);
                    if (//curve to top or bottom
                    (connections & 3) != 0) {
                        if (//x-
                        connectTo == 16)
                            rotationMatrix.rotate(Math.PI / 2, 0, 1, 0);
                        else if (//x+
                        connectTo == 32)
                            rotationMatrix.rotate(-Math.PI / 2, 0, 1, 0);
                        else if (//z+
                        connectTo == 8)
                            rotationMatrix.rotate(Math.PI, 0, 1, 0);
                        if (//flip to top
                        (connections & 2) != 0)
                            rotationMatrix.rotate(Math.PI, 0, 0, 1);
                    //default: Curve to z-
                    } else //curve to horizontal
                    {
                        rotationMatrix.rotate(-Math.PI / 2, 0, 0, 1);
                        if (//z+ to x+
                        connectTo == 40)
                            rotationMatrix.rotate(Math.PI, 1, 0, 0);
                        else if (//z+ to x-
                        connectTo == 24)
                            rotationMatrix.rotate(-Math.PI / 2, 1, 0, 0);
                        else if (//z- to x+
                        connectTo == 36)
                            rotationMatrix.rotate(Math.PI / 2, 1, 0, 0);
                    //default: z- to x-
                    }
                }
                break;
            case //tcross or tcurve
            3:
                if (//has straight connect
                straightX || straightZ || straightY) {
                    parts.add("tcross");
                    parts.add("con_yMin");
                    parts.add("con_zMin");
                    parts.add("con_zMax");
                    if (straightX) {
                        rotationMatrix.rotate(Math.PI / 2, 0, 1, 0);
                        if (//z-
                        (connections & 4) != 0)
                            rotationMatrix.rotate(Math.PI / 2, 0, 0, 1);
                        else if (//z+
                        (connections & 8) != 0)
                            rotationMatrix.rotate(-Math.PI / 2, 0, 0, 1);
                        else if (//y+
                        (connections & 2) != 0)
                            rotationMatrix.rotate(Math.PI, 0, 0, 1);
                    //default: Curve to y-
                    } else if (straightY) {
                        rotationMatrix.rotate(Math.PI / 2, 1, 0, 0);
                        if (//x-
                        (connections & 16) != 0)
                            rotationMatrix.rotate(-Math.PI / 2, 0, 0, 1);
                        else if (//x+
                        (connections & 32) != 0)
                            rotationMatrix.rotate(Math.PI / 2, 0, 0, 1);
                        else if (//z+
                        (connections & 8) != 0)
                            rotationMatrix.rotate(Math.PI, 0, 0, 1);
                    //default: Curve to z-
                    } else //default:z straight
                    {
                        if (//x-
                        (connections & 16) != 0)
                            rotationMatrix.rotate(-Math.PI / 2, 0, 0, 1);
                        else if (//x+
                        (connections & 32) != 0)
                            rotationMatrix.rotate(Math.PI / 2, 0, 0, 1);
                        else if (//y+
                        (connections & 2) != 0)
                            rotationMatrix.rotate(Math.PI, 0, 0, 1);
                    //default: Curve to y-
                    }
                } else //tcurve
                {
                    parts.add("tcurve");
                    parts.add("con_yMin");
                    parts.add("con_zMin");
                    parts.add("con_xMax");
                    //default y-, z-, x+
                    if (//z+
                    (connections & 8) != 0) {
                        if (//x-
                        (connections & 16) != 0)
                            rotationMatrix.rotate(Math.PI, 0, 1, 0);
                        else
                            rotationMatrix.rotate(-Math.PI / 2, 0, 1, 0);
                    } else //z-
                    {
                        if (//x-
                        (connections & 16) != 0)
                            rotationMatrix.rotate(Math.PI / 2, 0, 1, 0);
                    }
                    if (//y+
                    (connections & 2) != 0)
                        rotationMatrix.rotate(Math.PI / 2, 0, 0, 1);
                }
                break;
            case //cross or complex tcross
            4:
                boolean cross = (straightX && straightZ) || (straightX && straightY) || (straightZ && straightY);
                if (cross) {
                    parts.add("cross");
                    parts.add("con_yMin");
                    parts.add("con_yMax");
                    parts.add("con_zMin");
                    parts.add("con_zMax");
                    if (//x and z
                    !straightY)
                        rotationMatrix.rotate(Math.PI / 2, 0, 0, 1);
                    else if (//x and y
                    straightX)
                        rotationMatrix.rotate(Math.PI / 2, 0, 1, 0);
                } else {
                    parts.add("tcross2");
                    parts.add("con_yMin");
                    parts.add("con_zMin");
                    parts.add("con_zMax");
                    parts.add("con_xMax");
                    if (straightZ) {
                        //default y- z+- x+
                        if (//x-
                        (connections & 16) != 0)
                            rotationMatrix.rotate(Math.PI, 0, 1, 0);
                        if (//y+
                        (connections & 2) != 0)
                            rotationMatrix.rotate(Math.PI / 2, 0, 0, 1);
                    } else if (straightY) {
                        //default y+- z- x+
                        if (//z+
                        (connections & 8) != 0) {
                            rotationMatrix.rotate(Math.PI / 2, 0, 0, 1);
                            if (//x-
                            (connections & 16) != 0)
                                rotationMatrix.rotate(Math.PI / 2, 0, 0, 1);
                        } else if (//x-
                        (connections & 16) != 0)
                            rotationMatrix.rotate(-Math.PI / 2, 0, 0, 1);
                    } else {
                        rotationMatrix.rotate(Math.PI / 2, 0, 1, 0);
                        //default y- z- x+-
                        if (//z+
                        (connections & 8) != 0)
                            rotationMatrix.rotate(Math.PI, 0, 1, 0);
                        if (//y+
                        (connections & 2) != 0)
                            rotationMatrix.rotate(Math.PI / 2, 0, 0, 1);
                    }
                }
                break;
            case //complete tcross
            5:
                parts.add("tcross3");
                parts.add("con_yMin");
                parts.add("con_yMax");
                parts.add("con_zMin");
                parts.add("con_zMax");
                parts.add("con_xMax");
                //default y+- z+- x+
                if (straightZ) {
                    if (straightY) {
                        if (//x-
                        (connections & 16) != 0)
                            rotationMatrix.rotate(Math.PI, 0, 1, 0);
                    } else if (straightX)
                        rotationMatrix.rotate(((connections & 2) != 0) ? (Math.PI / 2) : (-Math.PI / 2), 0, 0, 1);
                } else if (straightX) {
                    rotationMatrix.rotate(Math.PI / 2, 0, 1, 0);
                    if (//z+
                    (connections & 8) != 0)
                        rotationMatrix.rotate(Math.PI, 0, 1, 0);
                }
                break;
            case //Full Crossing
            6:
                break;
        }
        //			connetionParts
        //			for(int i=0; i<6; i++)
        //				if(((TileEntityFluidPipe)tile).getConnectionStyle(i)==1)
        //					connectionCaps.add(CONNECTIONS[i]);
        Matrix4 tempMatr = new Matrix4();
        tempMatr.m03 = tempMatr.m13 = tempMatr.m23 = .5f;
        rotationMatrix.leftMultiply(tempMatr);
        tempMatr.invert();
        rotationMatrix = rotationMatrix.multiply(tempMatr);
        cachedOBJStates.put(key, new OBJState(parts, true, new TRSRTransformation(rotationMatrix.toMatrix4f())));
    }
    return cachedOBJStates.get(key);
}
Also used : TRSRTransformation(net.minecraftforge.common.model.TRSRTransformation) OBJState(net.minecraftforge.client.model.obj.OBJModel.OBJState) Matrix4(blusunrize.immersiveengineering.common.util.chickenbones.Matrix4)

Example 5 with TRSRTransformation

use of net.minecraftforge.common.model.TRSRTransformation in project ImmersiveEngineering by BluSunrize.

the class TileEntityFluidPipe method getOBJState.

@Override
public OBJState getOBJState() {
    byte connections = getConnectionByte();
    String key = getRenderCacheKey();
    if (!cachedOBJStates.containsKey(key)) {
        ArrayList<String> parts = new ArrayList();
        //new Matrix4();
        Matrix4 rotationMatrix = new Matrix4(TRSRTransformation.identity().getMatrix());
        //			if(pipeCover!=null)
        //				parts.add("cover");
        int totalConnections = Integer.bitCount(connections);
        boolean straightY = (connections & 3) == 3;
        boolean straightZ = (connections & 12) == 12;
        boolean straightX = (connections & 48) == 48;
        switch(totalConnections) {
            case //stub
            0:
                parts.add("center");
                break;
            case //stopper
            1:
                parts.add("stopper");
                //default: y-
                if (//y+
                (connections & 2) != 0)
                    rotationMatrix.rotate(Math.PI, 0, 0, 1);
                else if (//z-
                (connections & 4) != 0)
                    rotationMatrix.rotate(Math.PI / 2, 1, 0, 0);
                else if (//z+
                (connections & 8) != 0)
                    rotationMatrix.rotate(-Math.PI / 2, 1, 0, 0);
                else if (//x-
                (connections & 16) != 0)
                    rotationMatrix.rotate(-Math.PI / 2, 0, 0, 1);
                else if (//x+
                (connections & 32) != 0)
                    rotationMatrix.rotate(Math.PI / 2, 0, 0, 1);
                parts.add("con_yMin");
                break;
            case //straight or curve
            2:
                if (straightY) {
                    parts.add("pipe_y");
                    if (getConnectionStyle(0) == 1)
                        parts.add("con_yMin");
                    if (getConnectionStyle(1) == 1)
                        parts.add("con_yMax");
                } else if (straightZ) {
                    parts.add("pipe_z");
                    if (getConnectionStyle(2) == 1)
                        parts.add("con_zMin");
                    if (getConnectionStyle(3) == 1)
                        parts.add("con_zMax");
                } else if (straightX) {
                    parts.add("pipe_x");
                    if (getConnectionStyle(4) == 1)
                        parts.add("con_xMin");
                    if (getConnectionStyle(5) == 1)
                        parts.add("con_xMax");
                } else {
                    parts.add("curve");
                    parts.add("con_yMin");
                    parts.add("con_zMin");
                    byte connectTo = (byte) (connections & 60);
                    if (//curve to top or bottom
                    (connections & 3) != 0) {
                        if (//x-
                        connectTo == 16)
                            rotationMatrix.rotate(Math.PI / 2, 0, 1, 0);
                        else if (//x+
                        connectTo == 32)
                            rotationMatrix.rotate(-Math.PI / 2, 0, 1, 0);
                        else if (//z+
                        connectTo == 8)
                            rotationMatrix.rotate(Math.PI, 0, 1, 0);
                        if (//flip to top
                        (connections & 2) != 0)
                            rotationMatrix.rotate(Math.PI, 0, 0, 1);
                    //default: Curve to z-
                    } else //curve to horizontal
                    {
                        rotationMatrix.rotate(-Math.PI / 2, 0, 0, 1);
                        if (//z+ to x+
                        connectTo == 40)
                            rotationMatrix.rotate(Math.PI, 1, 0, 0);
                        else if (//z+ to x-
                        connectTo == 24)
                            rotationMatrix.rotate(-Math.PI / 2, 1, 0, 0);
                        else if (//z- to x+
                        connectTo == 36)
                            rotationMatrix.rotate(Math.PI / 2, 1, 0, 0);
                    //default: z- to x-
                    }
                }
                break;
            case //tcross or tcurve
            3:
                if (//has straight connect
                straightX || straightZ || straightY) {
                    parts.add("tcross");
                    parts.add("con_yMin");
                    parts.add("con_zMin");
                    parts.add("con_zMax");
                    if (straightX) {
                        rotationMatrix.rotate(Math.PI / 2, 0, 1, 0);
                        if (//z-
                        (connections & 4) != 0)
                            rotationMatrix.rotate(Math.PI / 2, 0, 0, 1);
                        else if (//z+
                        (connections & 8) != 0)
                            rotationMatrix.rotate(-Math.PI / 2, 0, 0, 1);
                        else if (//y+
                        (connections & 2) != 0)
                            rotationMatrix.rotate(Math.PI, 0, 0, 1);
                    //default: Curve to y-
                    } else if (straightY) {
                        rotationMatrix.rotate(Math.PI / 2, 1, 0, 0);
                        if (//x-
                        (connections & 16) != 0)
                            rotationMatrix.rotate(-Math.PI / 2, 0, 0, 1);
                        else if (//x+
                        (connections & 32) != 0)
                            rotationMatrix.rotate(Math.PI / 2, 0, 0, 1);
                        else if (//z+
                        (connections & 8) != 0)
                            rotationMatrix.rotate(Math.PI, 0, 0, 1);
                    //default: Curve to z-
                    } else //default:z straight
                    {
                        if (//x-
                        (connections & 16) != 0)
                            rotationMatrix.rotate(-Math.PI / 2, 0, 0, 1);
                        else if (//x+
                        (connections & 32) != 0)
                            rotationMatrix.rotate(Math.PI / 2, 0, 0, 1);
                        else if (//y+
                        (connections & 2) != 0)
                            rotationMatrix.rotate(Math.PI, 0, 0, 1);
                    //default: Curve to y-
                    }
                } else //tcurve
                {
                    parts.add("tcurve");
                    parts.add("con_yMin");
                    parts.add("con_zMin");
                    parts.add("con_xMax");
                    //default y-, z-, x+
                    if (//z+
                    (connections & 8) != 0) {
                        if (//x-
                        (connections & 16) != 0)
                            rotationMatrix.rotate(Math.PI, 0, 1, 0);
                        else
                            rotationMatrix.rotate(-Math.PI / 2, 0, 1, 0);
                    } else //z-
                    {
                        if (//x-
                        (connections & 16) != 0)
                            rotationMatrix.rotate(Math.PI / 2, 0, 1, 0);
                    }
                    if (//y+
                    (connections & 2) != 0)
                        rotationMatrix.rotate(Math.PI / 2, 0, 0, 1);
                }
                break;
            case //cross or complex tcross
            4:
                boolean cross = (straightX && straightZ) || (straightX && straightY) || (straightZ && straightY);
                if (cross) {
                    parts.add("cross");
                    parts.add("con_yMin");
                    parts.add("con_yMax");
                    parts.add("con_zMin");
                    parts.add("con_zMax");
                    if (//x and z
                    !straightY)
                        rotationMatrix.rotate(Math.PI / 2, 0, 0, 1);
                    else if (//x and y
                    straightX)
                        rotationMatrix.rotate(Math.PI / 2, 0, 1, 0);
                } else {
                    parts.add("tcross2");
                    parts.add("con_yMin");
                    parts.add("con_zMin");
                    parts.add("con_zMax");
                    parts.add("con_xMax");
                    if (straightZ) {
                        //default y- z+- x+
                        if (//x-
                        (connections & 16) != 0)
                            rotationMatrix.rotate(Math.PI, 0, 1, 0);
                        if (//y+
                        (connections & 2) != 0)
                            rotationMatrix.rotate(Math.PI / 2, 0, 0, 1);
                    } else if (straightY) {
                        rotationMatrix.rotate(Math.PI / 2, 1, 0, 0);
                        //default y+- z- x+
                        if (//z+
                        (connections & 8) != 0) {
                            rotationMatrix.rotate(Math.PI / 2, 0, 0, 1);
                            if (//x-
                            (connections & 16) != 0)
                                rotationMatrix.rotate(Math.PI / 2, 0, 0, 1);
                        } else if (//x-
                        (connections & 16) != 0)
                            rotationMatrix.rotate(-Math.PI / 2, 0, 0, 1);
                    } else {
                        rotationMatrix.rotate(Math.PI / 2, 0, 1, 0);
                        //default y- z- x+-
                        if (//z+
                        (connections & 8) != 0)
                            rotationMatrix.rotate(Math.PI, 0, 1, 0);
                        if (//y+
                        (connections & 2) != 0)
                            rotationMatrix.rotate(Math.PI / 2, 0, 0, 1);
                    }
                }
                break;
            case //complete tcross
            5:
                parts.add("tcross3");
                parts.add("con_yMin");
                parts.add("con_yMax");
                parts.add("con_zMin");
                parts.add("con_zMax");
                parts.add("con_xMax");
                //default y+- z+- x+
                if (straightZ) {
                    if (straightY) {
                        if (//x-
                        (connections & 16) != 0)
                            rotationMatrix.rotate(Math.PI, 0, 1, 0);
                    } else if (straightX)
                        rotationMatrix.rotate(((connections & 2) != 0) ? (Math.PI / 2) : (-Math.PI / 2), 0, 0, 1);
                } else if (straightX) {
                    rotationMatrix.rotate(Math.PI / 2, 0, 1, 0);
                    if (//z+
                    (connections & 8) != 0)
                        rotationMatrix.rotate(Math.PI, 0, 1, 0);
                }
                break;
            case //Full Crossing
            6:
                parts.add("con_yMin");
                parts.add("con_yMax");
                parts.add("con_zMin");
                parts.add("con_zMax");
                parts.add("con_xMin");
                parts.add("con_xMax");
                break;
        }
        //			connetionParts
        //			for(int i=0; i<6; i++)
        //				if(((TileEntityFluidPipe)tile).getConnectionStyle(i)==1)
        //					connectionCaps.add(CONNECTIONS[i]);
        Matrix4 tempMatr = new Matrix4();
        tempMatr.m03 = tempMatr.m13 = tempMatr.m23 = .5f;
        rotationMatrix.leftMultiply(tempMatr);
        tempMatr.invert();
        rotationMatrix = rotationMatrix.multiply(tempMatr);
        cachedOBJStates.put(key, new OBJState(parts, true, new TRSRTransformation(rotationMatrix.toMatrix4f())));
    }
    return cachedOBJStates.get(key);
}
Also used : TRSRTransformation(net.minecraftforge.common.model.TRSRTransformation) OBJState(net.minecraftforge.client.model.obj.OBJModel.OBJState) Matrix4(blusunrize.immersiveengineering.common.util.chickenbones.Matrix4)

Aggregations

TRSRTransformation (net.minecraftforge.common.model.TRSRTransformation)12 Matrix4 (blusunrize.immersiveengineering.common.util.chickenbones.Matrix4)5 Matrix4f (javax.vecmath.Matrix4f)3 BakedQuad (net.minecraft.client.renderer.block.model.BakedQuad)3 ImmutableList (com.google.common.collect.ImmutableList)2 Vector3f (javax.vecmath.Vector3f)2 TransformType (net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType)2 TextureAtlasSprite (net.minecraft.client.renderer.texture.TextureAtlasSprite)2 ResourceLocation (net.minecraft.util.ResourceLocation)2 OBJState (net.minecraftforge.client.model.obj.OBJModel.OBJState)2 UnpackedBakedQuad (net.minecraftforge.client.model.pipeline.UnpackedBakedQuad)2 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)2 ComparableItemStack (blusunrize.immersiveengineering.api.ComparableItemStack)1 ShaderWrapper (blusunrize.immersiveengineering.api.shader.CapabilityShader.ShaderWrapper)1 IShaderItem (blusunrize.immersiveengineering.api.shader.IShaderItem)1 ShaderCase (blusunrize.immersiveengineering.api.shader.ShaderCase)1 ShaderLayer (blusunrize.immersiveengineering.api.shader.ShaderCase.ShaderLayer)1 ImmutableMap (com.google.common.collect.ImmutableMap)1 Nullable (javax.annotation.Nullable)1 Matrix3f (javax.vecmath.Matrix3f)1