PLY writer: Added option to choose if we want to write texture coordinates as uv or ply (Thanks to Ossi Saukko for the patch)

This commit is contained in:
Jan Möbius
2021-06-01 12:47:22 +02:00
parent e710d4cb6f
commit 48c2e464cb
3 changed files with 11 additions and 3 deletions

View File

@@ -33,6 +33,7 @@
<li>OM Writer: Removed debug output</li> <li>OM Writer: Removed debug output</li>
<li>OM Writer/Reader: Added support for (re)storing properties of type vector<T></li> <li>OM Writer/Reader: Added support for (re)storing properties of type vector<T></li>
<li>OM Reader: Properties can now be restored from files without the need to create the properties beforehand. Custom types need to be registered for this to work using the OM_REGISTER_PROPERTY_TYPE macro.</li> <li>OM Reader: Properties can now be restored from files without the need to create the properties beforehand. Custom types need to be registered for this to work using the OM_REGISTER_PROPERTY_TYPE macro.</li>
<li>PLY writer: Added option to choose if we want to write texture coordinates as uv or ply</li>
</ul> </ul>
<b>Tools</b> <b>Tools</b>

View File

@@ -111,7 +111,8 @@ public:
ColorAlpha = 0x0800, ///< Has (r) / store (w) alpha values for colors ColorAlpha = 0x0800, ///< Has (r) / store (w) alpha values for colors
ColorFloat = 0x1000, ///< Has (r) / store (w) float values for colors (currently only implemented for PLY and OFF files) ColorFloat = 0x1000, ///< Has (r) / store (w) float values for colors (currently only implemented for PLY and OFF files)
Custom = 0x2000, ///< Has (r) custom properties (currently only implemented in PLY Reader ASCII version) Custom = 0x2000, ///< Has (r) custom properties (currently only implemented in PLY Reader ASCII version)
Status = 0x4000 ///< Has (r) / store (w) status properties Status = 0x4000, ///< Has (r) / store (w) status properties
TexCoordST = 0x8000 ///< Write texture coordinates as ST instead of UV
}; };
public: public:
@@ -212,6 +213,7 @@ public:
bool face_has_status() const { return check(Status); } bool face_has_status() const { return check(Status); }
bool color_has_alpha() const { return check(ColorAlpha); } bool color_has_alpha() const { return check(ColorAlpha); }
bool color_is_float() const { return check(ColorFloat); } bool color_is_float() const { return check(ColorFloat); }
bool use_st_coordinates() const { return check(TexCoordST); }
/// Returns true if _rhs has the same options enabled. /// Returns true if _rhs has the same options enabled.

View File

@@ -278,8 +278,13 @@ void _PLYWriter_::write_header(std::ostream& _out, BaseExporter& _be, Options& _
} }
if ( _opt.vertex_has_texcoord() ){ if ( _opt.vertex_has_texcoord() ){
_out << "property float u" << '\n'; if ( _opt.use_st_coordinates() ){
_out << "property float v" << '\n'; _out << "property float s" << '\n';
_out << "property float t" << '\n';
} else {
_out << "property float u" << '\n';
_out << "property float v" << '\n';
}
} }
if ( _opt.vertex_has_color() ){ if ( _opt.vertex_has_color() ){