Exemplo n.º 1
0
//-*****************************************************************************
void IObjectDrw::draw( const DrawContext &iCtx )
{
    if ( !m_object ) { return; }

    // Skip objects with "visible" property set to 0
    if ( iCtx.getVisibleOnly() ) {
        Abc::ICompoundProperty props = m_object.getProperties();
        const Abc::PropertyHeader* header = props.getPropertyHeader( "visible" );
        if ( header != NULL ) {
            Abc::IScalarProperty visible( props, "visible" );
            Abc::ISampleSelector iss( m_currentTime );
            int8_t val = 1;
            visible.get( reinterpret_cast<void*>( &val ), iss );
            if ( val == 0 ) 
                return;
        }
    }

    for ( DrawablePtrVec::iterator iter = m_children.begin();
          iter != m_children.end(); ++iter )
    {
        DrawablePtr dptr = (*iter);
        if ( dptr )
        {
            dptr->draw( iCtx );
        }
    }
}
//-*****************************************************************************
void IObjectDrw::draw( const DrawContext &iCtx )
{
    if ( !m_object ) { return; }

    // Skip objects with "visible" property set to 0
    if ( iCtx.visibleOnly() ) {
        Abc::ICompoundProperty props = m_object.getProperties();
        const Abc::PropertyHeader* header = props.getPropertyHeader( "visible" );
        if ( header != NULL ) {
            Abc::IScalarProperty visible( props, "visible" );
            Abc::ISampleSelector iss( m_currentTime );
            int8_t val = 1;
            visible.get( reinterpret_cast<void*>( &val ), iss );
            if ( val == 0 ) 
                return;
        }
    }

    // GL picking, add to global selection index
    int i = 0;
    for ( DrawablePtrVec::iterator iter = m_children.begin();
          iter != m_children.end(); ++iter, i++ )
    {
        Abc::IObject iChild = m_object.getChild( i );
        int index = pushName( iChild );
        DrawablePtr dptr = (*iter);
        if ( dptr )
        {
            dptr->draw( iCtx );
        }
        if ( index >= 0 )
            popName( m_object );
    }
    
}
Exemplo n.º 3
0
//-*****************************************************************************
void IObjectDrw::draw( const DrawContext &iCtx )
{
    if ( !m_object ) { return; }

    for ( DrawablePtrVec::iterator iter = m_children.begin();
          iter != m_children.end(); ++iter )
    {
        DrawablePtr dptr = (*iter);
        if ( dptr )
        {
            dptr->draw( iCtx );
        }
    }
}
Exemplo n.º 4
0
void drawScene(ScnNodePtr sceneRoot)
{
    glPushMatrix();
    glMultMatrixf(transpose(sceneRoot->transform.mat()).data);
    
    // post-order traversal
    const auto &children = sceneRoot->getChildren();
    for(const ScnNodePtr &node : children)
    {
        drawScene(node);
    }
    
    DrawablePtr drawable =
        std::dynamic_pointer_cast<Drawable>(sceneRoot);
    if(drawable)
        drawable->draw();
    
    glPopMatrix();
}