Open
Description
Hi Will,
I tried to integrate your library to my renderer, but I have some issue with lifetime definition. Indeed, I want to "encapsulate" some embree_rs objects inside a single struct to make my code modular (code example below).
pub struct EmbreeAcceleration<'device, 'scene> {
pub device: embree_rs::Device,
pub scene: embree_rs::Scene<'device>,
pub rtscene: embree_rs::CommittedScene<'scene>,
pub trimesh: Vec<embree_rs::TriangleMesh<'device>>
}
impl<'device, 'scene> EmbreeAcceleration<'device, 'scene> {
pub fn new(meshes: &Vec<geometry::Mesh>) -> Self {
let device = embree_rs::Device::new();
let scene = embree_rs::Scene::new(&device);
let mut trimesh = vec![];
for m in meshes {
// TODO: Create trimesh and register it
unimplemented!()
}
let rtscene = scene.commit();
EmbreeAcceleration {
device,
scene,
rtscene,
trimesh,
}
}
}
Note that the code above does not compile. Have you tried to do a similar thing with this library in one of your projects? If you know a solution, it will be much appreciated 😄
Cheers,
Adrien
Metadata
Metadata
Assignees
Labels
No labels