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:com.builtbroken.icbm.content.fragments.RenderFragment.java
private void doRenderArrow(EntityFragment entity, double xx, double yy, double zz, float p_76986_8_, float p_76986_9_) { GL11.glPushMatrix();//from w w w .j a v a2s .co m GL11.glTranslatef((float) xx, (float) yy, (float) zz); GL11.glRotatef(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * p_76986_9_ - 90.0F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * p_76986_9_, 0.0F, 0.0F, 1.0F); Tessellator tessellator = Tessellator.instance; byte b0 = 0; float f2 = 0.0F; float f3 = 0.5F; float f4 = (float) (0 + b0 * 10) / 32.0F; float f5 = (float) (5 + b0 * 10) / 32.0F; float f6 = 0.0F; float f7 = 0.15625F; float f8 = (float) (5 + b0 * 10) / 32.0F; float f9 = (float) (10 + b0 * 10) / 32.0F; float f10 = 0.05625F; GL11.glEnable(GL12.GL_RESCALE_NORMAL); 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, (double) f6, (double) f8); tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, (double) f7, (double) f8); tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, (double) f7, (double) f9); tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, (double) f6, (double) f9); tessellator.draw(); GL11.glNormal3f(-f10, 0.0F, 0.0F); tessellator.startDrawingQuads(); tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, (double) f6, (double) f8); tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, (double) f7, (double) f8); tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, (double) f7, (double) f9); tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, (double) f6, (double) 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, (double) f2, (double) f4); tessellator.addVertexWithUV(8.0D, -2.0D, 0.0D, (double) f3, (double) f4); tessellator.addVertexWithUV(8.0D, 2.0D, 0.0D, (double) f3, (double) f5); tessellator.addVertexWithUV(-8.0D, 2.0D, 0.0D, (double) f2, (double) f5); tessellator.draw(); } GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glPopMatrix(); }
From source file:com.builtbroken.icbm.content.launcher.block.TileLauncherFrame.java
@SideOnly(Side.CLIENT) public void renderDynamic(Pos pos, float frame, int pass) { GL11.glPushMatrix();/*from ww w .j a v a 2s . c om*/ GL11.glScalef(1f, 1f, 1f); GL11.glTranslatef(pos.xf() + 0.5f, pos.yf(), pos.zf() + 0.5f); if (getMetadata() == 0) { FMLClientHandler.instance().getClient().renderEngine.bindTexture(Assets.LAUNCHER_FRAME_TEXTURE); Assets.LAUNCHER_FRAME_BLOCK_MODEL.renderAll(); } else { int rotation = getMetadata(); switch (rotation) { case 1: GL11.glRotatef(180, 0, 1, 0); break; case 2: GL11.glRotatef(0, 0, 1, 0); break; case 3: GL11.glRotatef(90, 0, 1, 0); break; case 4: GL11.glRotatef(-90, 0, 1, 0); break; } FMLClientHandler.instance().getClient().renderEngine.bindTexture(Assets.LAUNCHER_FRAME_TEXTURE); Assets.LAUNCHER_FRAME_BLOCK_TOP_MODEL.renderAll(); } GL11.glPopMatrix(); }
From source file:com.builtbroken.icbm.content.launcher.controller.remote.display.TileSiloInterfaceClient.java
@Override public void renderInventoryItem(IItemRenderer.ItemRenderType type, ItemStack itemStack, Object... data) { if (type == IItemRenderer.ItemRenderType.INVENTORY) { GL11.glTranslatef(-0.5f, -1.4f, -0.5f); } else if (type == IItemRenderer.ItemRenderType.EQUIPPED_FIRST_PERSON) { GL11.glRotatef(150f, 0, 1, 0); } else if (type == IItemRenderer.ItemRenderType.EQUIPPED) { GL11.glRotatef(150f, 0, 1, 0);//from w ww . j a v a2 s . c o m GL11.glTranslatef(-0.5f, -0.1f, -0.5f); } FMLClientHandler.instance().getClient().renderEngine.bindTexture(Assets.FoF_STATION_TEXTURE); Assets.FoF_STATION_MODEL.renderOnly("Group_006", "Group_007"); }
From source file:com.builtbroken.icbm.content.launcher.controller.remote.display.TileSiloInterfaceClient.java
@Override @SideOnly(Side.CLIENT)/* w w w.j a va 2 s .com*/ public void renderDynamic(Pos pos, float frame, int pass) { //Render launcher GL11.glPushMatrix(); GL11.glTranslatef(pos.xf() + 0.5f, pos.yf() - 0.561f, pos.zf() + 0.5f); switch (getDirection()) { case EAST: break; case WEST: GL11.glRotatef(180f, 0, 1f, 0); break; case SOUTH: GL11.glRotatef(-90f, 0, 1f, 0); break; default: GL11.glRotatef(90f, 0, 1f, 0); break; } FMLClientHandler.instance().getClient().renderEngine.bindTexture(Assets.FoF_STATION_TEXTURE); Assets.FoF_STATION_MODEL.renderOnly("Group_006", "Group_007"); GL11.glPopMatrix(); }
From source file:com.builtbroken.icbm.content.launcher.launcher.standard.TileStandardLauncherClient.java
@Override @SideOnly(Side.CLIENT)// w ww . ja v a 2 s . c o m public void renderDynamic(Pos center, float f, int pass) { if (missile != null) { //Render launcher GL11.glPushMatrix(); Pos pos = center.add(getDirection()).add(0.5, 0, 0.5); GL11.glTranslatef(pos.xf(), pos.yf(), pos.zf()); GL11.glRotatef(45f, 0, 1, 0); if (missile instanceof ICustomMissileRender) { GL11.glTranslatef(0, ((ICustomMissileRender) missile).getRenderHeightOffset(), 0); ((ICustomMissileRender) missile).renderMissileInWorld(0, 0, f); } GL11.glPopMatrix(); } else if (recipe != null) { if (!processedModel) { processModel(); } //Render launcher GL11.glPushMatrix(); Pos pos = center; final float yf = 2.2f; switch (ForgeDirection.getOrientation(getMetadata())) { case NORTH: pos = pos.add(-0.65, yf, 0.95); break; case SOUTH: pos = pos.add(-0.65, yf, 2.95); break; case EAST: pos = pos.add(.35, yf, 1.95); break; case WEST: pos = pos.add(-1.65, yf, 1.95); break; } GL11.glTranslatef(pos.xf(), pos.yf(), pos.zf()); GL11.glRotatef(45f, 0, 1, 0); GL11.glScalef(0.85f, 0.85f, 0.85f); FMLClientHandler.instance().getClient().renderEngine.bindTexture(Assets.GREY_FAKE_TEXTURE); //TODO render crafting progress //TODO render ghost of missile frame //Render frame pieces for (int i = 0; i < recipe.frameLevel && i < frame.length; i++) { frame[i].render(); } //Only render guts of missile if frame is completed if (recipe.frameCompleted) { if (recipe.warhead != null) { warhead.render(); } if (recipe.rocketComputer != null) { guidance.render(); } if (recipe.rocketEngine != null) { for (GroupObject o : engine) { o.render(); } } //Render Skin if (recipe.platesContained > 0) { for (int i = 0; i < recipe.platesContained; i++) { //TODO fix layers as they are not perfect, could be naming of parts int layer = i / StandardMissileCrafting.PLATE_PER_LEVEL_COUNT; int set = i % StandardMissileCrafting.PLATE_PER_LEVEL_COUNT; if (layer < skinLayers.length) { skinLayers[layer][set].render(); } } } } GL11.glPopMatrix(); } }
From source file:com.builtbroken.icbm.content.missile.tile.TileCrashedMissile.java
private final void renderDefaultMissile() { GL11.glTranslated(0.5, 2, 0.5);/*from www . j av a2 s . c o m*/ GL11.glRotatef(yaw, 0.0F, 1.0F, 0.0F); GL11.glRotatef(pitch - 90, 0.0F, 0.0F, 1.0F); GL11.glScalef(.5f, .5f, .5f); FMLClientHandler.instance().getClient().renderEngine.bindTexture(Assets.CLASSIC_MISSILE_TEXTURE); if (missile == null || missile.getWarhead() != null) { Assets.CLASSIC_MISSILE_MODEL.renderOnly("WARHEAD 1", "WARHEAD 2", "WARHEAD 3", "WARHEAD 4"); } Assets.CLASSIC_MISSILE_MODEL.renderAllExcept("WARHEAD 1", "WARHEAD 2", "WARHEAD 3", "WARHEAD 4"); }
From source file:com.builtbroken.icbm.content.rail.RenderMissileCart.java
@Override public void doRender(final Entity entity, final double xx, final double yy, final double zz, final float p_76986_8_, final float delta) { final EntityMissileCart cart = (EntityMissileCart) entity; float f5 = cart.prevRotationPitch + (cart.rotationPitch - cart.prevRotationPitch) * delta; double x2 = MathHelper.lerp(cart.lastRenderX, xx, delta); double y2 = MathHelper.lerp(cart.lastRenderY, yy, delta); double z2 = MathHelper.lerp(cart.lastRenderZ, zz, delta); GL11.glPushMatrix();//from ww w . ja va2 s . com GL11.glTranslated(x2, y2, z2); GL11.glRotatef(180.0F - delta, 0.0F, 1.0F, 0.0F); GL11.glRotatef(-f5, 0.0F, 0.0F, 1.0F); cart.lastRenderX = x2; cart.lastRenderY = y2; cart.lastRenderZ = z2; if (cart.getType() == MissileCartTypes.SMALL) { GL11.glPushMatrix(); GL11.glTranslatef(0f, 0.05f, 0f); GL11.glRotated(90, 0, 1, 0); GL11.glRotated(cart.rotationYaw, 0, 1, 0); //Renders the cart FMLClientHandler.instance().getClient().renderEngine.bindTexture(Assets.SMALL_WORKSTATION_TEXTURE2); Assets.CART1x3.renderAll(); if (cart.getCargoMissile() != null) { //Render missile GL11.glRotated(-90, 0, 1, 0); renderMissile(cart.getCargoMissile(), cart.railSide, cart.facingDirection); } GL11.glPopMatrix(); } else if (cart.getType() == MissileCartTypes.MICRO) { GL11.glPushMatrix(); GL11.glTranslatef(0f, .32f, 0f); GL11.glRotated(90, 0, 1, 0); //Renders the cart FMLClientHandler.instance().getClient().renderEngine.bindTexture(Assets.GREY_FAKE_TEXTURE); Assets.CART1x1.renderAll(); if (cart.getCargoMissile() != null) { GL11.glTranslated(0, -0.44, 0); if (cart.getCargoMissile() instanceof ICustomMissileRender) { GL11.glTranslatef(0f, ((ICustomMissileRender) cart.getCargoMissile()).getRenderHeightOffset(), 0f); } renderMissile(cart.getCargoMissile(), ForgeDirection.EAST, ForgeDirection.UP); } GL11.glPopMatrix(); } else if (cart.getType() == MissileCartTypes.ThreeByThree) { GL11.glPushMatrix(); GL11.glTranslatef(0f, -0.05f, 0f); GL11.glRotated(90, 0, 1, 0); //Renders the cart FMLClientHandler.instance().getClient().renderEngine.bindTexture(Assets.GREY_FAKE_TEXTURE); Assets.CART3x3.renderAll(); if (cart.getCargoMissile() != null) { GL11.glTranslated(0, -0.3, 0); if (cart.getCargoMissile() instanceof ICustomMissileRender) { GL11.glTranslatef(0f, ((ICustomMissileRender) cart.getCargoMissile()).getRenderHeightOffset(), 0f); } renderMissile(cart.getCargoMissile(), ForgeDirection.EAST, ForgeDirection.UP); } GL11.glPopMatrix(); } else { float halfWidth = cart.width / 2.0F; float halfLength = cart.length / 2.0F; float yaw = (float) Math.abs(MathUtility.clampAngleTo180(cart.rotationYaw)); if (yaw >= 45 && yaw <= 135) { halfWidth = cart.length / 2.0F; halfLength = cart.width / 2.0F; } AxisAlignedBB bounds = AxisAlignedBB.getBoundingBox(-(double) halfWidth, 0, -(double) halfLength, +(double) halfWidth, 0.3, +(double) halfLength); GL11.glPushMatrix(); GL11.glTranslated(xx, yy, zz); FMLClientHandler.instance().getClient().renderEngine.bindTexture(Assets.GREY_FAKE_TEXTURE); RenderUtility.renderCube(bounds, Blocks.iron_block, Blocks.iron_block.getIcon(0, 0)); if (cart.getCargoMissile() != null) { GL11.glTranslated(0, -0.1, 0); if (cart.getCargoMissile() instanceof ICustomMissileRender) { GL11.glTranslatef(0f, ((ICustomMissileRender) cart.getCargoMissile()).getRenderHeightOffset(), 0f); } renderMissile(cart.getCargoMissile(), ForgeDirection.EAST, ForgeDirection.UP); } GL11.glPopMatrix(); } GL11.glPopMatrix(); if (Engine.runningAsDev) { drawBounds(cart, xx, yy, zz); } }
From source file:com.CiD.MysteryMod.TecEvolution.Buildcraft.RenderEntityBlock.java
License:Minecraft Mod Public
public void doRenderBlock(EntityBlock entity, double x, double y, double z) { if (entity.isDead) { return;/* w w w.j ava 2s . c o m*/ } shadowSize = entity.shadowSize; RenderInfo util = new RenderInfo(); util.texture = entity.texture; bindTexture(TextureMap.locationBlocksTexture); for (int iBase = 0; iBase < entity.iSize; ++iBase) { for (int jBase = 0; jBase < entity.jSize; ++jBase) { for (int kBase = 0; kBase < entity.kSize; ++kBase) { util.minX = 0; util.minY = 0; util.minZ = 0; double remainX = entity.iSize - iBase; double remainY = entity.jSize - jBase; double remainZ = entity.kSize - kBase; util.maxX = remainX > 1.0 ? 1.0 : remainX; util.maxY = remainY > 1.0 ? 1.0 : remainY; util.maxZ = remainZ > 1.0 ? 1.0 : remainZ; GL11.glPushMatrix(); GL11.glTranslatef((float) x, (float) y, (float) z); GL11.glRotatef(entity.rotationX, 1, 0, 0); GL11.glRotatef(entity.rotationY, 0, 1, 0); GL11.glRotatef(entity.rotationZ, 0, 0, 1); GL11.glTranslatef(iBase, jBase, kBase); renderBlock(util); GL11.glPopMatrix(); } } } }
From source file:com.darkona.adventurebackpack.client.render.CopygirlRenderUtils.java
License:Open Source License
public static void renderItemIn3d(ItemStack stack) { TextureManager textureManager = Minecraft.getMinecraft().getTextureManager(); // Not sure why but this can be null when the world loads. if (textureManager == null) { return;// w w w . ja va 2s . c om } Item item = stack.getItem(); GL11.glPushMatrix(); Tessellator tessellator = Tessellator.instance; GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F); GL11.glTranslatef(-0.5F, -0.5F, 1 / 32.0F); int passes = item.getRenderPasses(stack.getItemDamage()); for (int pass = 0; pass < passes; pass++) { textureManager.bindTexture(((stack.getItemSpriteNumber() == 0) ? TextureMap.locationBlocksTexture : TextureMap.locationItemsTexture)); IIcon icon = item.getIcon(stack, pass); if (icon != null) { float minU = icon.getMinU(); float maxU = icon.getMaxU(); float minV = icon.getMinV(); float maxV = icon.getMaxV(); CopygirlRenderUtils.setColorFromInt(item.getColorFromItemStack(stack, pass)); ItemRenderer.renderItemIn2D(tessellator, maxU, minV, minU, maxV, icon.getIconWidth(), icon.getIconHeight(), 0.0625F); } } if (stack.hasEffect(0)) { GL11.glDepthFunc(GL11.GL_EQUAL); GL11.glDisable(GL11.GL_LIGHTING); textureManager.bindTexture(glint); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE); float f7 = 0.76F; GL11.glColor4f(0.5F * f7, 0.25F * f7, 0.8F * f7, 1.0F); GL11.glMatrixMode(GL11.GL_TEXTURE); GL11.glPushMatrix(); float f8 = 0.125F; GL11.glScalef(f8, f8, f8); float f9 = Minecraft.getSystemTime() % 3000L / 3000.0F * 8.0F; GL11.glTranslatef(f9, 0.0F, 0.0F); GL11.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F); ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glScalef(f8, f8, f8); f9 = Minecraft.getSystemTime() % 4873L / 4873.0F * 8.0F; GL11.glTranslatef(-f9, 0.0F, 0.0F); GL11.glRotatef(10.0F, 0.0F, 0.0F, 1.0F); ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F); GL11.glPopMatrix(); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_LIGHTING); GL11.glDepthFunc(GL11.GL_LEQUAL); } GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glPopMatrix(); }
From source file:com.domsplace.FaultEngine.Location.Location3D.java
License:Apache License
public void applyTranslations(boolean invertCoords, boolean invertRotations) { float x = this.getFloatX(); float y = this.getFloatY(); float z = this.getFloatZ(); float p = (float) this.pitch; float ya = (float) this.yaw; float r = (float) this.getRotation(); if (invertCoords) { x = -x;/*from w ww . j av a2 s .c o m*/ y = -y; z = -z; } if (invertRotations) { p = -p; ya = -ya; r = -r; } GL11.glTranslatef(x, y, z); GL11.glRotatef(p, 1, 0, 0); GL11.glRotatef(ya, 0, 1, 0); GL11.glRotatef(r, 0, 0, 1); }