Changeset 205 for osgVisual/trunk
- Timestamp:
- Jan 24, 2011, 9:10:14 PM (14 years ago)
- Location:
- osgVisual/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
osgVisual/trunk/bin/osgVisualConfig.xml
r204 r205 41 41 <animationpath filename="salzburg.path"></animationpath> 42 42 <models> 43 <!-- Models can be loaded and placed in the scenerey. 44 - filename: 3D model to load. Leave empty to use model without 3D model. 45 - type: [plain] ? todo 43 <!-- Models can be loaded and placed in the scenery. 44 - objectname: Name of the object to identify it in the scenegraph. 46 45 - label: text to label the model with. 47 - dynamic: Add an standard updater to the model. todo48 - position: Po isition to place the model49 - attitude: Orientation to place the model46 - dynamic: "yes" to add an standard updater to the model. 47 - position: Position to place the model 48 - attitude: Orientation in degree to place the model 50 49 - updater [optional]: Channels to use for position and attitude update 51 - modeloffset [optional]: Offset for the loaded 3D model to the visual_object (if the 3D model has a wrong coordinate frame) 52 - cameraoffset [optional]: Offset for the object mounted camera manipulator to the visual_object 50 - cameraoffset [optional]: Rotational (in degree) and translational offset for the object mounted camera manipulator to the visual_object 51 - Geometry [optional]: 3D model to display. Leave empty to use model without 3D model. 52 - Geometryoffset [optional]: Rotational offset (in degree) for the loaded 3D model to the visual_object (if the 3D model has a wrong coordinate frame) 53 - Geometryscale [optional]: Scale factors for the loaded 3D model in all three dimensions. 53 54 --> 54 <model filename="cessna.osg" type="plain" label="TestText!" dynamic="yes">55 <model objectname="TestObject" label="TestText!" dynamic="yes"> 55 56 <position lat="47.12345" lon="11.234567" alt="1500.0"></position> 56 57 <attitude rot_x="0.0" rot_y="0.0" rot_z="0.0"></attitude> 57 58 <updater> 58 <position lat="channelXYZ" lon="channelXYZ" alt="channelXYZ"></position> 59 <attitude rot_x="channelXYZ" rot_y="channelXYZ" rot_z="channelXYZ"></attitude> 59 <translation-slots>todo</translation-slots> 60 60 </updater> 61 <modeloffset>62 <translation trans_x="0.0" trans_y="0.0" trans_z="0.0"></translation>63 <rotation rot_x="0.0" rot_y="0.0" rot_z="0.0"></rotation>64 </modeloffset>65 61 <cameraoffset> 66 62 <translation trans_x="0.0" trans_y="0.0" trans_z="0.0"></translation> 67 63 <rotation rot_x="0.0" rot_y="0.0" rot_z="0.0"></rotation> 68 64 </cameraoffset> 65 <geometry filename="cessna"> 66 <offset rot_x="0.0" rot_y="0.0" rot_z="0.0"></offset> 67 <scalefactor scale_x="1.0" scale_y="1.0" scale_z="1.0"></scalefactor> 68 </geometry> 69 69 </model> 70 70 </models> -
osgVisual/trunk/src/object/visual_object.cpp
r204 r205 43 43 geometry_offset_rotation.makeRotate( 0.0, 1.0, 1.0, 1.0 ); 44 44 45 // Init Scale 45 // Init Scale factor 46 46 scaleX = 1.0; 47 47 scaleY = 1.0; … … 74 74 //osg::ref<visual_object> object = new visual_object( root, nodeName); 75 75 76 std::string filename="", type 77 78 /* 79 <models> 80 <model filename="cessna" type="plain" label="TestText!" dynamic="yes"> 81 <position lat="47.12345" lon="11.234567" alt="1500.0"></position> 82 <attitude rot_x="0.0" rot_y="0.0" rot_z="0.0"></attitude> 83 <cameraoffset> 84 <translation trans_x="0.0" trans_y="0.0" trans_z="0.0"></translation> 85 <rotation rot_x="0.0" rot_y="0.0" rot_z="0.0"></rotation> 86 </cameraoffset> 87 </model> 88 </models> 89 */ 76 std::string objectname="", filename="", label=""; 77 bool dynamic = false; 78 double lat=0.0, lon=0.0, alt=0.0, rot_x=0.0, rot_y=0.0, rot_z=0.0; 79 double cam_trans_x=0.0, cam_trans_y=0.0, cam_trans_z=0.0, cam_rot_x=0.0, cam_rot_y=0.0, cam_rot_z=0.0; 80 double geometry_rot_x=0.0, geometry_rot_y=0.0, geometry_rot_z=0.0; 81 double geometry_scale_x=1.0, geometry_scale_y=1.0, geometry_scale_z=1.0; 82 osg::ref_ptr<osgVisual::object_updater> updater = NULL; 83 84 osgVisual::visual_object* object = new osgVisual::visual_object( sceneRoot_, objectname ); 85 object->lat = lat; 86 object->lon = lon; 87 object->alt = alt; 88 object->azimuthAngle_psi = rot_x; 89 object->pitchAngle_theta = rot_y; 90 object->bankAngle_phi = rot_z; 91 if(label!="") 92 object->addLabel("XML_defined_label", label); 93 if(dynamic) 94 { 95 updater = new osgVisual::object_updater(object); 96 } 97 object->setCameraOffset( cam_trans_x, cam_trans_y, cam_trans_z, cam_rot_x, cam_rot_y, cam_rot_z); 98 if(filename!="") 99 { 100 object->loadGeometry( filename ); 101 object->setGeometryOffset( geometry_rot_x, geometry_rot_y, geometry_rot_z ); 102 object->setScale( geometry_scale_x, geometry_scale_y, geometry_scale_z ); 103 } 104 105 if(updater.valid()) 106 object->addUpdater( updater ); 107 108 /* 109 - updater [optional]: Channels to use for position and attitude update 110 111 <updater> 112 <translation-slots>todo</translation-slots> 113 </updater> 114 */ 90 115 91 116 OSG_NOTIFY( osg::ALWAYS ) << "Done." << std::endl; 92 return NULL;117 return object; 93 118 } 94 119
Note: See TracChangeset
for help on using the changeset viewer.