Changeset 119


Ignore:
Timestamp:
Jul 7, 2005, 11:00:08 PM (19 years ago)
Author:
darran
Message:
  • working towards swm playback ability
  • removed unneeded time from state ...
Location:
Swollen/swollen
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • Swollen/swollen/main.cpp

    r116 r119  
    3232int main( int argc, char **argv )
    3333{
     34
     35   // check if last argument is an swm macro recording, in which case the configuration parameters
     36   // are in the swm header
     37   std::string swmfile = std::string(argv[argc-1]);
     38   if( swmfile.substr(swmfile.size()-4,4).find(".swm",0) == -1 )  // filename ends in .swm?
     39   {
     40      std::cout << "swm file ... need to read" << std::endl;
     41   }
    3442
    3543   // use an ArgumentParser object to manage the program arguments
     
    5361   arguments.getApplicationUsage()->addCommandLineOption("-version","Revision number and creation (not compile) date");
    5462
     63
    5564   // construct the viewer.
    5665   CustomViewer viewer(arguments);
     
    8190
    8291
    83    // load sww file specified as final argument on command line (static bedslope
    84    // geometry only, per timestep height field geometry is done in loop below)
     92   // last argument is either an sww file or an swm macro recording
    8593   int lastarg = arguments.argc()-1;
    8694   std::string swwfile = arguments.argv()[lastarg];
     
    265273            event_handler->setPaused( true );
    266274            playback_index = 0;
    267             // store current state
    268275         }
    269276
     
    272279            State state = State();
    273280            state.setTimestep( event_handler->getTimestep() );
    274             state.setTime( sww->getTime(timestep) );
    275281            state.setCulling( sww->getCulling() );
    276282            state.setWireframe( water->getWireframe() );
     
    288294         water->setWireframe( state.getWireframe() );
    289295         water->setCulling( state.getCulling() );
    290          hud->setTime( state.getTime() );
     296         hud->setTime( sww->getTime(state.getTimestep()) );
    291297
    292298         // loop playback
     
    301307            hud->setMode("");
    302308            event_handler->setPaused( true );
    303             // pop saved state
    304309         }
    305310
     
    309314      // '3' key causes compiled animation to be saved to disk
    310315      if( event_handler->toggleSave() )
     316      {
    311317         statelist.write( std::string("movie.swm") );
    312 
     318         std::cout << argc << std::endl;
     319         for( int i=0; i < argc; i++ )
     320            std::cout << argv[i] << std::endl;
     321      }
    313322
    314323      // scene-graph updates
  • Swollen/swollen/state.cpp

    r118 r119  
    2727void State::write(std::ostream& s)
    2828{
    29     s << _time << " ";
    3029    s << _timestep << " ";
    31 
    3230    s << _position.x() << " " << _position.y() << " " << _position.z() << " ";
    3331    s << _orientation.x() << " " << _orientation.y() << " " << _orientation.z() << " " << _orientation.w() << " ";
    34 
    3532    s << _culling << " ";
    3633    s << _wireframe << std::endl;
     
    4138void State::read(std::istream s)
    4239{
    43    s >> _time;
    4440   s >> _timestep;
    45 
    4641   s >> _position.x() >> _position.y() >> _position.z();
    4742   s >> _orientation.x() >> _orientation.y() >> _orientation.z() >> _orientation.w();
    48 
    4943   s >> _culling;
    5044   s >> _wireframe;
  • Swollen/swollen/state.h

    r118 r119  
    5151
    5252    State();
    53     virtual void setTime(double value){ _time = value; }
    5453    virtual void setTimestep(unsigned int value){ _timestep = value; }
    55     //virtual void setPosition(osg::Vec3 value){ _position = value; }
    56     //virtual void setOrientation(osg::Quat value){ _orientation = value; }
    5754    virtual void setCulling(bool value){ _culling = value; }
    5855    virtual void setWireframe(bool value){ _wireframe = value; }
    5956    virtual void setMatrix(osg::Matrix value);
    6057
    61     virtual double getTime(){ return _time; }
    6258    virtual unsigned int getTimestep(){ return _timestep; }
    63     //virtual osg::Vec3 getPosition(){ return _position; }
    64     //virtual osg::Quat getOrientation(){ return _orientation; }
    6559    virtual osg::Matrix getMatrix();
    6660    virtual bool getCulling(){ return _culling; }
     
    7569protected:
    7670
    77     double _time;
    7871    unsigned int _timestep;
    7972    osg::Vec3d _position;
Note: See TracChangeset for help on using the changeset viewer.