From b4ae01f20e07276679b288677b72a0111ce0f364 Mon Sep 17 00:00:00 2001 From: Jose Luis Blanco-Claraco Date: Wed, 5 Feb 2025 23:16:32 +0100 Subject: [PATCH] Done port mrpt-maps to mrpt-viz --- libs/maps/CMakeLists.txt | 4 +- .../include/mrpt/maps/CColouredPointsMap.h | 7 -- .../mrpt/viz/CAngularObservationMesh.h | 58 +++------ libs/maps/include/mrpt/viz/CPlanarLaserScan.h | 56 +++------ libs/maps/src/maps/CColouredPointsMap.cpp | 20 +-- libs/maps/src/maps/CPointsMap.cpp | 1 + libs/maps/src/viz/CAngularObservationMesh.cpp | 103 ++-------------- libs/maps/src/viz/CPlanarLaserScan.cpp | 114 +----------------- 8 files changed, 58 insertions(+), 305 deletions(-) diff --git a/libs/maps/CMakeLists.txt b/libs/maps/CMakeLists.txt index 30836a5ea0..7bdd0388d6 100644 --- a/libs/maps/CMakeLists.txt +++ b/libs/maps/CMakeLists.txt @@ -4,8 +4,8 @@ list(APPEND maps_EXTRA_SRCS "${MRPT_SOURCE_DIR}/libs/maps/src/maps/*.cpp" "${MRPT_SOURCE_DIR}/libs/maps/include/mrpt/maps/*.h" "${MRPT_SOURCE_DIR}/libs/maps/include/mrpt/slam/*.h") list(APPEND maps_EXTRA_SRCS_NAME "maps" "maps" "back-compat-hdrs") -list(APPEND maps_EXTRA_SRCS "${MRPT_SOURCE_DIR}/libs/maps/src/opengl/*.cpp" "${MRPT_SOURCE_DIR}/libs/maps/include/mrpt/viz/*.h") -list(APPEND maps_EXTRA_SRCS_NAME "opengl" "opengl") +list(APPEND maps_EXTRA_SRCS "${MRPT_SOURCE_DIR}/libs/maps/src/viz/*.cpp" "${MRPT_SOURCE_DIR}/libs/maps/include/mrpt/viz/*.h") +list(APPEND maps_EXTRA_SRCS_NAME "viz" "viz") list(APPEND maps_EXTRA_SRCS "${MRPT_SOURCE_DIR}/libs/maps/src/obs/*.cpp" "${MRPT_SOURCE_DIR}/libs/maps/include/mrpt/obs/*.h") list(APPEND maps_EXTRA_SRCS_NAME "obs" "obs") diff --git a/libs/maps/include/mrpt/maps/CColouredPointsMap.h b/libs/maps/include/mrpt/maps/CColouredPointsMap.h index 20a8ce2d6b..65c28334ca 100644 --- a/libs/maps/include/mrpt/maps/CColouredPointsMap.h +++ b/libs/maps/include/mrpt/maps/CColouredPointsMap.h @@ -208,10 +208,6 @@ class CColouredPointsMap : public CPointsMap /** The options employed when inserting laser scans in the map. */ TColourOptions colorScheme; - /** Reset the minimum-observed-distance buffer for all the points to a - * predefined value */ - void resetPointsMinDist(float defValue = 2000.0f); - // clang-format off auto getPointsBufferRef_color_R() const -> const mrpt::aligned_std_vector* override { return &m_color_R;} auto getPointsBufferRef_color_G() const -> const mrpt::aligned_std_vector* override { return &m_color_G; } @@ -317,9 +313,6 @@ class CColouredPointsMap : public CPointsMap /** The color data */ mrpt::aligned_std_vector m_color_R, m_color_G, m_color_B; - /** Minimum distance from where the points have been seen */ - // std::vector m_min_dist; - /** Clear the map, erasing all the points */ void internal_clear() override; diff --git a/libs/maps/include/mrpt/viz/CAngularObservationMesh.h b/libs/maps/include/mrpt/viz/CAngularObservationMesh.h index 88b26ca096..d6675ed8e3 100644 --- a/libs/maps/include/mrpt/viz/CAngularObservationMesh.h +++ b/libs/maps/include/mrpt/viz/CAngularObservationMesh.h @@ -13,10 +13,9 @@ #include #include #include -#include -#include #include #include +#include namespace mrpt::viz { @@ -39,8 +38,9 @@ namespace mrpt::viz * \ingroup mrpt_maps_grp */ class CAngularObservationMesh : - public CRenderizableShaderTriangles, - public CRenderizableShaderWireFrame + virtual public CVisualObject, + public VisualObjectParams_Triangles, + public VisualObjectParams_Lines { DEFINE_SERIALIZABLE(CAngularObservationMesh, mrpt::viz) public: @@ -120,7 +120,7 @@ class CAngularObservationMesh : * and the increment. * \throw std::logic_error if the increment is zero. */ - inline static TDoubleRange CreateFromIncrement(double initial, double final, double increment) + static TDoubleRange CreateFromIncrement(double initial, double final, double increment) { if (increment == 0) throw std::logic_error("Invalid increment value."); return TDoubleRange(initial, final, increment); @@ -129,7 +129,7 @@ class CAngularObservationMesh : * Creates a range of values from the initial value, the final value * and a desired amount of samples. */ - inline static TDoubleRange CreateFromAmount(double initial, double final, size_t amount) + static TDoubleRange CreateFromAmount(double initial, double final, size_t amount) { return TDoubleRange(initial, final, amount); } @@ -137,8 +137,7 @@ class CAngularObservationMesh : * Creates a zero-centered range of values from an aperture, an amount * of samples and a direction. */ - inline static TDoubleRange CreateFromAperture( - double aperture, size_t amount, bool negToPos = true) + static TDoubleRange CreateFromAperture(double aperture, size_t amount, bool negToPos = true) { return TDoubleRange(aperture, amount, negToPos); } @@ -146,7 +145,7 @@ class CAngularObservationMesh : * Returns the total aperture of the range. * \throw std::logic_error on invalid range type. */ - inline double aperture() const + double aperture() const { switch (rangeType) { @@ -167,7 +166,7 @@ class CAngularObservationMesh : * Returns the first value of the range. * \throw std::logic_error on invalid range type. */ - inline double initialValue() const + double initialValue() const { switch (rangeType) { @@ -185,7 +184,7 @@ class CAngularObservationMesh : * Returns the last value of the range. * \throw std::logic_error on invalid range type. */ - inline double finalValue() const + double finalValue() const { switch (rangeType) { @@ -207,7 +206,7 @@ class CAngularObservationMesh : * Returns the increment between two consecutive values of the range. * \throw std::logic_error on invalid range type. */ - inline double increment() const + double increment() const { switch (rangeType) { @@ -228,7 +227,7 @@ class CAngularObservationMesh : * Returns the total amount of values in this range. * \throw std::logic_error on invalid range type. */ - inline size_t amount() const + size_t amount() const { switch (rangeType) { @@ -257,7 +256,7 @@ class CAngularObservationMesh : * positive, false otherwise. * \throw std::logic_error on invalid range type. */ - inline bool negToPos() const + bool negToPos() const { switch (rangeType) { @@ -315,47 +314,28 @@ class CAngularObservationMesh : /** * Returns whether the object is configured as wireframe or solid. */ - inline bool isWireframe() const { return m_Wireframe; } + bool isWireframe() const { return m_Wireframe; } /** * Sets the display mode for the object. True=wireframe, False=solid. */ - inline void setWireframe(bool enabled = true) + void setWireframe(bool enabled = true) { m_Wireframe = enabled; - CRenderizable::notifyChange(); + CVisualObject::notifyChange(); } /** * Returns whether the object may be transparent or not. */ - inline bool isTransparencyEnabled() const { return mEnableTransparency; } + bool isTransparencyEnabled() const { return mEnableTransparency; } /** * Enables or disables transparencies. */ - inline void enableTransparency(bool enabled = true) + void enableTransparency(bool enabled = true) { mEnableTransparency = enabled; - CRenderizable::notifyChange(); + CVisualObject::notifyChange(); } - /** @name Renderizable shader API virtual methods - * @{ */ - void freeOpenGLResources() override - { - CRenderizableShaderTriangles::freeOpenGLResources(); - CRenderizableShaderWireFrame::freeOpenGLResources(); - } - void render(const RenderContext& rc) const override; - void renderUpdateBuffers() const override; - - virtual shader_list_t requiredShaders() const override - { - // May use up to two shaders (triangles and lines): - return {DefaultShaderID::WIREFRAME, DefaultShaderID::TRIANGLES_LIGHT}; - } - void onUpdateBuffers_Wireframe() override; - void onUpdateBuffers_Triangles() override; - /** @} */ - /** * Traces a ray to the object, returning the distance to a given pose * through its X axis. diff --git a/libs/maps/include/mrpt/viz/CPlanarLaserScan.h b/libs/maps/include/mrpt/viz/CPlanarLaserScan.h index 8cd483c1f0..db752f438b 100644 --- a/libs/maps/include/mrpt/viz/CPlanarLaserScan.h +++ b/libs/maps/include/mrpt/viz/CPlanarLaserScan.h @@ -14,14 +14,9 @@ #include #include #include -#include -#include -#include +#include -namespace mrpt -{ -/** \ingroup mrpt_maps_grp */ -namespace viz +namespace mrpt::viz { /** This object renders a 2D laser scan by means of three elements: the points, * the line along end-points and the 2D scanned surface. @@ -53,35 +48,14 @@ namespace viz * \ingroup mrpt_maps_grp */ class CPlanarLaserScan : - public CRenderizableShaderPoints, - public CRenderizableShaderTriangles, - public CRenderizableShaderWireFrame + virtual public CVisualObject, + public VisualObjectParams_Triangles, + public VisualObjectParams_Lines, + public VisualObjectParams_Points { DEFINE_SERIALIZABLE(CPlanarLaserScan, mrpt::viz) public: - /** @name Renderizable shader API virtual methods - * @{ */ - void render(const RenderContext& rc) const override; - void renderUpdateBuffers() const override; - void freeOpenGLResources() override - { - CRenderizableShaderTriangles::freeOpenGLResources(); - CRenderizableShaderWireFrame::freeOpenGLResources(); - CRenderizableShaderPoints::freeOpenGLResources(); - } - - virtual shader_list_t requiredShaders() const override - { - return { - DefaultShaderID::WIREFRAME, DefaultShaderID::TRIANGLES_NO_LIGHT, DefaultShaderID::POINTS}; - } - void onUpdateBuffers_Wireframe() override; - void onUpdateBuffers_Triangles() override; - void onUpdateBuffers_Points() override; - mrpt::math::TPoint3Df getLocalRepresentativePoint() const override; - /** @} */ - CPlanarLaserScan() = default; ~CPlanarLaserScan() override = default; @@ -89,25 +63,25 @@ class CPlanarLaserScan : void clear(); /** Show or hides the scanned points \sa sePointsWidth, setPointsColor*/ - inline void enablePoints(bool enable = true) + void enablePoints(bool enable = true) { m_enable_points = enable; - CRenderizable::notifyChange(); + CVisualObject::notifyChange(); } /** Show or hides lines along all scanned points \sa setLineWidth, * setLineColor*/ - inline void enableLine(bool enable = true) + void enableLine(bool enable = true) { m_enable_line = enable; - CRenderizable::notifyChange(); + CVisualObject::notifyChange(); } /** Show or hides the scanned area as a 2D surface \sa setSurfaceColor */ - inline void enableSurface(bool enable = true) + void enableSurface(bool enable = true) { m_enable_surface = enable; - CRenderizable::notifyChange(); + CVisualObject::notifyChange(); } void setLineColor(float R, float G, float B, float A = 1.0f) @@ -134,12 +108,13 @@ class CPlanarLaserScan : void setScan(const mrpt::obs::CObservation2DRangeScan& scan) { - CRenderizable::notifyChange(); + CVisualObject::notifyChange(); m_cache_valid = false; m_scan = scan; } auto internalBoundingBoxLocal() const -> mrpt::math::TBoundingBoxf override; + auto getLocalRepresentativePoint() const -> mrpt::math::TPoint3Df override; protected: mrpt::obs::CObservation2DRangeScan m_scan; @@ -157,5 +132,4 @@ class CPlanarLaserScan : bool m_enable_surface{true}; }; -} // namespace viz -} // namespace mrpt +} // namespace mrpt::viz diff --git a/libs/maps/src/maps/CColouredPointsMap.cpp b/libs/maps/src/maps/CColouredPointsMap.cpp index a440541283..b6e16b656c 100644 --- a/libs/maps/src/maps/CColouredPointsMap.cpp +++ b/libs/maps/src/maps/CColouredPointsMap.cpp @@ -17,6 +17,7 @@ #include #include #include +#include #include "CPointsMap_crtp_common.h" @@ -492,9 +493,6 @@ bool CColouredPointsMap::colourFromObservation( chB = 2; } - unsigned int n_proj = 0; - const float factor = 1.0f / 255; // Normalize pixels: - // Get the colour of the projected points size_t k; for (itProPoints = projectedPoints.begin(), k = 0; itProPoints != projectedPoints.end(); @@ -506,21 +504,13 @@ bool CColouredPointsMap::colourFromObservation( unsigned int ii = p_idx[p_proj[k]]; uint8_t* p = obs.image((unsigned int)itProPoints->x, (unsigned int)itProPoints->y); - m_color_R[ii] = p[chR] * factor; // R - m_color_G[ii] = p[chG] * factor; // G - m_color_B[ii] = p[chB] * factor; // B - // m_min_dist[ii] = p_dist[p_proj[k]]; - - n_proj++; + m_color_R[ii] = mrpt::u8tof(p[chR]); + m_color_G[ii] = mrpt::u8tof(p[chG]); + m_color_B[ii] = mrpt::u8tof(p[chB]); } - } // end for + } return true; -} // end colourFromObservation - -void CColouredPointsMap::resetPointsMinDist([[maybe_unused]] float defValue) -{ - // m_min_dist.assign(x.size(),defValue); } bool CColouredPointsMap::save3D_and_colour_to_text_file(const std::string& file) const diff --git a/libs/maps/src/maps/CPointsMap.cpp b/libs/maps/src/maps/CPointsMap.cpp index 7221668bcf..c308da803e 100644 --- a/libs/maps/src/maps/CPointsMap.cpp +++ b/libs/maps/src/maps/CPointsMap.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include #include diff --git a/libs/maps/src/viz/CAngularObservationMesh.cpp b/libs/maps/src/viz/CAngularObservationMesh.cpp index c9c6b44ed4..ab1ba3d1d7 100644 --- a/libs/maps/src/viz/CAngularObservationMesh.cpp +++ b/libs/maps/src/viz/CAngularObservationMesh.cpp @@ -14,29 +14,6 @@ #include #include -#if MRPT_HAS_OPENGL_GLUT || MRPT_HAS_EGL -#ifdef _WIN32 -// Windows: -#include -#endif - -#ifdef __APPLE__ -#include -#else -#include -#endif -#endif - -// Include libraries in linking: -#if MRPT_HAS_OPENGL_GLUT && defined(_WIN32) -// WINDOWS: -#if defined(_MSC_VER) -#pragma comment(lib, "opengl32.lib") -#pragma comment(lib, "GlU32.lib") -#endif -#endif - -using namespace mrpt; using namespace mrpt::obs; using namespace mrpt::maps; using namespace mrpt::math; @@ -44,7 +21,7 @@ using namespace mrpt::viz; using namespace mrpt::poses; using namespace mrpt::math; -IMPLEMENTS_SERIALIZABLE(CAngularObservationMesh, CRenderizable, mrpt::viz) +IMPLEMENTS_SERIALIZABLE(CAngularObservationMesh, CVisualObject, mrpt::viz) void CAngularObservationMesh::addTriangle( const TPoint3D& p1, const TPoint3D& p2, const TPoint3D& p3) const @@ -57,12 +34,12 @@ void CAngularObservationMesh::addTriangle( t.setColor(getColor_u8()); triangles.emplace_back(std::move(t)); - CRenderizable::notifyChange(); + CVisualObject::notifyChange(); } void CAngularObservationMesh::updateMesh() const { - CRenderizable::notifyChange(); + CVisualObject::notifyChange(); updateMeshImpl(); } @@ -145,62 +122,6 @@ void CAngularObservationMesh::updateMeshImpl() const meshUpToDate = true; } -void CAngularObservationMesh::render(const RenderContext& rc) const -{ - switch (rc.shader_id) - { - case DefaultShaderID::TRIANGLES_LIGHT: - if (!m_Wireframe) CRenderizableShaderTriangles::render(rc); - break; - case DefaultShaderID::WIREFRAME: - if (m_Wireframe) CRenderizableShaderWireFrame::render(rc); - break; - }; -} -void CAngularObservationMesh::renderUpdateBuffers() const -{ - CRenderizableShaderTriangles::renderUpdateBuffers(); - CRenderizableShaderWireFrame::renderUpdateBuffers(); -} - -void CAngularObservationMesh::onUpdateBuffers_Wireframe() -{ - auto& vbd = CRenderizableShaderWireFrame::m_vertex_buffer_data; - auto& cbd = CRenderizableShaderWireFrame::m_color_buffer_data; - std::unique_lock wfWriteLock( - CRenderizableShaderWireFrame::m_wireframeMtx.data); - - vbd.clear(); - cbd.clear(); - - for (const auto& t : triangles) - { - // Was: glBegin(GL_LINE_LOOP); - for (int k = 0; k <= 3; k++) - { - int kk = k % 3; - vbd.emplace_back(t.x(kk), t.y(kk), t.z(kk)); - cbd.emplace_back(t.r(kk), t.g(kk), t.b(kk), t.a(kk)); - } - } -} - -void CAngularObservationMesh::onUpdateBuffers_Triangles() -{ - std::unique_lock trisWriteLock( - CRenderizableShaderTriangles::m_trianglesMtx.data); - auto& tris = CRenderizableShaderTriangles::m_triangles; - - tris = this->triangles; - - // All faces, all vertices, same color: - for (auto& t : tris) - { - t.setColor(getColor_u8()); - t.computeNormals(); - } -} - bool CAngularObservationMesh::traceRay( [[maybe_unused]] const mrpt::poses::CPose3D& o, [[maybe_unused]] double& dist) const { @@ -211,7 +132,7 @@ bool CAngularObservationMesh::traceRay( bool CAngularObservationMesh::setScanSet( const std::vector& scans) { - CRenderizable::notifyChange(); + CVisualObject::notifyChange(); // Returns false if the scan is inconsistent if (scans.size() > 0) @@ -226,27 +147,27 @@ bool CAngularObservationMesh::setScanSet( } scanSet = scans; meshUpToDate = false; - CRenderizable::notifyChange(); + CVisualObject::notifyChange(); return true; } void CAngularObservationMesh::setPitchBounds(const double initial, const double final) { - CRenderizable::notifyChange(); + CVisualObject::notifyChange(); pitchBounds.clear(); pitchBounds.push_back(initial); pitchBounds.push_back(final); meshUpToDate = false; - CRenderizable::notifyChange(); + CVisualObject::notifyChange(); } void CAngularObservationMesh::setPitchBounds(const std::vector& bounds) { - CRenderizable::notifyChange(); + CVisualObject::notifyChange(); pitchBounds = bounds; meshUpToDate = false; - CRenderizable::notifyChange(); + CVisualObject::notifyChange(); } void CAngularObservationMesh::getPitchBounds(double& initial, double& final) const { @@ -288,7 +209,7 @@ void CAngularObservationMesh::serializeTo(mrpt::serialization::CArchive& out) co writeToStreamRender(out); // Version 0: out << pitchBounds << scanSet << m_Wireframe << mEnableTransparency; - CRenderizableShaderTriangles::params_serialize(out); // v1 + VisualObjectParams_Triangles::params_serialize(out); // v1 } void CAngularObservationMesh::serializeFrom(mrpt::serialization::CArchive& in, uint8_t version) @@ -300,14 +221,14 @@ void CAngularObservationMesh::serializeFrom(mrpt::serialization::CArchive& in, u readFromStreamRender(in); in >> pitchBounds >> scanSet >> m_Wireframe >> mEnableTransparency; - if (version >= 1) CRenderizableShaderTriangles::params_deserialize(in); + if (version >= 1) VisualObjectParams_Triangles::params_deserialize(in); break; default: MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(version); }; meshUpToDate = false; - CRenderizable::notifyChange(); + CVisualObject::notifyChange(); } void CAngularObservationMesh::TDoubleRange::values(std::vector& vals) const diff --git a/libs/maps/src/viz/CPlanarLaserScan.cpp b/libs/maps/src/viz/CPlanarLaserScan.cpp index 034670c060..bfb4b99c6a 100644 --- a/libs/maps/src/viz/CPlanarLaserScan.cpp +++ b/libs/maps/src/viz/CPlanarLaserScan.cpp @@ -12,123 +12,17 @@ #include #include -using namespace mrpt; using namespace mrpt::viz; using namespace mrpt::math; -using namespace std; -IMPLEMENTS_SERIALIZABLE(CPlanarLaserScan, CRenderizable, mrpt::viz) +IMPLEMENTS_SERIALIZABLE(CPlanarLaserScan, CVisualObject, mrpt::viz) void CPlanarLaserScan::clear() { - CRenderizable::notifyChange(); + CVisualObject::notifyChange(); m_scan.resizeScan(0); } -void CPlanarLaserScan::render(const RenderContext& rc) const -{ - switch (rc.shader_id) - { - case DefaultShaderID::TRIANGLES_NO_LIGHT: - if (m_enable_surface) CRenderizableShaderTriangles::render(rc); - break; - case DefaultShaderID::WIREFRAME: - if (m_enable_line) CRenderizableShaderWireFrame::render(rc); - break; - case DefaultShaderID::POINTS: - if (m_enable_points) CRenderizableShaderPoints::render(rc); - break; - }; -} -void CPlanarLaserScan::renderUpdateBuffers() const -{ - // Load into cache: - if (!m_cache_valid) - { - m_cache_valid = true; - m_cache_points.clear(); - m_cache_points.insertionOptions.minDistBetweenLaserPoints = 0; - m_cache_points.insertionOptions.isPlanarMap = false; - - m_cache_points.insertObservation(m_scan); - } - - CRenderizableShaderPoints::renderUpdateBuffers(); - CRenderizableShaderTriangles::renderUpdateBuffers(); - CRenderizableShaderWireFrame::renderUpdateBuffers(); -} - -void CPlanarLaserScan::onUpdateBuffers_Wireframe() -{ - auto& vbd = CRenderizableShaderWireFrame::m_vertex_buffer_data; - auto& cbd = CRenderizableShaderWireFrame::m_color_buffer_data; - std::unique_lock wfWriteLock( - CRenderizableShaderWireFrame::m_wireframeMtx.data); - - vbd.clear(); - cbd.clear(); - - size_t n; - const float *x, *y, *z; - m_cache_points.getPointsBuffer(n, x, y, z); - if (!n) return; - - for (size_t i = 0; i < n - 1; i++) - { - vbd.emplace_back(x[i], y[i], z[i]); - vbd.emplace_back(x[i + 1], y[i + 1], z[i + 1]); - } - - cbd.assign(vbd.size(), mrpt::img::TColorf(m_line_R, m_line_G, m_line_B, m_line_A).asTColor()); -} - -void CPlanarLaserScan::onUpdateBuffers_Triangles() -{ - std::unique_lock trisWriteLock( - CRenderizableShaderTriangles::m_trianglesMtx.data); - auto& tris = CRenderizableShaderTriangles::m_triangles; - - tris.clear(); - - size_t n; - const float *x, *y, *z; - m_cache_points.getPointsBuffer(n, x, y, z); - if (!n) return; - - using P3f = mrpt::math::TPoint3Df; - - for (size_t i = 0; i < n - 1; i++) - { - tris.emplace_back( - P3f(m_scan.sensorPose.x(), m_scan.sensorPose.y(), m_scan.sensorPose.z()), - P3f(x[i], y[i], z[i]), P3f(x[i + 1], y[i + 1], z[i + 1])); - } - - for (auto& t : tris) - { - t.computeNormals(); - t.setColor(mrpt::img::TColorf(m_plane_R, m_plane_G, m_plane_B, m_plane_A)); - } -} - -void CPlanarLaserScan::onUpdateBuffers_Points() -{ - auto& vbd = CRenderizableShaderPoints::m_vertex_buffer_data; - auto& cbd = CRenderizableShaderPoints::m_color_buffer_data; - std::unique_lock wfWriteLock(CRenderizableShaderPoints::m_pointsMtx.data); - - vbd.clear(); - - size_t n; - const float *x, *y, *z; - m_cache_points.getPointsBuffer(n, x, y, z); - - for (size_t i = 0; i < n; i++) vbd.emplace_back(x[i], y[i], z[i]); - - cbd.assign( - vbd.size(), mrpt::img::TColorf(m_points_R, m_points_G, m_points_B, m_points_A).asTColor()); -} - uint8_t CPlanarLaserScan::serializeGetVersion() const { return 3; } void CPlanarLaserScan::serializeTo(mrpt::serialization::CArchive& out) const { @@ -137,7 +31,7 @@ void CPlanarLaserScan::serializeTo(mrpt::serialization::CArchive& out) const out << m_line_R << m_line_G << m_line_B << m_line_A << m_points_R << m_points_G << m_points_B << m_points_A << m_plane_R << m_plane_G << m_plane_B << m_plane_A << m_enable_points << m_enable_line << m_enable_surface; // new in v1 - CRenderizableShaderTriangles::params_serialize(out); // v3 + VisualObjectParams_Triangles::params_serialize(out); // v3 } void CPlanarLaserScan::serializeFrom(mrpt::serialization::CArchive& in, uint8_t version) @@ -176,7 +70,7 @@ void CPlanarLaserScan::serializeFrom(mrpt::serialization::CArchive& in, uint8_t { m_enable_points = m_enable_line = m_enable_surface = true; } - if (version >= 3) CRenderizableShaderTriangles::params_deserialize(in); + if (version >= 3) VisualObjectParams_Triangles::params_deserialize(in); } break; default: