Compare commits
No commits in common. "52e5ace4e16bb961b03f97934e156cc541ef6469" and "b861e8c86be9958e451e0d0ce9d2a0a64d14fa6c" have entirely different histories.
52e5ace4e1
...
b861e8c86b
1
.gitignore
vendored
1
.gitignore
vendored
@ -9,7 +9,6 @@ toto
|
|||||||
|
|
||||||
tools/*.obj
|
tools/*.obj
|
||||||
! tools/minimal.obj
|
! tools/minimal.obj
|
||||||
! tools/cube.obj
|
|
||||||
tools/read_obj
|
tools/read_obj
|
||||||
tools/*.xyz
|
tools/*.xyz
|
||||||
tools/*.asc
|
tools/*.asc
|
||||||
|
2
Makefile
2
Makefile
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
CC = gcc
|
CC = gcc
|
||||||
|
|
||||||
OPT = -Wall -g -DDEBUG_LEVEL=0 -DMUST_ABORT=0
|
OPT = -Wall -g -pg -DDEBUG_LEVEL=0 -DMUST_ABORT=0
|
||||||
|
|
||||||
libbubulles.a: bubulles.o edges.o
|
libbubulles.a: bubulles.o edges.o
|
||||||
ar r $@ $?
|
ar r $@ $?
|
||||||
|
14
bubulles.c
14
bubulles.c
@ -121,18 +121,18 @@ return ( &where->bbs[idx] );
|
|||||||
int print_bublist_desc(BBList *bbl, int opts)
|
int print_bublist_desc(BBList *bbl, int opts)
|
||||||
{
|
{
|
||||||
|
|
||||||
fprintf(stderr, "------- bblist at %p\n", bbl);
|
printf("------- bblist at %p\n", bbl);
|
||||||
fprintf(stderr, "\tname \t'%s'\n", bbl->name);
|
printf("\tname \t'%s'\n", bbl->name);
|
||||||
|
|
||||||
fprintf(stderr, "\tsize\t%6d\n\tfidx\t%6d\n", bbl->size, bbl->fidx);
|
printf("\tsize\t%6d\n\tfidx\t%6d\n", bbl->size, bbl->fidx);
|
||||||
if (opts & 0x01) {
|
if (opts & 0x01) {
|
||||||
fprintf(stderr, "\txyz\t%f %f %f\n",
|
printf("\txyz\t%f %f %f\n",
|
||||||
bbl->position.x, bbl->position.y, bbl->position.z);
|
bbl->position.x, bbl->position.y, bbl->position.z);
|
||||||
}
|
}
|
||||||
fprintf(stderr, "\tflags\t0x%08lX\n", bbl->flags);
|
printf("\tflags\t0x%08lX\n", bbl->flags);
|
||||||
fprintf(stderr, "\tarray\t%p\n", bbl->bbs);
|
printf("\tarray\t%p\n", bbl->bbs);
|
||||||
|
|
||||||
fflush(stderr);
|
puts(""); fflush(stdout);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
78
edges.c
78
edges.c
@ -65,26 +65,6 @@ return 0;
|
|||||||
}
|
}
|
||||||
/* --------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------- */
|
||||||
/*
|
/*
|
||||||
* with this func, you can search for duplicates, but
|
|
||||||
* it is going to be SLOW with huges object.
|
|
||||||
*/
|
|
||||||
static int is_edge_in_list(EdgeList *list, int p0, int p1)
|
|
||||||
{
|
|
||||||
int idx;
|
|
||||||
|
|
||||||
for (idx=0; idx < list->fidx; idx++) {
|
|
||||||
if ( (list->edges[idx].A == p0) &&
|
|
||||||
(list->edges[idx].B == p1) ) return 1;
|
|
||||||
|
|
||||||
if ( (list->edges[idx].A == p1) &&
|
|
||||||
(list->edges[idx].B == p0) ) return 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0; /* NOT FOUND */
|
|
||||||
}
|
|
||||||
/* --------------------------------------------------------------------- */
|
|
||||||
/*
|
|
||||||
*
|
|
||||||
* we have two functions for adding an edge to a list
|
* we have two functions for adding an edge to a list
|
||||||
* the first one add unconditionnaly the edge to the
|
* the first one add unconditionnaly the edge to the
|
||||||
* (non full) list...
|
* (non full) list...
|
||||||
@ -108,7 +88,6 @@ list->edges[list->fidx].B = p1;
|
|||||||
list->fidx ++;
|
list->fidx ++;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* and the second only insert an edge if it was missing
|
* and the second only insert an edge if it was missing
|
||||||
* from the currently know list.
|
* from the currently know list.
|
||||||
@ -135,6 +114,24 @@ if ( ! is_edge_in_list(list, p0, p1) ) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/* --------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------- */
|
||||||
|
/*
|
||||||
|
* with this func, you can search for duplicates
|
||||||
|
*/
|
||||||
|
int is_edge_in_list(EdgeList *list, int p0, int p1)
|
||||||
|
{
|
||||||
|
int idx;
|
||||||
|
|
||||||
|
for (idx=0; idx < list->fidx; idx++) {
|
||||||
|
if ( (list->edges[idx].A == p0) &&
|
||||||
|
(list->edges[idx].B == p1) ) return 1;
|
||||||
|
|
||||||
|
if ( (list->edges[idx].A == p1) &&
|
||||||
|
(list->edges[idx].B == p0) ) return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0; /* NOT FOUND */
|
||||||
|
}
|
||||||
|
/* --------------------------------------------------------------------- */
|
||||||
int print_edgelist_desc(EdgeList *list, int k)
|
int print_edgelist_desc(EdgeList *list, int k)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -150,43 +147,12 @@ fprintf(stderr, "\tsize %8d\n", list->size);
|
|||||||
fprintf(stderr, "\tnext free %8d\n", list->fidx);
|
fprintf(stderr, "\tnext free %8d\n", list->fidx);
|
||||||
fprintf(stderr, "\tmagic 0x%08lX\n", list->magic);
|
fprintf(stderr, "\tmagic 0x%08lX\n", list->magic);
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
/* --------------------------------------------------------------------- */
|
|
||||||
/*
|
|
||||||
* /!\ the output format is subject to changes in
|
|
||||||
* a near futur.
|
|
||||||
*/
|
|
||||||
int edges_to_data(char *fname, EdgeList *list, int k)
|
|
||||||
{
|
|
||||||
FILE *fp;
|
|
||||||
int idx, foo;
|
|
||||||
|
|
||||||
#if DEBUG_LEVEL
|
|
||||||
fprintf(stderr, ">>> %s ( '%s' %p %d )\n", __func__, fname, list, k);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (NULL==(fp=fopen(fname, "w"))) {
|
|
||||||
perror(fname);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
for (idx=0; idx<list->fidx; idx++) {
|
|
||||||
foo = fprintf(fp, "%d %d\n", list->edges[idx].A, list->edges[idx].B);
|
|
||||||
/*
|
|
||||||
* error check
|
|
||||||
*/
|
|
||||||
if (foo < 0) {
|
|
||||||
perror(fname);
|
|
||||||
exit(1); /* be violent ! */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fclose(fp);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/* --------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------- */
|
||||||
int print_the_edges(FILE *fp, EdgeList *list, int k)
|
int print_the_edges(FILE *fp, EdgeList *list, int k)
|
||||||
{
|
{
|
||||||
int idx;
|
int foo;
|
||||||
|
|
||||||
#if DEBUG_LEVEL
|
#if DEBUG_LEVEL
|
||||||
fprintf(stderr, ">>> %s ( %p %d )\n", __func__, list, k);
|
fprintf(stderr, ">>> %s ( %p %d )\n", __func__, list, k);
|
||||||
@ -199,9 +165,9 @@ if (k) {
|
|||||||
|
|
||||||
fprintf(stderr, " list.fidx = %d\n", list->fidx);
|
fprintf(stderr, " list.fidx = %d\n", list->fidx);
|
||||||
|
|
||||||
for (idx=0; idx<list->fidx; idx++) {
|
for (foo=0; foo<list->fidx; foo++) {
|
||||||
fprintf(fp, "%6d\t\t%5d %5d\n", idx,
|
fprintf(fp, "%6d\t\t%5d %5d\n", foo,
|
||||||
list->edges[idx].A, list->edges[idx].B);
|
list->edges[foo].A, list->edges[foo].B);
|
||||||
}
|
}
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
|
7
edges.h
7
edges.h
@ -1,15 +1,13 @@
|
|||||||
/*
|
/*
|
||||||
* edges.h
|
* edges.h
|
||||||
* a part of libbubulle from tTh
|
* a part of libbubulle from tTh
|
||||||
*
|
|
||||||
* https://git.tetalab.org/tTh/libbubulle
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* --------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------- */
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int A, B;
|
int A, B;
|
||||||
short burz; /* for what usage ??? */
|
short burz;
|
||||||
} AnEdge;
|
} AnEdge;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@ -28,10 +26,9 @@ int free_edgelist(EdgeList *list, int k);
|
|||||||
int push_an_edge(EdgeList *list, int p0, int p1);
|
int push_an_edge(EdgeList *list, int p0, int p1);
|
||||||
int push_a_missing_edge(EdgeList *list, int p0, int p1);
|
int push_a_missing_edge(EdgeList *list, int p0, int p1);
|
||||||
|
|
||||||
// int is_edge_in_list(EdgeList *list, int p0, int p1);
|
int is_edge_in_list(EdgeList *list, int p0, int p1);
|
||||||
|
|
||||||
int print_edgelist_desc(EdgeList *list, int k);
|
int print_edgelist_desc(EdgeList *list, int k);
|
||||||
int edges_to_data(char *fname, EdgeList *list, int k);
|
|
||||||
int print_the_edges(FILE *file, EdgeList *list, int k);
|
int print_the_edges(FILE *file, EdgeList *list, int k);
|
||||||
|
|
||||||
/* --------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------- */
|
||||||
|
3
tools/.gitignore
vendored
3
tools/.gitignore
vendored
@ -1,7 +1,4 @@
|
|||||||
|
|
||||||
essai_faces
|
|
||||||
read_obj
|
|
||||||
|
|
||||||
*.vertices
|
*.vertices
|
||||||
*.edges
|
*.edges
|
||||||
|
|
||||||
|
@ -1,13 +1,10 @@
|
|||||||
|
|
||||||
BBFUNCS = ../libbubulles.a
|
BBFUNCS = ../libbubulles.a
|
||||||
|
|
||||||
OPT = -Wall -g -DDEBUG_LEVEL=0 -DMUST_ABORT=0
|
OPT = -Wall -g -pg -DDEBUG_LEVEL=0 -DMUST_ABORT=0
|
||||||
|
|
||||||
read_obj: read_obj.c Makefile importobj.o $(BBFUNCS)
|
read_obj: read_obj.c Makefile importobj.o $(BBFUNCS)
|
||||||
gcc $(OPT) $< importobj.o $(BBFUNCS) -o $@
|
gcc $(OPT) $< importobj.o $(BBFUNCS) -o $@
|
||||||
|
|
||||||
importobj.o: importobj.c ../bubulles.h Makefile
|
importobj.o: importobj.c ../bubulles.h Makefile
|
||||||
$(CC) $(OPT) -c $<
|
$(CC) $(OPT) -c $<
|
||||||
|
|
||||||
essai_faces: essai_faces.c Makefile
|
|
||||||
$(CC) $(OPT) $< -o $@
|
|
||||||
|
@ -1,49 +0,0 @@
|
|||||||
# cube.obj
|
|
||||||
#
|
|
||||||
|
|
||||||
o cube
|
|
||||||
|
|
||||||
v 0.0 0.0 0.0
|
|
||||||
v 0.0 0.0 1.0
|
|
||||||
v 0.0 1.0 0.0
|
|
||||||
v 0.0 1.0 1.0
|
|
||||||
v 1.0 0.0 0.0
|
|
||||||
v 1.0 0.0 1.0
|
|
||||||
v 1.0 1.0 0.0
|
|
||||||
v 1.0 1.0 1.0
|
|
||||||
|
|
||||||
vt 0.25 0.0
|
|
||||||
vt 0.5 0.0
|
|
||||||
vt 0 0.25
|
|
||||||
vt 0.25 0.25
|
|
||||||
vt 0.5 0.25
|
|
||||||
vt 0.75 0.25
|
|
||||||
vt 0.0 0.5
|
|
||||||
vt 0.25 0.5
|
|
||||||
vt 0.5 0.5
|
|
||||||
vt 0.75 0.5
|
|
||||||
vt 0.25 0.75
|
|
||||||
vt 0.5 0.75
|
|
||||||
vt 0.25 1.0
|
|
||||||
vt 0.5 1.0
|
|
||||||
|
|
||||||
vn 0.0 0.0 1.0
|
|
||||||
vn 0.0 0.0 -1.0
|
|
||||||
vn 0.0 1.0 0.0
|
|
||||||
vn 0.0 -1.0 0.0
|
|
||||||
vn 1.0 0.0 0.0
|
|
||||||
vn -1.0 0.0 0.0
|
|
||||||
|
|
||||||
f 1/11/2 7/14/2 5/12/2
|
|
||||||
f 1/11/2 3/13/2 7/14/2
|
|
||||||
f 1/7/6 4/4/6 3/3/6
|
|
||||||
f 1/7/6 2/8/6 4/4/6
|
|
||||||
f 3/1/3 8/5/3 7/2/3
|
|
||||||
f 3/1/3 4/4/3 8/5/3
|
|
||||||
f 5/10/5 7/6/5 8/5/5
|
|
||||||
f 5/10/5 8/5/5 6/9/5
|
|
||||||
f 1/11/4 5/12/4 6/9/4
|
|
||||||
f 1/11/4 6/9/4 2/8/4
|
|
||||||
f 2/8/1 6/9/1 8/5/1
|
|
||||||
f 2/8/1 8/5/1 4/4/1
|
|
||||||
|
|
@ -1,44 +0,0 @@
|
|||||||
/*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
int essai_lecture_face(char *str)
|
|
||||||
{
|
|
||||||
char *buffer, *ptr;
|
|
||||||
int bar;
|
|
||||||
int A, B, C;
|
|
||||||
|
|
||||||
printf("-------- '%s'\n", str);
|
|
||||||
buffer = ptr = strdup(str);
|
|
||||||
for (bar = 0;;) {
|
|
||||||
ptr = strtok(ptr, " \t");
|
|
||||||
if (NULL != ptr) {
|
|
||||||
printf("\t%2d '%s'\n", bar, ptr);
|
|
||||||
ptr = NULL;
|
|
||||||
bar++;
|
|
||||||
}
|
|
||||||
else break;
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
* so, here, we know the number of thing to decipher
|
|
||||||
*/
|
|
||||||
|
|
||||||
free(buffer);
|
|
||||||
printf(" -> %d\n", bar);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
|
||||||
{
|
|
||||||
int foo, bar;
|
|
||||||
|
|
||||||
foo = essai_lecture_face("3 14 159");
|
|
||||||
foo = essai_lecture_face("2 4 6 8");
|
|
||||||
foo = essai_lecture_face("0/10 1/11 2/12");
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
@ -7,7 +7,6 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
#include "../bubulles.h"
|
#include "../bubulles.h"
|
||||||
#include "../edges.h"
|
#include "../edges.h"
|
||||||
@ -28,8 +27,7 @@ typedef struct {
|
|||||||
int id;
|
int id;
|
||||||
} Tokens;
|
} Tokens;
|
||||||
|
|
||||||
enum token_id { T_comment=1, T_vertice, T_group, T_face, T_vt, T_vn,
|
enum token_id { T_comment=1, T_vertice, T_group, T_face, T_vt };
|
||||||
T_line, T_object, T_smoothing, T_usemtl, T_mtllib };
|
|
||||||
|
|
||||||
Tokens TokenList[] = {
|
Tokens TokenList[] = {
|
||||||
{ "#", T_comment },
|
{ "#", T_comment },
|
||||||
@ -37,12 +35,6 @@ Tokens TokenList[] = {
|
|||||||
{ "g", T_group }, // to be verified !
|
{ "g", T_group }, // to be verified !
|
||||||
{ "f", T_face },
|
{ "f", T_face },
|
||||||
{ "vt", T_vt }, // c'est quoi ce truc ?
|
{ "vt", T_vt }, // c'est quoi ce truc ?
|
||||||
{ "vn", T_vt }, // c'est quoi ce truc ?
|
|
||||||
{ "l", T_line },
|
|
||||||
{ "o", T_object },
|
|
||||||
{ "s", T_smoothing },
|
|
||||||
{ "usemtl", T_usemtl },
|
|
||||||
{ "mtllib", T_mtllib },
|
|
||||||
{ NULL, 0 }
|
{ NULL, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -84,62 +76,45 @@ if (3 == foo) {
|
|||||||
return foo;
|
return foo;
|
||||||
}
|
}
|
||||||
/* --------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------- */
|
||||||
/* new Mon 27 Mar 2023 12:08:18 AM CEST
|
/* new Mon 27 Mar 2023 12:08:18 AM CEST */
|
||||||
*
|
|
||||||
* mmmm... complex thing to do...
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
int parse_face(char *cptr, int phy)
|
int parse_face(char *cptr, int phy)
|
||||||
{
|
{
|
||||||
int ix, foo;
|
int ix, foo;
|
||||||
int pts[3];
|
int fa, fb;
|
||||||
|
|
||||||
#if DEBUG_LEVEL
|
#if DEBUG_LEVEL
|
||||||
fprintf(stderr, ">>> %s ( '%s' %d )\n", __func__, cptr, phy);
|
fprintf(stderr, ">>> %s ( '%s' %d )\n", __func__, cptr, phy);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (0)
|
|
||||||
fprintf(stderr, "parse_face");
|
|
||||||
for (foo=0; foo<16; foo++) {
|
|
||||||
fprintf(stderr, " %02X", ((unsigned char *)cptr)[foo]);
|
|
||||||
}
|
|
||||||
fprintf(stderr, "\n");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
for (ix=0; ix<3; ix++) {
|
for (ix=0; ix<3; ix++) {
|
||||||
cptr = strtok(NULL, " ");
|
cptr = strtok(NULL, " ");
|
||||||
if (NULL == cptr) {
|
if (NULL == cptr) {
|
||||||
fprintf(stderr, "incomplete face in %s\n", __func__);
|
fprintf(stderr, "incomplete face in %s\n", __func__);
|
||||||
return -4;
|
return -4;
|
||||||
}
|
}
|
||||||
if (1 != sscanf(cptr, "%d", &pts[ix])) {
|
if (2 != sscanf(cptr, "%d/%d", &fa, &fb)) {
|
||||||
fprintf(stderr, "%s: err sscanf\n", __func__);
|
fprintf(stderr, "%s: err sscanf\n", __func__);
|
||||||
exit(1);
|
exit(1);
|
||||||
return -3;
|
return -3;
|
||||||
}
|
}
|
||||||
|
// XXX fprintf(stderr, " %d got %d %d\n", ix, fa, fb);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* yes, i've found 0-lenght edges, wtf ?
|
||||||
|
*/
|
||||||
|
if (fa == fb) {
|
||||||
|
// fprintf(stderr, "'%s' dublicate\n", cptr);
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** check the freshly read datas **/
|
foo = push_a_missing_edge(edges, fa, fb);
|
||||||
if ( pts[0]==pts[1] || pts[0]==pts[2] || pts[2]==pts[1] ) {
|
|
||||||
fprintf(stderr, "%s: degerated face ( %d %d %d )\n", __func__,
|
|
||||||
pts[0], pts[1], pts[2]);
|
|
||||||
sleep(5);
|
|
||||||
}
|
|
||||||
|
|
||||||
foo = push_a_missing_edge(edges, pts[0], pts[1]);
|
|
||||||
if (foo) {
|
if (foo) {
|
||||||
fprintf(stderr, "%s: disaster #%d\n", __func__, foo);
|
fprintf(stderr, "%s: disaster #%d\n", __func__, foo);
|
||||||
|
#if MUST_ABORT
|
||||||
|
fflush(stderr), abort();
|
||||||
|
#endif
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
foo = push_a_missing_edge(edges, pts[1], pts[2]);
|
|
||||||
if (foo) {
|
|
||||||
fprintf(stderr, "%s: disaster #%d\n", __func__, foo);
|
|
||||||
return -2;
|
|
||||||
}
|
|
||||||
foo = push_a_missing_edge(edges, pts[2], pts[0]);
|
|
||||||
if (foo) {
|
|
||||||
fprintf(stderr, "%s: disaster #%d\n", __func__, foo);
|
|
||||||
return -2;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if DEBUG_LEVEL
|
#if DEBUG_LEVEL
|
||||||
@ -153,7 +128,7 @@ int try_to_read_an_OBJ_file(char *infname, char *file_vert, char *file_edges,
|
|||||||
int notused)
|
int notused)
|
||||||
{
|
{
|
||||||
FILE *fpin;
|
FILE *fpin;
|
||||||
char line[LINE_SZ+1], *cptr, *token;
|
char line[LINE_SZ+1], *cptr;
|
||||||
float x, y, z;
|
float x, y, z;
|
||||||
int foo, nbre, tokenid;
|
int foo, nbre, tokenid;
|
||||||
Bubulle bubulle;
|
Bubulle bubulle;
|
||||||
@ -168,14 +143,14 @@ if (NULL==(fpin=fopen(infname, "r"))) {
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
bublist = alloc_bubulles(infname, 200000, 0);
|
bublist = alloc_bubulles(infname, 500000, 0);
|
||||||
if (NULL==bublist) {
|
if (NULL==bublist) {
|
||||||
fprintf(stderr, "in %s, no mem for bubls, aborting...\n", __func__);
|
fprintf(stderr, "in %s, no mem for bubls, aborting...\n", __func__);
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
print_bublist_desc(bublist, 0);
|
print_bublist_desc(bublist, 0);
|
||||||
|
|
||||||
edges = alloc_edgelist("krkrkr", 400000, 0);
|
edges = alloc_edgelist("krkrkr", 200000, 0);
|
||||||
if (NULL==edges) {
|
if (NULL==edges) {
|
||||||
fprintf(stderr, "no mem for edges in %s, aborting...\n", __func__);
|
fprintf(stderr, "no mem for edges in %s, aborting...\n", __func__);
|
||||||
abort();
|
abort();
|
||||||
@ -198,11 +173,9 @@ while(NULL!=(cptr=fgets(line, LINE_SZ, fpin))) {
|
|||||||
|
|
||||||
cptr = strtok(line, " ");
|
cptr = strtok(line, " ");
|
||||||
if (NULL == cptr) {
|
if (NULL == cptr) {
|
||||||
/* this is an empty line */
|
fprintf(stderr, "no token ?\n");
|
||||||
// fprintf(stderr, "no token ?\n");
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
token = cptr;
|
|
||||||
tokenid = type_of_the_line(cptr);
|
tokenid = type_of_the_line(cptr);
|
||||||
if (verbosity > 1)
|
if (verbosity > 1)
|
||||||
fprintf(stderr, "token '%s' --> %d\n", cptr, tokenid);
|
fprintf(stderr, "token '%s' --> %d\n", cptr, tokenid);
|
||||||
@ -229,43 +202,21 @@ while(NULL!=(cptr=fgets(line, LINE_SZ, fpin))) {
|
|||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case T_face:
|
|
||||||
/* experimental code here */
|
|
||||||
foo = parse_face(cptr, 0);
|
|
||||||
if (foo) {
|
|
||||||
fprintf(stderr, " '%s' parse face -> %d\n",
|
|
||||||
cptr, foo);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case T_object:
|
|
||||||
cptr = strtok(NULL, " ");
|
|
||||||
fprintf(stderr, "\tObject: %s\n", cptr);
|
|
||||||
break;
|
|
||||||
case T_group:
|
case T_group:
|
||||||
cptr = strtok(NULL, " ");
|
cptr = strtok(NULL, " ");
|
||||||
fprintf(stderr, "\tGroup: %s\n", cptr);
|
fprintf(stderr, "\tGroup: %s\n", cptr);
|
||||||
break;
|
break;
|
||||||
case T_usemtl:
|
|
||||||
cptr = strtok(NULL, " ");
|
|
||||||
fprintf(stderr, "\tUsemtl: %s\n", cptr);
|
|
||||||
break;
|
|
||||||
case T_mtllib:
|
|
||||||
cptr = strtok(NULL, " ");
|
|
||||||
fprintf(stderr, "\tMtllib: %s\n", cptr);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case T_line:
|
case T_face:
|
||||||
break;
|
foo = parse_face(cptr, 0);
|
||||||
case T_smoothing:
|
if (foo) fprintf(stderr, " '%s' parse face -> %d\n",
|
||||||
break;
|
cptr, foo);
|
||||||
case T_vt:
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
fprintf(stderr, "token %s -> %d ?\n", token, tokenid);
|
// fprintf(stderr, "\ttoken %d ?\n", tokenid);
|
||||||
break;
|
continue; /* wtf ? */
|
||||||
}
|
}
|
||||||
|
|
||||||
nbre++;
|
nbre++;
|
||||||
@ -283,7 +234,7 @@ bubulles_to_data(file_vert, NULL, bublist, 0);
|
|||||||
free_bubulles(bublist, 0);
|
free_bubulles(bublist, 0);
|
||||||
|
|
||||||
print_edgelist_desc(edges, 0);
|
print_edgelist_desc(edges, 0);
|
||||||
edges_to_data(file_edges, edges, 0);
|
print_the_edges(stdout, edges, 0);
|
||||||
free_edgelist(edges, 0);
|
free_edgelist(edges, 0);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
o minimal
|
g minimal
|
||||||
v 0 0 0
|
v 0 0 0
|
||||||
v 1 0 0
|
v 1 0 0
|
||||||
v 0 1 0
|
v 0 1 0
|
||||||
v 0 0 1
|
v 0 0 1
|
||||||
f 1/2 2/3 3/1
|
f 1/2, 2/3, 3/1
|
||||||
f 0/1 0/1 0/2
|
f 0/1, 0/1, 0/2
|
||||||
|
@ -20,17 +20,15 @@ int main(int argc, char *argv[])
|
|||||||
int foo;
|
int foo;
|
||||||
char *fname; /* see manpage basename(3) */
|
char *fname; /* see manpage basename(3) */
|
||||||
|
|
||||||
fprintf(stderr, "\n### READ_OBJ %s %s\n\n", __DATE__, __TIME__);
|
|
||||||
|
|
||||||
if (2 != argc) {
|
if (2 != argc) {
|
||||||
bubulles_version(1);
|
bubulles_version(1);
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
verbosity = 1;
|
verbosity = 0;
|
||||||
|
|
||||||
fname = basename(argv[1]);
|
fname = basename(argv[1]);
|
||||||
fprintf (stderr, "input file name is '%s'\n", fname);
|
fprintf (stderr, "input fname is '%s'\n", fname);
|
||||||
|
|
||||||
foo = try_to_read_an_OBJ_file(argv[1], "bulles.vertices", "bulles.edges", 0);
|
foo = try_to_read_an_OBJ_file(argv[1], "bulles.vertices", "bulles.edges", 0);
|
||||||
fprintf(stderr, "try to read '%s' -> %d\n", argv [1], foo);
|
fprintf(stderr, "try to read '%s' -> %d\n", argv [1], foo);
|
||||||
|
Loading…
Reference in New Issue
Block a user