Exemplo n.º 1
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();
 }
Exemplo n.º 2
0
  public static void initPerspective(int width, int height, float zClose, float zFar) {
    fov = 55.0f;

    glEnable(GL_TEXTURE_2D);

    //		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);

    //		glEnable(GL_TEXTURE_2D);

    //		glEnable(GL_CULL_FACE);

    //		glShadeModel(GL_SMOOTH); // Enable Smooth Shading
    glClearDepth(1.0); // Depth Buffer Setup
    glEnable(GL_DEPTH_TEST); // Enables Depth Testing
    glDepthFunc(GL_LEQUAL); // The Type Of Depth Testing To Do

    glEnable(GL_CULL_FACE);
    glCullFace(GL_BACK);

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

    // Calculate The Aspect Ratio Of The Window
    gluPerspective(fov, (float) width / height, zClose, zFar);
    //		glOrtho(1, 1, 1, 1, -1, 1);
    glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix

    // Really Nice Perspective Calculations
    glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);

    glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); // GL_DECAL);
  }
Exemplo n.º 3
0
  public static void drawModel(Model m) {
    glFrontFace(GL_CCW);
    glCullFace(GL_BACK);
    glEnable(GL_CULL_FACE);

    glDepthFunc(GL_LEQUAL);
    glEnable(GL_DEPTH_TEST);

    for (Polygon p : m.mesh) {
      glBindTexture(GL_TEXTURE_2D, p.tex.id);

      glBegin(GL_TRIANGLES);
      {
        for (Vertex v : p.vertices) {
          glTexCoord2f(v.uv.x, v.uv.y);
          glNormal3f(v.norm.x, v.norm.y, v.norm.z);
          glVertex3f(v.pos.x, v.pos.y, v.pos.z);
        }
      }
      glEnd();
    }

    glDisable(GL_CULL_FACE);
    glDisable(GL_DEPTH_TEST);
  }
Exemplo n.º 4
0
  public void thing() {

    glFrontFace(GL_CW);
    glCullFace(GL_BACK);

    glEnable(GL_TEXTURE_2D);
    glEnable(GL_CULL_FACE);
    glEnable(GL_DEPTH_TEST);
    glActiveTexture(GL_TEXTURE0);

    GL11.glViewport(0, 0, window.getCanvas().getWidth(), window.getCanvas().getHeight());

    scene.init(this);
    // these variables are here purely for ease of reading
    // i could just pass in the lastTime and time into update.
    // delta is necessary to not see any Jumps if the framerates gets lower(if you have a framerate
    // of 60 and do something like move(5) it will move 5 units 60 times per seconds
    // while if you have 30 fps it would only update 30 times per second so if you do move(5 *
    // delta) it doesnt matter what fps you have the object will move the same distance;
    float lastTime = (float) System.nanoTime() / (float) 1000000000L;
    float delta = 0;

    while (running) {
      float time = (float) System.nanoTime() / (float) 1000000000L;
      delta = time - lastTime;
      update(delta);
      delta = 0;
      render();
      lastTime = time;
    }
    destroy();
  }
Exemplo n.º 5
0
  @Override
  protected void init() {
    initializeProgram();

    try {
      cylinderMesh = new Mesh("UnitCylinder.xml");
      planeMesh = new Mesh("LargePlane.xml");
    } catch (Exception exception) {
      exception.printStackTrace();
      System.exit(-1);
    }

    glEnable(GL_CULL_FACE);
    glCullFace(GL_BACK);
    glFrontFace(GL_CW);

    glEnable(GL_DEPTH_TEST);
    glDepthMask(true);
    glDepthFunc(GL_LEQUAL);
    glDepthRange(0.0f, 1.0f);
    glEnable(GL_DEPTH_CLAMP);

    projectionUniformBuffer = glGenBuffers();
    glBindBuffer(GL_UNIFORM_BUFFER, projectionUniformBuffer);
    glBufferData(GL_UNIFORM_BUFFER, ProjectionBlock.SIZE, GL_DYNAMIC_DRAW);

    // Bind the static buffers.
    glBindBufferRange(
        GL_UNIFORM_BUFFER, projectionBlockIndex, projectionUniformBuffer, 0, ProjectionBlock.SIZE);

    glBindBuffer(GL_UNIFORM_BUFFER, 0);
  }
      GL11.glTranslatef(0.0F, 1.0F, 0.0F);
      GL11.glRotatef(-f12 * f11 * 1.0F, 0.0F, 0.0F, 1.0F);
      GL11.glTranslatef(0.0F, -1.0F, 0.0F);
      this.Body.rotateAngleZ = 0.0F;

      
         GL11.glEnable(GL11.GL_CULL_FACE);
          f15 = f6 * (float)Math.PI * 2.0F;
          this.LeftArm.rotateAngleX = 0.125F - (float)Math.cos((double)f15) * 0.2F;
          this.LeftArm.rotateAngleY = 0.25F;
          this.LeftArm.rotateAngleZ = (float)(Math.sin((double)f15) + 0.125D) * 0.8F;
         // this.wingTip.rotateAngleZ = -((float)(Math.sin((double)(f15 + 2.0F)) + 0.5D)) * 0.75F;
         // this.rearLeg.rotateAngleX = 1.0F + f7 * 0.1F;
         // this.rearLegTip.rotateAngleX = 0.5F + f7 * 0.1F;
          this.RightFoot.rotateAngleX = 0.75F + f7 * 0.1F;
         //this.frontLeg.rotateAngleX = 1.3F + f7 * 0.1F;
         // this.frontLegTip.rotateAngleX = -0.5F - f7 * 0.1F;
          this.LeftFoot.rotateAngleX = 0.75F + f7 * 0.1F;
         // this.LeftArm.render(f5);
         // this.frontLeg.render(f5);
         // this.rearLeg.render(f5);
          GL11.glScalef(-1.0F, 1.0F, 1.0F);
          GL11.glRotatef(90F, 0.0F, 1.0F, 0.0F);

      GL11.glPopMatrix();
    GL11.glCullFace(GL11.GL_BACK);
      GL11.glDisable(GL11.GL_CULL_FACE);
      float f16 = -((float)Math.sin((double)(f6 * (float)Math.PI * 2.0F))) * 0.0F;
      f14 = f6 * (float)Math.PI * 2.0F;
      f8 = 10.0F;
      f9 = 60.0F;
      f10 = 0.0F;
      adouble = entitykirby.getMovementOffsets(11, this.partialTicks);

   
          /*adouble2 = entitykirby.getMovementOffsets(12, this.partialTicks);
          f16 = (float)((double)f16 + Math.sin((double)(0.45F + f14)) * 0.05000000074505806D);
          this.Body.rotateAngleY = (this.updateRotations(adouble2[0] - adouble[0]) * f11 + 180.0F) * (float)Math.PI / 180.0F;
          this.Body.rotateAngleX = f16 + (float)(adouble2[1] - adouble[1]) * (float)Math.PI / 180.0F * f11 * 5.0F;
          this.Body.rotateAngleZ = this.updateRotations(adouble2[0] - (double)f13) * (float)Math.PI / 180.0F * f11;
          this.Body.rotationPointY = f8;
          this.Body.rotationPointZ = f9;
          this.Body.rotationPointX = f10;*/
          f8 = (float)((double)f8 + Math.sin((double)this.Body.rotateAngleX) * 10.0D);
          f9 = (float)((double)f9 - Math.cos((double)this.Body.rotateAngleY) * Math.cos((double)this.Body.rotateAngleX) * 10.0D);
          f10 = (float)((double)f10 - Math.sin((double)this.Body.rotateAngleY) * Math.cos((double)this.Body.rotateAngleX) * 10.0D); 
          this.Body.render(f5);
          this.Face.render(f5);
          this.Back.render(f5);
          this.Left.render(f5);
          this.Right.render(f5);
          this.Top.render(f5);
          this.LeftArm.render(f5);
          this.RightArm.render(f5);
          this.LeftFoot.render(f5);
          this.RightFoot.render(f5);

      GL11.glPopMatrix();
      }
Exemplo n.º 7
0
 public void setUpLighting() {
   glShadeModel(GL_SMOOTH);
   glEnable(GL_DEPTH_TEST);
   glEnable(GL_LIGHTING);
   glEnable(GL_LIGHT0);
   glLightModel(GL_LIGHT_MODEL_AMBIENT, asFloatBuffer(new float[] {1.00f, 1.00f, 1.00f, 1f}));
   glLight(GL_LIGHT0, GL_POSITION, asFloatBuffer(new float[] {10000, 0, 0, 1}));
   glEnable(GL_CULL_FACE);
   glCullFace(GL_BACK);
   glEnable(GL_COLOR_MATERIAL);
   glColorMaterial(GL_FRONT, GL_DIFFUSE);
 }
Exemplo n.º 8
0
  /** R_SetupGL */
  void R_SetupGL() {

    //
    // set up viewport
    //
    // int x = (int) Math.floor(r_newrefdef.x * vid.width / vid.width);
    int x = r_newrefdef.x;
    // int x2 = (int) Math.ceil((r_newrefdef.x + r_newrefdef.width) * vid.width / vid.width);
    int x2 = r_newrefdef.x + r_newrefdef.width;
    // int y = (int) Math.floor(vid.height - r_newrefdef.y * vid.height / vid.height);
    int y = vid.height - r_newrefdef.y;
    // int y2 = (int) Math.ceil(vid.height - (r_newrefdef.y + r_newrefdef.height) * vid.height /
    // vid.height);
    int y2 = vid.height - (r_newrefdef.y + r_newrefdef.height);

    int w = x2 - x;
    int h = y - y2;

    GL11.glViewport(x, y2, w, h);

    //
    // set up projection matrix
    //
    float screenaspect = (float) r_newrefdef.width / r_newrefdef.height;
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadIdentity();
    MYgluPerspective(r_newrefdef.fov_y, screenaspect, 4, 4096);

    GL11.glCullFace(GL11.GL_FRONT);

    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glLoadIdentity();

    GL11.glRotatef(-90, 1, 0, 0); // put Z going up
    GL11.glRotatef(90, 0, 0, 1); // put Z going up
    GL11.glRotatef(-r_newrefdef.viewangles[2], 1, 0, 0);
    GL11.glRotatef(-r_newrefdef.viewangles[0], 0, 1, 0);
    GL11.glRotatef(-r_newrefdef.viewangles[1], 0, 0, 1);
    GL11.glTranslatef(-r_newrefdef.vieworg[0], -r_newrefdef.vieworg[1], -r_newrefdef.vieworg[2]);

    GL11.glGetFloat(GL11.GL_MODELVIEW_MATRIX, r_world_matrix);
    r_world_matrix.clear();

    //
    // set drawing parms
    //
    if (gl_cull.value != 0.0f) GL11.glEnable(GL11.GL_CULL_FACE);
    else GL11.glDisable(GL11.GL_CULL_FACE);

    GL11.glDisable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_ALPHA_TEST);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
  }
Exemplo n.º 9
0
  @Override
  public void initView() {
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadIdentity();
    GL11.glFrustum(-1.0, 1.0, -1.0, 1.0, 1.0, 40.0);
    GL11.glMatrixMode(GL11.GL_MODELVIEW);

    // GL11.glClearDepth(0.5f);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glCullFace(GL11.GL_BACK);
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
  }
Exemplo n.º 10
0
 private static void setUpLighting() {
   glShadeModel(GL_SMOOTH);
   glEnable(GL_DEPTH_TEST);
   glEnable(GL_LIGHTING);
   glEnable(GL_LIGHT0);
   glLightModel(
       GL_LIGHT_MODEL_AMBIENT,
       BufferTools.asFlippedFloatBuffer(new float[] {0.05f, 0.05f, 0.05f, 1f}));
   glLight(GL_LIGHT0, GL_POSITION, BufferTools.asFlippedFloatBuffer(new float[] {0, 0, 0, 1}));
   glEnable(GL_CULL_FACE);
   glCullFace(GL_BACK);
   glEnable(GL_COLOR_MATERIAL);
   glColorMaterial(GL_FRONT, GL_DIFFUSE);
 }
 private static void setUpStates() {
   glShadeModel(GL_SMOOTH);
   glEnable(GL_DEPTH_TEST);
   glEnable(GL_LIGHTING);
   glEnable(GL_LIGHT0);
   glLightModel(
       GL_LIGHT_MODEL_AMBIENT,
       BufferTools.asFlippedFloatBuffer(new float[] {0.05f, 0.05f, 0.05f, 1f}));
   glLight(GL_LIGHT0, GL_POSITION, BufferTools.asFlippedFloatBuffer(new float[] {0, 0, 0, 1}));
   glEnable(GL_CULL_FACE);
   glCullFace(GL_BACK);
   glEnable(GL_COLOR_MATERIAL);
   glColorMaterial(GL_FRONT, GL_DIFFUSE);
   glColor3f(0.4f, 0.27f, 0.17f);
   glMaterialf(GL_FRONT, GL_SHININESS, 10f);
   if (GLContext.getCapabilities().GL_ARB_depth_clamp) {
     glEnable(ARBDepthClamp.GL_DEPTH_CLAMP);
   }
 }
Exemplo n.º 12
0
  @Override
  public void init() throws IOException {
    super.init();

    screen.setTitle("MD2 Loader");

    createGameActions();

    glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    gluPerspective(45.0f, 800 / 600, 1.0f, 2000.0f);
    glMatrixMode(GL_MODELVIEW);
    glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);

    // Here, we turn on a lighting and enable lighting.  We don't need to
    // set anything else for lighting because we will just take the defaults.
    // We also want color, so we turn that on

    // Habilita Z-Buffer
    glEnable(GL_DEPTH_TEST);
    glEnable(GL_LIGHT0); // Turn on a light with defaults set
    glEnable(GL_LIGHTING); // Turn on lighting
    glEnable(GL_COLOR_MATERIAL); // Allow color

    // To make our model render somewhat faster, we do some front back culling.
    // It seems that Quake2 orders their polygons clock-wise.
    // Seleciona o modo de aplicação da textura
    glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, modo);
    glEnable(GL_CULL_FACE); // Turn culling on
    glCullFace(GL_FRONT);
    glEnable(GL_TEXTURE_2D);
    g_World.load(FILE_NAME);
    // g_LoadMd2.importMD2(g_World, "modelsd2/model8/head.md2", "modelsd2/model8/head.png");
    // g_LoadMd2.importMD2(g_World, "modelsd2/model8/throne.md2", "modelsd2/model8/throne.png");
  }
Exemplo n.º 13
0
  @Override
  public void setup() {
    // Viewport
    glViewport(0, 0, width, height);

    // Enable something else
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();

    // Enable three-dee
    glEnable(GL_DEPTH_TEST);

    // Enable textures
    glEnable(GL_TEXTURE_2D);

    // Blue sky
    glClearColor(93f / 255f, 155f / 255f, 217 / 255f, 0.0f);

    // Enable culling
    glEnable(GL_CULL_FACE);
    glCullFace(GL_BACK);

    // Allow alpha texturing (Does not enable it yet)
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

    // Enable vertex buffer objects
    glEnableClientState(GL_VERTEX_ARRAY);
    glEnableClientState(GL_NORMAL_ARRAY);
    glEnableClientState(GL_TEXTURE_COORD_ARRAY);

    TextureLib.loadDebugTexture();

    camera.setup();

    simpleSetup();
  }
Exemplo n.º 14
0
 public void glCullFace(int mode) {
   GL11.glCullFace(mode);
 }
Exemplo n.º 15
0
  private void a(float f) {
    if (i == null) {
      i = new kc[a[0].length()][a.length];
      for (int k = 0; k < i.length; k++) {
        for (int i1 = 0; i1 < i[k].length; i1++) i[k][i1] = new kc(this, k, i1);
      }
    }
    GL11.glMatrixMode(5889);
    GL11.glPushMatrix();
    GL11.glLoadIdentity();
    iy iy1 = new iy(b.c, b.d);
    int j1 = 120 * iy1.a;
    GLU.gluPerspective(70F, (float) b.c / (float) j1, 0.05F, 100F);
    GL11.glViewport(0, b.d - j1, b.c, j1);
    GL11.glMatrixMode(5888);
    GL11.glPushMatrix();
    GL11.glLoadIdentity();
    GL11.glDisable(2884);
    GL11.glCullFace(1029);
    GL11.glDepthMask(true);
    for (int k1 = 0; k1 < 3; k1++) {
      GL11.glPushMatrix();
      GL11.glTranslatef(0.4F, 0.6F, -12F);
      if (k1 == 0) {
        GL11.glClear(256);
        GL11.glTranslatef(0.0F, -0.4F, 0.0F);
        GL11.glScalef(0.98F, 1.0F, 1.0F);
        GL11.glEnable(3042);
        GL11.glBlendFunc(770, 771);
      }
      if (k1 == 1) {
        GL11.glDisable(3042);
        GL11.glClear(256);
      }
      if (k1 == 2) {
        GL11.glEnable(3042);
        GL11.glBlendFunc(768, 1);
      }
      GL11.glScalef(1.0F, -1F, 1.0F);
      GL11.glRotatef(15F, 1.0F, 0.0F, 0.0F);
      GL11.glScalef(0.89F, 1.0F, 0.4F);
      GL11.glTranslatef((float) (-a[0].length()) * 0.5F, (float) (-a.length) * 0.5F, 0.0F);
      GL11.glBindTexture(3553, b.n.a("/terrain.png"));
      if (k1 == 0) GL11.glBindTexture(3553, b.n.a("/title/black.png"));
      bc bc1 = new bc();
      for (int l1 = 0; l1 < a.length; l1++) {
        for (int i2 = 0; i2 < a[l1].length(); i2++) {
          char c = a[l1].charAt(i2);
          if (c == ' ') continue;
          GL11.glPushMatrix();
          kc kc1 = i[i2][l1];
          float f1 = (float) (kc1.b + (kc1.a - kc1.b) * (double) f);
          float f2 = 1.0F;
          float f3 = 1.0F;
          float f4 = 0.0F;
          if (k1 == 0) {
            f2 = f1 * 0.04F + 1.0F;
            f3 = 1.0F / f2;
            f1 = 0.0F;
          }
          GL11.glTranslatef(i2, l1, f1);
          GL11.glScalef(f2, f2, f2);
          GL11.glRotatef(f4, 0.0F, 1.0F, 0.0F);
          bc1.a(ly.u, f3);
          GL11.glPopMatrix();
        }
      }

      GL11.glPopMatrix();
    }

    GL11.glDisable(3042);
    GL11.glMatrixMode(5889);
    GL11.glPopMatrix();
    GL11.glMatrixMode(5888);
    GL11.glPopMatrix();
    GL11.glViewport(0, 0, b.c, b.d);
    GL11.glEnable(2884);
  }
Exemplo n.º 16
0
  public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
    GL11.glPushMatrix();
    EntityDragon entitydragon = (EntityDragon) entity;
    float f6 =
        entitydragon.field_40173_aw
            + (entitydragon.field_40172_ax - entitydragon.field_40173_aw) * field_40317_s;
    field_40313_c.rotateAngleX = (float) (Math.sin(f6 * 3.141593F * 2.0F) + 1.0D) * 0.2F;
    float f7 = (float) (Math.sin(f6 * 3.141593F * 2.0F - 1.0F) + 1.0D);
    f7 = (f7 * f7 * 1.0F + f7 * 2.0F) * 0.05F;
    GL11.glTranslatef(0.0F, f7 - 2.0F, -3F);
    GL11.glRotatef(f7 * 2.0F, 1.0F, 0.0F, 0.0F);
    float f8 = -30F;
    float f9 = 22F;
    float f10 = 0.0F;
    float f11 = 1.5F;
    double ad[] = entitydragon.func_40160_a(6, field_40317_s);
    float f12 =
        func_40307_a(
            entitydragon.func_40160_a(5, field_40317_s)[0]
                - entitydragon.func_40160_a(10, field_40317_s)[0]);
    float f13 =
        func_40307_a(entitydragon.func_40160_a(5, field_40317_s)[0] + (double) (f12 / 2.0F));
    f8 += 2.0F;
    float f14 = 0.0F;
    float f15 = f6 * 3.141593F * 2.0F;
    f8 = 20F;
    f9 = -12F;
    for (int i = 0; i < 5; i++) {
      double ad3[] = entitydragon.func_40160_a(5 - i, field_40317_s);
      f14 = (float) Math.cos((float) i * 0.45F + f15) * 0.15F;
      field_40312_b.rotateAngleY = ((func_40307_a(ad3[0] - ad[0]) * 3.141593F) / 180F) * f11;
      field_40312_b.rotateAngleX = f14 + (((float) (ad3[1] - ad[1]) * 3.141593F) / 180F) * f11 * 5F;
      field_40312_b.rotateAngleZ =
          ((-func_40307_a(ad3[0] - (double) f13) * 3.141593F) / 180F) * f11;
      field_40312_b.rotationPointY = f8;
      field_40312_b.rotationPointZ = f9;
      field_40312_b.rotationPointX = f10;
      f8 = (float) ((double) f8 + Math.sin(field_40312_b.rotateAngleX) * 10D);
      f9 =
          (float)
              ((double) f9
                  - Math.cos(field_40312_b.rotateAngleY)
                      * Math.cos(field_40312_b.rotateAngleX)
                      * 10D);
      f10 =
          (float)
              ((double) f10
                  - Math.sin(field_40312_b.rotateAngleY)
                      * Math.cos(field_40312_b.rotateAngleX)
                      * 10D);
      field_40312_b.render(f5);
    }

    field_40314_a.rotationPointY = f8;
    field_40314_a.rotationPointZ = f9;
    field_40314_a.rotationPointX = f10;
    double ad1[] = entitydragon.func_40160_a(0, field_40317_s);
    field_40314_a.rotateAngleY = ((func_40307_a(ad1[0] - ad[0]) * 3.141593F) / 180F) * 1.0F;
    field_40314_a.rotateAngleZ = ((-func_40307_a(ad1[0] - (double) f13) * 3.141593F) / 180F) * 1.0F;
    field_40314_a.render(f5);
    GL11.glPushMatrix();
    GL11.glTranslatef(0.0F, 1.0F, 0.0F);
    GL11.glRotatef(-f12 * f11 * 1.0F, 0.0F, 0.0F, 1.0F);
    GL11.glTranslatef(0.0F, -1F, 0.0F);
    field_40310_d.rotateAngleZ = 0.0F;
    field_40310_d.render(f5);
    for (int j = 0; j < 2; j++) {
      GL11.glEnable(2884 /*GL_CULL_FACE*/);
      float f16 = f6 * 3.141593F * 2.0F;
      field_40319_q.rotateAngleX = 0.125F - (float) Math.cos(f16) * 0.2F;
      field_40319_q.rotateAngleY = 0.25F;
      field_40319_q.rotateAngleZ = (float) (Math.sin(f16) + 0.125D) * 0.8F;
      field_40318_r.rotateAngleZ = -(float) (Math.sin(f16 + 2.0F) + 0.5D) * 0.75F;
      field_40311_e.rotateAngleX = 1.0F + f7 * 0.1F;
      field_40309_g.rotateAngleX = 0.5F + f7 * 0.1F;
      field_40316_o.rotateAngleX = 0.75F + f7 * 0.1F;
      field_40308_f.rotateAngleX = 1.3F + f7 * 0.1F;
      field_40315_n.rotateAngleX = -0.5F - f7 * 0.1F;
      field_40320_p.rotateAngleX = 0.75F + f7 * 0.1F;
      field_40319_q.render(f5);
      field_40308_f.render(f5);
      field_40311_e.render(f5);
      GL11.glScalef(-1F, 1.0F, 1.0F);
      if (j == 0) {
        GL11.glCullFace(1028 /*GL_FRONT*/);
      }
    }

    GL11.glPopMatrix();
    GL11.glCullFace(1029 /*GL_BACK*/);
    GL11.glDisable(2884 /*GL_CULL_FACE*/);
    f14 = -(float) Math.sin(f6 * 3.141593F * 2.0F) * 0.0F;
    f15 = f6 * 3.141593F * 2.0F;
    f8 = 10F;
    f9 = 60F;
    f10 = 0.0F;
    ad = entitydragon.func_40160_a(11, field_40317_s);
    for (int k = 0; k < 12; k++) {
      double ad2[] = entitydragon.func_40160_a(12 + k, field_40317_s);
      f14 = (float) ((double) f14 + Math.sin((float) k * 0.45F + f15) * 0.05000000074505806D);
      field_40312_b.rotateAngleY = ((func_40307_a(ad2[0] - ad[0]) * f11 + 180F) * 3.141593F) / 180F;
      field_40312_b.rotateAngleX = f14 + (((float) (ad2[1] - ad[1]) * 3.141593F) / 180F) * f11 * 5F;
      field_40312_b.rotateAngleZ = ((func_40307_a(ad2[0] - (double) f13) * 3.141593F) / 180F) * f11;
      field_40312_b.rotationPointY = f8;
      field_40312_b.rotationPointZ = f9;
      field_40312_b.rotationPointX = f10;
      f8 = (float) ((double) f8 + Math.sin(field_40312_b.rotateAngleX) * 10D);
      f9 =
          (float)
              ((double) f9
                  - Math.cos(field_40312_b.rotateAngleY)
                      * Math.cos(field_40312_b.rotateAngleX)
                      * 10D);
      f10 =
          (float)
              ((double) f10
                  - Math.sin(field_40312_b.rotateAngleY)
                      * Math.cos(field_40312_b.rotateAngleX)
                      * 10D);
      field_40312_b.render(f5);
    }

    GL11.glPopMatrix();
  }
Exemplo n.º 17
0
  /**
   * Draws the face with it's texture depending on which type or side it is. Normals should be added
   * here later as well.
   */
  public void draw() {
    if (texture != null) {
      // back
      if (type.equals("back")) {
        GL11.glPushMatrix();
        GL11.glCullFace(GL11.GL_BACK);
        if (texture != null) {
          GL11.glEnable(GL11.GL_TEXTURE_2D);
          texture.bind();
        }
        GL11.glBegin(GL11.GL_QUADS);

        GL11.glTexCoord2f(0, textureRepeat);
        GL11.glVertex3f(0, 0, 0);

        GL11.glTexCoord2f(textureRepeat, textureRepeat);
        GL11.glVertex3f(width, 0, 0);

        GL11.glTexCoord2f(textureRepeat, 0);
        GL11.glVertex3f(width, height, 0);

        GL11.glTexCoord2f(0, 0);
        GL11.glVertex3f(0, height, 0);

        GL11.glEnd();
        GL11.glPopMatrix();
      }

      // front
      if (type.equals("front")) {
        GL11.glPushMatrix();
        GL11.glCullFace(GL11.GL_FRONT);
        if (texture != null) {
          GL11.glEnable(GL11.GL_TEXTURE_2D);
          texture.bind();
        }
        GL11.glBegin(GL11.GL_QUADS);

        GL11.glTexCoord2f(0, textureRepeat);
        GL11.glVertex3f(0, 0, length);

        GL11.glTexCoord2f(textureRepeat, textureRepeat);
        GL11.glVertex3f(width, 0, length);

        GL11.glTexCoord2f(textureRepeat, 0);
        GL11.glVertex3f(width, height, length);

        GL11.glTexCoord2f(0, 0);
        GL11.glVertex3f(0, height, length);

        GL11.glEnd();
        GL11.glPopMatrix();
      }

      // left
      if (type.equals("left")) {
        GL11.glPushMatrix();
        GL11.glCullFace(GL11.GL_LEFT);
        if (texture != null) {
          GL11.glEnable(GL11.GL_TEXTURE_2D);
          texture.bind();
        }
        GL11.glBegin(GL11.GL_QUADS);

        GL11.glTexCoord2f(0, textureRepeat);
        GL11.glVertex3f(0, 0, 0);

        GL11.glTexCoord2f(textureRepeat, textureRepeat);
        GL11.glVertex3f(0, 0, length);

        GL11.glTexCoord2f(textureRepeat, 0);
        GL11.glVertex3f(0, height, length);

        GL11.glTexCoord2f(0, 0);
        GL11.glVertex3f(0, height, 0);

        GL11.glEnd();
        GL11.glPopMatrix();
      }

      // right
      if (type.equals("right")) {
        GL11.glPushMatrix();
        GL11.glCullFace(GL11.GL_RIGHT);
        if (texture != null) {
          GL11.glEnable(GL11.GL_TEXTURE_2D);
          texture.bind();
        }
        GL11.glBegin(GL11.GL_QUADS);

        GL11.glTexCoord2f(0, textureRepeat);
        GL11.glVertex3f(width, 0, 0);

        GL11.glTexCoord2f(textureRepeat, textureRepeat);
        GL11.glVertex3f(width, 0, length);

        GL11.glTexCoord2f(textureRepeat, 0);
        GL11.glVertex3f(width, height, length);

        GL11.glTexCoord2f(0, 0);
        GL11.glVertex3f(width, height, 0);

        GL11.glEnd();
        GL11.glPopMatrix();
      }

      // bottom
      if (type.equals("bottom")) {
        GL11.glPushMatrix();
        // GL11.glCullFace(GL11.GL_BOTTOM);
        if (texture != null) {
          GL11.glEnable(GL11.GL_TEXTURE_2D);
          texture.bind();
        }
        GL11.glBegin(GL11.GL_QUADS);

        GL11.glTexCoord2f(0, textureRepeat);
        GL11.glVertex3f(0, 0, length);

        GL11.glTexCoord2f(textureRepeat, textureRepeat);
        GL11.glVertex3f(width, 0, length);

        GL11.glTexCoord2f(textureRepeat, 0);
        GL11.glVertex3f(width, 0, 0);

        GL11.glTexCoord2f(0, 0);
        GL11.glVertex3f(0, 0, 0);

        GL11.glEnd();
        GL11.glPopMatrix();
      }

      // top
      if (type.equals("top")) {
        GL11.glPushMatrix();
        // GL11.glCullFace(GL11.GL_);
        if (texture != null) {
          GL11.glEnable(GL11.GL_TEXTURE_2D);
          texture.bind();
        }
        GL11.glBegin(GL11.GL_QUADS);

        GL11.glTexCoord2f(0, textureRepeat);
        GL11.glVertex3f(0, height, length);

        GL11.glTexCoord2f(textureRepeat, textureRepeat);
        GL11.glVertex3f(width, height, length);

        GL11.glTexCoord2f(textureRepeat, 0);
        GL11.glVertex3f(width, height, 0);

        GL11.glTexCoord2f(0, 0);
        GL11.glVertex3f(0, height, 0);

        GL11.glEnd();
        GL11.glPopMatrix();
      }
    }
  }
Exemplo n.º 18
0
  public void applyRenderState(RenderState state) {
    if (state.isWireframe() && !context.wireframe) {
      glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
      context.wireframe = true;
    } else if (!state.isWireframe() && context.wireframe) {
      glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
      context.wireframe = false;
    }

    if (state.isDepthTest() && !context.depthTestEnabled) {
      glEnable(GL_DEPTH_TEST);
      glDepthFunc(GL_LEQUAL);
      context.depthTestEnabled = true;
    } else if (!state.isDepthTest() && context.depthTestEnabled) {
      glDisable(GL_DEPTH_TEST);
      context.depthTestEnabled = false;
    }

    if (state.isAlphaTest()) {
      setFixedFuncBinding(FixedFuncBinding.AlphaTestFallOff, state.getAlphaFallOff());
    } else {
      setFixedFuncBinding(FixedFuncBinding.AlphaTestFallOff, 0f); // disable it
    }

    if (state.isDepthWrite() && !context.depthWriteEnabled) {
      glDepthMask(true);
      context.depthWriteEnabled = true;
    } else if (!state.isDepthWrite() && context.depthWriteEnabled) {
      glDepthMask(false);
      context.depthWriteEnabled = false;
    }

    if (state.isColorWrite() && !context.colorWriteEnabled) {
      glColorMask(true, true, true, true);
      context.colorWriteEnabled = true;
    } else if (!state.isColorWrite() && context.colorWriteEnabled) {
      glColorMask(false, false, false, false);
      context.colorWriteEnabled = false;
    }

    if (state.isPointSprite()) {
      logger.log(Level.WARNING, "Point Sprite unsupported!");
    }

    if (state.isPolyOffset()) {
      if (!context.polyOffsetEnabled) {
        glEnable(GL_POLYGON_OFFSET_FILL);
        glPolygonOffset(state.getPolyOffsetFactor(), state.getPolyOffsetUnits());
        context.polyOffsetEnabled = true;
        context.polyOffsetFactor = state.getPolyOffsetFactor();
        context.polyOffsetUnits = state.getPolyOffsetUnits();
      } else {
        if (state.getPolyOffsetFactor() != context.polyOffsetFactor
            || state.getPolyOffsetUnits() != context.polyOffsetUnits) {
          glPolygonOffset(state.getPolyOffsetFactor(), state.getPolyOffsetUnits());
          context.polyOffsetFactor = state.getPolyOffsetFactor();
          context.polyOffsetUnits = state.getPolyOffsetUnits();
        }
      }
    } else {
      if (context.polyOffsetEnabled) {
        glDisable(GL_POLYGON_OFFSET_FILL);
        context.polyOffsetEnabled = false;
        context.polyOffsetFactor = 0;
        context.polyOffsetUnits = 0;
      }
    }
    if (state.getFaceCullMode() != context.cullMode) {
      if (state.getFaceCullMode() == RenderState.FaceCullMode.Off) {
        glDisable(GL_CULL_FACE);
      } else {
        glEnable(GL_CULL_FACE);
      }

      switch (state.getFaceCullMode()) {
        case Off:
          break;
        case Back:
          glCullFace(GL_BACK);
          break;
        case Front:
          glCullFace(GL_FRONT);
          break;
        case FrontAndBack:
          glCullFace(GL_FRONT_AND_BACK);
          break;
        default:
          throw new UnsupportedOperationException(
              "Unrecognized face cull mode: " + state.getFaceCullMode());
      }

      context.cullMode = state.getFaceCullMode();
    }

    if (state.getBlendMode() != context.blendMode) {
      if (state.getBlendMode() == RenderState.BlendMode.Off) {
        glDisable(GL_BLEND);
      } else {
        glEnable(GL_BLEND);
        switch (state.getBlendMode()) {
          case Off:
            break;
          case Additive:
            glBlendFunc(GL_ONE, GL_ONE);
            break;
          case AlphaAdditive:
            glBlendFunc(GL_SRC_ALPHA, GL_ONE);
            break;
          case Color:
            glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_COLOR);
            break;
          case Alpha:
            glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
            break;
          case PremultAlpha:
            glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
            break;
          case Modulate:
            glBlendFunc(GL_DST_COLOR, GL_ZERO);
            break;
          case ModulateX2:
            glBlendFunc(GL_DST_COLOR, GL_SRC_COLOR);
            break;
          default:
            throw new UnsupportedOperationException(
                "Unrecognized blend mode: " + state.getBlendMode());
        }
      }

      context.blendMode = state.getBlendMode();
    }

    if (state.isStencilTest()) {
      throw new UnsupportedOperationException(
          "OpenGL 1.1 doesn't support two sided stencil operations.");
    }
  }
Exemplo n.º 19
0
  private void drawLogo(float f) {
    if (logoEffects == null) {
      logoEffects = new LogoEffectRandomizer[minecraftLogo[0].length()][minecraftLogo.length];
      for (int i = 0; i < logoEffects.length; i++) {
        for (int j = 0; j < logoEffects[i].length; j++) {
          logoEffects[i][j] = new LogoEffectRandomizer(this, i, j);
        }
      }
    }
    if (!panorama) {
      GL11.glEnable(GL11.GL_DEPTH_TEST);
    }
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glPushMatrix();
    GL11.glLoadIdentity();
    ScaledResolution scaledresolution =
        new ScaledResolution(mc.gameSettings, mc.displayWidth, mc.displayHeight);
    int k = 120 * scaledresolution.getScaleFactor();
    Project.gluPerspective(70F, (float) mc.displayWidth / (float) k, 0.05F, 100F);
    GL11.glViewport(0, mc.displayHeight - k, mc.displayWidth, k);
    GL11.glMatrixMode(5888 /*GL_MODELVIEW0_ARB*/);
    GL11.glPushMatrix();
    GL11.glLoadIdentity();
    GL11.glDisable(GL11.GL_CULL_FACE);
    GL11.glCullFace(GL11.GL_BACK);
    GL11.glDepthMask(true);
    RenderBlocks renderblocks = new RenderBlocks();
    for (int l = 0; l < 3; l++) {
      GL11.glPushMatrix();
      GL11.glTranslatef(0.4F, 0.6F, -13F);
      if (l == 0) {
        GL11.glClear(256);
        GL11.glTranslatef(0.0F, -0.4F, 0.0F);
        GL11.glScalef(0.98F, 1.0F, 1.0F);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(770, 771);
      }
      if (l == 1) {
        GL11.glDisable(GL11.GL_BLEND);
        GL11.glClear(256);
      }
      if (l == 2) {
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(768, 1);
      }
      GL11.glScalef(1.0F, -1F, 1.0F);
      GL11.glRotatef(15F, 1.0F, 0.0F, 0.0F);
      GL11.glScalef(0.89F, 1.0F, 0.4F);
      GL11.glTranslatef(
          (float) (-minecraftLogo[0].length()) * 0.5F,
          (float) (-minecraftLogo.length) * 0.5F,
          0.0F);
      mc.func_110434_K().func_110577_a(TextureMap.field_110575_b);
      if (l == 0) {
        mc.func_110434_K().func_110577_a(blackResource);
      }
      for (int i1 = 0; i1 < minecraftLogo.length; i1++) {
        for (int j1 = 0; j1 < minecraftLogo[i1].length(); j1++) {
          char c = minecraftLogo[i1].charAt(j1);
          if (i1 == 2 && ((double) updateCounter2 < 0.0001D)) {
            if (i1 == 2) {
              c = minecraftLogo[i1].charAt(j1 == 20 ? j1 - 1 : (j1 == 16 ? j1 + 1 : j1));
            }
          }
          if (c == ' ') {
            continue;
          }
          GL11.glPushMatrix();
          LogoEffectRandomizer logoeffectrandomizer = logoEffects[j1][i1];
          float f1 =
              (float)
                  (logoeffectrandomizer.field_1311_b
                      + (logoeffectrandomizer.field_1312_a - logoeffectrandomizer.field_1311_b)
                          * (double) f);
          float f2 = 1.0F;
          float f3 = 1.0F;
          float f4 = 0.0F;
          if (l == 0) {
            f2 = f1 * 0.04F + 1.0F;
            f3 = 1.0F / f2;
            f1 = 0.0F;
          }
          GL11.glTranslatef(j1, i1, f1);
          GL11.glScalef(f2, f2, f2);
          GL11.glRotatef(f4, 0.0F, 1.0F, 0.0F);
          renderMenuBlock(Block.stone, f3, renderblocks);
          GL11.glPopMatrix();
        }
      }

      GL11.glPopMatrix();
    }

    GL11.glDisable(GL11.GL_BLEND);
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glPopMatrix();
    GL11.glMatrixMode(5888 /*GL_MODELVIEW0_ARB*/);
    GL11.glPopMatrix();
    GL11.glViewport(0, 0, mc.displayWidth, mc.displayHeight);
    GL11.glEnable(GL11.GL_CULL_FACE);
  }
Exemplo n.º 20
0
  public static void main(String[] args) {
    Window window = new Window(1280, 720, "Test", false);
    double rotAngle = 0;
    double X = 0;
    Cube cube = new Cube(0, 0, 0, 1);
    Logger log = Logger.getInstance();
    Axis axis = new Axis(0, 10, 0, 50);

    window.drawOn3D();
    // Cullface
    glCullFace(GL_BACK);
    glEnable(GL_CULL_FACE);

    // depth
    glEnable(GL_DEPTH_TEST);

    //
    glClearDepth(1.0f);
    glDepthFunc(GL_LEQUAL);
    //
    glEnable(GL_LIGHT0);
    glEnable(GL_LIGHTING);

    while (!window.isCloseRequested()) {
      window.drawOn3D();
      // Clear the contents of the window (try disabling this and resizing the window � fun
      // guaranteed)
      glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

      // Polls the user input. This is very important, because it prevents your application from
      // becoming unresponsive
      glfwPollEvents();

      rotAngle = (glfwGetKey(window.getWindowID(), GLFW_KEY_RIGHT) == 1) ? rotAngle + 5 : rotAngle;
      rotAngle = (glfwGetKey(window.getWindowID(), GLFW_KEY_LEFT) == 1) ? rotAngle - 5 : rotAngle;

      X = (glfwGetKey(window.getWindowID(), GLFW_KEY_UP) == 1) ? X + .5 : X;
      X = (glfwGetKey(window.getWindowID(), GLFW_KEY_DOWN) == 1) ? X - .5 : X;

      log.debug("" + X);

      glPushMatrix();
      glTranslated(0, 0, -40 + X);
      //			glRotated(rotAngle, 0, 1, 0);

      axis.draw();
      glColor3d(0, 1, 1);
      glRotated(rotAngle, 0, 1, 0);
      cube.draw();
      glPopMatrix();

      window.drawOn2D();
      glPushMatrix();
      glColor3d(1, 1, 1);

      glBegin(GL_QUADS);
      glVertex2d(0, 0);
      glVertex2d(0, 100);
      glVertex2d(200, 100);
      glVertex2d(200, 0);
      glEnd();

      glPopMatrix();

      // Swaps the front and back framebuffers, this is a very technical process which you don't
      // necessarily
      // need to understand. You can simply see this method as updating the window contents.
      glfwSwapBuffers(window.getWindowID());
    }

    window.destroyWindow();
  }
Exemplo n.º 21
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());
   }
 }
  /** Sets the models various rotation angles then renders the model. */
  public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
    EntityKirby entitykirby = (EntityKirby) entity;
    if (entitykirby.isFlying) {
      GL11.glPushMatrix();

      float f6 =
          entitykirby.prevAnimTime
              + (entitykirby.animTime - entitykirby.prevAnimTime) * this.partialTicks;
      // this.jaw.rotateAngleX = (float)(Math.sin((double)(f6 * (float)Math.PI * 2.0F)) + 1.0D) *
      // 0.2F;
      float f7 = (float) (Math.sin((double) (f6 * (float) Math.PI * 2.0F - 1.0F)) + 1.0D);
      f7 = (f7 * f7 * 1.0F + f7 * 2.0F) * 0.05F;
      GL11.glTranslatef(0.0F, f7 - 2.0F, -3.0F);
      GL11.glRotatef(f7 * 2.0F, 1.0F, 0.0F, 0.0F);
      float f8 = -30.0F;
      float f10 = 0.0F;
      float f11 = 1.5F;
      double[] adouble = entitykirby.getMovementOffsets(6, this.partialTicks);
      float f12 =
          this.updateRotations(
              entitykirby.getMovementOffsets(5, this.partialTicks)[0]
                  - entitykirby.getMovementOffsets(10, this.partialTicks)[0]);
      float f13 =
          this.updateRotations(
              entitykirby.getMovementOffsets(5, this.partialTicks)[0] + (double) (f12 / 2.0F));
      f8 += 2.0F;
      float f14 = f6 * (float) Math.PI * 2.0F;
      f8 = 20.0F;
      float f9 = -12.0F;
      float f15;

      double[] adouble1 = entitykirby.getMovementOffsets(5, this.partialTicks);
      f15 = (float) Math.cos((double) (0.45F + f14)) * 0.15F;
      /*      this.Body.rotateAngleY = this.updateRotations(adouble1[0] - adouble[0]) * (float)Math.PI / 180.0F * f11;
      this.Body.rotateAngleX = f15 + (float)(adouble1[1] - adouble[1]) * (float)Math.PI / 180.0F * f11 * 5.0F;
      this.Body.rotateAngleZ = -this.updateRotations(adouble1[0] - (double)f13) * (float)Math.PI / 180.0F * f11;
      this.Body.rotationPointY = f8;
      this.Body.rotationPointZ = f9;
      this.Body.rotationPointX = f10;*/
      f8 = (float) ((double) f8 + Math.sin((double) this.Body.rotateAngleX) * 10.0D);
      f9 =
          (float)
              ((double) f9
                  - Math.cos((double) this.Body.rotateAngleY)
                      * Math.cos((double) this.Body.rotateAngleX)
                      * 10.0D);
      f10 =
          (float)
              ((double) f10
                  - Math.sin((double) this.Body.rotateAngleY)
                      * Math.cos((double) this.Body.rotateAngleX)
                      * 10.0D);
      // this.Body.render(f5);

      /*  double[] adouble2 = entitykirby.getMovementOffsets(0, this.partialTicks);

      this.Body.rotationPointY = f8;
       this.Body.rotationPointZ = f9;
       this.Body.rotationPointX = f10;

       this.Body.rotateAngleY = this.updateRotations(adouble2[0] - adouble[0]) * (float)Math.PI / 180.0F * 1.0F;
       this.Body.rotateAngleZ = -this.updateRotations(adouble2[0] - (double)f13) * (float)Math.PI / 180.0F * 1.0F;*/
      // this.Body.render(f5);
      GL11.glPushMatrix();
      GL11.glTranslatef(0.0F, 1.0F, 0.0F);
      GL11.glRotatef(-f12 * f11 * 1.0F, 0.0F, 0.0F, 1.0F);
      GL11.glTranslatef(0.0F, -1.0F, 0.0F);
      this.Body.rotateAngleZ = 0.0F;

      GL11.glEnable(GL11.GL_CULL_FACE);
      f15 = f6 * (float) Math.PI * 2.0F;
      this.LeftArm.rotateAngleX = 0.125F - (float) Math.cos((double) f15) * 0.2F;
      this.LeftArm.rotateAngleY = 0.25F;
      this.LeftArm.rotateAngleZ = (float) (Math.sin((double) f15) + 0.125D) * 0.8F;
      // this.wingTip.rotateAngleZ = -((float)(Math.sin((double)(f15 + 2.0F)) + 0.5D)) * 0.75F;
      // this.rearLeg.rotateAngleX = 1.0F + f7 * 0.1F;
      // this.rearLegTip.rotateAngleX = 0.5F + f7 * 0.1F;
      this.RightFoot.rotateAngleX = 0.75F + f7 * 0.1F;
      // this.frontLeg.rotateAngleX = 1.3F + f7 * 0.1F;
      // this.frontLegTip.rotateAngleX = -0.5F - f7 * 0.1F;
      this.LeftFoot.rotateAngleX = 0.75F + f7 * 0.1F;
      // this.LeftArm.render(f5);
      // this.frontLeg.render(f5);
      // this.rearLeg.render(f5);
      GL11.glScalef(-1.0F, 1.0F, 1.0F);
      GL11.glRotatef(90F, 0.0F, 1.0F, 0.0F);

      GL11.glPopMatrix();
      GL11.glCullFace(GL11.GL_BACK);
      GL11.glDisable(GL11.GL_CULL_FACE);
      float f16 = -((float) Math.sin((double) (f6 * (float) Math.PI * 2.0F))) * 0.0F;
      f14 = f6 * (float) Math.PI * 2.0F;
      f8 = 10.0F;
      f9 = 60.0F;
      f10 = 0.0F;
      adouble = entitykirby.getMovementOffsets(11, this.partialTicks);

      /*adouble2 = entitykirby.getMovementOffsets(12, this.partialTicks);
      f16 = (float)((double)f16 + Math.sin((double)(0.45F + f14)) * 0.05000000074505806D);
      this.Body.rotateAngleY = (this.updateRotations(adouble2[0] - adouble[0]) * f11 + 180.0F) * (float)Math.PI / 180.0F;
      this.Body.rotateAngleX = f16 + (float)(adouble2[1] - adouble[1]) * (float)Math.PI / 180.0F * f11 * 5.0F;
      this.Body.rotateAngleZ = this.updateRotations(adouble2[0] - (double)f13) * (float)Math.PI / 180.0F * f11;
      this.Body.rotationPointY = f8;
      this.Body.rotationPointZ = f9;
      this.Body.rotationPointX = f10;*/
      f8 = (float) ((double) f8 + Math.sin((double) this.Body.rotateAngleX) * 10.0D);
      f9 =
          (float)
              ((double) f9
                  - Math.cos((double) this.Body.rotateAngleY)
                      * Math.cos((double) this.Body.rotateAngleX)
                      * 10.0D);
      f10 =
          (float)
              ((double) f10
                  - Math.sin((double) this.Body.rotateAngleY)
                      * Math.cos((double) this.Body.rotateAngleX)
                      * 10.0D);
      this.Body.render(f5);
      this.Face.render(f5);
      this.Back.render(f5);
      this.Left.render(f5);
      this.Right.render(f5);
      this.Top.render(f5);
      this.LeftArm.render(f5);
      this.RightArm.render(f5);
      this.LeftFoot.render(f5);
      this.RightFoot.render(f5);

      GL11.glPopMatrix();
    } else {
      super.render(entity, f, f1, f2, f3, f4, f5);
      setRotationAngles(f, f1, f2, f3, f4, f5, entity);
      Body.render(f5);
      Face.render(f5);
      Back.render(f5);
      Left.render(f5);
      Right.render(f5);
      Top.render(f5);
      LeftArm.render(f5);
      RightArm.render(f5);
      LeftFoot.render(f5);
      RightFoot.render(f5);
    }
  }