31 #ifndef _wrapper_collada_H_
32 #define _wrapper_collada_H_
53 #include <dom/domConstants.h>
54 #include <dom/domCOLLADA.h>
55 #include <dom/domProfile_common.h>
56 #include <dae/daeSIDResolver.h>
57 #include <dom/domInstance_controller.h>
58 #include <dae/domAny.h>
59 #include <dae/daeErrorHandler.h>
60 #include <dae/daeUtils.h>
61 #include <dom/domImage.h>
62 #include <modules/stdErrPlugin.h>
63 #include <dom/domEllipsoid.h>
64 #include <dom/domInput_global.h>
65 #include <dom/domAsset.h>
69 #include <pcl_ros/point_cloud.h>
70 #include <pcl/point_types.h>
77 using namespace ColladaDOM150;
85 root = dae.add(file_name);
86 daeElement* asset = root->add(
"asset");
88 daeElement* created = asset->add(
"created");
89 daeElement* modified = asset->add(
"modified");
90 const char* date =
"2008-04-08T13:07:52-08:00";
91 created->setCharData(date);
92 modified->setCharData(date);
95 daeElement* visualSceneLib = root->add(
"library_visual_scenes");
96 visualScene = visualSceneLib->add(
"visual_scene");
97 visualScene->setAttribute(
"id",
"defaultScene");
100 root->add(
"scene instance_visual_scene")->setAttribute(
"url",
makeUriRef(
"defaultScene").c_str());
105 void add_polygon_fixed_color(std::string polygon_name, pcl::PointCloud<pcl::PointXYZ>::Ptr cloud, pcl::PointCloud<pcl::PointXYZ>::Ptr normal,
float r,
float g,
float b,
float a);
110 add_polygon_fixed_color(polygon_name, cloud, normal, r, g, b, a);
114 pcl::PointCloud<pcl::PointXYZ> normal_flip;
116 p.x = -normal->points[0].x;
117 p.y = -normal->points[0].y;
118 p.z = -normal->points[0].z;
119 normal_flip.points.push_back(p);
122 pcl::PointCloud<pcl::PointXYZ> cloud_flip;
124 for (
int i=((
int)cloud->points.size()-1); i>=0; i--)
126 cloud_flip.points.push_back(cloud->points[i]);
130 add_polygon_fixed_color((polygon_name +
"_flip").c_str(), cloud_flip.makeShared(), normal_flip.makeShared(), r, g, b, a);
137 ROS_INFO(
"Writting collada file %s",file_name.c_str());
151 const std::string& semantic,
152 const std::string& srcID,
156 std::string
makeUriRef(
const std::string&
id);
164 const std::string& srcID,
165 const std::string& paramNames,
168 daeTArray<double> pcl_pointcloud_tp_daearray(pcl::PointCloud<pcl::PointXYZ>::Ptr pc);
169 template<
typename T_wc>
wrapper_collada(std::string fl)
void my_addVisualScene(daeElement *root)
void my_addInput(daeElement *triangles, const string &semantic, const string &srcID, int offset)
void my_addMaterial(daeElement *root)
string makeUriRef(const string &id)
void my_addSource(daeElement *mesh, const std::string &srcID, const std::string ¶mNames, domFloat values[], int valueCount)
void my_addGeometry(daeElement *root)
void add_polygon_fixed_color_on_both_sides(std::string polygon_name, pcl::PointCloud< pcl::PointXYZ >::Ptr cloud, pcl::PointCloud< pcl::PointXYZ >::Ptr normal, float r, float g, float b, float a)
void my_addEffect(daeElement *root)
void my_addImage(daeElement *root)
daeTArray< T > rawArrayToDaeArray(T rawArray[], size_t count)