des bubulles
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

bubulles.h 2.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /*
  2. bubulles.h
  3. */
  4. /* --------------------------------------------------------------------- */
  5. #define LIBBB_VERSION 54
  6. #define SZ_BUBULLE_TEXT 51 /* arbitrary value */
  7. /* a 3d space coordinate */
  8. typedef struct {
  9. double x, y, z;
  10. unsigned long reserved;
  11. } XYZ;
  12. /* colors and transparency */
  13. typedef struct {
  14. float r, g, b, a;
  15. unsigned long reserved;
  16. } RGBA;
  17. /*
  18. this is our main entity : the bubulle.
  19. 'bubulle' is a slang french word for 'friendly bubble'.
  20. */
  21. typedef struct {
  22. XYZ p; /* position */
  23. double d; /* diameter */
  24. int gray; /* used as an index */
  25. RGBA col;
  26. long ttl; /* bubulles can be aged */
  27. double kvalue; /* wtf ? */
  28. } Bubulle;
  29. /*
  30. this is the bubulles list descriptor.
  31. */
  32. typedef struct {
  33. char name[SZ_BUBULLE_TEXT+1];
  34. int size; /* max number of bubulles */
  35. int fidx; /* next free slot */
  36. XYZ position; /* global position */
  37. unsigned long flags;
  38. Bubulle *bbs; /* ptr to a movable array */
  39. } BBList;
  40. BBList * alloc_bubulles(char *name, int nbre, int k);
  41. int free_bubulles(BBList *bbl, int k);
  42. int print_bublist_desc(BBList *bbl, int k);
  43. int push_bubulle(BBList *where, Bubulle *what);
  44. int poke_bubulle(BBList *where, Bubulle *what, int idx);
  45. int peek_bubulle(BBList *from, Bubulle *to, int idx);
  46. int cleanfill_my_bublist(BBList *what, int k);
  47. int bubulles_version(int k);
  48. void bubulles_sizeof(int k);
  49. Bubulle * bubulle_getaddr(BBList *where, int idx);
  50. /*
  51. * export functions for everything
  52. */
  53. /* TO BE DONE XXX */
  54. /*
  55. * export Awk machinable.
  56. * flags :
  57. * 0x0001 print diameter
  58. * 0x0002 print graylevel
  59. * 0x0004 print RGB values
  60. */
  61. int fprint_bubulles(FILE *fp, char *title, BBList *bbl, int flags);
  62. /* only human readable */
  63. int niceprint_bubulle(Bubulle *what, int unused);
  64. /* this is just a wtf function * see tbb.c */
  65. int bubulles_to_data(char *fname, char *title, BBList *bbl, int k);
  66. /* --------------------------------------------------------------------- */
  67. /* sometime we want to look at the bounding box */
  68. typedef struct {
  69. double minX, minY, minZ;
  70. double maxX, maxY, maxZ;
  71. int flags;
  72. } BBox;
  73. int bounding_box(Bubulle *boubs, int nbre, BBox *bbox);
  74. int print_bbox(BBox *bbox, int k);
  75. /* --------------------------------------------------------------------- */