Package rendering

Class Renderer

java.lang.Object
rendering.Renderer
All Implemented Interfaces:
Task

public class Renderer
extends java.lang.Object
implements Task
This class is responsible for communicating between a RayTracer and an ImageWriter.
  • Constructor Summary

    Constructors
    Constructor Description
    Renderer​(Camera camera, RayTracer rayTracer, java.lang.String filename, int threads)
    Construct a renderer with the provided data.
  • Method Summary

    Modifier and Type Method Description
    void render()
    Calculates the colours of each pixel, write them to the ImageWriter, then write the image to the output file.
    void task()
    The task to be performed.
    java.util.List<TaskTracker> taskTrackers()
    Get a list of all registered TaskTrackers.
    int totalJobs()
    Get the total number of jobs to be performed.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface cli.Task

    completeJobs, finished, performTask, register, start
  • Constructor Details

    • Renderer

      public Renderer​(Camera camera, RayTracer rayTracer, java.lang.String filename, int threads)
      Construct a renderer with the provided data.
      Parameters:
      camera - The camera to use to render the scene.
      rayTracer - The rayTracer to use to calculate the colour of each pixel.
      filename - The filename to write the rendered image to.
      threads - The number of threads to use to render the image.
  • Method Details

    • render

      public void render()
      Calculates the colours of each pixel, write them to the ImageWriter, then write the image to the output file.
    • task

      public void task()
      Description copied from interface: Task
      The task to be performed. This function will be called by Task.performTask().
      Specified by:
      task in interface Task
    • taskTrackers

      public java.util.List<TaskTracker> taskTrackers()
      Description copied from interface: Task
      Get a list of all registered TaskTrackers.
      Specified by:
      taskTrackers in interface Task
      Returns:
      A list of all registered TaskTrackers.
    • totalJobs

      public int totalJobs()
      Description copied from interface: Task
      Get the total number of jobs to be performed.
      Specified by:
      totalJobs in interface Task
      Returns:
      The total number of jobs to be performed.