List of usage examples for org.lwjgl.opengl GL11 glRotatef
public static native void glRotatef(@NativeType("GLfloat") float angle, @NativeType("GLfloat") float x, @NativeType("GLfloat") float y, @NativeType("GLfloat") float z);
From source file:ivorius.ivtoolkit.rendering.IvRenderHelper.java
License:Apache License
public static void renderLights(float ticks, int color, float alpha, int number) { float width = 2.5f; Tessellator tessellator = Tessellator.instance; float usedTicks = ticks / 200.0F; Random random = new Random(432L); GL11.glDisable(GL11.GL_TEXTURE_2D);/* w w w. j av a 2 s. co m*/ GL11.glShadeModel(GL11.GL_SMOOTH); GL11.glEnable(GL11.GL_BLEND); OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE, GL11.GL_ZERO); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glDepthMask(false); GL11.glPushMatrix(); for (int var7 = 0; (float) var7 < number; ++var7) { float xLogFunc = (((float) var7 / number * 28493.0f + ticks) / 10.0f) % 20.0f; if (xLogFunc > 10.0f) { xLogFunc = 20.0f - xLogFunc; } float yLogFunc = 1.0f / (1.0f + (float) Math.pow(2.71828f, -0.8f * xLogFunc) * ((1.0f / 0.01f) - 1.0f)); float lightAlpha = yLogFunc; if (lightAlpha > 0.01f) { GL11.glRotatef(random.nextFloat() * 360.0F, 1.0F, 0.0F, 0.0F); GL11.glRotatef(random.nextFloat() * 360.0F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(random.nextFloat() * 360.0F, 0.0F, 0.0F, 1.0F); GL11.glRotatef(random.nextFloat() * 360.0F, 1.0F, 0.0F, 0.0F); GL11.glRotatef(random.nextFloat() * 360.0F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(random.nextFloat() * 360.0F + usedTicks * 90.0F, 0.0F, 0.0F, 1.0F); tessellator.startDrawing(6); float var8 = random.nextFloat() * 20.0F + 5.0F; float var9 = random.nextFloat() * 2.0F + 1.0F; tessellator.setColorRGBA_I(color, (int) (255.0F * alpha * lightAlpha)); tessellator.addVertex(0.0D, 0.0D, 0.0D); tessellator.setColorRGBA_I(color, 0); tessellator.addVertex(-width * (double) var9, var8, (-0.5F * var9)); tessellator.addVertex(width * (double) var9, var8, (-0.5F * var9)); tessellator.addVertex(0.0D, var8, (1.0F * var9)); tessellator.addVertex(-width * (double) var9, var8, (-0.5F * var9)); tessellator.draw(); } } GL11.glPopMatrix(); GL11.glDepthMask(true); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_BLEND); GL11.glShadeModel(GL11.GL_FLAT); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_ALPHA_TEST); }
From source file:jake2.desktop.LWJGLAdapter.java
License:Open Source License
@Override public void glRotatef(float angle, float x, float y, float z) { GL11.glRotatef(angle, x, y, z); }
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 w w .ja v 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 .j a va 2s .c om*/ 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.model.ModelFoxTail.java
License:Open Source License
@Override public void render(EntityLivingBase theEntity, int subtype, float partialTicks) { float seed = getAnimationTime(4000F, theEntity); this.setRotationAngles(seed, 0, 0, 0, 0, partialTicks, theEntity); if (subtype == 0) { GL11.glRotatef(-20F, 1F, 0F, 0F); this.tailBase.render(0.0625F); } else if (subtype == 1) { GL11.glRotatef(-20F, 1F, 0F, 0F); GL11.glRotatef(40F, 0F, 1F, 0F); this.tailBase.render(0.0625F); this.setRotationAngles(seed, 1F, 0, 0, 0, 0, theEntity); GL11.glRotatef(-80F, 0F, 1F, 0F); this.tailBase.render(0.0625F); } else if (subtype == 2) { seed = getAnimationTime(6500F, theEntity); this.setRotationAngles(seed, -1.5F, 2.5F, 0F, 0, 0, theEntity); this.tailBase.render(0.0625F); this.setRotationAngles(seed, -1.3F, 1.6F, 0, (float) Math.toRadians(30F), 0, theEntity); this.tailBase.render(0.0625F); this.setRotationAngles(seed, -1.1F, 0.7F, 0, (float) Math.toRadians(-30F), 0, theEntity); this.tailBase.render(0.0625F); this.setRotationAngles(seed, -1.2F, 2.6F, (float) Math.toRadians(20F), (float) Math.toRadians(-15F), 0, theEntity);/* w w w . ja v a 2s.c o m*/ this.tailBase.render(0.0625F); this.setRotationAngles(seed, -0.9F, 1.1F, (float) Math.toRadians(20F), (float) Math.toRadians(15F), 0, theEntity); this.tailBase.render(0.0625F); this.setRotationAngles(seed, -0.8F, 2F, (float) Math.toRadians(20F), (float) Math.toRadians(45F), 0, theEntity); this.tailBase.render(0.0625F); this.setRotationAngles(seed, -1.25F, 0.6F, (float) Math.toRadians(20F), (float) Math.toRadians(-45F), 0, theEntity); this.tailBase.render(0.0625F); this.setRotationAngles(seed, -1.4F, 0.9F, (float) Math.toRadians(45F), (float) Math.toRadians(15F), 0, theEntity); this.tailBase.render(0.0625F); this.setRotationAngles(seed, -1.1F, 1.6F, (float) Math.toRadians(45F), (float) Math.toRadians(-15F), 0, theEntity); this.tailBase.render(0.0625F); } }
From source file:kihira.tails.client.model.tail.ModelFluffyTail.java
License:Open Source License
@Override public void render(EntityLivingBase theEntity, int subtype, float partialTicks) { float timestep = getAnimationTime(4000F, theEntity); if (subtype == 0) { this.setRotationAngles(0, timestep, 1F, 1F, 0, 0, partialTicks, theEntity); GL11.glRotatef(-20F, 1F, 0F, 0F); this.tailBase.render(0.0625F); } else if (subtype == 1) { this.setRotationAngles(1, timestep, 1F, 1F, 0F, (float) Math.toRadians(40F), partialTicks, theEntity); GL11.glRotatef(-20F, 1F, 0F, 0F); this.tailBase.render(0.0625F); this.setRotationAngles(1, timestep, 1.4F, 0F, 0F, (float) Math.toRadians(-40F), partialTicks, theEntity);//from w w w .j a va 2s .c om this.tailBase.render(0.0625F); } else if (subtype == 2) { timestep = getAnimationTime(6500F, theEntity); this.setRotationAngles(2, timestep, -1.5F, 2.5F, 0F, 0, partialTicks, theEntity); this.tailBase.render(0.0625F); this.setRotationAngles(2, timestep, -1.3F, 1.6F, 0, (float) Math.toRadians(30F), partialTicks, theEntity); this.tailBase.render(0.0625F); this.setRotationAngles(2, timestep, -1.1F, 0.7F, 0, (float) Math.toRadians(-30F), partialTicks, theEntity); this.tailBase.render(0.0625F); this.setRotationAngles(2, timestep, -1.2F, 2.6F, (float) Math.toRadians(20F), (float) Math.toRadians(-15F), partialTicks, theEntity); this.tailBase.render(0.0625F); this.setRotationAngles(2, timestep, -0.9F, 1.1F, (float) Math.toRadians(20F), (float) Math.toRadians(15F), partialTicks, theEntity); this.tailBase.render(0.0625F); this.setRotationAngles(2, timestep, -0.8F, 2F, (float) Math.toRadians(20F), (float) Math.toRadians(45F), partialTicks, theEntity); this.tailBase.render(0.0625F); this.setRotationAngles(2, timestep, -1.25F, 0.6F, (float) Math.toRadians(20F), (float) Math.toRadians(-45F), partialTicks, theEntity); this.tailBase.render(0.0625F); this.setRotationAngles(2, timestep, -1.4F, 0.9F, (float) Math.toRadians(45F), (float) Math.toRadians(15F), partialTicks, theEntity); this.tailBase.render(0.0625F); this.setRotationAngles(2, timestep, -1.1F, 1.6F, (float) Math.toRadians(45F), (float) Math.toRadians(-15F), partialTicks, theEntity); this.tailBase.render(0.0625F); } }
From source file:kihira.tails.client.model.wings.ModelMetalWings.java
License:Open Source License
@Override public void render(EntityLivingBase theEntity, int subtype, float partialTicks) { GL11.glTranslatef(0, -7F * SCALE, 1F * SCALE * 2); GL11.glRotatef(90, 0, 1, 0); GL11.glRotatef(90, 0, 0, 1);// w w w . ja v a2 s .co m boolean isFlying = theEntity instanceof EntityPlayer && ((EntityPlayer) theEntity).capabilities.isFlying && theEntity.isAirBorne || theEntity.fallDistance > 0F; float timestep = getAnimationTime(isFlying ? 500 : 6000, theEntity); float angle = (float) Math.sin(timestep) * (isFlying ? 20F : 6F); GL11.glTranslatef(0F, -0.5F * SCALE, 0F); GL11.glPushMatrix(); GL11.glTranslatef(0F, 0F, 2F * SCALE); GL11.glRotatef(30F - angle, 1F, 0F, 0F); GL11.glTranslatef(0F, 0F, -1F * SCALE); wing.render(SCALE); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslatef(0F, 0F, -2F * SCALE); GL11.glRotatef(-30F + angle, 1F, 0F, 0F); GL11.glTranslatef(0F, 0F, -1F * SCALE); wing.render(SCALE); GL11.glTranslatef(0F, 0F, 1F * SCALE); 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.j a va2 s. 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.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); GL11.glRotatef(90, 0, 0, 1);/*w ww . j av a 2 s . c o m*/ 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.Main.java
License:Open Source License
/** * R_RotateForEntity//from ww w . ja v a2 s .c o m */ final void R_RotateForEntity(entity_t e) { GL11.glTranslatef(e.origin[0], e.origin[1], e.origin[2]); GL11.glRotatef(e.angles[1], 0, 0, 1); GL11.glRotatef(-e.angles[0], 0, 1, 0); GL11.glRotatef(-e.angles[2], 1, 0, 0); }