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:kihira.minicreatures.client.model.parts.PartModelHorns.java

License:Open Source License

@Override
public void render(Entity entity, ModelBase modelBase, float par2, float par3, float par4, float par5,
        float par6, float par7) {
    Minecraft.getMinecraft().renderEngine.bindTexture(ClientProxy.specialTextures);
    ModelMiniPlayer modelMiniPlayer = (ModelMiniPlayer) modelBase;

    this.hornLeftBase.rotateAngleY = modelMiniPlayer.bipedHead.rotateAngleY;
    this.hornLeftBase.rotateAngleX = modelMiniPlayer.bipedHead.rotateAngleX;
    this.hornRightBase.rotateAngleY = modelMiniPlayer.bipedHead.rotateAngleY;
    this.hornRightBase.rotateAngleX = modelMiniPlayer.bipedHead.rotateAngleX;

    GL11.glPushMatrix();/*from   ww w  .j  a  v a 2  s  . c o m*/
    GL11.glScalef(1.5F / 2F, 1.5F / 2F, 1.5F / 2F);
    GL11.glTranslatef(0.0F, 16.0F * par7, 0.0F);
    this.hornLeftBase.render(par7);
    this.hornRightBase.render(par7);
    GL11.glPopMatrix();
}

From source file:kihira.minicreatures.client.model.parts.PartModelTail.java

License:Open Source License

@Override
public void render(Entity entity, ModelBase modelMiniPlayer, float par2, float par3, float par4, float par5,
        float par6, float par7) {
    Minecraft.getMinecraft().renderEngine.bindTexture(ClientProxy.specialTextures);
    GL11.glPushMatrix();/*from www . j  a v a  2 s .  c  o m*/
    GL11.glScalef(1.0F / 2F, 1.0F / 2F, 1.0F / 2F);
    GL11.glTranslatef(0.0F, 24.0F * par7, 0.0F);
    this.tailBase.render(par7);
    this.tailPart1.render(par7);
    this.tailPart2.render(par7);
    this.tailTip.render(par7);
    GL11.glPopMatrix();
}

From source file:kihira.minicreatures.client.render.RenderMiniPlayer.java

License:Open Source License

@Override
protected void renderEquippedItems(EntityLivingBase par1EntityLivingBase, float par2) {
    ItemStack itemstack = par1EntityLivingBase.getHeldItem();
    EntityMiniPlayer miniPlayer = (EntityMiniPlayer) par1EntityLivingBase;
    if (itemstack != null) {
        IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(itemstack, EQUIPPED);
        boolean is3D = (customRenderer != null
                && customRenderer.shouldUseRenderHelper(EQUIPPED, itemstack, BLOCK_3D));
        if (miniPlayer.isSitting())
            GL11.glTranslatef(0F, 0.3F, 0F);
        //If item is a block or has a custom renderer
        if (itemstack.getItem() instanceof ItemBlock && (is3D
                || RenderBlocks.renderItemIn3d(Block.getBlockFromItem(itemstack.getItem()).getRenderType()))) {
            GL11.glTranslatef(0.0F, 0.8875F, -0.3F);
            GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F);
            GL11.glScalef(-0.3F, -0.3F, -0.3F);
            this.renderManager.itemRenderer.renderItem(par1EntityLivingBase, itemstack, 0);
        }//from  w ww  . j av a 2 s.co  m
        //Otherwise render "2D"
        else {
            GL11.glTranslatef(0F, 0.725F, -0.025F);
            GL11.glScalef(0.5F, 0.5F, 0.5F);
            super.renderEquippedItems(par1EntityLivingBase, par2);
        }
    }
}

From source file:kihira.tails.client.gui.GuiEditor.java

License:Open Source License

private void drawEntity(int x, int y, int scale, float yaw, float pitch, EntityLivingBase entity) {
    float prevHeadYaw = entity.rotationYawHead;
    float prevRotYaw = entity.rotationYaw;
    float prevRotPitch = entity.rotationPitch;
    ItemStack prevItemStack = entity.getHeldItem();

    GL11.glPushMatrix();/*from  w ww . ja  v a2s .c  o m*/
    GL11.glTranslatef(x, y, -10F);
    GL11.glScalef(-scale, scale, scale);
    GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);
    GL11.glTranslatef(0.0F, entity.yOffset, 0.0F);
    GL11.glRotatef(pitch, 1F, 0.0F, 0.0F);
    GL11.glRotatef(yaw, 0F, 1F, 0.0F);

    entity.rotationYawHead = 0F;
    entity.rotationYaw = 0F;
    entity.rotationPitch = 0F;
    entity.renderYawOffset = 0F;
    entity.setSneaking(false);
    entity.setCurrentItemOrArmor(0, null);

    RenderHelper.enableStandardItemLighting();
    RenderManager.instance.playerViewY = 180.0F;
    RenderManager.instance.renderEntityWithPosYaw(entity, 0D, 0D, 0D, 0F, 1F);
    RenderHelper.disableStandardItemLighting();
    OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit);

    entity.rotationYawHead = prevHeadYaw;
    entity.rotationYaw = prevRotYaw;
    entity.rotationPitch = prevRotPitch;
    entity.setCurrentItemOrArmor(0, prevItemStack);

    GL11.glPopMatrix();
}

From source file:kihira.tails.client.gui.GuiEditor.java

License:Open Source License

private void renderPart(int x, int y, int scale, PartInfo partInfo) {
    GL11.glPushMatrix();/* w  ww  .  j  a  va 2  s.c o  m*/
    GL11.glTranslatef(x, y, 10F);
    GL11.glScalef(-scale, scale, 1F);

    RenderHelper.enableStandardItemLighting();
    RenderManager.instance.playerViewY = 180.0F;
    PartRegistry.getRenderPart(partInfo.partType, partInfo.typeid).render(this.fakeEntity, partInfo, 0, 0, 0,
            0);
    RenderHelper.disableStandardItemLighting();
    OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit);

    GL11.glPopMatrix();
}

From source file:kihira.tails.client.gui.PartsPanel.java

License:Open Source License

private void renderPart(int x, int y, int z, int scale, PartInfo partInfo) {
    GL11.glPushMatrix();/*from   w w  w  .ja  v a 2  s . com*/
    GL11.glTranslatef(x, y, z);
    GL11.glScalef(-scale, scale, 1F);

    RenderHelper.enableStandardItemLighting();
    RenderManager.instance.playerViewY = 180.0F;
    PartRegistry.getRenderPart(partInfo.partType, partInfo.typeid).render(fakeEntity, partInfo, 0, 0, 0, 0);
    RenderHelper.disableStandardItemLighting();
    OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit);

    GL11.glPopMatrix();
}

From source file:kihira.tails.client.render.FakeEntityRenderHelper.java

License:Open Source License

@Override
public void onPreRenderTail(EntityLivingBase entity, RenderPart tail, PartInfo info, double x, double y,
        double z) {
    switch (info.partType) {
    case TAIL: {//  w  w w .ja  va2s.c o m
        //Nine tails
        if (info.typeid == 0 && info.subid == 2) {
            GL11.glTranslatef(0F, 0.85F, 0F);
        } else
            GL11.glTranslatef(0F, 0.65F, 0F);
        GL11.glScalef(0.9F, 0.9F, 0.9F);
        break;
    }
    case EARS: {
        GL11.glRotatef(180F, 0F, 1F, 0F);
        GL11.glTranslatef(0F, 1.4F, 0F);
        break;
    }
    case WINGS: {
        GL11.glTranslatef(0F, 0.9F, 0F);
        GL11.glScalef(0.6F, 0.6F, 0.6F);
        break;
    }
    }
}

From source file:kihira.tails.client.render.PlayerRenderHelper.java

License:Open Source License

@Override
public void onPreRenderTail(EntityLivingBase entity, RenderPart tail, PartInfo info, double x, double y,
        double z) {
    if (info.partType == PartsData.PartType.EARS)
        return;/*  w  ww  .  j a v  a 2 s.  c  o  m*/
    if (info.partType == PartsData.PartType.WINGS)
        return;
    if (tail.modelPart instanceof ModelDragonTail) {
        GL11.glTranslatef(0F, 0.68F, 0.1F);
        GL11.glScalef(0.8F, 0.8F, 0.8F);
    } else if (tail.modelPart instanceof ModelCatTail || tail.modelPart instanceof ModelDevilTail) {
        GL11.glTranslatef(0F, 0.65F, 0.1F);
        GL11.glScalef(0.9F, 0.9F, 0.9F);
    } else {
        GL11.glTranslatef(0F, 0.65F, 0.1F);
        GL11.glScalef(0.8F, 0.8F, 0.8F);
    }
}

From source file:kihira.tails.client.render.RenderWings.java

License:Open Source License

@Override
protected void doRender(EntityLivingBase entity, PartInfo info, float partialTicks) {
    Minecraft.getMinecraft().renderEngine.bindTexture(info.getTexture());
    Tessellator tessellator = Tessellator.instance;
    boolean isFlying = entity instanceof EntityPlayer && ((EntityPlayer) entity).capabilities.isFlying
            && entity.isAirBorne || entity.fallDistance > 0F;
    float timestep = ModelPartBase.getAnimationTime(isFlying ? 500 : 6500, entity);
    float angle = (float) Math.sin(timestep) * (isFlying ? 24F : 4F);
    float scale = info.subid == 1 ? 1F : 2F;

    GL11.glTranslatef(0, -(scale * 8F) * ModelPartBase.SCALE + (info.subid == 1 ? 0.1F : 0), 0.1F);
    GL11.glRotatef(90, 0, 1, 0);//  w  ww  .  ja va 2  s.  co  m
    GL11.glRotatef(90, 0, 0, 1);
    GL11.glScalef(scale, scale, scale);
    GL11.glTranslatef(0.1F, -0.4F * ModelPartBase.SCALE, -0.025F);

    GL11.glPushMatrix();
    GL11.glTranslatef(0F, 0F, 1F * ModelPartBase.SCALE);
    GL11.glRotatef(30F - angle, 1F, 0F, 0F);
    ItemRenderer.renderItemIn2D(tessellator, 0, 0, 1, 1, 32, 32, ModelPartBase.SCALE / scale);
    GL11.glPopMatrix();

    GL11.glPushMatrix();
    GL11.glTranslatef(0F, 0.3F * ModelPartBase.SCALE, 0F);
    GL11.glRotatef(-30F + angle, 1F, 0F, 0F);
    ItemRenderer.renderItemIn2D(tessellator, 0, 0, 1, 1, 32, 32, ModelPartBase.SCALE / scale);
    GL11.glPopMatrix();
}

From source file:kuake2.render.lwjgl.Mesh.java

License:Open Source License

/**
 * R_DrawAliasModel/*from  w w  w .ja  v a2s .  co  m*/
 */
void R_DrawAliasModel(entity_t e) {
    if ((e.flags & Defines.RF_WEAPONMODEL) == 0) {
        if (R_CullAliasModel(e))
            return;
    }

    if ((e.flags & Defines.RF_WEAPONMODEL) != 0) {
        if (r_lefthand.value == 2.0f)
            return;
    }

    qfiles.dmdl_t paliashdr = (qfiles.dmdl_t) currentmodel.extradata;

    //
    // get lighting information
    //
    // PMM - rewrote, reordered to handle new shells & mixing
    // PMM - 3.20 code .. replaced with original way of doing it to keep mod authors happy
    //
    int i;
    if ((currententity.flags & (Defines.RF_SHELL_HALF_DAM | Defines.RF_SHELL_GREEN | Defines.RF_SHELL_RED
            | Defines.RF_SHELL_BLUE | Defines.RF_SHELL_DOUBLE)) != 0) {
        Math3D.VectorClear(shadelight);
        if ((currententity.flags & Defines.RF_SHELL_HALF_DAM) != 0) {
            shadelight[0] = 0.56f;
            shadelight[1] = 0.59f;
            shadelight[2] = 0.45f;
        }
        if ((currententity.flags & Defines.RF_SHELL_DOUBLE) != 0) {
            shadelight[0] = 0.9f;
            shadelight[1] = 0.7f;
        }
        if ((currententity.flags & Defines.RF_SHELL_RED) != 0)
            shadelight[0] = 1.0f;
        if ((currententity.flags & Defines.RF_SHELL_GREEN) != 0)
            shadelight[1] = 1.0f;
        if ((currententity.flags & Defines.RF_SHELL_BLUE) != 0)
            shadelight[2] = 1.0f;
    } else if ((currententity.flags & Defines.RF_FULLBRIGHT) != 0) {
        for (i = 0; i < 3; i++)
            shadelight[i] = 1.0f;
    } else {
        R_LightPoint(currententity.origin, shadelight);

        // player lighting hack for communication back to server
        // big hack!
        if ((currententity.flags & Defines.RF_WEAPONMODEL) != 0) {
            // pick the greatest component, which should be the same
            // as the mono value returned by software
            if (shadelight[0] > shadelight[1]) {
                if (shadelight[0] > shadelight[2])
                    r_lightlevel.value = 150 * shadelight[0];
                else
                    r_lightlevel.value = 150 * shadelight[2];
            } else {
                if (shadelight[1] > shadelight[2])
                    r_lightlevel.value = 150 * shadelight[1];
                else
                    r_lightlevel.value = 150 * shadelight[2];
            }
        }

        if (gl_monolightmap.string.charAt(0) != '0') {
            float s = shadelight[0];

            if (s < shadelight[1])
                s = shadelight[1];
            if (s < shadelight[2])
                s = shadelight[2];

            shadelight[0] = s;
            shadelight[1] = s;
            shadelight[2] = s;
        }
    }

    if ((currententity.flags & Defines.RF_MINLIGHT) != 0) {
        for (i = 0; i < 3; i++)
            if (shadelight[i] > 0.1f)
                break;
        if (i == 3) {
            shadelight[0] = 0.1f;
            shadelight[1] = 0.1f;
            shadelight[2] = 0.1f;
        }
    }

    if ((currententity.flags & Defines.RF_GLOW) != 0) { // bonus items will pulse with time
        float scale;
        float min;

        scale = (float) (0.1f * Math.sin(r_newrefdef.time * 7));
        for (i = 0; i < 3; i++) {
            min = shadelight[i] * 0.8f;
            shadelight[i] += scale;
            if (shadelight[i] < min)
                shadelight[i] = min;
        }
    }

    // =================
    // PGM   ir goggles color override
    if ((r_newrefdef.rdflags & Defines.RDF_IRGOGGLES) != 0
            && (currententity.flags & Defines.RF_IR_VISIBLE) != 0) {
        shadelight[0] = 1.0f;
        shadelight[1] = 0.0f;
        shadelight[2] = 0.0f;
    }
    // PGM
    // =================

    shadedots = r_avertexnormal_dots[((int) (currententity.angles[1] * (SHADEDOT_QUANT / 360.0)))
            & (SHADEDOT_QUANT - 1)];

    float an = (float) (currententity.angles[1] / 180 * Math.PI);
    shadevector[0] = (float) Math.cos(-an);
    shadevector[1] = (float) Math.sin(-an);
    shadevector[2] = 1;
    Math3D.VectorNormalize(shadevector);

    //
    // locate the proper data
    //

    c_alias_polys += paliashdr.num_tris;

    //
    // draw all the triangles
    //
    if ((currententity.flags & Defines.RF_DEPTHHACK) != 0) // hack the depth range to prevent view model from poking into walls
        GL11.glDepthRange(gldepthmin, gldepthmin + 0.3 * (gldepthmax - gldepthmin));

    if ((currententity.flags & Defines.RF_WEAPONMODEL) != 0 && (r_lefthand.value == 1.0f)) {
        GL11.glMatrixMode(GL11.GL_PROJECTION);
        GL11.glPushMatrix();
        GL11.glLoadIdentity();
        GL11.glScalef(-1, 1, 1);
        MYgluPerspective(r_newrefdef.fov_y, (float) r_newrefdef.width / r_newrefdef.height, 4, 4096);
        GL11.glMatrixMode(GL11.GL_MODELVIEW);

        GL11.glCullFace(GL11.GL_BACK);
    }

    GL11.glPushMatrix();
    e.angles[PITCH] = -e.angles[PITCH]; // sigh.
    R_RotateForEntity(e);
    e.angles[PITCH] = -e.angles[PITCH]; // sigh.

    image_t skin;
    // select skin
    if (currententity.skin != null)
        skin = currententity.skin; // custom player skin
    else {
        if (currententity.skinnum >= qfiles.MAX_MD2SKINS)
            skin = currentmodel.skins[0];
        else {
            skin = currentmodel.skins[currententity.skinnum];
            if (skin == null)
                skin = currentmodel.skins[0];
        }
    }
    if (skin == null)
        skin = r_notexture; // fallback...
    GL_Bind(skin.texnum);

    // draw it

    GL11.glShadeModel(GL11.GL_SMOOTH);

    GL_TexEnv(GL11.GL_MODULATE);
    if ((currententity.flags & Defines.RF_TRANSLUCENT) != 0) {
        GL11.glEnable(GL11.GL_BLEND);
    }

    if ((currententity.frame >= paliashdr.num_frames) || (currententity.frame < 0)) {
        VID.Printf(Defines.PRINT_ALL,
                "R_DrawAliasModel " + currentmodel.name + ": no such frame " + currententity.frame + '\n');
        currententity.frame = 0;
        currententity.oldframe = 0;
    }

    if ((currententity.oldframe >= paliashdr.num_frames) || (currententity.oldframe < 0)) {
        VID.Printf(Defines.PRINT_ALL, "R_DrawAliasModel " + currentmodel.name + ": no such oldframe "
                + currententity.oldframe + '\n');
        currententity.frame = 0;
        currententity.oldframe = 0;
    }

    if (r_lerpmodels.value == 0.0f)
        currententity.backlerp = 0;

    GL_DrawAliasFrameLerp(paliashdr, currententity.backlerp);

    GL_TexEnv(GL11.GL_REPLACE);
    GL11.glShadeModel(GL11.GL_FLAT);

    GL11.glPopMatrix();

    if ((currententity.flags & Defines.RF_WEAPONMODEL) != 0 && (r_lefthand.value == 1.0F)) {
        GL11.glMatrixMode(GL11.GL_PROJECTION);
        GL11.glPopMatrix();
        GL11.glMatrixMode(GL11.GL_MODELVIEW);
        GL11.glCullFace(GL11.GL_FRONT);
    }

    if ((currententity.flags & Defines.RF_TRANSLUCENT) != 0) {
        GL11.glDisable(GL11.GL_BLEND);
    }

    if ((currententity.flags & Defines.RF_DEPTHHACK) != 0)
        GL11.glDepthRange(gldepthmin, gldepthmax);

    if (gl_shadows.value != 0.0f
            && (currententity.flags & (Defines.RF_TRANSLUCENT | Defines.RF_WEAPONMODEL)) == 0) {
        GL11.glPushMatrix();
        R_RotateForEntity(e);
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glColor4f(0, 0, 0, 0.5f);
        GL_DrawAliasShadow(paliashdr, currententity.frame);
        GL11.glEnable(GL11.GL_TEXTURE_2D);
        GL11.glDisable(GL11.GL_BLEND);
        GL11.glPopMatrix();
    }
    GL11.glColor4f(1, 1, 1, 1);
}