diff options
author | taw27 <taw27@84d2e878-0bd5-11dd-ad15-13eda11d74c5> | 2008-04-16 18:28:14 +0000 |
---|---|---|
committer | taw27 <taw27@84d2e878-0bd5-11dd-ad15-13eda11d74c5> | 2008-04-16 18:28:14 +0000 |
commit | 6c8866fbc243e59d1b3a6d58525a449cbeb9e974 (patch) | |
tree | b7084ce647471f0da512c135fe8b3ec0e01f8a46 /src/model.c | |
parent | 9d4509e7626805853a7f469c8c7f5b30dfb67d60 (diff) |
assplode() routine to help with parsing
git-svn-id: svn://cook.msm.cam.ac.uk:745/thrust3d/thrust3d@4 84d2e878-0bd5-11dd-ad15-13eda11d74c5
Diffstat (limited to 'src/model.c')
-rw-r--r-- | src/model.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/model.c b/src/model.c index d50159d..40ecde8 100644 --- a/src/model.c +++ b/src/model.c @@ -213,13 +213,30 @@ static int model_load_obj(ModelContext *ctx, const char *name, RenderContext *re } if ( line[s] == 'f' ) { - + char **bits; + int i, n; + n = assplode(line, " \t\r\n", &bits); + printf("The %i bits are:\n", n); + for ( i=0; i<n; i++ ) { + char **sp; + int np, ip; + printf("%3i: '%s'\n", i, bits[i]); + np = assplode(bits[i], "/", &sp); + for ( ip=0; ip<np; ip++ ) { + printf("Subbit %i: '%s'\n", ip, sp[ip]); + } + if ( np < 3 ) { + continue; + } + free(bits[i]); + } + free(bits); } } fclose(fh); - + return model_add(ctx, model); } |