62#define BV_VLIST_CHUNK 35
70#define BV_VLIST_NULL ((struct bv_vlist *)0)
71#define BV_CK_VLIST(_p) BU_CKMAG((_p), BV_VLIST_MAGIC, "bv_vlist")
75#define BV_VLIST_LINE_MOVE 0
76#define BV_VLIST_LINE_DRAW 1
77#define BV_VLIST_POLY_START 2
78#define BV_VLIST_POLY_MOVE 3
79#define BV_VLIST_POLY_DRAW 4
80#define BV_VLIST_POLY_END 5
81#define BV_VLIST_POLY_VERTNORM 6
82#define BV_VLIST_TRI_START 7
83#define BV_VLIST_TRI_MOVE 8
84#define BV_VLIST_TRI_DRAW 9
85#define BV_VLIST_TRI_END 10
86#define BV_VLIST_TRI_VERTNORM 11
87#define BV_VLIST_POINT_DRAW 12
88#define BV_VLIST_POINT_SIZE 13
89#define BV_VLIST_LINE_WIDTH 14
90#define BV_VLIST_DISPLAY_MAT 15
91#define BV_VLIST_MODEL_MAT 16
92#define BV_VLIST_CMD_MAX 16
100#define BV_GET_VLIST(_free_hd, p) do {\
101 (p) = BU_LIST_FIRST(bv_vlist, (_free_hd)); \
102 if (BU_LIST_IS_HEAD((p), (_free_hd))) { \
103 BU_ALLOC((p), struct bv_vlist); \
104 (p)->l.magic = BV_VLIST_MAGIC; \
106 BU_LIST_DEQUEUE(&((p)->l)); \
112#define BV_FREE_VLIST(_free_hd, hd) do { \
113 BU_CK_LIST_HEAD((hd)); \
114 BU_LIST_APPEND_LIST((_free_hd), (hd)); \
117#define BV_ADD_VLIST(_free_hd, _dest_hd, pnt, draw) do { \
118 struct bv_vlist *_vp; \
119 BU_CK_LIST_HEAD(_dest_hd); \
120 _vp = BU_LIST_LAST(bv_vlist, (_dest_hd)); \
121 if (BU_LIST_IS_HEAD(_vp, (_dest_hd)) || _vp->nused >= BV_VLIST_CHUNK) { \
122 BV_GET_VLIST(_free_hd, _vp); \
123 BU_LIST_INSERT((_dest_hd), &(_vp->l)); \
125 VMOVE(_vp->pt[_vp->nused], (pnt)); \
126 _vp->cmd[_vp->nused++] = (draw); \
130#define BV_VLIST_SET_DISP_MAT(_free_hd, _dest_hd, _ref_pt) do { \
131 struct bv_vlist *_vp; \
132 BU_CK_LIST_HEAD(_dest_hd); \
133 _vp = BU_LIST_LAST(bv_vlist, (_dest_hd)); \
134 if (BU_LIST_IS_HEAD(_vp, (_dest_hd)) || _vp->nused >= BV_VLIST_CHUNK) { \
135 BV_GET_VLIST(_free_hd, _vp); \
136 BU_LIST_INSERT((_dest_hd), &(_vp->l)); \
138 VMOVE(_vp->pt[_vp->nused], (_ref_pt)); \
139 _vp->cmd[_vp->nused++] = BV_VLIST_DISPLAY_MAT; \
143#define BV_VLIST_SET_MODEL_MAT(_free_hd, _dest_hd) do { \
144 struct bv_vlist *_vp; \
145 BU_CK_LIST_HEAD(_dest_hd); \
146 _vp = BU_LIST_LAST(bv_vlist, (_dest_hd)); \
147 if (BU_LIST_IS_HEAD(_vp, (_dest_hd)) || _vp->nused >= BV_VLIST_CHUNK) { \
148 BV_GET_VLIST(_free_hd, _vp); \
149 BU_LIST_INSERT((_dest_hd), &(_vp->l)); \
151 _vp->cmd[_vp->nused++] = BV_VLIST_MODEL_MAT; \
155#define BV_VLIST_SET_POINT_SIZE(_free_hd, _dest_hd, _size) do { \
156 struct bv_vlist *_vp; \
157 BU_CK_LIST_HEAD(_dest_hd); \
158 _vp = BU_LIST_LAST(bv_vlist, (_dest_hd)); \
159 if (BU_LIST_IS_HEAD(_vp, (_dest_hd)) || _vp->nused >= BV_VLIST_CHUNK) { \
160 BV_GET_VLIST(_free_hd, _vp); \
161 BU_LIST_INSERT((_dest_hd), &(_vp->l)); \
163 _vp->pt[_vp->nused][0] = (_size); \
164 _vp->cmd[_vp->nused++] = BV_VLIST_POINT_SIZE; \
168#define BV_VLIST_SET_LINE_WIDTH(_free_hd, _dest_hd, _width) do { \
169 struct bv_vlist *_vp; \
170 BU_CK_LIST_HEAD(_dest_hd); \
171 _vp = BU_LIST_LAST(bv_vlist, (_dest_hd)); \
172 if (BU_LIST_IS_HEAD(_vp, (_dest_hd)) || _vp->nused >= BV_VLIST_CHUNK) { \
173 BV_GET_VLIST(_free_hd, _vp); \
174 BU_LIST_INSERT((_dest_hd), &(_vp->l)); \
176 _vp->pt[_vp->nused][0] = (_width); \
177 _vp->cmd[_vp->nused++] = BV_VLIST_LINE_WIDTH; \
198#define BV_CK_VLBLOCK(_p) BU_CKMAG((_p), BV_VLBLOCK_MAGIC, "bv_vlblock")
288 const unsigned char *buf);
313 const char *name_root,
Header file for the BRL-CAD common definitions.
void float int int float float * theta
void int float float float * scale
void int char int * length
void bv_vlist_export(struct bu_vls *vls, struct bu_list *hp, const char *name)
#define BV_VLIST_CHUNK
32-bit mach => just less than 1k
size_t bv_ck_vlist(const struct bu_list *vhead)
void bv_vlist_cleanup(struct bu_list *hd)
const char * bv_vlist_get_cmd_description(int cmd)
void bv_vlist_3string(struct bu_list *vhead, struct bu_list *free_hd, const char *string, const point_t origin, const mat_t rot, double scale)
void bv_vlblock_to_objs(struct bu_ptbl *out, const char *name_root, struct bv_vlblock *vbp, struct bview *v, struct bv_scene_obj *f, struct bu_list *vlfree)
size_t bv_vlist_cmd_cnt(struct bv_vlist *vlist)
void bv_plot_vlblock(FILE *fp, const struct bv_vlblock *vbp)
struct bv_scene_obj * bv_vlblock_obj(struct bv_vlblock *vbp, struct bview *v, const char *name)
int bv_vlist_bbox(struct bu_list *vlistp, point_t *bmin, point_t *bmax, size_t *length, int *dispmode)
void bv_vlist_rpp(struct bu_list *vlists, struct bu_list *hd, const point_t minn, const point_t maxx)
struct bv_vlblock * bv_vlblock_init(struct bu_list *free_vlist_hd, int max_ent)
void bv_vlist_to_uplot(FILE *fp, const struct bu_list *vhead)
void bv_vlist_import(struct bu_list *vlists, struct bu_list *hp, struct bu_vls *namevls, const unsigned char *buf)
void bv_vlblock_free(struct bv_vlblock *vbp)
struct bu_list * bv_vlblock_find(struct bv_vlblock *vbp, int r, int g, int b)
void bv_vlist_2string(struct bu_list *vhead, struct bu_list *free_hd, const char *string, double x, double y, double scale, double theta)
void bv_vlist_copy(struct bu_list *vlists, struct bu_list *dest, const struct bu_list *src)
fastf_t mat_t[ELEMENTS_PER_MAT]
4x4 matrix
fastf_t point_t[ELEMENTS_PER_POINT]
3-tuple point
Global registry of recognized magic numbers.
long * rgb
rgb[max] variable size array
struct bu_list * free_vlist_hd
where to get/put free vlists
struct bu_list * head
head[max] variable size array
size_t nused
elements 0..nused active
struct bu_list l
magic, forw, back
int cmd[BV_VLIST_CHUNK]
VL_CMD_*.
point_t pt[BV_VLIST_CHUNK]
associated 3-point/vect
fundamental vector, matrix, quaternion math macros