mirror of
https://github.com/TheRedShip/RT_GPU.git
synced 2025-09-27 18:48:36 +02:00
+ | Some opti
This commit is contained in:
@ -6,7 +6,7 @@
|
||||
/* By: ycontre <ycontre@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/12/23 18:30:18 by ycontre #+# #+# */
|
||||
/* Updated: 2025/01/19 18:46:38 by ycontre ### ########.fr */
|
||||
/* Updated: 2025/01/23 18:30:18 by ycontre ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -89,6 +89,7 @@ struct GPUBvh
|
||||
struct GPUBvhData
|
||||
{
|
||||
glm::mat4 transform;
|
||||
glm::mat4 inv_transform;
|
||||
alignas(16) glm::vec3 offset;
|
||||
float scale;
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* By: ycontre <ycontre@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/12/23 19:12:51 by ycontre #+# #+# */
|
||||
/* Updated: 2025/01/17 18:17:30 by ycontre ### ########.fr */
|
||||
/* Updated: 2025/01/23 19:39:33 by ycontre ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -42,21 +42,23 @@ class Triangle : public Object
|
||||
_vertex2 = glm::vec3(x2, y2, z2);
|
||||
_vertex3 = glm::vec3(x3, y3, z3);
|
||||
|
||||
// _vertex2 -= _position; //optimization
|
||||
// _vertex3 -= _position; //optimization
|
||||
|
||||
_normal = glm::normalize(glm::cross(_vertex2 - _position, _vertex3 - _position)); //optimization
|
||||
_centroid = (_position + _vertex2 + _vertex3) / 3.0f;
|
||||
|
||||
// _vertex2 -= _position; //optimization
|
||||
// _vertex3 -= _position; //optimization
|
||||
|
||||
_mat_index = mat_index;
|
||||
}
|
||||
Triangle(const glm::vec3& position, const glm::vec3& vertex2, const glm::vec3& vertex3, const int mat_index)
|
||||
: Object(position, mat_index), _vertex2(vertex2), _vertex3(vertex3) {
|
||||
// _vertex2 -= _position; //optimization
|
||||
// _vertex3 -= _position; //optimization
|
||||
|
||||
_normal = glm::normalize(glm::cross(_vertex2 - _position, _vertex3 - _position)); //optimization
|
||||
_centroid = (_position + _vertex2 + _vertex3) / 3.0f;
|
||||
|
||||
// _vertex2 -= _position; //optimization
|
||||
// _vertex3 -= _position; //optimization
|
||||
}
|
||||
|
||||
const glm::vec3 &getVertex2() const { return (_vertex2); }
|
||||
|
Reference in New Issue
Block a user