diff --git a/pronto-utils/src/pronto_math/pronto_math.hpp b/pronto-utils/src/pronto_math/pronto_math.hpp index e179cb3..f99e07c 100644 --- a/pronto-utils/src/pronto_math/pronto_math.hpp +++ b/pronto-utils/src/pronto_math/pronto_math.hpp @@ -19,7 +19,7 @@ struct obj_cfg{ struct ptcld_cfg{ ptcld_cfg(int id, std::string name, int type, bool reset, - int obj_coll, bool use_rgb, std::vector rgb ): + int obj_coll, int use_rgb, std::vector rgb ): id(id), name(name), type(type), reset(reset), obj_coll(obj_coll), use_rgb(use_rgb), rgb(rgb) {} int id; @@ -32,7 +32,7 @@ struct ptcld_cfg{ //int64_t obj_id; // which object in the pose collection is it relative to | was "element_id" //float rgba[4]; - bool use_rgb; // use this single color [0] or use colors in the cloud itself [0] + int use_rgb; // [-1] send no colors and have view pick, [0] use a single color, [-1] use colors in the XYZRGB cloud itself std::vector rgb; // 3 vals 0->1 // inline specification: http://live.boost.org/doc/libs/1_36_0/libs/assign/doc/index.html }; diff --git a/pronto-utils/src/pronto_vis/pronto_vis.cpp b/pronto-utils/src/pronto_vis/pronto_vis.cpp index 6f1aec9..9b84a76 100644 --- a/pronto-utils/src/pronto_vis/pronto_vis.cpp +++ b/pronto-utils/src/pronto_vis/pronto_vis.cpp @@ -214,7 +214,11 @@ void pronto_vis::ptcld_collection_to_lcm(ptcld_cfg pcfg, std::vector< pronto::Po this_plist->npoints = npts; // 3.2: colors: vs_color_t* colors = new vs_color_t[npts]; - this_plist->ncolors = npts; + // TODO: this sends the points, but they are not used. Should avoid sending altogether + if (pcfg.use_rgb == -1) + this_plist->ncolors = 0; // have viewer pick the color + else + this_plist->ncolors = npts; // 3.3: normals: this_plist->nnormals = 0; this_plist->normals = NULL; @@ -224,7 +228,7 @@ void pronto_vis::ptcld_collection_to_lcm(ptcld_cfg pcfg, std::vector< pronto::Po float rgba[4]; for(size_t j=0; jnpoints = npts; // 3.2: colors: vs_color_t* colors = new vs_color_t[npts]; - this_plist->ncolors = npts; + + // TODO: this sends the points, but they are not used. Should avoid sending altogether + if ( pcfg.use_rgb == -1 ) + this_plist->ncolors = 0; // have the viewer choose the colors. + else + this_plist->ncolors = npts; // 3.3: normals: this_plist->nnormals = 0; this_plist->normals = NULL; @@ -297,7 +306,7 @@ void pronto_vis::ptcld_to_lcm(ptcld_cfg pcfg, pronto::PointCloud &cloud, int64_t float rgba[4]; for(int j=0; jnpointids = 0; points->pointids = NULL; - points->ncolors = N_points; vs_color_t* colors = new vs_color_t[N_points]; - points->npoints = N_points; + // TODO: this sends the points, but they are not used. Should avoid sending altogether + if ( pcfg.use_rgb == -1) + points->ncolors = 0; + else + points->ncolors = N_points; + vs_point3d_t* entries = new vs_point3d_t[N_points]; + points->npoints = N_points; points->id = i; // ... still i - not k points->collection = pcfg.obj_coll;//PoseCollID;//collection.objectCollectionId(); @@ -557,7 +571,7 @@ void pronto_vis::mesh_to_lcm(ptcld_cfg pcfg, pcl::PolygonMesh::Ptr mesh, entries[j].y =(float) tmp(1); entries[j].z =(float) tmp(2); // r,g,b: input is ints 0->255, opengl wants floats 0->1 - if ( pcfg.use_rgb){// use the rgb value + if ( pcfg.use_rgb == 1){// use the rgb value rgba[0] = pcfg.rgb[0]; rgba[1] = pcfg.rgb[1]; rgba[2] = pcfg.rgb[2];