Пример #1
0
void EllipseView::
        drawSelectionCircle()
{
    float
        x = model_->centre.time,
        z = model_->centre.scale,
        _rx = fabs(model_->centrePlusRadius.time - model_->centre.time),
        _rz = fabs(model_->centrePlusRadius.scale - model_->centre.scale);
    float y = 1;

    Support::ToolGlBrush tgb(enabled);

    glBegin(GL_TRIANGLE_STRIP);
    for (unsigned k=0; k<=360; k++) {
        float s = z + _rz*sin(k*M_PI/180);
        float c = x + _rx*cos(k*M_PI/180);
        glVertex3f( c, 0, s );
        glVertex3f( c, y, s );
    }
    glEnd();

    glLineWidth(1.6f);
    glBegin(GL_LINE_LOOP);
    for (unsigned k=0; k<360; k++) {
        float s = z + _rz*sin(k*M_PI/180);
        float c = x + _rx*cos(k*M_PI/180);
        glVertex3f( c, y, s );
    }
    glEnd();
    glLineWidth(0.5f);
}
Пример #2
0
void BrushView::
drawCircle()
{
    float
    x = gauss.pos.x,
    z = gauss.pos.y,
    _rx = gauss.sigma().x,
    _rz = gauss.sigma().y;
    float y = 1;

    Support::ToolGlBrush tgb(enabled);

    glBegin(GL_TRIANGLE_STRIP);
    for (unsigned k=0; k<=360; k++) {
        float s = z + _rz*sin(k*M_PI/180);
        float c = x + _rx*cos(k*M_PI/180);
        glVertex3f( c, 0, s );
        glVertex3f( c, y, s );
    }
    glEnd();

    glLineWidth(0.6f);
    glBegin(GL_LINE_LOOP);
    for (unsigned k=0; k<360; k++) {
        float s = z + _rz*sin(k*M_PI/180);
        float c = x + _rx*cos(k*M_PI/180);
        glVertex3f( c, y, s );
    }
    glEnd();
    glLineWidth(0.5f);
}
Пример #3
0
void TooltipView::
        drawMarker( Heightmap::Position p )
{
#ifdef LEGACY_OPENGL
    Support::ToolGlBrush tgb(enabled);
    glColor4f( 0.7, 0.2, 0.2, enabled ? .5 : 0.2);

    const Tools::Support::RenderCamera c = *render_view_->model->camera.read ();
    float sz = -0.01/c.xscale*c.p[2];
    float x1 = p.time - sz;
    float x2 = p.time + sz;
    float y = 1.5;

    glBegin(GL_TRIANGLE_STRIP);
        glVertex3f( x1, 0, p.scale );
        glVertex3f( x1, y, p.scale );
        glVertex3f( x2, 0, p.scale );
        glVertex3f( x2, y, p.scale );
    glEnd();

    glLineWidth(1.6f);
    glBegin(GL_LINE_STRIP);
        glVertex3f( x1, 0, p.scale );
        glVertex3f( x1, y, p.scale );
        glVertex3f( x2, y, p.scale );
        glVertex3f( x2, 0, p.scale );
    glEnd();
    glLineWidth(0.5f);
#endif // LEGACY_OPENGL
}
Пример #4
0
void RectangleView::
        drawSelectionRectangle()
{
#ifdef LEGACY_OPENGL
    float
        x1 = model_->a.time,
        z1 = model_->a.scale,
        x2 = model_->b.time,
        z2 = model_->b.scale;
    if (x1==x2 || z1==z2)
        return;

    float y = 1;

    Support::ToolGlBrush tgb(enabled);

    glBegin(GL_TRIANGLE_STRIP);
        glVertex3f( x1, 0, z1 );
        glVertex3f( x1, y, z1 );
        glVertex3f( x2, 0, z1 );
        glVertex3f( x2, y, z1 );
        glVertex3f( x2, 0, z2 );
        glVertex3f( x2, y, z2 );
        glVertex3f( x1, 0, z2 );
        glVertex3f( x1, y, z2 );
        glVertex3f( x1, 0, z1 );
        glVertex3f( x1, y, z1 );
    glEnd();

    glLineWidth(1.6f);
    glBegin(GL_LINE_LOOP);
        glVertex3f( x1, y, z1 );
        glVertex3f( x2, y, z1 );
        glVertex3f( x2, y, z2 );
        glVertex3f( x1, y, z2 );
    glEnd();
    glLineWidth(0.5f);
#endif // LEGACY_OPENGL
}
Пример #5
0
void PlaybackMarkersView::
        drawMarkers()
{
    float y = 1;

    Support::ToolGlBrush tgb(enabled);

    glBegin(GL_QUADS);

    BOOST_FOREACH( const float& m, model_->markers() )
    {
        glVertex3f( m, 0, 0 );
        glVertex3f( m, y, 0 );
        glVertex3f( m, y, 1 );
        glVertex3f( m, 0, 1 );

        if ( !is_adding_marker_ && m == highlighted_marker_)
        {
            glVertex3f( m, 0, 0 );
            glVertex3f( m, y, 0 );
            glVertex3f( m, y, 1 );
            glVertex3f( m, 0, 1 );
        }
    }

    if ( is_adding_marker_ && 0 <= highlighted_marker_ )
        // draw adding marker
    {
        glVertex3f( highlighted_marker_, 0, 0 );
        glVertex3f( highlighted_marker_, y, 0 );
        glVertex3f( highlighted_marker_, y, 1 );
        glVertex3f( highlighted_marker_, 0, 1 );
    }

    PlaybackMarkersModel::Markers::iterator itr = model_->currentMarker();
    float a = *itr, b;
    itr++;
    if ( itr != model_->markers().end() )
        b = *itr;
    else {
//        b = project_->worker.length();
        Signal::OperationDesc::Extent x = project_->processing_chain ().read ()->extent(project_->default_target ());
        b = x.interval.get_value_or (Signal::Interval()).count();
    }

    glVertex3f( a, 0, -.1 );
    glVertex3f( a, y, -.1 );
    glVertex3f( a, y, 1.1 );
    glVertex3f( a, 0, 1.1 );

    glVertex3f( a, 0, -.1 );
    glVertex3f( a, y, -.1 );
    glVertex3f( b, y, -.1 );
    glVertex3f( b, 0, -.1 );

    glVertex3f( a, y, 1.1 );
    glVertex3f( a, 0, 1.1 );
    glVertex3f( b, 0, 1.1 );
    glVertex3f( b, y, 1.1 );

    glVertex3f( b, 0, -.1 );
    glVertex3f( b, y, -.1 );
    glVertex3f( b, y, 1.1 );
    glVertex3f( b, 0, 1.1 );

    glEnd();

    glLineWidth(1.6f);
    glBegin(GL_LINES);

    BOOST_FOREACH( const float& m, model_->markers() )
    {
        glVertex3f( m, y, 0 );
        glVertex3f( m, y, 1 );

        if ( !is_adding_marker_ && m == highlighted_marker_)
        {
            glVertex3f( m, y, 0 );
            glVertex3f( m, y, 1 );
        }
    }

    if ( is_adding_marker_ && 0 <= highlighted_marker_ )
        // draw adding marker
    {
        glVertex3f( highlighted_marker_, y, 0 );
        glVertex3f( highlighted_marker_, y, 1 );
    }

    glVertex3f( a, y, -.1 );
    glVertex3f( b, y, -.1 );

    glVertex3f( a, y, 1.1 );
    glVertex3f( b, y, 1.1 );

    glVertex3f( a, y, -.1 );
    glVertex3f( a, y, 1.1 );

    glVertex3f( b, y, -.1 );
    glVertex3f( b, y, 1.1 );

    glEnd();
    glLineWidth(0.5f);
}