Support Forum G3D Web Page |
Parses OBJ files with polygonal data and their associated MTL files. More...
Classes | |
class | Group |
An OBJ group, created with the "g" command. More... | |
class | Index |
Set of indices into the vertex attribute arrays. More... | |
class | Mesh |
Part of a group that uses a single material. More... | |
class | Options |
Public Types | |
typedef SmallArray< Index, 5 > | Face |
A polygon, which is expected to be a triangle or quadrilateral but is unlimited in OBJ format. More... | |
typedef Table< String, shared_ptr< Group > > | GroupTable |
Maps group names to groups. More... | |
typedef Table< shared_ptr< ParseMTL::Material >, shared_ptr< Mesh > > | MeshTable |
Public Member Functions | |
void | parse (const char *ptr, size_t len, const String &basePath, const ParseOBJ::Options &options) |
void | parse (BinaryInput &bi, const ParseOBJ::Options &options=ParseOBJ::Options(), const String &basePath="<AUTO>") |
Public Attributes | |
GroupTable | groupTable |
Maps group names to groups. More... | |
Array< String > | mtlArray |
stores names of MTL files included by the OBJ More... | |
Array< Vector3 > | normalArray |
Array< Point2 > | texCoord0Array |
Texture coordinates in OBJ coordinate frame, where (0, 0) is the LOWER-left. More... | |
Array< Point2 > | texCoord1Array |
Array< Point3 > | vertexArray |
Static Public Attributes | |
static const int | UNDEFINED = -1 |
Parses OBJ files with polygonal data and their associated MTL files.
Ignores groups, smoothing groups, surfaces, object names. Assumes that each face is in exactly one group. Note that group information may be useful for object-level culling.
Uses a special text parser instead of G3D::TextInput for peak performance (about 30x faster than TextInput).
This is intentionally designed to map the file format into memory, not to process it further. That supports a number of modeling uses of the data beyond specific OpenGL-trimesh rendering.
To iterate over the meshes, use:
typedef SmallArray<Index, 5> G3D::ParseOBJ::Face |
A polygon, which is expected to be a triangle or quadrilateral but is unlimited in OBJ format.
typedef Table<String, shared_ptr<Group> > G3D::ParseOBJ::GroupTable |
Maps group names to groups.
typedef Table<shared_ptr<ParseMTL::Material>, shared_ptr<Mesh> > G3D::ParseOBJ::MeshTable |
void G3D::ParseOBJ::parse | ( | const char * | ptr, |
size_t | len, | ||
const String & | basePath, | ||
const ParseOBJ::Options & | options | ||
) |
void G3D::ParseOBJ::parse | ( | BinaryInput & | bi, |
const ParseOBJ::Options & | options = ParseOBJ::Options() , |
||
const String & | basePath = "<AUTO>" |
||
) |
GroupTable G3D::ParseOBJ::groupTable |
Maps group names to groups.
Texture coordinates in OBJ coordinate frame, where (0, 0) is the LOWER-left.
|
static |