Search in sources :

Example 1 with TRSRTransformer

use of net.minecraftforge.client.model.pipeline.TRSRTransformer in project MinecraftForge by MinecraftForge.

the class ItemLayerModel method buildQuad.

private static BakedQuad buildQuad(Transformation transform, Direction side, TextureAtlasSprite sprite, int tint, boolean fullbright, float x0, float y0, float z0, float u0, float v0, float x1, float y1, float z1, float u1, float v1, float x2, float y2, float z2, float u2, float v2, float x3, float y3, float z3, float u3, float v3) {
    BakedQuadBuilder builder = new BakedQuadBuilder(sprite);
    builder.setQuadTint(tint);
    builder.setQuadOrientation(side);
    builder.setApplyDiffuseLighting(false);
    boolean hasTransform = !transform.isIdentity();
    IVertexConsumer consumer = hasTransform ? new TRSRTransformer(builder, transform) : builder;
    int uLight, vLight;
    uLight = vLight = fullbright ? 15 : 0;
    putVertex(consumer, side, x0, y0, z0, u0, v0, uLight, vLight);
    putVertex(consumer, side, x1, y1, z1, u1, v1, uLight, vLight);
    putVertex(consumer, side, x2, y2, z2, u2, v2, uLight, vLight);
    putVertex(consumer, side, x3, y3, z3, u3, v3, uLight, vLight);
    return builder.build();
}
Also used : IVertexConsumer(net.minecraftforge.client.model.pipeline.IVertexConsumer) TRSRTransformer(net.minecraftforge.client.model.pipeline.TRSRTransformer) BakedQuadBuilder(net.minecraftforge.client.model.pipeline.BakedQuadBuilder)

Example 2 with TRSRTransformer

use of net.minecraftforge.client.model.pipeline.TRSRTransformer in project MinecraftForge by MinecraftForge.

the class ItemTextureQuadConverter method putQuad.

private static BakedQuad putQuad(Transformation transform, Direction side, TextureAtlasSprite sprite, int color, int tint, float x1, float y1, float x2, float y2, float z, float u1, float v1, float u2, float v2, int luminosity) {
    BakedQuadBuilder builder = new BakedQuadBuilder(sprite);
    builder.setQuadTint(tint);
    builder.setQuadOrientation(side);
    builder.setApplyDiffuseLighting(luminosity == 0);
    // only apply the transform if it's not identity
    boolean hasTransform = !transform.isIdentity();
    IVertexConsumer consumer = hasTransform ? new TRSRTransformer(builder, transform) : builder;
    if (side == Direction.SOUTH) {
        putVertex(consumer, side, x1, y1, z, u1, v2, color, luminosity);
        putVertex(consumer, side, x2, y1, z, u2, v2, color, luminosity);
        putVertex(consumer, side, x2, y2, z, u2, v1, color, luminosity);
        putVertex(consumer, side, x1, y2, z, u1, v1, color, luminosity);
    } else {
        putVertex(consumer, side, x1, y1, z, u1, v2, color, luminosity);
        putVertex(consumer, side, x1, y2, z, u1, v1, color, luminosity);
        putVertex(consumer, side, x2, y2, z, u2, v1, color, luminosity);
        putVertex(consumer, side, x2, y1, z, u2, v2, color, luminosity);
    }
    return builder.build();
}
Also used : IVertexConsumer(net.minecraftforge.client.model.pipeline.IVertexConsumer) TRSRTransformer(net.minecraftforge.client.model.pipeline.TRSRTransformer) BakedQuadBuilder(net.minecraftforge.client.model.pipeline.BakedQuadBuilder)

Aggregations

BakedQuadBuilder (net.minecraftforge.client.model.pipeline.BakedQuadBuilder)2 IVertexConsumer (net.minecraftforge.client.model.pipeline.IVertexConsumer)2 TRSRTransformer (net.minecraftforge.client.model.pipeline.TRSRTransformer)2