本文整理汇总了C++中Transformation::SetTranslation方法的典型用法代码示例。如果您正苦于以下问题:C++ Transformation::SetTranslation方法的具体用法?C++ Transformation::SetTranslation怎么用?C++ Transformation::SetTranslation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Transformation
的用法示例。
在下文中一共展示了Transformation::SetTranslation方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReadNextExactToken
Transformation<real> SceneImporter<real>::ReadTransformation( std::istream& stream )
{
Transformation<real> transformation;
ReadNextExactToken( stream, "Transformation" );
ReadNextExactToken( stream, "(" );
if ( TryReadClosingParenthesis( stream ) )
return transformation;
Vector3<real> rotation = ReadVector3( stream ); ReadNextExactToken( stream, "," );
Vector3<real> translation = ReadVector3( stream ); ReadNextExactToken( stream, "," );
Vector3<real> scale = ReadVector3( stream );
ReadNextExactToken( stream, ")" );
transformation.RotateX( rotation.X() );
transformation.RotateY( rotation.Y() );
transformation.RotateZ( rotation.Z() );
transformation.SetTranslation( translation );
transformation.SetScaleX( scale.X() );
transformation.SetScaleY( scale.Y() );
transformation.SetScaleZ( scale.Z() );
return transformation;
}
示例2: SetTransformation
void SetTransformation(const Vec3& pos, const Quat& rot)
{
if (mOverridingCamera){
mOverridingCamera->SetTransformation(pos, rot);
return;
}
mTransformation.SetTranslation(pos);
mTransformation.SetRotation(rot);
mViewPropertyChanged = true;
}
示例3: SetPosition
void SetPosition(const Vec3& pos)
{
if (mOverridingCamera){
mOverridingCamera->SetPosition(pos);
return;
}
if (mTransformation.GetTranslation() == pos)
return;
mTransformation.SetTranslation(pos);
mViewPropertyChanged = true;
}
示例4: LoadTranslation
void SceneLoader::LoadTranslation(const XmlParser::XmlElement& rElement, Spatial* pSpatial) {
Debug(string("Translation: ") + rElement.GetInnerText());
vector<string> data = Utils::Split(rElement.GetInnerText(), ",");
float x = stof(data[0]);
float y = stof(data[1]);
float z = stof(data[2]);
Debug(string("Translation x: ") + to_string(x));
Debug(string("Translation y: ") + to_string(y));
Debug(string("Translation z: ") + to_string(z));
Debug(pSpatial->Name());
Transformation t = pSpatial->GetTransformation();
t.SetTranslation(Vector(x, y, z));
pSpatial->SetTransformation(t);
pSpatial->Transform();
}
示例5: asin
void TurntableCamera<real>::Update()
{
Transformation<real> transformation;
Vector3<real> initRotationAxis = Vector3<real>( 0, 1, 0 ) ^ mThetaAxis;
if ( initRotationAxis.SquaredLength() > 1e-5 )
transformation.SetRotationAxis( initRotationAxis.Normalized(), asin( initRotationAxis.Length() ) );
transformation.RotateAxis( mPhiAxis, mPhi );
transformation.RotateAxis( mThetaAxis, mTheta );
Transformation<real> transformationT;
transformationT.RotateAxis( mPhiAxis, mPhi );
transformationT.RotateAxis( mThetaAxis, mTheta );
transformation.SetTranslation( transformationT.GetRotation() * ( mPhiAxis ^ mThetaAxis ).Normalized() * mDistance + mCenter );
this->SetLocalTransformation( transformation );
Camera<real>::Update();
}
示例6: 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;
}
}
}
}
}
}