List of usage examples for org.lwjgl.opengl GL11 glTranslatef
public static native void glTranslatef(@NativeType("GLfloat") float x, @NativeType("GLfloat") float y, @NativeType("GLfloat") float z);
From source file:arrowsplus.client.render.RenderArrow.java
License:Open Source License
/** * Renders the arrow./* w w w . j a v a 2s . 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}/* www .j ava 2 s .co m*/ */ @Override protected void renderEntity(ItemStack itemStack, Object... data) { GL11.glScalef(0.125f, 0.125f, 0.125f); GL11.glTranslatef(0.0f, 5.0f, 0.0f); this.renderModel(itemStack); }
From source file:basedefense.client.renderer.item.surveillance.DNANeedleRenderer.java
License:Apache License
/** * {@inheritDoc}// w ww. j av a 2 s .c om */ @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}/*from w w w . j a va 2 s . 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}./*from www.j a v a 2 s . co 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:basedefense.client.renderer.item.surveillance.GooglyEyeRenderer.java
License:Apache License
/** * Renders the model at a certain distance from the center. * * @param distance The distance.//from www.jav a2s. c om * @param scale The model scale. */ private void renderModel(float distance, float scale) { GL11.glPushMatrix(); { GL11.glTranslatef(distance, 0.0f, 0.0f); GL11.glScalef(scale, scale, scale); Minecraft.getMinecraft().renderEngine.bindTexture( new ResourceLocation("basedefense2", "textures/models/surveillance_googly_eye.png")); EYE_MODEL.renderAll(); } GL11.glPopMatrix(); }
From source file:bau5.mods.projectbench.client.RenderCraftingFrame.java
License:LGPL
private void render(EntityCraftingFrame entity, double x, double y, double z, float par8, float par9) { if (renderBlocks.blockAccess == null) renderBlocks.blockAccess = entity.worldObj; GL11.glPushMatrix();// w w w. j av a2s .co m float f2 = (float) (entity.posX - x) - 0.5F; float f3 = (float) (entity.posY - y) - 0.5F; float f4 = (float) (entity.posZ - z) - 0.5F; int i = entity.xPosition + Direction.offsetX[entity.hangingDirection]; int j = entity.yPosition; int k = entity.zPosition + Direction.offsetZ[entity.hangingDirection]; float f5 = i - f2; float f6 = j - f3; float f7 = k - f4; GL11.glTranslatef(i - f2, j - f3, k - f4); renderFrameItemAsBlock(entity); renderItemInFrame(entity); 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 ww w . jav a 2 s . c o 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 render(EntityCraftingFrameII entity, double x, double y, double z, float par8, float par9) { if (renderBlocks.blockAccess == null) renderBlocks.blockAccess = entity.worldObj; GL11.glPushMatrix();/*w w w .j a v a2 s . c o m*/ float f2 = (float) (entity.posX - x) - 0.5F; float f3 = (float) (entity.posY - y) - 0.5F; float f4 = (float) (entity.posZ - z) - 0.5F; int i = entity.xPosition + Direction.offsetX[entity.hangingDirection]; int j = entity.yPosition; int k = entity.zPosition + Direction.offsetZ[entity.hangingDirection]; float f5 = i - f2; float f6 = j - f3; float f7 = k - f4; GL11.glTranslatef(i - f2, j - f3, k - f4); renderFrameItemAsBlock(entity); renderItemInFrame(entity); 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 w w .ja va2 s . c o 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(); } }