-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRayCaster.h
More file actions
53 lines (45 loc) · 2.4 KB
/
RayCaster.h
File metadata and controls
53 lines (45 loc) · 2.4 KB
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
48
49
50
51
52
53
//
// Created by Bray, Matthew D ERDC-RDE-GSL-MS CIV on 11/13/22.
//
#ifndef RAYCASTER_RAYCASTER_H
#define RAYCASTER_RAYCASTER_H
#include "Camera.h"
#include "Canvas.h"
#include "Computation.h"
#include "Intersection.h"
#include "MathUtils.h"
#include "Ray.h"
#include "Sphere.h"
#include "World.h"
#include <Eigen/Core>
// #include <Eigen/Geometry>
#include <vector>
#include <iostream>
#include <future>
using Vector4f = Eigen::Vector4f;
struct PointLight;
struct Light;
std::vector<Intersection> intersect_world(const World& world, const Ray& ray);
Vector4f normal_at(const Sphere* sphere, const Vector4f& world_point);
Vector4f reflect(const Vector4f& in, const Vector4f& normal);
Intersection hit(std::vector<Intersection> intersections);
Color lighting(const Material& material, const Shape* shape, const Light& light, const Vector4f& position, const Vector4f& eye, const Vector4f& normal, const float intensity);
bool is_shadowed(const World& world, const Vector4f& light_position, const Vector4f& point);
Computation prepare_computations(const Intersection& intersection, const Ray& ray, const std::vector<Intersection>& intersections = {});
Color shade_hit(const World& world, const Computation& comps, const int remaining=4);
Color color_at(const World& world, const Ray& ray, const int remaining=4);
Color reflected_color(const World& world, const Computation& comps, const int remaining=4);
Color refracted_color(const World& world, const Computation& comps, const int remaining=4);
float schlick(const Computation& comps);
Ray ray_for_pixel(const Camera& camera, const int px, const int py, const float x_offset=0.0f, const float y_offset=0.0f);
Canvas render(const Camera& camera, const World& world);
Canvas render_whitted_norecurs(const Camera& camera, const World& world);
Canvas render_stratified_jittering(const Camera& camera, const World& world, const bool multiprocessing=false);
Canvas render_aa(const Camera& camera, const World& world);
// float intensity_at(const Light* light, const Vector4f& point, const World& world);
float intensity_at_pointlight(const PointLight& light, const Vector4f& point, const World& world);
float intensity_at_arealight(const AreaLight& light, const Vector4f& point, const World& world);
Vector4f point_on_light(const AreaLight& light, const float u, const float v);
// ostream for LightType
std::ostream& operator<<(std::ostream& os, const LightType& type);
#endif //RAYCASTER_RAYCASTER_H