Package org.lwjgl.util.vector

Examples of org.lwjgl.util.vector.Vector3f


  }

  private void newCaption(String text) {
    moveText(20.0f);

    WorldText item = new WorldText(text, 8.0f, new Color(0.8f, 0.8f, 1.0f, 0.8f), new Vector3f(0.0f, textPosY,
        textPosZ), -45.0f, 0.0f, 0.0f, goManager);
    item.translate(-0.5f * item.getWidth(), 0.0f, 0.0f);

    moveText(20.0f);
  }
View Full Code Here


    moveText(20.0f);
  }

  private void newText(String text) {
    WorldText item = new WorldText(text, 5.0f, new Color(0.8f, 0.8f, 1.0f, 0.8f), new Vector3f(0.0f, textPosY,
        textPosZ), -45.0f, 0.0f, 0.0f, goManager);
    item.translate(-0.5f * item.getWidth(), 0.0f, 0.0f);

    moveText(10.0f);
  }
View Full Code Here

    }
  }

  public void centerH() {
    // undo previous translations in text-direction
    Vector3f p = getPosition();
    if (place == Place.FRONT || place == Place.BACK)
      p.x = position.x;
    else
      p.z = position.z;
    setPosition(p);
View Full Code Here

    translateInTextDir(-0.5f * getWidth());
  }

  public void centerV() {
    // undo previous translations in vertical direction
    Vector3f p = getPosition();
    if (place == Place.TOP || place == Place.BOTTOM)
      p.x = position.x;
    else
      p.y = position.y;
    setPosition(p);
View Full Code Here

   */
  public boolean isInBoundingBox(Cursor cursor, float eps) {
    if (!isEnabled() || !isVisible())
      return false;

    Vector3f position = getPosition();

    float left = 0, right = 0, top = 0, bottom = 0, front = 0, back = 0;

    switch (place) {
    case LEFT:
      left = position.x - eps;
      right = position.x + eps;
      top = position.y + eps;
      bottom = position.y - getHeight() - eps;
      front = position.z + eps;
      back = position.z - getWidth() - eps;
      break;

    case RIGHT:
      left = position.x - eps;
      right = position.x + eps;
      top = position.y + eps;
      bottom = position.y - getHeight() - eps;
      front = position.z + getWidth() + eps;
      back = position.z - eps;
      break;

    case TOP:
      left = position.x - eps;
      right = position.x + getHeight() + eps;
      top = position.y + eps;
      bottom = position.y - eps;
      front = position.z + getWidth() + eps;
      back = position.z - eps;
      break;

    case BOTTOM:
      left = position.x - getHeight() - eps;
      right = position.x + eps;
      top = position.y + eps;
      bottom = position.y - eps;
      front = position.z + getWidth() + eps;
      back = position.z - eps;
      break;

    case FRONT:
      left = position.x - eps;
      right = position.x + getWidth() + eps;
      top = position.y + eps;
      bottom = position.y - getHeight() - eps;
      front = position.z + eps;
      back = position.z - eps;
      break;

    case BACK:
      left = position.x - getWidth() - eps;
      right = position.x + eps;
      top = position.y + eps;
      bottom = position.y - getHeight() - eps;
      front = position.z + eps;
      back = position.z - eps;
      break;
    }

    Vector3f cp = cursor.getTextPosition();

    return (cp.x > left && cp.x < right && cp.y > bottom && cp.y < top && cp.z < front && cp.z > back);
  }
View Full Code Here

    flying = MenuState.FlyingDirection.IN;
    posZ = 25.5f + 1000.0f;
    destPosZ = 25.5f;

    Camera.init(new Vector3f(0.0f, 0.0f, posZ));
    Board.init();
  }
View Full Code Here

          posZ -= MenuState.getFlySpeed(posZ - destPosZ, 1050.0f, true) * elapsedTime;
        if (posZ <= destPosZ) {
          posZ = destPosZ;
          flying = FlyingDirection.NONE;
        }
        Camera.setPosition(new Vector3f(0.0f, 0.0f, posZ));
        break;

      case OUT:
        if (posZ < destPosZ)
          posZ += MenuState.getFlySpeed(destPosZ - posZ + 50.0f, 1050.0f, true) * elapsedTime;
        if (posZ >= destPosZ) {
          posZ = destPosZ;
          flying = FlyingDirection.NONE;
          getListener().changeState(getPrevious());
          return;
        }

        Camera.setPosition(new Vector3f(0.0f, 0.0f, posZ));
        break;

      case NONE:
        break;
      }
View Full Code Here

  }

  @Override
  public Vector3f getPosition() {
    Vector2f pos = block.getPosition();
    return new Vector3f(pos.x, pos.y, 0.0f);
  }
View Full Code Here

        /* Set transform matrix for this piece of track */
        transMat.setIdentity();
        rotMat.setIdentity();
        /* Translate by x,z coordinates */
        transMat.translate(new Vector3f(y, 0, x));
       
        int trackType = getTrackType(map.get(y, x), scan, map.scanRideable(y, x));
       
        /* Populate msh list with right .obj meshes */
        switch(trackType){
          case EW_STRAIGHT:
            mRotation -= 90f;
            rotMat.rotate((float) Math.toRadians(mRotation), new Vector3f(0, 1, 0));
          case NS_STRAIGHT:
            //msh.add(trackStraight);
            msh.add(objMeshes.get("res/mesh/track.obj"));
            break;

          case NSEW_CROSS:
            //msh.add(trackXCrossing);
            msh.add(objMeshes.get("res/mesh/track_x_cross.obj"));
            break;

          case NE_CURVE:
            mRotation -= 90f;
          case NW_CURVE:
            mRotation -= 90f;
          case SW_CURVE:
            mRotation -= 90f;
            rotMat.rotate((float) Math.toRadians(mRotation), new Vector3f(0, 1, 0));
          case SE_CURVE:
            //msh.add(track90Corner);
            msh.add(objMeshes.get("res/mesh/track_90_corner.obj"));
            break;

          case WNE_CROSS:
            mRotation -= 90f;
          case SWN_CROSS:
            mRotation -= 90f;
          case ESW_CROSS:
            mRotation -= 90f;
            rotMat.rotate((float) Math.toRadians(mRotation), new Vector3f(0, 1, 0));
          case NES_CROSS:
            //msh.add(trackTCrossing);
            msh.add(objMeshes.get("res/mesh/track_t_cross.obj"));
            break;

          case EW_STATION:
            mRotation -= 90f;
            rotMat.rotate((float) Math.toRadians(mRotation), new Vector3f(0, 1, 0));
          case NS_STATION:
            //msh.add(trackStraight);
            //msh.add(station);
            msh.add(objMeshes.get("res/mesh/track.obj"));
            msh.add(objMeshes.get("res/mesh/station2.obj"));

            if(rand.nextFloat() > 0.5f){
              //msh.add(station_bin);
              msh.add(objMeshes.get("res/mesh/station2_bin.obj"));
            }
            if(rand.nextFloat() > 0.5f){
              //msh.add(station_bench);
              msh.add(objMeshes.get("res/mesh/station2_bench.obj"));
            }
            if(rand.nextFloat() > 0.75f){
              //msh.add(station_map);
              msh.add(objMeshes.get("res/mesh/station2_map.obj"));
            }
            break;

          case WNE_STATION:
            mRotation -= 90f;
          case SWN_STATION:
            mRotation -= 90f;
          case ESW_STATION:
            mRotation -= 90f;
            rotMat.rotate((float) Math.toRadians(mRotation), new Vector3f(0, 1, 0));
          case NES_STATION:
            //msh.add(trackTCrossing);
            //msh.add(station);
            msh.add(objMeshes.get("res/mesh/track_t_cross.obj"));
            msh.add(objMeshes.get("res/mesh/station2.obj"));

            if(rand.nextFloat() > 0.5f){
              //msh.add(station_bin);
              msh.add(objMeshes.get("res/mesh/station2_bin.obj"));
            }
            if(rand.nextFloat() > 0.5f){
              //msh.add(station_bench);
              msh.add(objMeshes.get("res/mesh/station2_bench.obj"));
            }
            if(rand.nextFloat() > 0.75f){
              //msh.add(station_map);
              msh.add(objMeshes.get("res/mesh/station2_map.obj"));
            }
            break;
           
          case TREE:
            transMat.translate(new Vector3f(((float)Math.random()-0.5f)*0.8f, 0, ((float)Math.random()-0.5f)*0.8f));
            rotMat.rotate((float) Math.toRadians(Math.random()*360.0), new Vector3f(0, 1, 0));
            msh.add(objMeshes.get("res/mesh/cactus_trunk.obj"));
            if(rand.nextFloat() > 0.15f){
              msh.add(objMeshes.get("res/mesh/cactus_branch1.obj"));
            }
            if(rand.nextFloat() > 0.15f){
View Full Code Here

    public Chunk(ArrayList<Float> data){
      mesh = new Mesh();
      mesh.create(data, 9, GL_STATIC_DRAW, false);
      corner = new Vector3f[9];
     
      Vector3f topLeftFrontCorner = new Vector3f();
      Vector3f bottomRightBackCorner = new Vector3f();
     
      topLeftFrontCorner.x = data.get(0);
      bottomRightBackCorner.y = data.get(1);
      bottomRightBackCorner.z = data.get(2);
     
      int indices = mesh.getIndiceCount()*3;
      for (int i = 0; i < indices; i=i+3) {
        topLeftFrontCorner.x = Math.min(data.get(i), topLeftFrontCorner.x);
        topLeftFrontCorner.y = Math.max(data.get(i+1), topLeftFrontCorner.y);
        topLeftFrontCorner.z = Math.max(data.get(i+2), topLeftFrontCorner.z);
       
        bottomRightBackCorner.x = Math.max(data.get(i), bottomRightBackCorner.x);
        bottomRightBackCorner.y = Math.min(data.get(i+1), bottomRightBackCorner.y);
        bottomRightBackCorner.z = Math.min(data.get(i+2), bottomRightBackCorner.z);
      }
      corner[0] = new Vector3f(topLeftFrontCorner);
      corner[1] = new Vector3f(topLeftFrontCorner.x, topLeftFrontCorner.y, bottomRightBackCorner.z);
      corner[2] = new Vector3f(bottomRightBackCorner.x, topLeftFrontCorner.y, bottomRightBackCorner.z);
      corner[3] = new Vector3f(bottomRightBackCorner.x, topLeftFrontCorner.y, topLeftFrontCorner.z);
     
      corner[4] = new Vector3f(bottomRightBackCorner);
      corner[5] = new Vector3f(topLeftFrontCorner.x, bottomRightBackCorner.y, bottomRightBackCorner.z);
      corner[6] = new Vector3f(bottomRightBackCorner.x, bottomRightBackCorner.y, bottomRightBackCorner.z);
      corner[7] = new Vector3f(bottomRightBackCorner.x, bottomRightBackCorner.y, topLeftFrontCorner.z);
     
      corner[8] = new Vector3f((bottomRightBackCorner.x+topLeftFrontCorner.x)/2f,
        (bottomRightBackCorner.y+topLeftFrontCorner.y)/2f,
        (bottomRightBackCorner.z+topLeftFrontCorner.z)/2f
        );
    }
View Full Code Here

TOP

Related Classes of org.lwjgl.util.vector.Vector3f

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.