cgv
cgv::media::mesh::obj_reader_base Class Referenceabstract

#include <obj_reader.h>

Inheritance diagram for cgv::media::mesh::obj_reader_base:
cgv::media::mesh::obj_reader_generic< T > cgv::media::mesh::obj_loader_generic< T >

Public Types

typedef illum::obj_material::color_type color_type
 type used for rgba colors
 

Protected Attributes

unsigned group_index
 keep track of the current group
 
unsigned nr_groups
 number of groups
 
unsigned material_index
 keep track of current material index
 
unsigned nr_materials
 number of materials
 
std::map< std::string, unsigned > material_index_lut
 mapping from material names to material indices
 

helpers for reading

int minus
 
unsigned nr_normals
 
unsigned nr_texcoords
 
bool have_default_material
 
std::set< std::string > mtl_lib_files
 
color_type parse_color (const std::vector< cgv::utils::token > &t, unsigned off=0) const
 parse a color, if alpha not given it defaults to 1
 
void parse_face (const std::vector< cgv::utils::token > &tokens)
 
void parse_material (const std::vector< cgv::utils::token > &tokens)
 
virtual void parse_and_process_vertex (const std::vector< cgv::utils::token > &tokens)=0
 
virtual void parse_and_process_normal (const std::vector< cgv::utils::token > &tokens)=0
 
virtual void parse_and_process_texcoord (const std::vector< cgv::utils::token > &tokens)=0
 

status info during reading

std::string path_name
 store the path name
 
unsigned get_current_group () const
 return the index of the currently selected group or -1 if no group is defined
 
unsigned get_current_material () const
 return the index of the currently selected material or -1 if no material is defined
 

virtual interface

virtual void process_comment (const std::string &comment)
 overide this function to process a comment
 
virtual void process_color (const color_type &c)
 overide this function to process a color (this called for vc prefixes which is is not in the standard but for example used in pobj-files) More...
 
void convert_to_positive (unsigned vcount, int *vertices, int *texcoords, int *normals, unsigned v, unsigned n, unsigned t)
 convert negative indices to positive ones by adding the number of elements
 
virtual void process_face (unsigned vcount, int *vertices, int *texcoords=0, int *normals=0)
 overide this function to process a face, the indices start with 0 More...
 
virtual void process_group (const std::string &name, const std::string &parameters)
 overide this function to process a group given by name and parameter string
 
virtual void process_material (const cgv::media::illum::obj_material &mtl, unsigned idx)
 process a material definition. If a material with a certain name is overwritten, it will receive the same index More...
 
 obj_reader_base ()
 
virtual bool read_obj (const std::string &file_name)
 read an obj file
 
virtual bool read_mtl (const std::string &file_name)
 read a material file
 
virtual void clear ()
 clear the reader such that a new file can be read
 

Detailed Description

base class for obj reader with implementation that is independent of coordinate type.

Member Function Documentation

◆ process_color()

void cgv::media::mesh::obj_reader_base::process_color ( const color_type c)
protectedvirtual

overide this function to process a color (this called for vc prefixes which is is not in the standard but for example used in pobj-files)

overide this function to process a normal

Reimplemented in cgv::media::mesh::obj_loader_generic< T >.

◆ process_face()

void cgv::media::mesh::obj_reader_base::process_face ( unsigned  vcount,
int *  vertices,
int *  texcoords = 0,
int *  normals = 0 
)
protectedvirtual

overide this function to process a face, the indices start with 0

overide this function to process a face

Reimplemented in cgv::media::mesh::obj_loader_generic< T >.

◆ process_material()

void cgv::media::mesh::obj_reader_base::process_material ( const cgv::media::illum::obj_material mtl,
unsigned  idx 
)
protectedvirtual

process a material definition. If a material with a certain name is overwritten, it will receive the same index

process a material definition

Reimplemented in cgv::media::mesh::obj_loader_generic< T >.


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