//=========================================
/**
次计算方法
right向量的y分量始终是0
*/
//=========================================
在Camera类加了一个,以自身位置和目标位置计算look,up,right向量的函数
void zybCamera::setPositionAndTarget(D3DXVECTOR3* pos,D3DXVECTOR3* target)
{
_pos = *pos;
D3DXVECTOR3 look = *target - *pos;
D3DXVec3Normalize(&look,&look);
_look = look;
_right.y = 0;
//正向旋转90°,想想自己前方是前向量,又向量自然为前向量旋转90
_right.x = look.z;
_right.z = -look.x;
D3DXVec3Normalize(&_right,&_right);
D3DXVec3Cross(&_up, &_look, &_right);
D3DXVec3Normalize(&_up, &_up);
}