本文整理汇总了C++中ImageResource::cubeTexture方法的典型用法代码示例。如果您正苦于以下问题:C++ ImageResource::cubeTexture方法的具体用法?C++ ImageResource::cubeTexture怎么用?C++ ImageResource::cubeTexture使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ImageResource
的用法示例。
在下文中一共展示了ImageResource::cubeTexture方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fromImageResource
/*!
Creates an ImageHeader from the given \a resource.
*/
ImageHeader ImageHeader::fromImageResource(const ImageResource &resource)
{
ImageHeader result;
if (resource.isNull())
return result;
result.setType(resource.type());
switch (resource.type()) {
case ImageResource::Type::Image:
result.setWidth(resource.image().width());
result.setHeight(resource.image().height());
result.setDepth(1);
result.setImageFormat(resource.image().format());
break;
case ImageResource::Type::CubeTexture:
result.setWidth(resource.cubeTexture().width());
result.setHeight(resource.cubeTexture().height());
result.setDepth(resource.cubeTexture().depth());
result.setImageFormat(resource.cubeTexture().format());
break;
case ImageResource::Type::VolumeTexture:
result.setWidth(resource.volumeTexture().width());
result.setHeight(resource.volumeTexture().height());
result.setDepth(resource.volumeTexture().depth());
result.setImageFormat(resource.volumeTexture().format());
break;
default:
break;
}
return result;
}
示例2: main
int main(int argc, char *argv[])
{
ImageIO reader("texture.dds");
const auto result = reader.read();
// if (!result.first) ...
const auto &contents = result.second;
for (int index = 0; index < contents.header().imageCount(); ++index) { // read array
for (int level = 0; level < contents.header().mipmapCount(); ++level) { // read mipmaps
ImageResource resource = contents.resource(index, level);
if (resource.type() == ImageResource::Type::Image) {
const QImage image = resource.image();
// ...
} else if (resource.type() == ImageResource::Type::CubeTexture) {
CubeTexture texture = resource.cubeTexture();
// ...
} else if (resource.type() == ImageResource::Type::VolumeTexture) {
VolumeTexture texture = resource.volumeTexture();
// ...
}
}
}
ImageExifMeta exif = contents.exifMeta();
if (!exif.isEmpty()) {
// ...
}
return 0;
}