Hello,
I am using the nanort for generating a depth map. I want to implement RGB color of the vertices in this too (in my function nanort::TriangleIntersector<>). Can I extract the color of vertices from nanort and add it to this function. Below is the code I have developed. Thanks.
`
void RTracer::construct_scene(const ShapeIO& shio,
const pcl::PointCloud::Ptr cloud)
{
const pcl::PolygonMesh& pmesh = shio.mesh();
Hello, I am using the nanort for generating a depth map. I want to implement RGB color of the vertices in this too (in my function nanort::TriangleIntersector<>). Can I extract the color of vertices from nanort and add it to this function. Below is the code I have developed. Thanks. ` void RTracer::construct_scene(const ShapeIO& shio, const pcl::PointCloud::Ptr cloud)
{
const pcl::PolygonMesh& pmesh = shio.mesh();
if 0
endif
}
// // \brief Cast a ray and return the distance to mesh collision // returns 0 in case of no collision // float RTracer::cast_ray(float viewpoint[3], float viewdir[3]) const { nanort::Ray ray;
// compiler converts float[3] in argument to float
// casting float to float[3] afterwards violates some dumb ISO rule
// workaround to disabling -fpermissive
std::memcpy(ray.org, viewpoint, sizeof(float) 3);
std::memcpy(ray.dir, viewdir, sizeof(float) 3);
ray.min_t = 0.0f;
ray.max_t = 2RADIUS;
nanort::TriangleIntersector<> intersector(vertices.data(),
faces.data(),
3 sizeof(float));
nanort::TriangleIntersection<> hit;
bool did_hit = bvh.Traverse(ray, intersector, &hit);
return did_hit ? hit.t : 0.0;
}`