OK, I tried modify the file \src\osgPlugins\fbx\fbxMaterialToOsgStateSet.cpp
and changed this function, it seems to work !
but I guess there are other places to change right ?
actually any string got from fbx sdk should be converted from utf8 to ansi
before used in osg.
Code:
osg::ref_ptr<osg::Texture2D>
FbxMaterialToOsgStateSet::fbxTextureToOsgTexture(const KFbxFileTexture* fbx)
{
ImageMap::iterator it = _imageMap.find(fbx->GetFileName());
if (it != _imageMap.end())
return it->second;
osg::ref_ptr<osg::Image> pImage = NULL;
// Warning: fbx->GetRelativeFileName() is relative TO EXECUTION DIR
// fbx->GetFileName() is as stored initially in the FBX
char* fileName = NULL; KFbxUTF8ToAnsi(fbx->GetFileName(), fileName);
char* relativeFileName = NULL;
KFbxUTF8ToAnsi(fbx->GetRelativeFileName(), relativeFileName);
if ((pImage = osgDB::readImageFile(osgDB::concatPaths(_dir, fileName),
_options)) || // First try "export dir/name"
(pImage = osgDB::readImageFile(fileName, _options)) ||
// Then try "name" (if absolute)
(pImage = osgDB::readImageFile(osgDB::concatPaths(_dir,
relativeFileName), _options))) // Else try "current dir/name"
{
osg::ref_ptr<osg::Texture2D> pOsgTex = new osg::Texture2D;
pOsgTex->setImage(pImage.get());
pOsgTex->setWrap(osg::Texture2D::WRAP_S,
convertWrap(fbx->GetWrapModeU()));
pOsgTex->setWrap(osg::Texture2D::WRAP_T,
convertWrap(fbx->GetWrapModeV()));
_imageMap.insert(std::make_pair(fbx->GetFileName(), pOsgTex.get()));
return pOsgTex;
}
else
{
return NULL;
}
delete fileName;
delete relativeFileName;
}
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=51088#51088
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org