Files
dorayme/source/include/material.h
Godzil 75cf59cc1a Adding support for pattern.
Still a bit more work to be done there.
2020-02-21 09:36:34 +00:00

43 lines
1.2 KiB
C++

/*
* DoRayMe - a quick and dirty Raytracer
* Material header
*
* Created by Manoël Trapier
* Copyright (c) 2020 986-Studio.
*
*/
#ifndef DORAYME_MATERIAL_H
#define DORAYME_MATERIAL_H
#include <tuple.h>
#include <colour.h>
#include <pattern.h>
#include <light.h>
class Shape;
class Material
{
public:
Colour colour;
double ambient;
double diffuse;
double specular;
double shininess;
Pattern *pattern;
public:
Material() : colour(Colour(1, 1, 1)), ambient(0.1), diffuse(0.9), specular(0.9), shininess(200), pattern(nullptr) {};
Colour lighting(Light light, Tuple point, Tuple eyeVector, Tuple normalVector, Shape *hitObject, bool inShadow = false);
bool operator==(const Material &b) const { return double_equal(this->ambient, b.ambient) &&
double_equal(this->diffuse, b.diffuse) &&
double_equal(this->specular, b.specular) &&
double_equal(this->shininess, b.shininess) &&
(this->colour == b.colour); };
};
#endif /* DORAYME_MATERIAL_H */