Changeset 119
- Timestamp:
- Jul 7, 2005, 11:00:08 PM (20 years ago)
- Location:
- Swollen/swollen
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
Swollen/swollen/main.cpp
r116 r119 32 32 int main( int argc, char **argv ) 33 33 { 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 } 34 42 35 43 // use an ArgumentParser object to manage the program arguments … … 53 61 arguments.getApplicationUsage()->addCommandLineOption("-version","Revision number and creation (not compile) date"); 54 62 63 55 64 // construct the viewer. 56 65 CustomViewer viewer(arguments); … … 81 90 82 91 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 85 93 int lastarg = arguments.argc()-1; 86 94 std::string swwfile = arguments.argv()[lastarg]; … … 265 273 event_handler->setPaused( true ); 266 274 playback_index = 0; 267 // store current state268 275 } 269 276 … … 272 279 State state = State(); 273 280 state.setTimestep( event_handler->getTimestep() ); 274 state.setTime( sww->getTime(timestep) );275 281 state.setCulling( sww->getCulling() ); 276 282 state.setWireframe( water->getWireframe() ); … … 288 294 water->setWireframe( state.getWireframe() ); 289 295 water->setCulling( state.getCulling() ); 290 hud->setTime( s tate.getTime() );296 hud->setTime( sww->getTime(state.getTimestep()) ); 291 297 292 298 // loop playback … … 301 307 hud->setMode(""); 302 308 event_handler->setPaused( true ); 303 // pop saved state304 309 } 305 310 … … 309 314 // '3' key causes compiled animation to be saved to disk 310 315 if( event_handler->toggleSave() ) 316 { 311 317 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 } 313 322 314 323 // scene-graph updates -
Swollen/swollen/state.cpp
r118 r119 27 27 void State::write(std::ostream& s) 28 28 { 29 s << _time << " ";30 29 s << _timestep << " "; 31 32 30 s << _position.x() << " " << _position.y() << " " << _position.z() << " "; 33 31 s << _orientation.x() << " " << _orientation.y() << " " << _orientation.z() << " " << _orientation.w() << " "; 34 35 32 s << _culling << " "; 36 33 s << _wireframe << std::endl; … … 41 38 void State::read(std::istream s) 42 39 { 43 s >> _time;44 40 s >> _timestep; 45 46 41 s >> _position.x() >> _position.y() >> _position.z(); 47 42 s >> _orientation.x() >> _orientation.y() >> _orientation.z() >> _orientation.w(); 48 49 43 s >> _culling; 50 44 s >> _wireframe; -
Swollen/swollen/state.h
r118 r119 51 51 52 52 State(); 53 virtual void setTime(double value){ _time = value; }54 53 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; }57 54 virtual void setCulling(bool value){ _culling = value; } 58 55 virtual void setWireframe(bool value){ _wireframe = value; } 59 56 virtual void setMatrix(osg::Matrix value); 60 57 61 virtual double getTime(){ return _time; }62 58 virtual unsigned int getTimestep(){ return _timestep; } 63 //virtual osg::Vec3 getPosition(){ return _position; }64 //virtual osg::Quat getOrientation(){ return _orientation; }65 59 virtual osg::Matrix getMatrix(); 66 60 virtual bool getCulling(){ return _culling; } … … 75 69 protected: 76 70 77 double _time;78 71 unsigned int _timestep; 79 72 osg::Vec3d _position;
Note: See TracChangeset
for help on using the changeset viewer.