324 while (isspace(input[index]))
326 if (++index == input.size())
331 switch (input[index++])
351 while (index < input.size() && isspace(input[index]))
356 while (index < input.size() && !isspace(input[index]))
358 tval.push_back(input[index++]);
363 if (tval.find(
"///") != string::npos)
365 sscanf(tval.data(),
"%lu///", &tvertex.v);
367 else if (tval.find(
"//") != string::npos)
369 sscanf(tval.data(),
"%lu//%lu", &tvertex.v, &tvertex.vn);
373 sscanf(tval.data(),
"%lu/%lu/%lu", &tvertex.v, &tvertex.vt, &tvertex.vn);
376 tface.vertices.push_back(tvertex);
378 }
while (index < input.size());
385 vector <string> tgroups;
388 while (index < input.size() && isspace(input[index]))
393 while (index < input.size() && !isspace(input[index]))
395 tgroup.push_back(input[index++]);
399 tgroups.push_back(tgroup);
401 }
while (index < input.size());
410 switch (input[index+1])
421 while (index < input.size() && isspace(input[index]))
426 while (index < input.size() && !isspace(input[index]))
428 tval.push_back(input[index++]);
433 sscanf(tval.data(),
"%lu/%lu", &tvertex.v, &tvertex.vt);
434 tline.vertices.push_back(tvertex);
436 }
while (index < input.size());
443 switch (input[index])
447 string mtlname = input.substr(input.find(
" ")+1);
452 ifstream mtlfile(
location+
"/"+mtlname);
454 while (std::getline(mtlfile, sinput))
463 while (index < input.size() && isspace(input[index]))
467 name = input.substr(index, input.size());
471 switch (input[index+1])
480 while (index < input.size() && isspace(input[index]))
485 while (index < input.size() && !isspace(input[index]))
487 tval.push_back(input[index++]);
492 sscanf(&input[index],
"%lu", &tpoint.vertex);
495 }
while (index < input.size());
507 string mtlname = input.substr(input.find(
" ")+1);
509 for (
size_t j=0; j<
Materials.size(); ++j)
524 switch (input[index])
529 int i = sscanf(&input[index],
"%lf %lf %lf", &tvec.
x, &tvec.
y, &tvec.
z);
530 if (i == 1 || i == 2 || i == 3)
539 int i = sscanf(&input[index],
"%lf %lf %lf", &tvec.
x, &tvec.
y, &tvec.
z);
540 if (i == 1 || i == 2 || i == 3)
549 int i = sscanf(&input[index],
"%lf %lf %lf", &tvec.
x, &tvec.
y, &tvec.
z);
550 if (i == 1 || i == 2 || i == 3)
558 int i = sscanf(&input[index],
"%lf %lf %lf %lf", &tvec.
x, &tvec.
y, &tvec.
z, &tvec.
w);
559 if (i == 3 || i == 4)
size_t add_texture_vertex(Vector v)
Definition: objlib.cpp:40
vector< group > Groups
Definition: objlib.h:328
vector< material > Materials
Definition: objlib.h:324
int i
Definition: rw_test.cpp:37
void add_face(face face)
Definition: objlib.cpp:87
void add_line(line line)
Definition: objlib.cpp:75
double y
Definition: vector.h:713
size_t add_normal_vertex(Vector v)
Definition: objlib.cpp:46
void modify_groups(vector< string > groups)
Definition: objlib.cpp:107
size_t add_parameter_vertex(Vector v)
Definition: objlib.cpp:52
size_t add_geometric_vertex(Vector v)
Definition: objlib.cpp:34
double z
Definition: vector.h:714
void add_point(point point)
Definition: objlib.cpp:63
bool data_isfile(string path, off_t size)
Definition: datalib.cpp:1895
double x
Definition: vector.h:712
Vector Class.
Definition: vector.h:672
string location
Definition: objlib.h:404
double w
Definition: vector.h:715
vector< size_t > cGroups
Definition: objlib.h:401
void parsemtl(string input)
Definition: objlib.cpp:571
string name
Definition: objlib.h:329