mirror of
https://github.com/Linloir/SceneEditor.git
synced 2025-12-17 07:28:12 +08:00
[CORE][ADD] Ray Class Implementation
This commit is contained in:
parent
a924b4dd30
commit
4732c0810c
@ -1,6 +1,6 @@
|
|||||||
#include "ray.h"
|
#include "ray.h"
|
||||||
|
|
||||||
Ray Ray::toLocalSpace(glm::mat4 modelMatrix) {
|
Ray Ray::toLocalSpace(glm::mat4 modelMatrix) const {
|
||||||
// The model matrix is the matrix that transforms local space to world space
|
// The model matrix is the matrix that transforms local space to world space
|
||||||
// Therefore the inverse of the model matrix transforms world space to local space
|
// Therefore the inverse of the model matrix transforms world space to local space
|
||||||
glm::mat4 inversedModelMatrix = glm::inverse(modelMatrix);
|
glm::mat4 inversedModelMatrix = glm::inverse(modelMatrix);
|
||||||
|
|||||||
@ -4,8 +4,8 @@
|
|||||||
|
|
||||||
class Ray {
|
class Ray {
|
||||||
private:
|
private:
|
||||||
glm::vec3 _origin;
|
glm::vec3 _origin = glm::vec3(0.0f);
|
||||||
glm::vec3 _direction;
|
glm::vec3 _direction = glm::vec3(0.0f, 0.0f, -1.0f);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Ray() {}
|
Ray() {}
|
||||||
@ -15,9 +15,6 @@ public:
|
|||||||
inline glm::vec3 origin() const { return _origin; }
|
inline glm::vec3 origin() const { return _origin; }
|
||||||
inline glm::vec3 direction() const { return _direction; }
|
inline glm::vec3 direction() const { return _direction; }
|
||||||
|
|
||||||
inline void setOrigin(glm::vec3 origin) { _origin = origin; }
|
|
||||||
inline void setDirection(glm::vec3 direction) { _direction = direction; }
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Ray toLocalSpace(glm::mat4 modelMatrix);
|
Ray toLocalSpace(glm::mat4 modelMatrix) const;
|
||||||
};
|
};
|
||||||
Loading…
x
Reference in New Issue
Block a user