当前位置: 首页>>代码示例>>C++>>正文


C++ ProgressBar::setProgress方法代码示例

本文整理汇总了C++中ProgressBar::setProgress方法的典型用法代码示例。如果您正苦于以下问题:C++ ProgressBar::setProgress方法的具体用法?C++ ProgressBar::setProgress怎么用?C++ ProgressBar::setProgress使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ProgressBar的用法示例。


在下文中一共展示了ProgressBar::setProgress方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: setupProps

KDvoid Sample_Fresnel::setupProps ( KDvoid )
{
    Entity*  pEntity;
    
    // setting up props might take a while, so create a progress bar for visual feedback
    ProgressBar*  pProgress = m_pTrayMgr->createProgressBar ( TL_CENTER, "FresnelBuildingBar", "Creating Props...", 280, 100 );
    m_pTrayMgr->showBackdrop ( "SdkTrays/Shade" );

    pProgress->setComment ( "Upper Bath" );
    pEntity = m_pSceneMgr->createEntity ( "UpperBath", "RomanBathUpper.mesh" );
    m_pSceneMgr->getRootSceneNode()->attachObject ( pEntity );
    m_aSurfaceEnts.push_back ( pEntity );
    pProgress->setProgress ( 0.4 );
 
    pProgress->setComment("Columns");
    pEntity = m_pSceneMgr->createEntity ( "Columns", "columns.mesh" );
    m_pSceneMgr->getRootSceneNode ( )->attachObject ( pEntity );
    m_aSurfaceEnts.push_back ( pEntity );
    pProgress->setProgress ( 0.5 );

    pProgress->setComment ( "Ogre Head" );
    pEntity = m_pSceneMgr->createEntity ( "Head", "ogrehead.mesh" );
    pEntity->setMaterialName ( "RomanBath/OgreStone" );
    m_aSurfaceEnts.push_back ( pEntity );
    pProgress->setProgress ( 0.6 );
    
    SceneNode*  pHeadNode = m_pSceneMgr->getRootSceneNode ( )->createChildSceneNode ( );
    pHeadNode->setPosition ( -350, 55, 130 );
    pHeadNode->yaw ( Degree ( 90 ) );
    pHeadNode->attachObject ( pEntity );

    pProgress->setComment ( "Lower Bath" );
    pEntity = m_pSceneMgr->createEntity ( "LowerBath", "RomanBathLower.mesh" );
    m_pSceneMgr->getRootSceneNode ( )->attachObject ( pEntity );
    m_aSubmergedEnts.push_back( pEntity );
    pProgress->setProgress ( 1 );

    m_pTrayMgr->destroyWidget ( pProgress );
    m_pTrayMgr->hideBackdrop ( );
}
开发者ID:mcodegeeks,项目名称:OpenKODE-Framework,代码行数:40,代码来源:Fresnel.cpp

示例2: readConvert

VolumeFlow3D* FlowReader::readConvert(const tgt::ivec3& dimensions, const BYTE orientation,
                                      std::fstream& ifs)
{
    tgt::ivec3 permutation = Flow3D::getAxisPermutation(orientation);
    switch (orientation) {
        case Flow3D::XZY:
            LINFO("voxel order: XZY (code = " << static_cast<int>(orientation) << ")");
            LINFO("changing voxel order from XZY to XYZ...");
            break;
        case Flow3D::YXZ:
            LINFO("voxel order: YXZ (code = " << static_cast<int>(orientation) << ")");
            LINFO("changing voxel order from YXZ to XYZ...");
            break;
        case Flow3D::YZX:
            LINFO("voxel order: YZX (code = " << static_cast<int>(orientation) << ")");
            LINFO("changing voxel order from YZX to XYZ...");
            break;
        case Flow3D::ZXY:
            LINFO("voxel order: ZXY (code = " << static_cast<int>(orientation) << ")");
            LINFO("changing voxel order from ZXY to XYZ...");
            break;
        case Flow3D::ZYX:
            LINFO("voxel order: ZYX (code = " << static_cast<int>(orientation) << ")");
            LINFO("changing voxel order from ZYX to XYZ...");
            break;
        case Flow3D::XYZ:
            LINFO("voxel order: XYZ (code = " << static_cast<int>(orientation) << ")");
            LINFO("no conversion of voxel order required.");
            break;
        default:
            LINFO("voxel order: unknown (code = " << static_cast<int>(orientation) << ")");
            LINFO("further processing not possible! canceling");
            return 0;
    }

    const size_t numVoxels = dimensions.x * dimensions.y * dimensions.z;
    const size_t byteSize = numVoxels * sizeof(tgt::vec3);

    tgt::vec3* voxels = 0;
    try {
        voxels = new tgt::vec3[numVoxels];
    } catch (std::bad_alloc) {
        throw;
    }

    const tgt::ivec3 xyz(0, 1, 2);  // target voxel order is XYZ
    const int max = tgt::max(dimensions);

    // no remainder possible because getNumBytes is a multiple of max
    //
    const size_t bufferByteSize = byteSize / static_cast<size_t>(max);
    const size_t numBufferElements = bufferByteSize / sizeof(tgt::vec3);
    tgt::vec3* buffer = new tgt::vec3[numBufferElements];
    memset(buffer, 0, bufferByteSize);

    ProgressBar* progress = getProgressBar();

    tgt::ivec3 pos(0, 0, 0);
    float maxValue = std::numeric_limits<float>::min();
    float minValue = std::numeric_limits<float>::max();
    float maxMagnitude = 0.0f;

    for (size_t i = 0; i < size_t(max); ++i) {
        ifs.read(reinterpret_cast<char*>(buffer), bufferByteSize);
        if (progress)
            progress->setProgress(static_cast<float>(i) / static_cast<float>(max));

        for (size_t j = 0; j < numBufferElements; ++j) {
            // get the number of the voxel in current data orientation
            //
            size_t voxelNumber = j + (i * numBufferElements);

            if (orientation != Flow3D::XYZ) {
                // convert the number into the position within the voxel
                // ((x, y, z)-coordinates in volume's bounding box)
                //
                pos = Flow3D::voxelNumberToPos(voxelNumber, permutation, dimensions);

                // re-calculate the number of the voxel for the desired
                // data orientation
                //
                size_t newNumber = Flow3D::posToVoxelNumber(pos, xyz, dimensions);
                voxels[newNumber] = buffer[j];
            } else
                voxels[voxelNumber] = buffer[j];

            // calculate max and min of current voxel and dataset's min and max.
            //
            float voxelMax = tgt::max(buffer[j]);
            float voxelMin = tgt::min(buffer[j]);
            float magnitude = tgt::length(buffer[j]);

            if (voxelMax > maxValue)
                maxValue = voxelMax;
            if (voxelMin < minValue)
                minValue = voxelMin;
            if (magnitude > maxMagnitude)
                maxMagnitude = magnitude;
        }
    }
//.........这里部分代码省略.........
开发者ID:bsmr-opengl,项目名称:voreen,代码行数:101,代码来源:flowreader.cpp

示例3: 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;
}
开发者ID:alvatar,项目名称:smartmatter,代码行数:81,代码来源:imagesequencesource.cpp


注:本文中的ProgressBar::setProgress方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。