Changeset 118


Ignore:
Timestamp:
Jul 5, 2005, 9:27:04 PM (19 years ago)
Author:
darran
Message:
  • now using position/orientation only for view matrix save
  • can remove setTime ...
Location:
Swollen
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • Swollen/swollen/state.cpp

    r116 r118  
    3030    s << _timestep << " ";
    3131
    32     for( unsigned int i = 0; i < 16; i++ )
    33        s << *(_matrix.ptr()+i) << " ";
     32    s << _position.x() << " " << _position.y() << " " << _position.z() << " ";
     33    s << _orientation.x() << " " << _orientation.y() << " " << _orientation.z() << " " << _orientation.w() << " ";
    3434
    3535    s << _culling << " ";
     
    4444   s >> _timestep;
    4545
    46    for( unsigned int i = 0; i < 16; i++ )
    47       s >> *(_matrix.ptr()+i);
     46   s >> _position.x() >> _position.y() >> _position.z();
     47   s >> _orientation.x() >> _orientation.y() >> _orientation.z() >> _orientation.w();
    4848
    4949   s >> _culling;
    5050   s >> _wireframe;
     51}
     52
     53
     54void State::setMatrix(osg::Matrix m)
     55{
     56   m.get(_orientation);
     57   _position = m.getTrans();
     58
     59}
     60
     61osg::Matrix State::getMatrix()
     62{
     63   osg::Matrix m;
     64   m.set(_orientation);
     65   m.setTrans(_position);
     66   return m;
    5167}
    5268
  • Swollen/swollen/state.h

    r116 r118  
    5757    virtual void setCulling(bool value){ _culling = value; }
    5858    virtual void setWireframe(bool value){ _wireframe = value; }
    59     virtual void setMatrix(osg::Matrix value){ _matrix = value; }
     59    virtual void setMatrix(osg::Matrix value);
    6060
    6161    virtual double getTime(){ return _time; }
     
    6363    //virtual osg::Vec3 getPosition(){ return _position; }
    6464    //virtual osg::Quat getOrientation(){ return _orientation; }
    65     virtual osg::Matrix getMatrix(){ return _matrix; }
     65    virtual osg::Matrix getMatrix();
    6666    virtual bool getCulling(){ return _culling; }
    6767    virtual bool getWireframe(){ return _wireframe; }
     
    7777    double _time;
    7878    unsigned int _timestep;
    79     //osg::Vec3d _position;
    80     //osg::Quat _orientation;
    81     osg::Matrix _matrix;
     79    osg::Vec3d _position;
     80    osg::Quat _orientation;
     81    //osg::Matrix _matrix;
    8282    bool _culling;
    8383    bool _wireframe;
     
    9696   virtual bool write(std::string filename);
    9797   //virtual void read(std::string filename);
    98 
    9998   //virtual ~StateList();
    10099
Note: See TracChangeset for help on using the changeset viewer.