zoukankan      html  css  js  c++  java
  • 添加TLBB模型动画需要对OGRE添加的代码段

    要能正确加载TLBB模型动画在OgreSkeletonSerializer.cpp中readAnimationTrack添加如下代码

    void SkeletonSerializer::readAnimationTrack(DataStreamPtr& stream, Animation* anim, Skeleton* pSkel)

    {

      (省略)

      。。。

    // Keep looking for nested keyframes

    if (!stream->eof())

    {

      unsigned short streamID = readChunk(stream);

      while( (streamID == SKELETON_ANIMATION_TRACK_KEYFRAME || 

           streamID == 0x4120 ) && !stream->eof() )

      {

        if (streamID == 0x4120 )

        {

          //新增代码

          unsigned short len;

          unsigned short flags;

          readShorts(stream, &len, 1);

          readShorts(stream, &flags, 1);
          float time;

          for (int i = 0; i < len; i += 1)

          {

            readFloats(stream, &time, 1);

            TransformKeyFrame *kf = pTrack->createNodeKeyFrame(time);
            Quaternion rot = Quaternion::IDENTITY;

            if (flags & 1)

            {

              readObject(stream, rot);

            }

            kf->setRotation(rot);
            Vector3 trans = Vector3::ZERO;

            if (flags & 2)

            {

              readObject(stream, trans);

            }

            kf->setTranslate(trans);

                          Vector3 scale = Vector3::UNIT_SCALE;

            if (flags & 4)

            {

              readObject(stream, scale);

            }

            kf->setScale(scale);

          }

        }

        else

        {

          readKeyFrame(stream, pTrack, pSkel);

        }

        if (!stream->eof())

        {

          // Get next stream

          streamID = readChunk(stream);

        }

      }
      if (!stream->eof())

      {

        // Backpedal back to start of this stream if we've found a non-keyframe

        stream->skip(-STREAM_OVERHEAD_SIZE);

      }

    }

    。。。

    }

  • 相关阅读:
    Halcon 如何将图像转化为矩阵形式
    Halcon 图像分割
    Halcon intensity算子,用于计算灰度的均值和方差
    Halcon draw_region接口
    Halcon scale_image 函数用法技巧
    Halcon 保存图像
    Halcon 读取多张图片
    Halcon 算子 sub_image add_image mult_image div_image
    Halcon 算子 get_grayval 用于读取图像的灰度值
    Halcon 算子 convert_image_type 转换图像类型
  • 原文地址:https://www.cnblogs.com/LinuxHunter/p/1884883.html
Copyright © 2011-2022 走看看