本文整理汇总了C++中TransformNode::GetTransform方法的典型用法代码示例。如果您正苦于以下问题:C++ TransformNode::GetTransform方法的具体用法?C++ TransformNode::GetTransform怎么用?C++ TransformNode::GetTransform使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TransformNode
的用法示例。
在下文中一共展示了TransformNode::GetTransform方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UIEventHandler
bool CManipRot::UIEventHandler( const ui::Event& EV )
{
int ex = EV.miX;
int ey = EV.miY;
CVector2 posubp = EV.GetUnitCoordBP();
CCamera *pcam = mManager.GetActiveCamera();
bool brval = false;
bool isshift = false; //CSystem::IsKeyDepressed(VK_SHIFT );
bool isctrl = false; //CSystem::IsKeyDepressed(VK_CONTROL );
switch( EV.miEventCode )
{
case ui::UIEV_PUSH:
{
mManager.mManipHandler.Init(posubp, pcam->mCameraData.GetIVPMatrix(), pcam->QuatC );
mBaseTransform = mManager.mCurTransform;
SelectBestPlane(posubp);
brval = true;
}
break;
case ui::UIEV_RELEASE:
{
mManager.DisableManip();
brval = true;
}
break;
case ui::UIEV_DRAG:
{
IntersectWithPlanes( posubp );
if ( CheckIntersect() )
{
///////////////////////////////////////////
// calc normalvectors from base:origin to point on activeintersection plane (in world space)
const CVector3 & Origin = mBaseTransform.GetTransform().GetPosition();
CVector3 D1 = (Origin-mActiveIntersection->mIntersectionPoint).Normal();
CVector3 D0 = (Origin-mActiveIntersection->mBaseIntersectionPoint).Normal();
///////////////////////////////////////////
// calc matrix to put worldspace vector into plane local space
CMatrix4 MatWldToObj = mBaseTransform.GetTransform().GetMatrix(); //GetRotation();
MatWldToObj.Inverse();
CVector4 bAxisAngle = mLocalRotationAxis;
CQuaternion brq;
brq.FromAxisAngle(bAxisAngle);
CMatrix4 MatObjToPln = brq.ToMatrix();
MatObjToPln.Inverse();
CMatrix4 MatWldToPln = MatObjToPln*MatWldToObj;
//CMatrix4 MatInvRot = InvQuat.ToMatrix();
///////////////////////////////////////////
// calc plane local rotation
CVector4 AxisAngle = mLocalRotationAxis;
CVector4 D0I = CVector4(D0,CReal(0.0f)).Transform(MatWldToPln);
CVector4 D1I = CVector4(D1,CReal(0.0f)).Transform(MatWldToPln);
//orkprintf( "D0 <%f %f %f>\n", float(D0.GetX()), float(D0.GetY()), float(D0.GetZ()) );
//orkprintf( "D1 <%f %f %f>\n", float(D1.GetX()), float(D1.GetY()), float(D1.GetZ()) );
//orkprintf( "D0I <%f %f %f>\n", float(D0I.GetX()), float(D0I.GetY()), float(D0I.GetZ()) );
//orkprintf( "D1I <%f %f %f>\n", float(D1I.GetX()), float(D1I.GetY()), float(D1I.GetZ()) );
AxisAngle.SetW( CalcAngle(D0I,D1I) );
CQuaternion RotQ;
RotQ.FromAxisAngle( AxisAngle );
///////////////////
// Rot Snap
if( isshift )
{ CReal SnapAngleVal( PI2/16.0f );
CVector4 NewAxisAngle = RotQ.ToAxisAngle();
CReal Angle = NewAxisAngle.GetW();
Angle = SnapReal( Angle, SnapAngleVal );
NewAxisAngle.SetW( Angle );
RotQ.FromAxisAngle( NewAxisAngle );
}
///////////////////
// accum rotation
CQuaternion oq = mBaseTransform.GetTransform().GetRotation();
CQuaternion NewQ = RotQ.Multiply(oq);
///////////////////
// Rot Reset To Identity
if( isctrl && isshift )
{
NewQ.FromAxisAngle( CVector4( CReal(0.0f), CReal(1.0f), CReal(0.0f), CReal(0.0f) ) );
}
///////////////////
TransformNode mset = mManager.mCurTransform;
mset.GetTransform().SetRotation( NewQ );
mManager.ApplyTransform( mset );
///////////////////
}
brval = true;
}
break;
//.........这里部分代码省略.........