Example usage for org.lwjgl.opengl GL11 glScalef

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

Introduction

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

Prototype

public static native void glScalef(@NativeType("GLfloat") float x, @NativeType("GLfloat") float y,
        @NativeType("GLfloat") float z);

Source Link

Document

Manipulates the current matrix with a general scaling matrix along the x-, y- and z- axes.

Usage

From source file:de.sanandrew.mods.claysoldiers.client.render.entity.projectile.RenderBlockProjectile.java

License:Creative Commons License

@Override
public void doRender(Entity entity, double x, double y, double z, float yaw, float partTicks) {
    int blockX = MathHelper.floor_double(entity.posX);
    int blockY = MathHelper.floor_double(entity.posY);
    int blockZ = MathHelper.floor_double(entity.posZ);

    GL11.glPushMatrix();/*from  w  ww  . java 2 s.co m*/
    GL11.glTranslatef((float) x, (float) y, (float) z);
    GL11.glScalef(0.1F, 0.1F, 0.1F);
    this.bindEntityTexture(entity);
    GL11.glDisable(GL11.GL_LIGHTING);

    this.p_renderBlocks.setRenderBoundsFromBlock(this.p_block);
    this.p_renderBlocks.renderBlockSandFalling(this.p_block, entity.worldObj, blockX, blockY, blockZ, 0);

    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glPopMatrix();
}

From source file:de.sanandrew.mods.claysoldiers.client.render.entity.RenderClayMan.java

License:Creative Commons License

@Override
protected void renderLivingAt(EntityLivingBase entityLivingBase, double x, double y, double z) {
    super.renderLivingAt(entityLivingBase, x, y, z);
    GL11.glScalef(0.2F, 0.2F, 0.2F);
    ClaySoldiersMod.EVENT_BUS//from ww w  .  j  a v a  2  s. co m
            .post(new SoldierRenderEvent.RenderLivingEvent((EntityClayMan) entityLivingBase, this, x, y, z));
}

From source file:de.sanandrew.mods.claysoldiers.client.render.item.ItemRendererClayNexus.java

License:Creative Commons License

private void renderNexus(float x, float y, float z) {
    GL11.glPushMatrix();//from  ww w .  j  ava2s  .co  m
    GL11.glTranslatef(x, y + 1.57F + 0.125F, z);
    GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F);
    GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
    GL11.glScalef(1.1875F, 1.1875F, 1.1875F);

    Minecraft.getMinecraft().getTextureManager().bindTexture(Textures.NEXUS_TEXTURE);
    this.modelClayNexus.renderTileEntity();
    Minecraft.getMinecraft().getTextureManager().bindTexture(Textures.NEXUS_GLOWING);
    GL11.glEnable(GL11.GL_BLEND);
    OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO);
    this.modelClayNexus.renderTileEntityGlowmap();
    GL11.glDisable(GL11.GL_BLEND);

    GL11.glPopMatrix();
}

From source file:de.sanandrew.mods.claysoldiers.client.render.tileentity.RenderClayNexus.java

License:Creative Commons License

private static void renderSoldierItem(TileEntityClayNexus nexus, ItemStack stack, float partTicks) {
    float[] colors = new float[] { 1.0F, 1.0F, 1.0F };
    float itmAngle = nexus.prevSpinAngle + (nexus.spinAngle - nexus.prevSpinAngle) * partTicks - 45.0F;

    RGBAValues rgba = SAPUtils.getRgbaFromColorInt(ItemClayManDoll.getTeam(stack).getIconColor());
    colors[0] = rgba.getRed() / 255.0F;/*from  ww  w.ja  v a  2s. co  m*/
    colors[1] = rgba.getGreen() / 255.0F;
    colors[2] = rgba.getBlue() / 255.0F;

    GL11.glPushMatrix();
    GL11.glTranslatef(0.0F, 1.225F, 0.0F);
    GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F);
    GL11.glScalef(0.25F, 0.25F, 0.25F);
    GL11.glRotatef(itmAngle, 0.0F, 1.0F, 0.0F);
    GL11.glTranslatef(-0.5F, 0.0F, 0.0F);
    GL11.glColor3f(colors[0], colors[1], colors[2]);
    ItemRenderHelper.renderItemIn3D(stack);
    GL11.glColor3f(1.0F, 1.0F, 1.0F);
    GL11.glPopMatrix();
}

From source file:de.sanandrew.mods.claysoldiers.client.render.tileentity.RenderClayNexus.java

License:Creative Commons License

private static void renderThrowableItem(TileEntityClayNexus nexus, ItemStack stack, float partTicks) {
    float itmAngle = nexus.prevSpinAngle + (nexus.spinAngle - nexus.prevSpinAngle) * partTicks - 45.0F;
    ASoldierUpgrade upg = SoldierUpgrades.getUpgrade(stack);
    IThrowableUpgrade throwableUpg = upg instanceof IThrowableUpgrade ? (IThrowableUpgrade) upg : null;
    if (throwableUpg == null) {
        return;/*from  w  w  w  .  ja va2 s . c om*/
    }

    GL11.glPushMatrix();
    GL11.glTranslatef(0.0F, 0.875F, 0.0F);
    GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F);
    GL11.glScalef(0.25F, 0.25F, 0.25F);
    GL11.glRotatef(-itmAngle, 0.0F, 1.0F, 0.0F);
    GL11.glTranslatef(-0.5F, 0.0F, 0.0F);
    GL11.glColor3f(1.0F, 1.0F, 1.0F);
    throwableUpg.renderNexusThrowable(nexus, partTicks);
    GL11.glColor3f(1.0F, 1.0F, 1.0F);
    GL11.glPopMatrix();
}

From source file:de.sanandrew.mods.particledeco.client.render.block.RenderParticleBox.java

License:Creative Commons License

@Override
public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {
    Tessellator tessellator = Tessellator.instance;

    block.setBlockBoundsForItemRender();
    renderer.setRenderBoundsFromBlock(block);
    GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
    GL11.glScalef(1.5F, 1.0F, 1.5F);
    GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
    GL11.glScalef(1.0F, 1.5F, 1.0F);//from w w w .j a  v  a 2 s .co  m
    tessellator.startDrawingQuads();
    tessellator.setNormal(0.0F, -1.0F, 0.0F);
    renderer.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 0, 1));
    tessellator.draw();

    tessellator.startDrawingQuads();
    tessellator.setNormal(0.0F, 1.0F, 0.0F);
    renderer.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 1, 1));
    tessellator.draw();

    tessellator.startDrawingQuads();
    tessellator.setNormal(0.0F, 0.0F, -1.0F);
    renderer.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 2, 1));
    tessellator.draw();
    tessellator.startDrawingQuads();
    tessellator.setNormal(0.0F, 0.0F, 1.0F);
    renderer.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 3, 1));
    tessellator.draw();
    tessellator.startDrawingQuads();
    tessellator.setNormal(-1.0F, 0.0F, 0.0F);
    renderer.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 4, 1));
    tessellator.draw();
    tessellator.startDrawingQuads();
    tessellator.setNormal(1.0F, 0.0F, 0.0F);
    renderer.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 5, 1));
    tessellator.draw();
    GL11.glTranslatef(0.5F, 0.5F, 0.5F);
}

From source file:de.sanandrew.mods.turretmod.client.render.entity.RenderTurretArrow.java

License:Creative Commons License

public void doRender(EntityArrow arrow, double x, double y, double z, float yaw, float partTicks) {
    this.bindEntityTexture(arrow);
    GL11.glPushMatrix();/*  www.  jav  a 2 s.  c  o m*/
    GL11.glTranslatef((float) x, (float) y, (float) z);
    GL11.glRotatef(arrow.prevRotationYaw + (arrow.rotationYaw - arrow.prevRotationYaw) * partTicks - 90.0F,
            0.0F, 1.0F, 0.0F);
    GL11.glRotatef(arrow.prevRotationPitch + (arrow.rotationPitch - arrow.prevRotationPitch) * partTicks, 0.0F,
            0.0F, 1.0F);
    Tessellator tessellator = Tessellator.instance;

    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    float shake = arrow.arrowShake - partTicks;

    if (shake > 0.0F) {
        float shakeVal = -MathHelper.sin(shake * 3.0F) * shake;
        GL11.glRotatef(shakeVal, 0.0F, 0.0F, 1.0F);
    }

    float scale = 0.03625F;
    GL11.glRotatef(45.0F, 1.0F, 0.0F, 0.0F);
    GL11.glScalef(scale, scale, scale);
    GL11.glTranslatef(4.0F, 0.0F, 0.0F);
    GL11.glNormal3f(scale, 0.0F, 0.0F);

    tessellator.startDrawingQuads();
    tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, 0.0F, 0.15625F);
    tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, 0.15625F, 0.15625F);
    tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, 0.15625F, 0.3125F);
    tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, 0.0F, 0.3125F);
    tessellator.draw();
    GL11.glNormal3f(-scale, 0.0F, 0.0F);
    tessellator.startDrawingQuads();
    tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, 0.0F, 0.15625F);
    tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, 0.15625F, 0.15625F);
    tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, 0.15625F, 0.3125F);
    tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, 0.0F, 0.3125F);
    tessellator.draw();

    for (int i = 0; i < 4; ++i) {
        GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
        GL11.glNormal3f(0.0F, 0.0F, scale);
        tessellator.startDrawingQuads();
        tessellator.addVertexWithUV(-8.0D, -2.0D, 0.0D, 0.0F, 0.0F);
        tessellator.addVertexWithUV(8.0D, -2.0D, 0.0D, 0.5F, 0.0F);
        tessellator.addVertexWithUV(8.0D, 2.0D, 0.0D, 0.5F, 0.15625F);
        tessellator.addVertexWithUV(-8.0D, 2.0D, 0.0D, 0.0F, 0.15625F);
        tessellator.draw();
    }

    GL11.glDisable(GL12.GL_RESCALE_NORMAL);
    GL11.glPopMatrix();
}

From source file:de.sanandrew.mods.turretmod.client.render.tileentity.RenderItemTransmitter.java

License:Creative Commons License

private static void renderTooltipText(FontRenderer fontRenderer, TileEntityItemTransmitter te, int color,
        float alpha) {
    GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F);
    GL11.glTranslatef(-0.5F, 0.0F, 0.0F);
    GL11.glScalef(0.01F, 0.01F, 0.01F);
    GL11.glTranslatef(8.0F, 8.0F, -1.0F);
    int max = 0xE0;
    int alphaInt = Math.min(Math.max(0x04, MathHelper.ceiling_float_int(max * alpha)), max);
    ItemStack stack = te.getRequestItem();
    Turret turret = te.getRequestingTurret();
    String s;//from  w  w  w .j  a v  a  2 s . c  o  m

    s = SAPUtils.translatePostFormat("Requesting: %s", te.getRequest().name());
    fontRenderer.drawString(s, 0, te.getRequest() == Request.NONE ? 18 : 0, color | (alphaInt << 24));
    if (te.getRequest() != Request.NONE && turret != null && stack != null) {
        s = SAPUtils.translatePostFormat("Item: %s x%d", stack.getDisplayName(), stack.stackSize);
        fontRenderer.drawString(s, 0, 9, color | (alphaInt << 24));
        s = SAPUtils.translatePostFormat("Turret: %s", turret.getTurretName());
        fontRenderer.drawString(s, 0, 18, color | (alphaInt << 24));
        s = SAPUtils.translatePostFormat("    @ x:%.0f y:%.0f z:%.0f", turret.getEntity().posX,
                turret.getEntity().posY, turret.getEntity().posZ);
        fontRenderer.drawString(s, 0, 27, color | (alphaInt << 24));
        s = SAPUtils.translatePostFormat("Expiration time: %d", te.requestTimeout);
        fontRenderer.drawString(s, 0, 36, color | (alphaInt << 24));
    }
}

From source file:de.sanandrew.mods.varietychests.client.renderer.TileEntityCustomChestRenderer.java

License:Creative Commons License

public void renderChestAt(TileEntityCustomChest chest, double x, double y, double z, float partTicks,
        int pass) {
    int meta;//from www  .  j a  va  2 s  .  c  om

    if (!chest.hasWorldObj()) {
        meta = 0;
    } else {
        Block block = chest.getBlockType();
        meta = chest.getBlockMetadata();

        if (block instanceof BlockCustomChest && meta == 0) {
            try {
                ((BlockCustomChest) block).func_149954_e(chest.getWorldObj(), chest.xCoord, chest.yCoord,
                        chest.zCoord);
            } catch (ClassCastException e) {
                FMLLog.severe("Attempted to render a chest at %d,  %d, %d that was not a chest", chest.xCoord,
                        chest.yCoord, chest.zCoord);
            }

            meta = chest.getBlockMetadata();
        }

        chest.checkForAdjacentChests();
    }

    if (chest.adjacentChestZNeg == null && chest.adjacentChestXNeg == null) {
        ModelChest modelchest;

        if (chest.adjacentChestXPos == null && chest.adjacentChestZPos == null) {
            modelchest = this.modelSingleChest;

            if (pass == 0) {
                this.bindTexture(chest.getChestType().textureSng);
            } else {
                if (chest.blockType == VarietyChests.customGlowingChest) {
                    this.bindTexture(Textures.CHEST_GLOWMAP_SNG);
                } else if (chest.blockType == VarietyChests.customTrapChest) {
                    this.bindTexture(Textures.CHEST_TRAPMAP_SNG);
                }
            }

        } else {
            modelchest = this.modelDoubleChest;

            if (pass == 0) {
                this.bindTexture(chest.getChestType().textureDbl);
            } else {
                if (chest.blockType == VarietyChests.customGlowingChest) {
                    this.bindTexture(Textures.CHEST_GLOWMAP_DBL);
                } else if (chest.blockType == VarietyChests.customTrapChest) {
                    this.bindTexture(Textures.CHEST_TRAPMAP_DBL);
                }
            }
        }

        GL11.glPushMatrix();
        GL11.glEnable(GL12.GL_RESCALE_NORMAL);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        GL11.glTranslatef((float) x, (float) y + 1.0F, (float) z + 1.0F);
        GL11.glScalef(1.0F, -1.0F, -1.0F);
        GL11.glTranslatef(0.5F, 0.5F, 0.5F);
        short short1 = 0;

        if (meta == 2) {
            short1 = 180;
        }

        if (meta == 3) {
            short1 = 0;
        }

        if (meta == 4) {
            short1 = 90;
        }

        if (meta == 5) {
            short1 = -90;
        }

        if (meta == 2 && chest.adjacentChestXPos != null) {
            GL11.glTranslatef(1.0F, 0.0F, 0.0F);
        }

        if (meta == 5 && chest.adjacentChestZPos != null) {
            GL11.glTranslatef(0.0F, 0.0F, -1.0F);
        }

        GL11.glRotatef((float) short1, 0.0F, 1.0F, 0.0F);
        GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
        float f1 = chest.prevLidAngle + (chest.lidAngle - chest.prevLidAngle) * partTicks;
        float f2;

        if (chest.adjacentChestZNeg != null) {
            f2 = chest.adjacentChestZNeg.prevLidAngle
                    + (chest.adjacentChestZNeg.lidAngle - chest.adjacentChestZNeg.prevLidAngle) * partTicks;

            if (f2 > f1) {
                f1 = f2;
            }
        }

        if (chest.adjacentChestXNeg != null) {
            f2 = chest.adjacentChestXNeg.prevLidAngle
                    + (chest.adjacentChestXNeg.lidAngle - chest.adjacentChestXNeg.prevLidAngle) * partTicks;

            if (f2 > f1) {
                f1 = f2;
            }
        }

        f1 = 1.0F - f1;
        f1 = 1.0F - f1 * f1 * f1;
        modelchest.chestLid.rotateAngleX = -(f1 * (float) Math.PI / 2.0F);
        if (pass == 1) {
            GL11.glEnable(GL11.GL_BLEND);
            OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO);
            modelchest.renderAll();
            GL11.glDisable(GL11.GL_BLEND);
        } else {
            modelchest.renderAll();
        }
        GL11.glDisable(GL12.GL_RESCALE_NORMAL);
        GL11.glPopMatrix();
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    }
}

From source file:de.sanandrew.mods.varietychests.client.TileEntityCustomChestRenderer.java

License:Creative Commons License

public void renderTileEntityAt(TileEntityCustomChest chest, double x, double y, double z, float partTicks) {
    int meta;/* ww w. j a  v  a 2s  .  co  m*/

    if (!chest.hasWorldObj()) {
        meta = 0;
    } else {
        Block block = chest.getBlockType();
        meta = chest.getBlockMetadata();

        if (block instanceof BlockCustomChest && meta == 0) {
            try {
                ((BlockCustomChest) block).func_149954_e(chest.getWorldObj(), chest.xCoord, chest.yCoord,
                        chest.zCoord);
            } catch (ClassCastException e) {
                FMLLog.severe("Attempted to render a chest at %d,  %d, %d that was not a chest", chest.xCoord,
                        chest.yCoord, chest.zCoord);
            }

            meta = chest.getBlockMetadata();
        }

        chest.checkForAdjacentChests();
    }

    if (chest.adjacentChestZNeg == null && chest.adjacentChestXNeg == null) {
        ModelChest modelchest;

        if (chest.adjacentChestXPos == null && chest.adjacentChestZPos == null) {
            modelchest = this.modelSingleChest;

            this.bindTexture(chest.getChestType().textureSng);
        } else {
            modelchest = this.modelDoubleChest;

            this.bindTexture(chest.getChestType().textureDbl);
        }

        GL11.glPushMatrix();
        GL11.glEnable(GL12.GL_RESCALE_NORMAL);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        GL11.glTranslatef((float) x, (float) y + 1.0F, (float) z + 1.0F);
        GL11.glScalef(1.0F, -1.0F, -1.0F);
        GL11.glTranslatef(0.5F, 0.5F, 0.5F);
        short short1 = 0;

        if (meta == 2) {
            short1 = 180;
        }

        if (meta == 3) {
            short1 = 0;
        }

        if (meta == 4) {
            short1 = 90;
        }

        if (meta == 5) {
            short1 = -90;
        }

        if (meta == 2 && chest.adjacentChestXPos != null) {
            GL11.glTranslatef(1.0F, 0.0F, 0.0F);
        }

        if (meta == 5 && chest.adjacentChestZPos != null) {
            GL11.glTranslatef(0.0F, 0.0F, -1.0F);
        }

        GL11.glRotatef((float) short1, 0.0F, 1.0F, 0.0F);
        GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
        float f1 = chest.prevLidAngle + (chest.lidAngle - chest.prevLidAngle) * partTicks;
        float f2;

        if (chest.adjacentChestZNeg != null) {
            f2 = chest.adjacentChestZNeg.prevLidAngle
                    + (chest.adjacentChestZNeg.lidAngle - chest.adjacentChestZNeg.prevLidAngle) * partTicks;

            if (f2 > f1) {
                f1 = f2;
            }
        }

        if (chest.adjacentChestXNeg != null) {
            f2 = chest.adjacentChestXNeg.prevLidAngle
                    + (chest.adjacentChestXNeg.lidAngle - chest.adjacentChestXNeg.prevLidAngle) * partTicks;

            if (f2 > f1) {
                f1 = f2;
            }
        }

        f1 = 1.0F - f1;
        f1 = 1.0F - f1 * f1 * f1;
        modelchest.chestLid.rotateAngleX = -(f1 * (float) Math.PI / 2.0F);
        modelchest.renderAll();
        GL11.glDisable(GL12.GL_RESCALE_NORMAL);
        GL11.glPopMatrix();
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    }
}