Tachyon (current)  Current Main Branch
Data Structures | Typedefs | Enumerations | Functions
tinyobj Namespace Reference

Data Structures

struct  attrib_t
 
struct  callback_t
 
struct  index_t
 
struct  joint_and_weight_t
 
struct  lines_t
 
struct  material_t
 
class  MaterialFileReader
 Read .mtl from a file. More...
 
class  MaterialReader
 
class  MaterialStreamReader
 Read .mtl from a stream. More...
 
struct  mesh_t
 
class  ObjReader
 Wavefront .obj reader class(v2 API) More...
 
struct  ObjReaderConfig
 
struct  points_t
 
struct  shape_t
 
struct  skin_weight_t
 
struct  tag_t
 
struct  texture_option_t
 

Typedefs

typedef float real_t
 

Enumerations

enum  texture_type_t {
  TEXTURE_TYPE_NONE, TEXTURE_TYPE_SPHERE, TEXTURE_TYPE_CUBE_TOP, TEXTURE_TYPE_CUBE_BOTTOM,
  TEXTURE_TYPE_CUBE_FRONT, TEXTURE_TYPE_CUBE_BACK, TEXTURE_TYPE_CUBE_LEFT, TEXTURE_TYPE_CUBE_RIGHT
}
 

Functions

bool LoadObj (attrib_t *attrib, std::vector< shape_t > *shapes, std::vector< material_t > *materials, std::string *warn, std::string *err, const char *filename, const char *mtl_basedir=NULL, bool triangulate=true, bool default_vcols_fallback=true)
 ==>>========= Legacy v1 API ============================================= More...
 
bool LoadObjWithCallback (std::istream &inStream, const callback_t &callback, void *user_data=NULL, MaterialReader *readMatFn=NULL, std::string *warn=NULL, std::string *err=NULL)
 Loads .obj from a file with custom user callback. More...
 
bool LoadObj (attrib_t *attrib, std::vector< shape_t > *shapes, std::vector< material_t > *materials, std::string *warn, std::string *err, std::istream *inStream, MaterialReader *readMatFn=NULL, bool triangulate=true, bool default_vcols_fallback=true)
 Loads object from a std::istream, uses readMatFn to retrieve std::istream for materials. More...
 
void LoadMtl (std::map< std::string, int > *material_map, std::vector< material_t > *materials, std::istream *inStream, std::string *warning, std::string *err)
 Loads materials into std::map. More...
 
bool ParseTextureNameAndOption (std::string *texname, texture_option_t *texopt, const char *linebuf)
 Parse texture name and texture option for custom texture parameter through material::unknown_parameter. More...
 

Typedef Documentation

◆ real_t

typedef float tinyobj::real_t

Definition at line 146 of file tiny_obj_loader.h.

Enumeration Type Documentation

◆ texture_type_t

Enumerator
TEXTURE_TYPE_NONE 
TEXTURE_TYPE_SPHERE 
TEXTURE_TYPE_CUBE_TOP 
TEXTURE_TYPE_CUBE_BOTTOM 
TEXTURE_TYPE_CUBE_FRONT 
TEXTURE_TYPE_CUBE_BACK 
TEXTURE_TYPE_CUBE_LEFT 
TEXTURE_TYPE_CUBE_RIGHT 

Definition at line 149 of file tiny_obj_loader.h.

Function Documentation

◆ LoadMtl()

void tinyobj::LoadMtl ( std::map< std::string, int > *  material_map,
std::vector< material_t > *  materials,
std::istream *  inStream,
std::string *  warning,
std::string *  err 
)

Loads materials into std::map.

◆ LoadObj() [1/2]

bool tinyobj::LoadObj ( attrib_t attrib,
std::vector< shape_t > *  shapes,
std::vector< material_t > *  materials,
std::string *  warn,
std::string *  err,
const char *  filename,
const char *  mtl_basedir = NULL,
bool  triangulate = true,
bool  default_vcols_fallback = true 
)

==>>========= Legacy v1 API =============================================

Loads .obj from a file. 'attrib', 'shapes' and 'materials' will be filled with parsed shape data 'shapes' will be filled with parsed shape data Returns true when loading .obj become success. Returns warning message into warn, and error message into err 'mtl_basedir' is optional, and used for base directory for .mtl file. In default(‘NULL’), .mtl file is searched from an application's working directory. 'triangulate' is optional, and used whether triangulate polygon face in .obj or not. Option 'default_vcols_fallback' specifies whether vertex colors should always be defined, even if no colors are given (fallback to white).

◆ LoadObj() [2/2]

bool tinyobj::LoadObj ( attrib_t attrib,
std::vector< shape_t > *  shapes,
std::vector< material_t > *  materials,
std::string *  warn,
std::string *  err,
std::istream *  inStream,
MaterialReader readMatFn = NULL,
bool  triangulate = true,
bool  default_vcols_fallback = true 
)

Loads object from a std::istream, uses readMatFn to retrieve std::istream for materials.

Returns true when loading .obj become success. Returns warning and error message into err

◆ LoadObjWithCallback()

bool tinyobj::LoadObjWithCallback ( std::istream &  inStream,
const callback_t callback,
void *  user_data = NULL,
MaterialReader readMatFn = NULL,
std::string *  warn = NULL,
std::string *  err = NULL 
)

Loads .obj from a file with custom user callback.

.mtl is loaded as usual and parsed material_t data will be passed to callback.mtllib_cb. Returns true when loading .obj/.mtl become success. Returns warning message into warn, and error message into err See examples/callback_api/ for how to use this function.

◆ ParseTextureNameAndOption()

bool tinyobj::ParseTextureNameAndOption ( std::string *  texname,
texture_option_t texopt,
const char *  linebuf 
)

Parse texture name and texture option for custom texture parameter through material::unknown_parameter.

Parameters
[out]texnameParsed texture name
[out]texoptParsed texopt
[in]linebufInput string