libbubulle/bubulles.h

94 lines
2.3 KiB
C
Raw Permalink Normal View History

2018-11-10 11:31:31 +01:00
/*
2021-05-07 12:27:16 +02:00
bubulles.h - dirty software from tTh
2018-11-10 11:31:31 +01:00
*/
/* --------------------------------------------------------------------- */
2023-05-01 13:09:01 +02:00
#define LIBBB_VERSION 64
2018-11-10 11:31:31 +01:00
2023-03-21 20:31:50 +01:00
#define SZ_BUBULLE_TEXT 81 /* arbitrary value */
2018-11-10 11:31:31 +01:00
2018-11-13 13:20:35 +01:00
/* a 3d space coordinate */
2018-11-10 11:31:31 +01:00
typedef struct {
double x, y, z;
unsigned long reserved;
} XYZ;
2018-11-24 12:46:53 +01:00
/* colors and transparency */
2018-11-10 11:31:31 +01:00
typedef struct {
float r, g, b, a;
unsigned long reserved;
} RGBA;
2018-11-25 11:44:42 +01:00
/*
this is our main entity : the bubulle.
'bubulle' is a slang french word for 'friendly bubble'.
*/
2018-11-10 11:31:31 +01:00
typedef struct {
XYZ p; /* position */
double d; /* diameter */
2018-11-24 12:46:53 +01:00
int gray; /* used as an index */
2018-11-10 11:31:31 +01:00
RGBA col;
2018-11-24 12:46:53 +01:00
long ttl; /* bubulles can be aged */
2018-11-10 11:31:31 +01:00
double kvalue; /* wtf ? */
} Bubulle;
2018-11-25 11:44:42 +01:00
/*
this is the bubulles list descriptor.
*/
2018-11-10 11:31:31 +01:00
typedef struct {
char name[SZ_BUBULLE_TEXT+1];
int size; /* max number of bubulles */
int fidx; /* next free slot */
2018-11-25 11:44:42 +01:00
XYZ position; /* global position */
2018-11-10 11:31:31 +01:00
unsigned long flags;
2018-11-25 11:44:42 +01:00
Bubulle *bbs; /* ptr to a movable array */
2018-11-10 11:31:31 +01:00
} BBList;
2018-11-25 11:44:42 +01:00
2018-11-10 11:31:31 +01:00
BBList * alloc_bubulles(char *name, int nbre, int k);
int free_bubulles(BBList *bbl, int k);
int print_bublist_desc(BBList *bbl, int k);
int push_bubulle(BBList *where, Bubulle *what);
int poke_bubulle(BBList *where, Bubulle *what, int idx);
int peek_bubulle(BBList *from, Bubulle *to, int idx);
int cleanfill_my_bublist(BBList *what, int k);
int bubulles_version(int k);
void bubulles_sizeof(int k);
Bubulle * bubulle_getaddr(BBList *where, int idx);
2020-01-31 18:38:18 +01:00
/*
2020-05-09 21:44:10 +02:00
* export functions for everything
2020-01-31 18:38:18 +01:00
*/
2020-05-09 21:44:10 +02:00
/* TO BE DONE XXX */
2020-01-31 18:38:18 +01:00
/*
* export Awk machinable.
* flags :
* 0x0001 print diameter
* 0x0002 print graylevel
* 0x0004 print RGB values
*/
int fprint_bubulles(FILE *fp, char *title, BBList *bbl, int flags);
/* only human readable */
2018-11-10 11:31:31 +01:00
int niceprint_bubulle(Bubulle *what, int unused);
2020-01-31 18:38:18 +01:00
/* this is just a wtf function * see tbb.c */
2023-03-21 20:31:50 +01:00
int bubulles_to_data(char *fname, char *title, BBList *bbl, int flags);
2018-11-10 11:31:31 +01:00
/* --------------------------------------------------------------------- */
2018-11-13 13:20:35 +01:00
/* sometime we want to look at the bounding box */
2018-11-10 11:31:31 +01:00
typedef struct {
double minX, minY, minZ;
double maxX, maxY, maxZ;
int flags;
} BBox;
int bounding_box(Bubulle *boubs, int nbre, BBox *bbox);
int print_bbox(BBox *bbox, int k);
/* --------------------------------------------------------------------- */