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


C++ Transformation::SetRotation方法代码示例

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


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

示例1: SetRotation

	void SetRotation(const Quat& rot)
	{
		if (mOverridingCamera){
			mOverridingCamera->SetRotation(rot);
			return;
		}
		mTransformation.SetRotation(rot);
		mViewPropertyChanged = true;
	}
开发者ID:wangscript,项目名称:fastbirdEngine,代码行数:9,代码来源:Camera.cpp

示例2: LoadRotation

void SceneLoader::LoadRotation(const XmlParser::XmlElement& rElement, Spatial* pSpatial) {
    Debug(string("Rotation: ") + rElement.GetInnerText());
    vector<string> data = Utils::Split(rElement.GetInnerText(), ",");
    float x = stof(data[0]);
    float y = stof(data[1]);
    float z = stof(data[2]);
    float a = stof(data[3]);
    Debug(string("RotVector x: ") + to_string(x));
    Debug(string("RotVector y: ") + to_string(y));
    Debug(string("RotVector z: ") + to_string(z));
    Debug(string("RotVector a: ") + to_string(a));
    Debug(pSpatial->Name());
    Transformation t = pSpatial->GetTransformation();
    t.SetRotation(Vector(x, y, z), a * M_PI / 180);
    pSpatial->SetTransformation(t);
    pSpatial->Transform();
}
开发者ID:nigulo,项目名称:cpp,代码行数:17,代码来源:sceneloader.cpp

示例3: Update

	void Update(TIME_PRECISION dt){
		if (mCurPlayingAction)
		{
			if (mLastUpdatedFrame == gpTimer->GetFrame())
				return;

			mChanged = false;

			if (mPrevPlayingTime == mPlayingTime)
				return;

			TIME_PRECISION curTime = mPlayingTime;
			if (mReverse)
				mPlayingTime -= dt;
			else
				mPlayingTime += dt;

			mLastUpdatedFrame = gpTimer->GetFrame();
			// evaluate
			TIME_PRECISION normTime = curTime / mCurPlayingAction->mLength;
			bool cycled = mCycled;
			mCycled = false;
			if (mAnimationData->HasPosAnimation())
			{
				const Vec3 *p1 = 0, *p2 = 0;
				TIME_PRECISION interpol = 0;
				mAnimationData->PickPos(curTime, cycled, &p1, &p2, interpol);
				if (p1 && p2)
				{
					Vec3 pos = Lerp<Vec3>(*p1, *p2, interpol);
					mResult.SetTranslation(pos);
				}
			}

			if (mAnimationData->HasRotAnimation())
			{
				const Quat *r1 = 0, *r2 = 0;
				TIME_PRECISION interpol = 0;
				mAnimationData->PickRot(curTime, cycled, &r1, &r2, interpol);
				if (r1 && r2)
				{
					Quat rot = Slerp(*r1, *r2, interpol);
					mResult.SetRotation(rot);
				}
			}

			mPrevPlayingTime = curTime;
			mChanged = true;

			if ((!mReverse && mPlayingTime > mCurPlayingAction->mLength) ||
				(mReverse && mPlayingTime < 0))
			{
				if (mNextAction)
				{
					mCurPlayingAction = mNextAction;
					mReverse = mNextReverse;
					mNextAction = 0;
					if (mReverse)
					{
						mPlayingTime = mCurPlayingAction->mLength;
						mPrevPlayingTime = 0;
					}
					else
					{
						mPlayingTime = 0.f;
						mPrevPlayingTime = mCurPlayingAction->mLength;
					}
				}
				else
				{
					if (mReverse)
					{
						if (mCurPlayingAction->mLoop)
						{
							// mPlayingTime is negative
							mPlayingTime = mCurPlayingAction->mLength + mPlayingTime;
							mCycled = true;
						}
						else
						{
							mPlayingTime = 0.0f;
						}
					}
					else
					{
						if (mCurPlayingAction->mLoop)
						{
							mPlayingTime = mPlayingTime - mCurPlayingAction->mLength;
							mCycled = true;
						}
						else
						{
							mPlayingTime = mCurPlayingAction->mLength;
						}
					}

				}
			}
		}
	}
开发者ID:fastbird,项目名称:fastbirdEngine,代码行数:100,代码来源:Animation.cpp


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