diff --git a/src/libged/display_list.c b/src/libged/display_list.c index 1de79942ae..ebf1ad8a5f 100644 --- a/src/libged/display_list.c +++ b/src/libged/display_list.c @@ -680,135 +680,6 @@ solid_append_vlist(struct bv_scene_obj *sp, struct bv_vlist *vlist) BU_LIST_APPEND_LIST(&(sp->s_vlist), &(vlist->l)); } - -void -dl_add_path(int dashflag, struct bu_list *vhead, const struct db_full_path *pathp, struct db_tree_state *tsp, unsigned char *wireframe_color_override, struct _ged_client_data *dgcdp) -{ - if (!dgcdp || !dgcdp->v) - return; - - struct bv_scene_obj *sp = bv_obj_get(dgcdp->v, BV_DB_OBJS); - if (!sp) - return; - - struct ged_bv_data *bdata = (sp->s_u_data) ? (struct ged_bv_data *)sp->s_u_data : NULL; - if (!bdata) { - BU_GET(bdata, struct ged_bv_data); - db_full_path_init(&bdata->s_fullpath); - sp->s_u_data = (void *)bdata; - } else { - bdata->s_fullpath.fp_len = 0; - } - if (!sp->s_u_data) - return; - - solid_append_vlist(sp, (struct bv_vlist *)vhead); - - bv_scene_obj_bound(sp, dgcdp->v); - - db_dup_full_path(&bdata->s_fullpath, pathp); - - sp->s_flag = DOWN; - sp->s_iflag = DOWN; - sp->s_soldash = dashflag; - sp->s_old.s_Eflag = 0; - - if (tsp) { - sp->s_old.s_regionid = tsp->ts_regionid; - } - - solid_set_color_info(sp, wireframe_color_override, tsp); - - sp->s_dlist = 0; - sp->s_os->transparency = dgcdp->vs.transparency; - sp->s_os->s_dmode = dgcdp->vs.s_dmode; - - /* append solid to display list */ - bu_semaphore_acquire(RT_SEM_MODEL); - BU_LIST_APPEND(dgcdp->gdlp->dl_head_scene_obj.back, &sp->l); - bu_semaphore_release(RT_SEM_MODEL); - - ged_create_vlist_solid_cb(dgcdp->gedp, sp); - -} - - -static fastf_t -draw_solid_wireframe(struct bv_scene_obj *sp, struct bview *gvp, struct db_i *dbip, - const struct bn_tol *tol, const struct bg_tess_tol *ttol) -{ - int ret; - struct bu_list vhead; - struct rt_db_internal dbintern; - struct rt_db_internal *ip = &dbintern; - - BU_LIST_INIT(&vhead); - if (!sp->s_u_data) - return -1; - struct ged_bv_data *bdata = (struct ged_bv_data *)sp->s_u_data; - - ret = rt_db_get_internal(ip, DB_FULL_PATH_CUR_DIR(&bdata->s_fullpath), - dbip, sp->s_mat, &rt_uniresource); - - if (ret < 0) { - return -1; - } - - if (gvp && gvp->gv_s->adaptive_plot_csg && ip->idb_meth->ft_adaptive_plot) { - ret = ip->idb_meth->ft_adaptive_plot(&vhead, ip, tol, gvp, sp->s_size); - } else if (ip->idb_meth->ft_plot) { - ret = ip->idb_meth->ft_plot(&vhead, ip, ttol, tol, gvp); - } - - rt_db_free_internal(ip); - - if (ret < 0) { - if (DB_FULL_PATH_CUR_DIR(&bdata->s_fullpath)) - bu_log("%s: plot failure\n", DB_FULL_PATH_CUR_DIR(&bdata->s_fullpath)->d_namep); - - return -1; - } - - /* add plot to solid */ - solid_append_vlist(sp, (struct bv_vlist *)&vhead); - - return 0; -} - - -int -redraw_solid(struct bv_scene_obj *sp, struct db_i *dbip, struct db_tree_state *tsp, struct bview *gvp) -{ - if (sp->s_os->s_dmode == _GED_WIREFRAME) { - /* replot wireframe */ - if (BU_LIST_NON_EMPTY(&sp->s_vlist)) { - BV_FREE_VLIST(&RTG.rtg_vlfree, &sp->s_vlist); - } - return draw_solid_wireframe(sp, gvp, dbip, tsp->ts_tol, tsp->ts_ttol); - } - return 0; -} - - -int -dl_redraw(struct display_list *gdlp, struct ged *gedp, int skip_subtractions) -{ - struct db_i *dbip = gedp->dbip; - struct rt_wdb *wdbp = wdb_dbopen(gedp->dbip, RT_WDB_TYPE_DB_DEFAULT); - struct db_tree_state *tsp = &wdbp->wdb_initial_tree_state; - struct bview *gvp = gedp->ged_gvp; - int ret = 0; - struct bv_scene_obj *sp; - for (BU_LIST_FOR(sp, bv_scene_obj, &gdlp->dl_head_scene_obj)) { - if (!skip_subtractions || (skip_subtractions && !sp->s_soldash)) { - ret += redraw_solid(sp, dbip, tsp, gvp); - } - } - ged_create_vlist_display_list_cb(gedp, gdlp); - return ret; -} - - static void solid_copy_vlist(struct db_i *UNUSED(dbip), struct bv_scene_obj *sp, struct bv_vlist *vlist) { diff --git a/src/libged/ged_private.h b/src/libged/ged_private.h index 881b849e96..d41c3273f2 100644 --- a/src/libged/ged_private.h +++ b/src/libged/ged_private.h @@ -279,8 +279,6 @@ GED_EXPORT extern void _dl_eraseAllPathsFromDisplay(struct ged *gedp, const char extern void _dl_freeDisplayListItem(struct ged *gedp, struct display_list *gdlp); GED_EXPORT extern int dl_bounding_sph(struct bu_list *hdlp, vect_t *min, vect_t *max, int pflag); -GED_EXPORT extern void dl_add_path(int dashflag, struct bu_list *vhead, const struct db_full_path *pathp, struct db_tree_state *tsp, unsigned char *wireframe_color_override, struct _ged_client_data *dgcdp); - GED_EXPORT extern void color_soltab(struct bv_scene_obj *sp); GED_EXPORT extern void solid_set_color_info(struct bv_scene_obj *sp, unsigned char *wireframe_color_override, struct db_tree_state *tsp); diff --git a/src/libged/ged_util.cpp b/src/libged/ged_util.cpp index 2bde2d40ef..bd58fc9f30 100644 --- a/src/libged/ged_util.cpp +++ b/src/libged/ged_util.cpp @@ -1258,6 +1258,65 @@ _ged_do_list(struct ged *gedp, struct directory *dp, int verbose) } } + + +void +dl_add_path(int dashflag, struct bu_list *vhead, const struct db_full_path *pathp, struct db_tree_state *tsp, unsigned char *wireframe_color_override, struct _ged_client_data *dgcdp) +{ + if (!dgcdp || !dgcdp->v) + return; + + struct bv_scene_obj *sp = bv_obj_get(dgcdp->v, BV_DB_OBJS); + if (!sp) + return; + + struct ged_bv_data *bdata = (sp->s_u_data) ? (struct ged_bv_data *)sp->s_u_data : NULL; + if (!bdata) { + BU_GET(bdata, struct ged_bv_data); + db_full_path_init(&bdata->s_fullpath); + sp->s_u_data = (void *)bdata; + } else { + bdata->s_fullpath.fp_len = 0; + } + if (!sp->s_u_data) + return; + + + if (BU_LIST_IS_EMPTY(&(sp->s_vlist))) + sp->s_vlen = 0; + + struct bv_vlist *bvv = (struct bv_vlist *)vhead; + sp->s_vlen += bv_vlist_cmd_cnt(bvv); + BU_LIST_APPEND_LIST(&(sp->s_vlist), &(bvv->l)); + + bv_scene_obj_bound(sp, dgcdp->v); + + db_dup_full_path(&bdata->s_fullpath, pathp); + + sp->s_flag = DOWN; + sp->s_iflag = DOWN; + sp->s_soldash = dashflag; + sp->s_old.s_Eflag = 0; + + if (tsp) { + sp->s_old.s_regionid = tsp->ts_regionid; + } + + solid_set_color_info(sp, wireframe_color_override, tsp); + + sp->s_dlist = 0; + sp->s_os->transparency = dgcdp->vs.transparency; + sp->s_os->s_dmode = dgcdp->vs.s_dmode; + + /* append solid to display list */ + bu_semaphore_acquire(RT_SEM_MODEL); + BU_LIST_APPEND(dgcdp->gdlp->dl_head_scene_obj.back, &sp->l); + bu_semaphore_release(RT_SEM_MODEL); + + ged_create_vlist_solid_cb(dgcdp->gedp, sp); + +} + /** * Once the vlist has been created, perform the common tasks * in handling the drawn solid.