List of usage examples for org.lwjgl.opengl GL11 glScalef
public static native void glScalef(@NativeType("GLfloat") float x, @NativeType("GLfloat") float y, @NativeType("GLfloat") float z);
From source file:buildcraft.transport.render.GateItemRenderer.java
License:Minecraft Mod Public
private void renderIn3D(ItemStack stack) { GL11.glPushMatrix();/* w w w. j av a 2 s . c om*/ renderLayerIn3D(ItemGate.getLogic(stack).getIconItem()); GL11.glScalef(1, 1, 1.05f); renderLayerIn3D(ItemGate.getMaterial(stack).getIconItem()); for (IGateExpansion expansion : ItemGate.getInstalledExpansions(stack)) { renderLayerIn3D(expansion.getOverlayItem()); } GL11.glPopMatrix(); }
From source file:buildcraft.transport.render.GateItemRenderer.java
License:Minecraft Mod Public
private void renderAsEntityFlat(ItemStack stack) { GL11.glPushMatrix();/*w w w . j a v a2s .c om*/ byte iterations = 1; if (stack.stackSize > 1) { iterations = 2; } if (stack.stackSize > 15) { iterations = 3; } if (stack.stackSize > 31) { iterations = 4; } Random rand = new Random(187L); for (int ii = 0; ii < iterations; ++ii) { GL11.glPushMatrix(); GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(180 - RenderManager.instance.playerViewY, 0.0F, 1.0F, 0.0F); if (ii > 0) { float var12 = (rand.nextFloat() * 2.0F - 1.0F) * 0.3F; float var13 = (rand.nextFloat() * 2.0F - 1.0F) * 0.3F; float var14 = (rand.nextFloat() * 2.0F - 1.0F) * 0.3F; GL11.glTranslatef(var12, var13, var14); } GL11.glTranslatef(0.5f, 0.8f, 0); GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F); GL11.glScalef(1f / 16f, 1f / 16f, 1); render(ItemRenderType.ENTITY, stack); GL11.glPopMatrix(); } GL11.glPopMatrix(); }
From source file:buildcraft.transport.render.PipeRendererTESR.java
License:Minecraft Mod Public
private void pipeWireRender(TileGenericPipe pipe, float cx, float cy, float cz, PipeWire color, double x, double y, double z) { PipeRenderState state = pipe.renderState; float minX = CoreConstants.PIPE_MIN_POS; float minY = CoreConstants.PIPE_MIN_POS; float minZ = CoreConstants.PIPE_MIN_POS; float maxX = CoreConstants.PIPE_MAX_POS; float maxY = CoreConstants.PIPE_MAX_POS; float maxZ = CoreConstants.PIPE_MAX_POS; boolean foundX = false, foundY = false, foundZ = false; if (state.wireMatrix.isWireConnected(color, ForgeDirection.WEST)) { minX = 0;// w w w .j a va 2s. c om foundX = true; } if (state.wireMatrix.isWireConnected(color, ForgeDirection.EAST)) { maxX = 1; foundX = true; } if (state.wireMatrix.isWireConnected(color, ForgeDirection.DOWN)) { minY = 0; foundY = true; } if (state.wireMatrix.isWireConnected(color, ForgeDirection.UP)) { maxY = 1; foundY = true; } if (state.wireMatrix.isWireConnected(color, ForgeDirection.NORTH)) { minZ = 0; foundZ = true; } if (state.wireMatrix.isWireConnected(color, ForgeDirection.SOUTH)) { maxZ = 1; foundZ = true; } boolean center = false; if (minX == 0 && maxX != 1 && (foundY || foundZ)) { if (cx == CoreConstants.PIPE_MIN_POS) { maxX = CoreConstants.PIPE_MIN_POS; } else { center = true; } } if (minX != 0 && maxX == 1 && (foundY || foundZ)) { if (cx == CoreConstants.PIPE_MAX_POS) { minX = CoreConstants.PIPE_MAX_POS; } else { center = true; } } if (minY == 0 && maxY != 1 && (foundX || foundZ)) { if (cy == CoreConstants.PIPE_MIN_POS) { maxY = CoreConstants.PIPE_MIN_POS; } else { center = true; } } if (minY != 0 && maxY == 1 && (foundX || foundZ)) { if (cy == CoreConstants.PIPE_MAX_POS) { minY = CoreConstants.PIPE_MAX_POS; } else { center = true; } } if (minZ == 0 && maxZ != 1 && (foundX || foundY)) { if (cz == CoreConstants.PIPE_MIN_POS) { maxZ = CoreConstants.PIPE_MIN_POS; } else { center = true; } } if (minZ != 0 && maxZ == 1 && (foundX || foundY)) { if (cz == CoreConstants.PIPE_MAX_POS) { minZ = CoreConstants.PIPE_MAX_POS; } else { center = true; } } boolean found = foundX || foundY || foundZ; GL11.glPushMatrix(); GL11.glPushAttrib(GL11.GL_ENABLE_BIT); GL11.glEnable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_CULL_FACE); RenderHelper.disableStandardItemLighting(); GL11.glColor3f(1, 1, 1); GL11.glTranslatef((float) x, (float) y, (float) z); float scale = 1.001f; GL11.glTranslatef(0.5F, 0.5F, 0.5F); GL11.glScalef(scale, scale, scale); GL11.glTranslatef(-0.5F, -0.5F, -0.5F); bindTexture(TextureMap.locationBlocksTexture); RenderInfo renderBox = new RenderInfo(); renderBox.texture = BuildCraftTransport.instance.wireIconProvider .getIcon(state.wireMatrix.getWireIconIndex(color)); // Z render if (minZ != CoreConstants.PIPE_MIN_POS || maxZ != CoreConstants.PIPE_MAX_POS || !found) { renderBox.setBounds(cx == CoreConstants.PIPE_MIN_POS ? cx - 0.05F : cx, cy == CoreConstants.PIPE_MIN_POS ? cy - 0.05F : cy, minZ, cx == CoreConstants.PIPE_MIN_POS ? cx : cx + 0.05F, cy == CoreConstants.PIPE_MIN_POS ? cy : cy + 0.05F, maxZ); RenderEntityBlock.INSTANCE.renderBlock(renderBox, pipe.getWorldObj(), 0, 0, 0, pipe.xCoord, pipe.yCoord, pipe.zCoord, true, true); } // X render if (minX != CoreConstants.PIPE_MIN_POS || maxX != CoreConstants.PIPE_MAX_POS || !found) { renderBox.setBounds(minX, cy == CoreConstants.PIPE_MIN_POS ? cy - 0.05F : cy, cz == CoreConstants.PIPE_MIN_POS ? cz - 0.05F : cz, maxX, cy == CoreConstants.PIPE_MIN_POS ? cy : cy + 0.05F, cz == CoreConstants.PIPE_MIN_POS ? cz : cz + 0.05F); RenderEntityBlock.INSTANCE.renderBlock(renderBox, pipe.getWorldObj(), 0, 0, 0, pipe.xCoord, pipe.yCoord, pipe.zCoord, true, true); } // Y render if (minY != CoreConstants.PIPE_MIN_POS || maxY != CoreConstants.PIPE_MAX_POS || !found) { renderBox.setBounds(cx == CoreConstants.PIPE_MIN_POS ? cx - 0.05F : cx, minY, cz == CoreConstants.PIPE_MIN_POS ? cz - 0.05F : cz, cx == CoreConstants.PIPE_MIN_POS ? cx : cx + 0.05F, maxY, cz == CoreConstants.PIPE_MIN_POS ? cz : cz + 0.05F); RenderEntityBlock.INSTANCE.renderBlock(renderBox, pipe.getWorldObj(), 0, 0, 0, pipe.xCoord, pipe.yCoord, pipe.zCoord, true, true); } if (center || !found) { renderBox.setBounds(cx == CoreConstants.PIPE_MIN_POS ? cx - 0.05F : cx, cy == CoreConstants.PIPE_MIN_POS ? cy - 0.05F : cy, cz == CoreConstants.PIPE_MIN_POS ? cz - 0.05F : cz, cx == CoreConstants.PIPE_MIN_POS ? cx : cx + 0.05F, cy == CoreConstants.PIPE_MIN_POS ? cy : cy + 0.05F, cz == CoreConstants.PIPE_MIN_POS ? cz : cz + 0.05F); RenderEntityBlock.INSTANCE.renderBlock(renderBox, pipe.getWorldObj(), 0, 0, 0, pipe.xCoord, pipe.yCoord, pipe.zCoord, true, true); } RenderHelper.enableStandardItemLighting(); GL11.glPopAttrib(); GL11.glPopMatrix(); }
From source file:buildcraft.transport.render.PipeRendererTESR.java
License:Minecraft Mod Public
private void renderPower(Pipe<PipeTransportPower> pipe, double x, double y, double z) { initializeDisplayPowerList(pipe.container.getWorldObj()); PipeTransportPower pow = pipe.transport; GL11.glPushMatrix();//from w w w . ja v a 2 s . c o m GL11.glPushAttrib(GL11.GL_ENABLE_BIT); GL11.glDisable(GL11.GL_LIGHTING); // GL11.glEnable(GL11.GL_BLEND); GL11.glTranslatef((float) x, (float) y, (float) z); bindTexture(TextureMap.locationBlocksTexture); int[] displayList = pow.overload > 0 ? displayPowerListOverload : displayPowerList; for (int side = 0; side < 6; ++side) { GL11.glPushMatrix(); GL11.glTranslatef(0.5F, 0.5F, 0.5F); GL11.glRotatef(angleY[side], 0, 1, 0); GL11.glRotatef(angleZ[side], 0, 0, 1); float scale = 1.0F - side * 0.0001F; GL11.glScalef(scale, scale, scale); GL11.glTranslatef(-0.5F, -0.5F, -0.5F); short stage = pow.clientDisplayPower[side]; if (stage >= 1) { if (stage < displayList.length) { GL11.glCallList(displayList[stage]); } else { GL11.glCallList(displayList[displayList.length - 1]); } } GL11.glPopMatrix(); } /*bindTexture(STRIPES_TEXTURE); for (int side = 0; side < 6; side += 2) { if (pipe.container.isPipeConnected(ForgeDirection.values()[side])) { GL11.glPushMatrix(); GL11.glTranslatef(0.5F, 0.5F, 0.5F); GL11.glRotatef(angleY[side], 0, 1, 0); GL11.glRotatef(angleZ[side], 0, 0, 1); float scale = 1.0F - side * 0.0001F; GL11.glScalef(scale, scale, scale); float movement = (0.50F) * pipe.transport.getPistonStage(side / 2); GL11.glTranslatef(-0.25F - 1F / 16F - movement, -0.5F, -0.5F); // float factor = (float) (1.0 / 256.0); float factor = (float) (1.0 / 16.0); box.render(factor); GL11.glPopMatrix(); } }*/ GL11.glPopAttrib(); GL11.glPopMatrix(); }
From source file:buildcraft.transport.render.PipeRendererTESR.java
License:Minecraft Mod Public
public void doRenderItem(TravelingItem travellingItem, double x, double y, double z, float light, EnumColor color) {/*from w ww. jav a 2 s. c om*/ if (travellingItem == null || travellingItem.getItemStack() == null) { return; } float renderScale = 0.7f; ItemStack itemstack = travellingItem.getItemStack(); GL11.glPushMatrix(); GL11.glTranslatef((float) x, (float) y, (float) z); GL11.glTranslatef(0, 0.25F, 0); GL11.glScalef(renderScale, renderScale, renderScale); dummyEntityItem.setEntityItemStack(itemstack); customRenderItem.doRender(dummyEntityItem, 0, 0, 0, 0, 0); if (color != null) { bindTexture(TextureMap.locationBlocksTexture); RenderInfo block = new RenderInfo(); block.texture = PipeIconProvider.TYPE.ItemBox.getIcon(); float pix = 0.0625F; float min = -4 * pix; float max = 4 * pix; block.minY = min; block.maxY = max; block.minZ = min; block.maxZ = max; block.minX = min; block.maxX = max; RenderUtils.setGLColorFromInt(color.getLightHex()); RenderEntityBlock.INSTANCE.renderBlock(block, null, 0, 0, 0, false, true); } GL11.glPopMatrix(); }
From source file:buildcraft.transport.render.RenderPipe.java
License:Minecraft Mod Public
public void doRenderItem(IPipedItem entityitem, double d, double d1, double d2, float f1) { if (entityitem == null || entityitem.getItemStack() == null) return;//from ww w . j a va 2s .c o m float renderScale = 0.7f; ItemStack itemstack = entityitem.getItemStack(); GL11.glPushMatrix(); GL11.glTranslatef((float) d, (float) d1, (float) d2); GL11.glTranslatef(0, 0.25F, 0); GL11.glScalef(renderScale, renderScale, renderScale); dummyEntityItem.func_92058_a(itemstack); customRenderItem.doRenderItem(dummyEntityItem, 0, 0, 0, 0, 0); GL11.glPopMatrix(); }
From source file:buildcraft.transport.RenderPipe.java
License:Minecraft Mod Public
public void doRenderItem(IPipedItem entityitem, double d, double d1, double d2, float f1) { if (entityitem == null || entityitem.getItemStack() == null) return;//from w w w .j a va 2s .co m ItemStack itemstack = entityitem.getItemStack(); random.setSeed(187L); GL11.glPushMatrix(); byte quantity = 1; if (entityitem.getItemStack().stackSize > 1) quantity = 2; GL11.glTranslatef((float) d, (float) d1, (float) d2); GL11.glEnable(32826 /* GL_RESCALE_NORMAL_EXT */); IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(itemstack, ItemRenderType.ENTITY); if (customRenderer != null) { GL11.glTranslatef(0, 0.25F, 0); // BC SPECIFIC loadTexture("/terrain.png"); ForgeHooksClient.overrideTexture(itemstack.getItem()); float f4 = 0.25F; f4 = 0.5F; GL11.glScalef(f4, f4, f4); for (int j = 0; j < quantity; j++) { GL11.glPushMatrix(); if (j > 0) { float f5 = ((random.nextFloat() * 2.0F - 1.0F) * 0.2F) / f4; float f7 = ((random.nextFloat() * 2.0F - 1.0F) * 0.2F) / f4; float f9 = ((random.nextFloat() * 2.0F - 1.0F) * 0.2F) / f4; GL11.glTranslatef(f5, f7, f9); } RenderPipe.dummyEntityItem.item = itemstack; customRenderer.renderItem(ItemRenderType.ENTITY, itemstack, renderBlocks, RenderPipe.dummyEntityItem); GL11.glPopMatrix(); } } else if (itemstack.itemID < Block.blocksList.length && Block.blocksList[itemstack.itemID] != null && RenderBlocks.renderItemIn3d(Block.blocksList[itemstack.itemID].getRenderType())) { GL11.glTranslatef(0, 0.25F, 0); // BC SPECIFIC loadTexture("/terrain.png"); ForgeHooksClient.overrideTexture(Block.blocksList[itemstack.itemID]); float f4 = 0.25F; int j = Block.blocksList[itemstack.itemID].getRenderType(); if (j == 1 || j == 19 || j == 12 || j == 2) f4 = 0.5F; GL11.glScalef(f4, f4, f4); for (int k = 0; k < quantity; k++) { GL11.glPushMatrix(); if (k > 0) { float f6 = ((random.nextFloat() * 2.0F - 1.0F) * 0.2F) / f4; float f9 = ((random.nextFloat() * 2.0F - 1.0F) * 0.2F) / f4; float f11 = ((random.nextFloat() * 2.0F - 1.0F) * 0.2F) / f4; GL11.glTranslatef(f6, f9, f11); } float f7 = 1.0F; renderBlocks.renderBlockAsItem(Block.blocksList[itemstack.itemID], itemstack.getItemDamage(), f7); GL11.glPopMatrix(); } } else { GL11.glTranslatef(0, 0.10F, 0); // BC SPECIFIC if (itemstack.getItem().requiresMultipleRenderPasses()) { GL11.glScalef(0.5F, 0.5F, 0.5F); this.loadTexture(ForgeHooksClient.getTexture("/gui/items.png", Item.itemsList[itemstack.itemID])); for (int i = 0; i <= 1; ++i) { int iconIndex = itemstack.getItem().getIconFromDamageForRenderPass(itemstack.getItemDamage(), i); float scale = 1.0F; if (true) { int var17 = Item.itemsList[itemstack.itemID].getColorFromDamage(itemstack.getItemDamage(), i); float var18 = (var17 >> 16 & 255) / 255.0F; float var19 = (var17 >> 8 & 255) / 255.0F; float var20 = (var17 & 255) / 255.0F; GL11.glColor4f(var18 * scale, var19 * scale, var20 * scale, 1.0F); } this.drawItem(iconIndex, quantity); } } else { GL11.glScalef(0.5F, 0.5F, 0.5F); int i = itemstack.getIconIndex(); if (itemstack.itemID < Block.blocksList.length && Block.blocksList[itemstack.itemID] != null) { loadTexture("/terrain.png"); ForgeHooksClient.overrideTexture(Block.blocksList[itemstack.itemID]); } else { loadTexture("/gui/items.png"); ForgeHooksClient.overrideTexture(Item.itemsList[itemstack.itemID]); } drawItem(i, quantity); } } GL11.glDisable(32826 /* GL_RESCALE_NORMAL_EXT */); GL11.glPopMatrix(); }
From source file:ccm.burialservices.client.renderers.GraveRenderer.java
License:Open Source License
@Override public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float tickTime) { GraveTE te = (GraveTE) tileentity;/*from www.j a va 2 s . co m*/ GL11.glPushMatrix(); GL11.glTranslated(x, y, z); //Center to block ResourceLocation skin = te.getLocationSkin(); float f5 = 0.9F; float f6 = 0.0625F; switch (te.getBlockMetadata()) { case 0: break; case 1: GL11.glRotatef(90F, 0.0F, 1.0F, 0.0F); GL11.glTranslated(-1, 0, 0); break; case 2: GL11.glRotatef(180F, 0.0F, 1.0F, 0.0F); GL11.glTranslated(-1, 0, -1); break; case 3: GL11.glRotatef(-90F, 0.0F, 1.0F, 0.0F); GL11.glTranslated(0, 0, -1); break; } GL11.glTranslated(0.5, 0.1d, 0.5); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glScalef(f6, f6, f6); Minecraft.getMinecraft().renderEngine.bindTexture(skin); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glRotatef(90F, 1.0F, 0.0F, 0.0F); MODEL_BIPED.bipedHead.rotateAngleX = (float) Math.toRadians(15F); MODEL_BIPED.bipedHead.render(f5); MODEL_BIPED.bipedBody.render(f5); MODEL_BIPED.bipedRightArm.render(f5); MODEL_BIPED.bipedLeftArm.render(f5); MODEL_BIPED.bipedRightLeg.render(f5); MODEL_BIPED.bipedLeftLeg.render(f5); GL11.glPopMatrix(); ItemStack is = te.getHolding(); if (is != null) { renderItemHolding(0, te.getBlockMetadata(), is, x, y, z, tickTime); if (is.getItem().requiresMultipleRenderPasses()) { for (int i = 1; i < is.getItem().getRenderPasses(is.getItemDamage()); i++) { renderItemHolding(i, te.getBlockMetadata(), is, x, y, z, tickTime); } } } renderSign(x, y, z, tickTime, te.text, te.getBlockMetadata(), is != null); }
From source file:ccm.burialservices.client.renderers.GraveRenderer.java
License:Open Source License
private void renderSign(double x, double y, double z, float tickTime, String[] signText, int meta, boolean renderingItem) { if (signText.length == 0) return;// w w w.ja v a2s . c o m int i = 0; for (String line : signText) if (!Strings.isNullOrEmpty(line)) { i++; } if (i == 0) return; GL11.glPushMatrix(); float f1 = 0.6666667F; GL11.glTranslatef((float) x + 0.5F, (float) y + 0.75F * f1, (float) z + 0.5F); float f2 = 0.0F; switch (meta) { case 0: break; case 1: f2 = 90f; break; case 2: f2 = 180f; break; case 3: f2 = -90f; } GL11.glTranslated(0, -0.3, 0); if (renderingItem) GL11.glTranslated(0, 0.03, 0); GL11.glRotatef(f2, 0.0F, 1.0F, 0.0F); GL11.glRotatef(-90F, 1.0F, 0.0F, 0.0F); GL11.glTranslated(0, -1.2, 0); GL11.glTranslatef(0.0F, -0.3125F, -0.4375F); GL11.glTranslatef(0f, 0.8F, 0.5f); MODEL_SIGN.signStick.showModel = false; this.bindTexture(SIGN_TEXTURE); GL11.glPushMatrix(); GL11.glScalef(f1, -f1, -f1); MODEL_SIGN.renderSign(); GL11.glPopMatrix(); FontRenderer fontrenderer = this.getFontRenderer(); f2 = 0.016666668F * f1; GL11.glTranslatef(0.0F, 0.5F * f1, 0.07F * f1); GL11.glScalef(f2, -f2, f2); GL11.glNormal3f(0.0F, 0.0F, -1.0F * f2); GL11.glDepthMask(false); byte b0 = 0; for (int j = 0; j < signText.length; ++j) { GL11.glPushMatrix(); String s = signText[j]; int width = fontrenderer.getStringWidth(s); if (width > 95) { float f = 1f - ((width) * 0.0015f); GL11.glScalef(f, f, f); } fontrenderer.drawString(s, -width / 2, j * 10 - 20, b0); GL11.glPopMatrix(); } GL11.glDepthMask(true); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glPopMatrix(); }
From source file:ccm.pay2spawn.util.Helper.java
License:Open Source License
public static void renderPoint(Tessellator tess, int x, int y, int z) { GL11.glPushMatrix();/*from w w w . jav a 2s . co m*/ GL11.glTranslated(x, y, z); GL11.glScalef(1.01f, 1.01f, 1.01f); tess.startDrawing(GL11.GL_LINES); // FRONT tess.addVertex(0, 0, 0); tess.addVertex(0, 1, 0); tess.addVertex(0, 1, 0); tess.addVertex(1, 1, 0); tess.addVertex(1, 1, 0); tess.addVertex(1, 0, 0); tess.addVertex(1, 0, 0); tess.addVertex(0, 0, 0); // BACK tess.addVertex(0, 0, -1); tess.addVertex(0, 1, -1); tess.addVertex(0, 0, -1); tess.addVertex(1, 0, -1); tess.addVertex(1, 0, -1); tess.addVertex(1, 1, -1); tess.addVertex(0, 1, -1); tess.addVertex(1, 1, -1); // betweens. tess.addVertex(0, 0, 0); tess.addVertex(0, 0, -1); tess.addVertex(0, 1, 0); tess.addVertex(0, 1, -1); tess.addVertex(1, 0, 0); tess.addVertex(1, 0, -1); tess.addVertex(1, 1, 0); tess.addVertex(1, 1, -1); tess.draw(); GL11.glPopMatrix(); }