Hi,
Sample code from my loader :
DWFToolkit::DWFResourceContainer::ResourceIterator* piRes = pSect->findResourcesByRole( DWFXML::kzRole_Texture );
while( piRes && piRes->valid() ) {
DWFToolkit::DWFGraphicResource* pTxtr = dynamic_cast(piRes->get());
if( pTxtr ) {
DWFCore::DWFInputStream* pTxtrStrm = pTxtr->getInputStream();
int iSizeReq = (int) pTxtrStrm->available();
if( iSizeReq > 0 ) {
char *pImgeData = (char *) malloc(iSizeReq);
pTxtrStrm->read( pImgeData, iSizeReq );
CJPEGPtr apImge = new CJPEG(pImgeData, iSizeReq, true);
apImge->setWrapS(e3d::CImge::eWrapMode::wmREPEAT);
apImge->setWrapT(e3d::CImge::eWrapMode::wmREPEAT);
apImge->setMagFltr(e3d::CImge::eFltrMode::fltrLINEAR);
apImge->setMinFltr(e3d::CImge::eFltrMode::fltrLINEAR);
std::wstring wsName = (const wchar_t *) pTxtr->title();
m_mapTxtrs[wsName] = apImge;
free(pImgeData);
}
}
piRes->next();
}
the wsName value will be the same name as the TK_Color ie :
m_diffuse.m_name contains the same name. However, I also found out you can have the name of the colour followed by text values describing a colour as well for example :
ORANGESKIN (r=50 g=40 b=10) So I had to extract the two parts seperatly to get the correct end result (A real pain )
Hope this helps
Cheers
jason