Search in sources :

Example 1 with IRenderBuffer

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

the class RenderBlockMannequin method renderMagicCircle.

private void renderMagicCircle(byte r, byte g, byte b, float partialTickTime, int offset, boolean isChild) {
    GL11.glPushMatrix();
    if (isChild) {
        ModelHelper.enableChildModelScale(false, SCALE);
    }
    GL11.glColor4ub(r, g, b, (byte) 255);
    // GL11.glColor4f(r, g, b, 1F);
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glDisable(GL11.GL_CULL_FACE);
    GL11.glTranslatef(0F, 1.48F, 0F);
    float circleScale = 2.0F;
    GL11.glScalef(circleScale, circleScale, circleScale);
    float rotation = (float) ((double) (mc.theWorld.getTotalWorldTime() + offset) / 0.8F % 360) + partialTickTime;
    GL11.glRotatef(rotation, 0, 1, 0);
    ModRenderHelper.disableLighting();
    ModRenderHelper.enableAlphaBlend();
    bindTexture(circle);
    IRenderBuffer renderBuffer = RenderBridge.INSTANCE;
    renderBuffer.startDrawingQuads();
    renderBuffer.addVertexWithUV(-1, 0, -1, 1, 0);
    renderBuffer.addVertexWithUV(1, 0, -1, 0, 0);
    renderBuffer.addVertexWithUV(1, 0, 1, 0, 1);
    renderBuffer.addVertexWithUV(-1, 0, 1, 1, 1);
    renderBuffer.draw();
    ModRenderHelper.disableAlphaBlend();
    ModRenderHelper.enableLighting();
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glColor4f(1F, 1F, 1F, 1F);
    if (isChild) {
        ModelHelper.disableChildModelScale();
    }
    GL11.glPopMatrix();
}
Also used : IRenderBuffer(riskyken.armourersWorkshop.client.render.IRenderBuffer)

Example 2 with IRenderBuffer

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

the class RenderBlockGlowing method renderFacesWithLighting.

private boolean renderFacesWithLighting(IBlockAccess world, int x, int y, int z, ICubeColour colour, Block block, RenderBlocks renderer) {
    boolean rendered = false;
    int meta = world.getBlockMetadata(x, y, z);
    IRenderBuffer renderBuffer = RenderBridge.INSTANCE;
    double faceOffset = 0.02;
    float yNegLight = 0.5F;
    float yPosLight = 1.0F;
    float zLight = 0.8F;
    float xLight = 0.6F;
    float yNegR = yNegLight * ((colour.getRed(0) & 0xFF) / 255F);
    float yNegG = yNegLight * ((colour.getGreen(0) & 0xFF) / 255F);
    float yNegB = yNegLight * ((colour.getBlue(0) & 0xFF) / 255F);
    float yPosR = yPosLight * ((colour.getRed(1) & 0xFF) / 255F);
    float yPosG = yPosLight * ((colour.getGreen(1) & 0xFF) / 255F);
    float yPosB = yPosLight * ((colour.getBlue(1) & 0xFF) / 255F);
    float zNegR = zLight * ((colour.getRed(2) & 0xFF) / 255F);
    float zNegG = zLight * ((colour.getGreen(2) & 0xFF) / 255F);
    float zNegB = zLight * ((colour.getBlue(2) & 0xFF) / 255F);
    float zPosR = zLight * ((colour.getRed(3) & 0xFF) / 255F);
    float zPosG = zLight * ((colour.getGreen(3) & 0xFF) / 255F);
    float zPosB = zLight * ((colour.getBlue(3) & 0xFF) / 255F);
    float xNegR = xLight * ((colour.getRed(4) & 0xFF) / 255F);
    float xNegG = xLight * ((colour.getGreen(4) & 0xFF) / 255F);
    float xNegB = xLight * ((colour.getBlue(4) & 0xFF) / 255F);
    float xPosR = xLight * ((colour.getRed(5) & 0xFF) / 255F);
    float xPosG = xLight * ((colour.getGreen(5) & 0xFF) / 255F);
    float xPosB = xLight * ((colour.getBlue(5) & 0xFF) / 255F);
    if (renderer.renderAllFaces || block.shouldSideBeRendered(world, x, y - 1, z, 0)) {
        int pt = colour.getPaintType(0) & 0xFF;
        renderBuffer.setBrightness(block.getMixedBrightnessForBlock(world, x, y - 1, z));
        renderBuffer.setColorOpaque_F(yNegR, yNegG, yNegB);
        renderer.renderFaceYNeg(block, x, y, z, block.getIcon(pt, 0));
        if (meta == 1) {
            renderBuffer.setColorOpaque_B((byte) 255, (byte) 255, (byte) 255);
            renderer.renderFaceYNeg(block, x, y - faceOffset, z, block.getIcon(0, meta));
        }
        rendered = true;
    }
    if (renderer.renderAllFaces || block.shouldSideBeRendered(world, x, y + 1, z, 1)) {
        int pt = colour.getPaintType(1) & 0xFF;
        renderBuffer.setBrightness(block.getMixedBrightnessForBlock(world, x, y + 1, z));
        renderBuffer.setColorOpaque_F(yPosR, yPosG, yPosB);
        renderer.renderFaceYPos(block, x, y, z, block.getIcon(pt, 0));
        if (meta == 2) {
            renderBuffer.setColorOpaque_B((byte) 255, (byte) 255, (byte) 255);
            renderer.renderFaceYPos(block, x, y + faceOffset, z, block.getIcon(1, meta));
        }
        rendered = true;
    }
    if (renderer.renderAllFaces || block.shouldSideBeRendered(world, x, y, z - 1, 2)) {
        int pt = colour.getPaintType(2) & 0xFF;
        renderBuffer.setBrightness(block.getMixedBrightnessForBlock(world, x, y, z - 1));
        renderBuffer.setColorOpaque_F(zNegR, zNegG, zNegB);
        renderer.renderFaceZNeg(block, x, y, z, block.getIcon(pt, 0));
        if (meta == 3) {
            renderBuffer.setColorOpaque_B((byte) 255, (byte) 255, (byte) 255);
            renderer.renderFaceZNeg(block, x, y, z - faceOffset, block.getIcon(2, meta));
        }
        rendered = true;
    }
    if (renderer.renderAllFaces || block.shouldSideBeRendered(world, x, y, z + 1, 3)) {
        int pt = colour.getPaintType(3) & 0xFF;
        renderBuffer.setBrightness(block.getMixedBrightnessForBlock(world, x, y, z + 1));
        renderBuffer.setColorOpaque_F(zPosR, zPosG, zPosB);
        renderer.renderFaceZPos(block, x, y, z, block.getIcon(pt, 0));
        if (meta == 4) {
            renderBuffer.setColorOpaque_B((byte) 255, (byte) 255, (byte) 255);
            renderer.renderFaceZPos(block, x, y, z + faceOffset, block.getIcon(3, meta));
        }
        rendered = true;
    }
    if (renderer.renderAllFaces || block.shouldSideBeRendered(world, x - 1, y, z, 4)) {
        int pt = colour.getPaintType(4) & 0xFF;
        renderBuffer.setBrightness(block.getMixedBrightnessForBlock(world, x - 1, y, z));
        renderBuffer.setColorOpaque_F(xNegR, xNegG, xNegB);
        renderer.renderFaceXNeg(block, x, y, z, block.getIcon(pt, 0));
        if (meta == 5) {
            renderBuffer.setColorOpaque_B((byte) 255, (byte) 255, (byte) 255);
            renderer.renderFaceXNeg(block, x - faceOffset, y, z, block.getIcon(4, meta));
        }
        rendered = true;
    }
    if (renderer.renderAllFaces || block.shouldSideBeRendered(world, x + 1, y, z, 5)) {
        int pt = colour.getPaintType(5) & 0xFF;
        renderBuffer.setBrightness(block.getMixedBrightnessForBlock(world, x + 1, y, z));
        renderBuffer.setColorOpaque_F(xPosR, xPosG, xPosB);
        renderer.renderFaceXPos(block, x, y, z, block.getIcon(pt, 0));
        if (meta == 6) {
            renderBuffer.setColorOpaque_B((byte) 255, (byte) 255, (byte) 255);
            renderer.renderFaceXPos(block, x + faceOffset, y, z, block.getIcon(5, meta));
        }
        rendered = true;
    }
    return rendered;
}
Also used : IRenderBuffer(riskyken.armourersWorkshop.client.render.IRenderBuffer)

Example 3 with IRenderBuffer

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

the class RenderBlockGlowing method renderFaces.

private boolean renderFaces(IBlockAccess world, int x, int y, int z, ICubeColour colour, Block block, RenderBlocks renderer) {
    boolean rendered = false;
    int meta = world.getBlockMetadata(x, y, z);
    IRenderBuffer renderBuffer = RenderBridge.INSTANCE;
    renderBuffer.setBrightness(0xF000F0);
    double faceOffset = 0.02;
    if (renderer.renderAllFaces || block.shouldSideBeRendered(world, x, y - 1, z, 0)) {
        int pt = colour.getPaintType(0) & 0xFF;
        renderBuffer.setColorOpaque_B(colour.getRed(0), colour.getGreen(0), colour.getBlue(0));
        renderer.renderFaceYNeg(block, x, y, z, block.getIcon(pt, 0));
        if (meta == 1) {
            renderBuffer.setColorOpaque_B((byte) 255, (byte) 255, (byte) 255);
            renderer.renderFaceYNeg(block, x, y - faceOffset, z, block.getIcon(0, meta));
        }
        rendered = true;
    }
    if (renderer.renderAllFaces || block.shouldSideBeRendered(world, x, y + 1, z, 1)) {
        int pt = colour.getPaintType(1) & 0xFF;
        renderBuffer.setColorOpaque_B(colour.getRed(1), colour.getGreen(1), colour.getBlue(1));
        renderer.renderFaceYPos(block, x, y, z, block.getIcon(pt, 0));
        if (meta == 2) {
            renderBuffer.setColorOpaque_B((byte) 255, (byte) 255, (byte) 255);
            renderer.renderFaceYPos(block, x, y + faceOffset, z, block.getIcon(1, meta));
        }
        rendered = true;
    }
    if (renderer.renderAllFaces || block.shouldSideBeRendered(world, x, y, z - 1, 2)) {
        int pt = colour.getPaintType(2) & 0xFF;
        renderBuffer.setColorOpaque_B(colour.getRed(2), colour.getGreen(2), colour.getBlue(2));
        renderer.renderFaceZNeg(block, x, y, z, block.getIcon(pt, 0));
        if (meta == 3) {
            renderBuffer.setColorOpaque_B((byte) 255, (byte) 255, (byte) 255);
            renderer.renderFaceZNeg(block, x, y, z - faceOffset, block.getIcon(2, meta));
        }
        rendered = true;
    }
    if (renderer.renderAllFaces || block.shouldSideBeRendered(world, x, y, z + 1, 3)) {
        int pt = colour.getPaintType(3) & 0xFF;
        renderBuffer.setColorOpaque_B(colour.getRed(3), colour.getGreen(3), colour.getBlue(3));
        renderer.renderFaceZPos(block, x, y, z, block.getIcon(pt, 0));
        if (meta == 4) {
            renderBuffer.setColorOpaque_B((byte) 255, (byte) 255, (byte) 255);
            renderer.renderFaceZPos(block, x, y, z + faceOffset, block.getIcon(3, meta));
        }
        rendered = true;
    }
    if (renderer.renderAllFaces || block.shouldSideBeRendered(world, x - 1, y, z, 4)) {
        int pt = colour.getPaintType(4) & 0xFF;
        renderBuffer.setColorOpaque_B(colour.getRed(4), colour.getGreen(4), colour.getBlue(4));
        renderer.renderFaceXNeg(block, x, y, z, block.getIcon(pt, 0));
        if (meta == 5) {
            renderBuffer.setColorOpaque_B((byte) 255, (byte) 255, (byte) 255);
            renderer.renderFaceXNeg(block, x - faceOffset, y, z, block.getIcon(4, meta));
        }
        rendered = true;
    }
    if (renderer.renderAllFaces || block.shouldSideBeRendered(world, x + 1, y, z, 5)) {
        int pt = colour.getPaintType(5) & 0xFF;
        renderBuffer.setColorOpaque_B(colour.getRed(5), colour.getGreen(5), colour.getBlue(5));
        renderer.renderFaceXPos(block, x, y, z, block.getIcon(pt, 0));
        if (meta == 6) {
            renderBuffer.setColorOpaque_B((byte) 255, (byte) 255, (byte) 255);
            renderer.renderFaceXPos(block, x + faceOffset, y, z, block.getIcon(5, meta));
        }
        rendered = true;
    }
    return rendered;
}
Also used : IRenderBuffer(riskyken.armourersWorkshop.client.render.IRenderBuffer)

Example 4 with IRenderBuffer

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

the class EntityFXPaintSplash method renderParticle.

@Override
public void renderParticle(Tessellator tessellator, float p_70539_2_, float p_70539_3_, float p_70539_4_, float p_70539_5_, float p_70539_6_, float p_70539_7_) {
    IRenderBuffer renderBuffer = RenderBridge.INSTANCE;
    renderBuffer.draw();
    UtilRender.bindTexture(paintSplashTextures);
    renderBuffer.startDrawingQuads();
    renderBuffer.setBrightness(getBrightnessForRender(0));
    float f6 = (particleTextureIndexX) / 8 * 0.5F;
    float f7 = f6 + 0.5F;
    float f8 = (particleTextureIndexY) / 8 * 0.5F;
    float f9 = f8 + 0.5F;
    ;
    float f10 = 0.1F * this.particleScale;
    if (this.particleIcon != null) {
        f6 = this.particleIcon.getMinU();
        f7 = this.particleIcon.getMaxU();
        f8 = this.particleIcon.getMinV();
        f9 = this.particleIcon.getMaxV();
    }
    float f11 = (float) (this.prevPosX + (this.posX - this.prevPosX) * (double) p_70539_2_ - interpPosX);
    float f12 = (float) (this.prevPosY + (this.posY - this.prevPosY) * (double) p_70539_2_ - interpPosY);
    float f13 = (float) (this.prevPosZ + (this.posZ - this.prevPosZ) * (double) p_70539_2_ - interpPosZ);
    renderBuffer.setColourRGBA_F(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha);
    renderBuffer.addVertexWithUV((double) (f11 - p_70539_3_ * f10 - p_70539_6_ * f10), (double) (f12 - p_70539_4_ * f10), (double) (f13 - p_70539_5_ * f10 - p_70539_7_ * f10), (double) f7, (double) f9);
    renderBuffer.addVertexWithUV((double) (f11 - p_70539_3_ * f10 + p_70539_6_ * f10), (double) (f12 + p_70539_4_ * f10), (double) (f13 - p_70539_5_ * f10 + p_70539_7_ * f10), (double) f7, (double) f8);
    renderBuffer.addVertexWithUV((double) (f11 + p_70539_3_ * f10 + p_70539_6_ * f10), (double) (f12 + p_70539_4_ * f10), (double) (f13 + p_70539_5_ * f10 + p_70539_7_ * f10), (double) f6, (double) f8);
    renderBuffer.addVertexWithUV((double) (f11 + p_70539_3_ * f10 - p_70539_6_ * f10), (double) (f12 - p_70539_4_ * f10), (double) (f13 + p_70539_5_ * f10 - p_70539_7_ * f10), (double) f6, (double) f9);
    renderBuffer.draw();
    UtilRender.bindTexture(particleTextures);
    renderBuffer.startDrawingQuads();
}
Also used : IRenderBuffer(riskyken.armourersWorkshop.client.render.IRenderBuffer)

Example 5 with IRenderBuffer

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

the class GuiMiniArmourerBuildingModel method renderModels.

private void renderModels(int mouseX, int mouseY) {
    float scale = 0.0625F;
    GL11.glPushMatrix();
    GL11.glTranslatef(parent.width / 2, parent.height / 2, 500.0F);
    GL11.glScalef((float) (-zoom), (float) zoom, (float) zoom);
    GL11.glRotatef(180F, 0F, 1F, 0F);
    GL11.glRotatef(pitch, 1.0F, 0.0F, 0.0F);
    GL11.glRotatef(rotation, 0F, 1F, 0F);
    GL11.glTranslated(0, 1 * scale, 0);
    GL11.glScalef(-1, -1, 1);
    if (hoverCubeId != 0 && renderCubes != null) {
        int cubeId = (int) Math.ceil((double) hoverCubeId / 6);
        int cubeFace = cubeId * 6 - hoverCubeId;
        if (cubeId - 1 < renderCubes.size() & cubeId - 1 >= 0) {
            MiniCube tarCube = renderCubes.get(cubeId - 1);
            MiniCube newCube = new MiniCube(CubeRegistry.INSTANCE.getCubeFormId((byte) 0));
            ForgeDirection dir = GuiMiniArmourerHelper.getDirectionForCubeFace(cubeFace);
            newCube.setX((byte) (tarCube.getX() + dir.offsetX));
            newCube.setY((byte) (tarCube.getY() + dir.offsetY));
            newCube.setZ((byte) (tarCube.getZ() + dir.offsetZ));
            GL11.glEnable(GL11.GL_BLEND);
            GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
            GL11.glDisable(GL11.GL_TEXTURE_2D);
            IRenderBuffer buff = RenderBridge.INSTANCE;
            buff.startDrawingQuads();
            renderArmourBlock((byte) newCube.getX(), (byte) newCube.getY(), (byte) newCube.getZ(), newCube.getColour(), scale, true);
            buff.draw();
            GL11.glEnable(GL11.GL_TEXTURE_2D);
            GL11.glDisable(GL11.GL_BLEND);
        }
    }
    // Gui.drawRect(0, 0, parent.width, parent.height, 0xFF000000);
    drawBuildingCubes(false);
    GL11.glScalef(-1, -1, 1);
    RenderHelper.enableStandardItemLighting();
    mc.renderEngine.bindTexture(mc.thePlayer.getLocationSkin());
    if (skinPointer != null) {
        Skin skin = ClientSkinCache.INSTANCE.getSkin(skinPointer);
        if (skin != null) {
            for (int i = 0; i < skin.getParts().size(); i++) {
                SkinPart part = skin.getParts().get(i);
                if (part.getPartType() == currentSkinPartType) {
                    SkinPartRenderer.INSTANCE.renderPart(part, scale, skinPointer.getSkinDye(), null, false);
                }
            }
        }
    }
    if (currentSkinPartType != null) {
        GL11.glTranslated(0, -currentSkinPartType.getBuildingSpace().getY() * scale, 0);
        currentSkinPartType.renderBuildingGuide(scale, true, false);
    // SkinRenderHelper.renderBuildingGrid(currentSkinPartType, scale);
    }
    /*
        if (currentSkinType != null) {
            SkinRenderHelper.renderBuildingGuide(currentSkinType, scale, true, false);
            SkinRenderHelper.renderBuildingGrid(currentSkinType, scale);
        }
        */
    GL11.glPopMatrix();
}
Also used : ForgeDirection(net.minecraftforge.common.util.ForgeDirection) MiniCube(riskyken.armourersWorkshop.common.data.MiniCube) IRenderBuffer(riskyken.armourersWorkshop.client.render.IRenderBuffer) Skin(riskyken.armourersWorkshop.common.skin.data.Skin) SkinPart(riskyken.armourersWorkshop.common.skin.data.SkinPart)

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