UpdateCurrentStateInfo

From Multi Theft Auto: Wiki
Jump to navigation Jump to search

This C++ Function is found inside of CAdditionalVertexStreamManager.

It updates current state info.

It can be found in Client/Client Core/Sources/CAdditionalVertexStreamManager.cpp in Visual Studio.

Required Arguments

  • state: To be defined.

Returns

Returns a boolean value whether current state info was updated or not.

Code

bool CAdditionalVertexStreamManager::UpdateCurrentStateInfo ( SCurrentStateInfo& state )
{
    // Get vertex declaration
    if ( FAILED( m_pDevice->GetVertexDeclaration ( &state.decl.pVertexDeclaration ) ) )
        return false;

    // Get vertex declaration desc
    if ( state.decl.pVertexDeclaration )
    {
        if ( FAILED( state.decl.pVertexDeclaration->GetDeclaration ( state.decl.elements, &state.decl.numElements ) ) )
            return false;
    }

    // Get vertex stream
    if ( FAILED( m_pDevice->GetStreamSource ( 1, &state.stream1.pStreamData, &state.stream1.OffsetInBytes, &state.stream1.Stride ) ) )
        return NULL;

    // Get vertex stream desc
    if ( state.stream1.pStreamData )
    {
        if ( FAILED( state.stream1.pStreamData->GetDesc ( &state.decl.VertexBufferDesc1 ) ) )
            return false;
    }

    return true;
}

See Also