Ejemplo n.º 1
0
void AreaLightsExample::mouseMoveEvent(MouseMoveEvent& event) {
    if(_ui->handleMoveEvent(event.position())) {
        /* UI handles it */

    } else if((event.buttons() & MouseMoveEvent::Button::Left)) {
        const Vector2 delta = 3.0f*
            Vector2{event.position() - _previousMousePosition}/Vector2{GL::defaultFramebuffer.viewport().size()};
        _cameraRotation += delta;

        _previousMousePosition = event.position();

    } else return;

    redraw();
}
Ejemplo n.º 2
0
void PrimitivesExample::mouseMoveEvent(MouseMoveEvent& event) {
    if(!(event.buttons() & MouseMoveEvent::Button::Left)) return;

    const Vector2 delta = 3.0f*
        Vector2{event.position() - _previousMousePosition}/
        Vector2{GL::defaultFramebuffer.viewport().size()};

    _transformation =
        Matrix4::rotationX(Rad{delta.y()})*
        _transformation*
        Matrix4::rotationY(Rad{delta.x()});

    _previousMousePosition = event.position();
    event.setAccepted();
    redraw();
}