-
Notifications
You must be signed in to change notification settings - Fork 0
/
RayTracer.h
executable file
·41 lines (30 loc) · 1.14 KB
/
RayTracer.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#ifndef RAYTRACERH
#define RAYTRACERH
#include "algebra3.h"
#include "Scene.h"
#include "Ray.h"
#include "Primitives.h"
#include "IntersectRecord.h"
/* Raytracer objects trace viewing rays into the
scene in order to determine sample color. */
class RayTracer {
private:
/* Instance vars */
Scene* tracingScene; // Scene into which to trace rays
unsigned int recursionDepth; // Maximum # of ray bounces
double rayBias; // tMin for shadow/bounce rays
double shadowBias;
/* Instance methods */
rgb trace(Ray& ray, unsigned int depth);
bool traceShadowRay(Ray& ray);
rgb shadeIntersection(const IntersectRecord& intersection, Ray& ray, unsigned int depth);
rgb diffComp(const IntersectRecord& intersection, const vec3& incidence, const rgb& color);
rgb specComp(const IntersectRecord& intersection, const vec3& incidence, const rgb& color, Ray& viewRay);
bool refract(Ray& ray, const IntersectRecord& intersect, double oldIndex, double newIndex, vec3& refractDirection);
public:
/* Constructors */
RayTracer(Scene* scene, unsigned int depth, double bias);
/* Instance methods */
rgb traceViewingRay(Ray& ray);
};
#endif