Search in sources :

Example 11 with IRectangle3D

use of riskyken.armourersWorkshop.api.common.IRectangle3D in project Armourers-Workshop by RiskyKen.

the class SkinRenderHelper method renderGuidePart.

private static void renderGuidePart(ISkinPartType part, float scale, boolean showGuides, boolean hidden) {
    Minecraft.getMinecraft().getTextureManager().bindTexture(guideImage);
    IRectangle3D buildRec = part.getBuildingSpace();
    IRectangle3D guideRec = part.getGuideSpace();
    GL11.glPushMatrix();
    GL11.glDisable(GL11.GL_LIGHTING);
    if (showGuides) {
        // render building grid
        // 
        renderGuideBox(buildRec.getX(), buildRec.getY(), buildRec.getZ(), buildRec.getWidth(), buildRec.getHeight(), buildRec.getDepth(), scale);
        // render origin
        GL11.glColor4f(0F, 1F, 0F, 0.5F);
        renderGuideBox(-0.5F, -0.5F, -0.5F, 1, 1, 1, scale);
    }
    if (ConfigHandlerClient.showArmourerDebugRender) {
        // render debug box
        GL11.glColor4f(1F, 0F, 0F, 0.25F);
        renderGuideBox(guideRec.getX(), guideRec.getY(), guideRec.getZ(), guideRec.getWidth(), guideRec.getHeight(), guideRec.getDepth(), scale);
    }
    if (hidden) {
        GL11.glColor4f(0F, 0F, 1F, 0.25F);
        renderGuideBox(guideRec.getX(), guideRec.getY(), guideRec.getZ(), guideRec.getWidth(), guideRec.getHeight(), guideRec.getDepth(), scale);
    }
    GL11.glColor4f(1F, 1F, 1F, 1F);
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glPopMatrix();
}
Also used : IRectangle3D(riskyken.armourersWorkshop.api.common.IRectangle3D)

Example 12 with IRectangle3D

use of riskyken.armourersWorkshop.api.common.IRectangle3D 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

IRectangle3D (riskyken.armourersWorkshop.api.common.IRectangle3D)12 IPoint3D (riskyken.armourersWorkshop.api.common.IPoint3D)9 Block (net.minecraft.block.Block)5 SkinBlock (riskyken.armourersWorkshop.common.skin.type.block.SkinBlock)5 ISkinPartType (riskyken.armourersWorkshop.api.common.skin.type.ISkinPartType)4 ArrayList (java.util.ArrayList)2 Rectangle3D (riskyken.armourersWorkshop.api.common.skin.Rectangle3D)2 CubeMarkerData (riskyken.armourersWorkshop.common.skin.cubes.CubeMarkerData)2 SkinCubeData (riskyken.armourersWorkshop.common.skin.data.SkinCubeData)2 SkinPart (riskyken.armourersWorkshop.common.skin.data.SkinPart)2 SideOnly (cpw.mods.fml.relauncher.SideOnly)1 TileEntity (net.minecraft.tileentity.TileEntity)1 ICubeColour (riskyken.armourersWorkshop.api.common.skin.cubes.ICubeColour)1 ISkinPart (riskyken.armourersWorkshop.api.common.skin.data.ISkinPart)1 ISkinPartTypeTextured (riskyken.armourersWorkshop.api.common.skin.type.ISkinPartTypeTextured)1 IRenderBuffer (riskyken.armourersWorkshop.client.render.IRenderBuffer)1 BlockLocation (riskyken.armourersWorkshop.common.blocks.BlockLocation)1 MiniCube (riskyken.armourersWorkshop.common.data.MiniCube)1 SkinSaveException (riskyken.armourersWorkshop.common.exception.SkinSaveException)1 CubeColour (riskyken.armourersWorkshop.common.skin.cubes.CubeColour)1