- Timestamp:
- Jan 7, 2011, 5:41:45 PM (14 years ago)
- Location:
- osgVisual/trunk
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
osgVisual/trunk/CMakeLists.txt
r181 r183 195 195 196 196 # Module cluster 197 SET(SOURCES 198 ${SOURCES} 199 include/cluster/dataIO_cluster.h 200 include/cluster/dataIO_clusterDummy.h 201 src/cluster/dataIO_clusterDummy.cpp 202 ) 197 203 SET(USE_CLUSTER_ASIO_TCP_IOSTREAM OFF CACHE BOOL "Enable to use the Boost ASIO TCP iostream implementation for the cluster interface") 198 204 SET(USE_CLUSTER_ENET ON CACHE BOOL "Enable to use the ENet reliable UDP library implementation for the cluster interface") … … 200 206 SET(SOURCES 201 207 ${SOURCES} 202 include/cluster/dataIO_cluster.h203 208 include/cluster/dataIO_clusterAsioTcpIostream.h 204 209 src/cluster/dataIO_clusterAsioTcpIostream.cpp … … 218 223 SET(SOURCES 219 224 ${SOURCES} 220 include/cluster/dataIO_cluster.h221 225 include/cluster/dataIO_clusterENet.h 222 226 src/cluster/dataIO_clusterENet.cpp … … 242 246 include/cluster/enet/win32.h 243 247 ) 244 ADD_DEFINITIONS( "-DUSE_CLUSTER_ENET" ) 245 246 ENDIF() 247 248 IF(NOT USE_CLUSTER_ASIO_TCP_IOSTREAM AND NOT USE_CLUSTER_ENET) 249 SET(SOURCES 250 ${SOURCES} 251 include/cluster/dataIO_cluster.h 252 include/cluster/dataIO_clusterDummy.h 253 src/cluster/dataIO_clusterDummy.cpp 254 ) 255 ADD_DEFINITIONS( "-DUSE_CLUSTER_DUMMY" ) 256 ENDIF() 248 ADD_DEFINITIONS( "-DUSE_CLUSTER_ENET" ) 249 ENDIF() 250 251 257 252 258 253 … … 260 255 SET(SOURCES 261 256 ${SOURCES} 257 include/extLink/dataIO_extLinkDummy.h 258 src/extLink/dataIO_extLinkDummy.cpp 262 259 include/extLink/dataIO_extLink.h 263 260 include/extLink/manip_extLink.h … … 277 274 #Linking: VCL uses #pragma to link, no need for linking configuration in CMAKE 278 275 ELSE(USE_EXTLINK_VCL) 279 SET(SOURCES280 ${SOURCES}281 include/extLink/dataIO_extLinkDummy.h282 src/extLink/dataIO_extLinkDummy.cpp283 )284 276 UNSET(EXTLINK_VCL_INCLUDE_DIR CACHE) 285 ADD_DEFINITIONS( "-DUSE_EXTLINK_DUMMY" )286 277 ENDIF(USE_EXTLINK_VCL) 287 278 ELSE(WIN32) 288 279 UNSET(EXTLINK_VCL_INCLUDE_DIR CACHE) 289 SET(SOURCES 290 ${SOURCES} 291 include/extLink/dataIO_extLinkDummy.h 292 src/extLink/dataIO_extLinkDummy.cpp 293 ) 294 ADD_DEFINITIONS( "-DUSE_EXTLINK_DUMMY" ) 280 281 295 282 ENDIF(WIN32) 296 283 -
osgVisual/trunk/bin/osgVisualConfig.xml
r160 r183 16 16 <!-- optional: <blendmap filename="blendmap.png"></blendmap> to set blendmap independend from channel map --> 17 17 </module> 18 18 19 <module name="sky_silverlining" enabled="yes"></module> 20 19 21 <module name="vista2d" enabled="yes"> 20 22 <vista2d filename="D:\osgVisual\osgVisual\bin\altimeterSimple.v" paintBackground="no" position_x="1" position_y="1" zoom="1.0" playanimation="yes"></vista2d> 21 23 </module> 24 22 25 <module name="dataio" enabled="yes"> 23 26 <!-- XML configuration of the module "dataIO" 27 The parameter "enabled" is ignored, because dataIO is mandatory for the visual system to place object etc. 28 24 29 Available clusterroles: 25 30 master: This role recieves all relevant information via the extLink implementation and sends it via cluster implementation to the slave nodes. 26 31 slave: This role recieves all relevant rendering information via the cluster implementation. 27 standalone: This role recieves all relevant data via the extLink and renders it. No cluster functionality is used. 32 standalone: This role recieves all relevant data via the extLink and renders it. No cluster functionality is used. 28 33 --> 29 34 <dataio clusterrole="standalone"></dataio> 30 <cluster implementation="enet" master_ip="10.10.10.10" port="1234" use_zlib_compressor="yes" ></cluster>35 <cluster implementation="enet" hardsync="yes" master_ip="10.10.10.10" port="1234" use_zlib_compressor="yes" ></cluster> 31 36 <extlink implementation="vcl" filename="osgVisual.xml"></extlink> 32 37 </module> -
osgVisual/trunk/include/cluster/dataIO_cluster.h
r89 r183 22 22 23 23 #include "dataIO_transportContainer.h" 24 25 // XML Parser 26 #include <stdio.h> 27 #include <libxml/parser.h> 28 #include <libxml/tree.h> 24 29 25 30 … … 48 53 * 49 54 */ 50 dataIO_cluster() {}55 dataIO_cluster():hardSync(false) {} 51 56 52 57 /** … … 61 66 * 62 67 */ 63 virtual void init( osg::ArgumentParser& arguments_, osgViewer::Viewer* viewer_, clustermode clusterMode_, osgVisual::dataIO_transportContainer* sendContainer_, bool compressionEnabled_, bool asAscii_) = 0;68 virtual bool init( xmlNode* configurationNode, osgViewer::Viewer* viewer_, clustermode clusterMode_, osgVisual::dataIO_transportContainer* sendContainer_, bool asAscii_) = 0; 64 69 65 v oid enableHardSync(bool hardSync_){hardSync=hardSync_;};70 virtual bool processXMLConfiguration(xmlNode* clusterConfig_) = 0; 66 71 67 72 bool isHardSyncEnabled(){return hardSync;}; … … 127 132 int port; 128 133 bool hardSync; 134 bool compressionEnabled; // to indicate if OSGs compression alorithm should be used. 129 135 130 136 /** -
osgVisual/trunk/include/cluster/dataIO_clusterDummy.h
r59 r183 38 38 virtual ~dataIO_clusterDummy(void); 39 39 40 void init( osg::ArgumentParser& arguments_, clustermode clusterMode_, osgVisual::dataIO_transportContainer* sendContainer_, bool compressionEnabled_, bool asAscii_ ); 40 bool init(xmlNode* configurationNode, osgViewer::Viewer* viewer_, clustermode clusterMode_, osgVisual::dataIO_transportContainer* sendContainer_, bool asAscii_); 41 bool processXMLConfiguration(xmlNode* clusterConfig_); 41 42 void shutdown(); 42 43 43 44 void init(); 44 bool sendTO_OBJvaluesToSlaves( );45 bool sendTO_OBJvaluesToSlaves(osg::Matrixd viewMatrix_); 45 46 bool readTO_OBJvaluesFromMaster(); 46 47 void reportAsReadyToSwap(); -
osgVisual/trunk/include/cluster/dataIO_clusterENet.h
r89 r183 44 44 virtual ~dataIO_clusterENet(void); 45 45 46 void init( osg::ArgumentParser& arguments_, osgViewer::Viewer* viewer_, clustermode clusterMode_, osgVisual::dataIO_transportContainer* sendContainer_, bool compressionEnabled_, bool asAscii_ ); 46 bool init(xmlNode* configurationNode, osgViewer::Viewer* viewer_, clustermode clusterMode_, osgVisual::dataIO_transportContainer* sendContainer_, bool asAscii_); 47 bool processXMLConfiguration(xmlNode* clusterConfig_); 47 48 void shutdown(); 48 49 -
osgVisual/trunk/include/dataIO/visual_dataIO.h
r160 r183 26 26 27 27 // Cluster 28 #include <dataIO_clusterDummy.h> 28 29 #ifdef USE_CLUSTER_ASIO_TCP_IOSTREAM 29 30 #include <dataIO_clusterAsioTcpIostream.h> … … 32 33 #include <dataIO_clusterENet.h> 33 34 #endif 34 #ifdef USE_CLUSTER_DUMMY 35 #include <dataIO_clusterDummy.h> 36 #endif 35 36 37 37 38 38 39 39 //ExtLink 40 #ifdef USE_EXTLINK_DUMMY 41 #include <dataIO_extLinkDummy.h> 42 #endif 40 #include <dataIO_extLinkDummy.h> 43 41 #ifdef USE_EXTLINK_VCL 44 42 #include <dataIO_extLinkVCL.h> … … 135 133 * @return : True if parsing was successful. 136 134 */ 137 bool processXMLConfiguration( );135 bool processXMLConfiguration(xmlNode* extLinkConfig_); 138 136 139 137 /** -
osgVisual/trunk/src/cluster/dataIO_clusterDummy.cpp
r59 r183 29 29 } 30 30 31 void dataIO_clusterDummy::init( osg::ArgumentParser& arguments_, clustermode clusterMode_, osgVisual::dataIO_transportContainer* sendContainer_, bool compressionEnabled_, bool asAscii_)31 bool dataIO_clusterDummy::init(xmlNode* configurationNode, osgViewer::Viewer* viewer_, clustermode clusterMode_, osgVisual::dataIO_transportContainer* sendContainer_, bool asAscii_) 32 32 { 33 33 sendContainer = sendContainer_; 34 34 OSG_NOTIFY( osg::ALWAYS ) << "clusterDummy init();" << std::endl; 35 return true; 36 } 37 38 bool dataIO_clusterDummy::processXMLConfiguration(xmlNode* clusterConfig_) 39 { 40 OSG_NOTIFY( osg::ALWAYS ) << "clusterDummy processXMLConfiguration();" << std::endl; 41 return true; 35 42 } 36 43 … … 40 47 } 41 48 42 bool dataIO_clusterDummy::sendTO_OBJvaluesToSlaves( )49 bool dataIO_clusterDummy::sendTO_OBJvaluesToSlaves(osg::Matrixd viewMatrix_) 43 50 { 44 51 OSG_NOTIFY( osg::ALWAYS ) << "clusterDummy sendTO_OBJvaluesToSlaves()" << std::endl; -
osgVisual/trunk/src/cluster/dataIO_clusterENet.cpp
r88 r183 35 35 36 36 37 void dataIO_clusterENet::init( osg::ArgumentParser& arguments_, osgViewer::Viewer* viewer_, clustermode clusterMode_, osgVisual::dataIO_transportContainer* sendContainer_, bool compressionEnabled_, bool asAscii_ ) 38 { 37 bool dataIO_clusterENet::init(xmlNode* configurationNode, osgViewer::Viewer* viewer_, clustermode clusterMode_, osgVisual::dataIO_transportContainer* sendContainer_, bool asAscii_) 38 { 39 if (!configurationNode || !processXMLConfiguration(configurationNode)) 40 return false; 41 39 42 OSG_NOTIFY( osg::ALWAYS ) << "clusterENet init();" << std::endl; 40 43 … … 56 59 writeOptionString = "Ascii"; 57 60 } 58 if (compressionEnabled _)61 if (compressionEnabled) 59 62 writeOptionString+=" Compressor=zlib"; 60 63 readOptions = new osgDB::Options( readOptionString.c_str() ); … … 77 80 if(clusterMode == SLAVE) 78 81 { 79 // Get the server IP80 if(!arguments_.read("--server",serverToConnect, port))81 {82 // try server discovery83 //discoverServer(serverToConnect,port);84 /* todo : implement a udp server discovery based on ASIO */85 }86 87 82 // Init ENet 88 83 enet_impl->init(dataIO_clusterENet_implementation::CLIENT, port); … … 105 100 initialized = false; 106 101 std::cout << "Finally failed to establish connection to server " << serverToConnect << std::endl; 107 exit(-1);102 return false; 108 103 } 109 104 } // IF SLAVE END 105 106 return true; 107 } 108 109 bool dataIO_clusterENet::processXMLConfiguration(xmlNode* clusterConfig_) 110 { 111 // Extract cluster role 112 xmlAttr *attr = clusterConfig_->properties; 113 while ( attr ) 114 { 115 std::string attr_name=reinterpret_cast<const char*>(attr->name); 116 std::string attr_value=reinterpret_cast<const char*>(attr->children->content); 117 if( attr_name == "implementation" ) 118 { 119 if(attr_value != "enet") 120 { 121 OSG_NOTIFY( osg::ALWAYS ) << "WARNING: Cluster configuration does not match the 'enet' implementation, falling back to clusterDummy" << std::endl; 122 return false; 123 } 124 } 125 if( attr_name == "hardsync" ) 126 { 127 if(attr_value == "yes") 128 hardSync = true; 129 else 130 hardSync = false; 131 } 132 if( attr_name == "master_ip" ) 133 { 134 serverToConnect = attr_value; 135 } 136 if( attr_name == "port" ) 137 { 138 std::istringstream i(attr_value); 139 if (!(i >> port)) 140 { 141 OSG_NOTIFY( osg::ALWAYS ) << "WARNING: Cluster configuration : Invalid port number '" << attr_value << "', falling back to clusterDummy" << std::endl; 142 return false; 143 } 144 } 145 if( attr_name == "use_zlib_compressor" ) 146 { 147 if(attr_value == "yes") 148 compressionEnabled = true; 149 else 150 compressionEnabled = false; 151 } 152 attr = attr->next; 153 } // WHILE attrib END 154 155 return true; 110 156 } 111 157 -
osgVisual/trunk/src/dataIO/visual_dataIO.cpp
r160 r183 49 49 void visual_dataIO::init(osgViewer::Viewer* viewer_, osg::ArgumentParser& arguments_, std::string configFileName) 50 50 { 51 OSG_NOTIFY( osg::ALWAYS ) << "visual_dataIO initialize.." << std::endl;51 OSG_NOTIFY( osg::ALWAYS ) << "visual_dataIO initialize.."; 52 52 53 53 // Init variables … … 56 56 // Process XML configuration 57 57 this->configFileName = configFileName; 58 if(!processXMLConfiguration()) 58 xmlNode *extLinkConfig=NULL; 59 if(!processXMLConfiguration(extLinkConfig)) 59 60 OSG_FATAL << "ERROR: visual_dataIO::init() - Failed to initialize dataIO via XML configuration!"; 60 61 62 // Create Cluster.63 #ifdef USE_CLUSTER_ASIO_TCP_IOSTREAM64 cluster = new dataIO_clusterAsioTcpIostream();65 #endif66 #ifdef USE_CLUSTER_ENET67 cluster = new dataIO_clusterENet();68 cluster->enableHardSync( false ); /** \todo : rebuild this structure in cluster.h and move it this way to a general implementation. */69 #endif70 #ifdef USE_CLUSTER_DUMMY71 cluster = new dataIO_clusterDummy();72 #endif73 if(cluster.valid())74 //cluster->init(arguments_, clusterMode, slotContainer, true, false);75 cluster->init(arguments_, viewer_, clusterMode, slotContainer, false, false);76 61 77 62 // Create extLink. … … 85 70 86 71 87 88 72 // Install callbacks to perform DataIO activities every frame: 89 73 //// EventCallback at the absolute beginning of the frame … … 97 81 } 98 82 99 bool visual_dataIO::processXMLConfiguration( )83 bool visual_dataIO::processXMLConfiguration(xmlNode* extLinkConfig_) 100 84 { 101 85 // Init XML … … 103 87 bool disabled; 104 88 xmlNode* config = util::getModuleXMLConfig( configFileName, "dataio", tmpDoc, disabled ); 89 xmlNode* clusterConfig = NULL; 105 90 106 91 if( disabled) 107 92 OSG_NOTIFY( osg::ALWAYS ) << "..disabled by XML configuration file. dataIO can't be disabled. Ignoring." << std::endl; 93 else 94 OSG_NOTIFY( osg::ALWAYS ) << std::endl; 108 95 109 96 // extract configuration values … … 152 139 if(cur_node->type == XML_ELEMENT_NODE && node_name == "cluster") 153 140 { 154 // Check Attributes to determine if the dummy implementation or any other implementation must be instantiated155 156 // Pass XML attributes to cluster to analyse and configure it by cluster itself141 // Pass cluster configuration to the used cluster implementation. 142 // The implementation will use the configuration if it matches, otherwise falls back to dummy cluster 143 clusterConfig = cur_node; 157 144 } 158 145 … … 166 153 167 154 } // FOR all nodes END 155 156 157 158 // Create Cluster. 159 #ifdef USE_CLUSTER_ASIO_TCP_IOSTREAM 160 cluster = new dataIO_clusterAsioTcpIostream(); 161 #endif 162 #ifdef USE_CLUSTER_ENET 163 cluster = new dataIO_clusterENet(); 164 #endif 165 if( !cluster.valid() || !clusterConfig || !cluster->init(clusterConfig, viewer, clusterMode, slotContainer, false) ) 166 { 167 cluster = new dataIO_clusterDummy(); 168 cluster->init(clusterConfig, viewer, clusterMode, slotContainer, false); 169 } 170 171 168 172 169 173 // clean up … … 176 180 return false; 177 181 } 178 179 182 return true; 180 183 } -
osgVisual/trunk/src/sky_Silverlining/visual_skySilverLining.cpp
r182 r183 21 21 visual_skySilverLining::visual_skySilverLining(osgViewer::Viewer* viewer_, std::string configFileName, bool& disabled) 22 22 { 23 OSG_NOTIFY( osg::ALWAYS ) << "Initialize visual_skySilverlining..." ;23 OSG_NOTIFY( osg::ALWAYS ) << "Initialize visual_skySilverlining..." << std::endl; 24 24 25 25 atmosphereInitialized = false; … … 41 41 if( disabled) 42 42 OSG_NOTIFY( osg::ALWAYS ) << "..disabled by XML configuration file." << std::endl; 43 else 44 OSG_NOTIFY( osg::ALWAYS ) << std::endl; 43 45 44 if(config) 46 45 xmlFreeDoc(tmpDoc); xmlCleanupParser();
Note: See TracChangeset
for help on using the changeset viewer.