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:com.builtbroken.icbm.content.launcher.controller.remote.display.TileSiloInterfaceClient.java
@Override @SideOnly(Side.CLIENT)/* ww 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.large.TileLargeLauncher.java
@Override @SideOnly(Side.CLIENT)//from w w w . j a v a2 s. c om public void renderDynamic(Pos pos, float frame, int pass) { //Render launcher GL11.glPushMatrix(); GL11.glTranslatef(pos.xf() - 0.5f, pos.yf() + 0.5f, pos.zf() + 2.5f); GL11.glScalef(1.5f, 1.5f, 1.5f); FMLClientHandler.instance().getClient().renderEngine.bindTexture(Assets.GREY_FAKE_TEXTURE); Assets.STANDARD_MISSILE_MODEL.renderAll(); GL11.glPopMatrix(); }
From source file:com.builtbroken.icbm.content.launcher.launcher.standard.TileStandardLauncherClient.java
@Override @SideOnly(Side.CLIENT)//from ww w.j av a 2 s. com 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.launcher.silo.TileStandardSilo.java
@Override public void renderInventoryItem(IItemRenderer.ItemRenderType type, ItemStack itemStack, Object... data) { GL11.glTranslatef(-0.5f, -0.5f, -0.5f); GL11.glScaled(.8f, .8f, .8f);/*from w w w .j av a 2 s . c o m*/ FMLClientHandler.instance().getClient().renderEngine.bindTexture(Assets.SMALL_SILO_TEXTURE); GL11.glColor3f(1.0f, 0f, 0f); Assets.SMALL_SILO_MODEL.renderOnly("Group_001", "Component_1_001"); }
From source file:com.builtbroken.icbm.content.launcher.silo.TileStandardSilo.java
@Override @SideOnly(Side.CLIENT)/*from w w w . j a v a 2s. co m*/ public void renderDynamic(Pos pos, float frame, int pass) { //Render launcher GL11.glPushMatrix(); GL11.glTranslatef(pos.xf(), pos.yf(), pos.zf() + 1); FMLClientHandler.instance().getClient().renderEngine.bindTexture(Assets.STANDARD_SILO_TEXTURE); Assets.STANDARD_SILO_MODEL.renderAll(); GL11.glPopMatrix(); //Render missile if (getMissile() != null) { GL11.glPushMatrix(); GL11.glTranslatef(pos.xf() + 0.5f, pos.yf() + 2.75f, pos.zf() + 0.5f); //TODO rotate if (getMissile() instanceof ICustomMissileRender) { ((ICustomMissileRender) getMissile()).renderMissileInWorld(0, 0, frame); } GL11.glPopMatrix(); } }
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 w ww . ja v a 2 s. co m*/ 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.builtbroken.icbm.content.rail.RenderMissileCart.java
/** * Handles rendering of the missile/* ww w . java 2 s . c om*/ */ public static void renderMissile(IMissile missile, ForgeDirection connectedBlockSide, ForgeDirection direction) { ///Center render view to tile center GL11.glTranslatef(0f, 0.4f, 0f); //Handles setting the rotation based on the side switch (connectedBlockSide) { case UP: case DOWN: TileSmallMissileWorkstationClient.handleMissileRotationUD(direction); break; case EAST: case WEST: TileSmallMissileWorkstationClient.handleMissileRotationEW(direction); break; case SOUTH: case NORTH: TileSmallMissileWorkstationClient.handleMissileRotationNS(direction); break; } if (missile instanceof ICustomMissileRender) { ((ICustomMissileRender) missile).renderMissileInWorld(0, 0, 0); } else { //Bind texture FMLClientHandler.instance().getClient().renderEngine.bindTexture(Assets.SMALL_MISSILE_TEXTURE); //Group_001 body //Component_1_001 - 4 Body Fins if (missile.getWarhead() != null) { //Group_004 nose of warhead //Group_005 warhead Assets.SMALL_MISSILE_MODEL.renderOnly("Group_005"); if (missile.getWarhead().getExplosive() != null) { Assets.SMALL_MISSILE_MODEL.renderOnly("Group_004"); } } if (missile.getEngine() != null) { //Group_002 - Engine thruster //Group_003 - Engine case //Component_3_001 - 8 Engine lower segments //Component_2_001 - 4 Engine fins Assets.SMALL_MISSILE_MODEL.renderOnly("Group_002", "Group_003"); for (int i = 1; i < 9; i++) { Assets.SMALL_MISSILE_MODEL.renderOnly("Component_3_00" + i); } for (int i = 1; i < 5; i++) { Assets.SMALL_MISSILE_MODEL.renderOnly("Component_2_00" + i); } } if (missile.getGuidance() != null) { //TODO add model indication showing no guidance added } //Render body and fins Assets.SMALL_MISSILE_MODEL.renderOnly("Group_001", "Component_1_001", "Component_1_002", "Component_1_003", "Component_1_004"); } }
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;// www .j av a2s.co 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.darkcart.xdolf.util.RenderUtils.java
License:Open Source License
public static void drawStrip(int x, int y, float width, double angle, float points, float radius, int color) { GL11.glPushMatrix();/*from w w w . j a va 2s . c om*/ float f1 = (float) (color >> 24 & 255) / 255.0F; float f2 = (float) (color >> 16 & 255) / 255.0F; float f3 = (float) (color >> 8 & 255) / 255.0F; float f4 = (float) (color & 255) / 255.0F; GL11.glTranslatef(x, y, 0); GL11.glColor4f(f2, f3, f4, f1); GL11.glLineWidth(width); GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL11.GL_LINE_SMOOTH); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glHint(GL11.GL_LINE_SMOOTH_HINT, GL11.GL_NICEST); GL11.glEnable(GL13.GL_MULTISAMPLE); if (angle > 0) { GL11.glBegin(GL11.GL_LINE_STRIP); for (int i = 0; i < angle; i++) { float a = (float) (i * (angle * Math.PI / points)); float xc = (float) (Math.cos(a) * radius); float yc = (float) (Math.sin(a) * radius); GL11.glVertex2f(xc, yc); } GL11.glEnd(); } if (angle < 0) { GL11.glBegin(GL11.GL_LINE_STRIP); for (int i = 0; i > angle; i--) { float a = (float) (i * (angle * Math.PI / points)); float xc = (float) (Math.cos(a) * -radius); float yc = (float) (Math.sin(a) * -radius); GL11.glVertex2f(xc, yc); } GL11.glEnd(); } GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_LINE_SMOOTH); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL13.GL_MULTISAMPLE); GL11.glDisable(GL11.GL_MAP1_VERTEX_3); 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 ww . ja va2 s .co m*/ } 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(); }