Changeset 205 for osgVisual/trunk/src
- Timestamp:
- Jan 24, 2011, 9:10:14 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.