Пример #1
0
 /**
  * Implicitní konstruktor. Vytvoří kameru s pozicí v počátku soustavy souřadnic scény - bod (0, 0,
  * 0), vektorem up (0, 0, 1), vektorem pohledu (1, 0, 0), a rozlišením rastru (100 x 100) px.
  */
 protected AbstractCamera() {
   super();
   position = new Point3D();
   direction = new Vector3(1, 0, 0);
   up = new Vector3(0, 0, 1);
   right = direction.cross(up).normalized();
   up = right.cross(direction).normalized();
   screenWidth = 100;
   screenHeight = 100;
   realWidth = 2;
   realHeight = 2;
   computeRealUVSteps();
 }
Пример #2
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();
  }