- Timestamp:
- 03/17/10 15:33:47 (3 years ago)
- Location:
- OpenSceneGraph/branches/OpenSceneGraph-2.8
- Files:
-
- 3 modified
-
. (modified) (1 prop)
-
src/osgPlugins (modified) (1 prop)
-
src/osgPlugins/ac/ac3d.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/branches/OpenSceneGraph-2.8
- Property svn:mergeinfo
-
old new 1 1 /OpenSceneGraph/branches/OpenSceneGraph-2.8.2:10664 2 /OpenSceneGraph/trunk:9769,9879-9880,9895,9932,10 208,10340,10417,10456,10487,10622-10623,10625,10671-10672,10697,10722,10753,10788,10818,10854-10855,10858,10887,10891,10923,10933,11019,11032,11034-11035,11111,11127,111312 /OpenSceneGraph/trunk:9769,9879-9880,9895,9932,10010,10208,10340,10417,10456,10487,10622-10623,10625,10671-10672,10697,10722,10753,10758,10788,10818,10854-10855,10858,10887,10891,10923,10933,11019,11032,11034-11035,11111,11127,11131,11175
-
- Property svn:mergeinfo
-
OpenSceneGraph/branches/OpenSceneGraph-2.8/src/osgPlugins
- Property svn:mergeinfo
-
old new 1 1 /OpenSceneGraph/branches/OpenSceneGraph-2.8.2/src/osgPlugins:10664 2 2 /OpenSceneGraph/trunk:10539 3 /OpenSceneGraph/trunk/src/osgPlugins:9769,9879-9880,9895,9932,10 208,10340,10417,10456,10487,10622-10623,10625,10671-10672,10697,10722,10753,10788,10818,10854-10855,10858,10887,10891,10923,10933,11019,11032,11034-11035,11111,11127,111313 /OpenSceneGraph/trunk/src/osgPlugins:9769,9879-9880,9895,9932,10010,10208,10340,10417,10456,10487,10622-10623,10625,10671-10672,10697,10722,10753,10758,10788,10818,10854-10855,10858,10887,10891,10923,10933,11019,11032,11034-11035,11111,11127,11131,11175
-
- Property svn:mergeinfo
-
OpenSceneGraph/branches/OpenSceneGraph-2.8/src/osgPlugins/ac/ac3d.cpp
r9527 r11238 166 166 virtual WriteResult writeNode(const osg::Node& node,std::ostream& fout, const Options* opts) const 167 167 { 168 try 169 { 170 // write ac file. 171 if(dynamic_cast<const osg::Group*>(&node)) { 172 const osg::Group *gp=dynamic_cast<const osg::Group*>(&node); 173 const unsigned int nch=gp->getNumChildren(); 174 for (unsigned int i=0; i<nch; i++) { 175 writeNode(*(gp->getChild(i)), fout, opts); 176 } 177 } 178 else 179 osg::notify(osg::WARN)<<"File must start with a geode "<<std::endl; 180 fout.flush(); 181 return WriteResult::FILE_SAVED; 182 } 183 catch(ac3d::Exception e) 184 { 185 osg::notify(osg::WARN)<<"Error parsing OSG tree: "<< e.getError() << std::endl; 186 } 187 return WriteResult::FILE_NOT_HANDLED; 188 168 // write ac file. 169 if(dynamic_cast<const osg::Group*>(&node)) 170 { 171 const osg::Group *gp=dynamic_cast<const osg::Group*>(&node); 172 const unsigned int nch=gp->getNumChildren(); 173 for (unsigned int i=0; i<nch; i++) 174 { 175 writeNode(*(gp->getChild(i)), fout, opts); 176 } 177 } 178 else 179 osg::notify(osg::WARN)<<"File must start with a geode "<<std::endl; 180 181 fout.flush(); 182 return WriteResult::FILE_SAVED; 189 183 } 190 184 private: … … 417 411 TextureData toTextureData(const std::string& texName) 418 412 { 413 // If it is already there, use this 419 414 TextureDataMap::iterator i = mTextureStates.find(texName); 420 if (i == mTextureStates.end()) 421 mTextureStates[texName].setTexture(texName, mOptions.get(), mModulateTexEnv.get()); 422 return mTextureStates[texName]; 415 if (i != mTextureStates.end()) 416 return i->second; 417 // Try to load that texture. 418 TextureData textureData; 419 textureData.setTexture(texName, mOptions.get(), mModulateTexEnv.get()); 420 if (textureData.valid()) { 421 mTextureStates[texName] = textureData; 422 return textureData; 423 } 424 // still no joy?, try with the stripped filename if this is different 425 // Try the pure file name if it is different 426 std::string simpleTexName = osgDB::getSimpleFileName(texName); 427 if (simpleTexName != texName) 428 return toTextureData(simpleTexName); 429 430 // Nothing that worked, return invalid data 431 return TextureData(); 423 432 } 424 433 … … 1167 1176 else if (token == "texture") { 1168 1177 // read the texture name 1169 std::string texname = readString(stream); 1170 1171 // strip absolute paths 1172 if (texname[0] == '/' || 1173 (isalpha(texname[0]) && texname[1] == ':')) { 1174 std::string::size_type p = texname.rfind('\\'); 1175 if (p != std::string::npos) 1176 texname = texname.substr(p+1, std::string::npos); 1177 p = texname.rfind('/'); 1178 if (p != std::string::npos) 1179 texname = texname.substr(p+1, std::string::npos); 1180 } 1181 1182 textureData = fileData.toTextureData(texname); 1178 textureData = fileData.toTextureData(readString(stream)); 1183 1179 } 1184 1180 else if (token == "texrep") {
