Example usage for org.lwjgl.opengl GL11 glScaled

List of usage examples for org.lwjgl.opengl GL11 glScaled

Introduction

In this page you can find the example usage for org.lwjgl.opengl GL11 glScaled.

Prototype

public static native void glScaled(@NativeType("GLdouble") double x, @NativeType("GLdouble") double y,
        @NativeType("GLdouble") double z);

Source Link

Document

Double version of #glScalef Scalef .

Usage

From source file:hellfirepvp.astralsorcery.client.render.tile.TESRAltar.java

License:Open Source License

private void renderT2Additions(TileAltar te, double x, double y, double z, double jump) {
    GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
    GL11.glPushMatrix();/*from www  .  ja  va  2 s .  c o  m*/
    GL11.glTranslated(x + 0.5, y + 1.5, z + 0.5);
    GL11.glRotated(180, 1, 0, 0);
    GL11.glScaled(0.0625, 0.0625, 0.0625);
    RenderHelper.disableStandardItemLighting();

    GlStateManager.pushMatrix();
    //GlStateManager.rotate(-30.0F, 0.0F, 1.0F, 0.0F);
    GlStateManager.rotate(180.0F, 1.0F, 0.0F, 0.0F);
    RenderHelper.enableStandardItemLighting();
    GlStateManager.popMatrix();

    texAltar2.bind();
    modelAltar2.render(null, (float) jump, 0, 0, 0, 0, 1F);
    RenderHelper.disableStandardItemLighting();
    GL11.glPopMatrix();
    GL11.glPopAttrib();
}

From source file:hellfirepvp.astralsorcery.client.render.tile.TESRAttunementAltar.java

License:Open Source License

@Override
public void renderTileEntityAt(TileAttunementAltar te, double x, double y, double z, float partialTicks,
        int destroyStage) {
    GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
    GL11.glPushMatrix();/* w  ww.j  a v  a 2 s . co m*/

    GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5);
    GL11.glScaled(0.0625, 0.0625, 0.0625);
    GL11.glRotated(180, 1, 0, 0);

    GlStateManager.pushMatrix();
    GlStateManager.rotate(165.0F, 1.0F, 0.0F, 0.0F);
    RenderHelper.enableStandardItemLighting();
    GlStateManager.popMatrix();

    texModelAttunementAltar.bind();
    modelAttunementAltar.renderBase();
    GL11.glPopMatrix();

    float startY = -1.5F;
    float endY = -0.5F;
    float tickPartY = (endY - startY) / ((float) TileAttunementAltar.MAX_START_ANIMATION_TICK);

    float prevPosY = endY + (te.prevActivationTick * tickPartY);
    float posY = endY + (te.activationTick * tickPartY);
    double framePosY = RenderingUtils.interpolate(prevPosY, posY, partialTicks);

    double generalAnimationTick = ClientScheduler.getClientTick() / 4D;
    if (te.animate) {
        if (te.tesrLocked) {
            te.tesrLocked = false;
        }
    } else {
        if (te.tesrLocked) {
            generalAnimationTick = 7.25D;
        } else {
            if (Math.abs(
                    (generalAnimationTick % TileAttunementAltar.MAX_START_ANIMATION_SPIN) - 7.25D) <= 0.3125) {
                generalAnimationTick = 7.25D;
                te.tesrLocked = true;
            }
        }
    }

    float spinDur = TileAttunementAltar.MAX_START_ANIMATION_SPIN;

    for (int i = 1; i < 9; i++) {
        float incrementer = (spinDur / 8) * i;

        double aFrame = generalAnimationTick + incrementer;
        double prevAFrame = generalAnimationTick + incrementer - 1;
        double renderFrame = RenderingUtils.interpolate(prevAFrame, aFrame, 0);

        double partRenderFrame = (renderFrame % spinDur) / spinDur;
        float normalized = (float) (partRenderFrame * 2F * Math.PI);

        float xOffset = MathHelper.cos(normalized);
        float zOffset = MathHelper.sin(normalized);

        GL11.glPushMatrix();
        GL11.glTranslated(x + 0.5, y + framePosY, z + 0.5);
        GL11.glScaled(0.0625, 0.0625, 0.0625);
        GL11.glRotated(180, 1, 0, 0);

        modelAttunementAltar.renderHovering(xOffset, zOffset,
                (float) RenderingUtils.interpolate(
                        ((float) te.prevActivationTick) / TileAttunementAltar.MAX_START_ANIMATION_TICK,
                        ((float) te.activationTick) / TileAttunementAltar.MAX_START_ANIMATION_TICK,
                        partialTicks));

        GL11.glPopMatrix();
    }

    RenderHelper.disableStandardItemLighting();

    GL11.glPopAttrib();
}

From source file:hellfirepvp.astralsorcery.client.render.tile.TESRLens.java

License:Open Source License

@Override
public void renderTileEntityAt(TileCrystalLens te, double x, double y, double z, float partialTicks,
        int destroyStage) {
    List<BlockPos> linked = te.getLinkedPositions();
    float yaw = 0; //Degree
    float pitch = 0; //Degree
    if (!linked.isEmpty() && linked.size() == 1) {
        BlockPos to = linked.get(0);//from   w  ww . jav  a 2 s.c o m
        BlockPos from = te.getTrPos();
        Vector3 dir = new Vector3(to).subtract(new Vector3(from));

        pitch = (float) Math.atan2(dir.getY(), Math.sqrt(dir.getX() * dir.getX() + dir.getZ() * dir.getZ()));

        yaw = (float) Math.atan2(dir.getX(), dir.getZ());

        yaw = 180F + (float) Math.toDegrees(-yaw);
        pitch = (float) Math.toDegrees(pitch);
    }
    GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);

    GL11.glEnable(GL11.GL_BLEND);
    Blending.DEFAULT.apply();

    GL11.glPushMatrix();
    GL11.glTranslated(x + 0.5, y + 1.335, z + 0.5);
    GL11.glScaled(0.055, 0.055, 0.055);
    GL11.glRotated(180, 1, 0, 0);
    GL11.glRotated(yaw % 360, 0, 1, 0);
    renderHandle(yaw, pitch);
    if (te.getLensColor() != null) {
        GL11.glRotated(180, 0, 1, 0);
        Color c = te.getLensColor().wrappedColor;
        GL11.glColor4f(c.getRed() / 255F, c.getGreen() / 255F, c.getBlue() / 255F, 1F);
        renderColoredLens(yaw, -pitch);
        GL11.glColor4f(1F, 1F, 1F, 1F);
    }
    TextureHelper.refreshTextureBindState();
    GL11.glPopMatrix();
    GL11.glPopAttrib();
}

From source file:hellfirepvp.astralsorcery.client.render.tile.TESRPrismLens.java

License:Open Source License

public static void renderColoredPrismsLast() {
    GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
    GL11.glPushMatrix();//from  w  w w.j a  va  2  s . c o  m
    RenderingUtils.removeStandartTranslationFromTESRMatrix(Minecraft.getMinecraft().getRenderPartialTicks());

    GL11.glEnable(GL11.GL_BLEND);
    Blending.DEFAULT.apply();

    for (TileCrystalPrismLens prism : coloredPositions) {
        Color c = prism.getLensColor().wrappedColor;
        GL11.glPushMatrix();
        BlockPos pos = prism.getPos();

        GL11.glTranslated(pos.getX() + 0.5, pos.getY() + 1.5, pos.getZ() + 0.5);
        GL11.glScaled(0.0625, 0.0625, 0.0625);
        GL11.glRotated(180, 1, 0, 0);

        GL11.glColor4f(c.getRed() / 255F, c.getGreen() / 255F, c.getBlue() / 255F, 1F);
        renderColoredPrism();
        GL11.glColor4f(1F, 1F, 1F, 1F);

        GL11.glPopMatrix();
    }

    coloredPositions.clear();

    GL11.glPopMatrix();
    GL11.glPopAttrib();
}

From source file:hellfirepvp.astralsorcery.client.render.tile.TESRPrismLens.java

License:Open Source License

@Override
public void renderTileEntityAt(TileCrystalPrismLens te, double x, double y, double z, float partialTicks,
        int destroyStage) {
    GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
    GL11.glPushMatrix();/*from  w w w. j  a  v a  2s  .com*/

    if (te.getLinkedPositions().size() > 0) {
        long sBase = 0x5911539513145924L;
        sBase ^= (long) te.getPos().getX();
        sBase ^= (long) te.getPos().getY();
        sBase ^= (long) te.getPos().getZ();
        RenderingUtils.renderLightRayEffects(x + 0.5, y + 0.6, z + 0.5,
                BlockCollectorCrystal.CollectorCrystalType.ROCK_CRYSTAL.displayColor, sBase,
                ClientScheduler.getClientTick(), 9, 50, 25);
    }

    GL11.glTranslated(x + 0.5, y + 0.20, z + 0.5);

    GL11.glScaled(0.6, 0.6, 0.6);
    GL11.glEnable(GL11.GL_BLEND);
    Blending.DEFAULT.apply();
    TESRCollectorCrystal.renderCrystal(false, true);
    RenderHelper.disableStandardItemLighting();
    if (te.getLensColor() != null) {
        coloredPositions.add(te);
        /*GL11.glPopMatrix();
        GL11.glPushMatrix();
        GL11.glTranslated(x + 0.5, y + 1.5, z + 0.5);
        GL11.glScaled(0.0625, 0.0625, 0.0625);
        GL11.glRotated(180, 1, 0, 0);
        GL11.glEnable(GL11.GL_BLEND);
        Blending.DEFAULT.applyServer();
        Color c = te.getLensColor().wrappedColor;
        GL11.glColor4f(c.getRed() / 255F, c.getGreen() / 255F, c.getBlue() / 255F, 1F);
        renderColoredPrism();
        GL11.glColor4f(1F, 1F, 1F, 1F);*/
    }
    TextureHelper.refreshTextureBindState();
    GL11.glPopMatrix();
    GL11.glPopAttrib();
}

From source file:hellfirepvp.astralsorcery.client.render.tile.TESRRitualPedestal.java

License:Open Source License

private void renderCrystalStack(TileRitualPedestal te, double x, double y, double z) {
    ItemStack i = te.getInventoryHandler().getStackInSlot(0);
    if (!i.isEmpty()) {
        Item it = i.getItem();/*w  w w .  j  a  v  a2 s.com*/
        if (it instanceof ItemTunedCrystalBase) {
            GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
            GL11.glPushMatrix();
            boolean celestial = it instanceof ItemTunedCelestialCrystal;
            Color c = celestial ? BlockCollectorCrystalBase.CollectorCrystalType.CELESTIAL_CRYSTAL.displayColor
                    : BlockCollectorCrystalBase.CollectorCrystalType.ROCK_CRYSTAL.displayColor;
            long sBase = 1553015L;
            sBase ^= (long) te.getPos().getX();
            sBase ^= (long) te.getPos().getY();
            sBase ^= (long) te.getPos().getZ();
            RenderingUtils.renderLightRayEffects(x + 0.5, y + 1.3, z + 0.5, c, sBase,
                    ClientScheduler.getClientTick(), 20, 50, 25);

            GL11.glTranslated(x + 0.5, y + 1, z + 0.5);
            GL11.glScaled(0.6, 0.6, 0.6);
            GL11.glEnable(GL11.GL_BLEND);
            GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
            TESRCollectorCrystal.renderCrystal(celestial, true);

            GL11.glPopMatrix();
            GL11.glPopAttrib();
        }
    }
}

From source file:hellfirepvp.astralsorcery.client.util.BlockArrayRenderHelper.java

License:Open Source License

public void render3DGUI(double x, double y, float pTicks) {
    GuiScreen scr = Minecraft.getMinecraft().currentScreen;
    if (scr == null)
        return;/*from  w ww.  j  a v a 2  s  .  co m*/

    GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
    GL11.glPushMatrix();
    Minecraft mc = Minecraft.getMinecraft();
    double sc = new ScaledResolution(mc).getScaleFactor();
    GL11.glTranslated(x + 16D / sc, y + 16D / sc, 512);

    double mul = 10.5;

    double size = 2;
    double minSize = 0.5;

    Vec3i max = blocks.getMax();
    Vec3i min = blocks.getMin();

    double maxLength = 0;
    double pointDst = max.getX() - min.getX();
    if (pointDst > maxLength)
        maxLength = pointDst;
    pointDst = max.getY() - min.getY();
    if (pointDst > maxLength)
        maxLength = pointDst;
    pointDst = max.getZ() - min.getZ();
    if (pointDst > maxLength)
        maxLength = pointDst;
    maxLength -= 5;

    if (maxLength > 0) {
        size = (size - minSize) * (1D - (maxLength / 20D));
    }

    double dr = -5.75 * size;
    GL11.glTranslated(dr, dr, dr);
    GL11.glRotated(rotX, 1, 0, 0);
    GL11.glRotated(rotY, 0, 1, 0);
    GL11.glRotated(rotZ, 0, 0, 1);
    GL11.glTranslated(-dr, -dr, -dr);

    GL11.glScaled(-size * mul, -size * mul, -size * mul);

    BlockRendererDispatcher brd = Minecraft.getMinecraft().getBlockRendererDispatcher();
    VertexFormat blockFormat = DefaultVertexFormats.BLOCK;

    TextureHelper.setActiveTextureToAtlasSprite();
    Tessellator tes = Tessellator.getInstance();
    VertexBuffer vb = tes.getBuffer();

    vb.begin(GL11.GL_QUADS, blockFormat);
    for (Map.Entry<BlockPos, BakedBlockData> data : renderAccess.blockRenderData.entrySet()) {
        BlockPos offset = data.getKey();
        BakedBlockData renderData = data.getValue();
        if (renderData.type != Blocks.AIR) {
            brd.renderBlock(renderData.state, offset, renderAccess, vb);
        }
    }
    tes.draw();

    for (Map.Entry<BlockPos, BakedBlockData> data : renderAccess.blockRenderData.entrySet()) {
        BlockPos offset = data.getKey();
        BakedBlockData renderData = data.getValue();
        if (renderData.tileEntity != null && renderData.tesr != null) {
            renderData.tileEntity.setWorld(Minecraft.getMinecraft().world);
            renderData.tesr.renderTileEntityAt(renderData.tileEntity, offset.getX(), offset.getY(),
                    offset.getZ(), pTicks, 0);
        }
    }

    GL11.glPopMatrix();
    GL11.glPopAttrib();
}

From source file:hellfirepvp.astralsorcery.common.item.wand.ItemArchitectWand.java

License:Open Source License

@Override
@SideOnly(Side.CLIENT)// w  w  w.  ja va 2  s . com
public void onRenderInHandHUD(ItemStack lastCacheInstance, float fadeAlpha, float pTicks) {
    ItemStack blockStackStored = getStoredStateAsStack(lastCacheInstance);
    if (blockStackStored.isEmpty())
        return;

    int amtFound = 0;
    if (Mods.BOTANIA.isPresent()) {
        amtFound = ModIntegrationBotania.getItemCount(Minecraft.getMinecraft().player, lastCacheInstance,
                ItemUtils.createBlockState(blockStackStored));
    } else {
        Collection<ItemStack> stacks = ItemUtils.scanInventoryForMatching(
                new InvWrapper(Minecraft.getMinecraft().player.inventory), blockStackStored, false);
        for (ItemStack stack : stacks) {
            amtFound += stack.getCount();
        }
    }

    int height = 26;
    int width = 26;
    int offsetX = 30;
    int offsetY = 15;

    GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
    GL11.glPushMatrix();
    GL11.glDisable(GL11.GL_ALPHA_TEST);
    GL11.glEnable(GL11.GL_BLEND);
    Blending.DEFAULT.apply();
    ClientRenderEventHandler.texHUDItemFrame.bind();

    GL11.glColor4f(1F, 1F, 1F, fadeAlpha * 0.9F);
    Tessellator tes = Tessellator.getInstance();
    VertexBuffer vb = tes.getBuffer();

    vb.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
    vb.pos(offsetX, offsetY + height, 10).tex(0, 1).endVertex();
    vb.pos(offsetX + width, offsetY + height, 10).tex(1, 1).endVertex();
    vb.pos(offsetX + width, offsetY, 10).tex(1, 0).endVertex();
    vb.pos(offsetX, offsetY, 10).tex(0, 0).endVertex();
    tes.draw();

    TextureHelper.refreshTextureBindState();
    TextureHelper.setActiveTextureToAtlasSprite();

    RenderHelper.enableGUIStandardItemLighting();
    RenderItem ri = Minecraft.getMinecraft().getRenderItem();
    ri.renderItemAndEffectIntoGUI(Minecraft.getMinecraft().player, blockStackStored, offsetX + 5, offsetY + 5);
    RenderHelper.disableStandardItemLighting();
    GlStateManager.enableAlpha(); //Because Mc item rendering..

    GL11.glDisable(GL11.GL_DEPTH_TEST);
    GL11.glPushMatrix();
    GL11.glTranslated(offsetX + 14, offsetY + 16, 0);
    String amtString = String.valueOf(amtFound);
    if (amtFound == -1) {
        amtString = "";
    }
    GL11.glTranslated(-Minecraft.getMinecraft().fontRenderer.getStringWidth(amtString) / 3, 0, 0);
    GL11.glScaled(0.7, 0.7, 0.7);
    if (amtString.length() > 3) {
        GL11.glScaled(0.9, 0.9, 0.9);
    }
    int c = 0x00DDDDDD;
    Minecraft.getMinecraft().fontRenderer.drawStringWithShadow(amtString, 0, 0, c);
    GlStateManager.color(1F, 1F, 1F, 1F);
    TextureHelper.refreshTextureBindState();

    GL11.glPopMatrix();
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    GL11.glPopMatrix();
    GL11.glPopAttrib();
}

From source file:io.github.minecraftgui.models.fonts.UnicodeFont.java

License:Open Source License

@Override
public void drawString(String text, double y, double x, int size, Color color) {
    org.newdawn.slick.UnicodeFont unicodeFonts[] = fonts.get(size + "-" + color.getRGB());

    if (unicodeFonts != null) {
        GL11.glEnable(GL11.GL_BLEND);//from   w w  w.  j  a  v a  2  s.  co  m
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        GL11.glScaled(1f / screen.getScaleFactor(), 1f / screen.getScaleFactor(), 1);
        unicodeFonts[screen.getScaleFactor()].drawString((float) (x * screen.getScaleFactor()),
                (float) (y * screen.getScaleFactor()), text);
        GL11.glScaled(1f * screen.getScaleFactor(), 1f * screen.getScaleFactor(), 1);
    }
}

From source file:ivorius.ivtoolkit.bezier.IvBezierPath3DRendererText.java

License:Apache License

public void render(IvBezierPath3D path) {
    if (path.isDirty()) {
        path.buildDistances();//from   w  w  w.j  ava2  s .  c om
    }

    GL11.glEnable(GL11.GL_BLEND);
    OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO);

    String plainText = "";
    ArrayList<String> modifiers = new ArrayList<>();
    modifiers.add("");

    for (int i = 0; i < text.length(); i++) {
        char character = text.charAt(i);

        if (character == '\u00A7' && i + 1 < text.length()) {
            modifiers.set(modifiers.size() - 1, modifiers.get(modifiers.size() - 1) + text.substring(i, i + 2));
            i++;
        } else {
            plainText = plainText + character;
            modifiers.add(modifiers.get(modifiers.size() - 1));
        }
    }

    for (int i = 0; i < plainText.length(); i++) {
        int charIndex = inwards ? i : plainText.length() - i - 1;
        char character = plainText.charAt(charIndex);

        if (character != ' ') {
            double totalProgress = (spreadToFill ? ((double) i / (double) text.length()) : (i * 0.5)) + shift;
            double finalProgress = ((totalProgress % 1.0) + 1.0) % 1.0;

            if (finalProgress >= capBottom && finalProgress <= capTop) {
                IvBezierPoint3DCachedStep cachedStep = path.getCachedStep(finalProgress);
                double[] position = cachedStep.getPosition();
                double[] rotation = path.getNaturalRotation(cachedStep, 0.01);

                double red = IvMathHelper.mix(cachedStep.getLeftPoint().getRed(),
                        cachedStep.getRightPoint().getRed(), cachedStep.getInnerProgress());
                double green = IvMathHelper.mix(cachedStep.getLeftPoint().getGreen(),
                        cachedStep.getRightPoint().getGreen(), cachedStep.getInnerProgress());
                double blue = IvMathHelper.mix(cachedStep.getLeftPoint().getBlue(),
                        cachedStep.getRightPoint().getBlue(), cachedStep.getInnerProgress());
                double alpha = IvMathHelper.mix(cachedStep.getLeftPoint().getAlpha(),
                        cachedStep.getRightPoint().getAlpha(), cachedStep.getInnerProgress());

                double textSize = IvMathHelper.mix(cachedStep.getLeftPoint().getFontSize(),
                        cachedStep.getRightPoint().getFontSize(), cachedStep.getInnerProgress());

                GL11.glPushMatrix();
                GL11.glTranslated(position[0], position[1], position[2]);
                GL11.glScaled(-textSize / 12.0, -textSize / 12.0, -textSize / 12.0);
                GL11.glRotatef((float) rotation[0] + (inwards ? 0.0f : 180.0f), 0.0f, 1.0f, 0.0f);
                GL11.glRotatef((float) rotation[1], 1.0f, 0.0f, 0.0f);
                fontRenderer.drawString(modifiers.get(charIndex) + character, 0, 0,
                        ((int) (red * 255.0) << 16) + ((int) (green * 255.0) << 8) + ((int) (blue * 255.0)));
                GL11.glPopMatrix();
            }
        }
    }

    GL11.glDisable(GL11.GL_BLEND);
}