<div> </div><div> </div><div> Hi,<br>    I've also been doing the same thing lately. I've writen some code to achieve that, maybe help, :)<br><br>class TextureVisitor : public osg::NodeVisitor<br>{<br>public:<br>    TextureVisitor(int sizelimit, int levelnum):_sizelimit(sizelimit), _levelnum(levelnum),<br>        osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN)<br>    {}<br><br>    virtual void apply(osg::Group& node)<br>    {<br>        osg::StateSet* ss = node.getStateSet();<br>        if(ss!=NULL)<br>            traverseTexture(ss);<br>        traverse(node);<br>    }<br><br>    virtual void apply(osg::Node& node)<br>    {<br>        osg::StateSet* ss = node.getStateSet();<br>        if(ss!=NULL)<br>            traverseTexture(ss);<br>        traverse(node);<br>    }<br><br>    virtual void apply(osg::Geode& node)<br>    {<br>        osg::StateSet* ss = node.getStateSet();<br>        if(ss!=NULL)<br>            traverseTexture(ss);<br><br>        int numdrawables = node.getNumDrawables();<br>        for(int i=0; i<numdrawables; ++i)<br>        {<br>            ss = node.getDrawable(i)->getStateSet();<br>            if(ss!=NULL)<br>                traverseTexture(ss);<br>        }<br>        traverse(node);<br>    }<br><br>    void traverseTexture(osg::StateSet* ss)<br>    {<br>        osg::StateSet::TextureAttributeList texAbl =<br>            ss->getTextureAttributeList();<br>        int i=0;<br>        for(osg::StateAttribute* sa = ss->getTextureAttribute(i, osg::StateAttribute::TEXTURE);<br>            i<texAbl.size(); ++i)<br>        {<br>            osg::Texture2D* tex2d = dynamic_cast<osg::Texture2D*>(sa);<br>            if(tex2d==NULL)<br>                continue;<br>            //对于每一个image<br>            int numImg = tex2d->getNumImages();<br>            for(int j=0; j<numImg; ++j)<br>            {<br>                osg::Image* img = tex2d->getImage(j);<br>                    SaveTexture(img);<br>            }<br>        }<br>    }<br>    string getName(const string& filename)<br>    {<br>        string::size_type pos = filename.find_last_of("\\");<br>        string::size_type pointpos = filename.find_last_of(".");<br>        string name;<br>        for(string::size_type i = pos+1; i<pointpos; ++i)<br>        {<br>            name += filename[i];<br>        }<br>        return name;<br>    }<br>    void SaveTexture(osg::Image* img)<br>    {<br>        osgDB::writeImageFile(img, img->getFileName());<br>    }<br>private:<br>    int _sizelimit;<br>    int _levelnum;<br>};<br></div><div> </div><div></div><br><pre>在2008-07-09 21:32:46,Doug <taecmcpt@comcast.net> 写道:
>Hi,
>
>I have a model in .ive format with an embedded texture. I need to bring 
>the model into 3dsMax to work on it. I can use osgconv to convert it to 
>one of several different formats that Max can import (obj, dae, etc.), 
>but I also need the texture that is embedded. Can anyone point me in the 
>right direction as to how to extract a texture that is embedded in an 
>.ive file?
>
>Thanks,
>
>Doug
>_______________________________________________
>osg-users mailing list
>osg-users@lists.openscenegraph.org
>http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
</pre><br><!-- footer --><br><hr>
<a style="font-size:14px;line-height:15px; color:#000; text-decoration:none" href="http://tx2.163.com/fab.html" target="_blank"><span style="text-decoration:underline; color:blue">网易首款免费3D网游“天下2”,6月6日激情公测</span> </a>