public void init() {
    cam = new PerspCam().initProjection(70, Display.getAspectRatio(), 0.01f, 100f);
    cam.setPosition(new Vector3(0, 0, 0.5f));

    sheet =
        new SpriteSheet(
            Texture.fromFilePath(FilePath.getResourceFile("resources/coin_sprinkle.png")), 32, 32);

    Sprite sprite = new Sprite();
    sprite.getAnimation().addFrame(sheet.getCell(0, 0), 0.25f, TimeUtils.Unit.SECONDS);
    sprite.getAnimation().addFrame(sheet.getCell(0, 1), 0.25f, TimeUtils.Unit.SECONDS);
    sprite.getAnimation().setEndCallback(sprite.getAnimation()::start);
    sprite.getAnimation().start();

    model = new BillBoardModel(sprite, 0.2f, 0.2f);
    model2 =
        new BillBoardModel(
            Texture.fromFilePath(FilePath.getResourceFile("resources/texture.png")), 0.8f, 0.8f);

    scene = new Scene3D();

    // Add the entity to the scene
    scene.addChild(entity = new Entity3D(model, new Cuboid(Vector3.ZERO, 1, 1, 1)));
    entity.setPosition(new Vector3(0, 0, 0.2f));
    scene.addChild(new Entity3D(model2, new Cuboid(Vector3.ZERO, 1, 1, 1)));
  }
  public void update(float delta) {
    if (Keyboard.isClicked(Keyboard.KEY_ESCAPE)) end();

    float speed = 2 * delta;

    if (Keyboard.isPressed(Keyboard.KEY_W)) cam.moveForward(speed);

    if (Keyboard.isPressed(Keyboard.KEY_S)) cam.moveBackward(speed);

    if (Keyboard.isPressed(Keyboard.KEY_A)) cam.moveLeft(speed);

    if (Keyboard.isPressed(Keyboard.KEY_D)) cam.moveRight(speed);

    if (Keyboard.isPressed(Keyboard.KEY_Q)) cam.moveUp(speed);

    if (Keyboard.isPressed(Keyboard.KEY_E)) cam.moveDown(speed);

    if (Keyboard.isPressed(Keyboard.KEY_UP)) cam.rotateX(1);

    if (Keyboard.isPressed(Keyboard.KEY_DOWN)) cam.rotateX(-1);

    if (Keyboard.isPressed(Keyboard.KEY_LEFT)) cam.rotateY(1);

    if (Keyboard.isPressed(Keyboard.KEY_RIGHT)) cam.rotateY(-1);

    // Mouse look!
    if (Keyboard.isPressed(Keyboard.KEY_SPACE)) {
      if (!Display.isCursorGrabbed()) Display.grabCursor();

      cam.rotateX(Mouse.getDY() * speed);
      cam.rotateY(Mouse.getDX() * speed);
    } else Display.showCursor();

    entity.rotate(0, 0, 90 * delta);
    scene.update(delta);

    // Calculate the new memory used again
    long newUsedMemory = (getUsedMemory() / 1048576);
    usedMemory = Math.max(usedMemory, newUsedMemory);

    Display.setTitle(
        "Total Memory: "
            + (getTotalMemory() / 1048576)
            + "MB / Free Memory: "
            + (getFreeMemory() / 1048576)
            + "MB / Used Memory: "
            + newUsedMemory
            + "MB");
  }