project: Global illumination pathtracer

Details

A simple pathtracer program, capable of producing renderings of simple bodies. The program computes global illumination, by intersecting scene objects, such as luminaries and solid bodies, with idealised surface properies.

  • last updated: August, 2018
Download source

Screenshots

scene_3smpls.bmp scene_1smpl_dark.bmp scene_30smpls.bmp

src > object.hpp

View raw
#ifndef RAYTRACER_OBJECT_HPP
#define RAYTRACER_OBJECT_HPP

#include <math.h>

#include "./vec3.hpp"
#include "./color.hpp"
#include "./ray.hpp"
#include "./material.hpp"

namespace raytracer
{

class object
{
 public:
  virtual bool intersects(const ray& ray, double& length, vec3& normal, material& material) const =0;
  const material* object_material() {return material_; };
  const vec3& pos() {return pos_; };
 protected:
  const material* material_;
  vec3 pos_;
  object() {}
  object(const material& material){
    this->material_= &material;
  }
};

}

#endif