List of usage examples for org.lwjgl.opengl GL11 glRotated
public static native void glRotated(@NativeType("GLdouble") double angle, @NativeType("GLdouble") double x, @NativeType("GLdouble") double y, @NativeType("GLdouble") double z);
From source file:com.farincorporated.frameutils.client.rendering.FramePistonRenderer.java
@Override public void renderItem(ItemRenderType type, ItemStack item, Object... data) { //RenderBlocks render = (RenderBlocks) data[0]; GL11.glDisable(GL11.GL_CULL_FACE);/*from w ww .j av a2 s . c om*/ GL11.glPushMatrix(); GL11.glScaled(scale, scale, scale); double[] dir = this.directionRotate(1); GL11.glRotated(dir[0], dir[1], dir[2], dir[3]); this.renderPistonBase(this.frametextures .get(item.hasTagCompound() ? item.getTagCompound().getString("frame_material") : "wood")); GL11.glPushMatrix(); this.bindTexture(this.pistonmap); modelpiston.renderPart("pistsontop"); GL11.glPopMatrix(); GL11.glPopMatrix(); }
From source file:com.farincorporated.frameutils.client.rendering.FrameTranslaterRenderer.java
@Override public void renderTileEntityAt(TileEntity ti, double x, double y, double z, float timesincelasttick) { TileFrameTranslater tile = (TileFrameTranslater) ti; ResourceLocation framemap = super.getFrame(tile.getMaterialType()); GL11.glDisable(GL11.GL_CULL_FACE);/*from w ww . j av a2 s. c om*/ GL11.glColor3d(1.0, 1.0, 1.0); GL11.glPushMatrix(); GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5); GL11.glScaled(scale, scale, scale); double[] dir = this.directionRotate(tile.getFace()); GL11.glRotated(dir[0], dir[1], dir[2], dir[3]); this.renderTranslater(framemap); GL11.glPopMatrix(); }
From source file:com.hea3ven.colladamodel.client.model.transform.Rotation.java
License:Open Source License
public void apply() { GL11.glRotated(angle, vec.xCoord, vec.yCoord, vec.zCoord); }
From source file:com.hilburn.dimensionguard.client.DisabledRenderer.java
License:Open Source License
@Override public void renderItem(ItemRenderType type, ItemStack itemStack, Object... data) { ItemStack thisStack = ItemStack/*w w w . j a va 2 s . com*/ .loadItemStackFromNBT((NBTTagCompound) itemStack.stackTagCompound.getTag("ItemStack")); boolean isInventory = type == ItemRenderType.INVENTORY; Tessellator tess = Tessellator.instance; FontRenderer fontRenderer = mc.fontRenderer; TextureManager textureManager = mc.getTextureManager(); GL11.glPushMatrix(); Item item = thisStack.getItem(); Block block = Block.getBlockFromItem(item); if (thisStack != null && block != null && block.getRenderBlockPass() != 0) { GL11.glEnable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_CULL_FACE); OpenGlHelper.glBlendFunc(770, 771, 1, 0); } IItemRenderer storedRenderer = MinecraftForgeClient.getItemRenderer(thisStack, type); //======Handles Special Blocks and Items====== if (storedRenderer != null) { storedRenderer.renderItem(type, thisStack, data); } else { if (thisStack.getItemSpriteNumber() == 0 && item instanceof ItemBlock && RenderBlocks.renderItemIn3d(block.getRenderType())) { //=====Handles regular blocks====== textureManager.bindTexture(textureManager.getResourceLocation(0)); switch (type) { case EQUIPPED_FIRST_PERSON: case EQUIPPED: case ENTITY: GL11.glTranslatef(0.5F, 0.5F, 0.5F); default: } if (thisStack != null && block != null && block.getRenderBlockPass() != 0) { GL11.glDepthMask(false); renderBlocksIr.renderBlockAsItem(block, thisStack.getItemDamage(), 1.0F); GL11.glDepthMask(true); } else { renderBlocksIr.renderBlockAsItem(block, thisStack.getItemDamage(), 1.0F); } } else { //=======Handles Regular Items====== if (isInventory) { renderItem.renderItemIntoGUI(fontRenderer, textureManager, thisStack, 0, 0); } else { GL11.glEnable(GL12.GL_RESCALE_NORMAL); switch (type) { case EQUIPPED_FIRST_PERSON: //TODO: get items to render in the right place GL11.glRotated(90F, 0F, 1F, 0F); GL11.glTranslatef(-1F, 0.5F, 0F); break; case EQUIPPED: GL11.glRotated(90F, 0F, 1F, 0F); GL11.glTranslatef(-1F, 0.5F, 0F); GL11.glRotated(90F, 1F, 0F, 0F); //GL11.glTranslatef(0, -4 / 16f, 0); break; case ENTITY: //GL11.glTranslatef(-0.5f, 0f, 1f / 16f); // correction of the rotation point when items lie on the ground default: } IIcon icon = thisStack.getIconIndex(); float xMax; float yMin; float xMin; float yMax; float depth = 1f / 16f; float width; float height; float xDiff; float yDiff; float xSub; float ySub; xMin = icon.getMinU(); xMax = icon.getMaxU(); yMin = icon.getMinV(); yMax = icon.getMaxV(); width = icon.getIconWidth(); height = icon.getIconHeight(); xDiff = xMin - xMax; yDiff = yMin - yMax; xSub = 0.5f * (xMax - xMin) / width; ySub = 0.5f * (yMax - yMin) / height; //=====Front and back===== tess.startDrawingQuads(); tess.setNormal(0, 0, 1); tess.addVertexWithUV(0, 0, 0, xMax, yMax); tess.addVertexWithUV(1, 0, 0, xMin, yMax); tess.addVertexWithUV(1, 1, 0, xMin, yMin); tess.addVertexWithUV(0, 1, 0, xMax, yMin); tess.draw(); tess.startDrawingQuads(); tess.setNormal(0, 0, -1); tess.addVertexWithUV(0, 1, -depth, xMax, yMin); tess.addVertexWithUV(1, 1, -depth, xMin, yMin); tess.addVertexWithUV(1, 0, -depth, xMin, yMax); tess.addVertexWithUV(0, 0, -depth, xMax, yMax); tess.draw(); // =========Sides============ tess.startDrawingQuads(); tess.setNormal(-1, 0, 0); float pos; float iconPos; float w = width, m = xMax, d = xDiff, s = xSub; for (int k = 0, e = (int) w; k < e; ++k) { pos = k / w; iconPos = m + d * pos - s; tess.addVertexWithUV(pos, 0, -depth, iconPos, yMax); tess.addVertexWithUV(pos, 0, 0, iconPos, yMax); tess.addVertexWithUV(pos, 1, 0, iconPos, yMin); tess.addVertexWithUV(pos, 1, -depth, iconPos, yMin); } tess.draw(); tess.startDrawingQuads(); tess.setNormal(1, 0, 0); float posEnd; w = width; m = xMax; d = xDiff; s = xSub; float d2 = 1f / w; for (int k = 0, e = (int) w; k < e; ++k) { pos = k / w; iconPos = m + d * pos - s; posEnd = pos + d2; tess.addVertexWithUV(posEnd, 1, -depth, iconPos, yMin); tess.addVertexWithUV(posEnd, 1, 0, iconPos, yMin); tess.addVertexWithUV(posEnd, 0, 0, iconPos, yMax); tess.addVertexWithUV(posEnd, 0, -depth, iconPos, yMax); } tess.draw(); tess.startDrawingQuads(); tess.setNormal(0, 1, 0); float h = height; m = yMax; d = yDiff; s = ySub; d2 = 1f / h; for (int k = 0, e = (int) h; k < e; ++k) { pos = k / h; iconPos = m + d * pos - s; posEnd = pos + d2; tess.addVertexWithUV(0, posEnd, 0, xMax, iconPos); tess.addVertexWithUV(1, posEnd, 0, xMin, iconPos); tess.addVertexWithUV(1, posEnd, -depth, xMin, iconPos); tess.addVertexWithUV(0, posEnd, -depth, xMax, iconPos); } tess.draw(); tess.startDrawingQuads(); tess.setNormal(0, -1, 0); h = height; m = yMax; d = yDiff; s = ySub; for (int k = 0, e = (int) h; k < e; ++k) { pos = k / h; iconPos = m + d * pos - s; tess.addVertexWithUV(1, pos, 0, xMin, iconPos); tess.addVertexWithUV(0, pos, 0, xMax, iconPos); tess.addVertexWithUV(0, pos, -depth, xMax, iconPos); tess.addVertexWithUV(1, pos, -depth, xMin, iconPos); } tess.draw(); GL11.glDisable(GL12.GL_RESCALE_NORMAL); } } } if (thisStack != null && block != null && block.getRenderBlockPass() != 0) { GL11.glDisable(GL11.GL_BLEND); } GL11.glPopMatrix(); if (isInventory) { renderItem.renderItemIntoGUI(fontRenderer, textureManager, itemStack, 0, 0); //TODO: only renders on items, not blocks - fix } }
From source file:com.minestellar.core.render.item.AntennaItemRender.java
License:Open Source License
@Override public void renderItem(ItemRenderType type, ItemStack item, Object... data) { switch (type) { case ENTITY://from www. j a v a 2s. com GL11.glPushMatrix(); GL11.glTranslated(-0.5, 0, -0.5); TileEntityRendererDispatcher.instance.renderTileEntityAt(new TileEntityRadioAntenna(), 0.0D, 0.0D, 0.0D, 0.0F); GL11.glTranslated(0.5, 0, 0.5); GL11.glPopMatrix(); break; case EQUIPPED_FIRST_PERSON: GL11.glPushMatrix(); GL11.glScaled(0.45D, 0.45D, 0.45D); TileEntityRendererDispatcher.instance.renderTileEntityAt(new TileEntityRadioAntenna(), 0.0D, 0.0D, 0.0D, 0.0F); GL11.glPopMatrix(); break; case INVENTORY: GL11.glPushMatrix(); GL11.glScaled(0.45D, 0.45D, 0.45D); GL11.glRotated(-180, 0, 10, 0); GL11.glTranslated(0, -0.65, 0); TileEntityRendererDispatcher.instance.renderTileEntityAt(new TileEntityRadioAntenna(), 0.0D, 0.0D, 0.0D, 0.0F); GL11.glTranslated(0, +0.65, 0); GL11.glPopMatrix(); break; } }
From source file:com.mrcrayfish.furniture.render.tileentity.WashingMachineRenderer.java
License:Open Source License
@Override public void renderTileEntityAt(TileEntity tileEntity, double posX, double posY, double posZ, float p_180535_8_, int p_180535_9_) { TileEntityWashingMachine tileEntityWashingMachine = (TileEntityWashingMachine) tileEntity; Block block = tileEntity.getBlockType(); int metadata = block.getMetaFromState(tileEntity.getWorld().getBlockState(tileEntity.getPos())); GL11.glPushMatrix();//from w w w .j av a2s .com GL11.glTranslatef((float) posX + 0.5F, (float) posY + 0.5F, (float) posZ + 0.5F); GL11.glRotatef(metadata * -90F, 0, 1, 0); this.armour.hoverStart = 0.0F; for (int i = 0; i < 4; i++) { if (tileEntityWashingMachine.getStackInSlot(i) != null) { double zOffset = getOffsetZ(metadata, i); armour.setEntityItemStack(tileEntityWashingMachine.getStackInSlot(i)); GL11.glRotated(tileEntityWashingMachine.progress * 5, 0, 0, 1); Minecraft.getMinecraft().getRenderManager().renderEntityWithPosYaw(armour, 0.0, -0.35D, zOffset, 0.0F, 0.0F); } } GL11.glPopMatrix(); }
From source file:de.sanandrew.mods.turretmod.client.render.tileentity.RenderItemTransmitter.java
License:Creative Commons License
private static void setupTooltipRenderer(Minecraft mc, TileEntityItemTransmitter te, float partTicks) { double playerPTX = mc.thePlayer.lastTickPosX + (mc.thePlayer.posX - mc.thePlayer.lastTickPosX) * partTicks; double playerPTZ = mc.thePlayer.lastTickPosZ + (mc.thePlayer.posZ - mc.thePlayer.lastTickPosZ) * partTicks; Vec3 vecPos = Vec3.createVectorHelper(playerPTX - (te.xCoord + 0.5D), 0.0, playerPTZ - (te.zCoord + 0.5D)); vecPos = vecPos.normalize();/*from w w w .ja v a2 s.co m*/ double angle = Math.toDegrees(Math.atan2(vecPos.zCoord, vecPos.xCoord)); GL11.glDepthMask(false); GL11.glRotated(90, 0.0F, 1.0F, 0.0F); GL11.glRotated(angle, 0.0F, 1.0F, 0.0F); GL11.glTranslated(0.0F, -0.25F, 0.0F); GL11.glDisable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_BLEND); OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO); GL11.glColor4d(1.0D, 1.0D, 1.0D, 0.75D + (float) SAPUtils.RNG.nextGaussian() * 0.02F); }
From source file:fr.mcnanotech.kevin_68.nanotechmod.city.client.renderer.tileentity.TileEntityTextSpotLightRender.java
License:Creative Commons License
public void renderTileEntitySignAt(TileEntityTextSpotLight tileentity, double par2, double par4, double par6, float par8) { float f = tileentity.isActiveFloat(); if (f > 0.0F) { GL11.glPushMatrix();/*w w w.j a va 2 s.c om*/ float f1 = 0.6666667F; float f2 = 0.0F; float d2 = (float) tileentity.getWorldObj().getTotalWorldTime() + par8; byte b1 = 1; double d3 = (double) d2 * 0.025D * (1.0D - (double) (b1 & 1) * 2.5D); int i1 = (tileentity.get(TileEntityTextSpotLight.REVERSEROTATION) == 1 ? -1 : 1); GL11.glTranslatef((float) par2 + 0.5F, (float) par4 + 0.75F * f1, (float) par6 + 0.5F); GL11.glRotatef(-f2, 0.0F, 1.0F, 0.0F); GL11.glTranslatef(0.0F, -0.4F, 0.0F); GL11.glScaled(0.9D, 0.9D, 0.9D); if (tileentity.get(TileEntityTextSpotLight.ROTATE) == 0) { GL11.glRotated(d3 * 5 * tileentity.get(TileEntityTextSpotLight.ROTATIONSPEED) * i1, 0.0F, 1.0F, 0.0F); } else { GL11.glRotatef(tileentity.get(TileEntityTextSpotLight.ANGLE), 0.0F, 1.0F, 0.0F); } this.modelSign.signStick.showModel = false; this.bindTexture(field_110638_a); GL11.glPushMatrix(); GL11.glScalef(f1, -f1, -f1); this.modelSign.renderSign(); GL11.glPopMatrix(); FontRenderer fontrenderer = this.func_147498_b(); f2 = 0.016666668F * f1; GL11.glTranslatef(0.0F, 0.5F * f1, 0.07F * f1); GL11.glScalef(f2 * 5, -f2 * 5, f2 * 5); GL11.glNormal3f(0.0F, 0.0F, -1.0F * f2); GL11.glDepthMask(false); GL11.glTranslated(0.0F, -tileentity.get(TileEntityTextSpotLight.HEIGHT), 0.0F); // GL11.glTranslated(0.0F, tileentity.getScale() / 5.0F, 0.0F); GL11.glScaled(1.0 + (1.0 * (tileentity.get(TileEntityTextSpotLight.SCALE) / 10)), 1.0 + (1.0 * (tileentity.get(TileEntityTextSpotLight.SCALE) / 10)), 1.0 + (1.0 * (tileentity.get(TileEntityTextSpotLight.SCALE) / 10))); String s = tileentity.signText; fontrenderer.drawString(s, -fontrenderer.getStringWidth(s) / 2, -20, (tileentity.get(TileEntityTextSpotLight.RED) * 65536) + (tileentity.get(TileEntityTextSpotLight.GREEN) * 256) + tileentity.get(TileEntityTextSpotLight.BLUE)); // GL11.glRotatef(180, 0.0F, 1.0F, 0.0F); // fontrenderer.drawString(s, -fontrenderer.getStringWidth(s) / 2, // -20, (tileentity.getRedValue() * 65536) + // (tileentity.getGreenValue() * 256) + tileentity.getBlueValue()); GL11.glDepthMask(true); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glPopMatrix(); } }
From source file:gravestone.models.block.memorials.ModelHangedSkeleton.java
License:LGPL
public void renderAll() { float f5 = 0.0625F; this.bipedBody.render(f5); this.bipedRightLeg.render(f5); this.bipedLeftLeg.render(f5); if (this.isInStocks) { this.rightArm.render(f5); this.leftArm.render(f5); this.rightArm2.render(f5); this.leftArm2.render(f5); } else {//w ww .ja v a 2s .c om this.bipedRightArm.render(f5); this.bipedLeftArm.render(f5); } Minecraft.getMinecraft().renderEngine .bindTexture(isWitherSkeleton ? Resources.WITHER_SKULL_CANDLE : Resources.SKELETON_SKULL_CANDLE); GL11.glPushMatrix(); GL11.glRotated(20, 1, 0, 0); GL11.glTranslated(0, -1.5, 0); skull.renderAll(); GL11.glPopMatrix(); }
From source file:gravestone.models.block.ModelPileOfBones.java
License:LGPL
public void renderAll(boolean haveSkull) { float f5 = 0.0625F; bone1.render(f5);/*w w w.j av a 2 s. c o m*/ bone2.render(f5); bone3.render(f5); bone4.render(f5); bone5.render(f5); bone6.render(f5); bone7.render(f5); bone8.render(f5); if (haveSkull) { Minecraft.getMinecraft().renderEngine.bindTexture(Resources.SKELETON_SKULL_CANDLE); GL11.glPushMatrix(); GL11.glTranslated(0.4, 0, 0.5); GL11.glRotated(45, 0, 1, 0); skull.renderAll(); GL11.glPopMatrix(); } }