Changeset 197


Ignore:
Timestamp:
Jan 12, 2011, 10:20:19 PM (13 years ago)
Author:
Torben Dannhauer
Message:

working commit for backup purposes, not compiling at this stage.. sorry, will be corrected tomorrow

Location:
osgVisual/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • osgVisual/trunk/bin/osgVisualConfig.xml

    r196 r197  
    3838 
    3939  <scenery>
    40     <terrain filename="D:/OpenSceneGraph/VPB-Testdatensatz/DB_Small/database.ive"></terrain>
     40    <terrain filename="D:/OpenSceneGraph/VPB-Testdatensatz/DB_Small/database.ive" filename2="J:\BRD1m_MUC0.25m_srtmEU_BM\terrain.ive"></terrain>
    4141    <animationpath filename="salzburg.path"></animationpath>
    4242    <models>
     
    5050      </model>
    5151    </models>
    52     <datetime day="0" month="0" year="0" hour="15" minute="30"></datetime>
     52    <datetime day="0" month="0" year="0" hour="12" minute="30"></datetime>
    5353    <visibility range="50000" turbidity="2.2" ></visibility>
    5454    <cloudlayer slot="1" type="cumulusCongestus" enabled="true" fadetime="15">
  • osgVisual/trunk/include/sky_Silverlining/visual_skySilverLining.h

    r182 r197  
    3434
    3535#include <visual_util.h>
     36
     37// XML Parser
     38#include <stdio.h>
     39#include <libxml/parser.h>
     40#include <libxml/tree.h>
     41
     42#include <string.h>
     43#include <iostream>
    3644
    3745namespace osgVisual
     
    252260         *
    253261         * \li CloudTypes::CIRROCUMULUS - High planar cloud puffs.
    254          * \li CloudTypes::CIRRUS_FIBRATUS - High, wispy cirrus clouds.
    255      * \li CloudTypes::NIMBOSTRATUS - Low stratus decks.
    256      * \li CloudTypes::CUMULONIMBUS_CAPPILATUS - A large thunderhead with lightning and rain.
    257      * \li CloudTypes::CUMULUS_MEDIOCRIS - Small, puffy clouds.
    258      * \li CloudTypes::CUMULUS_CONGESTUS - Larger cumulus clouds with flattened bottoms.
    259      * \li CloudTypes::CUMULUS_MEDIOCRIS_INFINITE - A cumulus mediocris layer where the clouds wrap around
    260      *  the camera location at all times, to create the illusion of an infinitely large cloud layer.
    261      * \li CloudTypes::CUMULUS_CONGESTUS_INFINITE - A cumulus congestus layer where the clouds wrap around
     262         * \li CloudTypes::CIRRUS_FIBRATUS - High, thicker and fibrous clouds that signal changing weather.
     263     * \li CloudTypes::STRATUS - Low clouds represented as a slab.
     264     * \li CloudTypes::CUMULUS_MEDIOCRIS - Low, puffy clouds on fair days.
     265     * \li CloudTypes::CUMULUS_CONGESTUS - Large cumulus clouds that could turn into a thunderhead.
     266         * \li CloudTypes::CUMULONIMBUS_CAPPILATUS - A large thunderhead with lightning and rain.
     267     * \li CloudTypes::STRATOCUMULUS - Low, dense, puffy clouds with some sun breaks between them.
    262268     *  the camera location at all times, to create the illusion of an infinitely large cloud layer.
    263269         *
     
    466472
    467473
    468 
    469 
     474/** @name XML configuration
     475 *  The following functions provide the XML functionality to configure sky via XML
     476 */
     477//@{
     478        void configureCloudlayerbyXML( xmlNode* cloudlayerNode_ );
     479//@}
    470480
    471481private:
  • osgVisual/trunk/src/sky_Silverlining/visual_skySilverLining.cpp

    r183 r197  
    742742        }
    743743}
     744
     745void visual_skySilverLining::configureCloudlayerbyXML( xmlNode* cloudlayerNode_ )
     746{
     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
     757
     758                xmlAttr  *attr = cloudlayerNode_->properties;
     759                while ( attr )
     760                {
     761                        std::string attr_name=reinterpret_cast<const char*>(attr->name);
     762                        std::string attr_value=reinterpret_cast<const char*>(attr->children->content);
     763                        if( attr_name == "slot" )
     764                        {
     765                                std::stringstream sstr(attr_value);
     766                                sstr >> slot;
     767                        }
     768                        if( attr_name == "enabled" )
     769                        {
     770                                if(attr_value=="yes")
     771                                        enabled = true;
     772                                else
     773                                        enabled = false;
     774                        }
     775                        if( attr_name == "fadetime" )
     776                        {
     777                                std::stringstream sstr(attr_value);
     778                                sstr >> fadetime;
     779                        }
     780                        if( attr_name == "type" )
     781                        {
     782                                if(attr_value=="CIRROCUMULUS")
     783                                        ctype = CIRROCUMULUS;
     784                                if(attr_value=="CIRRUS_FIBRATUS")
     785                                        ctype = CIRRUS_FIBRATUS;
     786                                if(attr_value=="STRATUS")
     787                                        ctype = STRATUS;
     788                                if(attr_value=="CUMULUS_MEDIOCRIS")
     789                                        ctype = CUMULUS_MEDIOCRIS;
     790                                if(attr_value=="CUMULUS_CONGESTUS")
     791                                        ctype = CUMULUS_CONGESTUS;
     792                                if(attr_value=="CUMULONIMBUS_CAPPILATUS")
     793                                        ctype = CUMULONIMBUS_CAPPILATUS;
     794                                if(attr_value=="STRATOCUMULUS")
     795                                        ctype = STRATOCUMULUS;
     796                        }
     797                        attr = attr->next;
     798                }
     799
     800                cloudlayerNode_ = cloudlayerNode_->children;
     801                if(!cloudlayerNode_)
     802                {
     803                        OSG_NOTIFY( osg::ALWAYS ) << "ERROR - visual_skySilverLining::configureCloudlayerbyXML: Missing geometry specification for a cloudlayer." << std::endl;
     804                        return;
     805                }
     806
     807                for (xmlNode *cur_node = cloudlayerNode_; cur_node; cur_node = cur_node->next)
     808                {
     809                        if(cur_node->type == XML_ELEMENT_NODE && node_name == "geometry")
     810                        {
     811                                xmlAttr  *attr = cloudlayerNode_->properties;
     812                                while ( attr )
     813                                {
     814                                        std::string attr_name=reinterpret_cast<const char*>(attr->name);
     815                                        std::string attr_value=reinterpret_cast<const char*>(attr->children->content);
     816                                        if( attr_name == "baselength" )
     817                                        {
     818                                                std::stringstream sstr(attr_value);
     819                                                sstr >> baselength;
     820                                        }
     821                                        if( attr_name == "basewidth" )
     822                                        {
     823                                                std::stringstream sstr(attr_value);
     824                                                sstr >> basewidth;
     825                                        }
     826                                        if( attr_name == "thickness" )
     827                                        {
     828                                                std::stringstream sstr(attr_value);
     829                                                sstr >> thickness;
     830                                        }
     831                                        if( attr_name == "baseHeight" )
     832                                        {
     833                                                std::stringstream sstr(attr_value);
     834                                                sstr >> baseHeight;
     835                                        }
     836                                        if( attr_name == "density" )
     837                                        {
     838                                                std::stringstream sstr(attr_value);
     839                                                sstr >> density;
     840                                        }
     841                                        attr = attr->next;
     842                                }
     843                        }
     844
     845                        if(cur_node->type == XML_ELEMENT_NODE && node_name == "precipitation")
     846                        {
     847                                xmlAttr  *attr = cloudlayerNode_->properties;
     848                                while ( attr )
     849                                {
     850                                        std::string attr_name=reinterpret_cast<const char*>(attr->name);
     851                                        std::string attr_value=reinterpret_cast<const char*>(attr->children->content);
     852                                        if( attr_name == "rate_mmPerHour_rain" )
     853                                        {
     854                                                std::stringstream sstr(attr_value);
     855                                                sstr >> rate_mmPerHour_rain;
     856                                        }
     857                                        if( attr_name == "rate_mmPerHour_drySnow" )
     858                                        {
     859                                                std::stringstream sstr(attr_value);
     860                                                sstr >> rate_mmPerHour_drySnow;
     861                                        }
     862                                        if( attr_name == "rate_mmPerHour_wetSnow" )
     863                                        {
     864                                                std::stringstream sstr(attr_value);
     865                                                sstr >> rate_mmPerHour_wetSnow;
     866                                        }
     867                                        if( attr_name == "rate_mmPerHour_sleet" )
     868                                        {
     869                                                std::stringstream sstr(attr_value);
     870                                                sstr >> rate_mmPerHour_sleet;
     871                                        }
     872                                        attr = attr->next;
     873                                }
     874                        }
     875                }
     876
     877                if(slot!=-1 && baselength!=-1 && basewidth!=-1 && thickness!=-1 && baseHeight!=-1 && density!=-1 )
     878                        addCloudLayer( slot, baselength, basewidth, thickness, baseHeight, density, ctype );
     879
     880                if(slot!=-1 && rate_mmPerHour_rain!=-1 && rate_mmPerHour_drySnow!=-1 && thickness!=-1 && baseHeight!=-1 && density!=-1 )
     881                        setSlotPrecipitation( slot, rate_mmPerHour_rain, rate_mmPerHour_drySnow, rate_mmPerHour_wetSnow, rate_mmPerHour_sleet );
     882        }
     883        else
     884                OSG_NOTIFY( osg::ALWAYS ) << "ERROR - visual_skySilverLining::configureCloudlayerbyXML: Node is not a cloudlayer node." << std::endl;
     885}
Note: See TracChangeset for help on using the changeset viewer.