3#include <torch/extension.h>
10extern torch::Tensor
intersectsAny(OptixAccelStructureWrapperCPP as,
11 const torch::Tensor &origins,
12 const torch::Tensor &dirs);
14 const torch::Tensor &origins,
15 const torch::Tensor &dirs);
16extern std::tuple<torch::Tensor, torch::Tensor, torch::Tensor, torch::Tensor,
19 torch::Tensor directions);
21 torch::Tensor origins,
22 torch::Tensor directions);
23extern std::tuple<torch::Tensor, torch::Tensor, torch::Tensor>
25 torch::Tensor directions);
32 pybind11::class_<hmesh::OptixAccelStructureWrapperCPP>(
33 m,
"OptixAccelStructureWrapperCPP")
34 .def(pybind11::init<>())
35 .def(
"buildAccelStructure",
37 .def(
"freeAccelStructure",
42 "Create Optix context");
44 "Create Optix module");
46 "Create Optix pipelines for each function type.");
47 m.def(
"buildSBT", &
hmesh::buildSBT,
"Build SBT for each function type.");
49 "Find out if each ray hit any triangle on the mesh.");
51 "Find the index of the first triangle a ray hits.");
53 "Find if ray hits any triangle and return ray index, triangle index, "
54 "hit location and uv.");
56 "Find the intersection count.");
58 "Find all intersection locations.");
PYBIND11_MODULE(TORCH_EXTENSION_NAME, m)
std::tuple< torch::Tensor, torch::Tensor, torch::Tensor > intersectsLocation(OptixAccelStructureWrapperCPP as, torch::Tensor origins, torch::Tensor directions)
torch::Tensor intersectsFirst(OptixAccelStructureWrapperCPP as, const torch::Tensor &origins, const torch::Tensor &dirs)
std::tuple< torch::Tensor, torch::Tensor, torch::Tensor, torch::Tensor, torch::Tensor > intersectsClosest(OptixAccelStructureWrapperCPP as, torch::Tensor origins, torch::Tensor directions)
Find if ray hits any triangle and return ray index, triangle index, hit location and uv.
void createOptixContext()
torch::Tensor intersectsCount(OptixAccelStructureWrapperCPP as, torch::Tensor origins, torch::Tensor directions)
torch::Tensor intersectsAny(OptixAccelStructureWrapperCPP as, const torch::Tensor &origins, const torch::Tensor &dirs)
void buildAccelStructure(torch::Tensor vertices, torch::Tensor faces)
void freeAccelStructure()