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


C++ TimeRange::getVisibleStartTime方法代码示例

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


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

示例1:

void
PlayerSceneCreate::applyTransitionAnimation(SceneNodePtr start_node, SceneNodePtr end_node,
        const PlayerItemPtr item, const TimeRange &time_range,
        SceneNode *middle_node)
{
    Time beginTime = time_range.getVisibleStartTime();
    Time endTime = time_range.getVisibleEndTime();

    // TODO: check for whether the difference between begin and end time is enough for the
    // duration of the two transitions. Should have been checked by whoever set up the
    // the PlayerTimeline earlier.

    const TransitionPtr trans = item->getStartTransition();
    // Add in the animations based on the begin transition
    if (trans) {
        trans->addKeysForNextItem(start_node.get(), beginTime, beginTime + Time::Seconds(trans->getDuration()), middle_node);
    }

    const TransitionPtr endTrans = item->getEndTransition();
    // Add in the animations based on the end transition
    if (endTrans)  {
        endTrans->addKeysForPreviousItem(end_node.get(), endTime - Time::Seconds(endTrans->getDuration()), endTime, middle_node);
    }
}
开发者ID:CaringLabs,项目名称:MediaFramework,代码行数:24,代码来源:PlayerSceneCreate.cpp

示例2: switch


//.........这里部分代码省略.........
    set_node_gravity(node.get(), gravity);

    // Cropping region, default of "no crop" is (0,0,1,1)
    float cx = 0, cy = 0, cw = 1, ch = 1;
    item->getCroppingRegion(cx, cy, cw, ch);
    node->setCroppingRegion(cx, cy, cw, ch);

    // Focus of subregion when aspect fitting subregions
    float fx = 0.5f, fy = 0.3333f;
    item->getFocusCenter(fx, fy);
    node->setFocusCenter(fx, fy);

    // Frame preserves size when image resizes
    const FrameInfo &framing = item->getFraming();
    if (framing.hasFraming()) {
        BorderWidths frame_size, frame_uvs;
        framing.getFrameSize(frame_size.left, frame_size.right, frame_size.top, frame_size.bottom);
        framing.getFrameUVs(frame_uvs.left, frame_uvs.right, frame_uvs.top, frame_uvs.bottom);
        node->setFrameBorder(frame_size, frame_uvs);
    }

    // Blend mode enumeration
    BlendMode blendMode = item->getBlendMode();
    set_node_blend_mode(node.get(), blendMode);

    // Set zorder, when static
    node->setZOrder(item->getZOrder());

    // Set static opacity
    node->setOpacity(item->getOpacity());

    // This controls when videos start playing.
    // NOTE: if the transition expands the visible time, should the
    // video be playing during this time? Right now, it is set
    // so that the video holds the first or last frame during the
    // extra transition time.
    //
    mf::Time playbackStartOffset = time_range.getItemStartTime()+Time::Seconds(item->getPlaybackStart());
    node->setLocalTimeOffset(playbackStartOffset);

    //NOTE This isn't the way I want to keep track of local time. I want it to
    // be handled by the Preloader later.
    if (node->getAsset() != NULL)
        node->getAsset()->setLocalTimeOffset(playbackStartOffset);

    // Create keys for the animation for this item, if it exists
    const AnimationPtr animation = item->getAnimation();
    if (animation) {
        Time anim_begin, anim_end;
        switch(animation->getTiming()) {
        default:
        case Animation::INNER_TIME_RANGE:
            // Internal time range is the time when the item is visible and
            // is not running part of the transition animation.
            anim_begin = time_range.getInternalStartTime();
            anim_end = time_range.getInternalEndTime();
            break;
        case Animation::ITEM_TIMING:
            anim_begin = time_range.getItemStartTime();
            anim_end = time_range.getItemEndTime();
            break;
        case Animation::OUTER_TIME_RANGE:
            anim_begin = time_range.getVisibleStartTime();
            anim_end = time_range.getVisibleEndTime();
            break;
        }

        // Make sure there is really time between the transitions in order to play an animation
        if (anim_begin < anim_end) {
            animation->addKeysToNode(node.get(), anim_begin, anim_end);
        }
    }

    // Add in the filter effects based on the transitions
    applyTransitionEffects(node, item, time_range);

    // Transfer camera
    if (item->getCamera()) {
        CameraViewPtr camera_view = item->getCamera();
        CameraObjectPtr camera_object;

        const auto it = _cameraShareMap.find(camera_view);
        if (it != _cameraShareMap.end()) {
            camera_object = it->second;
        } else {
            camera_object.reset(new CameraNode());
            _cameraShareMap[camera_view] = camera_object;  // store for sharing

            // Transfer properties
            camera_view->setProperties(camera_object.get());

            // Add animation to camera
            camera_view->addKeysToNode(camera_object.get(), time_range.getItemStartTime(), time_range.getItemEndTime());
        }

        // Give camera to node
        node->setCamera(camera_object);
    }

}
开发者ID:CaringLabs,项目名称:MediaFramework,代码行数:101,代码来源:PlayerSceneCreate.cpp

示例3: if

void
PlayerSceneCreate::applyTransitionEffects(SceneNodePtr node, const PlayerItemPtr item, const TimeRange &time_range)
{
    Time beginTime = time_range.getVisibleStartTime();
    Time endTime = time_range.getVisibleEndTime();

    const TransitionPtr trans = item->getStartTransition();
    // Add in the animations based on the begin transition
    if (trans) {

        const Time end = beginTime + Time::Seconds(trans->getDuration());
        FilterEffectPtr filter = trans->getFilterForNextItem();
        if (filter) {
            EffectNodeCreateInfo createInfo;
            createInfo.sourceAsset = node->getAsset();
            // reversing end and start times, effect time goes from 1->0
            createInfo.animBegin = end - time_range.getItemStartTime();
            createInfo.animEnd = beginTime - time_range.getItemStartTime();
            createInfo.shareNonStatic = false;
            createInfo.nodeCreator = std::bind(&PlayerSceneCreate::
                                               createOrShareNodeNetwork,
                                               this,
                                               std::placeholders::_1,
                                               std::placeholders::_2);

            // Create effect network for the transition filter
            ShaderNodePtr shader;
            EffectNodeNetworkPtr network = createOrShareNodeNetwork(filter, createInfo);
            if (network->getNetworkType() == IMAGE) {
                // Connect the shader to the output of this network
                ImageAsset *filterNetworkOutput = network->getImage();
                shader = node->addRendererKey(beginTime, filter->getRendererId());
                shader->setSourceImage(filterNetworkOutput);
            }
            else if (network->getNetworkType() == SHADER) {
                shader = ShaderNodePtr(network->getShader());
                // Start transition filter's shader at begin time
                node->addRendererKey(beginTime, shader);
            }

            // After transition, go back to regular renderer (id ==0)
            node->addDefaultRendererKey(end);

            // Animate the transition
            node->addEffectTimeKey(beginTime, 1.0f);
            node->addEffectTimeKey(end, 0.0f);
        }
    }

    const TransitionPtr endTrans = item->getEndTransition();
    // Add in the animations based on the end transition
    if (endTrans)  {

        Time start = endTime - Time::Seconds(endTrans->getDuration());

        FilterEffectPtr filter = endTrans->getFilterForPreviousItem();
        if (filter) {
            EffectNodeCreateInfo createInfo;
            createInfo.sourceAsset = node->getAsset();
            createInfo.animBegin = start - time_range.getItemStartTime();
            createInfo.animEnd = endTime - time_range.getItemStartTime();
            createInfo.shareNonStatic = false;
            createInfo.nodeCreator = std::bind(&PlayerSceneCreate::createOrShareNodeNetwork,
                                               this,
                                               std::placeholders::_1,
                                               std::placeholders::_2);

            // Create effect network for the transition filter
            ShaderNodePtr shader;
            EffectNodeNetworkPtr network = createOrShareNodeNetwork(filter, createInfo);
            if (network->getNetworkType() == IMAGE) {
                // Connect the shader to the output of this network
                ImageAsset *filterNetworkOutput = network->getImage();
                shader = node->addRendererKey(start, filter->getRendererId());
                shader->setSourceImage(filterNetworkOutput);
            }
            else if (network->getNetworkType() == SHADER) {
                shader = ShaderNodePtr(network->getShader());
                // Start transition filter's shader at start time
                node->addRendererKey(start, shader);
            }

            // Animate the transition
            node->addEffectTimeKey(start, 0.0f);
            node->addEffectTimeKey(endTime, 1.0f);
        }

    }

}
开发者ID:CaringLabs,项目名称:MediaFramework,代码行数:90,代码来源:PlayerSceneCreate.cpp


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