Changeset 183 for osgVisual/trunk/src
- Timestamp:
- Jan 7, 2011, 5:41:45 PM (14 years ago)
- Location:
- osgVisual/trunk/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
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.