Skip to content

Read multiple objects from an obj file #803

@Salingo

Description

@Salingo

I have a question about reading multiple objects in Wavefront .obj files, the obj files may contain many object groups such as:

#
# object example_1
#
v 0.0 0.0 0.0
v 1.0 0.0 0.0
v 1.0 0.0 1.0
v 0.0 0.0 1.0
# 4 vertices

g example_1
f 1 4 3 
f 3 2 1 
# 2 faces

#
# object example_2
#
v 2.0 2.0 2.0
v 3.0 2.0 2.0
v 1.0 1.0 3.0
v 2.0 2.0 2.0
# 4 vertices

g example_2
f 1 4 3 
f 3 2 1 
# 2 faces

The igl::readOBJ function only returns one single object, so the group information is lost. Is there an easy way to read this kind of obj file as grouped objects?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions