# Cinder

# cinder::ObjLoader Class Reference

Loads Alias|Wavefront .OBJ file format. More...

`#include <ObjLoader.h>`

List of all members.

## Classes
struct | Face
struct | Group
## Public Member Functions
| ObjLoader (shared_ptr< IStream > aStream, bool includeUVs=true)
| ~ObjLoader ()
void | load (TriMesh *destTriMesh, boost::tribool loadNormals=boost::logic::indeterminate, boost::tribool loadTexCoords=boost::logic::indeterminate, bool optimizeVertices=true)
void | load (size_t groupIndex, TriMesh *destTriMesh, boost::tribool loadNormals=boost::logic::indeterminate, boost::tribool loadTexCoords=boost::logic::indeterminate, bool optimizeVertices=true)

## Detailed Description

Loads Alias|Wavefront .OBJ file format.

Currently does not support anything but polygonal data
Example usage:

     cinder::TriMesh myCube;
     ObjLoader loader( loadFile( "myPath/cube.obj" ) );
     loader.load( &myCube );
     gl::draw( myCube );

## Constructor & Destructor Documentation

cinder::ObjLoader::ObjLoader | ( | shared_ptr< IStream > | aStream,
|  | bool | includeUVs = `true` |
| ) |  |  |

Constructs and does the parsing of the file

Parameters:

  | includeUVs | if false UV coordinates will be skipped, which can provide a faster load time

cinder::ObjLoader::~ObjLoader | ( |  | ) |

## Member Function Documentation

void cinder::ObjLoader::load | ( | TriMesh * | destTriMesh,
|  | boost::tribool | loadNormals = `boost::logic::indeterminate`,
|  | boost::tribool | loadTexCoords = `boost::logic::indeterminate`,
|  | bool | optimizeVertices = `true` |
| ) |  |  |

Loads all the groups present in the file into a single TriMesh

Parameters:

  | destTriMesh | the destination TriMesh, whose contents are cleared first
  | loadNormals | should normals be loaded or generated if not present. Default determines from the contents of the file
  | loadTexCoords | should 2D texture coordinates be loaded or set to zero if not present. Default determines from the contents of the file
  | optimizeVertices | should the loader minimze the vertices by identifying shared vertices between faces.

void cinder::ObjLoader::load | ( | size_t | groupIndex,
|  | TriMesh * | destTriMesh,
|  | boost::tribool | loadNormals = `boost::logic::indeterminate`,
|  | boost::tribool | loadTexCoords = `boost::logic::indeterminate`,
|  | bool | optimizeVertices = `true` |
| ) |  |  |

Loads a particular group into a TriMesh

Parameters:

  | loadNormals | should normals be loaded or generated if not present. Default determines from the contents of the file
  | loadTexCoords | should 2D texture coordinates be loaded or set to zero if not present. Default determines from the contents of the file
  | optimizeVertices | should the loader minimize the vertices by identifying shared vertices between faces.

The documentation for this class was generated from the following files:

- include/cinder/ObjLoader.h
- src/cinder/ObjLoader.cpp