void GUIScrollbarGadget::draw()
{
    if (!isVisible_ || isValidated_ || !setupClipping())
        return;
    
    #if 1 // !TODO! -> call in virtual setPosition/ setRect/ setSize functino
    updateBarLocation();
    #endif
    
    GlbRenderSys->draw2DRectangle(Rect_, Color_);
    
    if (Flags_ & GUIFLAG_HATCHEDFACE)
        drawHatchedFace(Rect_);
    
    if (!(Flags_ & GUIFLAG_BORDERLESS))
        drawFrame(Rect_, 0, false);
    
    dim::rect2di BarRect, ButtonARect, ButtonBRect, PageARect, PageBRect;
    getButtonRects(BarRect, ButtonARect, ButtonBRect, PageARect, PageBRect);
    
    drawScrollbar(BarRect);
    drawScrollbarButton(ButtonARect, dim::rect2df(0, 0, 1, 1), USAGE_FORWARDS);
    drawScrollbarButton(ButtonBRect, dim::rect2df(0, 1, 1, 0), USAGE_BACKWARDS);
    
    if (!isEnabled_)
        drawHatchedFace(Rect_);
}
void GUIListGadget::draw()
{
    if (!isVisible_ || isValidated_ || !setupClipping())
        return;
    
    GlbRenderSys->draw2DRectangle(Rect_, Color_);
    
    /* Draw all item entries */
    s32 ItemPos = 0;
    for (std::list<GUIListItem*>::iterator it = ItemList_.begin(); it != ItemList_.end(); ++it)
    {
        drawItem(*it, ItemPos);
        ItemPos += (*it)->getItemSize();
    }
    
    /* Draw all column entries */
    s32 ColumnPos = 0;
    for (std::list<GUIListColumn*>::iterator it = ColumnList_.begin(); it != ColumnList_.end(); ++it)
    {
        drawColumn(*it, ColumnPos);
        ColumnPos += (*it)->getColumnSize();
    }
    
    /* Update scrollbar ranges */
    HorzScroll_.setRange(ColumnPos);
    VertScroll_.setRange(ItemPos + COLUMN_HEIGHT);
    
    drawChildren();
    
    GlbRenderSys->setClipping(true, dim::point2di(VisRect_.Left, VisRect_.Top), VisRect_.getSize());
    
    drawFrame(Rect_, 0, false);
}
void Component::draw(Graphics* const TheGraphics, Real32 Opacity) const
{
    //If not visible then don't draw
    if (!getVisible())
        return;

    //Grab the initial transformation
    GLdouble InitMat[16];
    glGetDoublev(GL_MODELVIEW_MATRIX, InitMat);

    //Translate to my position
    glTranslatef(getPosition().x(), getPosition().y(), 0);

    if(setupClipping(TheGraphics))
    {

        //Activate My Border Drawing constraints
        Border* DrawnBorder = getDrawnBorder();
        if(DrawnBorder != NULL)
        {
            DrawnBorder->activateInternalDrawConstraints(TheGraphics,0,0,getSize().x(),getSize().y());
        }


        //Draw My Background
        drawBackground(TheGraphics, getDrawnBackground(), Opacity);

        //Draw Internal
        drawInternal(TheGraphics, Opacity);

        //Make sure the clipping is reset
        setupClipping(TheGraphics);

        //Draw My Foreground
        drawForeground(TheGraphics, getDrawnForeground(), Opacity);

        //Draw all parts that should not be clipped against
        drawUnclipped(TheGraphics, Opacity);
    }

    //Reset the transformation
    glLoadMatrixd(InitMat);
}
void TabPanel::drawTab(UInt32 TabIndex, Graphics* const TheGraphics, Real32 Opacity) const
{
    Pnt2f TabPosition(getTabs(TabIndex)->getPosition()), 
          TabBorderPosition;
    Vec2f TabSize(getTabs(TabIndex)->getSize()), 
          TabBorderSize;

    BorderRefPtr DrawnTabBorder(getDrawnTabBorder(TabIndex));

    LayerRefPtr DrawnTabBackground(getDrawnTabBackground(TabIndex));

    Real32 TabBorderLeftWidth, TabBorderRightWidth,TabBorderTopWidth, TabBorderBottomWidth;
    calculateTabBorderLengths(DrawnTabBorder, TabBorderLeftWidth, TabBorderRightWidth,TabBorderTopWidth, TabBorderBottomWidth);

    TabBorderPosition.setValues(TabPosition.x() - TabBorderLeftWidth, TabPosition.y() - TabBorderTopWidth);
    TabBorderSize.setValues(TabSize.x() + TabBorderLeftWidth + TabBorderRightWidth,
                            TabSize.y() + TabBorderTopWidth + TabBorderBottomWidth);

    if(DrawnTabBorder != NULL)
    {
        DrawnTabBorder->draw(TheGraphics,
                             TabBorderPosition.x(), TabBorderPosition.y(),
                             TabBorderSize.x(), TabBorderSize.y(),
                             getOpacity()*Opacity);
        //DrawnTabBorder->activateInternalDrawConstraints(TheGraphics,
        //                 TabBorderPosition.x(), TabBorderPosition.y(),
        //				 TabBorderSize.x(), TabBorderSize.y());
    }

    if(DrawnTabBackground != NULL)
    {
        DrawnTabBackground->draw(TheGraphics, 
                                 TabPosition, 
                                 TabPosition + TabSize, 
                                 getOpacity()*Opacity);
    }

    //Draw the tab component
    getTabs(TabIndex)->draw(TheGraphics, getOpacity()*Opacity);

    setupClipping(TheGraphics);

    if(DrawnTabBorder != NULL)
    {
        DrawnTabBorder->deactivateInternalDrawConstraints(TheGraphics,
                                                          TabBorderPosition.x(), TabBorderPosition.y(),
                                                          TabBorderSize.x(), TabBorderSize.y());
    }
}
void TabPanel::drawInternal(Graphics* const TheGraphics, Real32 Opacity) const
{
    //Draw Inactive tabs
    for (UInt32 i = 0; i < getMFTabs()->size(); ++i)
    {
        if(i != getSelectedIndex())
        {
            drawTab(i,TheGraphics, Opacity);
        }
    }

    //Draw Active Content
    drawContents(TheGraphics, Opacity);

    //Draw Active Tab
    if(getSelectedIndex() != -1)
    {
        setupClipping(TheGraphics);
        drawTab(getSelectedIndex(),TheGraphics, Opacity);
    }
}
Beispiel #6
0
//----------------------------------------------------------------------------//
void IrrlichtGeometryBuffer::draw() const
{
    if (!d_matrixValid)
        updateMatrix();

    d_driver.setTransform(irr::video::ETS_WORLD, d_matrix);

    const int pass_count = d_effect ? d_effect->getPassCount() : 1;
    for (int pass = 0; pass < pass_count; ++pass)
    {
        // set up RenderEffect
        if (d_effect)
            d_effect->performPreRenderFunctions(pass);

        // draw the batches
        size_t pos = 0;
        BatchList::const_iterator i = d_batches.begin();
        for ( ; i != d_batches.end(); ++i)
        {
            if (i->clip)
                setupClipping();

            d_material.setTexture(0, i->texture);
            d_driver.setMaterial(d_material);
            d_driver.drawIndexedTriangleList(&d_vertices[pos], i->vertexCount,
                                             &d_indices[pos], i->vertexCount / 3);
            pos += i->vertexCount;

            if (i->clip)
                cleanupClipping();
        }
    }

    // clean up RenderEffect
    if (d_effect)
        d_effect->performPostRenderFunctions();
}