Changeset 111 for Swollen/include


Ignore:
Timestamp:
Jun 21, 2005, 2:21:44 PM (19 years ago)
Author:
darran
Message:
  • refactoring to facilitate storing state
  • segfaulting at the moment ...
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Swollen/include/swwreader.h

    r107 r111  
    7171    virtual osg::ref_ptr<osg::Vec2Array> getBedslopeTextureCoords();
    7272
    73     virtual bool hasBedslopeTexture() {return (_bedslopetexture != NULL);}
     73    virtual bool hasBedslopeTexture() {return (_state.bedslopetexturefilename != NULL);}
    7474    virtual void setBedslopeTexture( std::string filename );
    7575    virtual osg::Image* getBedslopeTexture();
     
    8787    virtual unsigned int getNumberOfTimesteps() {return _ntimesteps;}
    8888
    89     virtual float getAlphaMin() {return _alphamin;}
    90     virtual float getAlphaMax() {return _alphamax;}
    91     virtual float getHeightMin() {return _heightmin;}
    92     virtual float getHeightMax() {return _heightmax;}
    93     virtual float getCullAngle() {return _cullangle;}
     89    virtual float getAlphaMin() {return _state.alphamin;}
     90    virtual float getAlphaMax() {return _state.alphamax;}
     91    virtual float getHeightMin() {return _state.heightmin;}
     92    virtual float getHeightMax() {return _state.heightmax;}
     93    virtual float getCullAngle() {return _state.cullangle;}
    9494
    95     virtual void setAlphaMin( float value ) {_alphamin = value;}
    96     virtual void setAlphaMax( float value ) {_alphamax = value;}
    97     virtual void setHeightMin( float value ) {_heightmin = value;}
    98     virtual void setHeightMax( float value ) {_heightmax = value;}
     95    virtual void setAlphaMin( float value ) {_state.alphamin = value;}
     96    virtual void setAlphaMax( float value ) {_state.alphamax = value;}
     97    virtual void setHeightMin( float value ) {_state.heightmin = value;}
     98    virtual void setHeightMax( float value ) {_state.heightmax = value;}
    9999
    100     virtual void setCullAngle( float value ) {_cullangle = value;}
    101     virtual void toggleCulling() {_culling = _culling ? false : true;}
     100    virtual void setCullAngle( float value ) {_state.cullangle = value;}
     101    virtual void toggleCulling() {_state.culling = _state.culling ? false : true;}
     102    virtual bool getCulling() {return _state.culling;}
     103    virtual void setCulling(bool value) {_state.culling = value;}
    102104   
    103105    virtual triangle_list getConnectivity(unsigned int index) {return _connectivity.at(index);}
    104106
    105     const std::string getSwollenDir() {return *_swollendir;}
    106     virtual void setSwollenDir(const std::string path) {_swollendir = new std::string(path);}
     107    const std::string getSwollenDir() {return *(_state.swollendirectory);}
     108    virtual void setSwollenDir(const std::string path) {_state.swollendirectory = new std::string(path);}
    107109
    108110
     
    111113    virtual ~SWWReader();
    112114
    113     std::string* _filename;
    114     std::string* _swollendir;
    115    
     115
     116    // state contains all the info needed to serialize
     117    struct
     118    {
     119          float alphamax;  // define alpha (transparency) function
     120          float alphamin;
     121          float heightmax;
     122          float heightmin;
     123
     124          float cullangle;  // cull triangles with steepness angle above this value
     125          bool culling;   // culling is on or off
     126
     127          std::string* swwfilename;
     128          std::string* bedslopetexturefilename;
     129          std::string* swollendirectory;
     130
     131    } _state;
     132
     133
    116134    // constructor determines SWW validity (netcdf + proper structure)
    117135    bool _valid;
     
    147165    osg::ref_ptr<osg::Vec4Array> _stagecolors;
    148166
    149     // optional bedslope texture map
    150     std::string* _bedslopetexture;
    151 
    152167    // optional geodata for bedslope texture map
    153168    struct
     
    179194    std::vector<triangle_list> _connectivity;
    180195
    181     // define alpha (transparency) function
    182     float _alphamax, _alphamin, _heightmax, _heightmin;
    183 
    184     // cull triangles with steepness angle above this value
    185     float _cullangle;
    186     bool _culling;
    187 
    188196};
    189197
Note: See TracChangeset for help on using the changeset viewer.