Пример #1
0
//--------------------------------------------------------------------------------------
CPUTBuffer *CPUTModel::GetBuffer( const cString &name, int meshIndex ) const
{
    if( meshIndex >= 0 )
    {
        CPUTMaterial *pMaterial = mpMaterial[meshIndex];
        if( pMaterial )
        {
            UINT bufferCount = pMaterial->GetBufferCount();
            for( UINT ii=0; ii<bufferCount; ii++ )
            {
                CPUTBuffer *pBuffer = pMaterial->GetBuffer(ii);
                if( 0 == _wcsicmp( pBuffer->GetName().data(), name.data() ) )
                {
                    pBuffer->AddRef();
                    return pBuffer;
                }
            }
        }
    }
    else
    {
        // No meshIndex specified, so check all materials
        for(UINT ii=0; ii<mMeshCount; ii++ )
        {
            CPUTBuffer *pBuffer = GetBuffer( name, ii );
            if( pBuffer )
            {
                return pBuffer;
            }
        }
    }
    return NULL;
}
//-----------------------------------------------------------------------------
CPUTBuffer *CPUTAssetLibrary::GetConstantBuffer(const cString &name, const CPUTModel *pModel, int meshIndex )
{
    // If we already have one by this name, then return it
    CPUTBuffer *pBuffer = FindConstantBuffer(name, true, pModel, meshIndex);
    ASSERT( pBuffer, _L("Can't find constant buffer ") + name );
    pBuffer->AddRef();
    return pBuffer;
}
//-----------------------------------------------------------------------------
CPUTBuffer *CPUTAssetLibrary::GetBuffer(const cString &name )
{
    // If we already have one by this name, then return it
    CPUTBuffer *pBuffer = FindBuffer(name, true);
    ASSERT( pBuffer, _L("Can't find buffer ") + name );
    pBuffer->AddRef();
    return pBuffer;
}
Пример #4
0
//-----------------------------------------------------------------------------
CPUTBuffer *CPUTAssetLibrary::GetConstantBuffer(const std::string &name)
{
    // If we already have one by this name, then return it
    CPUTBuffer *pBuffer = FindConstantBuffer(name, true);
    LIBRARY_ASSERT(pBuffer, "Can't find constant buffer " + name);
    if(pBuffer != NULL)
    pBuffer->AddRef();
    return pBuffer;
}
CPUTBuffer *CPUTAssetLibrary::GetConstantBufferByName(const cString &name)
{
    CPUTBuffer *pConstantBuffer = (CPUTBuffer *) FindAssetByName(name, mpConstantBufferList);
    if (pConstantBuffer != NULL)
    {
        pConstantBuffer->AddRef();
        return pConstantBuffer;
    }

    return NULL;
}
Пример #6
0
CPUTBuffer *CPUTAssetLibrary::GetBufferByName(const std::string &name)
{
    CPUTBuffer *pBuffer = (CPUTBuffer *) FindAssetByName(name, mpBufferList);
    if (pBuffer != NULL)
    {
        pBuffer->AddRef();
        return pBuffer;
    }

    return NULL;
}