GitHub Classroom Input Files Output Files Grade Server


Throughout this quarter you will implement the basic functions of a distribution ray tracer. This software will be enhanced throughout the quarter, thus this initial assignment will serve as the base for following assignments. Since you will be adding and reusing your code, it is advised that you write your code in a clean, structured object-oriented fashion. All code must be written in C++.

The GitHub Classroom page for this assignment can be found here.

Input files for all stages of the project can be found here.

Test files (arguments and expected output) for all stages of the project can be found here.

CMakeLists.txt template for use in compiling your C++ code.



Project Turn-In

Use of a version control system is mandatory for this project and is how I will be collecting your source code for grading. In particular, we will be using GitHub Classroom.

Continuous Integration

We will have a class continuous integration server that builds and tests your programs. The server runs on an hourly basis and uses access to your hosted repositories. There are two primary benefits provided by this server:

  1. Resolve build issues early on - it’s always a nightmare trying to get everyone’s code to build on my machine
  2. Detect cross-platform runtime issues


You have the option of using either a CMake or Make build. If you provide neither a CMakeLists.txt or Makefile in your repository, the server will attempt to run a command similar to:

g++ src/*.cpp

This will sometimes work but it is highly recommended that you provide a CMakeLists.txt or a Makefile.

Later in the quarter I might revoke the option to use a Makefile and require everyone to provide a CMakeLists.txt

Directory Structure

The directory structure of your project may vary depending on your build system, but it should generally look something like this:

├── CMakeLists.txt
├── resources
│   ├── planes.pov
│   ├── simple.pov
│   ├── spheres.pov
│   └── ugly.pov
└── src
    ├── Camera.cpp
    ├── Camera.h
    ├── ... etc
    └── stb_image_write.h

If you’re using a CMake build, I will execute these commands to run your program:

> cd build/
> cmake ..
> raytrace render /long/absolute/path/to/simple.pov 640 480

As such you should not make assumptions about where the simple.pov etc. files will be, but just use the path as specified.

That means that when you are testing your program locally, assuming a CMake build, you’ll do something like this:

> raytrace render ../resources/simple.pov 640 480

Or better yet, you can simply clone the input files repository to your home directory, then do:

> raytrace render ~/csc473-inputfiles/p1/simple.pov 640 480


In order to match my output exactly for the different test input/output files, you will need to use std::ios::fixed and std::setprecision along with cout. For, example:

    cout << std::setiosflags(std::ios::fixed);
    cout << std::setprecision(4);
    cout << "Pixel: [" << X << ", " << Y << "] Ray: " << Ray << endl;

Also, when converting the float color values to 0-255 ints (which you should do as the last step before printing out or writing out pixel colors), you will need to round:

unsigned int red = (unsigned int) std::round(color.r * 255.f);
unsigned int green = (unsigned int) std::round(color.g * 255.f);
unsigned int blue = (unsigned int) std::round(color.b * 255.f);

Image Output

Image files should be output as png files. Use stb_image_write.h to produce your output images unless you have a strong inclination to use some other library. Name the output file “output.png” and create it in the current directory (where the executable is run). See the C++ snippets reference for an example of how to write an image using stb_image_write.