Class RayTracerUniformSuperSampler

java.lang.Object
  extended by RayTracer
      extended by RayTracerUniformSuperSampler

public class RayTracerUniformSuperSampler
extends RayTracer

Implements a ray tracer that provides uniform super-sampling. The grid size determines how many rays are cast per pixel. A value of 1 will cast one ray at the center of the pixel. A value of 2 will split the pixel into a 2x2 grid and cast four rays. A value of 3 splits the pixel into a 3x3 grid, and so on.


Constructor Summary
RayTracerUniformSuperSampler(Scene scene, int gridSize)
          Constructs a uniform super-sampling ray tracer.
 
Method Summary
 void calculateSamplingInfo(javax.vecmath.Point3d pixel)
          An abstract method for calculating the initial position the ray is cast through.
 javax.vecmath.Color3f samplePixel(javax.vecmath.Point3d startPixel, javax.vecmath.Vector3d widthStep, javax.vecmath.Vector3d heightStep)
          An abstract method to sample a pixel.
 
Methods inherited from class RayTracer
getBufferedImage, getPixelsShaded, getProgress, getScene, render
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RayTracerUniformSuperSampler

public RayTracerUniformSuperSampler(Scene scene,
                                    int gridSize)
Constructs a uniform super-sampling ray tracer.

Parameters:
scene - The scene to render.
gridSize - The size of the grid to super-sample with.
Method Detail

calculateSamplingInfo

public void calculateSamplingInfo(javax.vecmath.Point3d pixel)
Description copied from class: RayTracer
An abstract method for calculating the initial position the ray is cast through. This point will be used as the base point to step through all the pixels in the viewport.

Parameters:
pixel - The point that will contain the initial pixel position.

samplePixel

public javax.vecmath.Color3f samplePixel(javax.vecmath.Point3d startPixel,
                                         javax.vecmath.Vector3d widthStep,
                                         javax.vecmath.Vector3d heightStep)
Description copied from class: RayTracer
An abstract method to sample a pixel.

Parameters:
startPixel - The pixel to be sampled.
widthStep - The width of the pixel.
heightStep - The height of the pixel.
Returns:
The color sampled from the specified pixel.