/// 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);
      }
    }
    /// 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];
    }
    /// 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);
      }
    }