27
27
28
28
#include " vmath.h"
29
29
#include " bn.h"
30
- #include " raytrace.h"
30
+ #include " rt/functab.h"
31
+ #include " rt/db_internal.h"
31
32
#include " rt_ecmds.h"
32
33
33
34
#ifdef __cplusplus
@@ -76,88 +77,6 @@ __BEGIN_DECLS
76
77
#define CMD_BAD 920
77
78
#define CMD_MORE 921
78
79
79
- struct rt_solid_edit {
80
-
81
- struct rt_solid_edit_map *m;
82
-
83
- // Optional logging of messages from editing code
84
- struct bu_vls *log_str;
85
-
86
- // Container to hold the intermediate state
87
- // of the object being edited (I think?)
88
- struct rt_db_internal es_int;
89
-
90
- // Tolerance for calculations
91
- const struct bn_tol *tol;
92
- struct bview *vp;
93
-
94
- // Primary variable used to identify specific editing operations
95
- int edit_flag;
96
- /* item/edit_mode selected from menu. TODO - it seems like this
97
- * may be used to "specialize" edit_flag to narrow its scope to
98
- * specific operations - in which case we might be able to rename
99
- * it to something more general than "menu"... */
100
- int edit_menu;
101
-
102
- // Translate values used in XY mouse vector manipulation
103
- vect_t edit_absolute_model_tran;
104
- vect_t last_edit_absolute_model_tran;
105
- vect_t edit_absolute_view_tran;
106
- vect_t last_edit_absolute_view_tran;
107
-
108
- // Scale values used in XY mouse vector manipulation
109
- fastf_t edit_absolute_scale;
110
-
111
- // MGED wants to know if we're in solid rotate, translate or scale mode.
112
- // (TODO - why?) Rather than keying off of primitive specific edit op
113
- // types, have the ops set flags:
114
- int solid_edit_rotate;
115
- int solid_edit_translate;
116
- int solid_edit_scale;
117
- int solid_edit_pick;
118
-
119
- fastf_t es_scale; /* scale factor */
120
- mat_t incr_change; /* change(s) from last cycle */
121
- mat_t model_changes; /* full changes this edit */
122
- fastf_t acc_sc_sol; /* accumulate solid scale factor */
123
- mat_t acc_rot_sol; /* accumulate solid rotations */
124
-
125
- int e_keyfixed; /* keypoint specified by user? */
126
- point_t e_keypoint; /* center of editing xforms */
127
- const char *e_keytag; /* string identifying the keypoint */
128
-
129
- int e_mvalid; /* e_mparam valid. e_inpara must = 0 */
130
- vect_t e_mparam; /* mouse input param. Only when es_mvalid set */
131
-
132
- int e_inpara; /* parameter input from keyboard flag. 1 == e_para valid. e_mvalid must = 0 */
133
- vect_t e_para; /* keyboard input parameter changes */
134
-
135
- mat_t e_invmat; /* inverse of e_mat KAA */
136
- mat_t e_mat; /* accumulated matrix of path */
137
-
138
- point_t curr_e_axes_pos; /* center of editing xforms */
139
- point_t e_axes_pos;
140
-
141
- // Conversion factors
142
- double base2local;
143
- double local2base;
144
-
145
- // Trigger for view updating
146
- int update_views;
147
-
148
- // vlfree list
149
- struct bu_list *vlfree;
150
-
151
- /* Flag to trigger some primitive edit opts to use keypoint (and maybe other behaviors?) */
152
- int mv_context;
153
-
154
- /* Internal primitive editing information specific to primitive types. */
155
- void *ipe_ptr;
156
-
157
- /* User pointer */
158
- void *u_ptr;
159
- };
160
-
161
80
struct rt_solid_edit_map *rt_solid_edit_map_create (void );
162
81
void rt_solid_edit_map_destroy (struct rt_solid_edit_map *);
163
82
int rt_solid_edit_map_clbk_set (struct rt_solid_edit_map *em, int ed_cmd, int menu_cmd, int mode, bu_clbk_t f, void *d);
@@ -166,12 +85,6 @@ int rt_solid_edit_map_sync(struct rt_solid_edit_map *om, struct rt_solid_edit_ma
166
85
int rt_solid_edit_clbk_get (bu_clbk_t *f, void **d, struct rt_solid_edit *s, int ed_cmd, int menu_cmd, int mode);
167
86
168
87
169
- struct rt_solid_edit_menu_item {
170
- char *menu_string;
171
- void (*menu_func)(struct rt_solid_edit *, int , int , int , void *);
172
- int menu_arg;
173
- };
174
-
175
88
void rt_solid_edit_process (struct rt_solid_edit *s);
176
89
177
90
243
156
rt_solid_edit_generic_menu_str (struct bu_vls *mstr, const struct rt_db_internal *ip, const struct bn_tol *tol);
244
157
245
158
246
- struct rt_solid_edit_functab {
247
- uint32_t magic;
248
- char ft_name[17 ]; /* current longest name is 16 chars, need one element for terminating NULL */
249
- char ft_label[9 ]; /* current longest label is 8 chars, need one element for terminating NULL */
250
-
251
- void (*ft_labels)(int *num_lines,
252
- point_t *lines,
253
- struct rt_point_labels *pl,
254
- int max_pl,
255
- const mat_t xform,
256
- struct rt_solid_edit *s,
257
- struct bn_tol *tol);
258
- #define EDFUNCTAB_FUNC_LABELS_CAST (_func ) ((void (*)(int *, point_t *, struct rt_point_labels *, int , const mat_t , struct rt_solid_edit *, struct bn_tol *))((void (*)(void ))_func))
259
-
260
- const char *(*ft_keypoint)(point_t *pt,
261
- const char *keystr,
262
- const mat_t mat,
263
- struct rt_solid_edit *s,
264
- const struct bn_tol *tol);
265
- #define EDFUNCTAB_FUNC_KEYPOINT_CAST (_func ) ((const char *(*)(point_t *, const char *, const mat_t , struct rt_solid_edit *, const struct bn_tol *))((void (*)(void ))_func))
266
-
267
- void (*ft_e_axes_pos)(
268
- struct rt_solid_edit *s,
269
- const struct rt_db_internal *ip,
270
- const struct bn_tol *tol);
271
- #define EDFUNCTAB_FUNC_E_AXES_POS_CAST (_func ) ((void (*)(struct rt_solid_edit *s, const struct rt_db_internal *, const struct bn_tol *))((void (*)(void ))_func))
272
-
273
- // Written format is intended to be human editable text that will be parsed
274
- // by ft_read_params. There are no guarantees of formatting consistency by
275
- // this API, so external apps should not rely on this format being
276
- // consistent release-to-release. The only API guarantee is that
277
- // ft_write_params output for a given BRL-CAD version is readable by
278
- // ft_read_params.
279
- void (*ft_write_params)(
280
- struct bu_vls *p,
281
- const struct rt_db_internal *ip,
282
- const struct bn_tol *tol,
283
- fastf_t base2local);
284
- #define EDFUNCTAB_FUNC_WRITE_PARAMS_CAST (_func ) ((void (*)(struct bu_vls *, const struct rt_db_internal *, const struct bn_tol *, fastf_t ))((void (*)(void ))_func))
285
-
286
- // Parse ft_write_params output and assign numerical values to ip.
287
- int (*ft_read_params)(
288
- struct rt_db_internal *ip,
289
- const char *fc,
290
- const struct bn_tol *tol,
291
- fastf_t local2base);
292
- #define EDFUNCTAB_FUNC_READ_PARAMS_CAST (_func ) ((int (*)(struct rt_db_internal *, const char *, const struct bn_tol *, fastf_t ))((void (*)(void ))_func))
293
-
294
- int (*ft_edit)(struct rt_solid_edit *s, int edflag);
295
- #define EDFUNCTAB_FUNC_EDIT_CAST (_func ) ((int (*)(struct rt_solid_edit *, int ))((void (*)(void ))_func))
296
-
297
- /* Translate mouse info into edit ready info. mousevec [X] and [Y] are in
298
- * the range -1.0...+1.0, corresponding to viewspace.
299
- *
300
- * In order to allow command line commands to do the same things that a
301
- * mouse movements can, the preferred strategy is to store values and allow
302
- * ft_edit to actually do the work. */
303
- int (*ft_edit_xy)(struct rt_solid_edit *s, int edflag, const vect_t mousevec);
304
- #define EDFUNCTAB_FUNC_EDITXY_CAST (_func ) ((int (*)(struct rt_solid_edit *, int , const vect_t ))((void (*)(void ))_func))
305
-
306
- /* Create primitive specific editing struct */
307
- void *(*ft_prim_edit_create)(struct rt_solid_edit *s);
308
- #define EDFUNCTAB_FUNC_PRIMEDIT_CREATE_CAST (_func ) ((void *(*)(struct rt_solid_edit *))((void (*)(void ))_func))
309
-
310
- /* Destroy primitive specific editing struct */
311
- void (*ft_prim_edit_destroy)(void *);
312
- #define EDFUNCTAB_FUNC_PRIMEDIT_DESTROY_CAST (_func ) ((void (*)(void *))((void (*)(void ))_func))
313
-
314
- /* Create primitive specific editing struct */
315
- void (*ft_prim_edit_reset)(struct rt_solid_edit *s);
316
- #define EDFUNCTAB_FUNC_PRIMEDIT_RESET_CAST (_func ) ((void (*)(struct rt_solid_edit *))((void (*)(void ))_func))
317
-
318
- int (*ft_menu_str)(struct bu_vls *m, const struct rt_db_internal *ip, const struct bn_tol *tol);
319
- #define EDFUNCTAB_FUNC_MENU_STR_CAST (_func ) ((int (*)(struct bu_vls *, const struct rt_db_internal *, const struct bn_tol *))((void (*)(void ))_func))
320
-
321
- struct rt_solid_edit_menu_item *(*ft_menu_item)(const struct bn_tol *tol);
322
- #define EDFUNCTAB_FUNC_MENU_ITEM_CAST (_func ) ((struct rt_solid_edit_menu_item *(*)(const struct bn_tol *))((void (*)(void ))_func))
323
-
324
- };
325
- extern const struct rt_solid_edit_functab EDOBJ[];
326
-
327
159
__END_DECLS
328
160
329
161
#endif /* EDFUNCTAB_H */
0 commit comments