Njord201/Raytracer

Parse the configuration file !

Closed this issue · 0 comments

I've to implement the parsing system of the external file !

To do it i'm going to use the libconfig++ library!

Here is an example of a scene file using libconfig++ file format:

Configuration of the camera

camera :
{
resolution = { width = 1920; height = 1080; };
position = { x = 0; y = -100; z = 20; };
rotation = { x = 0; y = 0; z = 0; };
fieldOfView = 72.0; # In degree
};

Primitives in the scene

primitives :
{
// List of spheres
spheres = (
{ x = 60; y = 5; z = 40; r = 25; color = { r = 255; g = 64; b = 64; }; } ,
{ x = -40; y = 20; z = -10; r = 35; color = { r = 64; g = 255; b = 64; }; }
) ;

    // List of planes
    planes = (
            { axis = " Z " ; position = -20; color = { r = 64; g = 64; b = 255; }; }
    ) ;

};

Light configuration

lights :
{
ambient = 0.4; # Multiplier of ambient light
diffuse = 0.6; # Multiplier of diffuse light

    # List of point lights
    point = (
         { x = 400; y = 100; z = 500;};
    ) ;

    # List of directional lights
    directional = () ;

};