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:gravestone.renderer.tileentity.TileEntityGSHauntedChestRenderer.java

License:LGPL

/**
 * Renders the TileEntity for the chest at a position.
 *//*from  w w  w .  j av  a  2 s. com*/
public void renderTileEntityChestAt(TileEntityGSHauntedChest te, double par2, double par4, double par6,
        float par8) {
    int metadata = 0;

    if (te.hasWorldObj()) {
        metadata = te.getBlockMetadata();
    }

    ModelChest modelchest = this.chestModel;

    if (this.isChristmas) {
        this.bindTexture(Resources.CHRISTMAS_CHEST);
    } else {
        this.bindTexture(Resources.DEFAULT_CHEST);
    }

    GL11.glPushMatrix();
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    GL11.glColor4f(1, 1, 1, 1);
    GL11.glTranslatef((float) par2, (float) par4 + 1, (float) par6 + 1);
    GL11.glScalef(1, -1, -1);
    GL11.glTranslatef(0.5F, 0.5F, 0.5F);
    float direction = 0;

    switch (metadata) {
    case 2:
        direction = 180;
        break;
    case 3:
        direction = 0;
        break;
    case 4:
        direction = 90;
        break;
    case 5:
        direction = -90;
        break;
    }

    GL11.glRotatef(direction, 0, 1, 0);
    GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
    float f1 = te.prevLidAngle + (te.lidAngle - te.prevLidAngle) * par8;

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

From source file:gravestone.renderer.tileentity.TileEntityGSMemorialRenderer.java

License:LGPL

@Override
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float f, int par9) {
    TileEntityGSMemorial tileEntity = (TileEntityGSMemorial) te;
    EnumMemorials memorialType = tileEntity.getMemorialType();
    int meta = 0;

    if (tileEntity.getWorld() != null) {
        meta = tileEntity.getBlockMetadata();
    }//from www  .  j  a  va  2  s  .  c  o  m
    EnumFacing facing = EnumFacing.values()[meta];

    GL11.glPushMatrix();

    if (tileEntity.getWorld() != null) {
        GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
        GL11.glScalef(1, -1, -1);
    } else {
        switch (memorialType.getMemorialType()) {
        case CROSS:
        case OBELISK:
            GL11.glTranslatef((float) x + 0.5F, (float) y + 0.5F, (float) z + 0.5F);
            GL11.glScalef(0.4F, -0.4F, -0.4F);
            break;
        default:
            GL11.glTranslatef((float) x + 0.5F, (float) y + 0.8F, (float) z + 0.5F);
            GL11.glScalef(0.7F, -0.7F, -0.7F);
            break;
        }
    }

    switch (facing) {
    case SOUTH:
        GL11.glRotatef(0, 0, 1, 0);
        break;
    case WEST:
        GL11.glRotatef(90, 0, 1, 0);
        break;
    case NORTH:
        GL11.glRotatef(180, 0, 1, 0);
        break;
    case EAST:
        GL11.glRotatef(270, 0, 1, 0);
        break;
    }
    //
    //        if (memorialType == 9) {
    //            celticCross.renderAll();
    //        } else
    boolean isMossy = tileEntity.isMossy();
    ModelMemorial model = getModel(memorialType.getMemorialType());
    model.setPedestalTexture(getPedestalTexture(memorialType, isMossy));
    switch (memorialType.getMemorialType()) {
    case CREEPER_STATUE:
        bindTextureByName(getTexture(memorialType, memorialType.getTexture(), isMossy));
        model.customRender(tileEntity.isEnchanted());
        break;
    case STEVE_STATUE:
        bindTextureByName(getTexture(memorialType, memorialType.getTexture(), isMossy));
        model.customRender(getArmorTexture(memorialType, isMossy), tileEntity.isEnchanted());
        break;
    case GIBBET:
    case STOCKS:
    case BURNING_STAKE:
        bindTextureByName(memorialType.getTexture());
        model.customRender(memorialType, tileEntity.getHangedMob(), tileEntity.getHangedVillagerProfession());
        break;
    default:
        bindTextureByName(getTexture(memorialType, memorialType.getTexture(), isMossy));
        if (tileEntity.isEnchanted()) {
            model.renderEnchanted();
        } else {
            model.renderAll();
        }
    }

    GL11.glPopMatrix();
}

From source file:gravestone.renderer.tileentity.TileEntityGSPileOfBonesRenderer.java

License:LGPL

public void renderTileEntityCandleAt(TileEntityGSPileOfBones tileEntity, float x, float y, float z,
        float par8) {
    this.bindTexture(Resources.PILE_OF_BONES);

    int meta;/*from  ww  w .  j  a v  a  2 s.  c  o  m*/

    GL11.glPushMatrix();
    if (tileEntity.getWorld() == null) {
        GL11.glTranslatef(x + 0.5F, y + 2.7F, z + 0.5F);
        GL11.glScalef(1.8F, -1.8F, -1.8F);
        GL11.glRotatef(-90, 0, 1, 0);
        meta = tileEntity.getBlockMetadata();
    } else {
        GL11.glTranslatef(x + 0.5F, y + 1.5F, z + 0.5F);
        GL11.glScalef(1, -1, -1);
        meta = tileEntity.getBlockMetadata();
        int direction = tileEntity.getDirection();
        switch (direction) {
        case 1:
            direction = -90;
            break;
        case 0:
            direction = 180;
            break;
        case 2:
            direction = 0;
            break;
        case 3:
        default:
            direction = 90;
            break;
        }
        GL11.glRotatef(direction, 0, 1, 0);
    }

    pileOfBonesModel.renderAll(meta != 0);
    GL11.glPopMatrix();
}

From source file:gravestone.renderer.tileentity.TileEntityGSSkullCandleRenderer.java

License:LGPL

public void renderTileEntitySkullAt(TileEntityGSSkullCandle tileEntity, float x, float y, float z, float par8) {
    float rotation = 0;
    byte meta;// w  w w.  j a  va  2s.c  om
    if (tileEntity.getWorld() != null) {
        rotation = (tileEntity.getRotation() * 360) / 8F;
        meta = (byte) tileEntity.getBlockMetadata();
    } else {
        meta = (byte) tileEntity.getBlockMetadata();//(byte) tileEntity.blockMetadata;
    }

    bindSkullCandleTexture(EnumSkullCandle.getById(meta));

    GL11.glPushMatrix();
    if (tileEntity.getWorld() == null) {
        GL11.glTranslatef(x + 0.5F, y + 2.2F, z + 0.5F);
        GL11.glScalef(1.5F, -1.5F, -1.5F);
    } else {
        GL11.glTranslatef(x + 0.5F, y + 1.5F, z + 0.5F);
        GL11.glScalef(1, -1, -1);
    }
    GL11.glRotatef(rotation, 0, 1, 0);

    skullCandleModel.renderAll();
    GL11.glPopMatrix();
}

From source file:gravestone.renderer.tileentity.TileEntityGSSpawnerRenderer.java

License:LGPL

/**
 * Render a skull tile entity.//from   w  ww  . j  a  v a2 s .com
 */
public void renderSpawnerPentagramAt(TileEntityGSSpawner tileEntity, float x, float y, float z, float par8) {

    this.bindTexture(Resources.PENTAGRAM);

    GL11.glPushMatrix();
    if (tileEntity.getWorld() != null) {
        GL11.glTranslatef(x + 0.5F, y + 1.5F, z + 0.5F);
        GL11.glScalef(1, -1, -1);
    } else {
        GL11.glTranslatef(x + 0.5F, y + 1, z + 0.5F);
        GL11.glScalef(0.6F, -0.6F, -0.6F);
    }
    GL11.glTranslated(0, -0.01, 0);

    EnumSpawner spawnerType = EnumSpawner.getById((byte) tileEntity.getBlockMetadata());
    ModelSpawnerPentagram spawner = getSpawnerModel(spawnerType);
    spawner.renderAll();
    GL11.glPopMatrix();
}

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

License:Open Source License

@Override
public void renderTileEntityAt(TileCelestialCrystals te, double x, double y, double z, float partialTicks,
        int destroyStage) {
    GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
    GL11.glPushMatrix();//  w  w  w  . j  ava  2 s .  co m
    RenderHelper.disableStandardItemLighting();
    GL11.glTranslated(x + 0.5, y + 0.1, z + 0.5);
    float size = 0.2F;
    GL11.glScalef(size, size, size);

    int r = 0x59A51481;
    BlockPos at = te.getPos();
    r ^= at.getX();
    r ^= at.getY();
    r ^= at.getZ();
    r = Math.abs(r);
    r = rotMapping[r % rotMapping.length];
    GL11.glRotated(r, 0, 1, 0);

    renderCelestialCrystals(te.getGrowth());
    RenderHelper.enableStandardItemLighting();
    GL11.glPopMatrix();
    GL11.glPopAttrib();
}

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

License:Open Source License

@Override
public void render(ItemStack stack) {
    GL11.glPushMatrix();/*from w  ww . java2  s.c  o m*/
    GL11.glTranslated(0.5, 0.25, 0.5);
    GL11.glScalef(0.2F, 0.2F, 0.2F);
    GL11.glRotated(-10, 0, 0, 1);
    GL11.glRotated(20, 1, 0, 0);
    GL11.glRotated(-70, 0, 1, 0);
    GL11.glDisable(GL11.GL_CULL_FACE);
    RenderHelper.disableStandardItemLighting();
    renderCelestialCrystals(MathHelper.clamp(stack.getItemDamage(), 0, 4));
    RenderHelper.enableStandardItemLighting();
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glPopMatrix();
}

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

License:Open Source License

private static void renderTile(BindableResource tex) {
    GL11.glPushMatrix();//  ww  w  .j  a  v a2s.  c om
    GL11.glScalef(0.13F, 0.13F, 0.13F);
    tex.bind();
    if (dlCrystal == -1) {
        dlCrystal = GLAllocation.generateDisplayLists(1);
        GL11.glNewList(dlCrystal, GL11.GL_COMPILE);
        OBJModelLibrary.bigCrystal.renderAll(true);
        GL11.glEndList();
    }
    GL11.glCallList(dlCrystal);

    GL11.glPopMatrix();
}

From source file:illarion.graphics.lwjgl.render.TextureRenderDisplaylist.java

License:Open Source License

/**
 * Draw a texture using display lists at a specified location.
 * // www  . j av a  2  s . co  m
 * @param x the x coordinate of the texture
 * @param y the y coordinate of the texture
 * @param z the z coordinate (so the layer) of the texture
 * @param width the width of the area the texture shall be rendered on
 * @param height the height of the area the texture shall be rendered on
 * @param texture the texture that shall be drawn
 * @param color the color that is supposed to be used with that texture
 * @param mirror mirror the texture horizontal
 * @param rotation the value the texture is rotated by
 */
@Override
public void drawTexture(final float x, final float y, final float z, final float width, final float height,
        final TextureLWJGL texture, final SpriteColor color, final boolean mirror, final float rotation) {

    DriverSettingsLWJGL.getInstance().enableTexture(texture.getTextureID());
    color.setActiveColor();
    GL11.glPushMatrix();

    int xmod = 1;
    if (mirror) {
        xmod = -1;
        GL11.glTranslatef(x + width, y, z);
    } else {
        GL11.glTranslatef(x, y, z);
    }
    if (rotation != 0.f) {
        GL11.glRotatef(rotation, 0, 0, 1);
    }
    GL11.glScalef(width * xmod, height, 1.f);
    GL11.glTranslatef(0.5f, 0.5f, 0);

    GL11.glCallList(texture.getDisplayListID());

    GL11.glPopMatrix();
}

From source file:illarion.graphics.lwjgl.render.TextureRenderImmediate.java

License:Open Source License

/**
 * Draw a texture at a specified location using the immediate mode.
 * /*from   ww  w. jav a 2s  .  co  m*/
 * @param x the x coordinate of the texture
 * @param y the y coordinate of the texture
 * @param z the z coordinate (so the layer) of the texture
 * @param width the width of the area the texture shall be rendered on
 * @param height the height of the area the texture shall be rendered on
 * @param texture the texture that shall be drawn
 * @param color the color that is supposed to be used with that texture
 * @param mirror mirror the texture horizontal
 * @param rotation the value the texture is rotated by
 */
@Override
public void drawTexture(final float x, final float y, final float z, final float width, final float height,
        final TextureLWJGL texture, final SpriteColor color, final boolean mirror, final float rotation) {

    DriverSettingsLWJGL.getInstance().enableTexture(texture.getTextureID());
    color.setActiveColor();

    GL11.glPushMatrix();

    int xmod = 1;
    if (mirror) {
        xmod = -1;
        GL11.glTranslatef(x + width, y, z);
    } else {
        GL11.glTranslatef(x, y, z);
    }

    GL11.glScalef(width * xmod, height, 1.f);
    GL11.glTranslatef(0.5f, 0.5f, 0);

    if (rotation != 0.f) {
        GL11.glRotatef(rotation, 0, 0, 1);
    }

    GL11.glBegin(GL11.GL_TRIANGLE_STRIP);

    if (mirror) {
        GL11.glTexCoord2d(texture.getRelX2(), texture.getRelY2());
        GL11.glVertex2f(-0.5f, -0.5f);
        GL11.glTexCoord2d(texture.getRelX2(), texture.getRelY1());
        GL11.glVertex2f(-0.5f, 0.5f);
        GL11.glTexCoord2d(texture.getRelX1(), texture.getRelY2());
        GL11.glVertex2f(0.5f, -0.5f);
        GL11.glTexCoord2d(texture.getRelX1(), texture.getRelY1());
        GL11.glVertex2f(0.5f, 0.5f);
    } else {
        GL11.glTexCoord2d(texture.getRelX1(), texture.getRelY2());
        GL11.glVertex2f(-0.5f, -0.5f);
        GL11.glTexCoord2d(texture.getRelX1(), texture.getRelY1());
        GL11.glVertex2f(-0.5f, 0.5f);
        GL11.glTexCoord2d(texture.getRelX2(), texture.getRelY2());
        GL11.glVertex2f(0.5f, -0.5f);
        GL11.glTexCoord2d(texture.getRelX2(), texture.getRelY1());
        GL11.glVertex2f(0.5f, 0.5f);
    }

    GL11.glEnd();
    GL11.glPopMatrix();
}