Пример #1
0
//-----------------------------------------------------------------------------//
// 외부에서 온 명령들을 이함수에서 처리한다.
//-----------------------------------------------------------------------------//
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;
	}

}
Пример #2
0
//-------------------------------
//
//-------------------------------
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
Пример #3
0
//-------------------------------
//
//-------------------------------
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
Пример #4
0
//--------------------------------
//
//--------------------------------
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