예제 #1
0
  private void drawPlayerIcons(final Player player, double elapsedMillis) {
    quadVao.bind();
    playerTexture.bind(0);
    uiShader.use();

    final FloatBuffer matrixBuffer = BufferUtils.createFloatBuffer(16);
    Matrix4f projectionMatrix = new Matrix4f().setOrtho(0, windowWidth, windowHeight, 0, -1, 1);

    for (int i = 0; i < player.numLives(); i++) {
      final Matrix4f mat = new Matrix4f();
      mat.identity();
      mat.translate((float) windowWidth - 100 - i * 60f, 60, 0);
      mat.translate(25, 25, 0);
      mat.scale(25, 25, 1);

      Matrix4f tmp = new Matrix4f(projectionMatrix).mul(mat);
      tmp.get(matrixBuffer);
      uiShader.setUniformMatrixF("projMatrix", matrixBuffer);

      GL11.glDrawArrays(GL11.GL_TRIANGLES, 0, 6);
    }

    playerTexture.unbind();
    quadVao.unbind();
  }
예제 #2
0
 private void updateMatrix() {
   mat.identity();
   mat.translate(-x, -y, -z);
   mat.rotate((float) Math.toRadians(-rx), X_AXIS);
   mat.rotate((float) Math.toRadians(-ry), Y_AXIS);
 }
예제 #3
0
 /** Update local matrix. */
 public void updateLocalMatrix() {
   localMatrix.identity();
   localMatrix.translate(position);
   localMatrix.rotate(rotation);
   localMatrix.scale(scale);
 }