#pragma once
#include <librealsense2/rs.hpp>
#include <tuple>
#include <pcl/io/ply_io.h>
#include <pcl/point_types.h>

typedef pcl::PointXYZRGB PointRGB;
typedef pcl::PointCloud<PointRGB> PointCloudRGB;
typedef PointCloudRGB::Ptr PtrCloud;

class PCLConverter
{
public:
    static PtrCloud points_to_pcl(const rs2::points &points, const rs2::video_frame &color);
    static void convert_and_save_ply(const std::string &fileName, const rs2::points &points, const rs2::video_frame &color);

private:
    static std::tuple<uint8_t, uint8_t, uint8_t> get_texcolor(rs2::video_frame texture, rs2::texture_coordinate texcoords);
};