mirror of
https://github.com/TheRedShip/RT_GPU.git
synced 2025-09-27 10:48:34 +02:00
+ | BVH Working
This commit is contained in:
@ -3,10 +3,10 @@
|
||||
/* ::: :::::::: */
|
||||
/* BVH.hpp :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: TheRed <TheRed@students.42.fr> +#+ +:+ +#+ */
|
||||
/* By: ycontre <ycontre@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/01/16 21:36:19 by TheRed #+# #+# */
|
||||
/* Updated: 2025/01/16 21:36:19 by TheRed ### ########.fr */
|
||||
/* Updated: 2025/01/17 18:59:28 by ycontre ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -30,13 +30,13 @@ struct AABB
|
||||
class BVH
|
||||
{
|
||||
public:
|
||||
BVH(std::vector<GPUObject> primitives, int first_primitive, int primitive_count);
|
||||
BVH(std::vector<GPUObject> &primitives, int first_primitive, int primitive_count);
|
||||
|
||||
|
||||
void showAABB(Scene *scene);
|
||||
|
||||
void updateBounds(std::vector<GPUObject> primitives);
|
||||
void subdivide(std::vector<GPUObject> primitives);
|
||||
void updateBounds(std::vector <GPUObject> &primitives);
|
||||
void subdivide(std::vector<GPUObject> &primitives);
|
||||
|
||||
int size();
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* By: ycontre <ycontre@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/12/23 19:12:51 by ycontre #+# #+# */
|
||||
/* Updated: 2025/01/13 18:43:18 by ycontre ### ########.fr */
|
||||
/* Updated: 2025/01/17 18:17:30 by ycontre ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -53,8 +53,8 @@ class Triangle : public Object
|
||||
: Object(position, mat_index), _vertex2(vertex2), _vertex3(vertex3) {
|
||||
// _vertex2 -= _position; //optimization
|
||||
// _vertex3 -= _position; //optimization
|
||||
|
||||
_normal = glm::normalize(glm::cross(_vertex2, _vertex3)); //optimization
|
||||
|
||||
_normal = glm::normalize(glm::cross(_vertex2 - _position, _vertex3 - _position)); //optimization
|
||||
}
|
||||
|
||||
const glm::vec3 &getVertex2() const { return (_vertex2); }
|
||||
|
Reference in New Issue
Block a user