openctm load数据流 函数

CTMuint CTMCALL myCTMRead(void * aBuf, CTMuint aCount, void * aUserData)
{
    static int count = 0;
    static void* ptr = NULL;

    if (ptr != aUserData)
    {
        count = 0;
        ptr = aUserData;
    }

    memcpy((char*)aBuf, (char*)ptr + count, aCount*sizeof(char));
    count += aCount;

    return aCount;
}

pvFile为数据流指针

CTMimporter* pCTMimporter = new CTMimporter();
CTMreadfn pCTMreadfn = myCTMRead;
pCTMimporter->LoadCustom(pCTMreadfn, pvFile);

你可能感兴趣的:(openctm load数据流 函数)