Beispiel #1
0
  /**
   * Vytvoří kameru s danými atributy.
   *
   * @param position Pozice kamery ve scéně.
   * @param direction Vektor určující směr pohledu kamery.
   * @param up Vektor určující směr nahoru.
   * @param screenWidth Šířka rastru průmětny.
   * @param screenHeight Výška rastru průmětny.
   */
  public AbstractCamera(
      Point3D position, Vector3 direction, Vector3 up, int screenWidth, int screenHeight) {
    this.position = position;
    this.direction = direction.normalized();
    this.up = up.normalized();
    right = this.direction.cross(this.up).normalized();
    this.up = right.cross(this.direction).normalized();
    this.screenWidth = screenWidth;
    this.screenHeight = screenHeight;

    if (screenWidth > screenHeight) {
      realHeight = 2.0f;
      realWidth = screenWidth * realHeight / screenHeight;
    } else {
      realWidth = 2.0f;
      realHeight = screenHeight * realWidth / screenWidth;
    }

    computeRealUVSteps();
  }