Changeset 68


Ignore:
Timestamp:
Dec 16, 2004, 5:56:02 PM (20 years ago)
Author:
darran
Message:

work in progress ...

Location:
Swollen
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • Swollen/doc/contract2_hours.txt

    r65 r68  
    33------------------
    44
     5
     616 Decomber, Thursday (10am-6pm)
     7- terrain manipulator added
     8- -version flag
     9- toggling between terrain manipulator and trackball for lighting
     10- experiments with cairns ubd map
    511
    61215 December, Wednesday (4 hours)
  • Swollen/doc/contract2_priorities.txt

    r65 r68  
    3333- Optional height-dependent semi-transparent water surface [0]
    3434- added -nosky command-line option to appease those who want a plain background [?]
     35- add -version command line flag synced with Subversion revision number (useful for debugging) [?]
    3536
    3637
     
    4344- Output coordinates defining camera position [?]
    4445- Ability to handle scenes with a resolution of 500,000+ triangles [3]
     46- Interactive positioning of light(s) [0]
     47- Ability to have shading on bed-surface. This was the case with
     48  distro31052004 and is very useful with large scale topographies.
     49  Please have a look at the file Hobart_first_order_size77670.sww using
     50  both swwviewer and swollen and let Ole know what you think.
     51  Perhaps default to that standard background in the absence of bedslope.jpg
     52  or perhaps tie in with the geotiff item by having such a default behaviour.
     53
    4554
    4655
     
    7483- Scene augmentation with OSG models [2]       
    7584- Optional contour lines of water surface [1]
    76 - Ability to have shading on bed-surface. This was the case with
    77   distro31052004 and is very useful with large scale topographies.
    78   Please have a look at the file Hobart_first_order_size77670.sww using
    79   both swwviewer and swollen and let Ole know what you think.
    80   Perhaps default to that standard background in the absence of bedslope.jpg
    81   or perhaps tie in with the geotiff item by having such a default behaviour.
    8285
    8386       
     
    9396- Ability to show earthquakes [0]
    9497- Concept of 'buildings' and shaking them [0]
    95 - Interactive positioning of light(s) [0]
    9698- user feedback should differentiate between "sww file not found" and
    9799  "sww file couldn't read" [1]
    98 - add -version command line flag synced with Subversion revision number (useful for debugging) [?]
    99100- prune -help documentation removing irrelevant options [?]
    100101
  • Swollen/swollen/keyboardeventhandler.cpp

    r48 r68  
    55KeyboardEventHandler::KeyboardEventHandler( int nTimesteps, float tps)
    66{
    7   _paused = DEF_PAUSED_START;
    8   _direction = 1;
    9   _ntimesteps = nTimesteps;
    10   _tps = tps;
    11   _tpsorig = tps;
    12   _timestepchanged = false;
    13   _timestep = 0;
    14   _prevtime = 0;
    15   _togglewireframe = false;
     7    _paused = DEF_PAUSED_START;
     8    _direction = 1;
     9    _ntimesteps = nTimesteps;
     10    _tps = tps;
     11    _tpsorig = tps;
     12    _timestepchanged = false;
     13    _timestep = 0;
     14    _prevtime = 0;
     15    _togglewireframe = false;
    1616}
    1717
     
    2323    if( ea.getEventType() == osgGA::GUIEventAdapter::KEYDOWN )
    2424    {
    25                 switch( ea.getKey() )
     25        switch( ea.getKey() )
     26            {
     27            case osgGA::GUIEventAdapter::KEY_Space:
     28                _paused = _paused ? false : true;
     29                handled = true;
     30                break;
     31
     32            case osgGA::GUIEventAdapter::KEY_Up:
     33                if( !_paused ) _tps *= 1.5;
     34                handled = true;
     35                break;
     36
     37            case osgGA::GUIEventAdapter::KEY_Down:
     38                if( !_paused ) _tps /= 1.5;
     39                handled = true;
     40                break;
     41
     42            case 'r':
     43                _paused = DEF_PAUSED_START;
     44                _tps = _tpsorig;
     45                _timestep = 0;
     46                _timestepchanged = true;
     47                handled = true;
     48                break;
     49
     50            case osgGA::GUIEventAdapter::KEY_Right:
     51                if( _paused )
    2652                {
    27                         case osgGA::GUIEventAdapter::KEY_Space:
    28                                 _paused = _paused ? false : true;
    29                                 handled = true;
    30                                 break;
     53                    _timestep = (_timestep+1) % _ntimesteps;
     54                    _timestepchanged = true;
     55                }
     56                else
     57                    _direction = +1;
     58                handled = true;
     59                break;
    3160
    32                         case osgGA::GUIEventAdapter::KEY_Up:
    33                                 if( !_paused ) _tps *= 1.5;
    34                                 handled = true;
    35                                 break;
     61            case osgGA::GUIEventAdapter::KEY_Left:
     62                if( _paused )
     63                {
     64                    _timestep = _timestep-1;
     65                    if( _timestep < 0 ) _timestep = _ntimesteps-1;
     66                    _timestepchanged = true;
     67                }
     68                else
     69                    _direction = -1;
     70                handled = true;
     71                break;
    3672
    37                         case osgGA::GUIEventAdapter::KEY_Down:
    38                                 if( !_paused ) _tps /= 1.5;
    39                                 handled = true;
    40                                 break;
     73            case 'w':
     74                _togglewireframe = true;
     75                handled = true;
     76                break;
     77            }
    4178
    42                         case 'r':
    43                                 _paused = DEF_PAUSED_START;
    44                                 _tps = _tpsorig;
    45                                 _timestep = 0;
    46                                 _timestepchanged = true;
    47                                 handled = true;
    48                                 break;
    49 
    50                         case osgGA::GUIEventAdapter::KEY_Right:
    51                                 if( _paused )
    52                                 {
    53                                         _timestep = (_timestep+1) % _ntimesteps;
    54                                         _timestepchanged = true;
    55                                 }
    56                                 else
    57                                         _direction = +1;
    58                                 handled = true;
    59                                 break;
    60 
    61                         case osgGA::GUIEventAdapter::KEY_Left:
    62                                 if( _paused )
    63                                 {
    64                                         _timestep = _timestep-1;
    65                                         if( _timestep < 0 ) _timestep = _ntimesteps-1;
    66                                         _timestepchanged = true;
    67                                 }
    68                                 else
    69                                         _direction = -1;
    70                                 handled = true;
    71                                 break;
    72 
    73                         case 'w':
    74                           _togglewireframe = true;
    75                           handled = true;
    76                           break;
    77                 }
    78 
    79         }
     79    }
    8080    return handled;
    8181}
     
    8484void KeyboardEventHandler::setTime( float time)
    8585{
    86         if( !isPaused()  &&  time - _prevtime > 1.0/_tps )
    87         {
    88                 _prevtime = time;
    89                 _timestep = _timestep + _direction;
    90                 if( _timestep == _ntimesteps )
    91                         _timestep = 0;
    92                 else if( _timestep < 0 )
    93                         _timestep = _ntimesteps-1;
    94                 _timestepchanged = true;
    95         }
     86    if( !isPaused()  &&  time - _prevtime > 1.0/_tps )
     87    {
     88        _prevtime = time;
     89        _timestep = _timestep + _direction;
     90        if( _timestep == _ntimesteps )
     91            _timestep = 0;
     92        else if( _timestep < 0 )
     93            _timestep = _ntimesteps-1;
     94        _timestepchanged = true;
     95    }
    9696}
    9797
     
    9999bool KeyboardEventHandler::timestepChanged()
    100100{
    101         if( _timestepchanged )
    102         {
    103                 _timestepchanged = false;
    104                 return true;
    105         }
    106         return false;
     101    if( _timestepchanged )
     102    {
     103        _timestepchanged = false;
     104        return true;
     105    }
     106    return false;
    107107}
    108108
     
    110110bool KeyboardEventHandler::toggleWireframe()
    111111{
    112         if( _togglewireframe )
    113         {
    114                 _togglewireframe = false;
    115                 return true;
    116         }
    117         return false;
     112    if( _togglewireframe )
     113    {
     114        _togglewireframe = false;
     115        return true;
     116    }
     117    return false;
    118118}
    119119
  • Swollen/swollen/main.cpp

    r67 r68  
    219219            // light position manipulator matrix
    220220            osg::Matrixd matrix = trackball->getInverseMatrix();
    221             std::cout << matrix << std::endl;
     221            //std::cout << matrix << std::endl;
    222222
    223223        }
Note: See TracChangeset for help on using the changeset viewer.