diff --git a/modules/odm_georef/src/Georef.cpp b/modules/odm_georef/src/Georef.cpp index d5df39c5..2597e257 100644 --- a/modules/odm_georef/src/Georef.cpp +++ b/modules/odm_georef/src/Georef.cpp @@ -1411,20 +1411,20 @@ void Georef::transformPointCloud(const char *inputFile, const Eigen::Transform vertices = file.request_properties_from_element("vertex", { "x", "y", "z" }); - std::shared_ptr normals; + // std::shared_ptr normals; std::shared_ptr colors; // Not all point clouds have normals and colors // and different naming conventions apply - try{ - normals = file.request_properties_from_element("vertex", { "nx", "ny", "nz" }); - }catch(const std::exception &){} + // try{ + // normals = file.request_properties_from_element("vertex", { "nx", "ny", "nz" }); + // }catch(const std::exception &){} - if (!normals){ - try{ - normals = file.request_properties_from_element("vertex", { "normal_x", "normal_y", "normal_z" }); - }catch(const std::exception &){} - } + // if (!normals){ + // try{ + // normals = file.request_properties_from_element("vertex", { "normal_x", "normal_y", "normal_z" }); + // }catch(const std::exception &){} + // } try{ colors = file.request_properties_from_element("vertex", { "diffuse_red", "diffuse_green", "diffuse_blue" }); @@ -1470,6 +1470,9 @@ void Georef::transformPointCloud(const char *inputFile, const Eigen::Transform (transform (0, 0) * x + transform (0, 1) * y + transform (0, 2) * z + transform (0, 3)); verts[i].y = static_cast (transform (1, 0) * x + transform (1, 1) * y + transform (1, 2) * z + transform (1, 3)); verts[i].z = static_cast (transform (2, 0) * x + transform (2, 1) * y + transform (2, 2) * z + transform (2, 3)); + + // TODO: normals can be computed using the inverse transpose + // https://paroj.github.io/gltut/Illumination/Tut09%20Normal%20Transformation.html } log_ << '\n'; @@ -1484,11 +1487,11 @@ void Georef::transformPointCloud(const char *inputFile, const Eigen::Transform(verts.data()), Type::INVALID, 0); - if (normals) outFile.add_properties_to_element("vertex", { "nx", "ny", "nz" }, Type::FLOAT32, verts.size() * 3, reinterpret_cast(normals->buffer.get()), Type::INVALID, 0); + // if (normals) outFile.add_properties_to_element("vertex", { "nx", "ny", "nz" }, Type::FLOAT32, verts.size() * 3, reinterpret_cast(normals->buffer.get()), Type::INVALID, 0); if (colors) outFile.add_properties_to_element("vertex", { "red", "green", "blue" }, Type::UINT8, verts.size() * 3, reinterpret_cast(colors->buffer.get()), Type::INVALID, 0); outFile.get_comments().push_back("generated by OpenDroneMap"); - outFile.write(outputStream, false); + outFile.write(outputStream, true); fb.close();