/** Renders the dragon model. Called by renderModel. */
  protected void renderDragonModel(
      EntityDragonBoss par1EntityDragonBoss,
      float par2,
      float par3,
      float par4,
      float par5,
      float par6,
      float par7) {
    if (par1EntityDragonBoss.deathTicks > 0) {
      float f6 = par1EntityDragonBoss.deathTicks / 200.0F;
      GL11.glDepthFunc(GL11.GL_LEQUAL);
      GL11.glEnable(GL11.GL_ALPHA_TEST);
      GL11.glAlphaFunc(GL11.GL_GREATER, f6);
      bindTexture(field_110842_f);
      mainModel.render(par1EntityDragonBoss, par2, par3, par4, par5, par6, par7);
      GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
      GL11.glDepthFunc(GL11.GL_EQUAL);
    }

    bindEntityTexture(par1EntityDragonBoss);
    mainModel.render(par1EntityDragonBoss, par2, par3, par4, par5, par6, par7);

    if (par1EntityDragonBoss.hurtTime > 0) {
      GL11.glDepthFunc(GL11.GL_EQUAL);
      GL11.glDisable(GL11.GL_TEXTURE_2D);
      GL11.glEnable(GL11.GL_BLEND);
      GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
      GL11.glColor4f(1.0F, 0.0F, 0.0F, 0.5F);
      mainModel.render(par1EntityDragonBoss, par2, par3, par4, par5, par6, par7);
      GL11.glEnable(GL11.GL_TEXTURE_2D);
      GL11.glDisable(GL11.GL_BLEND);
      GL11.glDepthFunc(GL11.GL_LEQUAL);
    }
  }
  /** Renders the dragon model. Called by renderModel. */
  protected void renderDragonModel(
      EntityDragon par1EntityDragon,
      float par2,
      float par3,
      float par4,
      float par5,
      float par6,
      float par7) {
    if (par1EntityDragon.deathTicks > 0) {
      float f = (float) par1EntityDragon.deathTicks / 200F;
      GL11.glDepthFunc(GL11.GL_LEQUAL);
      GL11.glEnable(GL11.GL_ALPHA_TEST);
      GL11.glAlphaFunc(GL11.GL_GREATER, f);
      loadDownloadableImageTexture(par1EntityDragon.skinUrl, "/mob/enderdragon/shuffle.png");
      mainModel.render(par1EntityDragon, par2, par3, par4, par5, par6, par7);
      GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
      GL11.glDepthFunc(GL11.GL_EQUAL);
    }

    loadDownloadableImageTexture(par1EntityDragon.skinUrl, par1EntityDragon.getTexture());
    mainModel.render(par1EntityDragon, par2, par3, par4, par5, par6, par7);

    if (par1EntityDragon.hurtTime > 0) {
      GL11.glDepthFunc(GL11.GL_EQUAL);
      GL11.glDisable(GL11.GL_TEXTURE_2D);
      GL11.glEnable(GL11.GL_BLEND);
      GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
      GL11.glColor4f(1.0F, 0.0F, 0.0F, 0.5F);
      mainModel.render(par1EntityDragon, par2, par3, par4, par5, par6, par7);
      GL11.glEnable(GL11.GL_TEXTURE_2D);
      GL11.glDisable(GL11.GL_BLEND);
      GL11.glDepthFunc(GL11.GL_LEQUAL);
    }
  }
  @Override
  public void doRender(Entity entity, double x, double y, double z, float a, float b) {
    EntityRippleMark mark = (EntityRippleMark) entity;
    long dt = GameTimer.getTime() - mark.creationTime;

    GL11.glDisable(GL11.GL_CULL_FACE);
    GL11.glDisable(GL11.GL_DEPTH_TEST);
    GL11.glAlphaFunc(GL11.GL_GREATER, 0);
    GL11.glDepthMask(false);
    GL11.glPushMatrix();

    GL11.glTranslated(x, y, z);

    for (int i = 0; i < timeOffsets.length; ++i) {
      GL11.glPushMatrix();

      long mod = (dt - timeOffsets[i]) % CYCLE;
      float size = getSize(mod);

      GL11.glTranslatef(0, getHeight(mod), 0);
      GL11.glScalef(size, 1, size);
      material.color = mark.color.copy();
      material.color.a *= getAlpha(mod);
      mesh.draw(material);

      GL11.glPopMatrix();
    }

    GL11.glPopMatrix();
    GL11.glDepthMask(true);
    GL11.glAlphaFunc(GL11.GL_GEQUAL, 0.1f);
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
  }
  public void renderParticles(Entity entity, float f) {
    float f1 = ActiveRenderInfo.rotationX;
    float f2 = ActiveRenderInfo.rotationZ;
    float f3 = ActiveRenderInfo.rotationYZ;
    float f4 = ActiveRenderInfo.rotationXY;
    float f5 = ActiveRenderInfo.rotationXZ;
    EntityFX.interpPosX = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * (double) f;
    EntityFX.interpPosY = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * (double) f;
    EntityFX.interpPosZ = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * (double) f;

    for (int k = 0; k < fxes.length; ++k) {
      if (!this.fxes[k].isEmpty()) {
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        GL11.glDepthMask(false);
        GL11.glEnable(GL11.GL_BLEND);
        switch (k) {
          case 0:
            GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE);
            renderer.bindTexture(additiveTextureSheet);
            break;
        }

        GL11.glAlphaFunc(GL11.GL_GREATER, 0.003921569F);
        Tessellator tessellator = Tessellator.instance;
        tessellator.startDrawingQuads();

        for (int j = 0; j < this.fxes[k].size(); ++j) {
          final EntityFX entityfx = this.fxes[k].get(j);
          if (entityfx == null) continue;
          tessellator.setBrightness(entityfx.getBrightnessForRender(f));

          try {
            entityfx.renderParticle(tessellator, f, f1, f5, f2, f3, f4);
          } catch (Throwable throwable) {
            CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Rendering Particle");
            CrashReportCategory crashreportcategory =
                crashreport.makeCategory("Particle being rendered");
            crashreportcategory.addCrashSectionCallable("Particle", entityfx::toString);
            throw new ReportedException(crashreport);
          }
        }

        tessellator.draw();
        GL11.glDisable(GL11.GL_BLEND);
        GL11.glDepthMask(true);
        GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
      }
    }
  }
  /** Applies fixed function bindings from the context to OpenGL */
  private void applyFixedFuncBindings(boolean forLighting) {
    if (forLighting) {
      glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, context.shininess);
      setMaterialColor(GL_AMBIENT, context.ambient, ColorRGBA.DarkGray);
      setMaterialColor(GL_DIFFUSE, context.diffuse, ColorRGBA.White);
      setMaterialColor(GL_SPECULAR, context.specular, ColorRGBA.Black);

      if (context.useVertexColor) {
        glEnable(GL_COLOR_MATERIAL);
      } else {
        glDisable(GL_COLOR_MATERIAL);
      }
    } else {
      // Ignore other values as they have no effect when
      // GL_LIGHTING is disabled.
      ColorRGBA color = context.color;
      if (color != null) {
        glColor4f(color.r, color.g, color.b, color.a);
      } else {
        glColor4f(1, 1, 1, 1);
      }
    }
    if (context.alphaTestFallOff > 0f) {
      glEnable(GL_ALPHA_TEST);
      glAlphaFunc(GL_GREATER, context.alphaTestFallOff);
    } else {
      glDisable(GL_ALPHA_TEST);
    }
  }
Example #6
0
  public static void initOrtho(int width, int height) {
    glEnable(GL_TEXTURE_2D);

    glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);

    glEnable(GL_BLEND);
    //		glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    glBlendFunc(GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    //		glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE_MINUS_CONSTANT_COLOR);
    //		GL11.glDisable(GL_BLEND);
    //		GL11.glDepthMask(true);

    glEnable(GL_ALPHA_TEST);
    glAlphaFunc(GL_GREATER, 0.1f);

    glEnable(GL_DEPTH_TEST);
    glDepthFunc(GL_LEQUAL); // The Type Of Depth Testing To Do

    glViewport(0, 0, width, height);
    glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
    glLoadIdentity(); // Reset The Projection Matrix

    // Calculate The Aspect Ratio Of The Window
    glOrtho(0, width, 0, height, -99999, 99999);
    glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix

    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
  }
Example #7
0
 private void initGL() {
   try {
     Display.setDisplayMode(new DisplayMode(GS.FRAMEWIDTH, GS.FRAMEHEIGHT));
     Display.setFullscreen(true);
     Display.create();
     Display.setVSyncEnabled(true);
   } catch (LWJGLException e) {
     e.printStackTrace();
     Display.destroy();
     System.exit(1);
   }
   GL11.glEnable(GL11.GL_TEXTURE_2D);
   // GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
   GL11.glClearDepth(1.0f);
   // GL11.glEnable(GL11.GL_DEPTH_TEST);
   // GL11.glDepthFunc(GL11.GL_ADD); //Wenn nicht auskommentiert führt es zu Exception
   GL11.glMatrixMode(GL11.GL_PROJECTION);
   GL11.glViewport(0, 0, GS.FRAMEWIDTH, GS.FRAMEHEIGHT);
   GL11.glOrtho(0, GS.FRAMEWIDTH, GS.FRAMEHEIGHT, 0, 0, 128);
   GL11.glEnable(GL11.GL_BLEND);
   GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
   // GL11.glBlendEquation( BLENDING_EQUATIONS[blendingEquationIndex]);
   GL11.glShadeModel(GL11.GL_FLAT);
   GL11.glMatrixMode(GL11.GL_MODELVIEW);
   GL11.glEnable(GL11.GL_ALPHA_TEST);
   GL11.glAlphaFunc(GL11.GL_GREATER, 0);
   GL11.glCullFace(GL11.GL_BACK);
   glEnable(GL_CULL_FACE);
   glCullFace(GL_BACK);
   GL11.glLoadIdentity();
 }
 @Override
 protected void renderGeometry(Camera camera) {
   SceneGraph.clientInstance.getPglWrapper().doLighting();
   if (Entity.effectLight != null) Entity.effectLight.disable();
   GL11.glEnable(GL11.GL_BLEND);
   GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
   GL11.glAlphaFunc(GL11.GL_GREATER, 0.1f);
   GL11.glEnable(GL11.GL_ALPHA_TEST);
   SceneGraph.clientInstance.renderscene();
   GL11.glDisable(GL11.GL_BLEND);
   GL11.glDisable(GL11.GL_ALPHA_TEST);
 }
Example #9
0
  /**
   * @see org.newdawn.slick.Game#render(org.newdawn.slick.GameContainer, org.newdawn.slick.Graphics)
   */
  @Override
  public void render(GameContainer container, Graphics g) throws SlickException {
    String text = "abc";
    font.drawString(610, 100, text);

    GL11.glDisable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    GL11.glAlphaFunc(GL11.GL_GEQUAL, 0.5f);
    font.drawString(610, 150, text);
    GL11.glDisable(GL11.GL_ALPHA_TEST);
    GL11.glEnable(GL11.GL_BLEND);

    g.translate(-50, -130);
    g.scale(10, 10);
    font.drawString(0, 0, text);

    GL11.glDisable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    GL11.glAlphaFunc(GL11.GL_GEQUAL, 0.5f);
    font.drawString(0, 26, text);
    GL11.glDisable(GL11.GL_ALPHA_TEST);
    GL11.glEnable(GL11.GL_BLEND);

    g.resetTransform();
    g.setColor(Color.lightGray);
    g.drawString("Original Size on Sheet", 620, 210);
    g.drawString("10x Scale Up", 40, 575);

    g.setColor(Color.darkGray);
    g.drawRect(40, 40, 560, 530);
    g.drawRect(610, 105, 150, 100);

    g.setColor(Color.white);
    g.drawString("512x512 Font Sheet", 620, 300);
    g.drawString("NEHE Charset", 620, 320);
    g.drawString("4096x4096 (8x) Source Image", 620, 340);
    g.drawString("ScanSize = 20", 620, 360);
  }
Example #10
0
 public static void initOpenGL() {
   GLPrep.resizedRefresh();
   GL11.glEnable(GL11.GL_ALPHA_TEST); // allows alpha channels or
   // transperancy
   GL11.glAlphaFunc(GL11.GL_GREATER, 0.1f); // set alpha aceptance
   GL11.glEnable(GL11.GL_COLOR_MATERIAL);
   GL11.glDisable(GL11.GL_DITHER);
   GL11.glShadeModel(GL11.GL_SMOOTH); // smooth shading
   GL11.glClearDepth(1.0); // Enables Clearing Of The Depth Buffer
   GL11.glDepthMask(true); // turn on depth mask
   GL11.glEnable(GL11.GL_DEPTH_TEST); // Enables Depth Testing
   GL11.glDepthFunc(GL11.GL_ALWAYS); // The Type Of Depth Test To Do
   GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST);
   GL11.glEnable(GL11.GL_TEXTURE_2D); // enable 2d textures
   RenderManager.registerRenders();
 }
  public static void dispatch() {
    Profiler profiler = ClientUtils.mc().mcProfiler;
    profiler.startSection(ImmersiveEngineering.MODID + "-particles");

    boolean isLightingEnabled = GL11.glGetBoolean(GL11.GL_LIGHTING);
    GL11.glDepthMask(false);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_LIGHTING);

    for (String key : EntityFXIEBase.queuedRenders.keySet()) {
      profiler.endStartSection(key);
      int i = 0;
      ClientUtils.tes().startDrawingQuads();
      for (EntityFXIEBase particle : EntityFXIEBase.queuedRenders.get(key)) {
        if ((i++) == 0)
          ClientUtils.mc().getTextureManager().bindTexture(particle.getParticleTexture());
        particle.tessellateFromQueue(ClientUtils.tes());
      }
      ClientUtils.tes().draw();
    }
    EntityFXIEBase.queuedRenders.clear();

    profiler.startSection("depthIgnoring");
    GL11.glDisable(GL11.GL_DEPTH_TEST);
    for (String key : EntityFXIEBase.queuedDepthIgnoringRenders.keySet()) {
      profiler.endStartSection(key);
      int i = 0;
      ClientUtils.tes().startDrawingQuads();
      for (EntityFXIEBase particle : EntityFXIEBase.queuedDepthIgnoringRenders.get(key)) {
        if ((i++) == 0)
          ClientUtils.mc().getTextureManager().bindTexture(particle.getParticleTexture());
        particle.tessellateFromQueue(ClientUtils.tes());
      }
      ClientUtils.tes().draw();
    }
    EntityFXIEBase.queuedDepthIgnoringRenders.clear();
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    profiler.endSection();

    if (!isLightingEnabled) GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glDepthMask(true);

    profiler.endSection();
  }
Example #12
0
 private void loadScreen() throws LWJGLException {
   ScaledResolution scaledresolution =
       new ScaledResolution(gameSettings, displayWidth, displayHeight);
   GL11.glClear(16640);
   GL11.glMatrixMode(5889 /*GL_PROJECTION*/);
   GL11.glLoadIdentity();
   GL11.glOrtho(
       0.0D, scaledresolution.field_25121_a, scaledresolution.field_25120_b, 0.0D, 1000D, 3000D);
   GL11.glMatrixMode(5888 /*GL_MODELVIEW0_ARB*/);
   GL11.glLoadIdentity();
   GL11.glTranslatef(0.0F, 0.0F, -2000F);
   GL11.glViewport(0, 0, displayWidth, displayHeight);
   GL11.glClearColor(0.0F, 0.0F, 0.0F, 0.0F);
   Tessellator tessellator = Tessellator.instance;
   GL11.glDisable(2896 /*GL_LIGHTING*/);
   GL11.glEnable(3553 /*GL_TEXTURE_2D*/);
   GL11.glDisable(2912 /*GL_FOG*/);
   GL11.glBindTexture(3553 /*GL_TEXTURE_2D*/, renderEngine.getTexture("/title/mojang.png"));
   tessellator.startDrawingQuads();
   tessellator.setColorOpaque_I(0xffffff);
   tessellator.addVertexWithUV(0.0D, displayHeight, 0.0D, 0.0D, 0.0D);
   tessellator.addVertexWithUV(displayWidth, displayHeight, 0.0D, 0.0D, 0.0D);
   tessellator.addVertexWithUV(displayWidth, 0.0D, 0.0D, 0.0D, 0.0D);
   tessellator.addVertexWithUV(0.0D, 0.0D, 0.0D, 0.0D, 0.0D);
   tessellator.draw();
   char c = '\u0100';
   char c1 = '\u0100';
   GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
   tessellator.setColorOpaque_I(0xffffff);
   func_6274_a(
       (scaledresolution.getScaledWidth() - c) / 2,
       (scaledresolution.getScaledHeight() - c1) / 2,
       0,
       0,
       c,
       c1);
   GL11.glDisable(2896 /*GL_LIGHTING*/);
   GL11.glDisable(2912 /*GL_FOG*/);
   GL11.glEnable(3008 /*GL_ALPHA_TEST*/);
   GL11.glAlphaFunc(516, 0.1F);
   Display.swapBuffers();
 }
  private void renderBeam(Tessellator tess, TileParticleGenerator tile, float f) {
    int x = 0;
    int y = 0;
    int z = 0;
    double length = tile.beam_length;
    float red = (float) tile.beam_red / 255F;
    float green = (float) tile.beam_green / 255F;
    float blue = (float) tile.beam_blue / 255F;

    GL11.glPushMatrix();
    GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);

    bindTexture(beamTexture);
    GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, 10497.0F);
    GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, 10497.0F);
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glDisable(GL11.GL_CULL_FACE);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glDepthMask(true);
    OpenGlHelper.glBlendFunc(770, 1, 1, 0);

    // float time = (float)tile.getWorldObj().getTotalWorldTime() + f;
    float time = tile.rotation + f;
    float upMot = -time * 0.2F - (float) MathHelper.floor_float(-time * 0.1F);
    float rotValue = tile.beam_rotation * (tile.rotation + f * 0.5F);
    double rotation = rotValue;

    tess.startDrawingQuads();
    tess.setBrightness(200);
    tess.setColorRGBA(tile.beam_red, tile.beam_green, tile.beam_blue, 32);

    double scale = (double) tile.beam_scale * 0.2D;
    double d7 = 0.5D + Math.cos(rotation + 2.356194490192345D) * scale; // x point 1
    double d9 = 0.5D + Math.sin(rotation + 2.356194490192345D) * scale; // z point 1
    double d11 = 0.5D + Math.cos(rotation + (Math.PI / 4D)) * scale; // x point 2
    double d13 = 0.5D + Math.sin(rotation + (Math.PI / 4D)) * scale; // z point 2
    double d15 = 0.5D + Math.cos(rotation + 3.9269908169872414D) * scale; // Dist from x-3
    double d17 = 0.5D + Math.sin(rotation + 3.9269908169872414D) * scale;
    double d19 = 0.5D + Math.cos(rotation + 5.497787143782138D) * scale;
    double d21 = 0.5D + Math.sin(rotation + 5.497787143782138D) * scale;
    double height = (double) (length);
    double texXMin = 0.0D;
    double texXMax = 1.0D;
    double d28 = (double) (-1.0F + upMot);
    double texHeight = (double) (length) * (0.5D / scale) + d28;

    tess.addVertexWithUV(x + d7, y + height, z + d9, texXMax, texHeight);
    tess.addVertexWithUV(x + d7, y, z + d9, texXMax, d28);
    tess.addVertexWithUV(x + d11, y, z + d13, texXMin, d28);
    tess.addVertexWithUV(x + d11, y + height, z + d13, texXMin, texHeight);

    tess.addVertexWithUV(x + d19, y + height, z + d21, texXMax, texHeight);
    tess.addVertexWithUV(x + d19, y, z + d21, texXMax, d28);
    tess.addVertexWithUV(x + d15, y, z + d17, texXMin, d28);
    tess.addVertexWithUV(x + d15, y + height, z + d17, texXMin, texHeight);

    tess.addVertexWithUV(x + d11, y + height, z + d13, texXMax, texHeight);
    tess.addVertexWithUV(x + d11, y, z + d13, texXMax, d28);
    tess.addVertexWithUV(x + d19, y, z + d21, texXMin, d28);
    tess.addVertexWithUV(x + d19, y + height, z + d21, texXMin, texHeight);

    tess.addVertexWithUV(x + d15, y + height, z + d17, texXMax, texHeight);
    tess.addVertexWithUV(x + d15, y, z + d17, texXMax, d28);
    tess.addVertexWithUV(x + d7, y, z + d9, texXMin, d28);
    tess.addVertexWithUV(x + d7, y + height, z + d9, texXMin, texHeight);

    rotation += 0.77f;
    d7 = 0.5D + Math.cos(rotation + 2.356194490192345D) * scale;
    d9 = 0.5D + Math.sin(rotation + 2.356194490192345D) * scale;
    d11 = 0.5D + Math.cos(rotation + (Math.PI / 4D)) * scale;
    d13 = 0.5D + Math.sin(rotation + (Math.PI / 4D)) * scale;
    d15 = 0.5D + Math.cos(rotation + 3.9269908169872414D) * scale;
    d17 = 0.5D + Math.sin(rotation + 3.9269908169872414D) * scale;
    d19 = 0.5D + Math.cos(rotation + 5.497787143782138D) * scale;
    d21 = 0.5D + Math.sin(rotation + 5.497787143782138D) * scale;

    d28 = (-1F + (upMot * 1));
    texHeight = (double) (length) * (0.5D / scale) + d28;

    tess.setColorRGBA_F(red, green, blue, 1f);

    tess.addVertexWithUV(x + d7, y + height, z + d9, texXMax, texHeight);
    tess.addVertexWithUV(x + d7, y, z + d9, texXMax, d28);
    tess.addVertexWithUV(x + d11, y, z + d13, texXMin, d28);
    tess.addVertexWithUV(x + d11, y + height, z + d13, texXMin, texHeight);

    tess.addVertexWithUV(x + d19, y + height, z + d21, texXMax, texHeight);
    tess.addVertexWithUV(x + d19, y, z + d21, texXMax, d28);
    tess.addVertexWithUV(x + d15, y, z + d17, texXMin, d28);
    tess.addVertexWithUV(x + d15, y + height, z + d17, texXMin, texHeight);

    tess.addVertexWithUV(x + d11, y + height, z + d13, texXMax, texHeight);
    tess.addVertexWithUV(x + d11, y, z + d13, texXMax, d28);
    tess.addVertexWithUV(x + d19, y, z + d21, texXMin, d28);
    tess.addVertexWithUV(x + d19, y + height, z + d21, texXMin, texHeight);

    tess.addVertexWithUV(x + d15, y + height, z + d17, texXMax, texHeight);
    tess.addVertexWithUV(x + d15, y, z + d17, texXMax, d28);
    tess.addVertexWithUV(x + d7, y, z + d9, texXMin, d28);
    tess.addVertexWithUV(x + d7, y + height, z + d9, texXMin, texHeight);

    tess.draw();
    GL11.glPushMatrix();

    // GL11.glTranslated(0, 0.4, 0);
    // length -= 0.5F;

    GL11.glEnable(GL11.GL_BLEND);
    OpenGlHelper.glBlendFunc(770, 771, 1, 0);
    GL11.glDepthMask(false);
    GL11.glTranslated(0.5, 0, 0.5);
    GL11.glScalef(tile.beam_scale, 1f, tile.beam_scale);
    GL11.glTranslated(-0.5, -0, -0.5);
    tess.startDrawingQuads();
    tess.setColorRGBA(tile.beam_red, tile.beam_green, tile.beam_blue, 32);
    double d30 = 0.2D;
    double d4 = 0.2D;
    double d6 = 0.8D;
    double d8 = 0.2D;
    double d10 = 0.2D;
    double d12 = 0.8D;
    double d14 = 0.8D;
    double d16 = 0.8D;
    double d18 = (double) (length);
    double d20 = 0.0D;
    double d22 = 1D;
    double d24 = (double) (-1.0F + upMot);
    double d26 = (double) (length) + d24;
    tess.addVertexWithUV(x + d30, y + d18, z + d4, d22, d26);
    tess.addVertexWithUV(x + d30, y, z + d4, d22, d24);
    tess.addVertexWithUV(x + d6, y, z + d8, d20, d24);
    tess.addVertexWithUV(x + d6, y + d18, z + d8, d20, d26);
    tess.addVertexWithUV(x + d14, y + d18, z + d16, d22, d26);
    tess.addVertexWithUV(x + d14, y, z + d16, d22, d24);
    tess.addVertexWithUV(x + d10, y, z + d12, d20, d24);
    tess.addVertexWithUV(x + d10, y + d18, z + d12, d20, d26);
    tess.addVertexWithUV(x + d6, y + d18, z + d8, d22, d26);
    tess.addVertexWithUV(x + d6, y, z + d8, d22, d24);
    tess.addVertexWithUV(x + d14, y, z + d16, d20, d24);
    tess.addVertexWithUV(x + d14, y + d18, z + d16, d20, d26);
    tess.addVertexWithUV(x + d10, y + d18, z + d12, d22, d26);
    tess.addVertexWithUV(x + d10, y, z + d12, d22, d24);
    tess.addVertexWithUV(x + d30, y, z + d4, d20, d24);
    tess.addVertexWithUV(x + d30, y + d18, z + d4, d20, d26);
    tess.draw();
    GL11.glPopMatrix();

    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glDepthMask(true);
    //
    //		GL11.glEnable(GL11.GL_LIGHTING);
    //		GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glPopMatrix();
  }
Example #14
0
  public void render(final Camera cam) {

    boolean sortChunks = false;

    Vector3 camPos = cam.getPosition();
    boolean camInNewChunk = true;
    if (lastPos != null) {
      camInNewChunk =
          (lastPos.getXI() / 16) != (camPos.getXI() / 16)
              || (lastPos.getYI() / 16) != (camPos.getYI() / 16)
              || (lastPos.getZI() / 16) != (camPos.getZI() / 16);
    }
    if (camInNewChunk) {
      sortChunks = true;
    }
    lastPos = cam.getPosition();

    GL11.glEnable(GL11.GL_ALPHA_TEST);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glAlphaFunc(GL11.GL_NOTEQUAL, 0);

    class CompareChunk implements Comparator<Chunk> {

      @Override
      public int compare(Chunk a, Chunk b) {
        Vector3 camPos = cam.getPosition();
        double distA =
            MathUtils.distSq(a.x, a.y, a.z, camPos.getXF(), camPos.getYF(), camPos.getZF());
        double distB =
            MathUtils.distSq(b.x, b.y, b.z, camPos.getXF(), camPos.getYF(), camPos.getZF());
        if (distA < distB) {
          return -1;
        } else if (distA > distB) {
          return 1;
        } else {
          return 0;
        }
      }
    }

    if (sortChunks) {
      Collections.sort(renderList, new CompareChunk());
    }

    for (Chunk chunk : renderList) {
      Vector3 chunkToCam = chunk.getPositionCenter().sub(camPos);

      if (chunkToCam.getLengthSq()
          < Math.pow(Main.renderDist + Chunk.xSize, 2)) { // if chunk is within renderdistance
        Vector3 toCam1 = chunk.getPositionCorner(0, 0, 0).sub(camPos);
        Vector3 toCam2 = chunk.getPositionCorner(0, 0, 1).sub(camPos);
        Vector3 toCam3 = chunk.getPositionCorner(0, 1, 0).sub(camPos);
        Vector3 toCam4 = chunk.getPositionCorner(0, 1, 1).sub(camPos);
        Vector3 toCam5 = chunk.getPositionCorner(1, 0, 0).sub(camPos);
        Vector3 toCam6 = chunk.getPositionCorner(1, 0, 1).sub(camPos);
        Vector3 toCam7 = chunk.getPositionCorner(1, 1, 0).sub(camPos);
        Vector3 toCam8 = chunk.getPositionCorner(1, 1, 1).sub(camPos);

        toCam1.normalize();
        toCam2.normalize();
        toCam3.normalize();
        toCam4.normalize();
        toCam5.normalize();
        toCam6.normalize();
        toCam7.normalize();
        toCam8.normalize();

        Vector3 camVec = cam.getLookat().sub(cam.getPosition());
        camVec.normalize();

        double dot1 = toCam1.dot(camVec);
        double dot2 = toCam2.dot(camVec);
        double dot3 = toCam3.dot(camVec);
        double dot4 = toCam4.dot(camVec);
        double dot5 = toCam5.dot(camVec);
        double dot6 = toCam6.dot(camVec);
        double dot7 = toCam7.dot(camVec);
        double dot8 = toCam8.dot(camVec);

        if (dot1 > 0 || dot2 > 0 || dot3 > 0 || dot4 > 0 || dot5 > 0 || dot6 > 0 || dot7 > 0
            || dot8 > 0) { // if chunk is not behind camera
          GL11.glPushMatrix();
          GL11.glTranslatef(chunk.x * Chunk.xSize, chunk.y * Chunk.ySize, chunk.z * Chunk.zSize);
          chunk.render();
          GL11.glPopMatrix();
        }
      }
    }
  }
Example #15
0
 public void startGame() throws LWJGLException {
   if (mcCanvas != null) {
     Graphics g = mcCanvas.getGraphics();
     if (g != null) {
       g.setColor(Color.BLACK);
       g.fillRect(0, 0, displayWidth, displayHeight);
       g.dispose();
     }
     Display.setParent(mcCanvas);
   } else if (fullscreen) {
     Display.setFullscreen(true);
     displayWidth = Display.getDisplayMode().getWidth();
     displayHeight = Display.getDisplayMode().getHeight();
     if (displayWidth <= 0) {
       displayWidth = 1;
     }
     if (displayHeight <= 0) {
       displayHeight = 1;
     }
   } else {
     Display.setDisplayMode(new DisplayMode(displayWidth, displayHeight));
   }
   Display.setTitle("Minecraft Minecraft Beta 1.7.3");
   try {
     Display.create();
   } catch (LWJGLException lwjglexception) {
     lwjglexception.printStackTrace();
     try {
       Thread.sleep(1000L);
     } catch (InterruptedException interruptedexception) {
     }
     Display.create();
   }
   mcDataDir = getMinecraftDir();
   saveLoader = new SaveConverterMcRegion(new File(mcDataDir, "saves"));
   gameSettings = new GameSettings(this, mcDataDir);
   texturePackList = new TexturePackList(this, mcDataDir);
   renderEngine = new RenderEngine(texturePackList, gameSettings);
   fontRenderer = new FontRenderer(gameSettings, "/font/default.png", renderEngine);
   ColorizerWater.func_28182_a(renderEngine.func_28149_a("/misc/watercolor.png"));
   ColorizerGrass.func_28181_a(renderEngine.func_28149_a("/misc/grasscolor.png"));
   ColorizerFoliage.func_28152_a(renderEngine.func_28149_a("/misc/foliagecolor.png"));
   entityRenderer = new EntityRenderer(this);
   RenderManager.instance.itemRenderer = new ItemRenderer(this);
   statFileWriter = new StatFileWriter(session, mcDataDir);
   AchievementList.openInventory.setStatStringFormatter(new StatStringFormatKeyInv(this));
   loadScreen();
   Keyboard.create();
   Mouse.create();
   mouseHelper = new MouseHelper(mcCanvas);
   try {
     Controllers.create();
   } catch (Exception exception) {
     exception.printStackTrace();
   }
   checkGLError("Pre startup");
   GL11.glEnable(3553 /*GL_TEXTURE_2D*/);
   GL11.glShadeModel(7425 /*GL_SMOOTH*/);
   GL11.glClearDepth(1.0D);
   GL11.glEnable(2929 /*GL_DEPTH_TEST*/);
   GL11.glDepthFunc(515);
   GL11.glEnable(3008 /*GL_ALPHA_TEST*/);
   GL11.glAlphaFunc(516, 0.1F);
   GL11.glCullFace(1029 /*GL_BACK*/);
   GL11.glMatrixMode(5889 /*GL_PROJECTION*/);
   GL11.glLoadIdentity();
   GL11.glMatrixMode(5888 /*GL_MODELVIEW0_ARB*/);
   checkGLError("Startup");
   glCapabilities = new OpenGlCapsChecker();
   sndManager.loadSoundSettings(gameSettings);
   renderEngine.registerTextureFX(textureLavaFX);
   renderEngine.registerTextureFX(textureWaterFX);
   renderEngine.registerTextureFX(new TexturePortalFX());
   renderEngine.registerTextureFX(new TextureCompassFX(this));
   renderEngine.registerTextureFX(new TextureWatchFX(this));
   renderEngine.registerTextureFX(new TextureWaterFlowFX());
   renderEngine.registerTextureFX(new TextureLavaFlowFX());
   renderEngine.registerTextureFX(new TextureFlamesFX(0));
   renderEngine.registerTextureFX(new TextureFlamesFX(1));
   renderGlobal = new RenderGlobal(this, renderEngine);
   GL11.glViewport(0, 0, displayWidth, displayHeight);
   effectRenderer = new EffectRenderer(theWorld, renderEngine);
   try {
     downloadResourcesThread = new ThreadDownloadResources(mcDataDir, this);
     downloadResourcesThread.start();
   } catch (Exception exception1) {
   }
   checkGLError("Post startup");
   ingameGUI = new GuiIngame(this);
   if (serverName != null) {
     displayGuiScreen(new GuiConnecting(this, serverName, serverPort));
   } else {
     displayGuiScreen(new GuiMainMenu());
   }
 }
  @Override
  public void renderItem(final ItemRenderType type, final ItemStack item, final Object... data) {
    if (item == null) {
      return;
    }

    GL11.glPushMatrix();
    GL11.glPushAttrib(GL11.GL_ENABLE_BIT | GL11.GL_COLOR_BUFFER_BIT);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL11.GL_LIGHTING);

    if (AEConfig.instance.isFeatureEnabled(AEFeature.AlphaPass)
        && item.getItem() instanceof IAlphaPassItem
        && ((IAlphaPassItem) item.getItem()).useAlphaPass(item)) {
      GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
      GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
      GL11.glDisable(GL11.GL_ALPHA_TEST);
      GL11.glEnable(GL11.GL_BLEND);
    } else {
      GL11.glAlphaFunc(GL11.GL_GREATER, 0.4f);
      GL11.glEnable(GL11.GL_ALPHA_TEST);
      GL11.glDisable(GL11.GL_BLEND);
    }

    if (type == ItemRenderType.EQUIPPED_FIRST_PERSON) {
      GL11.glTranslatef(-0.2f, -0.1f, -0.3f);
    }

    if (type == ItemRenderType.ENTITY) {
      GL11.glRotatef(90.0f, 0.0f, 1.0f, 0.0f);
      GL11.glScalef(0.8f, 0.8f, 0.8f);
      GL11.glTranslatef(-0.8f, -0.87f, -0.7f);
    }

    if (type == ItemRenderType.INVENTORY) {
      GL11.glTranslatef(0.0f, -0.1f, 0.0f);
    }

    GL11.glTranslated(0.2, 0.3, 0.1);
    GL11.glScaled(1.2, 1.2, 1.);

    GL11.glColor4f(1, 1, 1, 1);
    Tessellator.instance.setColorOpaque_F(1, 1, 1);
    Tessellator.instance.setBrightness(14 << 20 | 14 << 4);

    BusRenderHelper.INSTANCE.setBounds(0, 0, 0, 1, 1, 1);
    BusRenderHelper.INSTANCE.setTexture(null);
    BusRenderHelper.INSTANCE.setInvColor(0xffffff);
    this.getRenderer().blockAccess = ClientHelper.proxy.getWorld();

    BusRenderHelper.INSTANCE.setOrientation(
        ForgeDirection.EAST, ForgeDirection.UP, ForgeDirection.SOUTH);

    this.getRenderer().uvRotateBottom =
        this.getRenderer().uvRotateEast =
            this.getRenderer().uvRotateNorth =
                this.getRenderer().uvRotateSouth =
                    this.getRenderer().uvRotateTop = this.getRenderer().uvRotateWest = 0;
    this.getRenderer().useInventoryTint = false;
    this.getRenderer().overrideBlockTexture = null;

    if (item.getItem() instanceof IFacadeItem) {
      final IFacadeItem fi = (IFacadeItem) item.getItem();
      final IFacadePart fp = fi.createPartFromItemStack(item, ForgeDirection.SOUTH);

      if (type == ItemRenderType.EQUIPPED_FIRST_PERSON) {
        GL11.glRotatef(160.0f, 0.0f, 1.0f, 0.0f);
        GL11.glTranslated(-0.4, 0.1, -1.6);
      }

      if (fp != null) {
        fp.renderInventory(BusRenderHelper.INSTANCE, this.getRenderer());
      }
    } else {
      final IPart ip = this.getRenderer(item, (IPartItem) item.getItem());

      if (ip != null) {
        if (type == ItemRenderType.ENTITY) {
          final int depth = ip.cableConnectionRenderTo();
          GL11.glTranslatef(0.0f, 0.0f, -0.04f * (8 - depth) - 0.06f);
        }

        ip.renderInventory(BusRenderHelper.INSTANCE, this.getRenderer());
      }
    }

    this.getRenderer().uvRotateBottom =
        this.getRenderer().uvRotateEast =
            this.getRenderer().uvRotateNorth =
                this.getRenderer().uvRotateSouth =
                    this.getRenderer().uvRotateTop = this.getRenderer().uvRotateWest = 0;

    GL11.glPopAttrib();
    GL11.glPopMatrix();
  }
Example #17
0
  @Override
  public void drawScreen(int mouseX, int mouseY, float par3) {
    if (DEBUG_RENDERING) {
      renderTimes[renderTimesIndex++] = System.currentTimeMillis();
      if (renderTimesIndex == renderTimes.length) {
        renderTimesIndex = 0;
        double elapsed = 0;
        for (int i = 0; i < renderTimes.length - 1; i++) {
          elapsed += renderTimes[i + 1] - renderTimes[i];
        }
        System.out.printf("GuiAtlas avg. render time: %.3f\n", elapsed / renderTimes.length);
      }
    }

    GL11.glColor4f(1, 1, 1, 1);
    GL11.glAlphaFunc(GL11.GL_GREATER, 0); // So light detail on tiles is visible
    AtlasRenderHelper.drawFullTexture(Textures.BOOK, getGuiX(), getGuiY(), WIDTH, HEIGHT);

    if (stack == null || biomeData == null) return;

    if (state.is(DELETING_MARKER)) {
      GL11.glColor4f(1, 1, 1, 0.5f);
    }
    GL11.glEnable(GL11.GL_SCISSOR_TEST);
    GL11.glScissor(
        (getGuiX() + CONTENT_X) * screenScale,
        mc.displayHeight - (getGuiY() + CONTENT_Y + MAP_HEIGHT) * screenScale,
        MAP_WIDTH * screenScale,
        MAP_HEIGHT * screenScale);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    // Find chunk coordinates of the top left corner of the map.
    // The 'roundToBase' is required so that when the map scales below the
    // threshold the tiles don't change when map position changes slightly.
    // The +-2 at the end provide margin so that tiles at the edges of
    // the page have their stitched texture correct.
    int mapStartX =
        MathUtil.roundToBase(
            (int)
                Math.floor(
                    -((double) MAP_WIDTH / 2d + mapOffsetX + 2 * tileHalfSize) / mapScale / 16d),
            tile2ChunkScale);
    int mapStartZ =
        MathUtil.roundToBase(
            (int)
                Math.floor(
                    -((double) MAP_HEIGHT / 2d + mapOffsetY + 2 * tileHalfSize) / mapScale / 16d),
            tile2ChunkScale);
    int mapEndX =
        MathUtil.roundToBase(
            (int)
                Math.ceil(
                    ((double) MAP_WIDTH / 2d - mapOffsetX + 2 * tileHalfSize) / mapScale / 16d),
            tile2ChunkScale);
    int mapEndZ =
        MathUtil.roundToBase(
            (int)
                Math.ceil(
                    ((double) MAP_HEIGHT / 2d - mapOffsetY + 2 * tileHalfSize) / mapScale / 16d),
            tile2ChunkScale);
    int mapStartScreenX = getGuiX() + WIDTH / 2 + (int) ((mapStartX << 4) * mapScale) + mapOffsetX;
    int mapStartScreenY = getGuiY() + HEIGHT / 2 + (int) ((mapStartZ << 4) * mapScale) + mapOffsetY;

    TileRenderIterator iter = new TileRenderIterator(biomeData);
    iter.setScope(
        new Rect().setOrigin(mapStartX, mapStartZ).set(mapStartX, mapStartZ, mapEndX, mapEndZ));
    iter.setStep(tile2ChunkScale);
    while (iter.hasNext()) {
      SubTileQuartet subtiles = iter.next();
      for (SubTile subtile : subtiles) {
        if (subtile == null || subtile.tile == null) continue;
        AtlasRenderHelper.drawAutotileCorner(
            BiomeTextureMap.instance().getTexture(subtile.tile),
            mapStartScreenX + subtile.x * tileHalfSize,
            mapStartScreenY + subtile.y * tileHalfSize,
            subtile.getTextureU(),
            subtile.getTextureV(),
            tileHalfSize);
      }
    }

    if (!state.is(HIDING_MARKERS)) {
      int markersStartX =
          MathUtil.roundToBase(mapStartX, MarkersData.CHUNK_STEP) / MarkersData.CHUNK_STEP - 1;
      int markersStartZ =
          MathUtil.roundToBase(mapStartZ, MarkersData.CHUNK_STEP) / MarkersData.CHUNK_STEP - 1;
      int markersEndX =
          MathUtil.roundToBase(mapEndX, MarkersData.CHUNK_STEP) / MarkersData.CHUNK_STEP + 1;
      int markersEndZ =
          MathUtil.roundToBase(mapEndZ, MarkersData.CHUNK_STEP) / MarkersData.CHUNK_STEP + 1;
      double iconScale = getIconScale();

      // Draw global markers:
      for (int x = markersStartX; x <= markersEndX; x++) {
        for (int z = markersStartZ; z <= markersEndZ; z++) {
          List<Marker> markers = globalMarkersData.getMarkersAtChunk(x, z);
          if (markers == null) continue;
          for (Marker marker : markers) {
            renderMarker(marker, iconScale);
          }
        }
      }

      // Draw local markers:
      if (localMarkersData != null) {
        for (int x = markersStartX; x <= markersEndX; x++) {
          for (int z = markersStartZ; z <= markersEndZ; z++) {
            List<Marker> markers = localMarkersData.getMarkersAtChunk(x, z);
            if (markers == null) continue;
            for (Marker marker : markers) {
              renderMarker(marker, iconScale);
            }
          }
        }
      }
    }

    GL11.glDisable(GL11.GL_SCISSOR_TEST);

    // Overlay the frame so that edges of the map are smooth:
    GL11.glColor4f(1, 1, 1, 1);
    AtlasRenderHelper.drawFullTexture(Textures.BOOK_FRAME, getGuiX(), getGuiY(), WIDTH, HEIGHT);
    double iconScale = getIconScale();

    // Draw player icon:
    if (!state.is(HIDING_MARKERS)) {
      // How much the player has moved from the top left corner of the map, in pixels:
      int playerOffsetX = (int) (player.posX * mapScale) + mapOffsetX;
      int playerOffsetZ = (int) (player.posZ * mapScale) + mapOffsetY;
      if (playerOffsetX < -MAP_WIDTH / 2) playerOffsetX = -MAP_WIDTH / 2;
      if (playerOffsetX > MAP_WIDTH / 2) playerOffsetX = MAP_WIDTH / 2;
      if (playerOffsetZ < -MAP_HEIGHT / 2) playerOffsetZ = -MAP_HEIGHT / 2;
      if (playerOffsetZ > MAP_HEIGHT / 2 - 2) playerOffsetZ = MAP_HEIGHT / 2 - 2;
      // Draw the icon:
      GL11.glColor4f(1, 1, 1, state.is(PLACING_MARKER) ? 0.5f : 1);
      GL11.glPushMatrix();
      GL11.glTranslated(
          getGuiX() + WIDTH / 2 + playerOffsetX, getGuiY() + HEIGHT / 2 + playerOffsetZ, 0);
      float playerRotation =
          (float) Math.round(player.rotationYaw / 360f * PLAYER_ROTATION_STEPS)
              / PLAYER_ROTATION_STEPS
              * 360f;
      GL11.glRotatef(180 + playerRotation, 0, 0, 1);
      GL11.glTranslated(-PLAYER_ICON_WIDTH / 2 * iconScale, -PLAYER_ICON_HEIGHT / 2 * iconScale, 0);
      AtlasRenderHelper.drawFullTexture(
          Textures.PLAYER,
          0,
          0,
          (int) Math.round(PLAYER_ICON_WIDTH * iconScale),
          (int) Math.round(PLAYER_ICON_HEIGHT * iconScale));
      GL11.glPopMatrix();
      GL11.glColor4f(1, 1, 1, 1);
    }

    // Draw buttons:
    super.drawScreen(mouseX, mouseY, par3);

    // Draw the semi-transparent marker attached to the cursor when placing a new marker:
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    if (state.is(PLACING_MARKER)) {
      GL11.glColor4f(1, 1, 1, 0.5f);
      AtlasRenderHelper.drawFullTexture(
          MarkerTextureMap.instance().getTexture(markerFinalizer.selectedType),
          mouseX - MARKER_SIZE / 2 * iconScale,
          mouseY - MARKER_SIZE / 2 * iconScale,
          (int) Math.round(MARKER_SIZE * iconScale),
          (int) Math.round(MARKER_SIZE * iconScale));
      GL11.glColor4f(1, 1, 1, 1);
    }

    // Draw progress overlay:
    if (state.is(EXPORTING_IMAGE)) {
      drawDefaultBackground();
      progressBar.draw((width - 100) / 2, height / 2 - 34);
    }
  }
Example #18
0
  public static void drawLine(
      double x,
      double y,
      double x2,
      double y2,
      float r,
      float g,
      float b,
      float te,
      boolean wiggle) {
    float count =
        FMLClientHandler.instance().getClient().thePlayer.ticksExisted
            + new Random().nextFloat()
            + te;

    Tessellator var12 = Tessellator.instance;

    GL11.glPushMatrix();
    GL11.glAlphaFunc(516, 0.003921569F);
    GL11.glDisable(3553);
    GL11.glEnable(3042);
    GL11.glBlendFunc(770, 771);

    double d3 = x - x2;
    double d4 = y - y2;
    float dist = MathHelper.sqrt_double(d3 * d3 + d4 * d4);
    int inc = (int) (dist / 2.0F);
    float dx = (float) (d3 / inc);
    float dy = (float) (d4 / inc);
    if (Math.abs(d3) > Math.abs(d4)) {
      dx *= 2.0F;
    } else {
      dy *= 2.0F;
    }
    GL11.glLineWidth(3.0F);
    GL11.glEnable(2848);
    GL11.glHint(3154, 4354);

    var12.startDrawing(3);
    for (int a = 0; a <= inc; a++) {
      float r2 = r;
      float g2 = g;
      float b2 = b;
      float mx = 0.0F;
      float my = 0.0F;
      float op = 0.6F;
      if (wiggle) {
        float phase = a / inc;
        mx = MathHelper.sin((count + a) / 7.0F) * 5.0F * (1.0F - phase);
        my = MathHelper.sin((count + a) / 5.0F) * 5.0F * (1.0F - phase);
        r2 *= (1.0F - phase);
        g2 *= (1.0F - phase);
        b2 *= (1.0F - phase);
        op *= phase;
      }
      var12.setColorRGBA_F(r2, g2, b2, op);

      var12.addVertex(x - dx * a + mx, y - dy * a + my, 0.0D);
      if (Math.abs(d3) > Math.abs(d4)) {
        dx *= (1.0F - 1.0F / (inc * 3.0F / 2.0F));
      } else {
        dy *= (1.0F - 1.0F / (inc * 3.0F / 2.0F));
      }
    }
    var12.draw();

    GL11.glBlendFunc(770, 771);
    GL11.glDisable(2848);
    GL11.glDisable(3042);
    GL11.glDisable(32826);
    GL11.glEnable(3553);
    GL11.glAlphaFunc(516, 0.1F);
    GL11.glPopMatrix();
  }
Example #19
0
  @SubscribeEvent
  public void eventRenderWorld(RenderWorldLastEvent e) {

    if (delay < 0 && Keyboard.isKeyDown(56) && Keyboard.isKeyDown(57) && Keyboard.isKeyDown(29)) {
      delay = 15;
      this.enabled = !this.enabled;
    }
    delay--;
    if (!this.enabled) return;
    i++;
    if (i > 1000) {
      i = 0;
      System.out.println("Saving Snitch List");
      Config.saveConfig();
    }
    PlayerInteractHandler.timer++;
    try { // Should put this is method yolo
      for (Coordinate c : SnitchField.instance.coordinateList) {
        // Render Snitch Range
        if (c.getDistance() > 81) continue;
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        GL11.glLineWidth(5F);
        GL11.glDisable(GL11.GL_LIGHTING);
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glEnable(GL11.GL_LINE_SMOOTH);
        GL11.glEnable(GL13.GL_MULTISAMPLE);
        GL11.glAlphaFunc(GL11.GL_GREATER, 0.09F);
        GL11.glDepthMask(false);

        GL11.glPushMatrix();
        double px = -(RenderManager.renderPosX - c.x);
        double py = -(RenderManager.renderPosY - c.y);
        double pz = -(RenderManager.renderPosZ - c.z);
        AxisAlignedBB bb =
            AxisAlignedBB.getBoundingBox(
                px - 10.55d, py - 10.55d, pz - 10.55d, px + 10.55d, py + 10.55d, pz + 10.55d);
        // odd choice because I just ripped this off squeenhowies esp
        int color = getColor(c.hoursToDate());
        if (c.hostile) {
          GL11.glColor4f(1F, 0.0F, 0.0F, 0.25F);
        } else {
          if (color == 0) {
            GL11.glColor4d(0F, 0.56F, 1.0F, 0.25F);
          } else if (color == 1) {
            GL11.glColor4d(0.11F, 0.91F, 0F, 0.25F); // Green
          } else if (color == 2) {
            GL11.glColor4d(0.88F, 0.83F, 0.0F, 0.25F); // Yellow
          } else if (color == 3) {
            GL11.glColor4d(0.75F, 0F, 0.91F, 0.25F);
          }
        }
        drawCrossedOutlinedBoundingBox(bb);
        if (c.hostile) {
          GL11.glColor4f(1F, 0.0F, 0.0F, 0.1F);
        } else {
          if (color == 0) {
            GL11.glColor4d(0F, 0.56F, 1.0F, 0.1F); // Blue
          } else if (color == 1) {
            GL11.glColor4d(0.11F, 0.91F, 0F, 0.1F); // Green
          } else if (color == 2) {
            GL11.glColor4d(0.88F, 0.83F, 0.0F, 0.1F); // Yellow
          } else if (color == 3) {
            GL11.glColor4d(0.75F, 0F, 0.91F, 0.1F); // Purple
          }
        }

        drawBoundingBoxQuads(bb);
        GL11.glPopMatrix();

        GL11.glDepthMask(true);
        GL11.glDisable(GL11.GL_LINE_SMOOTH);
        GL11.glDisable(GL11.GL_BLEND);
        GL11.glEnable(GL11.GL_TEXTURE_2D);
        GL11.glEnable(GL11.GL_DEPTH_TEST);
        GL11.glDisable(GL13.GL_MULTISAMPLE);
        GL11.glEnable(GL11.GL_LIGHTING);

        // Render snitch block
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        GL11.glLineWidth(5F);
        GL11.glDisable(GL11.GL_LIGHTING);
        GL11.glDisable(GL11.GL_DEPTH_TEST);
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glEnable(GL11.GL_LINE_SMOOTH);
        GL11.glEnable(GL13.GL_MULTISAMPLE);
        GL11.glAlphaFunc(GL11.GL_GREATER, 0.09F);
        GL11.glDepthMask(false);

        GL11.glPushMatrix();
        px = -(RenderManager.renderPosX - c.x);
        py = -(RenderManager.renderPosY - c.y);
        pz = -(RenderManager.renderPosZ - c.z);
        bb =
            AxisAlignedBB.getBoundingBox(
                px - 0.5d, py - 0.5d, pz - 0.5d, px + 0.5d, py + 0.5d, pz + 0.5d);
        bb.expand(0.05, 0.05, 0.05);
        // odd choice because I just ripped this off my hacked client's esp
        if (c.hostile) {
          GL11.glColor4f(1F, 0.0F, 0.0F, 0.25F);
        } else {
          if (color == 0) {
            GL11.glColor4d(0F, 0.56F, 1.0F, 0.25F);
          } else if (color == 1) {
            GL11.glColor4d(0.11F, 0.91F, 0F, 0.25F);
          } else if (color == 2) {
            GL11.glColor4d(0.88F, 0.83F, 0.0F, 0.25F); // Yellow
          } else if (color == 3) {
            GL11.glColor4d(0.75F, 0F, 0.91F, 0.25F);
          }
        }
        drawCrossedOutlinedBoundingBox(bb);
        if (c.hostile) {
          GL11.glColor4f(1F, 0.0F, 0.0F, 0.1F);
        } else {
          if (color == 0) {
            GL11.glColor4d(0F, 0.56F, 1.0F, 0.1F);
          } else if (color == 1) {
            GL11.glColor4d(0.11F, 0.91F, 0F, 0.1F);
          } else if (color == 2) {
            GL11.glColor4d(0.88F, 0.83F, 0.0F, 0.1F); // Yellow
          } else if (color == 3) {
            GL11.glColor4d(0.75F, 0F, 0.91F, 0.1F);
          }
        }
        drawBoundingBoxQuads(bb);
        GL11.glPopMatrix();

        GL11.glDepthMask(true);
        GL11.glDisable(GL11.GL_LINE_SMOOTH);
        GL11.glDisable(GL11.GL_BLEND);
        GL11.glEnable(GL11.GL_TEXTURE_2D);
        GL11.glEnable(GL11.GL_DEPTH_TEST);
        GL11.glDisable(GL13.GL_MULTISAMPLE);
        GL11.glEnable(GL11.GL_LIGHTING);
      }

      for (Coordinate c : SnitchField.instance.tempList) {
        // Render Snitch Range
        if (c.getDistance() > 81) continue;

        // Render snitch block
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        GL11.glLineWidth(5F);
        GL11.glDisable(GL11.GL_LIGHTING);
        GL11.glDisable(GL11.GL_DEPTH_TEST);
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glEnable(GL11.GL_LINE_SMOOTH);
        GL11.glEnable(GL13.GL_MULTISAMPLE);
        GL11.glAlphaFunc(GL11.GL_GREATER, 0.09F);
        GL11.glDepthMask(false);

        GL11.glPushMatrix();
        double px = -(RenderManager.renderPosX - c.x);
        double py = -(RenderManager.renderPosY - c.y);
        double pz = -(RenderManager.renderPosZ - c.z);
        AxisAlignedBB bb =
            AxisAlignedBB.getBoundingBox(
                px - 0.5d, py - 0.5d, pz - 0.5d, px + 0.5d, py + 0.5d, pz + 0.5d);
        bb.expand(0.05, 0.05, 0.05);
        // odd choice because I just ripped this off my hacked client's esp
        GL11.glColor4f(1F, 1F, 1F, 0.25F);
        drawCrossedOutlinedBoundingBox(bb);
        GL11.glColor4f(1F, 1F, 1F, 0.1F);
        drawBoundingBoxQuads(bb);
        GL11.glPopMatrix();

        GL11.glDepthMask(true);
        GL11.glDisable(GL11.GL_LINE_SMOOTH);
        GL11.glDisable(GL11.GL_BLEND);
        GL11.glEnable(GL11.GL_TEXTURE_2D);
        GL11.glEnable(GL11.GL_DEPTH_TEST);
        GL11.glDisable(GL13.GL_MULTISAMPLE);
        GL11.glEnable(GL11.GL_LIGHTING);
      }

    } catch (ConcurrentModificationException f) {

    }
  }