Module raytracer

Class PixelwiseRenderer

java.lang.Object
de.grogra.task.Task
de.grogra.ray2.tracing.PixelwiseRenderer
All Implemented Interfaces:
Renderer
Direct Known Subclasses:
BidirectionalRenderer, MetropolisRenderer

public class PixelwiseRenderer extends Task implements Renderer
  • Field Details

    • ANTIALIASING

      public static final String ANTIALIASING
      See Also:
    • RAYPROCESSOR

      public static final String RAYPROCESSOR
      See Also:
    • BRIGHTNESS

      public static final String BRIGHTNESS
      See Also:
    • THREAD_COUNT

      public static final String THREAD_COUNT
      See Also:
    • AUTO_ADJUST

      public static final String AUTO_ADJUST
      See Also:
    • AUTO_ADJUST_MAX_VALUE

      public static final String AUTO_ADJUST_MAX_VALUE
      See Also:
    • REMOVE_OUTLIERS

      public static final String REMOVE_OUTLIERS
      See Also:
    • HDR

      public static final String HDR
      See Also:
    • SEED

      public static final String SEED
      See Also:
    • monitor

      protected ProgressMonitor monitor
    • camera

      protected Sensor camera
    • cameraTransformation

      protected Matrix4d cameraTransformation
    • threadCount

      public int threadCount
    • width

      protected int width
    • height

      protected int height
    • image

      protected BufferedImage image
    • rgbaPixels

      protected int[] rgbaPixels
    • hdrPixels

      protected float[][] hdrPixels
    • observer

      protected ImageObserver observer
    • originalScene

      protected Scene originalScene
    • antialiasing

      protected Antialiasing antialiasing
    • imageUpdateDistance

      protected int imageUpdateDistance
    • imageUpdateRate

      protected int imageUpdateRate
    • brightness

      protected float brightness
    • hdr

      protected boolean hdr
    • autoAdjust

      protected boolean autoAdjust
    • removeOutliers

      protected boolean removeOutliers
    • autoAdjustMaxValue

      protected float autoAdjustMaxValue
    • maxValue

      protected float maxValue
    • seed

      protected long seed
    • renderedLines

      protected int renderedLines
    • lineState

      protected int[] lineState
    • DEBUG_X

      public static int DEBUG_X
    • DEBUG_Y

      public static int DEBUG_Y
    • DEBUG_LINE

      public static float DEBUG_LINE
    • DEBUG_PIXEL

      public static boolean DEBUG_PIXEL
    • DEBUG_SUBPIXEL

      public static boolean DEBUG_SUBPIXEL
  • Constructor Details

    • PixelwiseRenderer

      public PixelwiseRenderer()
  • Method Details

    • getNumericOption

      public Number getNumericOption(String key, Number def)
    • getBooleanOption

      public boolean getBooleanOption(String key, boolean def)
    • getClassOption

      public Object getClassOption(String key, Object def)
    • initialize

      public void initialize(Options opts, ProgressMonitor progress)
      Description copied from interface: Renderer
      Initializes the renderer. This method has to be invoked at first.
      Specified by:
      initialize in interface Renderer
      Parameters:
      opts - options to use (may be null)
      progress - monitor to display rendering progress (may be null)
    • getCamera

      public Sensor getCamera()
    • getCameraTransformation

      public Matrix4d getCameraTransformation()
    • setAntialiasing

      public void setAntialiasing(Antialiasing a)
    • setHDR

      public void setHDR(boolean value)
    • setAutoAdjust

      public void setAutoAdjust(boolean value)
    • getAutoAdjust

      public boolean getAutoAdjust()
    • setAutoAdjustMaxValue

      public void setAutoAdjustMaxValue(float value)
    • setBrightness

      public void setBrightness(float value)
    • setThreadCount

      public void setThreadCount(int value)
    • getBrightness

      public float getBrightness()
    • getSeed

      public long getSeed()
    • render

      public void render(Scene scene, Sensor camera, Matrix4d cameraTransformation, int width, int height, ImageObserver obs)
      Description copied from interface: Renderer
      Renders an image of a scene.
      Specified by:
      render in interface Renderer
      Parameters:
      scene - scene to render
      camera - camera to use
      cameraTransformation - transformation from camera coordinates to world coordinates
      width - width of image
      height - height of image
      obs - the observer receives the image data
    • removeOutliers

      protected void removeOutliers()
    • getAdjustFactor

      public float getAdjustFactor()
    • createLocalSolver

      public Solver createLocalSolver(boolean sameThread)
    • merge

      public void merge(PixelwiseRenderer.Result res)
    • done

      protected boolean done()
      Description copied from class: Task
      Returns true iff the complete task has been solved.
      Specified by:
      done in class Task
      Returns:
      has the task been solved?
    • nextPartialTask

      protected PartialTask nextPartialTask(int solverIndex)
      Description copied from class: Task
      This method returns the next partial task for this task. If all parts of the task have been solved or currently are being solved, null is returned. However, a later invocation may return a partial task if a currently active solver does not completely solve its partial task.
      Specified by:
      nextPartialTask in class Task
      Parameters:
      solverIndex - index of solver which will be used for next task
      Returns:
      next partial task, or null
    • dispose

      protected void dispose(PartialTask task)
      Description copied from class: Task
      This method is invoked when an active solver is removed or invokes Task.partialTaskDone(Solver) in order to tell this task that the partial task of the solver is no longer processed. Note that the solver may not have completely processed its partial task.
      Specified by:
      dispose in class Task
      Parameters:
      task - partial task which is no longer processed
    • renderLines

      protected void renderLines(Antialiasing antialiasing, IntList lines, PixelwiseRenderer.Result res)
    • toIntColor

      protected static int toIntColor(float r, float g, float b, float a)
    • toRGBA

      protected static float[] toRGBA(int intColor)
    • setMessage

      public void setMessage(String text, float progress)
      Show Status message.
      Parameters:
      text - short text to display
      progress - state of progress from 0 to 1, or one of the constants #INDETERMINATE_PROGRESS, #DONE_PROGRESS
    • getScene

      public Scene getScene()
    • luminance

      public float luminance(double x, double y, double z)