public void initialize(RenderManager rm, ViewPort vp) {
    renderManager = rm;
    renderer = rm.getRenderer();
    viewPort = vp;
    fsQuad = new Picture("filter full screen quad");

    Camera cam = vp.getCamera();

    // save view port diensions
    left = cam.getViewPortLeft();
    right = cam.getViewPortRight();
    top = cam.getViewPortTop();
    bottom = cam.getViewPortBottom();
    originalWidth = cam.getWidth();
    originalHeight = cam.getHeight();
    // first call to reshape
    reshape(vp, cam.getWidth(), cam.getHeight());
  }
示例#2
0
  /**
   * Updates a points arrays with the frustum corners of the provided camera.
   *
   * @param viewCam
   * @param points
   */
  public static void updateFrustumPoints2(Camera viewCam, Vector3f[] points) {
    int w = viewCam.getWidth();
    int h = viewCam.getHeight();

    points[0].set(viewCam.getWorldCoordinates(new Vector2f(0, 0), 0));
    points[1].set(viewCam.getWorldCoordinates(new Vector2f(0, h), 0));
    points[2].set(viewCam.getWorldCoordinates(new Vector2f(w, h), 0));
    points[3].set(viewCam.getWorldCoordinates(new Vector2f(w, 0), 0));

    points[4].set(viewCam.getWorldCoordinates(new Vector2f(0, 0), 1));
    points[5].set(viewCam.getWorldCoordinates(new Vector2f(0, h), 1));
    points[6].set(viewCam.getWorldCoordinates(new Vector2f(w, h), 1));
    points[7].set(viewCam.getWorldCoordinates(new Vector2f(w, 0), 1));
  }
示例#3
0
  @Override
  protected void initialize(Application app) {

    ed = getState(EntityDataState.class).getEntityData();
    entities = ed.getEntities(Position.class, ModelType.class);

    // Calculate how big min/max needs to be to incorporate
    // the full view + margin at z = 0
    Camera cam = app.getCamera();
    float z = cam.getViewToProjectionZ(cam.getLocation().z);
    Vector3f worldMin = cam.getWorldCoordinates(new Vector2f(0, 0), z);
    Vector3f worldMax = cam.getWorldCoordinates(new Vector2f(cam.getWidth(), cam.getHeight()), z);
    min = worldMin.addLocal(-margin, -margin, 0);
    max = worldMax.addLocal(margin, margin, 0);
  }