shithub: 3dee

Download patch

ref: 9c83b71274dd94ffb66db6230580d6a315ea8548
parent: 313b109b27c9290783c38f1806f437fd2f033f3e
author: rodri <rgl@antares-labs.eu>
date: Sun Jun 22 21:24:57 EDT 2025

toobj: only add a material if the Model has one. raise the max memory limit

--- a/toobj.c
+++ b/toobj.c
@@ -4,6 +4,7 @@
 #include <draw.h>
 #include <memdraw.h>
 #include <geometry.h>
+#include <pool.h>
 #include "libgraphics/graphics.h"
 #include "fns.h"
 #include "libobj/obj.h"
@@ -43,7 +44,8 @@
 	Material *mtl;
 	int i, idx;
 
-	obj->materials = objallocmtl("main.mtl");
+	if(m->nmaterials > 0)
+		obj->materials = objallocmtl("main.mtl");
 	for(mtl = m->materials; mtl < m->materials + m->nmaterials; mtl++){
 		objmtl = objallocmt(mtl->name);
 
@@ -185,6 +187,9 @@
 	OBJ *obj;
 	char *infile, *dstdir;
 	int fd;
+
+	/* we could be dealing with some pretty beefy data */
+	mainmem->maxsize = (uintptr)~0;
 
 	OBJfmtinstall();
 	ARGBEGIN{
--