- Timestamp:
- Jan 18, 2011, 8:59:45 PM (14 years ago)
- Location:
- osgVisual/trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
osgVisual/trunk/bin/osgVisualConfig.xml
r198 r200 52 52 <datetime day="0" month="0" year="0" hour="12" minute="30"></datetime> 53 53 <visibility range="50000" turbidity="2.2" ></visibility> 54 55 <!--<cloudlayer slot="0" type="CUMULONIMBUS_CAPPILATUS" enabled="true" fadetime="15">56 <geometry baselength="20000" basewidth="20000" thickness="600" baseHeight="1000" density="0.5"></geometry>57 </cloudlayer>-->58 <cloudlayer slot="1" type="CUMULUS_CONGESTUS" enabled="true" fadetime="15">59 <geometry baselength="50000" basewidth="50000" thickness="1600" baseHeight="1000" density="0.07"></geometry>60 <precipitation rate_mmPerHour_rain="5.0" rate_mmPerHour_drySnow="7.0" rate_mmPerHour_wetSnow="10.0" rate_mmPerHour_sleet="0.0"></precipitation>61 </cloudlayer>62 <cloudlayer slot="2" type="CUMULUS_MEDIOCRIS" enabled="true" fadetime="15">63 <geometry baselength="50000" basewidth="50000" thickness="1600" baseHeight="1000" density="0.07"></geometry>64 </cloudlayer>65 <!--<cloudlayer slot="3" type="CIRRUS_FIBRATUS" enabled="true" fadetime="15">66 <geometry baselength="5000000" basewidth="5000000" thickness="600" baseHeight="7351" density="0.2"></geometry>67 </cloudlayer>-->68 <!--<cloudlayer slot="4" type="CIRROCUMULUS" enabled="true" fadetime="15">69 <geometry baselength="50000" basewidth="50000" thickness="600" baseHeight="7351" density="0.2"></geometry>70 </cloudlayer>-->71 <!--<cloudlayer slot="5" type="STRATOCUMULUS" enabled="true" fadetime="15">72 <geometry baselength="100000" basewidth="100000" thickness="2500" baseHeight="2000" density="0.3"></geometry>73 </cloudlayer>-->74 <!--<cloudlayer slot="6" type="STRATUS" enabled="true" fadetime="15">75 <geometry baselength="50000" basewidth="50000" thickness="1500" baseHeight="1500" density="0.3"></geometry>76 </cloudlayer>-->77 54 <clouds> 55 <!--<cloudlayer slot="0" type="CUMULONIMBUS_CAPPILATUS" enabled="true" fadetime="15"> 56 <geometry baselength="20000" basewidth="20000" thickness="600" baseHeight="1000" density="0.5"></geometry> 57 </cloudlayer>--> 58 <cloudlayer slot="1" type="CUMULUS_CONGESTUS" enabled="true" fadetime="15"> 59 <geometry baselength="50000" basewidth="50000" thickness="1600" baseHeight="1000" density="0.07"></geometry> 60 <precipitation rate_mmPerHour_rain="5.0" rate_mmPerHour_drySnow="7.0" rate_mmPerHour_wetSnow="10.0" rate_mmPerHour_sleet="0.0"></precipitation> 61 </cloudlayer> 62 <cloudlayer slot="2" type="CUMULUS_MEDIOCRIS" enabled="true" fadetime="15"> 63 <geometry baselength="50000" basewidth="50000" thickness="1600" baseHeight="1000" density="0.07"></geometry> 64 </cloudlayer> 65 <!--<cloudlayer slot="3" type="CIRRUS_FIBRATUS" enabled="true" fadetime="15"> 66 <geometry baselength="5000000" basewidth="5000000" thickness="600" baseHeight="7351" density="0.2"></geometry> 67 </cloudlayer>--> 68 <!--<cloudlayer slot="4" type="CIRROCUMULUS" enabled="true" fadetime="15"> 69 <geometry baselength="50000" basewidth="50000" thickness="600" baseHeight="7351" density="0.2"></geometry> 70 </cloudlayer>--> 71 <!--<cloudlayer slot="5" type="STRATOCUMULUS" enabled="true" fadetime="15"> 72 <geometry baselength="100000" basewidth="100000" thickness="2500" baseHeight="2000" density="0.3"></geometry> 73 </cloudlayer>--> 74 <!--<cloudlayer slot="6" type="STRATUS" enabled="true" fadetime="15"> 75 <geometry baselength="50000" basewidth="50000" thickness="1500" baseHeight="1500" density="0.3"></geometry> 76 </cloudlayer>--> 77 </clouds> 78 78 <windlayer bottom="500.0" top="700." speed="25.0" direction="90.0"></windlayer> 79 79 </scenery> -
osgVisual/trunk/src/core/visual_core.cpp
r198 r200 366 366 } 367 367 368 if(cur_node->type == XML_ELEMENT_NODE && node_name == "cloud layer")368 if(cur_node->type == XML_ELEMENT_NODE && node_name == "clouds") 369 369 { 370 370 if(sky.valid()) -
osgVisual/trunk/src/sky_Silverlining/visual_skySilverLining.cpp
r198 r200 746 746 { 747 747 std::string node_name=reinterpret_cast<const char*>(cloudlayerNode_->name); 748 if(cloudlayerNode_->type == XML_ELEMENT_NODE && node_name == "cloudlayer") 749 { 750 int slot = -1; 751 bool enabled; 752 int fadetime = -1, baselength = -1, basewidth = -1, thickness = -1, baseHeight = -1 ; 753 float density = -1.0, rate_mmPerHour_rain = -1.0, rate_mmPerHour_drySnow = -1.0, rate_mmPerHour_wetSnow = -1.0, rate_mmPerHour_sleet = -1.0; 754 CloudTypes ctype = CUMULUS_CONGESTUS; 755 756 xmlAttr *attr = cloudlayerNode_->properties; 757 while ( attr ) 758 { 759 std::string attr_name=reinterpret_cast<const char*>(attr->name); 760 std::string attr_value=reinterpret_cast<const char*>(attr->children->content); 761 if( attr_name == "slot" ) 748 if(cloudlayerNode_->type == XML_ELEMENT_NODE && node_name == "clouds") 749 { 750 for (cloudlayerNode_= cloudlayerNode_->children; cloudlayerNode_; cloudlayerNode_ = cloudlayerNode_->next) 751 { 752 node_name=reinterpret_cast<const char*>(cloudlayerNode_->name); 753 if(cloudlayerNode_->type == XML_ELEMENT_NODE && node_name == "cloudlayer") 762 754 { 763 std::stringstream sstr(attr_value); 764 sstr >> slot; 765 } 766 if( attr_name == "enabled" ) 767 { 768 if(attr_value=="yes") 769 enabled = true; 770 else 771 enabled = false; 772 } 773 if( attr_name == "fadetime" ) 774 { 775 std::stringstream sstr(attr_value); 776 sstr >> fadetime; 777 } 778 if( attr_name == "type" ) 779 { 780 if(attr_value=="CIRROCUMULUS") 781 ctype = CIRROCUMULUS; 782 if(attr_value=="CIRRUS_FIBRATUS") 783 ctype = CIRRUS_FIBRATUS; 784 if(attr_value=="STRATUS") 785 ctype = STRATUS; 786 if(attr_value=="CUMULUS_MEDIOCRIS") 787 ctype = CUMULUS_MEDIOCRIS; 788 if(attr_value=="CUMULUS_CONGESTUS") 789 ctype = CUMULUS_CONGESTUS; 790 if(attr_value=="CUMULONIMBUS_CAPPILATUS") 791 ctype = CUMULONIMBUS_CAPPILATUS; 792 if(attr_value=="STRATOCUMULUS") 793 ctype = STRATOCUMULUS; 794 } 795 attr = attr->next; 796 } 797 798 if(!cloudlayerNode_->children) 799 { 800 OSG_NOTIFY( osg::ALWAYS ) << "ERROR - visual_skySilverLining::configureCloudlayerbyXML: Missing geometry specification for a cloudlayer." << std::endl; 801 return; 802 } 803 804 for (xmlNode *cur_node = cloudlayerNode_->children; cur_node; cur_node = cur_node->next) 805 { 806 node_name=reinterpret_cast<const char*>(cur_node->name); 807 if(cur_node->type == XML_ELEMENT_NODE && node_name == "geometry") 808 { 809 xmlAttr *attr = cur_node->properties; 755 int slot = -1; 756 bool enabled; 757 int fadetime = -1, baselength = -1, basewidth = -1, thickness = -1, baseHeight = -1 ; 758 float density = -1.0, rate_mmPerHour_rain = -1.0, rate_mmPerHour_drySnow = -1.0, rate_mmPerHour_wetSnow = -1.0, rate_mmPerHour_sleet = -1.0; 759 CloudTypes ctype = CUMULUS_CONGESTUS; 760 761 xmlAttr *attr = cloudlayerNode_->properties; 810 762 while ( attr ) 811 763 { 812 764 std::string attr_name=reinterpret_cast<const char*>(attr->name); 813 765 std::string attr_value=reinterpret_cast<const char*>(attr->children->content); 814 if( attr_name == " baselength" )766 if( attr_name == "slot" ) 815 767 { 816 768 std::stringstream sstr(attr_value); 817 sstr >> baselength;769 sstr >> slot; 818 770 } 819 if( attr_name == "basewidth" ) 771 if( attr_name == "enabled" ) 772 { 773 if(attr_value=="yes") 774 enabled = true; 775 else 776 enabled = false; 777 } 778 if( attr_name == "fadetime" ) 820 779 { 821 780 std::stringstream sstr(attr_value); 822 sstr >> basewidth;781 sstr >> fadetime; 823 782 } 824 if( attr_name == "t hickness" )783 if( attr_name == "type" ) 825 784 { 826 std::stringstream sstr(attr_value); 827 sstr >> thickness; 828 } 829 if( attr_name == "baseHeight" ) 830 { 831 std::stringstream sstr(attr_value); 832 sstr >> baseHeight; 833 } 834 if( attr_name == "density" ) 835 { 836 std::stringstream sstr(attr_value); 837 sstr >> density; 785 if(attr_value=="CIRROCUMULUS") 786 ctype = CIRROCUMULUS; 787 if(attr_value=="CIRRUS_FIBRATUS") 788 ctype = CIRRUS_FIBRATUS; 789 if(attr_value=="STRATUS") 790 ctype = STRATUS; 791 if(attr_value=="CUMULUS_MEDIOCRIS") 792 ctype = CUMULUS_MEDIOCRIS; 793 if(attr_value=="CUMULUS_CONGESTUS") 794 ctype = CUMULUS_CONGESTUS; 795 if(attr_value=="CUMULONIMBUS_CAPPILATUS") 796 ctype = CUMULONIMBUS_CAPPILATUS; 797 if(attr_value=="STRATOCUMULUS") 798 ctype = STRATOCUMULUS; 838 799 } 839 800 attr = attr->next; 840 801 } 802 803 if(!cloudlayerNode_->children) 804 { 805 OSG_NOTIFY( osg::ALWAYS ) << "ERROR - visual_skySilverLining::configureCloudlayerbyXML: Missing geometry specification for a cloudlayer." << std::endl; 806 return; 807 } 808 809 for (xmlNode *cur_node = cloudlayerNode_->children; cur_node; cur_node = cur_node->next) 810 { 811 node_name=reinterpret_cast<const char*>(cur_node->name); 812 if(cur_node->type == XML_ELEMENT_NODE && node_name == "geometry") 813 { 814 xmlAttr *attr = cur_node->properties; 815 while ( attr ) 816 { 817 std::string attr_name=reinterpret_cast<const char*>(attr->name); 818 std::string attr_value=reinterpret_cast<const char*>(attr->children->content); 819 if( attr_name == "baselength" ) 820 { 821 std::stringstream sstr(attr_value); 822 sstr >> baselength; 823 } 824 if( attr_name == "basewidth" ) 825 { 826 std::stringstream sstr(attr_value); 827 sstr >> basewidth; 828 } 829 if( attr_name == "thickness" ) 830 { 831 std::stringstream sstr(attr_value); 832 sstr >> thickness; 833 } 834 if( attr_name == "baseHeight" ) 835 { 836 std::stringstream sstr(attr_value); 837 sstr >> baseHeight; 838 } 839 if( attr_name == "density" ) 840 { 841 std::stringstream sstr(attr_value); 842 sstr >> density; 843 } 844 attr = attr->next; 845 } 846 } 847 848 if(cur_node->type == XML_ELEMENT_NODE && node_name == "precipitation") 849 { 850 xmlAttr *attr = cur_node->properties; 851 while ( attr ) 852 { 853 std::string attr_name=reinterpret_cast<const char*>(attr->name); 854 std::string attr_value=reinterpret_cast<const char*>(attr->children->content); 855 if( attr_name == "rate_mmPerHour_rain" ) 856 { 857 std::stringstream sstr(attr_value); 858 sstr >> rate_mmPerHour_rain; 859 } 860 if( attr_name == "rate_mmPerHour_drySnow" ) 861 { 862 std::stringstream sstr(attr_value); 863 sstr >> rate_mmPerHour_drySnow; 864 } 865 if( attr_name == "rate_mmPerHour_wetSnow" ) 866 { 867 std::stringstream sstr(attr_value); 868 sstr >> rate_mmPerHour_wetSnow; 869 } 870 if( attr_name == "rate_mmPerHour_sleet" ) 871 { 872 std::stringstream sstr(attr_value); 873 sstr >> rate_mmPerHour_sleet; 874 } 875 attr = attr->next; 876 } 877 } 878 } 879 880 if(slot!=-1 && baselength!=-1 && basewidth!=-1 && thickness!=-1 && baseHeight!=-1 && density!=-1 ) 881 addCloudLayer( slot, baselength, basewidth, thickness, baseHeight, density, ctype ); 882 883 if(slot!=-1 && rate_mmPerHour_rain!=-1 && rate_mmPerHour_drySnow!=-1 && thickness!=-1 && baseHeight!=-1 && density!=-1 ) 884 setSlotPrecipitation( slot, rate_mmPerHour_rain, rate_mmPerHour_drySnow, rate_mmPerHour_wetSnow, rate_mmPerHour_sleet ); 841 885 } 842 843 if(cur_node->type == XML_ELEMENT_NODE && node_name == "precipitation") 844 { 845 xmlAttr *attr = cur_node->properties; 846 while ( attr ) 847 { 848 std::string attr_name=reinterpret_cast<const char*>(attr->name); 849 std::string attr_value=reinterpret_cast<const char*>(attr->children->content); 850 if( attr_name == "rate_mmPerHour_rain" ) 851 { 852 std::stringstream sstr(attr_value); 853 sstr >> rate_mmPerHour_rain; 854 } 855 if( attr_name == "rate_mmPerHour_drySnow" ) 856 { 857 std::stringstream sstr(attr_value); 858 sstr >> rate_mmPerHour_drySnow; 859 } 860 if( attr_name == "rate_mmPerHour_wetSnow" ) 861 { 862 std::stringstream sstr(attr_value); 863 sstr >> rate_mmPerHour_wetSnow; 864 } 865 if( attr_name == "rate_mmPerHour_sleet" ) 866 { 867 std::stringstream sstr(attr_value); 868 sstr >> rate_mmPerHour_sleet; 869 } 870 attr = attr->next; 871 } 872 } 873 } 874 875 if(slot!=-1 && baselength!=-1 && basewidth!=-1 && thickness!=-1 && baseHeight!=-1 && density!=-1 ) 876 addCloudLayer( slot, baselength, basewidth, thickness, baseHeight, density, ctype ); 877 878 if(slot!=-1 && rate_mmPerHour_rain!=-1 && rate_mmPerHour_drySnow!=-1 && thickness!=-1 && baseHeight!=-1 && density!=-1 ) 879 setSlotPrecipitation( slot, rate_mmPerHour_rain, rate_mmPerHour_drySnow, rate_mmPerHour_wetSnow, rate_mmPerHour_sleet ); 880 } 881 else 882 OSG_NOTIFY( osg::ALWAYS ) << "ERROR - visual_skySilverLining::configureCloudlayerbyXML: Node is not a cloudlayer node." << std::endl; 883 } 886 else 887 OSG_NOTIFY( osg::ALWAYS ) << "ERROR - visual_skySilverLining::configureCloudlayerbyXML: Node is not a cloudlayer node." << std::endl; 888 } // FOR-loop end 889 } // If Clouds END 890 }
Note: See TracChangeset
for help on using the changeset viewer.