From 1af782b52c796fd341621b0c9de2dea3a1c7c660 Mon Sep 17 00:00:00 2001 From: rodri Date: Fri, 27 Sep 2024 21:04:56 +0000 Subject: obj: make it right. --- .workspace | 1 - obj.c | 15 +++++++-------- readme | 7 +++---- 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/.workspace b/.workspace index c39eb66..4ef2181 100755 --- 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 diff --git a/obj.c b/obj.c index 9f296a2..a2e5936 100644 --- a/obj.c +++ b/obj.c @@ -325,7 +325,7 @@ readobjmodel(char *path) 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 @@ void 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); } diff --git a/readme b/readme index 8a62116..a888d60 100644 --- a/readme +++ b/readme @@ -94,12 +94,11 @@ USAGE 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 -- cgit v1.2.3