Rendu
A lightweight rendering engine for experimentations
Loading...
Searching...
No Matches
Intersection.hpp
1#pragma once
2#include "resources/Mesh.hpp"
3#include "Common.hpp"
4
5
10struct Ray {
11 const glm::vec3 pos;
12 const glm::vec3 dir;
13 const glm::vec3 invdir;
14
19 Ray(const glm::vec3 & origin, const glm::vec3 & direction);
20};
21
22
28
29public:
30
40 static bool sphere(const glm::vec3 & rayOrigin, const glm::vec3 & rayDir, float radius, glm::vec2 & roots);
41
49 static bool box(const Ray & ray, const BoundingBox & box, float mini, float maxi);
50
51};
Represent the smallest axis-aligne box containing a given object or region of space.
Definition: Bounds.hpp:28
Provide helpers for basic analytic intersections.
Definition: Intersection.hpp:27
static bool sphere(const glm::vec3 &rayOrigin, const glm::vec3 &rayDir, float radius, glm::vec2 &roots)
Definition: Intersection.cpp:7
static bool box(const Ray &ray, const BoundingBox &box, float mini, float maxi)
Definition: Intersection.cpp:22
Represent a ray, shot from a given position in a specific direction.
Definition: Intersection.hpp:10
const glm::vec3 invdir
Ray reciprocal direction (normalized).
Definition: Intersection.hpp:13
const glm::vec3 pos
Ray position.
Definition: Intersection.hpp:11
const glm::vec3 dir
Ray direction (normalized).
Definition: Intersection.hpp:12