Search in sources :

Example 6 with IRenderBuffer

use of riskyken.armourersWorkshop.client.render.IRenderBuffer in project Armourers-Workshop by RiskyKen.

the class GuiMiniArmourerBuildingModel method drawBuildingCubes.

private void drawBuildingCubes(boolean fake) {
    if (cubes == null) {
    // return;
    }
    renderCubes.clear();
    fakeCubeRenders = 0;
    // GL11.glDisable(GL11.GL_NORMALIZE);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    if (fake) {
        GL11.glDisable(GL11.GL_LIGHTING);
        IRectangle3D guideSpace = currentSkinPartType.getGuideSpace();
        for (int ix = 0; ix < guideSpace.getWidth(); ix++) {
            for (int iy = 0; iy < guideSpace.getHeight(); iy++) {
                for (int iz = 0; iz < guideSpace.getDepth(); iz++) {
                    byte x = (byte) (ix + guideSpace.getX());
                    byte y = (byte) (iy + guideSpace.getY());
                    byte z = (byte) (iz + guideSpace.getZ());
                    MiniCube cube = new MiniCube(CubeRegistry.INSTANCE.getCubeFormId((byte) 0));
                    cube.setX(x);
                    cube.setY(y);
                    cube.setZ(z);
                    renderCubes.add(cube);
                }
            }
        }
        fakeCubeRenders = renderCubes.size();
    }
    float scale = 0.0625F;
    int colourId = 1;
    renderCubes.addAll(cubes);
    IRenderBuffer buff = RenderBridge.INSTANCE;
    buff.startDrawingQuads();
    for (int i = 0; i < renderCubes.size(); i++) {
        MiniCube cube = renderCubes.get(i);
        if (cube != null) {
            if (cube.isGlowing() & !fake) {
                GL11.glDisable(GL11.GL_LIGHTING);
                ModRenderHelper.disableLighting();
            }
            ICubeColour colour = new CubeColour();
            if (fake) {
                colour.setColour(GuiMiniArmourerHelper.getColourFromId(colourId).getRGB(), 0);
                colour.setColour(GuiMiniArmourerHelper.getColourFromId(colourId + 1).getRGB(), 1);
                colour.setColour(GuiMiniArmourerHelper.getColourFromId(colourId + 2).getRGB(), 2);
                colour.setColour(GuiMiniArmourerHelper.getColourFromId(colourId + 3).getRGB(), 3);
                colour.setColour(GuiMiniArmourerHelper.getColourFromId(colourId + 4).getRGB(), 4);
                colour.setColour(GuiMiniArmourerHelper.getColourFromId(colourId + 5).getRGB(), 5);
            } else {
                colour = cube.getCubeColour();
            }
            renderArmourBlock((byte) cube.getX(), (byte) cube.getY(), (byte) cube.getZ(), colour, scale, false);
            if (cube.isGlowing() & !fake) {
                ModRenderHelper.enableLighting();
                GL11.glEnable(GL11.GL_LIGHTING);
            }
        }
        colourId += 6;
    }
    buff.draw();
    if (fake) {
        GL11.glEnable(GL11.GL_LIGHTING);
    }
    GL11.glEnable(GL11.GL_TEXTURE_2D);
}
Also used : IRectangle3D(riskyken.armourersWorkshop.api.common.IRectangle3D) ICubeColour(riskyken.armourersWorkshop.api.common.skin.cubes.ICubeColour) MiniCube(riskyken.armourersWorkshop.common.data.MiniCube) IRenderBuffer(riskyken.armourersWorkshop.client.render.IRenderBuffer) ICubeColour(riskyken.armourersWorkshop.api.common.skin.cubes.ICubeColour) CubeColour(riskyken.armourersWorkshop.common.skin.cubes.CubeColour)

Aggregations

IRenderBuffer (riskyken.armourersWorkshop.client.render.IRenderBuffer)6 MiniCube (riskyken.armourersWorkshop.common.data.MiniCube)2 ForgeDirection (net.minecraftforge.common.util.ForgeDirection)1 IRectangle3D (riskyken.armourersWorkshop.api.common.IRectangle3D)1 ICubeColour (riskyken.armourersWorkshop.api.common.skin.cubes.ICubeColour)1 CubeColour (riskyken.armourersWorkshop.common.skin.cubes.CubeColour)1 Skin (riskyken.armourersWorkshop.common.skin.data.Skin)1 SkinPart (riskyken.armourersWorkshop.common.skin.data.SkinPart)1