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:valkyrienwarfare.addon.combat.render.EntityCannonBasicRender.java
License:Open Source License
@Override public void doRender(EntityCannonBasic entity, double x, double y, double z, float entityYaw, float partialTicks) { float paritalTickYaw = entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * partialTicks; float paritalTickPitch = entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * partialTicks; double renderYaw = -paritalTickYaw + 90f; double renderPitch = paritalTickPitch; bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); // entity.posX += 15; Tessellator tessellator = Tessellator.getInstance(); BufferBuilder BufferBuilder = tessellator.getBuffer(); double oldX = BufferBuilder.xOffset; double oldY = BufferBuilder.yOffset; double oldZ = BufferBuilder.zOffset; GL11.glPushMatrix();//w w w . j a va2 s . c om GlStateManager.disableLighting(); if (this.renderOutlines) { GlStateManager.enableColorMaterial(); GlStateManager.enableOutlineMode(this.getTeamColor(entity)); } BufferBuilder.setTranslation(0, 0, 0); GL11.glTranslated(x, y, z); double offsetAngle = entity.getBaseAngleOffset(); GL11.glRotated(offsetAngle, 0, 1D, 0); GL11.glPushMatrix(); GL11.glTranslated(-.1D, 0, 0); renderBase(entity, x, y, z, entityYaw, partialTicks); GL11.glPopMatrix(); GL11.glTranslated(.15D, .5D, 0); GL11.glRotated(renderYaw - offsetAngle, 0, 1D, 0); GL11.glRotated(renderPitch, 0, 0, 1D); GL11.glTranslated(-.8D, 0, -0.25); GL11.glPushMatrix(); renderHead(entity, x, y, z, entityYaw, partialTicks); GL11.glPopMatrix(); if (this.renderOutlines) { GlStateManager.disableOutlineMode(); GlStateManager.disableColorMaterial(); } BufferBuilder.setTranslation(oldX, oldY, oldZ); GlStateManager.disableLighting(); GlStateManager.resetColor(); GlStateManager.enableLighting(); GL11.glPopMatrix(); }
From source file:valkyrienwarfare.addon.control.renderer.PropellerEngineTileEntityRenderer.java
License:Open Source License
@Override public void render(TileEntityPropellerEngine tileentity, double x, double y, double z, float partialTick, int destroyStage, float alpha) { IBlockState state = tileentity.getWorld().getBlockState(tileentity.getPos()); if (state.getBlock() instanceof BlockAirshipEngine) { EnumFacing facing = state.getValue(BlockAirshipEngine.FACING); IBlockState engineRenderState = getRenderState(state); IBlockState propellerRenderState = ValkyrienWarfareControl.INSTANCE.blocks.shipWheel .getStateFromMeta(14);/* w w w. j a v a 2 s . c o m*/ this.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); GlStateManager.pushMatrix(); GlStateManager.disableLighting(); Tessellator tessellator = Tessellator.getInstance(); BufferBuilder BufferBuilder = tessellator.getBuffer(); double oldX = BufferBuilder.xOffset; double oldY = BufferBuilder.yOffset; double oldZ = BufferBuilder.zOffset; BufferBuilder.setTranslation(0, 0, 0); GL11.glTranslated(x, y, z); GlStateManager.disableAlpha(); GlStateManager.disableBlend(); int brightness = tileentity.getWorld().getCombinedLight(tileentity.getPos(), 0); // GL11.glScaled(1.2D, 1.2D, 1.2D); GL11.glTranslated(0.5D, 0.5D, 0.5D); switch (facing) { case UP: GL11.glRotated(-90, 1, 0, 0); break; case DOWN: GL11.glRotated(90, 1, 0, 0); break; case NORTH: GL11.glRotated(180, 0, 1, 0); break; case EAST: GL11.glRotated(90, 0, 1, 0); break; case SOUTH: GL11.glRotated(0, 0, 1, 0); break; case WEST: GL11.glRotated(270, 0, 1, 0); break; } GL11.glTranslated(-0.5D, -0.5D, -0.5D); FastBlockModelRenderer.renderBlockModel(BufferBuilder, tessellator, tileentity.getWorld(), engineRenderState, brightness); GL11.glPushMatrix(); GL11.glTranslated(0.5D, 0.21D, 0.5D); GL11.glRotated(tileentity.getPropellerAngle(partialTick), 0, 0, 1); GL11.glScaled(1.5D, 1.5D, 1); GL11.glTranslated(-0.5D, -0.21D, -0.5D); FastBlockModelRenderer.renderBlockModel(BufferBuilder, tessellator, tileentity.getWorld(), propellerRenderState, brightness); GL11.glPopMatrix(); GL11.glPopMatrix(); BufferBuilder.setTranslation(oldX, oldY, oldZ); } }
From source file:valkyrienwarfare.addon.control.renderer.ShipHelmTileEntityRenderer.java
License:Open Source License
@Override public void render(TileEntityShipHelm tileentity, double x, double y, double z, float partialTick, int destroyStage, float alpha) { if (tileentity instanceof TileEntityShipHelm) { IBlockState helmState = tileentity.getWorld().getBlockState(tileentity.getPos()); if (helmState.getBlock() != ValkyrienWarfareControl.INSTANCE.blocks.shipHelm) { return; }//from w w w.jav a 2 s.c om this.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); GlStateManager.pushMatrix(); GlStateManager.disableLighting(); Tessellator tessellator = Tessellator.getInstance(); BufferBuilder BufferBuilder = tessellator.getBuffer(); double oldX = BufferBuilder.xOffset; double oldY = BufferBuilder.yOffset; double oldZ = BufferBuilder.zOffset; BufferBuilder.setTranslation(0, 0, 0); GL11.glTranslated(x, y, z); GlStateManager.disableAlpha(); GlStateManager.disableBlend(); double smoothCompassDif = (tileentity.compassAngle - tileentity.lastCompassAngle); if (smoothCompassDif < -180) { smoothCompassDif += 360; } if (smoothCompassDif > 180) { smoothCompassDif -= 360; } double smoothWheelDif = (tileentity.wheelRotation - tileentity.lastWheelRotation); if (smoothWheelDif < -180) { smoothWheelDif += 360; } if (smoothWheelDif > 180) { smoothWheelDif -= 360; } double smoothCompass = tileentity.lastCompassAngle + (smoothCompassDif) * partialTick + 180D; double smoothWheel = tileentity.lastWheelRotation + (smoothWheelDif) * partialTick; BlockPos originPos = tileentity.getPos(); IBlockState wheelState = ValkyrienWarfareControl.INSTANCE.blocks.shipWheel.getStateFromMeta(0); IBlockState compassState = ValkyrienWarfareControl.INSTANCE.blocks.shipWheel.getStateFromMeta(1); IBlockState glassState = ValkyrienWarfareControl.INSTANCE.blocks.shipWheel.getStateFromMeta(2); IBlockState helmStateToRender = ValkyrienWarfareControl.INSTANCE.blocks.shipWheel.getStateFromMeta(3); // TODO: Better rendering cache int brightness = tileentity.getWorld().getCombinedLight(tileentity.getPos(), 0); double multiplier = 2.0D; GL11.glTranslated((1D - multiplier) / 2.0D, 0, (1D - multiplier) / 2.0D); GL11.glScaled(multiplier, multiplier, multiplier); EnumFacing enumfacing = helmState.getValue(BlockShipHelm.FACING); double wheelAndCompassStateRotation = enumfacing.getHorizontalAngle(); GL11.glTranslated(0.5D, 0, 0.5D); GL11.glRotated(wheelAndCompassStateRotation, 0, 1, 0); GL11.glTranslated(-0.5D, 0, -0.5D); FastBlockModelRenderer.renderBlockModel(BufferBuilder, tessellator, tileentity.getWorld(), helmStateToRender, brightness); GL11.glPushMatrix(); GL11.glTranslated(.5, .522, 0); GL11.glRotated(smoothWheel, 0, 0, 1); GL11.glTranslated(-.5, -.522, 0); FastBlockModelRenderer.renderBlockModel(BufferBuilder, tessellator, tileentity.getWorld(), wheelState, brightness); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(0.5D, 0, 0.5D); GL11.glRotated(smoothCompass, 0, 1, 0); GL11.glTranslated(-0.5D, 0, -0.5D); FastBlockModelRenderer.renderBlockModel(BufferBuilder, tessellator, tileentity.getWorld(), compassState, brightness); GL11.glPopMatrix(); GlStateManager.enableAlpha(); GlStateManager.enableBlend(); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); FastBlockModelRenderer.renderBlockModel(BufferBuilder, tessellator, tileentity.getWorld(), glassState, brightness); GlStateManager.disableAlpha(); GlStateManager.disableBlend(); GL11.glPopMatrix(); BufferBuilder.setTranslation(oldX, oldY, oldZ); GlStateManager.enableLighting(); GlStateManager.resetColor(); } }
From source file:valkyrienwarfare.addon.control.renderer.ShipTelegraphTileEntityRenderer.java
License:Open Source License
@Override public void render(TileEntityShipTelegraph tileentity, double x, double y, double z, float partialTick, int destroyStage, float alpha) { IBlockState telegraphState = tileentity.getWorld().getBlockState(tileentity.getPos()); if (telegraphState.getBlock() != ValkyrienWarfareControl.INSTANCE.blocks.shipTelegraph) { return;//from ww w. j a va 2 s.com } this.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); GlStateManager.pushMatrix(); GlStateManager.disableLighting(); Tessellator tessellator = Tessellator.getInstance(); BufferBuilder BufferBuilder = tessellator.getBuffer(); double oldX = BufferBuilder.xOffset; double oldY = BufferBuilder.yOffset; double oldZ = BufferBuilder.zOffset; BufferBuilder.setTranslation(0, 0, 0); GL11.glTranslated(x, y, z); GlStateManager.disableAlpha(); GlStateManager.disableBlend(); BlockPos originPos = tileentity.getPos(); IBlockState glassState = ValkyrienWarfareControl.INSTANCE.blocks.shipWheel.getStateFromMeta(8); IBlockState dialState = ValkyrienWarfareControl.INSTANCE.blocks.shipWheel.getStateFromMeta(7); IBlockState leftHandleState = ValkyrienWarfareControl.INSTANCE.blocks.shipWheel.getStateFromMeta(6); IBlockState rightHandleState = ValkyrienWarfareControl.INSTANCE.blocks.shipWheel.getStateFromMeta(5); IBlockState helmStateToRender = ValkyrienWarfareControl.INSTANCE.blocks.shipWheel.getStateFromMeta(4); int brightness = tileentity.getWorld().getCombinedLight(tileentity.getPos(), 0); double multiplier = 1.5D; GL11.glTranslated((1D - multiplier) / 2.0D, 0, (1D - multiplier) / 2.0D); GL11.glScaled(multiplier, multiplier, multiplier); EnumFacing enumfacing = telegraphState.getValue(BlockShipTelegraph.FACING); double wheelAndCompassStateRotation = enumfacing.getHorizontalAngle(); GL11.glTranslated(0.5D, 0, 0.5D); GL11.glRotated(wheelAndCompassStateRotation, 0, 1, 0); GL11.glTranslated(-0.5D, 0, -0.5D); FastBlockModelRenderer.renderBlockModel(BufferBuilder, tessellator, tileentity.getWorld(), helmStateToRender, brightness); FastBlockModelRenderer.renderBlockModel(BufferBuilder, tessellator, tileentity.getWorld(), dialState, brightness); GL11.glPushMatrix(); GL11.glTranslated(0.497D, 0.857D, 0.5D); GL11.glRotated(tileentity.getHandleRenderRotation(), 0D, 0D, 1D); GL11.glTranslated(-0.497D, -0.857D, -0.5D); FastBlockModelRenderer.renderBlockModel(BufferBuilder, tessellator, tileentity.getWorld(), rightHandleState, brightness); FastBlockModelRenderer.renderBlockModel(BufferBuilder, tessellator, tileentity.getWorld(), leftHandleState, brightness); GL11.glPopMatrix(); GlStateManager.enableAlpha(); GlStateManager.enableBlend(); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); FastBlockModelRenderer.renderBlockModel(BufferBuilder, tessellator, tileentity.getWorld(), glassState, brightness); GlStateManager.disableAlpha(); GlStateManager.disableBlend(); GL11.glPopMatrix(); BufferBuilder.setTranslation(oldX, oldY, oldZ); GlStateManager.enableLighting(); GlStateManager.resetColor(); }
From source file:valkyrienwarfare.mod.client.render.PhysObjectRenderManager.java
License:Open Source License
public void updateTranslation(double partialTicks) { PhysicsWrapperEntity entity = parent.wrapper; Vector centerOfRotation = entity.wrapping.centerCoord; curPartialTick = partialTicks;/*w w w . j av a 2s.com*/ double moddedX = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * partialTicks; double moddedY = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * partialTicks; double moddedZ = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * partialTicks; // System.out.println(entity.roll - entity.prevRoll); double p0 = Minecraft.getMinecraft().player.lastTickPosX + (Minecraft.getMinecraft().player.posX - Minecraft.getMinecraft().player.lastTickPosX) * partialTicks; double p1 = Minecraft.getMinecraft().player.lastTickPosY + (Minecraft.getMinecraft().player.posY - Minecraft.getMinecraft().player.lastTickPosY) * partialTicks; double p2 = Minecraft.getMinecraft().player.lastTickPosZ + (Minecraft.getMinecraft().player.posZ - Minecraft.getMinecraft().player.lastTickPosZ) * partialTicks; Quaternion smoothRotation = getSmoothRotationQuat(partialTicks); double[] radians = smoothRotation.toRadians(); double moddedPitch = Math.toDegrees(radians[0]); double moddedYaw = Math.toDegrees(radians[1]); double moddedRoll = Math.toDegrees(radians[2]); parent.coordTransform.updateRenderMatrices(moddedX, moddedY, moddedZ, moddedPitch, moddedYaw, moddedRoll); if (offsetPos != null) { double offsetX = offsetPos.getX() - centerOfRotation.X; double offsetY = offsetPos.getY() - centerOfRotation.Y; double offsetZ = offsetPos.getZ() - centerOfRotation.Z; GlStateManager.translate(-p0 + moddedX, -p1 + moddedY, -p2 + moddedZ); GL11.glRotated(moddedPitch, 1D, 0, 0); GL11.glRotated(moddedYaw, 0, 1D, 0); GL11.glRotated(moddedRoll, 0, 0, 1D); GL11.glTranslated(offsetX, offsetY, offsetZ); // transformBuffer = BufferUtils.createFloatBuffer(16); } }
From source file:valkyrienwarfare.mod.client.render.PhysObjectRenderManager.java
License:Open Source License
public void inverseTransform(double partialTicks) { PhysicsWrapperEntity entity = parent.wrapper; Vector centerOfRotation = entity.wrapping.centerCoord; curPartialTick = partialTicks;/*from www .jav a 2 s.c o m*/ double moddedX = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * partialTicks; double moddedY = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * partialTicks; double moddedZ = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * partialTicks; double p0 = Minecraft.getMinecraft().player.lastTickPosX + (Minecraft.getMinecraft().player.posX - Minecraft.getMinecraft().player.lastTickPosX) * partialTicks; double p1 = Minecraft.getMinecraft().player.lastTickPosY + (Minecraft.getMinecraft().player.posY - Minecraft.getMinecraft().player.lastTickPosY) * partialTicks; double p2 = Minecraft.getMinecraft().player.lastTickPosZ + (Minecraft.getMinecraft().player.posZ - Minecraft.getMinecraft().player.lastTickPosZ) * partialTicks; Quaternion smoothRotation = getSmoothRotationQuat(partialTicks); double[] radians = smoothRotation.toRadians(); double moddedPitch = Math.toDegrees(radians[0]); double moddedYaw = Math.toDegrees(radians[1]); double moddedRoll = Math.toDegrees(radians[2]); // parent.coordTransform.updateRenderMatrices(moddedX, moddedY, moddedZ, // moddedPitch, moddedYaw, moddedRoll); if (offsetPos != null) { double offsetX = offsetPos.getX() - centerOfRotation.X; double offsetY = offsetPos.getY() - centerOfRotation.Y; double offsetZ = offsetPos.getZ() - centerOfRotation.Z; GL11.glTranslated(-offsetX, -offsetY, -offsetZ); GL11.glRotated(-moddedRoll, 0, 0, 1D); GL11.glRotated(-moddedYaw, 0, 1D, 0); GL11.glRotated(-moddedPitch, 1D, 0, 0); GlStateManager.translate(p0 - moddedX, p1 - moddedY, p2 - moddedZ); // transformBuffer = BufferUtils.createFloatBuffer(16); } }
From source file:vazkii.botania.client.core.handler.TiaraWingRenderHandler.java
License:Creative Commons License
private void renderHalo(EntityPlayer player, float partialTicks) { float yaw = player.prevRotationYawHead + (player.rotationYawHead - player.prevRotationYawHead) * partialTicks; float yawOffset = player.prevRenderYawOffset + (player.renderYawOffset - player.prevRenderYawOffset) * partialTicks; float pitch = player.prevRotationPitch + (player.rotationPitch - player.prevRotationPitch) * partialTicks; GL11.glPushMatrix();/*w ww. j a v a 2s .co m*/ GL11.glRotatef(yawOffset, 0, -1, 0); GL11.glRotatef(yaw - 270, 0, 1, 0); GL11.glRotatef(pitch, 0, 0, 1); GL11.glShadeModel(GL11.GL_SMOOTH); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240, 240); GL11.glDisable(GL11.GL_LIGHTING); GL11.glColor4f(1F, 1F, 1F, 1F); Minecraft.getMinecraft().renderEngine.bindTexture(textureHalo); GL11.glTranslated(0, -player.eyeHeight + (player.isSneaking() ? 0.0625 : 0), 0); GL11.glRotated(30, 1, 0, -1); GL11.glTranslatef(-0.1F, -0.5F, -0.1F); GL11.glRotatef(player.ticksExisted + partialTicks, 0, 1, 0); Tessellator tes = Tessellator.instance; tes.startDrawingQuads(); tes.addVertexWithUV(-0.5, 0, -0.5, 0, 0); tes.addVertexWithUV(-0.5, 0, 0.5, 0, 1); tes.addVertexWithUV(0.5, 0, 0.5, 1, 1); tes.addVertexWithUV(0.5, 0, -0.5, 1, 0); tes.draw(); GL11.glEnable(GL11.GL_LIGHTING); GL11.glShadeModel(GL11.GL_FLAT); GL11.glPopMatrix(); }
From source file:vazkii.botania.client.render.tile.RenderTileSparkChanger.java
License:Open Source License
@Override public void renderTileEntityAt(TileEntity tileentity, double d0, double d1, double d2, float pticks) { GL11.glPushMatrix();/*w w w.j a v a 2s .c o m*/ GL11.glTranslated(d0, d1, d2); GL11.glRotated(90F, 1F, 0F, 0F); GL11.glTranslatef(0.8F, 0.2F, -0.22F); GL11.glColor4f(1F, 1F, 1F, 1F); ItemStack stack = ((TileSparkChanger) tileentity).getStackInSlot(0); if (stack != null) { GL11.glPushMatrix(); Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationItemsTexture); float s = 0.6F; GL11.glScalef(s, s, s); GL11.glRotatef(180F, 0F, 1F, 0F); int renderPass = 0; do { IIcon icon = stack.getItem().getIcon(stack, renderPass); if (icon != null) { Color color = new Color(stack.getItem().getColorFromItemStack(stack, renderPass)); GL11.glColor3ub((byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue()); float f = icon.getMinU(); float f1 = icon.getMaxU(); float f2 = icon.getMinV(); float f3 = icon.getMaxV(); ItemRenderer.renderItemIn2D(Tessellator.instance, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 1F / 16F); GL11.glColor3f(1F, 1F, 1F); } renderPass++; } while (renderPass < stack.getItem().getRenderPasses(stack.getItemDamage())); GL11.glPopMatrix(); } GL11.glColor4f(1F, 1F, 1F, 1F); GL11.glPopMatrix(); }
From source file:vazkii.priscemagica.client.render.tile.RenderTileDesk.java
License:Creative Commons License
@Override public void renderTileEntityAt(TileEntity tileentity, double d0, double d1, double d2, float f) { GL11.glPushMatrix();/*from w w w. j a v a 2 s . c o m*/ GL11.glTranslated(d0, d1, d2); GL11.glTranslatef(0F, 0.815F, 0F); GL11.glRotated(90F, 1F, 0F, 0F); GL11.glTranslatef(0.12F, 0.25F, 0F); GL11.glRotatef(34F, 0F, 0F, 1F); GL11.glScalef(0.75F, 0.75F, 0.75F); Minecraft.getMinecraft().renderEngine.func_110577_a(resourceBook); GL11.glEnable(GL11.GL_CULL_FACE); book.render(null, 0F, 0F, 0F, 0F, 0F, 0.0625F); GL11.glDisable(GL11.GL_CULL_FACE); Minecraft.getMinecraft().renderEngine.func_110577_a(resourceMap); GL11.glRotatef(90F, 0F, 1F, 0F); GL11.glRotatef(20F, 1F, 0F, 0F); GL11.glTranslatef(-0.08F, 0F, 0.4F); GL11.glDisable(GL11.GL_LIGHTING); Tessellator tess = Tessellator.instance; tess.startDrawingQuads(); tess.addVertexWithUV(0F, 0F, 0.75F, 0, 1); tess.addVertexWithUV(0F, 0.75F, 0.75F, 1, 1); tess.addVertexWithUV(0F, 0.75F, 0F, 1, 0); tess.addVertexWithUV(0F, 0F, 0F, 0, 0); tess.draw(); float scale = 1 / 128F; GL11.glScalef(scale, scale, scale); GL11.glRotatef(-90F, 0F, 1F, 0F); GL11.glTranslatef(5F, 5F, -1F); FontRenderer font = Minecraft.getMinecraft().standardGalacticFontRenderer; String[] text = { "this is going to be a", "spell here, but as", "of now it's just", "writing some data", "please wait a bit", "for your spell.", "if you decided to", "read this then you", "just wasted a", "bunch of time, woo" }; for (String element : text) { font.drawString(element, 0, 0, 0x555555); GL11.glTranslatef(0F, 9F, 0F); } GL11.glPopMatrix(); }
From source file:vengine.VGraphics.java
public void drawRect(int x, int y, int w, int h, double angle) { VPoint[] points = new VPoint[] { new VPoint(-w / 2, -h / 2, 0), new VPoint(-w / 2, +h / 2, 0), new VPoint(+w / 2, +h / 2, 0), new VPoint(+w / 2, -h / 2, 0), }; GL11.glTranslated(x, y, 0);//from w w w . j ava2 s . c o m GL11.glRotated(angle, 0, 0, 1); fillPolygon(points); GL11.glRotated(angle, 0, 0, -1); GL11.glTranslated(-x, -y, 0); }