本文整理汇总了C++中ProgressBar::forceUpdate方法的典型用法代码示例。如果您正苦于以下问题:C++ ProgressBar::forceUpdate方法的具体用法?C++ ProgressBar::forceUpdate怎么用?C++ ProgressBar::forceUpdate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ProgressBar
的用法示例。
在下文中一共展示了ProgressBar::forceUpdate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadImageSequence
void ImageSequenceSource::loadImageSequence(const std::string& d)
throw (tgt::FileException, std::bad_alloc) {
if (!isInitialized()) {
LERROR("loadImageSequence(): not initialized");
return;
}
// important: d might be cleared by clearSequence
std::string dir(d);
forceReload_ = false;
if (!imageSequence_) {
LERROR("No image sequence present");
return;
}
// clear current sequence
clearSequence();
if (dir.empty())
return;
LINFO("Loading images from directory " << dir << " ...");
currentDir_ = dir;
imageDirectory_.set(dir);
// load images as textures and collect them in an image sequence
std::vector<std::string> filenames = tgt::FileSystem::readDirectory(dir, true, false);
// create progress bar
ProgressBar* progressDialog = 0;
if (showProgressBar_.get() && !filenames.empty()) {
progressDialog = VoreenApplication::app()->createProgressDialog();
if (progressDialog) {
progressDialog->setTitle("Loading Images");
progressDialog->show();
progressDialog->setProgress(0.f);
progressDialog->forceUpdate();
}
}
tgt::Texture::Filter filterMode = textureFiltering_.get() ? tgt::Texture::LINEAR : tgt::Texture::NEAREST;
for (size_t i=0; i<filenames.size(); ++i) {
if (progressDialog) {
progressDialog->setMessage("Loading " + filenames[i] + " ...");
progressDialog->setProgress(static_cast<float>(i) / static_cast<float>(filenames.size()));
}
LINFO("Loading image " << filenames[i] << " ...");
tgt::Texture* texture = TexMgr.load(dir + "/" + filenames[i], filterMode,
false, false, true, false, !GpuCaps.isNpotSupported());
if (texture)
imageSequence_->add(texture);
else
LWARNING("Failed to load image: " << filenames[i]);
}
LGL_ERROR;
// upload texture data
if (uploadTextureData_.get()) {
LINFO("Uploading texture data ...");
for (unsigned int i=0; i<imageSequence_->size(); i++)
imageSequence_->at(i)->uploadTexture();
LGL_ERROR;
}
// clear progress
if (progressDialog) {
progressDialog->hide();
delete progressDialog;
progressDialog = 0;
}
// output sequence
outport_.setData(imageSequence_);
LINFO("Successfully loaded " << imageSequence_->size() << " images.");
numImages_.set(imageSequence_->size());
LGL_ERROR;
}