C++绘制点云
osg::Geode* pcd_geode = new osg::Geode(); //几何体 osg::Geometry* pcd_geometry = new osg::Geometry(); for (int k = 0; k < list_dall_data.size(); k++) { PTSData* indexPTSObj = list_dall_data.at(k); int w = indexPTSObj->getW(); int h = indexPTSObj->getH(); double x = indexPTSObj->getX(); double y = indexPTSObj->getY(); double z = indexPTSObj->getZ(); int r = indexPTSObj->getR(); int g = indexPTSObj->getG(); int b = indexPTSObj->getB(); coord->at(k) = osg::Vec3(x, y, z); //颜色 colors->at(k) = osg::Vec4(((float)(r)) / 255, ((float)(g)) / 255, ((float)(b)) / 255, 1.0f); } //设置顶点的关联方式 pcd_geometry->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::POINTS, 0, points)); pcd_geode->addDrawable(pcd_geometry);
############################