cgv
Loading...
Searching...
No Matches
cgv::media::mesh::simple_mesh_obj_reader< T > Class Template Reference
Inheritance diagram for cgv::media::mesh::simple_mesh_obj_reader< T >:
cgv::media::mesh::obj_reader_generic< T > cgv::media::mesh::obj_reader_base

Public Types

typedef T coord_type
 type of coordinates
 
typedef cgv::math::fvec< T, 2 > vec2_type
 type used to store texture coordinates
 
typedef cgv::math::fvec< T, 3 > vec3_type
 type used to store positions and normal vectors
 
typedef illum::obj_material::color_type color_type
 type used for rgba colors
 
typedef simple_mesh< T >::idx_type idx_type
 
- Public Types inherited from cgv::media::mesh::obj_reader_generic< T >
typedef T coord_type
 type of coordinates
 
typedef cgv::math::fvec< T, 2 > vec2_type
 type used to store texture coordinates
 
typedef cgv::math::fvec< T, 3 > vec3_type
 type used to store positions and normal vectors
 
- Public Types inherited from cgv::media::mesh::obj_reader_base
typedef illum::obj_material::color_type color_type
 type used for rgba colors
 

Public Member Functions

 simple_mesh_obj_reader (simple_mesh< T > &_mesh)
 
void process_vertex (const vec3_type &p)
 overide this function to process a vertex
 
void process_texcoord (const vec2_type &t)
 overide this function to process a texcoord
 
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)
 
void process_normal (const vec3_type &n)
 overide this function to process a normal
 
void process_face (unsigned vcount, int *vertices, int *texcoords, int *normals)
 overide this function to process a face, the indices start with 0
 
void process_group (const std::string &name, const std::string &parameters)
 overide this function to process a group given by name and parameter string
 
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
 
- Public Member Functions inherited from cgv::media::mesh::obj_reader_generic< T >
 obj_reader_generic ()
 default constructor
 
- Public Member Functions inherited from cgv::media::mesh::obj_reader_base
virtual bool parse_obj (const std::string &content, const std::string path_name="")
 parse the content of an obj file already read to memory, where path_name is used to find material files
 
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
 

Protected Attributes

simple_mesh< T > & mesh
 
- Protected Attributes inherited from cgv::media::mesh::obj_reader_base
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
 
int minus
 
unsigned nr_normals
 
unsigned nr_texcoords
 
bool have_default_material
 
std::set< std::string > mtl_lib_files
 
std::string path_name
 store the path name
 

Additional Inherited Members

- Static Public Member Functions inherited from cgv::media::mesh::obj_reader_generic< T >
static bool is_double (const char *begin, const char *end, coord_type &value)
 
- Protected Member Functions inherited from cgv::media::mesh::obj_reader_generic< T >
vec2_type parse_vec2 (const std::vector< cgv::utils::token > &t) const
 parse 2d vector
 
vec3_type parse_vec3 (const std::vector< cgv::utils::token > &t) const
 parse 3d vector
 
void parse_and_process_vertex (const std::vector< cgv::utils::token > &tokens)
 
void parse_and_process_normal (const std::vector< cgv::utils::token > &tokens)
 
void parse_and_process_texcoord (const std::vector< cgv::utils::token > &tokens)
 
- Protected Member Functions inherited from cgv::media::mesh::obj_reader_base
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, bool is_line=false)
 
void parse_material (const std::vector< cgv::utils::token > &tokens)
 
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 void process_comment (const std::string &comment)
 overide this function to process a comment
 
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_line (unsigned vcount, int *vertices, int *texcoords=0, int *normals=0)
 overide this function to process a line strip, the indices start with 0
 

Detailed Description

template<typename T>
class cgv::media::mesh::simple_mesh_obj_reader< T >

Definition at line 465 of file simple_mesh.cxx.

Member Typedef Documentation

◆ color_type

template<typename T >
typedef illum::obj_material::color_type cgv::media::mesh::simple_mesh_obj_reader< T >::color_type

type used for rgba colors

Definition at line 475 of file simple_mesh.cxx.

◆ coord_type

template<typename T >
typedef T cgv::media::mesh::simple_mesh_obj_reader< T >::coord_type

type of coordinates

Definition at line 469 of file simple_mesh.cxx.

◆ idx_type

template<typename T >
typedef simple_mesh<T>::idx_type cgv::media::mesh::simple_mesh_obj_reader< T >::idx_type

Definition at line 477 of file simple_mesh.cxx.

◆ vec2_type

template<typename T >
typedef cgv::math::fvec<T,2> cgv::media::mesh::simple_mesh_obj_reader< T >::vec2_type

type used to store texture coordinates

Definition at line 471 of file simple_mesh.cxx.

◆ vec3_type

template<typename T >
typedef cgv::math::fvec<T,3> cgv::media::mesh::simple_mesh_obj_reader< T >::vec3_type

type used to store positions and normal vectors

Definition at line 473 of file simple_mesh.cxx.

Constructor & Destructor Documentation

◆ simple_mesh_obj_reader()

template<typename T >
cgv::media::mesh::simple_mesh_obj_reader< T >::simple_mesh_obj_reader ( simple_mesh< T > &  _mesh)
inline

Definition at line 481 of file simple_mesh.cxx.

Member Function Documentation

◆ process_color()

template<typename T >
void cgv::media::mesh::simple_mesh_obj_reader< T >::process_color ( const color_type c)
inlinevirtual

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)

Reimplemented from cgv::media::mesh::obj_reader_base.

Definition at line 487 of file simple_mesh.cxx.

References cgv::media::colored_model::get_nr_colors(), cgv::media::colored_model::resize_colors(), and cgv::media::colored_model::set_color().

◆ process_face()

template<typename T >
void cgv::media::mesh::simple_mesh_obj_reader< T >::process_face ( unsigned  vcount,
int *  vertices,
int *  texcoords,
int *  normals 
)
inlinevirtual

◆ process_group()

template<typename T >
void cgv::media::mesh::simple_mesh_obj_reader< T >::process_group ( const std::string &  name,
const std::string &  parameters 
)
inlinevirtual

overide this function to process a group given by name and parameter string

Reimplemented from cgv::media::mesh::obj_reader_base.

Definition at line 516 of file simple_mesh.cxx.

◆ process_material()

template<typename T >
void cgv::media::mesh::simple_mesh_obj_reader< T >::process_material ( const cgv::media::illum::obj_material mtl,
unsigned  idx 
)
inlinevirtual

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

Reimplemented from cgv::media::mesh::obj_reader_base.

Definition at line 521 of file simple_mesh.cxx.

◆ process_normal()

template<typename T >
void cgv::media::mesh::simple_mesh_obj_reader< T >::process_normal ( const vec3_type n)
inlinevirtual

overide this function to process a normal

Reimplemented from cgv::media::mesh::obj_reader_generic< T >.

Definition at line 489 of file simple_mesh.cxx.

◆ process_texcoord()

template<typename T >
void cgv::media::mesh::simple_mesh_obj_reader< T >::process_texcoord ( const vec2_type t)
inlinevirtual

overide this function to process a texcoord

Reimplemented from cgv::media::mesh::obj_reader_generic< T >.

Definition at line 485 of file simple_mesh.cxx.

◆ process_vertex()

template<typename T >
void cgv::media::mesh::simple_mesh_obj_reader< T >::process_vertex ( const vec3_type p)
inlinevirtual

overide this function to process a vertex

Reimplemented from cgv::media::mesh::obj_reader_generic< T >.

Definition at line 483 of file simple_mesh.cxx.

Member Data Documentation

◆ mesh

template<typename T >
simple_mesh<T>& cgv::media::mesh::simple_mesh_obj_reader< T >::mesh
protected

Definition at line 479 of file simple_mesh.cxx.


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