Prep - Lab 2

Due: Sunday, Apr 18th 2020

Start Early!!!


Individual Effort:
No team participation is really encouraged in the case of the homework or the labs.
You're are allowed to use any library to parse the xml files and read/write PNG files. No other libraries are allowed.

Objectives:

Creating a basic structure for your Raytracer.


Goals:

Read specifications for the Raytracer, so you get a better overview of the necessary parameters and have more time working on the actual renderer later on.


Tasks:

Write a XML parser in Java or C++ with an XML library of your choice. Please use gradle for Java (at least Java 6) and cmake/make for C++ (clang or gcc). (Write down in the readme of your submission how to compile and run your program)


XML Parsing

Your parser should be able to read our xml based input file format:
Input file specification

Your submission should be able to parse the following files
example1.xml example2.xml example3.xml

The file to process will be passed as a command line argument: Example:
./program Downloads/example3.xml
The above command should output the parsed content of the file. Your output should look like this ( doesn't have to match exactly, but you have to print out at least all the information):
outputFile: example3.png

camera
position: Vec3[0.0, 0.0, 1.0]
lookat: Vec3[0.0, 0.0, -2.5]
up: Vec3[0.0, 1.0, 0.0]
horizontalFOV: 45
maxBounces: 8

ambientLights
color: Color[1.0, 1.0, 1.0]

parallelLights
color: Color[1.0, 1.0, 1.0]
direction: Vec3[0.0, -1.0, -0.25]

surfaces

sphere:
position: Vec3[-2.1, 2.0, -3.0]
materialSolid:
color: Color[0.17, 0.18, 0.5]
phong: Phong{ka=0.3, kd=0.9, ks=1.0, exponent=200}
reflectance: 0.0
transmittance: 0.0
refraction: 2.3

sphere:
position: Vec3[0.0, 2.0, -3.0]
materialSolid:
color: Color[0.5, 0.17, 0.18]
phong: Phong{ka=0.3, kd=0.9, ks=1.0, exponent=200}
reflectance: 0.0
transmittance: 0.0
refraction: 2.3

sphere:
position: Vec3[2.1, 2.0, -3.0]
materialSolid:
color: Color[0.18, 0.5, 0.17]
phong: Phong{ka=0.3, kd=0.9, ks=1.0, exponent=200}
reflectance: 0.0
transmittance: 0.0
refraction: 2.3

sphere:
position: Vec3[0.0, -2.0, -5.0]
materialSolid:
color: Color[0.48, 0.5, 0.17]
phong: Phong{ka=0.3, kd=0.9, ks=1.0, exponent=200}
reflectance: 0.0
transmittance: 0.0
refraction: 2.3
    

Submission


Grading Criteria

Grading the labs will be based on the following:

In order to get a full mark, you need to do all of the assigned tasks AND adhere to to lab procedures while creating readable and efficient code. I.e. if you accomplish only 70% of the tasks correctly, but you do not adhere to lab procedures, your final mark will be 70*(1-0.05) = 66.5%.