OpenSceneGraph | OSG如何存储带纹理osgb格式可以节省空间
在使用OSG(OpenSceneGraph)存储带纹理osgb格式的过程中,大家会遇到这样一种情况:存储后的osgb文件所占用的大小远大于原始文件的大小,几倍至几十倍。这是为何呢?原因是OSG默认的存储格式是不压缩存储,所以解决方案就是设置参数将存储格式改为压缩存储。方法如下:
osg::ref_ptr<osgDB::ReaderWriter::Options> options = new osgDB::ReaderWriter::Options;
options->setOptionString("WriteImageHint=IncludeFile"); // 设置压缩
osgDB::writeNodeFile(*(node.get()), osgb_path, options);
如下文档可以找到解决方法的来源:
$ osgconv --format osgb
Plugin osgPlugins-3.3.9/osgdb_osg.so
{
ReaderWriter : OSG Reader/Writer
{
features : readObject readNode writeObject writeNode
extensions : .osg OpenSceneGraph Ascii file format
extensions : .osgs Pseudo OpenSceneGraph file loaded, with file encoded in filename string
options : OutputTextureFiles Write out the texture images to file
options : includeExternalReferences Export option
options : precision Set the floating point precision when writing out files
options : writeExternalReferenceFiles Export option
}
ReaderWriter : OpenSceneGraph Native Format Reader/Writer
{
features : readObject readImage readNode writeObject writeImage writeNode
extensions : .osg2 OpenSceneGraph extendable format
extensions : .osgb OpenSceneGraph extendable binary format
extensions : .osgt OpenSceneGraph extendable ascii format
extensions : .osgx OpenSceneGraph extendable XML format
options : Ascii Import/Export option: Force reading/writing ascii file
options : Compressor=<name> Export option: Use an inbuilt or user-defined compressor
options : ForceReadingImage Import option: Load an empty image instead if required file missed
options : SchemaData Export option: Record inbuilt schema data into a binary file
options : SchemaFile=<file> Import/Export option: Use/Record an ascii schema file
options : 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 fi
lename; <WriteOut> writes Image::data() to disk as external file.
options : XML Import/Export option: Force reading/writing XML file
}
}
上面文档中,有关WriteImageHint的项的描述(第26行):选择IncludeData是直接写入数据,无压缩,是默认选项。而includeFile则是写入流,按我的理解,就是将原始的影像数据流原原本本的写入osgb,原始的影像是压缩过的,比如jpg格式,那保存出来的osgb就是压缩过的。因此,将WriteImageHint设置为IncludeFile可以解决OSG存储带纹理osgb格式数据量大的问题,节省空间。
OpenSceneGraph | OSG如何存储带纹理osgb格式可以节省空间的更多相关文章
- Unity3D学习笔记2——绘制一个带纹理的面
目录 1. 概述 2. 详论 2.1. 网格(Mesh) 2.1.1. 顶点 2.1.2. 顶点索引 2.2. 材质(Material) 2.2.1. 创建材质 2.2.2. 使用材质 2.3. 光照 ...
- MySQL 存储php中json_encode格式中文问题及解决
MySQL 存储php中json_encode格式信息 ,遇到中文时, 会变成一堆类似uxxxx信息. 1. 原因分析:在存储到数据库时!MySQL 不会存储 unicode 字符: MySQL 仅 ...
- supermap中预览osgb格式的倾斜摄影文件
参考: https://zhidao.baidu.com/question/136723493545478005.html 使用的是SuperMap IDesktop 9D,操作方法如下: 打开超图, ...
- js 处理Json 时间带T 时间格式
对于后台传过来的json数据是带T时间格式的坑处理的一些做法总结 new Date(data[j].addtime).toISOString().replace(/T/g, ' ').replace( ...
- Apache Hive 存储方式、压缩格式
简介: Apache hive 存储方式跟压缩格式! 1.Text File hive> create external table tab_textfile ( host string com ...
- GIS开源库OpenSceneGraph(OSG)、OSGEarth、GDAL、Qt、CGAL、Boost
GIS开源有这些库:OpenSceneGraph(OSG).OSGEarth.GDAL.Qt.CGAL.Boost
- PCL Save VTK File With Texture Coordinates 使用PCL库来保存带纹理坐标的VTK文件
我之前有一篇博客Convert PLY to VTK Using PCL 1.6.0 or PCL 1.8.0 使用PCL库将PLY格式转为VTK格式展示了如何将PLY格式文件转化为VTK格式的文件, ...
- [粒子特效]osg的自带粒子系统osgParticle::ParticleSystem
osgParticle示例简单的演示了在osg中使用粒子系统的效果,用到了osgParticle库中的相关类,在osgParticle中主要有: (以下部分材料摘取自osg向场景中添加osgParti ...
- Python的小数据存储,用什么格式更有逼格?
小数据存储 我们在编写代码的时候,经常会涉及到数据存储的情况,如果是爬虫得到的大数据,我们会选择使用数据库,或者excel存储.但如果只是一些小数据,或者说关联性较强且存在存储后复用的数据,我们该如何 ...
随机推荐
- Delphi 滚动条的使用
DELPHI的滚动条默认发送消息格式: function TControl.Perform( Msg: Cardinal; WParam: WPARAM; LParam: LPARAM): LRESU ...
- 【LeetCode 25】K 个一组翻转链表
题目链接 [题解] 模拟就好. 就k个k个节点地翻转. 每个节点都把next域指向它前面那个节点 修改完之后把这个节点前面的那个节点的next域改成这一段的最后一个节点. 然后把这一段最左边的那个节点 ...
- Wannafly Winter Camp Day8(Div1,onsite) E题 Souls-like Game 线段树 矩阵乘法
目录 Catalog Solution: (有任何问题欢迎留言或私聊 && 欢迎交流讨论哦 Catalog @ Problem:传送门 Portal 原题目描述在最下面. 简单的 ...
- Java-Class-@I:java.annotation.Resource
ylbtech-Java-Class-@I:java.annotation.Resource 1.返回顶部 2.返回顶部 1.1. import javax.annotation.Resource ...
- Git 学习第二天(三)
删除文件: 先新建一个test文件到webgit版本库中,然后 git add git commit 当然,我们可以在文件夹中删除文件,git 也提供了命令 rm file 此时 ...
- Netty 源码分析——ChannelPipeline
Netty 源码分析--ChannelPipeline 通过前面的两章我们分析了客户端和服务端的流程代码,其中在初始化 Channel 的时候一定会看到一个 ChannelPipeline.所以在 N ...
- HTML5 placeholder实际应用经验分享及拓展
QQ邮箱登陆(http://mail.qq.com) 如下截图啦: 我在上面一个demo类似原理上做了下修改,制作了一个这样子交互效果的demo,希望对有兴趣的同行能帮上点忙,您可以狠狠地点击这里:透 ...
- ubuntu 搭建嵌入式开发环境tftp的方法
网上很多安装的时候都要安装tftpd-hpa tftp-hpa xinetd三个安装包,经我测试,xinetd无需安装,安装好前两个后,修改tftpd-hpa的配置文件即可:etc/default/t ...
- 自定义hive文件和记录格式及文本文件数据编码
(1)一段 建表语句: [ROW FORMAT row_format] [STORED AS file_format] | STORED BY 'storage.handler.class.name' ...
- 基于Python玩转人工智能最火框架 TensorFlow应用实践✍✍✍
基于Python玩转人工智能最火框架 TensorFlow应用实践 随着 TensorFlow 在研究及产品中的应用日益广泛,很多开发者及研究者都希望能深入学习这一深度学习框架.而在昨天机器之心发起 ...