本文整理汇总了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;
}
示例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();
}
示例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;
}
}
}
}
}
}