37 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,
bool is_line =
false);
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;
54 unsigned get_current_group()
const;
56 unsigned get_current_material()
const;
61 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_line(
unsigned vcount,
int *vertices,
70 int *texcoords = 0,
int *normals = 0);
72 virtual void process_face(
unsigned vcount,
int* vertices,
73 int* texcoords = 0,
int* normals = 0);
75 virtual void process_group(
const std::string& name,
const std::string& parameters);
83 virtual bool parse_obj(
const std::string& content,
const std::string path_name =
"");
85 virtual bool read_obj(
const std::string& file_name);
87 virtual bool read_mtl(
const std::string& file_name);
107 static bool is_double(
const char* begin,
const char* end,
coord_type& value);
112 vec2_type parse_vec2(
const std::vector<cgv::utils::token>& t)
const;
114 vec3_type parse_vec3(
const std::vector<cgv::utils::token>& t)
const;
116 void parse_and_process_vertex(
const std::vector<cgv::utils::token>& tokens);
118 void parse_and_process_normal(
const std::vector<cgv::utils::token>& tokens);
120 void parse_and_process_texcoord(
const std::vector<cgv::utils::token>& tokens);
126 virtual void process_vertex(
const vec3_type& p);
128 virtual void process_texcoord(
const vec2_type& t);
130 virtual void process_normal(
const vec3_type& n);