Skip to content

Class Argos::ObjSerializer

ClassList > Argos > ObjSerializer

Serialize and deserialize 3D meshes using the Wavefront OBJ format. More...

  • #include <ObjSerializer.h>

Public Functions

Type Name
void deserialize (std::vector< Vector3D< double > > & vertices, std::vector< Face > & faces, std::istream & input) const
Read a 3D mesh from an OBJ stream.
void serialize (const std::vector< Vector3D< double > > & vertices, const std::vector< Face > & faces, std::ostream & output) const
Serialize a 3D mesh to an OBJ stream.
void serialize (const std::vector< Vector3D< double > > & vertices, const std::vector< Face > & faces, const std::vector< double > & textureCoordinates, std::ostream & output) const
Serialize a 3D mesh with per-vertex texture coordinates to an OBJ stream.

Detailed Description

Only a minimal subset of OBJ is supported: * Vertices (v x y z). * Polygonal faces (f i1 i2 i3 ...).

Normals, texture coordinates, materials and other OBJ features are ignored.

Public Functions Documentation

function deserialize

Read a 3D mesh from an OBJ stream.

void Argos::ObjSerializer::deserialize (
    std::vector< Vector3D < double > > & vertices,
    std::vector< Face > & faces,
    std::istream & input
) const

Parameters:

  • vertices Output vector filled with the vertices read from the stream.
  • faces Output vector filled with the faces as zero-based vertex indices.
  • input Input stream providing the OBJ text.

Note:

Unknown lines (comments, blank lines) are silently ignored.

Note:

Normals, texture coordinates and other OBJ features are not supported by the reader.

Note:

Vertex indices read from the OBJ (one-based) are converted to zero-based indices.


function serialize [1/2]

Serialize a 3D mesh to an OBJ stream.

void Argos::ObjSerializer::serialize (
    const std::vector< Vector3D < double > > & vertices,
    const std::vector< Face > & faces,
    std::ostream & output
) const

Parameters:

  • vertices Vertices of the mesh, written as v x y z lines.
  • faces Faces of the mesh given as zero-based vertex indices.
  • output Output stream receiving the OBJ text.

Note:

Vertex indices are converted from zero-based (C++) to one-based (OBJ) when writing.


function serialize [2/2]

Serialize a 3D mesh with per-vertex texture coordinates to an OBJ stream.

void Argos::ObjSerializer::serialize (
    const std::vector< Vector3D < double > > & vertices,
    const std::vector< Face > & faces,
    const std::vector< double > & textureCoordinates,
    std::ostream & output
) const

Parameters:

  • vertices Vertices of the mesh, written as v x y z lines.
  • faces Faces of the mesh given as zero-based vertex indices.
  • textureCoordinates Per-vertex texture coordinates written as vt u lines (one coordinate per vertex).
  • output Output stream receiving the OBJ text.

Note:

Vertex indices are converted from zero-based (C++) to one-based (OBJ) when writing.



The documentation for this class was generated from the following file include/serializer/ObjSerializer.h