Search in sources :

Example 1 with SmartLightingQuad

use of blusunrize.immersiveengineering.client.models.SmartLightingQuad in project ImmersiveEngineering by BluSunrize.

the class ClientUtils method createBakedQuad.

public static BakedQuad createBakedQuad(VertexFormat format, Vector3f[] vertices, EnumFacing facing, TextureAtlasSprite sprite, double[] uvs, float[] colour, boolean invert, float[] alpha, boolean smartLighting, BlockPos basePos) {
    UnpackedBakedQuad.Builder builder = new UnpackedBakedQuad.Builder(format);
    builder.setQuadOrientation(facing);
    builder.setTexture(sprite);
    Normal faceNormal = new Normal(facing.getDirectionVec().getX(), facing.getDirectionVec().getY(), facing.getDirectionVec().getZ());
    int vId = invert ? 3 : 0;
    int u = vId > 1 ? 2 : 0;
    putVertexData(format, builder, vertices[vId], faceNormal, uvs[u], uvs[1], sprite, colour, alpha[vId]);
    vId = invert ? 2 : 1;
    u = vId > 1 ? 2 : 0;
    putVertexData(format, builder, vertices[vId], faceNormal, uvs[u], uvs[3], sprite, colour, alpha[vId]);
    vId = invert ? 1 : 2;
    u = vId > 1 ? 2 : 0;
    putVertexData(format, builder, vertices[vId], faceNormal, uvs[u], uvs[3], sprite, colour, alpha[vId]);
    vId = invert ? 0 : 3;
    u = vId > 1 ? 2 : 0;
    putVertexData(format, builder, vertices[vId], faceNormal, uvs[u], uvs[1], sprite, colour, alpha[vId]);
    BakedQuad tmp = builder.build();
    return smartLighting ? new SmartLightingQuad(tmp.getVertexData(), -1, facing, sprite, format, basePos) : tmp;
}
Also used : BakedQuad(net.minecraft.client.renderer.block.model.BakedQuad) UnpackedBakedQuad(net.minecraftforge.client.model.pipeline.UnpackedBakedQuad) UnpackedBakedQuad(net.minecraftforge.client.model.pipeline.UnpackedBakedQuad) SmartLightingQuad(blusunrize.immersiveengineering.client.models.SmartLightingQuad) Normal(net.minecraftforge.client.model.obj.OBJModel.Normal)

Aggregations

SmartLightingQuad (blusunrize.immersiveengineering.client.models.SmartLightingQuad)1 BakedQuad (net.minecraft.client.renderer.block.model.BakedQuad)1 Normal (net.minecraftforge.client.model.obj.OBJModel.Normal)1 UnpackedBakedQuad (net.minecraftforge.client.model.pipeline.UnpackedBakedQuad)1