示例#1
0
  /**
   * Update axis display depending the current scene camera view.<br>
   * You should call it after having modified camera settings.
   */
  public void updateAxisView() {
    if (!isWindowSet()) return;

    lock();
    try {
      double pos[] = cam.GetPosition();
      double fp[] = cam.GetFocalPoint();
      double viewup[] = cam.GetViewUp();

      // mimic axis camera position to scene camera position
      axisCam.SetPosition(pos);
      axisCam.SetFocalPoint(fp);
      axisCam.SetViewUp(viewup);
      axisRenderer.ResetCamera();

      final int[] size = rw.GetSize();
      // adjust scale
      final double scale = size[1] / 512d;
      // adjust offset
      final int w = (int) (size[0] - (axisOffset[0] * scale));
      final int h = (int) (size[1] - (axisOffset[1] * scale));
      // zoom and translate
      zoomView(axisCam, axisRenderer, axisScale * (axisCam.GetDistance() / 17d));
      translateView(axisCam, axisRenderer, -w, -h);
    } finally {
      unlock();
    }
  }