3 #include <cgv/math/fvec.h>
4 #include <cgv/media/illum/obj_material.hh>
5 #include <cgv/utils/tokenizer.h>
11 #include <cgv/media/lib_begin.h>
36 color_type parse_color(
const std::vector<cgv::utils::token>& t,
unsigned off = 0)
const;
39 unsigned nr_normals, nr_texcoords;
40 bool have_default_material;
41 std::set<std::string> mtl_lib_files;
42 void parse_face(
const std::vector<cgv::utils::token>& tokens);
43 void parse_material(
const std::vector<cgv::utils::token>& tokens);
44 virtual void parse_and_process_vertex(
const std::vector<cgv::utils::token>& tokens) = 0;
45 virtual void parse_and_process_normal(
const std::vector<cgv::utils::token>& tokens) = 0;
46 virtual void parse_and_process_texcoord(
const std::vector<cgv::utils::token>& tokens) = 0;
51 std::string path_name;
54 unsigned get_current_group()
const;
56 unsigned get_current_material()
const;
60 virtual void process_comment(
const std::string& comment);
63 virtual void process_color(
const color_type& c);
65 void convert_to_positive(
unsigned vcount,
int *vertices,
66 int *texcoords,
int *normals,
67 unsigned v,
unsigned n,
unsigned t);
69 virtual void process_face(
unsigned vcount,
int *vertices,
70 int *texcoords = 0,
int *normals = 0);
72 virtual void process_group(
const std::string& name,
const std::string& parameters);
80 virtual bool read_obj(
const std::string& file_name);
82 virtual bool read_mtl(
const std::string& file_name);
102 static bool is_double(
const char* begin,
const char* end,
crd_type& value);
106 v2d_type parse_v2d(
const std::vector<cgv::utils::token>& t)
const;
109 v3d_type parse_v3d(
const std::vector<cgv::utils::token>& t)
const;
111 void parse_and_process_vertex(
const std::vector<cgv::utils::token>& tokens);
113 void parse_and_process_normal(
const std::vector<cgv::utils::token>& tokens);
115 void parse_and_process_texcoord(
const std::vector<cgv::utils::token>& tokens);
120 virtual void process_vertex(
const v3d_type& p);
123 virtual void process_texcoord(
const v2d_type& t);
125 virtual void process_normal(
const v3d_type& n);
140 #include <cgv/config/lib_end.h>