List of usage examples for org.lwjgl.opengl GL11 glPushMatrix
public static native void glPushMatrix();
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 w w.j a v a 2 s . c om*/ 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 . ja v a 2 s. c om*/ 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 w ww . j a v a 2 s . co 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.RenderVoid.java
License:Open Source License
public static final void renderHand(EntityPlayer player) { GL11.glDisable(GL11.GL_CULL_FACE);/*from w ww.jav a 2 s .c o m*/ GL11.glPushMatrix(); RenderUtils.renderEnchantGlint_Equip(); RenderUtils.loadTexture(steveTexture); GL11.glRotated(-23.75, 0.0F, 0.0F, 1.0F); GL11.glRotated(21.914, 0.0F, 1.0F, 0.0F); GL11.glRotated(32.75, 1.0F, 0.0F, 0.0F); GL11.glTranslatef(.758F, -.072F, -.402F); GL11.glColor3f(1.0F, 1.0F, 1.0F); model.onGround = 0.0F; model.setRotationAngles(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, player); model.bipedRightArm.render(0.0625F); GL11.glPopMatrix(); GL11.glEnable(GL11.GL_CULL_FACE); }
From source file:cn.academy.core.client.render.SkillRenderDebug.java
License:Open Source License
@SideOnly(Side.CLIENT) @Override//w w w .ja va 2 s .co 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 . j ava2 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 ww w .jav a 2 s . c o m 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.core.client.ui.NotifyUI.java
License:GNU General Public License
private static void drawIcon(INotification notf, Vec3 p, double alpha) { GL11.glColor4d(1, 1, 1, alpha);// w w w . j a v a 2s.c o m GL11.glPushMatrix(); RenderUtils.glTranslate(p); RenderUtils.loadTexture(notf.getIcon()); HudUtils.rect(83, 83); 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(); //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;/*from w w w .jav a 2 s . co m*/ 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;/*from w w w . j a va 2 s.c om*/ 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(); }