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


C++ seq::resize方法代码示例

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


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

示例1: interpolateFrom

    /// Interpolate animation frame from two other frames.
    ///
    /// \param src Source frame (earlier).
    /// \param dst Destination frame (later).
    /// \param current_time Animation time.
    void interpolateFrom(const AnimationFrame &lhs, const AnimationFrame &rhs, float current_time)
    {
      unsigned bone_count = lhs.getBoneCount();
#if defined(USE_LD)
      if(rhs.getBoneCount() != bone_count)
      {
        std::ostringstream sstr;
        sstr << "cannot interpolate between frames of size " << bone_count << " and " << rhs.getBoneCount();
        BOOST_THROW_EXCEPTION(std::runtime_error(sstr.str()));
      }
#endif

      //std::cout << "resizing bones or not? " << m_bones.size() << " vs " << bone_count << std::endl;

      m_time = current_time;
      m_bones.resize(bone_count);

      for(unsigned ii = 0; (bone_count > ii); ++ii)
      {
        const BoneState &ll = lhs.getBoneState(ii);
        const BoneState &rr = rhs.getBoneState(ii);
        float ltime = lhs.getTime();
        float rtime = rhs.getTime();
        float mix_time = (current_time - ltime) / (rtime - ltime);
        vec3 mix_pos = mix(ll.getPosition(), rr.getPosition(), mix_time);
        quat mix_rot = mix(ll.getRotation(), rr.getRotation(), mix_time);

        //std::cout << "mix time: " << mix_time << ": " << mix_pos << " ; " << mix_rot << std::endl;

        m_bones[ii] = BoneState(mix_pos, mix_rot);
      }
    }
开发者ID:faemiyah,项目名称:faemiyah-demoscene_2016-08_80k-intro_my_mistress_the_leviathan,代码行数:37,代码来源:verbatim_animation_frame.hpp

示例2: getPass

    /// Get pass at index.
    ///
    /// Will create pass if not available.
    ///
    /// \param idx Pass index.
    /// \return Reference to pass.
    ObjectReferenceSeq& getPass(unsigned idx)
    {
      unsigned req_pass_count = idx + 1;

      if(m_objects.size() <= req_pass_count)
      {
        m_objects.resize(req_pass_count);
      }

      return m_objects[idx];
    }
开发者ID:faemiyah,项目名称:faemiyah-demoscene_2016-08_80k-intro_my_mistress_the_leviathan,代码行数:17,代码来源:verbatim_state.hpp

示例3: duplicate

    /// Duplicate from given frame.
    ///
    /// \param op Frame to duplicate.
    void duplicate(const AnimationFrame &op)
    {
      unsigned bone_count = op.getBoneCount();

      m_time = op.getTime();
      m_bones.resize(bone_count);

      for(unsigned ii = 0; (bone_count > ii); ++ii)
      {
        m_bones[ii] = op.getBoneState(ii);
      }
    }
开发者ID:faemiyah,项目名称:faemiyah-demoscene_2016-08_80k-intro_my_mistress_the_leviathan,代码行数:15,代码来源:verbatim_animation_frame.hpp


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