BRL-CAD
osg-test.cpp File Reference
#include "common.h"
#include "bu/log.h"
#include "bu/list.h"
#include "mater.h"
#include "raytrace.h"
#include "rtfunc.h"
#include <map>
#include <osgUtil/Optimizer>
#include <osgDB/ReadFile>
#include <osgViewer/Viewer>
#include <osgViewer/CompositeViewer>
#include <osgViewer/ViewerEventHandlers>
#include <osgGA/TrackballManipulator>
#include <osgGA/StateSetManipulator>
#include <osg/Material>
#include <osg/Geode>
#include <osg/BlendFunc>
#include <osg/Depth>
#include <osg/PolygonOffset>
#include <osg/MatrixTransform>
#include <osg/Camera>
#include <osg/RenderInfo>
#include <osg/LineStipple>
#include <osgDB/WriteFile>
#include <osgText/Text>
Include dependency graph for osg-test.cpp:

Go to the source code of this file.

Functions

struct bu_listobj_vlist (const struct directory *dp, const struct db_i *dbip, mat_t mat)
 
void add_vlist_to_geom (osg::Geometry *geom, struct bu_list *plot_segments)
 
osg::ref_ptr< osg::Group > solid_node (std::map< const struct directory *, osg::ref_ptr< osg::Group > > *osg_nodes, const struct directory *dp, const struct db_i *dbip)
 
void create_solid_nodes (std::map< const struct directory *, osg::ref_ptr< osg::Group > > *osg_nodes, struct directory *dp, struct db_i *dbip)
 
osg::ref_ptr< osg::Group > bare_comb_node (std::map< const struct directory *, osg::ref_ptr< osg::Group > > *osg_nodes, const struct directory *dp, const struct db_i *dbip)
 
int subtracted_solid (struct db_full_path *path)
 
void add_comb_child (osg::Group *comb, osg::Group *child, struct db_full_path *child_path, struct db_i *dbip)
 
osg::ref_ptr< osg::Group > full_comb_node (std::map< const struct directory *, osg::ref_ptr< osg::Group > > *osg_nodes, struct directory *dp, struct db_i *dbip)
 
osg::ref_ptr< osg::Group > full_region_node (std::map< const struct directory *, osg::ref_ptr< osg::Group > > *osg_nodes, struct directory *dp, struct db_i *dbip)
 
osg::ref_ptr< osg::Group > full_assembly_node (std::map< const struct directory *, osg::ref_ptr< osg::Group > > *osg_nodes, struct directory *dp, struct db_i *dbip)
 
int characterize_dp (struct directory *dp, struct db_i *dbip)
 
void add_dp_to_scene (std::map< const struct directory *, osg::ref_ptr< osg::Group > > *osg_nodes, struct directory *dp, struct db_i *dbip)
 
int add_path_to_scene (std::map< const struct directory *, osg::ref_ptr< osg::Group > > *osg_nodes, const struct db_full_path *path, struct db_i *dbip)
 
int main (int argc, char **argv)
 

Detailed Description

BRL-CAD test application for OpenSceneGraph integration, based off of osghud example from OpenSceneGraph, which has the following license:

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Definition in file osg-test.cpp.

Function Documentation

struct bu_list* obj_vlist ( const struct directory dp,
const struct db_i dbip,
mat_t  mat 
)

Definition at line 78 of file osg-test.cpp.

References BN_TOL_MAGIC, bu_exit(), BU_GET, BU_LIST_INIT, directory::d_namep, rt_db_free_internal(), rt_db_get_internal(), RT_DB_INTERNAL_INIT, rt_obj_plot(), RT_TESS_TOL_MAGIC, and rt_uniresource.

Referenced by full_region_node(), and solid_node().

Here is the call graph for this function:

void add_vlist_to_geom ( osg::Geometry *  geom,
struct bu_list plot_segments 
)
osg::ref_ptr<osg::Group> solid_node ( std::map< const struct directory *, osg::ref_ptr< osg::Group > > *  osg_nodes,
const struct directory dp,
const struct db_i dbip 
)

Definition at line 165 of file osg-test.cpp.

References add_vlist_to_geom(), BU_PUT, directory::d_namep, obj_vlist(), and RT_FREE_VLIST.

Referenced by add_dp_to_scene(), create_solid_nodes(), full_assembly_node(), and full_comb_node().

Here is the call graph for this function:

void create_solid_nodes ( std::map< const struct directory *, osg::ref_ptr< osg::Group > > *  osg_nodes,
struct directory dp,
struct db_i dbip 
)

Definition at line 206 of file osg-test.cpp.

References BU_PTBL_GET, BU_PTBL_INIT_ZERO, BU_PTBL_LEN, db_search(), db_search_free(), DB_SEARCH_RETURN_UNIQ_DP, and solid_node().

Here is the call graph for this function:

osg::ref_ptr<osg::Group> bare_comb_node ( std::map< const struct directory *, osg::ref_ptr< osg::Group > > *  osg_nodes,
const struct directory dp,
const struct db_i dbip 
)

Definition at line 226 of file osg-test.cpp.

References directory::d_namep, rt_db_internal::idb_ptr, rt_db_get_internal(), and rt_uniresource.

Referenced by add_path_to_scene(), full_assembly_node(), full_comb_node(), and full_region_node().

Here is the call graph for this function:

int subtracted_solid ( struct db_full_path path)

Definition at line 274 of file osg-test.cpp.

References db_full_path::fp_bool, and db_full_path::fp_len.

Referenced by full_region_node().

void add_comb_child ( osg::Group *  comb,
osg::Group *  child,
struct db_full_path child_path,
struct db_i dbip 
)

Definition at line 284 of file osg-test.cpp.

References bn_mat_is_equal(), BN_TOL_MAGIC, DB_FULL_PATH_CUR_DIR, db_path_to_mat(), db_full_path::fp_bool, db_full_path::fp_len, and rt_uniresource.

Referenced by add_path_to_scene(), full_assembly_node(), and full_comb_node().

Here is the call graph for this function:

osg::ref_ptr<osg::Group> full_comb_node ( std::map< const struct directory *, osg::ref_ptr< osg::Group > > *  osg_nodes,
struct directory dp,
struct db_i dbip 
)

Definition at line 327 of file osg-test.cpp.

References add_comb_child(), bare_comb_node(), BU_PTBL_GET, BU_PTBL_INIT_ZERO, BU_PTBL_LEN, directory::d_flags, DB_FULL_PATH_CUR_DIR, db_search(), db_search_free(), DB_SEARCH_RETURN_UNIQ_DP, DB_SEARCH_TREE, RT_DIR_COMB, RT_DIR_SOLID, and solid_node().

Referenced by add_dp_to_scene(), and full_assembly_node().

Here is the call graph for this function:

osg::ref_ptr<osg::Group> full_region_node ( std::map< const struct directory *, osg::ref_ptr< osg::Group > > *  osg_nodes,
struct directory dp,
struct db_i dbip 
)

Definition at line 367 of file osg-test.cpp.

References add_vlist_to_geom(), bare_comb_node(), BU_PTBL_GET, BU_PTBL_INIT_ZERO, BU_PTBL_LEN, BU_PUT, directory::d_namep, DB_FULL_PATH_CUR_DIR, db_path_to_mat(), db_search(), db_search_free(), DB_SEARCH_TREE, db_full_path::fp_len, obj_vlist(), RT_FREE_VLIST, rt_uniresource, and subtracted_solid().

Referenced by add_dp_to_scene(), and full_assembly_node().

Here is the call graph for this function:

osg::ref_ptr<osg::Group> full_assembly_node ( std::map< const struct directory *, osg::ref_ptr< osg::Group > > *  osg_nodes,
struct directory dp,
struct db_i dbip 
)

Definition at line 450 of file osg-test.cpp.

References add_comb_child(), bare_comb_node(), BU_PTBL_GET, BU_PTBL_INIT_ZERO, BU_PTBL_LEN, directory::d_flags, DB_FULL_PATH_CUR_DIR, db_search(), db_search_free(), DB_SEARCH_RETURN_UNIQ_DP, DB_SEARCH_TREE, full_comb_node(), full_region_node(), RT_DIR_COMB, RT_DIR_REGION, RT_DIR_SOLID, and solid_node().

Referenced by add_dp_to_scene().

Here is the call graph for this function:

int characterize_dp ( struct directory dp,
struct db_i dbip 
)

Definition at line 513 of file osg-test.cpp.

References BU_PTBL_INIT_ZERO, BU_PTBL_LEN, directory::d_flags, db_search(), db_search_free(), DB_SEARCH_QUIET, RT_DIR_COMB, RT_DIR_REGION, and RT_DIR_SOLID.

Referenced by add_dp_to_scene().

Here is the call graph for this function:

void add_dp_to_scene ( std::map< const struct directory *, osg::ref_ptr< osg::Group > > *  osg_nodes,
struct directory dp,
struct db_i dbip 
)

Definition at line 537 of file osg-test.cpp.

References characterize_dp(), full_assembly_node(), full_comb_node(), full_region_node(), and solid_node().

Referenced by add_path_to_scene().

Here is the call graph for this function:

int add_path_to_scene ( std::map< const struct directory *, osg::ref_ptr< osg::Group > > *  osg_nodes,
const struct db_full_path path,
struct db_i dbip 
)

Definition at line 560 of file osg-test.cpp.

References add_comb_child(), add_dp_to_scene(), bare_comb_node(), db_dup_full_path(), db_free_full_path(), DB_FULL_PATH_CUR_DIR, db_full_path_init(), DB_FULL_PATH_POP, db_full_path::fp_len, and db_full_path::fp_names.

Referenced by main().

Here is the call graph for this function:

int main ( int  argc,
char **  argv 
)

Definition at line 588 of file osg-test.cpp.

References add_path_to_scene(), bu_exit(), bu_file_exists(), BU_LIST_INIT, db_close(), db_dirbuild(), DB_FULL_PATH_ROOT_DIR, db_open(), DB_OPEN_READONLY, db_string_to_path(), DBI_NULL, RT_CK_DBI, RT_DIR_NULL, RTG, and rt_g::rtg_vlfree.

Here is the call graph for this function: