• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ animation::NodeTrackIterator类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中animation::NodeTrackIterator的典型用法代码示例。如果您正苦于以下问题:C++ NodeTrackIterator类的具体用法?C++ NodeTrackIterator怎么用?C++ NodeTrackIterator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: calcAnimationSize

    //---------------------------------------------------------------------
    size_t SkeletonSerializer::calcAnimationSize(const Skeleton* pSkel, const Animation* pAnim, SkeletonVersion ver)
    {
        size_t size = SSTREAM_OVERHEAD_SIZE;

        // Name, including terminator
        size += calcStringSize(pAnim->getName());
        // length
        size += sizeof(float);

        if ((int)ver > (int)SKELETON_VERSION_1_0)
        {
            if (pAnim->getUseBaseKeyFrame())
            {
                size += SSTREAM_OVERHEAD_SIZE;
                // char* baseAnimationName (including terminator)
                size += calcStringSize(pAnim->getBaseKeyFrameAnimationName());
                // float baseKeyFrameTime
                size += sizeof(float);
            }
        }

        // Nested animation tracks
        Animation::NodeTrackIterator trackIt = pAnim->getNodeTrackIterator();
        while(trackIt.hasMoreElements())
        {
            size += calcAnimationTrackSize(pSkel, trackIt.getNext());
        }

        return size;
    }
开发者ID:bsmr-c-cpp,项目名称:ogre,代码行数:31,代码来源:OgreSkeletonSerializer.cpp


示例2: writeAnimation

    //---------------------------------------------------------------------
    void XMLSkeletonSerializer::writeAnimation(TiXmlElement* animsNode, 
        const Animation* anim)
    {
        TiXmlElement* animNode = 
            animsNode->InsertEndChild(TiXmlElement("animation"))->ToElement();

        animNode->SetAttribute("name", anim->getName());
        animNode->SetAttribute("length", StringConverter::toString(anim->getLength()));
		
		// Optional base keyframe information
		if (anim->getUseBaseKeyFrame())
		{
			TiXmlElement* baseInfoNode = 
				animNode->InsertEndChild(TiXmlElement("baseinfo"))->ToElement();
			baseInfoNode->SetAttribute("baseanimationname", anim->getBaseKeyFrameAnimationName());
			baseInfoNode->SetAttribute("basekeyframetime", StringConverter::toString(anim->getBaseKeyFrameTime()));
		}

        // Write all tracks
        TiXmlElement* tracksNode = 
            animNode->InsertEndChild(TiXmlElement("tracks"))->ToElement();

        Animation::NodeTrackIterator trackIt = anim->getNodeTrackIterator();
        while (trackIt.hasMoreElements())
        {
            writeAnimationTrack(tracksNode, trackIt.getNext());
        }

    }
开发者ID:redkaras,项目名称:Demi3D,代码行数:30,代码来源:OgreXMLSkeletonSerializer.cpp


示例3: calcAnimationSize

    //---------------------------------------------------------------------
    size_t SkeletonSerializer::calcAnimationSize(const Skeleton* pSkel, 
        const Animation* pAnim)
    {
        size_t size = STREAM_OVERHEAD_SIZE;

        // Name, including terminator
        size += pAnim->getName().length() + 1;
        // length
        size += sizeof(float);

        // Nested animation tracks
		Animation::NodeTrackIterator trackIt = pAnim->getNodeTrackIterator();
		while(trackIt.hasMoreElements())
		{
            size += calcAnimationTrackSize(pSkel, trackIt.getNext());
        }

        return size;
    }
开发者ID:MrLobo,项目名称:El-Rayo-de-Zeus,代码行数:20,代码来源:OgreSkeletonSerializer.cpp


示例4: writeAnimation

    //---------------------------------------------------------------------
    void SkeletonSerializer::writeAnimation(const Skeleton* pSkel, 
        const Animation* anim)
    {
        writeChunkHeader(SKELETON_ANIMATION, calcAnimationSize(pSkel, anim));

        // char* name                       : Name of the animation
        writeString(anim->getName());
        // float length                      : Length of the animation in seconds
        float len = anim->getLength();
        writeFloats(&len, 1);

        // Write all tracks
        Animation::NodeTrackIterator trackIt = anim->getNodeTrackIterator();
        while(trackIt.hasMoreElements())
        {
            writeAnimationTrack(pSkel, trackIt.getNext());
        }

    }
开发者ID:MrLobo,项目名称:El-Rayo-de-Zeus,代码行数:20,代码来源:OgreSkeletonSerializer.cpp


示例5: writeAnimation

    //---------------------------------------------------------------------
    void SkeletonSerializer::writeAnimation(const Skeleton* pSkel, 
        const Animation* anim, SkeletonVersion ver)
    {
        writeChunkHeader(SKELETON_ANIMATION, calcAnimationSize(pSkel, anim, ver));

        // char* name                       : Name of the animation
        writeString(anim->getName());
        // float length                      : Length of the animation in seconds
        float len = anim->getLength();
        writeFloats(&len, 1);
        pushInnerChunk(mStream);
        {
        if ((int)ver > (int)SKELETON_VERSION_1_0)
        {
            if (anim->getUseBaseKeyFrame())
            {
                size_t size = SSTREAM_OVERHEAD_SIZE;
                // char* baseAnimationName (including terminator)
                    size += calcStringSize(anim->getBaseKeyFrameAnimationName());
                // float baseKeyFrameTime
                size += sizeof(float);
                
                writeChunkHeader(SKELETON_ANIMATION_BASEINFO, size);
                
                // char* baseAnimationName (blank for self)
                writeString(anim->getBaseKeyFrameAnimationName());
                
                // float baseKeyFrameTime
                float t = (float)anim->getBaseKeyFrameTime();
                writeFloats(&t, 1);
            }
        }

        // Write all tracks
        Animation::NodeTrackIterator trackIt = anim->getNodeTrackIterator();
        while(trackIt.hasMoreElements())
        {
            writeAnimationTrack(pSkel, trackIt.getNext());
        }
        }
        popInnerChunk(mStream);

    }
开发者ID:bsmr-c-cpp,项目名称:ogre,代码行数:44,代码来源:OgreSkeletonSerializer.cpp


示例6: writeAnimation

    //---------------------------------------------------------------------
    void XMLSkeletonSerializer::writeAnimation(TiXmlElement* animsNode, 
        const Animation* anim)
    {
        TiXmlElement* animNode = 
            animsNode->InsertEndChild(TiXmlElement("animation"))->ToElement();

        animNode->SetAttribute("name", anim->getName());
        animNode->SetAttribute("length", StringConverter::toString(anim->getLength()));

        // Write all tracks
        TiXmlElement* tracksNode = 
            animNode->InsertEndChild(TiXmlElement("tracks"))->ToElement();

        Animation::NodeTrackIterator trackIt = anim->getNodeTrackIterator();
        while (trackIt.hasMoreElements())
        {
            writeAnimationTrack(tracksNode, trackIt.getNext());
        }

    }
开发者ID:Strongc,项目名称:game-ui-solution,代码行数:21,代码来源:OgreXMLSkeletonSerializer.cpp


示例7: oldKf

void OgreSample19App::tweakSneakAnim()
{
	SkeletonPtr skel = SkeletonManager::getSingleton().load("jaiqua.skeleton",ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
	Animation * anim = skel->getAnimation("Sneak");
	Animation::NodeTrackIterator tracks = anim->getNodeTrackIterator();
	
	while(tracks.hasMoreElements())
	{
		NodeAnimationTrack * track = tracks.getNext();
		TransformKeyFrame oldKf(0,0);
		track->getInterpolatedKeyFrame(ANIM_CHOP,&oldKf);
		while (track->getKeyFrame(track->getNumKeyFrames()-1)->getTime() >= ANIM_CHOP - 0.3f)
		{
			track->removeKeyFrame(track->getNumKeyFrames()-1);
		}

		TransformKeyFrame * newKf = track->createNodeKeyFrame(ANIM_CHOP);
		TransformKeyFrame * startKf = track->getNodeKeyFrame(0);

		Bone * bone = skel->getBone(track->getHandle());

		if (bone->getName() == "Spineroot")
		{
			mSneakStartPos = startKf->getTranslate() + bone->getInitialPosition();
			mSneakEndPos = oldKf.getTranslate() + bone->getInitialPosition();
			mSneakStartPos.y = mSneakEndPos.y;
			newKf->setTranslate(oldKf.getTranslate());
			newKf->setRotation(oldKf.getRotation());
			newKf->setScale(oldKf.getScale());
		}
		else
		{
			newKf->setTranslate(startKf->getTranslate());
			newKf->setRotation(startKf->getRotation());
			newKf->setScale(startKf->getScale());
		}
	}
}
开发者ID:harr999y,项目名称:OgreFramework,代码行数:38,代码来源:OgreSample19.cpp


示例8: ExportSkeleton

void ModelConverter::ExportSkeleton( const Ogre::Skeleton* pSkeleton, const Ogre::String& filename )
{
	LogManager::getSingleton().logMessage("Populating DOM...");

	// Write main skeleton data
	LogManager::getSingleton().logMessage("Exporting bones..");

	DiMotionPtr mt = Demi::DiAssetManager::GetInstancePtr(
		)->CreateOrReplaceAsset<DiMotion>(pSkeleton->getName().c_str());
	DiSkeleton* skeleton = mt->CreateSkeleton();
	
	// save bones
	WriteSkeleton(pSkeleton,skeleton);

	LogManager::getSingleton().logMessage("Bones exported.");

	unsigned short numAnims = pSkeleton->getNumAnimations();
	String msg = "Exporting animations, count=" + StringConverter::toString(numAnims);
	LogManager::getSingleton().logMessage(msg);

	// save animations
	for (unsigned short i = 0; i < numAnims; ++i)
	{
		Animation* pAnim = pSkeleton->getAnimation(i);
		msg = "Exporting animation: " + pAnim->getName();
		LogManager::getSingleton().logMessage(msg);

		Demi::DiAnimation* anim = mt->CreateAnimation(
			pAnim->getName().c_str(), pAnim->getLength());

		// save tracks
		Animation::NodeTrackIterator trackIt = pAnim->getNodeTrackIterator();
		size_t count = 0;
		while (trackIt.hasMoreElements())
		{
			NodeAnimationTrack* track = trackIt.getNext();

			Bone* bone = (Bone*)track->getAssociatedNode();
			Demi::DiNodeClip* clip = anim->CreateNodeClip(count++,skeleton->GetBone(bone->getHandle()));
			
			// save key frames
			for (unsigned short i = 0; i < track->getNumKeyFrames(); ++i)
			{
				TransformKeyFrame* kf = track->getNodeKeyFrame(i);

				Demi::DiTransformKeyFrame* pKeyframe = clip->CreateNodeKeyFrame(kf->getTime());

				pKeyframe->SetTranslate(Demi::DiVec3(kf->getTranslate().x,
										kf->getTranslate().y,kf->getTranslate().z));
				pKeyframe->SetRotation(Demi::DiQuat(kf->getRotation().w,
										kf->getRotation().x,kf->getRotation().y,kf->getRotation().z));
				pKeyframe->SetScale(Demi::DiVec3(kf->getScale().x,
										kf->getScale().y,kf->getScale().z));
			}
		}

		LogManager::getSingleton().logMessage("Animation exported.");
	}

	if (mt)
	{
		// save to file
		DiMotionSerializer ms;
		ms.ExportMotion(mt,filename);
	}
}
开发者ID:redkaras,项目名称:Demi3D,代码行数:66,代码来源:ModelConverter.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ anope::string类代码示例发布时间:2022-05-31
下一篇:
C++ android::sp类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap