de.grogra.ray2.tracing
Class PixelwiseRenderer

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

public class PixelwiseRenderer
extends Task
implements Renderer


Nested Class Summary
static class PixelwiseRenderer.RenderTask
           
static class PixelwiseRenderer.Result
           
 
Field Summary
protected  Antialiasing antialiasing
           
static java.lang.String ANTIALIASING
           
static java.lang.String AUTO_ADJUST
           
static java.lang.String AUTO_ADJUST_MAX_VALUE
           
protected  boolean autoAdjust
           
protected  float autoAdjustMaxValue
           
protected  float brightness
           
static java.lang.String BRIGHTNESS
           
protected  Sensor camera
           
protected  Matrix4d cameraTransformation
           
static float DEBUG_LINE
           
static boolean DEBUG_PIXEL
           
static boolean DEBUG_SUBPIXEL
           
static int DEBUG_X
           
static int DEBUG_Y
           
protected  boolean hdr
           
static java.lang.String HDR
           
protected  float[][] hdrPixels
           
protected  int height
           
protected  java.awt.image.BufferedImage image
           
protected  int imageUpdateDistance
           
protected  int imageUpdateRate
           
protected  int[] lineState
           
protected  float maxValue
           
protected  ProgressMonitor monitor
           
protected  java.awt.image.ImageObserver observer
           
protected  Scene originalScene
           
static java.lang.String RAYPROCESSOR
           
static java.lang.String REMOVE_OUTLIERS
           
protected  boolean removeOutliers
           
protected  int renderedLines
           
protected  int[] rgbaPixels
           
protected  long seed
           
static java.lang.String SEED
           
static java.lang.String THREAD_COUNT
           
 int threadCount
           
protected  int width
           
 
Constructor Summary
PixelwiseRenderer()
           
 
Method Summary
 Solver createLocalSolver(boolean sameThread)
           
protected  void dispose(PartialTask 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.
protected  boolean done()
          Returns true iff the complete task has been solved.
 float getAdjustFactor()
           
 boolean getAutoAdjust()
           
 boolean getBooleanOption(java.lang.String key, boolean def)
           
 float getBrightness()
           
 Sensor getCamera()
           
 Matrix4d getCameraTransformation()
           
 java.lang.Object getClassOption(java.lang.String key, java.lang.Object def)
           
 java.lang.Number getNumericOption(java.lang.String key, java.lang.Number def)
           
 Scene getScene()
           
 long getSeed()
           
 void initialize(Options opts, ProgressMonitor progress)
          Initializes the renderer.
 float luminance(double x, double y, double z)
           
 void merge(PixelwiseRenderer.Result res)
           
protected  PartialTask nextPartialTask(int solverIndex)
          This method returns the next partial task for this task.
protected  void removeOutliers()
           
 void render(Scene scene, Sensor camera, Matrix4d cameraTransformation, int width, int height, java.awt.image.ImageObserver obs)
          Renders an image of a scene.
protected  void renderLines(Antialiasing antialiasing, IntList lines, PixelwiseRenderer.Result res)
           
 void setAntialiasing(Antialiasing a)
           
 void setAutoAdjust(boolean value)
           
 void setAutoAdjustMaxValue(float value)
           
 void setBrightness(float value)
           
 void setHDR(boolean value)
           
 void setMessage(java.lang.String text, float progress)
          Show Status message.
 void setThreadCount(int value)
           
protected static int toIntColor(float r, float g, float b, float a)
           
protected static float[] toRGBA(int intColor)
           
 
Methods inherited from class de.grogra.task.Task
addSolver, finishSolve, getSolverCount, getSolvers, isSolving, isStopped, partialTaskDone, prepareSolve, removeSolver, removeSolvers, solve, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface de.grogra.ray2.Renderer
stop
 

Field Detail

antialiasing

protected Antialiasing antialiasing

ANTIALIASING

public static final java.lang.String ANTIALIASING
See Also:
Constant Field Values

AUTO_ADJUST

public static final java.lang.String AUTO_ADJUST
See Also:
Constant Field Values

AUTO_ADJUST_MAX_VALUE

public static final java.lang.String AUTO_ADJUST_MAX_VALUE
See Also:
Constant Field Values

autoAdjust

protected boolean autoAdjust

autoAdjustMaxValue

protected float autoAdjustMaxValue

brightness

protected float brightness

BRIGHTNESS

public static final java.lang.String BRIGHTNESS
See Also:
Constant Field Values

camera

protected Sensor camera

cameraTransformation

protected Matrix4d cameraTransformation

DEBUG_LINE

public static float DEBUG_LINE

DEBUG_PIXEL

public static boolean DEBUG_PIXEL

DEBUG_SUBPIXEL

public static boolean DEBUG_SUBPIXEL

DEBUG_X

public static int DEBUG_X

DEBUG_Y

public static int DEBUG_Y

hdr

protected boolean hdr

HDR

public static final java.lang.String HDR
See Also:
Constant Field Values

hdrPixels

protected float[][] hdrPixels

height

protected int height

image

protected java.awt.image.BufferedImage image

imageUpdateDistance

protected int imageUpdateDistance

imageUpdateRate

protected int imageUpdateRate

lineState

protected int[] lineState

maxValue

protected float maxValue

monitor

protected ProgressMonitor monitor

observer

protected java.awt.image.ImageObserver observer

originalScene

protected Scene originalScene

RAYPROCESSOR

public static final java.lang.String RAYPROCESSOR
See Also:
Constant Field Values

REMOVE_OUTLIERS

public static final java.lang.String REMOVE_OUTLIERS
See Also:
Constant Field Values

removeOutliers

protected boolean removeOutliers

renderedLines

protected int renderedLines

rgbaPixels

protected int[] rgbaPixels

seed

protected long seed

SEED

public static final java.lang.String SEED
See Also:
Constant Field Values

THREAD_COUNT

public static final java.lang.String THREAD_COUNT
See Also:
Constant Field Values

threadCount

public int threadCount

width

protected int width
Constructor Detail

PixelwiseRenderer

public PixelwiseRenderer()
Method Detail

createLocalSolver

public Solver createLocalSolver(boolean sameThread)

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

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?

getAdjustFactor

public float getAdjustFactor()

getAutoAdjust

public boolean getAutoAdjust()

getBooleanOption

public boolean getBooleanOption(java.lang.String key,
                                boolean def)

getBrightness

public float getBrightness()

getCamera

public Sensor getCamera()

getCameraTransformation

public Matrix4d getCameraTransformation()

getClassOption

public java.lang.Object getClassOption(java.lang.String key,
                                       java.lang.Object def)

getNumericOption

public java.lang.Number getNumericOption(java.lang.String key,
                                         java.lang.Number def)

getScene

public Scene getScene()

getSeed

public long getSeed()

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)

luminance

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

merge

public void merge(PixelwiseRenderer.Result res)

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

removeOutliers

protected void removeOutliers()

render

public void render(Scene scene,
                   Sensor camera,
                   Matrix4d cameraTransformation,
                   int width,
                   int height,
                   java.awt.image.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

renderLines

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

setAntialiasing

public void setAntialiasing(Antialiasing a)

setAutoAdjust

public void setAutoAdjust(boolean value)

setAutoAdjustMaxValue

public void setAutoAdjustMaxValue(float value)

setBrightness

public void setBrightness(float value)

setHDR

public void setHDR(boolean value)

setMessage

public void setMessage(java.lang.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

setThreadCount

public void setThreadCount(int value)

toIntColor

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

toRGBA

protected static float[] toRGBA(int intColor)