raytracer/include/objects.hpp

39 lines
1.1 KiB
C++

#pragma once
#include "./vec.hpp"
#include "./raytrace.hpp"
#include <stdio.h>
struct Plane : Renderable {
v3 n;
choice_t offset;
int surface_type;
Plane(const v3& n, choice_t offset, const Material& specs, int surface_type);
Plane(const v3& n, choice_t offset, const Material& specs);
inline v3 normal(const v3& _) { return n; }
int intersect(const v3& eye, const v3& dir, choice_t& hit_dist, v3& hit_loc, v3& hit_normal) override;
};
struct Sphere : Renderable {
v3 o;
choice_t r;
int surface_type;
Sphere(const v3& origin, choice_t r, const Material& specs, int surface_type);
Sphere(const v3& origin, choice_t r);
inline v3 normal(const v3& xyz) const { return (xyz - o).norm(); }
int intersect(const v3& eye, const v3& dir, choice_t& hit_dist, v3& hit_loc, v3& hit_normal) override;
int transmit(const v3& eye, const v3& dir, choice_t& hit_dist, v3& hit_loc, v3& hit_normal) override;
};
struct Light : Sphere {
Light(const v3& origin, choice_t r, const v3& colour);
Light(const v3& origin, choice_t r, const Material& specs);
};