本文整理汇总了C++中ImageLoader::WriteBinary方法的典型用法代码示例。如果您正苦于以下问题:C++ ImageLoader::WriteBinary方法的具体用法?C++ ImageLoader::WriteBinary怎么用?C++ ImageLoader::WriteBinary使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ImageLoader
的用法示例。
在下文中一共展示了ImageLoader::WriteBinary方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TextureProcessorMain
//.........这里部分代码省略.........
}
}
string extension = filename.substr(filename.find(".") + 1);
ImageLoader* loader = NULL;
if (extension == "jpg" || extension == "jpeg")
{
loader = new JpegLoader();
}
else if (extension == "png")
{
loader = new PngLoader();
}
else if (extension == "bmp")
{
loader = new BmpLoader();
}
/*ilInit();
ilEnable(IL_FILE_OVERWRITE);
ilEnable(IL_ORIGIN_SET);
ilSetInteger(IL_ORIGIN_MODE, IL_ORIGIN_UPPER_LEFT); */
auto startLoad = std::chrono::high_resolution_clock::now();
loader->Load(filename, reverseChannels == true ? ImageLoader::PixelChannelOrder::ORDER_BGR : ImageLoader::PixelChannelOrder::ORDER_RGB);
if (flipVertically)
loader->FlipVertically();
auto endLoad = std::chrono::high_resolution_clock::now();
long long timeLoad = std::chrono::duration_cast<std::chrono::milliseconds>(endLoad - startLoad).count();
//TextureLoader loader = TextureLoader(filename.c_str());
//std::cout << "timeLoad : " << timeLoad << "\n";
//loader.SetTextureFormat(texFormat);
auto startMip = std::chrono::high_resolution_clock::now();
if(generateMipmaps)
loader->GenerateMipmaps();
auto endMip = std::chrono::high_resolution_clock::now();
long long timeMip = std::chrono::duration_cast<std::chrono::milliseconds>(endMip - startMip).count();
// std::cout << "timeMip : " << timeMip << "\n";
if (!useMemory)
{
// Texture loaded, now write a binary file.
filename = strtok((char *)filename.c_str(), "."); // Remove the extension.
char* extension = strtok(NULL, ".");
// Get the new filename with extension .bbt
filename = strtok((char*)filename.c_str(), "."); // Remove the extension.
filename += ".bbt";
loader->WriteBinary(filename.c_str(), generateMipmaps);
delete loader;
}
else // Memory.
{
/*auto startMem = std::chrono::high_resolution_clock::now();
int totalSize = jpegLoader->GetTotalSizeToWrite();
char* memory = AllocateMem(totalSize);
jpegLoader->WriteMemory(memory, generateMipmaps);
auto endMem = std::chrono::high_resolution_clock::now();
auto timeMem = std::chrono::duration_cast<std::chrono::milliseconds>(endMem - startMem).count();
auto end = std::chrono::high_resolution_clock::now();
auto time = std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count();
SetBinary(memory);
return memory; */
return loader;
}
return 0;
}