Package se.llbit.chunky.renderer.scene

Examples of se.llbit.chunky.renderer.scene.Camera$PinholeProjector


    etaLbl.setText("ETA: N/A");
  }

  @Override
  public void onZoom(int diff) {
    Camera camera = renderMan.scene().camera();
    double value = renderMan.scene().camera().getFoV();
    double scale = camera.getMaxFoV() - camera.getMinFoV();
    double offset = value/scale;
    double newValue = scale*Math.exp(Math.log(offset) + 0.1*diff);
    if (!Double.isNaN(newValue) && !Double.isInfinite(newValue)) {
      renderMan.scene().camera().setFoV(newValue);
    }
View Full Code Here


    renderMan.scene().camera().setDof(newValue);
  }

  @Override
  public void update() {
    Camera camera = renderMan.scene().camera();
    if (camera.infiniteDoF()) {
      setTextFieldText("inf");
      setSliderValue(getSlider().getMaximum());
    } else {
      set(renderMan.scene().camera().getDof());
    }
View Full Code Here

    height = PersistentSettings.DEFAULT_3D_CANVAS_HEIGHT;

    buffer = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
    backBuffer = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);

    camera = new Camera(this);
    nextCamera = new Camera(this);
    nextCamera.setView(-3*Math.PI/4, -5*Math.PI/6, 0);

    if (targetFile.isEmpty()) {
      view = new Chunk3DView(this, parent);
      view.setRenderer(this);
View Full Code Here

    int x1 = Math.min(x0 + manager.tileWidth, width);
    int y0 = manager.tileWidth * (jobId / xjobs);
    int y1 = Math.min(y0 + manager.tileWidth, height);

    double[] samples = scene.getSampleBuffer();
    final Camera cam = scene.camera();

    long jobStart = System.nanoTime();

    if (scene.pathTrace()) {

      // this is intentionally incorrectly indented for readability
      for (int y = y0; y < y1; ++y) {
        int offset = y * width * 3 + x0 * 3;
        for (int x = x0; x < x1; ++x) {

          double sr = 0;
          double sg = 0;
          double sb = 0;

          for (int i = 0; i < RenderConstants.SPP_PASS; ++i) {
            double oy = random.nextDouble();
            double ox = random.nextDouble();

            cam.calcViewRay(ray, random, (-halfWidth + (x + ox)
                / height), (-.5 + (y + oy) / height));

            scene.pathTrace(state);

            sr += ray.color.x;
            sg += ray.color.y;
            sb += ray.color.z;
          }
          double sinv = 1.0 / (scene.spp + RenderConstants.SPP_PASS);
          samples[offset+0] = (samples[offset+0] * scene.spp + sr) * sinv;
          samples[offset+1] = (samples[offset+1] * scene.spp + sg) * sinv;
          samples[offset+2] = (samples[offset+2] * scene.spp + sb) * sinv;

          if (scene.finalizeBuffer()) {
            scene.finalizePixel(x, y);
          }

          offset += 3;
        }
      }

    } else {

      Ray target = state.rayPool.get(ray);
      scene.trace(target);
      int tx = (int) QuickMath.floor(target.x.x + target.d.x * Ray.OFFSET);
      int ty = (int) QuickMath.floor(target.x.y + target.d.y * Ray.OFFSET);
      int tz = (int) QuickMath.floor(target.x.z + target.d.z * Ray.OFFSET);

      // this is intentionally incorrectly indented for readability
      for (int x = x0; x < x1; ++x)
      for (int y = y0; y < y1; ++y) {

      boolean firstFrame = scene.previewCount > 1;
      if (firstFrame) {
        if (((x+y)%2) == 0) {
          continue;
        }
      } else {
        if (((x+y)%2) != 0) {
          scene.finalizePixel(x, y);
          continue;
        }
      }

      cam.calcViewRay(ray, random,
          (-halfWidth + (double)x / height),
          (-.5 + (double)y / height));

      scene.quickTrace(state);

View Full Code Here

TOP

Related Classes of se.llbit.chunky.renderer.scene.Camera$PinholeProjector

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.