-
Notifications
You must be signed in to change notification settings - Fork 0
/
Collision.h
35 lines (28 loc) · 1.13 KB
/
Collision.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
#ifndef _COLLISION_H_
#define _COLLISION_H_
// GL
#include "GLInclude.h"
// Engine
#include "Material.h"
////////////////////////////////////////////////////////////////////////////////
/// @brief Information of a collision
////////////////////////////////////////////////////////////////////////////////
struct Collision {
//////////////////////////////////////////////////////////////////////////////
/// @brief Type of a collision, i.e., hit or miss.
//////////////////////////////////////////////////////////////////////////////
enum class Type {
kMiss = 0, ///< No collision
kHit ///< Collision
};
// Constructors
Collision() : m_type(Type::kMiss), m_t(0){};
Collision(const glm::vec3& _x, const glm::vec3& _n, const Material* _m, float _t) :
m_type(Type::kHit), m_x{_x}, m_normal{_n}, m_material{_m}, m_t(_t){};
Type m_type; ///< Type of collision object
glm::vec3 m_x; ///< Point of collision
glm::vec3 m_normal; ///< Normal at collision
const Material* m_material; ///< Material of surface
float m_t; // parameter t on the ray
};
#endif