toytracer/material.h

34 lines
701 B
C
Raw Normal View History

#ifndef MATERIAL_H
#define MATERIAL_H
#include "hittable.h"
#include "vec3.h"
struct hit_record;
class Material {
public:
virtual bool scatter(const Ray& r_in, const hit_record& rec, Color& attenuation, Ray& scattered) const = 0;
};
class Lambertian : public Material {
public:
Lambertian(const Color& a) : albedo(a) {}
virtual bool scatter(const Ray& r_in, const hit_record& rec, Color& attenuation, Ray& scattered) const;
private:
Color albedo;
};
class Metal : public Material {
public:
Metal(const Color& a) : albedo(a) {}
virtual bool scatter(const Ray& r_in, const hit_record& rec, Color& attenuation, Ray& scattered) const;
private:
Color albedo;
};
#endif // MATERIAL_H