private void drag(Point MousePt) { Quat4f ThisQuat = new Quat4f(); arcBall.drag(MousePt, ThisQuat); // Update End Vector And Get Rotation As Quaternion lock (matrixLock) { //lock 的目的很明确:就是不想让别人使用这段代码, //体现在多线程情况下,只允许当前线程执行该代码区域, //其他线程等待直到该线程执行结束;这样可以多线程避免同时使用某一方法造成数据混乱。 ThisRot.Rotation = ThisQuat; // Convert Quaternion Into Matrix3fT ThisRot.mul(ThisRot, LastRot); // Accumulate Last Rotation Into This One } }
private void drag(Point MousePt) { Quat4f ThisQuat = new Quat4f(); arcBall.drag(MousePt, ThisQuat); // Update End Vector And Get Rotation As Quaternion lock (matrixLock) { ThisRot.Rotation = ThisQuat; // Convert Quaternion Into Matrix3fT ThisRot.mul(ThisRot, LastRot); // Accumulate Last Rotation Into This One } }