本文整理汇总了C++中osg::Image::getOrigin方法的典型用法代码示例。如果您正苦于以下问题:C++ Image::getOrigin方法的具体用法?C++ Image::getOrigin怎么用?C++ Image::getOrigin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类osg::Image
的用法示例。
在下文中一共展示了Image::getOrigin方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: local_writeImage
//.........这里部分代码省略.........
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;
case 2:
case GL_LUMINANCE_ALPHA:
hdr.set_components(type, type);
break;
case 3:
case GL_RGB:
hdr.set_components(type, type, type);
break;
case 4:
case GL_RGBA:
hdr.set_components(type, type, type, type);
break;
default:
my_errmsg = "Image has unsupported pixel format";
throw std::exception();
}
if (img.getPacking() != 1)
{
my_errmsg = "Image has unsupported packing";
throw std::exception();
}
hdr.write_to(fout);
#if 0 /* Does not seem to be necessary */
if (img.t() > 1 && img.getOrigin() == osg::Image::BOTTOM_LEFT)
{
int depth = (img.r() >= 1 ? img.r() : 1);
const unsigned char* data = static_cast<const unsigned char*>(img.getDataPointer());
size_t row_size = hdr.element_size() * img.s();
gta::io_state io_state;
for (int k = 0; k < depth; k++)
{
const unsigned char* slice = data + k * (row_size * img.t());
for (int j = 0; j < img.t(); j++)
{
const unsigned char* p = slice + (img.t() - 1 - j) * row_size;
hdr.write_elements(io_state, fout, img.s(), p);
}
}
}
else
{
hdr.write_data(fout, img.getDataPointer());
}
#endif
hdr.write_data(fout, img.getDataPointer());
}