Cinder  0.9.1
Classes | Public Member Functions | Protected Member Functions | List of all members
cinder::ObjLoader Class Reference

#include <ObjLoader.h>

Inherits cinder::geom::Source.

Classes

struct  Face
 
struct  Group
 
struct  Material
 

Public Member Functions

 ObjLoader (std::shared_ptr< IStreamCinder > stream, bool includeNormals=true, bool includeTexCoords=true, bool optimize=true)
 
 ObjLoader (DataSourceRef dataSource, bool includeNormals=true, bool includeTexCoords=true, bool optimize=true)
 
 ObjLoader (DataSourceRef dataSource, DataSourceRef materialSource, bool includeNormals=true, bool includeTexCoords=true, bool optimize=true)
 
ObjLoadergroupIndex (size_t groupIndex)
 
ObjLoadergroupName (const std::string &groupName)
 
bool hasGroup (const std::string &groupName) const
 
size_t getNumGroups () const
 
const std::vector< Group > & getGroups () const
 
size_t getNumVertices () const override
 
size_t getNumIndices () const override
 
geom::Primitive getPrimitive () const override
 
uint8_t getAttribDims (geom::Attrib attr) const override
 
geom::AttribSet getAvailableAttribs () const override
 
void loadInto (geom::Target *target, const geom::AttribSet &requestedAttribs) const override
 
Source * clone () const override
 

Protected Member Functions

void copyIndicesNonIndexed (uint16_t *dest) const
 
void copyIndicesNonIndexed (uint32_t *dest) const
 
template<typename T >
void forceCopyIndicesTrianglesImpl (T *dest) const
 

Detailed Description

Loads Alias|Wavefront .OBJ file format.

Example usage:

ObjLoader loader( loadFile( "myPath/cube.obj" ) );
myCubeRef = gl::Batch::create( loader, gl::getStockShader( gl::ShaderDef().color() ) );
myCubeRef->draw();

Constructor & Destructor Documentation

cinder::ObjLoader::ObjLoader ( std::shared_ptr< IStreamCinder stream,
bool  includeNormals = true,
bool  includeTexCoords = true,
bool  optimize = true 
)

Constructs and does the parsing of the file

Parameters
includeNormalsif false texture coordinates will be skipped, which can provide a faster load time
includeTexCoordsif false normasls will be skipped, which can provide a faster load time
cinder::ObjLoader::ObjLoader ( DataSourceRef  dataSource,
bool  includeNormals = true,
bool  includeTexCoords = true,
bool  optimize = true 
)

Constructs and does the parsing of the file

Parameters
includeNormalsif false texture coordinates will be skipped, which can provide a faster load time
includeTexCoordsif false normasls will be skipped, which can provide a faster load time
cinder::ObjLoader::ObjLoader ( DataSourceRef  dataSource,
DataSourceRef  materialSource,
bool  includeNormals = true,
bool  includeTexCoords = true,
bool  optimize = true 
)

Constructs and does the parsing of the file

Parameters
includeNormalsif false texture coordinates will be skipped, which can provide a faster load time
includeTexCoordsif false normasls will be skipped, which can provide a faster load time

Member Function Documentation

ObjLoader & cinder::ObjLoader::groupIndex ( size_t  groupIndex)

Loads a specific group index from the file

ObjLoader & cinder::ObjLoader::groupName ( const std::string &  groupName)

Loads a specific group name from the file

bool cinder::ObjLoader::hasGroup ( const std::string &  groupName) const

Returns whether the file contains a group labeled with groupName

size_t cinder::ObjLoader::getNumGroups ( ) const

Returns the total number of groups.

const std::vector<Group>& cinder::ObjLoader::getGroups ( ) const

Returns a vector<> of the Groups in the OBJ.

size_t cinder::ObjLoader::getNumVertices ( ) const
overridevirtual

Implements cinder::geom::Source.

size_t cinder::ObjLoader::getNumIndices ( ) const
overridevirtual

Implements cinder::geom::Source.

geom::Primitive cinder::ObjLoader::getPrimitive ( ) const
overridevirtual

Implements cinder::geom::Source.

uint8_t cinder::ObjLoader::getAttribDims ( geom::Attrib  attr) const
overridevirtual

Implements cinder::geom::Source.

geom::AttribSet cinder::ObjLoader::getAvailableAttribs ( ) const
overridevirtual

Implements cinder::geom::Source.

void cinder::ObjLoader::loadInto ( geom::Target target,
const geom::AttribSet requestedAttribs 
) const
overridevirtual

Implements cinder::geom::Source.

Source* cinder::ObjLoader::clone ( ) const
overridevirtual

Implements cinder::geom::Source.

void cinder::geom::Source::copyIndicesNonIndexed ( uint16_t *  dest) const
protectedinherited

Builds a sequential list of vertices to simulate an indexed geometry when Source is non-indexed. Assumes dest contains storage for getNumVertices() entries.

void cinder::geom::Source::copyIndicesNonIndexed ( uint32_t *  dest) const
protectedinherited

Builds a sequential list of vertices to simulate an indexed geometry when Source is non-indexed. Assumes dest contains storage for getNumVertices() entries.

template<typename T >
void cinder::geom::Source::forceCopyIndicesTrianglesImpl ( T *  dest) const
protectedinherited

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