List of usage examples for org.lwjgl.opengl GL11 glTranslated
public static native void glTranslated(@NativeType("GLdouble") double x, @NativeType("GLdouble") double y, @NativeType("GLdouble") double z);
From source file:cn.academy.core.client.gui.GuiPresetSelect.java
License:Open Source License
private void drawSelectionMenu(int w, int h, long dt) { double ratio = dt < 500 ? 0 : (dt < 600 ? (dt - 500) / 100d : 1.0); double mAlpha = dt < 700 ? 0 : Math.min(1.0, (dt - 700) / 300d); double textAlpha = dt < 850 ? 0 : Math.min(1.0, (dt - 850) / 300d); GL11.glColor4d(1, 1, 1, 1);/*from w w w . j a va2 s. c o m*/ GL11.glPushMatrix(); GL11.glTranslated(18, 0, 0); rect(0, 0, 419, 115, 6, 22 * ratio); GL11.glColor4d(1, 1, 1, mAlpha); rect(0, 22, 419, 137, 118, 127); //draw each text final double y_step = 32; double y0 = 22; GL11.glColor4d(0.3, 0.3, 0.3, mAlpha); for (int i = 0; i < 4; ++i) { if (curSelection == i) { rect(-6, y0, 413, 233, 6, 31); GL11.glColor4d(0, 0, 0, mAlpha * 0.2); HudUtils.drawModalRect(0, y0, 118, 31); } GL11.glColor4d(0.3, 0.3, 0.3, mAlpha); drawText(ACLangs.presetPrefix() + (i + 1), 10, y0 + 8, 15); RenderUtils.loadTexture(ACClientProps.TEX_GUI_PRESET); y0 += y_step; } GL11.glPopMatrix(); }
From source file:cn.academy.core.client.render.ACModelBiped.java
License:Open Source License
@Override public void render(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7) { GL11.glPushMatrix();//from w ww.j av a 2 s . com { if (par1Entity == Minecraft.getMinecraft().thePlayer) { GL11.glPopMatrix(); return; } //System.out.println(DebugUtils.formatArray(par2, par3, par4, par5, par6, par7)); GL11.glTranslated(0, 1, 0); GL11.glRotated(180, 0, 1, 0); GL11.glRotated(90, 1, 0, 0); GL11.glRotated(180, 0, 1, 0); super.render(par1Entity, par2, par3, par4, par5, par6, par7); } GL11.glPopMatrix(); }
From source file:cn.academy.core.client.render.ray.RendererRayBaseSimple.java
License:GNU General Public License
@Override public void doRender(Entity ent, double x, double y, double z, float a, float b) { IRay ray = (IRay) ent;/*from w ww . j av a 2s . com*/ GL11.glPushMatrix(); double length = ray.getLength(); double fix = ray.getStartFix(); Vec3 vo; if (ray.needsViewOptimize()) vo = ViewOptimize.getFixVector(ray); else vo = vec(0, 0, 0); // Rotate fix vector to world coordinate vo.rotateAroundY(MathUtils.toRadians(270 - ent.rotationYaw)); Vec3 start = vec(0, 0, 0), end = add(start, multiply(new Motion3D(ent, true).getMotionVec(), length)); start = add(start, vo); x += start.xCoord; y += start.yCoord; z += start.zCoord; Vec3 delta = subtract(end, start); double dxzsq = delta.xCoord * delta.xCoord + delta.zCoord * delta.zCoord; double npitch = MathUtils.toDegrees(Math.atan2(delta.yCoord, Math.sqrt(dxzsq))); double nyaw = MathUtils.toDegrees(Math.atan2(delta.xCoord, delta.zCoord)); GL11.glTranslated(x, y, z); GL11.glRotated(-90 + nyaw, 0, 1, 0); GL11.glRotated(npitch, 0, 0, 1); GL11.glTranslated(fix, 0, 0); draw(ent, ray.getLength() - fix); GL11.glPopMatrix(); }
From source file:cn.academy.core.client.render.ray.RendererRayCylinder.java
License:GNU General Public License
@Override protected void draw(Entity entity, double len) { if (RenderUtils.isInShadowPass()) return;/* w w w . java2 s . com*/ GL11.glEnable(GL11.GL_BLEND); GL11.glPushMatrix(); IRay ray = (IRay) entity; //HACK: Store the previous alpha double oldA = color.a; color.a *= ray.getAlpha(); double width = this.width * ray.getWidth(); color.bind(); GL11.glDisable(GL11.GL_LIGHTING); GL11.glPushMatrix(); double offset = width * (1 - headFix); GL11.glTranslated(offset, 0, 0); GL11.glScaled(width * headFix, width, width); head.draw(shader); GL11.glPopMatrix(); //Draw the cylinder GL11.glPushMatrix(); GL11.glTranslated(width, 0, 0); GL11.glScaled(len - width, width, width); cylinder.draw(shader); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(len + width - offset, 0, 0); GL11.glScaled(-width * headFix, width, -width); head.draw(shader); GL11.glPopMatrix(); GL11.glPopMatrix(); color.a = oldA; GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_LIGHTING); GL11.glColor4d(1, 1, 1, 1); }
From source file:cn.academy.core.client.render.RenderEntityBlock.java
License:GNU General Public License
@Override public void doRender(Entity e, double x, double y, double z, float pt, float b) { EntityBlock entity = (EntityBlock) e; if (entity.block != null) { GL11.glPushMatrix();//from www. j a v a 2s.c o m { Tessellator tes = Tessellator.instance; tes.setColorOpaque_F(1.0F, 1.0F, 1.0F); renderBlocks.blockAccess = e.worldObj; { if (Minecraft.isAmbientOcclusionEnabled()) { GL11.glShadeModel(GL11.GL_SMOOTH); } else { GL11.glShadeModel(GL11.GL_FLAT); } RenderHelper.disableStandardItemLighting(); RenderUtils.loadTexture(TextureMap.locationBlocksTexture); //x += b * entity.motionX; //y += b * entity.motionY; //z += b * entity.motionZ; int ix = (int) entity.posX, iy = (int) entity.posY, iz = (int) entity.posZ; GL11.glTranslated(x, y, z); GL11.glRotatef(MathUtils.lerpf(entity.lastYaw, entity.yaw, pt), 0, 1, 0); GL11.glRotatef(MathUtils.lerpf(entity.lastPitch, entity.pitch, pt), 1, 0, 0); GL11.glTranslated(-ix - 0.5, -iy - 0.5, -iz - 0.5); tes.startDrawingQuads(); renderBlocks.renderBlockAllFaces(entity.block, ix, iy, iz); tes.setTranslation(0, 0, 0); tes.draw(); RenderHelper.enableStandardItemLighting(); } } GL11.glPopMatrix(); } if (entity.tileEntity != null) { entity.tileEntity.blockType = entity.block; TileEntitySpecialRenderer tesr = TileEntityRendererDispatcher.instance .getSpecialRenderer(entity.tileEntity); if (tesr != null) { try { tesr.renderTileEntityAt(entity.tileEntity, x - 0.5, y, z - 0.5, pt); } catch (Exception ex) { AcademyCraft.log.error("Error handling EntityBlock TE rendering: " + tesr.getClass()); ex.printStackTrace(); } } } }
From source file:cn.academy.core.client.render.SkillRenderDebug.java
License:Open Source License
@SideOnly(Side.CLIENT) @Override//from w w w . j av a 2 s . c o m public void renderSurroundings(EntityPlayer player, long time) { GL11.glPushMatrix(); { GL11.glTranslated(-.5, 0, -.5); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor4f(1, 1, 1, 0.3F); RenderUtils.drawCube(1, 1, 2); GL11.glDisable(GL11.GL_BLEND); } GL11.glPopMatrix(); }
From source file:cn.academy.core.client.render.SkillRenderManager.java
License:Open Source License
public static void renderThirdPerson(EntityLivingBase ent, ItemStack stack, ItemRenderType type) { if (type == ItemRenderType.EQUIPPED_FIRST_PERSON || !(ent instanceof EntityPlayer)) return;//from www .jav a2 s. c o m EntityPlayer player = (EntityPlayer) ent; Item item = stack.getItem(); Block block = Block.getBlockFromItem(stack.getItem()); GL11.glDepthFunc(GL11.GL_LEQUAL); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glPushMatrix(); { GL11.glColor4d(1, 0.6, 0.6, 0.55); if (stack.getItemSpriteNumber() == 0 && item instanceof ItemBlock) { //block render routine GL11.glTranslated(0, 0, 1.5); GL11.glScalef(2F, 2F, 2F); GL11.glRotated(45, 1, 0, 1); GL11.glRotated(45, 0, 1, 0); GL11.glRotated(180, 1, 0, 0); } else if (item.isFull3D()) { GL11.glTranslated(0.1, 0.8, -.4); GL11.glScalef(.8F, .8F, .8F); GL11.glRotated(45, 0, 0, -1); } else { GL11.glTranslated(-.3, 1.2, -.6); GL11.glRotatef(90, 1, 0, 0); GL11.glScalef(1.5F, 1.5F, 1.5F); } traverseHandRender(player, HandRenderType.EQUIPPED); } GL11.glPopMatrix(); }
From source file:cn.academy.core.client.render.SkillRenderManager.java
License:Open Source License
public static void renderFirstPerson() { //System.out.println("rfp"); GL11.glDepthFunc(GL11.GL_LEQUAL);//from w w w . j a v a2s . c om GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glPushMatrix(); { GL11.glTranslated(0.28, -0.55, -.9); GL11.glColor4d(1, 0.6, 0.6, 0.55); GL11.glScalef(0.66F, 0.66F, 0.66F); GL11.glRotatef(20, 1, 0, 0); //RenderUtils.loadTexture(ACClientProps.TEX_ARC_SHELL[0]); //RenderUtils.drawCube(1, 1, 1, false); traverseHandRender(Minecraft.getMinecraft().thePlayer, HandRenderType.FIRSTPERSON); //rpe.renderHandEffect(Minecraft.getMinecraft().thePlayer, null, HandRenderType.FIRSTPERSON); } GL11.glPopMatrix(); }
From source file:cn.academy.crafting.client.gui.GuiImagFusor.java
License:Open Source License
@Override protected void drawGuiContainerForegroundLayer(int x, int y) { GL11.glPushMatrix();// w w w . j a va2 s.c om //Notice: We used a hack to get rid of MC's offset and use absolute offset. GL11.glTranslated(-this.guiLeft, -this.guiTop, 0); Widget widget = gui.getTopWidget(x, y); if (widget != null) { String text = null; if (widget.getName().equals("progress_imag")) { text = tile.getEnergy() + "/" + tile.getMaxEnergy() + " IF"; } else if (widget.getName().equals("progress_proj")) { text = tile.getLiquidAmount() + "/" + tile.getTankSize() + " mB"; } if (text != null) { EnergyUIHelper.drawTextBox(text, x + 5, y + 2, 9); } } GL11.glPopMatrix(); }
From source file:cn.academy.crafting.client.render.block.RenderImagPhaseLiquid.java
License:GNU General Public License
@Override public void renderTileEntityAt(TileEntity te, double x, double y, double z, float w) { if (!(te.getBlockType() instanceof BlockFluidClassic)) return;// w w w . j ava2s. c o m BlockFluidClassic liq = (BlockFluidClassic) te.getBlockType(); double distSq = Minecraft.getMinecraft().thePlayer.getDistanceSq(te.xCoord + .5, te.yCoord + .5, te.zCoord + .5); double alpha = 1 / (1 + 0.2 * Math.pow(distSq, 0.5)); if (alpha < 1E-1) return; GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glPushMatrix(); GL11.glTranslated(x, y, z); GL11.glDepthMask(false); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glColor4d(1, 1, 1, alpha); //GL11.glColor4d(1, 1, 1, 1); RenderHelper.disableStandardItemLighting(); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.defaultTexUnit, 240f, 240f); double ht = 1.2 * Math.sqrt(rbf.getFluidHeightForRender(te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord, (BlockFluidBase) te.getBlockType())); GL11.glEnable(GL11.GL_BLEND); drawLayer(0, -0.3 * ht, 0.3, 0.2, 0.7); drawLayer(1, 0.35 * ht, 0.3, 0.05, 0.7); if (ht > 0.5) drawLayer(2, 0.7 * ht, 0.1, 0.25, 0.7); RenderHelper.enableStandardItemLighting(); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glDepthMask(true); GL11.glPopMatrix(); }