Exemplo n.º 1
0
bool Interface::load_tex(const char *name, int idx)
{
    char fn[MAX_PATH];
    strcpy(fn, name);
    if (!strstr(name, ".png"))
    {
        strcat(fn, ".png");
    }

    Stream *str = global.fs->open(fn);
    if ((str == NULL) || (str->getFileStreamHandle() == INVALID_HANDLE_VALUE))
    {
        ERROR_MESSAGE("Interface: Doesn\'t load texture %s\n", fn);
        return false;
    }
    uint32_t sz = str->getSize();
    char buf[sz];
    str->read(buf, sz);
    delete str;

    bool ret = this->load_tex(buf, sz, idx);
#ifdef SD_DEBUG
    if (ret)
        printf("Game: Texture %s loaded\n", fn);
    else
    {
        red_color();
        printf("Game: Doesn\'t load texture %s\n", fn);
        normal_color();
    }
#endif
    return ret;
}
Exemplo n.º 2
0
void printToPCLViewer() {
    pclViewer->removeAllPointClouds();
    pcl::visualization::PointCloudColorHandlerRGBField<pcl::PointXYZRGB> rgb(cloud);
    pclViewer->addPointCloud<pcl::PointXYZRGB>(cloud,rgb,"source cloud");
    pclViewer->setPointCloudRenderingProperties (pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 1, "source cloud");
    pcl::visualization::PointCloudColorHandlerCustom<pcl::PointXYZRGB> red_color(cloud_p, 255, 0, 0);
    pclViewer->addPointCloud<pcl::PointXYZRGB>(cloud_p,red_color,"segmented cloud");
    pclViewer->setPointCloudRenderingProperties (pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 1, "segmented cloud");

}
Exemplo n.º 3
0
void PlanSegmentor::printToPCLViewer()
{
    m_pclViewer->removeAllPointClouds();
    pcl::visualization::PointCloudColorHandlerRGBField<pcl::PointXYZRGB> rgb(m_cloud);
    m_pclViewer->addPointCloud<pcl::PointXYZRGB>(m_cloud,rgb,"source cloud");
    m_pclViewer->setPointCloudRenderingProperties (pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 1, "source cloud");
    pcl::visualization::PointCloudColorHandlerCustom<pcl::PointXYZRGB> red_color(m_segmented_cloud, 255, 0, 0);
    m_pclViewer->addPointCloud<pcl::PointXYZRGB>(m_segmented_cloud,red_color,"segmented cloud");
    m_pclViewer->setPointCloudRenderingProperties (pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 1, "segmented cloud");
    pcl::visualization::PointCloudColorHandlerCustom<pcl::PointXYZRGB> blue_color(m_objects_cloud, 0, 0, 255);
    m_pclViewer->addPointCloud<pcl::PointXYZRGB>(m_objects_cloud,blue_color,"objects cloud");
    m_pclViewer->setPointCloudRenderingProperties (pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 1, "objects cloud");
}
Exemplo n.º 4
0
	void compareTwoNormals(typename pcl::PointCloud<PointT>::ConstPtr cloud1,
						   typename pcl::PointCloud<PointT>::ConstPtr cloud2,
						   const std::string &name1 = "cloud1",
						   const std::string &name2 = "cloud2")
	{
		std::cout << "compare " << name1 << " and " << name2 << std::endl;

		// visualizer
		pcl::visualization::PCLVisualizer viewer ("3D Viewer");
		viewer.setBackgroundColor (0, 0, 0);

		// comparison
		int v1(0);
		viewer.createViewPort(0.0, 0.0, 0.5, 1.0, v1);
		viewer.setBackgroundColor (0, 0, 0, v1);
		viewer.addText(name1, 10, 10, "v1 text", v1);
		pcl::visualization::PointCloudColorHandlerCustom<PointT> green_color(cloud1, 0, 255, 0);
		viewer.addPointCloud<PointT> (cloud1, green_color, "cloud1", v1);
		viewer.setPointCloudRenderingProperties (pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 2, "cloud1"); // points
		viewer.addPointCloudNormals<PointT> (cloud1, 1, 0.05, "normals1", v1);	// normals

		int v2(0);
		viewer.createViewPort(0.5, 0.0, 1.0, 1.0, v2);
		viewer.setBackgroundColor (0, 0, 0, v2);
		viewer.addText(name2, 10, 10, "v2 text", v2);
		pcl::visualization::PointCloudColorHandlerCustom<PointT> red_color(cloud2, 255, 0, 0);
		viewer.addPointCloud<PointT> (cloud2, red_color, "cloud2", v2);
		viewer.setPointCloudRenderingProperties (pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 2, "cloud2"); // points
		viewer.addPointCloudNormals<PointT> (cloud2, 1, 0.05, "normals2", v2);	// normals

		viewer.addCoordinateSystem (5.0);
		viewer.initCameraParameters ();

		// main loop
		while (!viewer.wasStopped ())
		{
			viewer.spinOnce (100);
			boost::this_thread::sleep (boost::posix_time::microseconds (100000));
		}
	}