| 57 |
|
|
| 58 |
bool isTracking = false; |
bool isTracking = false; |
| 59 |
|
|
| 60 |
|
System.Windows.Threading.DispatcherTimer frameTimer; |
| 61 |
|
|
| 62 |
public CameraControl(PerspectiveCamera camera) |
public CameraControl(PerspectiveCamera camera) |
| 63 |
{ |
{ |
| 64 |
_camera = camera; |
_camera = camera; |
| 71 |
|
|
| 72 |
_cameraLookDirection = _camera.LookDirection; |
_cameraLookDirection = _camera.LookDirection; |
| 73 |
|
|
| 74 |
|
|
| 75 |
|
frameTimer = new System.Windows.Threading.DispatcherTimer(); |
| 76 |
|
frameTimer.Tick += new EventHandler(frameTimer_Tick); |
| 77 |
|
frameTimer.Interval = new TimeSpan(0, 0, 0, 0, 1); |
| 78 |
|
frameTimer.Start(); |
| 79 |
|
} |
| 80 |
|
|
| 81 |
|
void frameTimer_Tick(object sender, EventArgs e) |
| 82 |
|
{ |
| 83 |
|
|
| 84 |
|
//this.OnMouseMove(sender, e); |
| 85 |
} |
} |
| 86 |
|
|
| 87 |
/// <summary> |
/// <summary> |
| 261 |
_eventSource.Cursor = Cursors.Arrow; |
_eventSource.Cursor = Cursors.Arrow; |
| 262 |
} |
} |
| 263 |
|
|
| 264 |
|
Point currentPosition; |
| 265 |
|
|
| 266 |
private void OnMouseMove(object sender, MouseEventArgs e) |
private void OnMouseMove(object sender, MouseEventArgs e) |
| 267 |
{ |
{ |
| 268 |
Point currentPosition = e.GetPosition(EventSource); |
currentPosition = e.GetPosition(EventSource); |
| 269 |
|
|
| 270 |
if (e.RightButton == MouseButtonState.Pressed && (Keyboard.IsKeyDown(Key.LeftShift) || Keyboard.IsKeyDown(Key.RightShift))) |
if (e.RightButton == MouseButtonState.Pressed && (Keyboard.IsKeyDown(Key.LeftShift) || Keyboard.IsKeyDown(Key.RightShift))) |
| 271 |
{ |
{ |
| 517 |
_camera.Position = new Point3D(_camera.Position.X, _camera.Position.Y, _camera.Position.Z + scale); |
_camera.Position = new Point3D(_camera.Position.X, _camera.Position.Y, _camera.Position.Z + scale); |
| 518 |
} |
} |
| 519 |
|
|
| 520 |
|
//for test |
| 521 |
|
/* |
| 522 |
|
private void FPSMouseMove(object sender, EventArgs e) |
| 523 |
|
{ |
| 524 |
|
currentPosition = e.GetPosition(EventSource); |
| 525 |
|
|
| 526 |
|
if (isTracking) |
| 527 |
|
{ |
| 528 |
|
if (isLookAround == true) |
| 529 |
|
LookUpDown(currentPosition); |
| 530 |
|
else if (isFocus == true) |
| 531 |
|
{ |
| 532 |
|
_eventSource.Cursor = Cursors.None; |
| 533 |
|
Focus(currentPosition); |
| 534 |
|
} |
| 535 |
|
else if (isCameraPanUP) |
| 536 |
|
CameraPanUP(currentPosition); |
| 537 |
|
else if (isCameraPanLeftRight) |
| 538 |
|
{ |
| 539 |
|
_eventSource.Cursor = Cursors.None; |
| 540 |
|
CameraPanLeftRight(currentPosition); |
| 541 |
|
} |
| 542 |
|
else if (isRotateObject) |
| 543 |
|
{ |
| 544 |
|
_eventSource.Cursor = Cursors.None; |
| 545 |
|
|
| 546 |
|
RotateObject(currentPosition); |
| 547 |
|
} |
| 548 |
|
else if (isPanObject) |
| 549 |
|
{ |
| 550 |
|
_eventSource.Cursor = Cursors.None; |
| 551 |
|
PanObject(currentPosition); |
| 552 |
|
} |
| 553 |
|
else if (isLookAround) |
| 554 |
|
{ |
| 555 |
|
LookAround(currentPosition); |
| 556 |
|
} |
| 557 |
|
} |
| 558 |
|
|
| 559 |
|
_previousPosition2D = currentPosition; |
| 560 |
|
|
| 561 |
|
}*/ |
| 562 |
|
|
| 563 |
|
|
| 564 |
} |
} |
| 565 |
|
|