osg osgDB::Options noTexturesInIVEFile ForceReadingImage dds_flip

osgDB::writeNodeFile(node, path, new osgDB::Options("noTexturesInIVEFile"));

noTexturesInIVEFile:选项可以在写ive模型文件的时候只写纹理文件对应的路径,而不是默认的将纹理数据写入ive文件

更多参数,可以查看ReaderWriterIVE.cpp文件中的定义

osg::Node* osgbNode=osgDB::readNodeFile(osgbModelFile, new osgDB::Options("ForceReadingImage"));

ForceReadingImage:选项只对osg2,osgb,osgt,osgx起作用,它可以在纹理文件不存在(或者读取失败)时,生成一张空的纹理对象osg::Image,并记录下纹理文件对应的路径

osg::Node* ddsImageNode=osgDB::readNodeFile(modelFile, new osgDB::Options("dds_flip"));

在读取模型中含有dds格式纹理的时候,需要用到这个选项。如果在命令行中使用osgviewer aaa.osg -O dds_flip

OSG自支持格式的升级版是在2010年提出的,它的目的是方便扩展、跨格式可持续更新且支持任何OSG已有的格式。比如它可以代表图片,可以代表heighfield,可以代表模型等等。

这个升级版的插件代码在此处: src/osgPlugins/osg/ReaderWriterOSG2.cpp and wrappers at src/osgWrappers/serializers.

它支持两种格式:

  • .osgb二进制格式
  • .osgt Ascii格式

支持的操作为:

  • WriteImageHint=<hint> (Export option) Hint of writing image to stream.
  • <IncludeData> writes Image::data() directly;
  • <IncludeFile> writes the image file itself to stream;
  • <UseExternal> writes only the filename;
  • <WriteOut> writes Image::data() to disk as external file.
  • # ./osgconv cow.osg cow.osgb -O WriteImageHint=IncludeData
    # ./osgviewer cow.osgb
  • osgDB::writeNodeFile(node, path, new osgDB::Options("WriteImageHint=WriteOut"));
原文地址:https://www.cnblogs.com/coolbear/p/4354150.html