diff options
| author | Ray <raysan5@gmail.com> | 2016-08-31 10:22:40 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-08-31 10:22:40 +0200 |
| commit | d27709b1f20f3630354990f30aaf70442cb176f3 (patch) | |
| tree | 149981ded9aa340fa208c8aa913351d3cb3f8067 | |
| parent | be97583f00997fa918a15d0164190ae6876d0571 (diff) | |
| parent | 384602e5b59bf67e2e7b5e6dd40bf78c32a5bb21 (diff) | |
| download | raylib-d27709b1f20f3630354990f30aaf70442cb176f3.tar.gz raylib-d27709b1f20f3630354990f30aaf70442cb176f3.zip | |
Merge pull request #188 from teodor-stoenescu/develop
Greater LoadOBJ() flexibility
| -rw-r--r-- | src/models.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/models.c b/src/models.c index e9044e96..55de3d4f 100644 --- a/src/models.c +++ b/src/models.c @@ -1898,9 +1898,7 @@ static Mesh LoadOBJ(const char *fileName) if (dataType == 't') // Read texCoord { - float useless = 0; - - fscanf(objFile, "%f %f %f", &midTexCoords[countTexCoords].x, &midTexCoords[countTexCoords].y, &useless); + fscanf(objFile, "%f %f%*[^\n]s\n", &midTexCoords[countTexCoords].x, &midTexCoords[countTexCoords].y); countTexCoords++; fscanf(objFile, "%c", &dataType); @@ -1959,6 +1957,7 @@ static Mesh LoadOBJ(const char *fileName) if ((numNormals == 0) && (numTexCoords == 0)) fscanf(objFile, "%i %i %i", &vNum[0], &vNum[1], &vNum[2]); else if (numNormals == 0) fscanf(objFile, "%i/%i %i/%i %i/%i", &vNum[0], &vtNum[0], &vNum[1], &vtNum[1], &vNum[2], &vtNum[2]); + else if (numTexCoords == 0) fscanf(objFile, "%i//%i %i//%i %i//%i", &vNum[0], &vnNum[0], &vNum[1], &vnNum[1], &vNum[2], &vnNum[2]); else fscanf(objFile, "%i/%i/%i %i/%i/%i %i/%i/%i", &vNum[0], &vtNum[0], &vnNum[0], &vNum[1], &vtNum[1], &vnNum[1], &vNum[2], &vtNum[2], &vnNum[2]); mesh.vertices[vCounter] = midVertices[vNum[0]-1].x; |
