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


C++ AvatarAudioStream::getAvatarBoundingBoxScale方法代码示例

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


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

示例1: box

AudioMixerClientData::IgnoreZone& AudioMixerClientData::IgnoreZoneMemo::get(unsigned int frame) {
    // check for a memoized zone
    if (frame != _frame.load(std::memory_order_acquire)) {
        AvatarAudioStream* stream = _data.getAvatarAudioStream();

        // get the initial dimensions from the stream
        glm::vec3 corner = stream ? stream->getAvatarBoundingBoxCorner() : glm::vec3(0);
        glm::vec3 scale = stream ? stream->getAvatarBoundingBoxScale() : glm::vec3(0);

        // enforce a minimum scale
        static const glm::vec3 MIN_IGNORE_BOX_SCALE = glm::vec3(0.3f, 1.3f, 0.3f);
        if (glm::any(glm::lessThan(scale, MIN_IGNORE_BOX_SCALE))) {
            scale = MIN_IGNORE_BOX_SCALE;
        }

        // quadruple the scale (this is arbitrary number chosen for comfort)
        const float IGNORE_BOX_SCALE_FACTOR = 4.0f;
        scale *= IGNORE_BOX_SCALE_FACTOR;

        // create the box (we use a box for the zone for convenience)
        AABox box(corner, scale);

        // update the memoized zone
        // This may be called by multiple threads concurrently,
        // so take a lock and only update the memo if this call is first.
        // This prevents concurrent updates from invalidating the returned reference
        // (contingent on the preconditions listed in the header).
        std::lock_guard<std::mutex> lock(_mutex);
        if (frame != _frame.load(std::memory_order_acquire)) {
            _zone = box;
            unsigned int oldFrame = _frame.exchange(frame, std::memory_order_release);
            Q_UNUSED(oldFrame);
        }
    }

    return _zone;
}
开发者ID:SeijiEmery,项目名称:hifi,代码行数:37,代码来源:AudioMixerClientData.cpp


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