| 21 |
using System.Windows.Controls; |
using System.Windows.Controls; |
| 22 |
using Petzold.Media3D; |
using Petzold.Media3D; |
| 23 |
using _3DTools; |
using _3DTools; |
| 24 |
|
using Xenki.Framework; |
| 25 |
|
using System.Collections.Generic; |
| 26 |
|
|
| 27 |
|
|
| 28 |
namespace Xenki.DefaultRenderer |
namespace Xenki.DefaultRenderer |
| 33 |
private Point _previousPosition2D; |
private Point _previousPosition2D; |
| 34 |
private Vector3D _previousPosition3D = new Vector3D(0, 0, 1); |
private Vector3D _previousPosition3D = new Vector3D(0, 0, 1); |
| 35 |
|
|
| 36 |
|
IPrimitiveData dataControl; |
| 37 |
|
|
| 38 |
private PerspectiveCamera _camera; |
private PerspectiveCamera _camera; |
| 39 |
private Point3D _cameraLookPoint; |
private Point3D _cameraLookPoint; |
| 48 |
|
|
| 49 |
public CameraControl(PerspectiveCamera camera) |
public CameraControl(PerspectiveCamera camera) |
| 50 |
{ |
{ |
| 51 |
_camera = camera; |
//dataControl = DefaultNetwork.DefaultNetwork.m_primitiveData; |
| 52 |
|
|
| 53 |
|
_camera = camera; |
| 54 |
|
|
| 55 |
frameTimer = new System.Windows.Threading.DispatcherTimer(); |
frameTimer = new System.Windows.Threading.DispatcherTimer(); |
| 56 |
frameTimer.Tick += new EventHandler(frameTimer_Tick); |
frameTimer.Tick += new EventHandler(frameTimer_Tick); |
| 412 |
|
|
| 413 |
private void PanObject(Point currentPosition) |
private void PanObject(Point currentPosition) |
| 414 |
{ |
{ |
| 415 |
|
|
| 416 |
|
|
| 417 |
Vector3D vector3D = GetTranslationVector3D(visul3d, _previousPosition2D, currentPosition); |
Vector3D vector3D = GetTranslationVector3D(visul3d, _previousPosition2D, currentPosition); |
| 418 |
GeometryModel3D geometryModel3D = visul3d.Content as GeometryModel3D; |
|
| 419 |
|
vector3D = MoveObject(visul3d ,vector3D); |
| 420 |
|
} |
| 421 |
|
|
| 422 |
|
private Vector3D MoveObject(ModelVisual3D visual, Vector3D vector3D) |
| 423 |
|
{ |
| 424 |
|
|
| 425 |
|
|
| 426 |
|
GeometryModel3D geometryModel3D = visual.Content as GeometryModel3D; |
| 427 |
if (geometryModel3D != null) |
if (geometryModel3D != null) |
| 428 |
{ |
{ |
| 429 |
MeshGeometry3D meshGeometry3D = geometryModel3D.Geometry as MeshGeometry3D; |
MeshGeometry3D meshGeometry3D = geometryModel3D.Geometry as MeshGeometry3D; |
| 435 |
points[i] = Point3D.Add(points[i], vector3D * 50); |
points[i] = Point3D.Add(points[i], vector3D * 50); |
| 436 |
} |
} |
| 437 |
} |
} |
| 438 |
|
return vector3D; |
| 439 |
} |
} |
| 440 |
|
|
| 441 |
string mm = ""; |
string mm = ""; |