ref: 1af782b52c796fd341621b0c9de2dea3a1c7c660
parent: c7f2ba6465d213923e25174db722ca13716ec018
author: rodri <rgl@antares-labs.eu>
date: Fri Sep 27 17:04:56 EDT 2024
obj: make it right.
--- a/.workspace
+++ b/.workspace
@@ -1,6 +1,5 @@
#!/bin/rc
bind -bc ../libgraphics libgraphics
-bind -bc ../libobj libgraphics/libobj
bind -bc ../libobj libobj
B *.[hc] mkfile readme
--- a/obj.c
+++ b/obj.c
@@ -325,7 +325,7 @@
static void
usage(void)
{
- fprint(2, "usage: %s [file]\n", argv0);
+ fprint(2, "usage: %s objfile dstdir\n", argv0);
exits("usage");
}
@@ -333,18 +333,17 @@
threadmain(int argc, char *argv[])
{
Model *m;
- char *infile;
- infile = "/fd/0";
ARGBEGIN{
default: usage();
}ARGEND;
- if(argc == 1)
- infile = argv[0];
- else if(argc != 0)
+ if(argc != 2)
usage();
- m = readobjmodel(infile);
- writemodel(1, m);
+ m = readobjmodel(argv[0]);
+ if(m == nil)
+ sysfatal("readobjmodel: %r");
+ if(exportmodel(argv[1], m) < 0)
+ sysfatal("exportmodel: %r");
exits(nil);
}
--- a/readme
+++ b/readme
@@ -94,12 +94,11 @@
positions.
- obj [file]
+ obj objfile dir
- As of now this tool will take a Wavefront OBJ file, with all its materials,
+ This tool will take a Wavefront OBJ file objfile, with all its materials,
and convert it into a model(6) file (see libgraphics/model.6.txt) that's
- written to stdout. The only exception is textures, which aren't taken care
- of yet. This will change soon.
+ written, along with its assets, inside the directory dir.
CUBEMAPS