Package k8

Examples of k8.k8


    this.top = (int) this.T[11] - HALFWIDTH;
    this.right = (int) this.T[3] + HALFWIDTH;
    this.bottom = (int) this.T[11] + HALFWIDTH;
   
    // Make a flat surface out of two Triangles
    Triangle triangle = new Triangle();
    triangle.setVertices(-Tile.HALFWIDTH , 0, Tile.HALFWIDTH,
        Tile.HALFWIDTH , 0, Tile.HALFWIDTH,
        Tile.HALFWIDTH, 0, -Tile.HALFWIDTH);
    triangle.setTexture(0, 1, 1, 1, 1, 0);
    triangle.setTexture(TileTexture.getInstance());
    this.add(triangle);

    triangle = new Triangle();
    triangle.setVertices(-Tile.HALFWIDTH, 0, Tile.HALFWIDTH,
        Tile.HALFWIDTH, 0, -Tile.HALFWIDTH,
        -Tile.HALFWIDTH, 0, -Tile.HALFWIDTH);
    triangle.setTexture(0, 1, 1, 0, 0, 0);
    triangle.setTexture(TileTexture.getInstance());
    this.add(triangle);
   
    Client.logger.info("tile at " + this.T[3] + ", " + this.T[11] + " - " + Tile.HALFWIDTH);
  }
View Full Code Here


    // Set the text scaling proportional to width
    textScale = layer.getWidth() / 5000;

    // Position
    position = new Text();
    position.setScale(textScale);
    position.moveRight(layer.getWidth() / 2);
    position.moveUp(0.001f);
    layer.add(position);

    // FPS Counter
    fps = new Text();
    fps.setScale(textScale);
    fps.moveRight(0.001f);
    fps.moveUp(0.001f);
    layer.add(fps);
   
View Full Code Here

  }

  /** Sets the depth */
  public void setDepth(float depth)
  {
    Camera camera = Camera.getInstance();
    float aspect = camera.getAspectRatio();
    int fov = camera.getFOV();
   
    this.depth = depth;
    this.width = (float) (depth * (fov / RadDeg));
    this.height = width / aspect;

View Full Code Here

    int h = Texture.nearestPower(height);
    if (h > maxSize)
      h = maxSize;

    // Get current glPixelStore state
    PixelStoreState pss = new PixelStoreState();

    // set pixel packing
    GL11.glPixelStorei(GL11.GL_PACK_ROW_LENGTH, 0);
    GL11.glPixelStorei(GL11.GL_PACK_ALIGNMENT, 1);
    GL11.glPixelStorei(GL11.GL_PACK_SKIP_ROWS, 0);
    GL11.glPixelStorei(GL11.GL_PACK_SKIP_PIXELS, 0);

    ByteBuffer image;
    boolean done = false;

    if (w != width || h != height)
    {
      // Must rescale image to get "top" mipmap texture image
      image = BufferUtils.createByteBuffer((w + 4) * h * bpp);
     
      if (!Texture.gluScaleImage(format, width, height, type, data, w, h,
          type, image))
        done = true;

      /* set pixel unpacking */
      GL11.glPixelStorei(GL11.GL_UNPACK_ROW_LENGTH, 0);
      GL11.glPixelStorei(GL11.GL_UNPACK_ALIGNMENT, 1);
      GL11.glPixelStorei(GL11.GL_UNPACK_SKIP_ROWS, 0);
      GL11.glPixelStorei(GL11.GL_UNPACK_SKIP_PIXELS, 0);
    } else
    {
      image = data;
    }

    ByteBuffer bufferA = null;
    ByteBuffer bufferB = null;

    int level = 0;
    while (!done)
    {
      if (image != data)
      {
        /* set pixel unpacking */
        GL11.glPixelStorei(GL11.GL_UNPACK_ROW_LENGTH, 0);
        GL11.glPixelStorei(GL11.GL_UNPACK_ALIGNMENT, 1);
        GL11.glPixelStorei(GL11.GL_UNPACK_SKIP_ROWS, 0);
        GL11.glPixelStorei(GL11.GL_UNPACK_SKIP_PIXELS, 0);
      }

      GL11.glTexImage2D(target, level, components, w, h, 0, format, type,
          image);

      if (w == 1 && h == 1)
        break;

      final int newW = (w < 2) ? 1 : w >> 1;
      final int newH = (h < 2) ? 1 : h >> 1;

      final ByteBuffer newImage;

      if (bufferA == null)
        newImage = (bufferA = BufferUtils.createByteBuffer((newW + 4)
            * newH * bpp));
      else if (bufferB == null)
        newImage = (bufferB = BufferUtils.createByteBuffer((newW + 4)
            * newH * bpp));
      else
        newImage = bufferB;

      if (!Texture.gluScaleImage(format, w, h, type, image, newW, newH,
          type, newImage))
        done = true;

      image = newImage;
      if (bufferB != null)
        bufferB = bufferA;

      w = newW;
      h = newH;
      level++;
    }

    // Restore original glPixelStore state
    pss.save();
  }
View Full Code Here

    default:
      return false;
    }

    // Get glPixelStore state
    PixelStoreState pss = new PixelStoreState();

    // Unpack the pixel data and convert to floating point
    if (pss.unpackRowLength > 0)
      rowlen = pss.unpackRowLength;
    else
View Full Code Here

  /** Creates an instance of HUD */
  public HUD(float depth)
  {
    // Create the Layer
    layer = new Layer(depth);   

    // Set the text scaling proportional to width
    textScale = layer.getWidth() / 5000;

    // Position
View Full Code Here

TOP

Related Classes of k8.k8

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.