~ | BVH sent to gpu

This commit is contained in:
TheRedShip
2025-01-17 16:27:39 +01:00
parent 6f80a66550
commit 6fdea11adb
14 changed files with 359 additions and 46 deletions

View File

@ -53,11 +53,11 @@ bool Scene::parseScene(char *name)
}
file.close();
//bvh
BVH *bvh = new BVH(_gpu_objects, 0, _gpu_objects.size());
bvh->showAABB(this);
// addObject(new Cube((bvh->getAABB().max + bvh->getAABB().min) / 2.0f, bvh->getAABB().max - bvh->getAABB().min, 7));
//
BVH *bvh = new BVH(_gpu_objects, 0, _gpu_objects.size());
_gpu_bvh = bvh->getGPUBvhs();
// bvh->showAABB(this);
return (true);
}
@ -162,27 +162,32 @@ void Scene::updateLightAndObjects(int mat_id)
}
}
std::set<int> Scene::getGPULights()
std::set<int> Scene::getGPULights()
{
return (_gpu_lights);
}
const std::vector<GPUObject>& Scene::getObjectData() const
const std::vector<GPUObject> &Scene::getObjectData() const
{
return (_gpu_objects);
}
std::vector<GPUMaterial>& Scene::getMaterialData()
std::vector<GPUMaterial> &Scene::getMaterialData()
{
return (_gpu_materials);
}
GPUVolume &Scene::getVolume()
GPUVolume &Scene::getVolume()
{
return (_gpu_volume);
}
Camera *Scene::getCamera(void) const
std::vector<GPUBvh> &Scene::getBVH()
{
return (_gpu_bvh);
}
Camera *Scene::getCamera(void) const
{
return (_camera);
}
@ -192,4 +197,4 @@ GPUMaterial Scene::getMaterial(int material_index)
if (material_index < 0 || material_index >= (int)_gpu_materials.size())
throw std::runtime_error("Incorrect material index");
return (_gpu_materials[material_index]);
}
}