Search in sources :

Example 1 with TransformationList

use of codechicken.lib.vec.TransformationList in project BluePower by Qmunity.

the class SawRenderFMP method renderItem.

@Override
public void renderItem(ItemRenderType renderType, ItemStack item, Object... data) {
    double pi = Math.PI;
    Transformation t;
    switch(renderType) {
        case INVENTORY:
            t = new TransformationList(new Scale(1.8), new Translation(0, 0, -0.6), new Rotation(-pi / 4, 1, 0, 0), new Rotation(pi * 3 / 4, 0, 1, 0));
            break;
        case ENTITY:
            t = new TransformationList(new Scale(1), new Translation(0, 0, -0.25), new Rotation(-pi / 4, 1, 0, 0));
            break;
        case EQUIPPED_FIRST_PERSON:
            t = new TransformationList(new Scale(1.5), new Rotation(-pi / 3, 1, 0, 0), new Rotation(pi * 3 / 4, 0, 1, 0), new Translation(0.5, 0.5, 0.5));
            break;
        case EQUIPPED:
            t = new TransformationList(new Scale(1.5), new Rotation(-pi / 5, 1, 0, 0), new Rotation(-pi * 3 / 4, 0, 1, 0), new Translation(0.75, 0.5, 0.75));
            break;
        default:
            t = null;
            break;
    }
    CCRenderState.reset();
    CCRenderState.useNormals = true;
    CCRenderState.pullLightmap();
    CCRenderState.changeTexture("microblock:textures/items/saw.png");
    CCRenderState.startDrawing();
    handle.render(t);
    holder.render(t);
    CCRenderState.draw();
    GL11.glDisable(GL11.GL_CULL_FACE);
    CCRenderState.changeTexture(Refs.MODID + ":textures/items/fmpsaw.png");
    CCRenderState.startDrawing();
    int tex = 0;
    if (item.getItem() == BPItems.ruby_saw) {
        tex = 0;
    } else if (item.getItem() == BPItems.amethyst_saw) {
        tex = 1;
    } else if (item.getItem() == BPItems.sapphire_saw) {
        tex = 2;
    }
    blade.render(t, new UVTranslation(0, tex * 4 / 64D));
    CCRenderState.draw();
    GL11.glEnable(GL11.GL_CULL_FACE);
}
Also used : Transformation(codechicken.lib.vec.Transformation) Translation(codechicken.lib.vec.Translation) UVTranslation(codechicken.lib.render.uv.UVTranslation) UVTranslation(codechicken.lib.render.uv.UVTranslation) Scale(codechicken.lib.vec.Scale) TransformationList(codechicken.lib.vec.TransformationList) Rotation(codechicken.lib.vec.Rotation)

Example 2 with TransformationList

use of codechicken.lib.vec.TransformationList in project GregTech by GregTechCE.

the class StoneRenderer method renderBlock.

@Override
public boolean renderBlock(IBlockAccess world, BlockPos pos, IBlockState state, BufferBuilder buffer) {
    // otherwise, we are in solid rendering layer and render primary stone
    CCRenderState renderState = CCRenderState.instance();
    renderState.reset();
    renderState.bind(buffer);
    Matrix4 translation = new Matrix4();
    translation.translate(pos.getX(), pos.getY(), pos.getZ());
    TextureAtlasSprite stoneSprite = TextureUtils.getBlockTexture("stone");
    Material material = ((BlockSurfaceRock) state.getBlock()).getStoneMaterial(world, pos, state);
    int renderingColor = GTUtility.convertRGBtoOpaqueRGBA_CL(material.materialRGB);
    IVertexOperation[] operations = new IVertexOperation[] { new IconTransformation(stoneSprite), new ColourMultiplier(renderingColor), new TransformationList(translation) };
    if (world != null) {
        renderState.setBrightness(world, pos);
    }
    renderState.setPipeline(operations);
    CCModel actualModel = getActualModel(world, pos);
    renderState.setModel(actualModel);
    renderState.render();
    return true;
}
Also used : IVertexOperation(codechicken.lib.render.pipeline.IVertexOperation) TextureAtlasSprite(net.minecraft.client.renderer.texture.TextureAtlasSprite) BlockSurfaceRock(gregtech.common.blocks.surfacerock.BlockSurfaceRock) Material(gregtech.api.unification.material.type.Material) CCRenderState(codechicken.lib.render.CCRenderState) TransformationList(codechicken.lib.vec.TransformationList) Matrix4(codechicken.lib.vec.Matrix4) CCModel(codechicken.lib.render.CCModel) IconTransformation(codechicken.lib.vec.uv.IconTransformation) ColourMultiplier(codechicken.lib.render.pipeline.ColourMultiplier)

Example 3 with TransformationList

use of codechicken.lib.vec.TransformationList in project GregTech by GregTechCE.

the class Textures method renderFace.

@SideOnly(Side.CLIENT)
public static void renderFace(CCRenderState renderState, Matrix4 translation, IVertexOperation[] ops, EnumFacing face, Cuboid6 bounds, TextureAtlasSprite sprite) {
    BlockFace blockFace = blockFaces.get();
    blockFace.loadCuboidFace(bounds, face.getIndex());
    UVTransformationList uvList = new UVTransformationList(new IconTransformation(sprite));
    if (face.getIndex() == 0) {
        uvList.prepend(new UVMirror(0, 0, bounds.min.z, bounds.max.z));
    }
    renderState.setPipeline(blockFace, 0, blockFace.verts.length, ArrayUtils.addAll(ops, new TransformationList(translation), uvList));
    renderState.render();
}
Also used : BlockFace(codechicken.lib.render.BlockRenderer.BlockFace) UVTransformationList(codechicken.lib.vec.uv.UVTransformationList) TransformationList(codechicken.lib.vec.TransformationList) UVTransformationList(codechicken.lib.vec.uv.UVTransformationList) IconTransformation(codechicken.lib.vec.uv.IconTransformation) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Aggregations

TransformationList (codechicken.lib.vec.TransformationList)3 IconTransformation (codechicken.lib.vec.uv.IconTransformation)2 BlockFace (codechicken.lib.render.BlockRenderer.BlockFace)1 CCModel (codechicken.lib.render.CCModel)1 CCRenderState (codechicken.lib.render.CCRenderState)1 ColourMultiplier (codechicken.lib.render.pipeline.ColourMultiplier)1 IVertexOperation (codechicken.lib.render.pipeline.IVertexOperation)1 UVTranslation (codechicken.lib.render.uv.UVTranslation)1 Matrix4 (codechicken.lib.vec.Matrix4)1 Rotation (codechicken.lib.vec.Rotation)1 Scale (codechicken.lib.vec.Scale)1 Transformation (codechicken.lib.vec.Transformation)1 Translation (codechicken.lib.vec.Translation)1 UVTransformationList (codechicken.lib.vec.uv.UVTransformationList)1 Material (gregtech.api.unification.material.type.Material)1 BlockSurfaceRock (gregtech.common.blocks.surfacerock.BlockSurfaceRock)1 TextureAtlasSprite (net.minecraft.client.renderer.texture.TextureAtlasSprite)1 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)1