@@ -969,7 +969,7 @@ static bool parseLine(Command *command, const char *p, size_t p_len,
969969 // vertex
970970 if (token[0 ] == ' v' && IS_SPACE ((token[1 ]))) {
971971 token += 2 ;
972- float x, y, z;
972+ float x = 0 . 0f , y = 0 . 0f , z = 0 . 0f ;
973973 parseFloat3 (&x, &y, &z, &token);
974974 command->vx = x;
975975 command->vy = y;
@@ -981,7 +981,7 @@ static bool parseLine(Command *command, const char *p, size_t p_len,
981981 // normal
982982 if (token[0 ] == ' v' && token[1 ] == ' n' && IS_SPACE ((token[2 ]))) {
983983 token += 3 ;
984- float x, y, z;
984+ float x = 0 . 0f , y = 0 . 0f , z = 0 . 0f ;
985985 parseFloat3 (&x, &y, &z, &token);
986986 command->nx = x;
987987 command->ny = y;
@@ -993,7 +993,7 @@ static bool parseLine(Command *command, const char *p, size_t p_len,
993993 // texcoord
994994 if (token[0 ] == ' v' && token[1 ] == ' t' && IS_SPACE ((token[2 ]))) {
995995 token += 3 ;
996- float x, y;
996+ float x = 0 . 0f , y = 0 . 0f ;
997997 parseFloat2 (&x, &y, &token);
998998 command->tx = x;
999999 command->ty = y;
@@ -1360,10 +1360,11 @@ bool parseObj(attrib_t *attrib, std::vector<shape_t> *shapes, const char *buf,
13601360 num_f += command_count[t].num_f ;
13611361 num_faces += command_count[t].num_faces ;
13621362 }
1363- // std::cout << "# v " << num_v << std::endl;
1364- // std::cout << "# vn " << num_vn << std::endl;
1365- // std::cout << "# vt " << num_vt << std::endl;
1366- // std::cout << "# f " << num_f << std::endl;
1363+
1364+ // std::cout << "# v " << num_v << std::endl;
1365+ // std::cout << "# vn " << num_vn << std::endl;
1366+ // std::cout << "# vt " << num_vt << std::endl;
1367+ // std::cout << "# f " << num_f << std::endl;
13671368
13681369 // 4. merge
13691370 // @todo { parallelize merge. }
@@ -1442,9 +1443,9 @@ bool parseObj(attrib_t *attrib, std::vector<shape_t> *shapes, const char *buf,
14421443 for (size_t k = 0 ; k < commands[t][i].f .size (); k++) {
14431444 vertex_index &vi = commands[t][i].f [k];
14441445 int v_idx = fixIndex (vi.v_idx , v_count);
1445- int vn_idx = fixIndex (vi.vn_idx , n_count);
14461446 int vt_idx = fixIndex (vi.vt_idx , t_count);
1447- attrib->faces [f_count + k] = vertex_index (v_idx, vn_idx, vt_idx);
1447+ int vn_idx = fixIndex (vi.vn_idx , n_count);
1448+ attrib->faces [f_count + k] = vertex_index (v_idx, vt_idx, vn_idx);
14481449 }
14491450 attrib->material_ids [face_count] = material_id;
14501451 attrib->face_num_verts [face_count] = commands[t][i].f .size ();
0 commit comments