本文整理汇总了C++中osg::Image::r方法的典型用法代码示例。如果您正苦于以下问题:C++ Image::r方法的具体用法?C++ Image::r怎么用?C++ Image::r使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类osg::Image
的用法示例。
在下文中一共展示了Image::r方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: local_writeImage
WriteResult local_writeImage(std::ostream& fout,const osg::Image& img,const osgDB::ReaderWriter::Options* options) const
{
std::string my_errmsg;
try
{
gta::header hdr;
gta::compression compression = gta::zlib;
if (options)
{
std::istringstream iss(options->getOptionString());
std::string opt;
std::string compressionMethod;
while (iss >> opt)
{
if (opt == "COMPRESSION")
{
iss >> compressionMethod;
}
};
if (compressionMethod == "NONE")
compression = gta::none;
else if (compressionMethod == "ZLIB")
compression = gta::zlib;
else if (compressionMethod == "ZLIB1")
compression = gta::zlib1;
else if (compressionMethod == "ZLIB2")
compression = gta::zlib2;
else if (compressionMethod == "ZLIB3")
compression = gta::zlib3;
else if (compressionMethod == "ZLIB4")
compression = gta::zlib4;
else if (compressionMethod == "ZLIB5")
compression = gta::zlib5;
else if (compressionMethod == "ZLIB6")
compression = gta::zlib6;
else if (compressionMethod == "ZLIB7")
compression = gta::zlib7;
else if (compressionMethod == "ZLIB8")
compression = gta::zlib8;
else if (compressionMethod == "ZLIB9")
compression = gta::zlib9;
else if (compressionMethod == "BZIP2")
compression = gta::bzip2;
else if (compressionMethod == "XZ")
compression = gta::xz;
}
hdr.set_compression(compression);
if (img.s() > 0 && img.t() <= 1 && img.r() <= 1)
{
hdr.set_dimensions(img.s());
}
else if (img.s() > 0 && img.t() > 1 && img.r() <= 1)
{
hdr.set_dimensions(img.s(), img.t());
}
else if (img.s() > 0 && img.t() > 1 && img.r() > 1)
{
hdr.set_dimensions(img.s(), img.t(), img.r());
}
else
{
my_errmsg = "Image has unsupported dimensions";
throw std::exception();
}
gta::type type;
switch (img.getDataType())
{
case GL_BYTE:
type = gta::int8;
break;
case GL_UNSIGNED_BYTE:
type = gta::uint8;
break;
case GL_SHORT:
type = gta::int16;
break;
case GL_UNSIGNED_SHORT:
type = gta::uint16;
break;
case GL_INT:
type = gta::int32;
break;
case GL_UNSIGNED_INT:
type = gta::uint32;
break;
case GL_FLOAT:
type = gta::float32;
break;
default:
my_errmsg = "Image has unsupported data type";
throw std::exception();
}
switch (img.getPixelFormat())
{
case 1:
case GL_DEPTH_COMPONENT:
case GL_LUMINANCE:
case GL_ALPHA:
hdr.set_components(type);
break;
//.........这里部分代码省略.........