VEyeChgV を改良予定
共通のコードはまだ手を付けられないので,テスト的に,VOpGLS のビューに修正を加えた. VOpGLS.zip
ID_V_EYE_DRAG を追加.
マウスのイベントを追加.
void CVOpGLSView::OnLButtonDown(UINT nFlags, CPoint point) {
SetDragAnchor(point) ;
if (CanMouseEyeChange()) {
SetDragMoveEye() ;
DrgLastEye = GetEyeChg().GetEye() ;
return ;
}
VOpGLView::OnLButtonDown(nFlags, point);
}
void CVOpGLSView::OnLButtonUp(UINT nFlags, CPoint point) {
if (CanMouseEyeChange()) {
SetDragMoveEye(FALSE) ;
this->InvalidateRect(NULL) ;
return ;
}
VOpGLView::OnLButtonUp(nFlags, point);
}
void CVOpGLSView::OnMouseMove(UINT nFlags, CPoint point) {
if (CanDragEyeChange()) {
Eye newEye = DrgLastEye ;
CRect rect ;
GetClientRect(&rect) ;
double newAngleXY = rad(Anchor.x-point.x)*180/rect.Width () ;
double newAngleZ =-rad(Anchor.y-point.y)*120/rect.Height() ;
newEye = newEye.GetSpinXY(newAngleXY) ;
newEye = newEye.GetSpinZ (newAngleZ) ;
GetEyeChgP()->SetEye(newEye) ;
this->InvalidateRect(NULL) ;
return ;
}
VOpGLView::OnMouseMove(nFlags, point);
}
2012/10/04 追記
同様に改良. ToPAm.zip