Beispiel #1
0
void Canvas::exit()
{
    LBASSERT(_state == STATE_RUNNING || _state == STATE_DELETE);
    _switchLayout(getActiveLayoutIndex(), LB_UNDEFINED_UINT32);
    if (_state == STATE_RUNNING)
        _state = STATE_STOPPED;
}
Beispiel #2
0
void Canvas::activateLayout(const uint32_t index)
{
    if (_state == STATE_RUNNING)
        _switchLayout(getActiveLayoutIndex(), index);
    else
        Super::activateLayout(index);
}
Beispiel #3
0
bool Config::_handleKeyEvent( const eq::KeyEvent& event )
{
    switch( event.key )
    {
        case 'z':
            _adjustEyeBase( -0.1f );
            return true;
        case 'Z':
            _adjustEyeBase( 0.1f );
            return true;
        case 'y':
            _adjustModelScale( 0.1f );
            return true;
        case 'Y':
            _adjustModelScale( 10.0f );
            return true;
        case 't':
            _adjustTileSize( -1 );
            return true;
        case 'T':
            _adjustTileSize( 1 );
             return true;
        case 'u':
            _frameData.toggleCompression();
            return true;

        case 'n':
        case 'N':
            _frameData.togglePilotMode();
            return true;
        case ' ':
            stopFrames();
            _spinX   = 0;
            _spinY   = 0;
            _advance = 0;
            _frameData.reset();
            _setHeadMatrix( eq::Matrix4f::IDENTITY );
            return true;

        case 'i':
            _useIdleAA = !_useIdleAA;
            return true;

        case 'k':
        {
            lunchbox::RNG rng;
            if( rng.get< bool >( ))
                _frameData.toggleOrtho();
            if( rng.get< bool >( ))
                _frameData.toggleStatistics();
            if( rng.get< bool >( ))
                _switchCanvas();
            if( rng.get< bool >( ))
                _switchView();
            if( rng.get< bool >( ))
                _switchLayout( 1 );
            if( rng.get< bool >( ))
                _switchModel();
            if( rng.get< bool >( ))
                eqAdmin::addWindow( _getAdminServer(), rng.get< bool >( ));
            if( rng.get< bool >( ))
            {
                eqAdmin::removeWindow( _getAdminServer( ));
                _currentCanvas = 0;
            }
            if( rng.get< bool >( ))
                _switchViewMode();
            return true;
        }

        case 'o':
        case 'O':
            _frameData.toggleOrtho();
            return true;

        case 's':
        case 'S':
            _frameData.toggleStatistics();
            return true;

        case 'f':
            _freezeLoadBalancing( true );
            return true;

        case 'F':
            _freezeLoadBalancing( false );
            return true;

        case eq::KC_F1:
        case 'h':
        case 'H':
            _frameData.toggleHelp();
            return true;

        case 'd':
        case 'D':
            _frameData.toggleColorMode();
            return true;

        case 'q':
            _frameData.adjustQuality( -.1f );
            return true;

        case 'Q':
            _frameData.adjustQuality( .1f );
            return true;

        case 'c':
        case 'C':
            _switchCanvas();
            return true;

        case 'v':
        case 'V':
            _switchView();
            return true;

        case 'm':
        case 'M':
            _switchModel();
            return true;

        case 'l':
            _switchLayout( 1 );
            return true;
        case 'L':
            _switchLayout( -1 );
            return true;

        case 'w':
        case 'W':
            _frameData.toggleWireframe();
            return true;

        case 'r':
        case 'R':
            _frameData.toggleRenderMode();
            return true;
        case 'g':
        case 'G':
            _switchViewMode();
            return true;
        case 'a':
            eqAdmin::addWindow( _getAdminServer(), false /* active stereo */ );
            return true;
        case 'p':
            eqAdmin::addWindow( _getAdminServer(), true /* passive stereo */ );
            return true;
        case 'x':
            eqAdmin::removeWindow( _getAdminServer( ));
            _currentCanvas = 0;
            LBASSERT( update() );
            return false;

        // Head Tracking Emulation
        case eq::KC_UP:
        {
            eq::Matrix4f headMatrix = _getHeadMatrix();
            headMatrix.y() += 0.1f;
            _setHeadMatrix( headMatrix );
            return true;
        }
        case eq::KC_DOWN:
        {
            eq::Matrix4f headMatrix = _getHeadMatrix();
            headMatrix.y() -= 0.1f;
            _setHeadMatrix( headMatrix );
            return true;
        }
        case eq::KC_RIGHT:
        {
            eq::Matrix4f headMatrix = _getHeadMatrix();
            headMatrix.x() += 0.1f;
            _setHeadMatrix( headMatrix );
            return true;
        }
        case eq::KC_LEFT:
        {
            eq::Matrix4f headMatrix = _getHeadMatrix();
            headMatrix.x() -= 0.1f;
            _setHeadMatrix( headMatrix );
            return true;
        }
        case eq::KC_PAGE_DOWN:
        {
            eq::Matrix4f headMatrix = _getHeadMatrix();
            headMatrix.z() += 0.1f;
            _setHeadMatrix( headMatrix );
            return true;
        }
        case eq::KC_PAGE_UP:
        {
            eq::Matrix4f headMatrix = _getHeadMatrix();
            headMatrix.z() -= 0.1f;
            _setHeadMatrix( headMatrix );
            return true;
        }
        case '.':
        {
            eq::Matrix4f headMatrix = _getHeadMatrix();
            headMatrix.pre_rotate_x( .1f );
            _setHeadMatrix( headMatrix );
            return true;
        }
        case ',':
        {
            eq::Matrix4f headMatrix = _getHeadMatrix();
            headMatrix.pre_rotate_x( -.1f );
            _setHeadMatrix( headMatrix );
            return true;
        }
        case ';':
        {
            eq::Matrix4f headMatrix = _getHeadMatrix();
            headMatrix.pre_rotate_y( .1f );
            _setHeadMatrix( headMatrix );
            return true;
        }
        case '\'':
        {
            eq::Matrix4f headMatrix = _getHeadMatrix();
            headMatrix.pre_rotate_y( -.1f );
            _setHeadMatrix( headMatrix );
            return true;
        }
        case '[':
        {
            eq::Matrix4f headMatrix = _getHeadMatrix();
            headMatrix.pre_rotate_z( -.1f );
            _setHeadMatrix( headMatrix );
            return true;
        }
        case ']':
        {
            eq::Matrix4f headMatrix = _getHeadMatrix();
            headMatrix.pre_rotate_z( .1f );
            _setHeadMatrix( headMatrix );
            return true;
        }

        case '+':
            _changeFocusDistance( .1f );
            return true;

        case '-':
            _changeFocusDistance( -.1f );
            return true;

        case '1':
            _setFocusMode( eq::FOCUSMODE_FIXED );
            return true;

        case '2':
            _setFocusMode( eq::FOCUSMODE_RELATIVE_TO_ORIGIN );
            return true;

        case '3':
            _setFocusMode( eq::FOCUSMODE_RELATIVE_TO_OBSERVER );
            return true;

        case '4':
            _adjustResistance( 1 );
            return true;

        case '5':
            _adjustResistance( -1 );
            return true;

        case 'j':
            stopFrames();
            return true;

        case 'e':
            _toggleEqualizer();
            return true;

        default:
            return false;
    }
}
Beispiel #4
0
bool Config::handleEvent(const eq::EventType type, const eq::KeyEvent& event)
{
    if (type != eq::EVENT_KEY_PRESS)
        return eq::Config::handleEvent(type, event);

    switch (event.key)
    {
    case 'b':
    case 'B':
        _frameData.toggleBackground();
        return true;

    case 'd':
    case 'D':
        _frameData.toggleColorMode();
        return true;

    case eq::KC_F1:
    case 'h':
    case 'H':
        _frameData.toggleHelp();
        return true;

    case 'r':
    case 'R':
    case ' ':
        _spinX = 0;
        _spinY = 0;
        _frameData.reset();
        return true;

    case 'n':
    case 'N':
        _frameData.toggleNormalsQuality();
        return true;

    case 'o':
    case 'O':
        _frameData.toggleOrtho();
        return true;

    case 's':
    case 'S':
        _frameData.toggleStatistics();
        return true;

    case 'l':
        _switchLayout(1);
        return true;
    case 'L':
        _switchLayout(-1);
        return true;

    case 'q':
        _frameData.adjustQuality(-.1f);
        return true;

    case 'Q':
        _frameData.adjustQuality(.1f);
        return true;

    case 'c':
    case 'C':
    {
        const eq::Canvases& canvases = getCanvases();
        if (canvases.empty())
            return true;

        _frameData.setCurrentViewID(co::uint128_t());

        if (!_currentCanvas)
        {
            _currentCanvas = canvases.front();
            return true;
        }

        eq::Canvases::const_iterator i =
            std::find(canvases.begin(), canvases.end(), _currentCanvas);
        LBASSERT(i != canvases.end());

        ++i;
        if (i == canvases.end())
            _currentCanvas = canvases.front();
        else
            _currentCanvas = *i;
        return true;
    }

    case 'v':
    case 'V':
    {
        const eq::Canvases& canvases = getCanvases();
        if (!_currentCanvas && !canvases.empty())
            _currentCanvas = canvases.front();

        if (!_currentCanvas)
            return true;

        const eq::Layout* layout = _currentCanvas->getActiveLayout();
        if (!layout)
            return true;

        const eq::View* current = find<eq::View>(_frameData.getCurrentViewID());

        const eq::Views& views = layout->getViews();
        LBASSERT(!views.empty());

        if (!current)
        {
            _frameData.setCurrentViewID(views.front()->getID());
            return true;
        }

        eq::Views::const_iterator i =
            std::find(views.begin(), views.end(), current);
        LBASSERT(i != views.end());

        ++i;
        if (i == views.end())
            _frameData.setCurrentViewID(co::uint128_t());
        else
            _frameData.setCurrentViewID((*i)->getID());
        return true;
    }

    default:
        break;
    }
    return eq::Config::handleEvent(type, event);
}
Beispiel #5
0
void Canvas::init()
{
    LBASSERT(_state == STATE_STOPPED);
    _switchLayout(LB_UNDEFINED_UINT32, getActiveLayoutIndex());
    _state = STATE_RUNNING;
}
Beispiel #6
0
bool Config::_handleKeyEvent( const eq::KeyEvent& event )
{
    switch( event.key )
    {
        case eq::KC_F1:
        case 'h':
        case 'H':
            _frameData.toggleHelp();
            return true;

        case 'r':
        case 'R':
        case ' ':
            _spinX = 0;
            _spinY = 0;
            _frameData.reset();
            return true;

        case 'o':
        case 'O':
            _frameData.toggleOrtho();
            return true;

        case 's':
        case 'S':
        _frameData.toggleStatistics();
            return true;

        case 'l':
            _switchLayout( 1 );
            return true;
        case 'L':
            _switchLayout( -1 );
            return true;

        case 'q':
            _frameData.adjustQuality( -.1f );
            return true;

        case 'Q':
            _frameData.adjustQuality( .1f );
            return true;

        case 'c':
        case 'C':
        {
            const eq::Canvases& canvases = getCanvases();
            if( canvases.empty( ))
                return true;

            _frameData.setCurrentViewID( co::base::UUID::ZERO );

            if( !_currentCanvas )
            {
                _currentCanvas = canvases.front();
                return true;
            }

            eq::Canvases::const_iterator i = std::find( canvases.begin(),
                                                        canvases.end(),
                                                        _currentCanvas );
            EQASSERT( i != canvases.end( ));

            ++i;
            if( i == canvases.end( ))
                _currentCanvas = canvases.front();
            else
                _currentCanvas = *i;
            return true;
        }

        case 'v':
        case 'V':
        {
            const eq::Canvases& canvases = getCanvases();
            if( !_currentCanvas && !canvases.empty( ))
                _currentCanvas = canvases.front();

            if( !_currentCanvas )
                return true;

            const eq::Layout* layout = _currentCanvas->getActiveLayout();
            if( !layout )
                return true;

            const eq::View* current = 
                              find< eq::View >( _frameData.getCurrentViewID( ));

            const eq::Views& views = layout->getViews();
            EQASSERT( !views.empty( ))

            if( !current )
            {
                _frameData.setCurrentViewID( views.front()->getID( ));
                return true;
            }

            eq::Views::const_iterator i = std::find( views.begin(),
                                                          views.end(),
                                                          current );
            EQASSERT( i != views.end( ));

            ++i;
            if( i == views.end( ))
                _frameData.setCurrentViewID( co::base::UUID::ZERO );
            else
                _frameData.setCurrentViewID( (*i)->getID( ));
            return true;
        }

        default:
            break;
    }
    return false;
}