shithub: libobj

Download patch

ref: b67c52fb5d8ea4ec8ac9ca8490619898feaaf3f0
parent: 6be6c7a12a4dc890ca67750aa8924f430b2922ea
author: rodri <rgl@antares-labs.eu>
date: Sat Sep 21 07:05:13 EDT 2024

allow '-' in object and material names.

--- a/obj.c
+++ b/obj.c
@@ -629,7 +629,7 @@
 			}
 			do{
 				*p++ = c;
-			}while(c = Bgetc(bin), (isalnum(c) || c == '.' || c == '_') && p-buf < sizeof(buf)-1);
+			}while(c = Bgetc(bin), (isalnum(c) || c == '.' || c == '_' || c == '-') && p-buf < sizeof(buf)-1);
 			*p = 0;
 			o = geto(obj, buf);
 			if(o == nil){
@@ -850,7 +850,7 @@
 				p = buf;
 				do{
 					*p++ = c;
-				}while(c = Bgetc(bin), (isalnum(c) || c == '.' || c == '_') && p-buf < sizeof(buf)-1);
+				}while(c = Bgetc(bin), (isalnum(c) || c == '.' || c == '_' || c == '-') && p-buf < sizeof(buf)-1);
 				*p = 0;
 				if((obj->materials = objmtlparse(buf)) == nil){
 					error("objmtlparse: %r");
@@ -862,7 +862,7 @@
 				p = buf;
 				do{
 					*p++ = c;
-				}while(c = Bgetc(bin), (isalnum(c) || c == '.' || c == '_') && p-buf < sizeof(buf)-1);
+				}while(c = Bgetc(bin), (isalnum(c) || c == '.' || c == '_' || c == '-') && p-buf < sizeof(buf)-1);
 				*p = 0;
 				if(obj->materials != nil && (m = getmtl(obj->materials, buf)) == nil){
 					error("no material '%s' found", buf);