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:aroma1997.compactwindmills.rotors.WindmillRenderer.java
License:Open Source License
public void renderBlockRotor(TileEntityWindmill tileEntity, World world, int posX, int posY, int posZ, Block block) {/*from w w w.ja v a 2 s . c o m*/ if (tileEntity.getRotor() == null) { return; } model = new ModelRotor(tileEntity.getType().checkRadius); Tessellator tessellator = Tessellator.instance; float brightness = world.getBlockLightValue(posX, posY, posZ); int skyBrightness = world.getLightBrightnessForSkyBlocks(posX, posY + 1, posZ, 0); int skyBrightness1 = skyBrightness % 65536; int skyBrightness2 = skyBrightness / 65536; tessellator.setColorOpaque_F(brightness, brightness, brightness); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, skyBrightness1, skyBrightness2); short facing = tileEntity.getFacing(); GL11.glPushMatrix(); GL11.glTranslatef(0.5F, 0.5F, 0.5F); if (facing == 2 || facing == 3 || facing == 4 || facing == 5) { int dir = facing == 4 ? 0 : facing == 2 ? 1 : facing == 5 ? 2 : facing; GL11.glRotatef(dir * -90F, 0F, 1F, 0F); } else if (facing == 1) { GL11.glRotatef(-90.0F, 0.0F, 0.0F, 1.0F); } GL11.glRotatef(360 - System.currentTimeMillis() / 30 % 360, 1.0F, 0.0F, 0.0F); GL11.glTranslatef(-0.25F, 0.0F, 0.0F); bindTexture(tileEntity.getRotor().getRenderTexture()); model.render(null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F); GL11.glPopMatrix(); }
From source file:arrowsplus.client.render.RenderArrow.java
License:Open Source License
/** * Renders the arrow.//from w w w. j ava 2 s . co m * * @param entityArrow The arrow to render. * @param posX The x position to render the arrow at. * @param posY The y position to render the arrow at. * @param posZ The z position to render the arrow at. * @param yaw The yaw rotation to render the arrow with. * @param pitch The pitch to render the arrow with. */ public void renderArrow(EntityArrowBase entityArrow, double posX, double posY, double posZ, float yaw, float pitch) { this.func_110777_b(entityArrow); GL11.glPushMatrix(); GL11.glTranslatef((float) posX, (float) posY, (float) posZ); GL11.glRotatef(entityArrow.prevRotationYaw + (entityArrow.rotationYaw - entityArrow.prevRotationYaw) * pitch - 90.0F, 0.0F, 1.0F, 0.0F); GL11.glRotatef( entityArrow.prevRotationPitch + (entityArrow.rotationPitch - entityArrow.prevRotationPitch) * pitch, 0.0F, 0.0F, 1.0F); Tessellator tessellator = Tessellator.instance; byte b0 = 0; float f2 = 0.0F; float f3 = 0.5F; float f4 = (0 + b0 * 10) / 32.0F; float f5 = (5 + b0 * 10) / 32.0F; float f6 = 0.0F; float f7 = 0.15625F; float f8 = (5 + b0 * 10) / 32.0F; float f9 = (10 + b0 * 10) / 32.0F; float f10 = 0.05625F; GL11.glEnable(GL12.GL_RESCALE_NORMAL); float f11 = entityArrow.arrowShake - pitch; if (f11 > 0.0F) { float f12 = -MathHelper.sin(f11 * 3.0F) * f11; GL11.glRotatef(f12, 0.0F, 0.0F, 1.0F); } GL11.glRotatef(45.0F, 1.0F, 0.0F, 0.0F); GL11.glScalef(f10, f10, f10); GL11.glTranslatef(-4.0F, 0.0F, 0.0F); GL11.glNormal3f(f10, 0.0F, 0.0F); tessellator.startDrawingQuads(); tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, f6, f8); tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, f7, f8); tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, f7, f9); tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, f6, f9); tessellator.draw(); GL11.glNormal3f(-f10, 0.0F, 0.0F); tessellator.startDrawingQuads(); tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, f6, f8); tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, f7, f8); tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, f7, f9); tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, f6, f9); 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, f10); tessellator.startDrawingQuads(); tessellator.addVertexWithUV(-8.0D, -2.0D, 0.0D, f2, f4); tessellator.addVertexWithUV(8.0D, -2.0D, 0.0D, f3, f4); tessellator.addVertexWithUV(8.0D, 2.0D, 0.0D, f3, f5); tessellator.addVertexWithUV(-8.0D, 2.0D, 0.0D, f2, f5); tessellator.draw(); } GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glPopMatrix(); }
From source file:basedefense.client.renderer.item.surveillance.DNANeedleRenderer.java
License:Apache License
/** * {@inheritDoc}/*from w ww . j a v a 2 s .com*/ */ @Override protected void setupEquipped(ItemStack itemStack, Object... data) { GL11.glRotatef(45, 0.0f, 1.0f, 0.0f); GL11.glRotatef(70, 1.0f, 0.0f, 0.0f); GL11.glTranslatef(0.0f, 0.0f, -5.0f); }
From source file:basedefense.client.renderer.item.surveillance.DNANeedleRenderer.java
License:Apache License
/** * {@inheritDoc}// www . j a va 2s . c o m */ @Override protected void setupEquippedCommon(ItemStack itemStack, Object... data) { GL11.glScalef(0.25f, 0.25f, 0.25f); GL11.glRotatef(180, 0.0f, 1.0f, 0.0f); }
From source file:basedefense.client.renderer.item.surveillance.DNANeedleRenderer.java
License:Apache License
/** * {@inheritDoc}/*from w w w .j a v a 2s .co m*/ */ @Override protected void setupEquippedFirstPerson(ItemStack itemStack, Object... data) { GL11.glRotatef(-65, 0.0f, 1.0f, 0.0f); GL11.glTranslatef(-2.5f, 3.0f, 1.0f); }
From source file:basedefense.client.renderer.item.surveillance.GooglyEyeRenderer.java
License:Apache License
/** * Handles {@link RenderLivingEvent}./* ww w. ja v a 2 s.c o m*/ * * @param event The event. */ @SubscribeEvent public void onRenderLiving(RenderLivingEvent.Post event) { EntityLivingBase entity = event.entity; if (!GooglyGlassesItem.ITEM.isPlayerWearing()) return; EntityConfiguration configuration = EntityConfiguration.valueOf(entity.getClass()); if (configuration == null) return; GL11.glPushMatrix(); { GL11.glTranslated(event.x, event.y, event.z); GL11.glTranslatef(0.0f, configuration.getRotationCenterY(), 0.0f); GL11.glRotatef(entity.getRotationYawHead(), 0.0f, -1.0f, 0.0f); GL11.glPushMatrix(); { GL11.glRotatef(entity.rotationPitch, 1.0f, 0.0f, 0.0f); GL11.glTranslatef(0.0f, configuration.getEyeOffsetY(), configuration.getEyeOffsetZ()); this.renderModel(configuration.getEyeOffsetX(), configuration.getEyeScale()); this.renderModel(-configuration.getEyeOffsetX(), configuration.getEyeScale()); } GL11.glPopMatrix(); } GL11.glPopMatrix(); }
From source file:bau5.mods.projectbench.client.RenderCraftingFrame.java
License:LGPL
private void renderItemInFrame(EntityCraftingFrame entity) { ItemStack itemstack = entity.getDisplayedItem(); if (itemstack != null) { EntityItem entityitem = new EntityItem(entity.worldObj, 0.0D, 0.0D, 0.0D, itemstack); entityitem.getEntityItem().stackSize = 1; entityitem.hoverStart = 0.0F;//from w ww . j a v a 2s. co m GL11.glPushMatrix(); GL11.glTranslatef(-0.453125F * Direction.offsetX[entity.hangingDirection], -0.18F, -0.453125F * Direction.offsetZ[entity.hangingDirection]); GL11.glRotatef(180.0F + entity.rotationYaw, 0.0F, 1.0F, 0.0F); GL11.glRotatef((-90 * entity.getRotation()), 0.0F, 0.0F, 1.0F); switch (entity.getRotation()) { case 1: GL11.glTranslatef(-0.16F, -0.16F, 0.0F); break; case 2: GL11.glTranslatef(0.0F, -0.32F, 0.0F); break; case 3: GL11.glTranslatef(0.16F, -0.16F, 0.0F); } RenderItem.renderInFrame = true; RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F); RenderItem.renderInFrame = false; GL11.glPopMatrix(); } }
From source file:bau5.mods.projectbench.client.RenderCraftingFrame.java
License:LGPL
private void renderFrameItemAsBlock(EntityItemFrame eif) { GL11.glPushMatrix();/*from w w w.ja va 2 s . com*/ this.renderManager.renderEngine.func_110577_a(TextureMap.field_110575_b); GL11.glRotatef(eif.rotationYaw, 0.0F, 1.0F, 0.0F); Block block = Block.planks; float f = 0.0625F; float f1 = 0.75F; float f2 = f1 / 2.0F; GL11.glPushMatrix(); this.renderBlocks.overrideBlockBounds(0.0D, (0.5F - f2 + 0.0625F), (0.5F - f2 + 0.0625F), (f * 0.5F), (0.5F + f2 - 0.0625F), (0.5F + f2 - 0.0625F)); this.renderBlocks.setOverrideBlockTexture(ProjectBench.instance.projectBench.getIcon(1, 0)); this.renderBlocks.renderBlockAsItem(block, 0, 1.0F); this.renderBlocks.clearOverrideBlockTexture(); this.renderBlocks.unlockBlockBounds(); GL11.glPopMatrix(); this.renderBlocks.setOverrideBlockTexture(Block.planks.getIcon(1, 1)); GL11.glPushMatrix(); this.renderBlocks.overrideBlockBounds(0.0D, (0.5F - f2), (0.5F - f2), (f + 1.0E-4F), (f + 0.5F - f2), (0.5F + f2)); this.renderBlocks.renderBlockAsItem(block, 0, 1.0F); GL11.glPopMatrix(); GL11.glPushMatrix(); this.renderBlocks.overrideBlockBounds(0.0D, (0.5F + f2 - f), (0.5F - f2), (f + 1.0E-4F), (0.5F + f2), (0.5F + f2)); this.renderBlocks.renderBlockAsItem(block, 0, 1.0F); GL11.glPopMatrix(); GL11.glPushMatrix(); this.renderBlocks.overrideBlockBounds(0.0D, (0.5F - f2), (0.5F - f2), f, (0.5F + f2), (f + 0.5F - f2)); this.renderBlocks.renderBlockAsItem(block, 0, 1.0F); GL11.glPopMatrix(); GL11.glPushMatrix(); this.renderBlocks.overrideBlockBounds(0.0D, (0.5F - f2), (0.5F + f2 - f), f, (0.5F + f2), (0.5F + f2)); this.renderBlocks.renderBlockAsItem(block, 0, 1.0F); GL11.glPopMatrix(); this.renderBlocks.unlockBlockBounds(); this.renderBlocks.clearOverrideBlockTexture(); GL11.glPopMatrix(); }
From source file:bau5.mods.projectbench.client.RenderCraftingFrameII.java
License:LGPL
private void renderItemInFrame(EntityCraftingFrameII entity) { ItemStack itemstack = entity.getDisplayedItem(); if (itemstack != null) { EntityItem entityitem = new EntityItem(entity.worldObj, 0.0D, 0.0D, 0.0D, itemstack); entityitem.hoverStart = 0.0F;//from w ww . j a va2s . co m GL11.glPushMatrix(); GL11.glTranslatef(-0.453125F * Direction.offsetX[entity.hangingDirection], -0.18F, -0.453125F * Direction.offsetZ[entity.hangingDirection]); GL11.glRotatef(180.0F + entity.rotationYaw, 0.0F, 1.0F, 0.0F); GL11.glRotatef((-90 * entity.getRotation()), 0.0F, 0.0F, 1.0F); switch (entity.getRotation()) { case 1: GL11.glTranslatef(-0.16F, -0.16F, 0.0F); break; case 2: GL11.glTranslatef(0.0F, -0.32F, 0.0F); break; case 3: GL11.glTranslatef(0.16F, -0.16F, 0.0F); } RenderItem.renderInFrame = true; RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F); RenderItem.renderInFrame = false; GL11.glPopMatrix(); } }
From source file:bau5.mods.projectbench.client.RenderCraftingFrameII.java
License:LGPL
private void renderFrameItemAsBlock(EntityItemFrame eif) { GL11.glPushMatrix();/* www .j a va 2s. c om*/ this.renderManager.renderEngine.func_110577_a(TextureMap.field_110575_b); GL11.glRotatef(eif.rotationYaw, 0.0F, 1.0F, 0.0F); Block block = Block.planks; float f = 0.0625F; float f1 = 0.75F; float f2 = f1 / 2.0F; GL11.glPushMatrix(); this.renderBlocks.overrideBlockBounds(0.0D, (0.5F - f2 + 0.0625F), (0.5F - f2 + 0.0625F), (f * 0.5F), (0.5F + f2 - 0.0625F), (0.5F + f2 - 0.0625F)); this.renderBlocks.setOverrideBlockTexture(Block.workbench.getBlockTextureFromSide(1)); this.renderBlocks.renderBlockAsItem(block, 0, 1.0F); this.renderBlocks.clearOverrideBlockTexture(); this.renderBlocks.unlockBlockBounds(); GL11.glPopMatrix(); this.renderBlocks.setOverrideBlockTexture(Block.planks.getIcon(1, 1)); GL11.glPushMatrix(); this.renderBlocks.overrideBlockBounds(0.0D, (0.5F - f2), (0.5F - f2), (f + 1.0E-4F), (f + 0.5F - f2), (0.5F + f2)); this.renderBlocks.renderBlockAsItem(block, 0, 1.0F); GL11.glPopMatrix(); GL11.glPushMatrix(); this.renderBlocks.overrideBlockBounds(0.0D, (0.5F + f2 - f), (0.5F - f2), (f + 1.0E-4F), (0.5F + f2), (0.5F + f2)); this.renderBlocks.renderBlockAsItem(block, 0, 1.0F); GL11.glPopMatrix(); GL11.glPushMatrix(); this.renderBlocks.overrideBlockBounds(0.0D, (0.5F - f2), (0.5F - f2), f, (0.5F + f2), (f + 0.5F - f2)); this.renderBlocks.renderBlockAsItem(block, 0, 1.0F); GL11.glPopMatrix(); GL11.glPushMatrix(); this.renderBlocks.overrideBlockBounds(0.0D, (0.5F - f2), (0.5F + f2 - f), f, (0.5F + f2), (0.5F + f2)); this.renderBlocks.renderBlockAsItem(block, 0, 1.0F); GL11.glPopMatrix(); this.renderBlocks.unlockBlockBounds(); this.renderBlocks.clearOverrideBlockTexture(); GL11.glPopMatrix(); }