Changed: Use VSCode auto-formatter.
This commit is contained in:
@@ -88,7 +88,6 @@ void ObjLoader::load(MeshFrame *o_result, char *t_filename, float t_scale, u8 t_
|
|||||||
&vertexIndex[0], &coordIndex[0], &normalIndex[0],
|
&vertexIndex[0], &coordIndex[0], &normalIndex[0],
|
||||||
&vertexIndex[1], &coordIndex[1], &normalIndex[1],
|
&vertexIndex[1], &coordIndex[1], &normalIndex[1],
|
||||||
&vertexIndex[2], &coordIndex[2], &normalIndex[2]);
|
&vertexIndex[2], &coordIndex[2], &normalIndex[2]);
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
/* Loaded only two digits (V, VT) succesfuly. Not setting VN. */
|
/* Loaded only two digits (V, VT) succesfuly. Not setting VN. */
|
||||||
@@ -98,7 +97,6 @@ void ObjLoader::load(MeshFrame *o_result, char *t_filename, float t_scale, u8 t_
|
|||||||
&vertexIndex[0], &coordIndex[0],
|
&vertexIndex[0], &coordIndex[0],
|
||||||
&vertexIndex[1], &coordIndex[1],
|
&vertexIndex[1], &coordIndex[1],
|
||||||
&vertexIndex[2], &coordIndex[2]);
|
&vertexIndex[2], &coordIndex[2]);
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
/* Only V set. Checking for existance of VT or VN. */
|
/* Only V set. Checking for existance of VT or VN. */
|
||||||
@@ -107,23 +105,26 @@ void ObjLoader::load(MeshFrame *o_result, char *t_filename, float t_scale, u8 t_
|
|||||||
/* Check for existance of V/// configuration.. */
|
/* Check for existance of V/// configuration.. */
|
||||||
newerMatches = fscanf(file, "%d/// %d/// %d///\n", x, x, x);
|
newerMatches = fscanf(file, "%d/// %d/// %d///\n", x, x, x);
|
||||||
fsetpos(file, &start);
|
fsetpos(file, &start);
|
||||||
if(newerMatches==3){
|
if (newerMatches == 3)
|
||||||
|
{
|
||||||
/* Configuration confirmed. */
|
/* Configuration confirmed. */
|
||||||
fscanf(file, "%d/// %d/// %d///\n", &vertexIndex[0], &vertexIndex[1], &vertexIndex[2]);
|
fscanf(file, "%d/// %d/// %d///\n", &vertexIndex[0], &vertexIndex[1], &vertexIndex[2]);
|
||||||
|
}
|
||||||
}else
|
else
|
||||||
{
|
{
|
||||||
/* Failed, checking configuration V//VN */
|
/* Failed, checking configuration V//VN */
|
||||||
newerMatches = fscanf(file, "%d//%d %d//%d %d//%d", x, x, x, x, x, x);
|
newerMatches = fscanf(file, "%d//%d %d//%d %d//%d", x, x, x, x, x, x);
|
||||||
fsetpos(file, &start);
|
fsetpos(file, &start);
|
||||||
if(newerMatches==6){
|
if (newerMatches == 6)
|
||||||
|
{
|
||||||
/* Configuration confirmed. */
|
/* Configuration confirmed. */
|
||||||
newerMatches = fscanf(file, "%d//%d %d//%d %d//%d",
|
newerMatches = fscanf(file, "%d//%d %d//%d %d//%d",
|
||||||
&vertexIndex[0], &normalIndex[0],
|
&vertexIndex[0], &normalIndex[0],
|
||||||
&vertexIndex[1], &normalIndex[1],
|
&vertexIndex[1], &normalIndex[1],
|
||||||
&vertexIndex[2], &normalIndex[2]);
|
&vertexIndex[2], &normalIndex[2]);
|
||||||
}
|
}
|
||||||
else{
|
else
|
||||||
|
{
|
||||||
/*Unknown configuration.*/
|
/*Unknown configuration.*/
|
||||||
PRINT_ERR("Unknown .obj face for .obj file!");
|
PRINT_ERR("Unknown .obj face for .obj file!");
|
||||||
printf("Obj file mentioned: \"%s\"\n", path);
|
printf("Obj file mentioned: \"%s\"\n", path);
|
||||||
@@ -134,7 +135,6 @@ void ObjLoader::load(MeshFrame *o_result, char *t_filename, float t_scale, u8 t_
|
|||||||
PRINT_ERR("Unknown faces format in .obj file!");
|
PRINT_ERR("Unknown faces format in .obj file!");
|
||||||
printf(" \"%s\"\n", path);
|
printf(" \"%s\"\n", path);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
/* if(ferror(file))
|
/* if(ferror(file))
|
||||||
PRINT_ERR("Failed to load .obj file \"%s\".");
|
PRINT_ERR("Failed to load .obj file \"%s\".");
|
||||||
@@ -194,17 +194,14 @@ void ObjLoader::load(MeshFrame *o_result, char *t_filename, float t_scale, u8 t_
|
|||||||
o_result->getMaterial(materialsI).setNormalFace(faceI, normalIndex[0] - 1);
|
o_result->getMaterial(materialsI).setNormalFace(faceI, normalIndex[0] - 1);
|
||||||
o_result->getMaterial(materialsI).setNormalFace(faceI + 1, normalIndex[1] - 1);
|
o_result->getMaterial(materialsI).setNormalFace(faceI + 1, normalIndex[1] - 1);
|
||||||
o_result->getMaterial(materialsI).setNormalFace(faceI + 2, normalIndex[2] - 1);
|
o_result->getMaterial(materialsI).setNormalFace(faceI + 2, normalIndex[2] - 1);
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
o_result->calculateBoundingBoxes();
|
o_result->calculateBoundingBoxes();
|
||||||
fclose(file);
|
fclose(file);
|
||||||
|
|||||||
Reference in New Issue
Block a user