-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathraytracer.h
47 lines (36 loc) · 1.28 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
42
43
44
45
46
47
#ifndef RAYTRACER_H_
#define RAYTRACER_H_
#pragma once
#include <vector>
#include "color.h"
#include "ppm.h"
#include "utils.h"
namespace raytracer {
class RayTracer {
public:
RayTracer(int width, int height);
~RayTracer();
void Render(const Scene& scene);
int width_;
int height_;
PpmFile image_;
private:
std::vector<ISect> GetIntersections(const Ray& ray, const Scene& scene) const;
double CastTestRay(const Ray& ray, const Scene& scene) const;
Color TraceRay(const Ray& ray, const Scene& scene, int depth) const;
Color GetNaturalColor(const SceneObject& thing, const Vector3& pos,
const Vector3& normal, const Vector3& rd,
const Scene& scene) const;
Color GetReflectionColor(const SceneObject& thing, const Vector3& pos,
const Vector3& rd, const Scene& scene,
int depth) const;
Color Shade(const ISect& isect, const Scene& scene, int depth) const;
double RecenterX(double x) const;
double RecenterY(double y) const;
Vector3 GetPoint(double x, double y, const Camera& camera) const;
};
inline RayTracer::RayTracer(int width, int height)
: width_(width), height_(height), image_(height_, width_) { }
inline RayTracer::~RayTracer() { }
}
#endif // RAYTRACER_H_