@Override
 protected void controlUpdate(float tpf) {
   light.setPosition(spatial.getWorldTranslation().add(0, 0, 32));
   flicker += 8 * tpf;
   float radius =
       FastMath.sin(FastMath.tan(FastMath.cos(flicker + (FastMath.rand.nextFloat() * 2)))) * 20
           + 200;
   light.setRadius(radius);
 }
Exemplo n.º 2
0
  protected void zoomCamera(float value) {
    // derive fovY value
    float h = cam.getFrustumTop();
    float w = cam.getFrustumRight();
    float aspect = w / h;

    float near = cam.getFrustumNear();

    float fovY = FastMath.atan(h / near) / (FastMath.DEG_TO_RAD * .5f);
    fovY += value * 0.1f;

    if (fovY < Config.ZOOM_FOV_MAX && fovY > Config.ZOOM_FOV_MIN) {
      h = FastMath.tan(fovY * FastMath.DEG_TO_RAD * .5f) * near;
      w = h * aspect;

      cam.setFrustumTop(h);
      cam.setFrustumBottom(-h);
      cam.setFrustumLeft(-w);
      cam.setFrustumRight(w);
    }
  }