예제 #1
0
  public void processMouse() {

    DoubleBuffer x = BufferUtils.createDoubleBuffer(1), y = BufferUtils.createDoubleBuffer(1);

    glfwGetCursorPos(window, x, y);
    x.rewind();
    y.rewind();
    float mouseX = (float) x.get(), mouseY = (float) y.get();

    pitch = MOUSE_SENSITIVITY * mouseY;
    yaw = MOUSE_SENSITIVITY * mouseX;
  }
예제 #2
0
  public boolean isOver() {
    DoubleBuffer b1 = BufferUtils.createDoubleBuffer(1);
    DoubleBuffer b2 = BufferUtils.createDoubleBuffer(1);

    glfwGetCursorPos(window, b1, b2);

    Vector2f pos1 = getPos();
    Vector2f pos2 = new Vector2f((float) b1.get(0), HEIGHT - (float) b2.get(0));
    Vector2f size1 = getSize();

    boolean over = PhysicMain.inSquare(pos2, pos1, size1);

    if (over) {
      if (!m_hover) onHover();
      m_hoverTime += Logic.Logic.DELTA_TIME;
    } else m_hoverTime = 0.0f;

    m_hover = over;

    return over;
  }
예제 #3
0
 public static DoubleBuffer planeEquation(
     double x1,
     double y1,
     double z1,
     double x2,
     double y2,
     double z2,
     double x3,
     double y3,
     double z3) {
   double[] eq = new double[4];
   eq[0] = y1 * (z2 - z3) + y2 * (z3 - z1) + y3 * (z1 - z2);
   eq[1] = z1 * (x2 - x3) + z2 * (x3 - x1) + z3 * (x1 - x2);
   eq[2] = x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2);
   eq[3] = -(x1 * (y2 * z3 - y3 * z2) + x2 * (y3 * z1 - y1 * z3) + x3 * (y1 * z2 - y2 * z1));
   DoubleBuffer b = BufferUtils.createDoubleBuffer(8).put(eq);
   b.flip();
   return b;
 }
예제 #4
0
 public DoubleBuffer(double[] doubleValue) {
   this.doubleBuffer = BufferUtils.createDoubleBuffer(doubleValue.length);
   this.doubleBuffer.put(doubleValue);
   this.doubleBuffer.flip();
   this.elements = doubleValue.length;
 }