Compare commits
No commits in common. "ce2154d9c12bea1a40b3d92bf0328e1a3ec05a5c" and "457afac7c0a208413ff6a7f1d0932da76ecf685b" have entirely different histories.
ce2154d9c1
...
457afac7c0
8
Makefile
8
Makefile
@ -12,19 +12,19 @@ CC = gcc
|
||||
|
||||
OPT = -Wall -g -O3 -DDEBUG_LEVEL=0 -DMUST_ABORT=0
|
||||
|
||||
libbubulles.a: bubulles.o edges.o
|
||||
libbubulles.a: bubulles.o importobj.o
|
||||
ar r $@ $?
|
||||
|
||||
bubulles.o: bubulles.c bubulles.h Makefile
|
||||
$(CC) $(OPT) -c $<
|
||||
|
||||
edges.o: edges.c bubulles.h edges.h Makefile
|
||||
importobj.o: importobj.c bubulles.h Makefile
|
||||
$(CC) $(OPT) -c $<
|
||||
|
||||
# ------------------------------------------------
|
||||
# --- build some tests and tools
|
||||
|
||||
tbb: tbb.c bubulles.h libbubulles.a Makefile
|
||||
$(CC) $(OPT) $< libbubulles.a -o tbb
|
||||
tbb: tbb.c bubulles.h bubulles.o Makefile
|
||||
$(CC) $(OPT) $< bubulles.o -o tbb
|
||||
|
||||
#############################################
|
||||
|
@ -9,7 +9,6 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "bubulles.h"
|
||||
#include "edges.h"
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
||||
@ -33,8 +32,6 @@ printf("%-15s %4lu\n", "XYZ", sizeof(XYZ));
|
||||
printf("%-15s %4lu\n", "RGBA", sizeof(RGBA));
|
||||
printf("%-15s %4lu\n", "Bubulle", sizeof(Bubulle));
|
||||
printf("%-15s %4lu\n", "BBList", sizeof(BBList));
|
||||
printf("%-15s %4lu\n", "AnEdge", sizeof(AnEdge));
|
||||
printf("%-15s %4lu\n", "EdgeList", sizeof(EdgeList));
|
||||
puts("");
|
||||
}
|
||||
|
||||
@ -231,8 +228,10 @@ fprintf(stderr, "*** %s : array at %p, sz %d\n", __func__, ar, bbl->size);
|
||||
for (idx=0; idx<bbl->fidx; idx++) {
|
||||
fprintf(fp, "%12.6f %12.6f %12.6f",
|
||||
ar[idx].p.x, ar[idx].p.y, ar[idx].p.z);
|
||||
|
||||
if (opts & 0x01) fprintf(fp, " %12.6f", ar[idx].d);
|
||||
if (opts & 0x02) fprintf(fp, " %6d", ar[idx].gray);
|
||||
|
||||
fputs("\n", fp);
|
||||
}
|
||||
fflush(fp);
|
||||
@ -249,6 +248,7 @@ printf("xyzd %11.6f %11.6f %11.6f %11.6f\n",
|
||||
printf("diam %11.6f gray %5d\n", what->d, what->gray);
|
||||
printf("rgba %11.6f %11.6f %11.6f %11.6f\n",
|
||||
what->col.r, what->col.g, what->col.b, what->col.a);
|
||||
|
||||
puts("----------------------------------------------------------");
|
||||
|
||||
return 0;
|
||||
|
@ -4,9 +4,9 @@
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
||||
#define LIBBB_VERSION 60
|
||||
#define LIBBB_VERSION 57
|
||||
|
||||
#define SZ_BUBULLE_TEXT 81 /* arbitrary value */
|
||||
#define SZ_BUBULLE_TEXT 51 /* arbitrary value */
|
||||
|
||||
/* a 3d space coordinate */
|
||||
typedef struct {
|
||||
@ -77,7 +77,7 @@ int fprint_bubulles(FILE *fp, char *title, BBList *bbl, int flags);
|
||||
int niceprint_bubulle(Bubulle *what, int unused);
|
||||
|
||||
/* this is just a wtf function * see tbb.c */
|
||||
int bubulles_to_data(char *fname, char *title, BBList *bbl, int flags);
|
||||
int bubulles_to_data(char *fname, char *title, BBList *bbl, int k);
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
/* sometime we want to look at the bounding box */
|
||||
|
23
edges.c
23
edges.c
@ -1,23 +0,0 @@
|
||||
/*
|
||||
* edges.c
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "bubulles.h"
|
||||
#include "edges.h"
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
int print_edgelist_desc(EdgeList *list, int k)
|
||||
{
|
||||
|
||||
printf("edgelist addr: %p\n", list);
|
||||
|
||||
if (k) {
|
||||
fprintf(stderr, "%s: k must be 0, was %d\n", __func__, k);
|
||||
return k;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
/* --------------------------------------------------------------------- */
|
19
edges.h
19
edges.h
@ -1,19 +0,0 @@
|
||||
/*
|
||||
* edges.h
|
||||
*/
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
||||
typedef struct {
|
||||
int A, B;
|
||||
} AnEdge;
|
||||
|
||||
typedef struct {
|
||||
char name[SZ_BUBULLE_TEXT+1];
|
||||
int size; /* max number of edges */
|
||||
int fidx; /* next free slot */
|
||||
AnEdge *edges;
|
||||
unsigned long flags;
|
||||
} EdgeList;
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
@ -8,8 +8,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "../bubulles.h"
|
||||
#include "../edges.h"
|
||||
#include "bubulles.h"
|
||||
|
||||
extern int verbosity;
|
||||
|
||||
@ -23,19 +22,18 @@ typedef struct {
|
||||
int id;
|
||||
} Tokens;
|
||||
|
||||
enum token_id { T_comment=1, T_vertice, T_group, T_face };
|
||||
enum token_id { T_comment=1, T_vertice };
|
||||
|
||||
Tokens TokenList[] = {
|
||||
{ "#", T_comment },
|
||||
{ "v", T_vertice },
|
||||
{ "g", T_group }, // to be verified
|
||||
{ "f", T_face },
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
static int type_of_the_line(char *text)
|
||||
{
|
||||
Tokens *token;
|
||||
int id;
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, "%s is searching '%s'\n", __func__, text);
|
||||
@ -76,12 +74,12 @@ int try_to_read_an_OBJ_file(char *infname, char *outfname, int notused)
|
||||
FILE *fpin;
|
||||
char line[LINE_SZ+1], *cptr;
|
||||
float x, y, z;
|
||||
int foo, nbre, tokenid, fa, fb, ix;
|
||||
int foo, nbre, tokenid;
|
||||
BBList *bublist;
|
||||
Bubulle bubulle;
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, ">>> %s ( '%s' %d )\n", __func__, infname, notused);
|
||||
fprintf(stderr, ">>> %s ( '%s' %d )\n", __func__, fname, notused);
|
||||
#endif
|
||||
|
||||
if (NULL==(fpin=fopen(infname, "r"))) {
|
||||
@ -114,8 +112,7 @@ while(NULL!=(cptr=fgets(line, LINE_SZ, fpin))) {
|
||||
continue;
|
||||
}
|
||||
tokenid = type_of_the_line(cptr);
|
||||
if (verbosity > 1)
|
||||
fprintf(stderr, "token '%s' --> %d\n", cptr, tokenid);
|
||||
if (verbosity > 1) fprintf(stderr, "token '%s' --> %d\n", cptr, tokenid);
|
||||
|
||||
memset(&bubulle, 0, sizeof(Bubulle));
|
||||
|
||||
@ -123,7 +120,6 @@ while(NULL!=(cptr=fgets(line, LINE_SZ, fpin))) {
|
||||
case T_comment:
|
||||
/* do nothing */
|
||||
break;
|
||||
|
||||
case T_vertice:
|
||||
x = y = z = 0.0;
|
||||
foo = parse_vertice(cptr, &x, &y, &z);
|
||||
@ -132,24 +128,6 @@ while(NULL!=(cptr=fgets(line, LINE_SZ, fpin))) {
|
||||
bubulle.p.z = z;
|
||||
if (verbosity > 1) niceprint_bubulle(&bubulle, 0);
|
||||
break;
|
||||
|
||||
case T_group:
|
||||
cptr = strtok(NULL, " ");
|
||||
fprintf(stderr, "Group: %s\n", cptr);
|
||||
break;
|
||||
|
||||
case T_face:
|
||||
fprintf(stderr, "Face A: %s\n", cptr);
|
||||
for (ix=0; ix<3; ix++) {
|
||||
cptr = strtok(NULL, " ");
|
||||
fprintf(stderr, "Piste %d: %s\n", ix, cptr);
|
||||
if (2==sscanf(cptr, "%d/%d", &fa, &fb))
|
||||
fprintf(stderr, " %d %d %d\n", foo, fa, fb);
|
||||
else
|
||||
return -3;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
// fprintf(stderr, "token %d ?\n", tokenid);
|
||||
continue; /* wtf ? */
|
||||
@ -157,8 +135,7 @@ while(NULL!=(cptr=fgets(line, LINE_SZ, fpin))) {
|
||||
|
||||
foo = push_bubulle(bublist, &bubulle);
|
||||
if (foo) {
|
||||
fprintf(stderr, "*** %s: error %d on push\n", __func__, foo);
|
||||
exit(1);
|
||||
fprintf(stderr, "%s: err %d on push\n", __func__, foo);
|
||||
break;
|
||||
}
|
||||
nbre++;
|
@ -3,8 +3,5 @@ BBFUNCS = ../libbubulles.a
|
||||
|
||||
OPT = -Wall -g -DDEBUG_LEVEL=1 -DMUST_ABORT
|
||||
|
||||
read_obj: read_obj.c Makefile importobj.o $(BBFUNCS)
|
||||
gcc $(OPT) $< importobj.o $(BBFUNCS) -o $@
|
||||
|
||||
importobj.o: importobj.c ../bubulles.h Makefile
|
||||
$(CC) $(OPT) -c $<
|
||||
read_obj: read_obj.c Makefile $(BBFUNCS)
|
||||
gcc $(OPT) $< $(BBFUNCS) -o $@
|
||||
|
@ -20,13 +20,8 @@ if (2 != argc) {
|
||||
|
||||
verbosity = 1;
|
||||
|
||||
<<<<<<< HEAD
|
||||
foo = try_to_read_an_OBJ_file(argv[1], "bulles.xyz", 0);
|
||||
fprintf(stderr, "try to read '%s' --> %d\n", argv[1], foo);
|
||||
=======
|
||||
foo = try_to_read_an_OBJ_file(argv[1], "bubulles.asc", 0);
|
||||
fprintf(stderr, "try to read -> %d\n", foo);
|
||||
>>>>>>> 457afac7c0a208413ff6a7f1d0932da76ecf685b
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user