osgEarth 2.1.1
Public Member Functions | Public Attributes

MyEventHandler Struct Reference

List of all members.

Public Member Functions

 MyEventHandler (osgEarth::Util::OceanSurfaceNode *ocean)
bool handle (const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa)

Public Attributes

osg::ref_ptr
< osgEarth::Util::OceanSurfaceNode
_ocean

Detailed Description

Definition at line 107 of file osgearth_ocean.cpp.


Constructor & Destructor Documentation

MyEventHandler::MyEventHandler ( osgEarth::Util::OceanSurfaceNode ocean) [inline]

Definition at line 109 of file osgearth_ocean.cpp.

        :_ocean(ocean) { }

Member Function Documentation

bool MyEventHandler::handle ( const osgGA::GUIEventAdapter &  ea,
osgGA::GUIActionAdapter &  aa 
) [inline]

Definition at line 112 of file osgearth_ocean.cpp.

    {
        if ( ea.getEventType() == osgGA::GUIEventAdapter::KEYDOWN )
        {
            switch (ea.getKey())
            {
            case 'h':
                {
                    _ocean->setWaveHeight( _ocean->getWaveHeight() * 1.1 );
                }
                break;
            case 'H':
                {
                    _ocean->setWaveHeight( _ocean->getWaveHeight() * 0.9 );
                }
                break;
            case 'p':
                {
                    _ocean->setPeriod( _ocean->getPeriod() * 1.1 );
                }
                break;
            case 'P':
                {
                    _ocean->setPeriod( _ocean->getPeriod() * 0.9 );
                }
                break;
            case 'e':
                {
                    _ocean->setEnabled( !_ocean->getEnabled() );
                }
            case 'i':
                {
                    _ocean->setInvertMask( !_ocean->getInvertMask() );
                }
                break;
            case 'C':
                {
                    osg::Vec4f color = _ocean->getModulationColor();
                    color.a() = osg::clampBelow( color.a() + 0.1f, 1.0f );
                    _ocean->setModulationColor( color );                        
                }
                break;
            case 'c':
                {
                    osg::Vec4f color = _ocean->getModulationColor();
                    color.a() = osg::clampAbove( color.a() - 0.1f, 0.0f );
                    _ocean->setModulationColor( color );                        
                }
                break;
            case 'A':
                { 
                    _ocean->setOceanAnimationPeriod(_ocean->getOceanAnimationPeriod() + 0.25);
                }
                break;
            case 'a':
                { 
                    _ocean->setOceanAnimationPeriod(_ocean->getOceanAnimationPeriod() - 0.25);
                }
                break;
            case 'J':
                {
                    _ocean->setOceanSurfaceImageSizeRadians( _ocean->getOceanSurfaceImageSizeRadians() * 1.5f);
                }
                break;
            case 'j':
                {
                    _ocean->setOceanSurfaceImageSizeRadians( _ocean->getOceanSurfaceImageSizeRadians() * 0.5f);
                }
                break;
                        case 'm':
                                {
                                        _ocean->setAdjustToMSL( !_ocean->getAdjustToMSL());
                                }
                                break;
            }
        }
        return false;
    }

Member Data Documentation

Definition at line 191 of file osgearth_ocean.cpp.


The documentation for this struct was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines