From 90c62c4cc0bc79ea51ae114467757a8d80c38fa6 Mon Sep 17 00:00:00 2001 From: victorfisac Date: Fri, 20 May 2016 14:07:50 +0200 Subject: [PATCH 1/2] Fix small warning Material glossiness is a float type value... --- src/models.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/models.c b/src/models.c index 44e30390..0e59242b 100644 --- a/src/models.c +++ b/src/models.c @@ -2068,7 +2068,7 @@ static Material LoadMTL(const char *fileName) { if (buffer[1] == 's') // Ns int Shininess (specular exponent). Ranges from 0 to 1000. { - sscanf(buffer, "Ns %i", &material.glossiness); + sscanf(buffer, "Ns %f", &material.glossiness); } else if (buffer[1] == 'i') // Ni int Refraction index. { From 3fa6fdacf2be438cfc81d3ae5ef2b58801aecce6 Mon Sep 17 00:00:00 2001 From: victorfisac Date: Fri, 20 May 2016 14:24:53 +0200 Subject: [PATCH 2/2] Improved MTL loading shininess value --- src/models.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/models.c b/src/models.c index 0e59242b..414f6716 100644 --- a/src/models.c +++ b/src/models.c @@ -2068,7 +2068,11 @@ static Material LoadMTL(const char *fileName) { if (buffer[1] == 's') // Ns int Shininess (specular exponent). Ranges from 0 to 1000. { - sscanf(buffer, "Ns %f", &material.glossiness); + int shininess = 0; + sscanf(buffer, "Ns %i", &shininess); + + // Normalize shininess value to material glossiness attribute + material.glossiness = (float)shininess/1000; } else if (buffer[1] == 'i') // Ni int Refraction index. {