-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSI_RayTracing.h
26 lines (19 loc) · 969 Bytes
/
SI_RayTracing.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
#pragma once
#include <optional>
struct Vector3;
struct World;
struct LightSource;
struct RayHit;
struct ReflectionHit;
// S'il existe, retourner l'objet le plus proche touché par un rayon
std::optional<RayHit> GetNearestHit(const std::vector<Shape*>& shapes, const Ray& ray);
// Vérifie si aucun objet bloque la trajectoire de la lumière avec la surface
bool IsVisibleByLight(const RayHit& rayHit, const World& world);
// Quantité de lumière perçue par une surface
float GetOutgoingLightFor(const RayHit& ray, const LightSource& lightSource);
// Retourne le rayon réfléchis par la surface (externe)
Ray GetReflectRay(const Vector3& incident, const RayHit& rayHit);
// Calcule la direction de réfraction
std::optional<Vector3> CalculateRefractionDirection(const Vector3& incident, const Vector3& normal);
// Récupère l'intensité de lumière à partir d'un rayon
Vector3 GetRadiance(const Ray& ray, const World& world, int& currentDepth);