//-----------------------------------------------------------------------------// // 외부에서 온 명령들을 이함수에서 처리한다. //-----------------------------------------------------------------------------// void CCharacter::Command( SMsg Msg ) { switch( Msg.type ) { case MSG_KEYDOWN: KeyProc( Msg.lparam, Msg.wparam ); break; case MSG_SETPOS: { Matrix44 mat; Vector3 *pv = (Vector3*)Msg.lparam; mat.SetWorld( *pv ); SetWorldTM( &mat ); } break; case MSG_MOVPOS: { } break; } }
//------------------------------- // //------------------------------- void Vector3::GetQuaternion( Quaternion& qRot ) { Vector3 vDir; vDir.x = x; vDir.y = y; vDir.z = z; vDir.Normalize(); vDir *= -1; Matrix44 matWorld; matWorld.SetWorld( Vector3( 0.0F, 0.0F, 0.0F ), vDir, Vector3( 0.0F, 0.0F, 1.0F ) ); qRot = matWorld.GetQuaternion(); } //Vector3::GetQuaternion
//------------------------------- // //------------------------------- Quaternion Vector3::GetQuaternion() { Vector3 vDummy; vDummy.x = x; vDummy.y = y; vDummy.z = z; if( x == 0 && y == 0 ) { Quaternion qRot; qRot.SetRotationZ( ANGLE( 0 ) ); return qRot; } //if vDummy.Normalize(); vDummy *= -1; Matrix44 matWorld; matWorld.SetWorld( vInit, vDummy, vUp ); return matWorld.GetQuaternion(); } //Vector3::GetQuaternion
//-------------------------------- // //-------------------------------- void Quaternion::SetOrientation( const Vector3& vDir, const Vector3& vUp ) { Matrix44 matWorld; matWorld.SetWorld( Vector3( 0.0F, 0.0F, 0.0F ), vDir, vUp ); *this = matWorld.GetQuaternion(); } //Quaternion::SetOrientation