3DTools/Trackball.cs
(开头部分) 7KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
//---------------------------------------------------------------------------
//
// (c) Copyright Microsoft Corporation.
// This source is subject to the Microsoft Limited Permissive License.
// See http://www.microsoft.com/resources/sharedsource/licensingbasics/limitedpermissivelicense.mspx
// All other rights reserved.
//
// This file is part of the 3D Tools for Windows Presentation Foundation
// project. For more information, see:
//
// http://CodePlex.com/Wiki/View.aspx?ProjectName=3DTools
//
// The following article discusses the mechanics behind this
// trackball implementation: http://viewport3d.com/trackball.htm
//
// Reading the article is not required to use this sample code,
// but skimming it might be useful.
//
//---------------------------------------------------------------------------
using System;
using System.Diagnostics;
using System.Windows;
using System.Windows.Input;
using System.Windows.Media.Media3D;
using System.Windows.Markup;
namespace _3DTools
{
/// <summary>
/// Trackball is a utility class which observes the mouse events
/// on a specified FrameworkElement and produces a Transform3D
/// with the resultant rotation and scale.
///
/// Example Usage:
///
/// Trackball trackball = new Trackball();
/// trackball.EventSource = myElement;
/// myViewport3D.Camera.Transform = trackball.Transform;
///
/// Because Viewport3Ds only raise events when the mouse is over the
/// rendered 3D geometry (as opposed to not when the mouse is within
/// the layout bounds) you usually want to use another element as
/// your EventSource. For example, a transparent border placed on
/// top of your Viewport3D works well:
///
/// <Grid>
/// <ColumnDefinition />
/// <RowDefinition />
/// <Viewport3D Name="myViewport" ClipToBounds="True" Grid.Row="0" Grid.Column="0" />
/// <Border Name="myElement" Background="Transparent" Grid.Row="0" Grid.Column="0" />
/// </Grid>
///
/// NOTE: The Transform property may be shared by multiple Cameras
/// if you want to have auxilary views following the trackball.
///
/// It can also be useful to share the Transform property with
/// models in the scene that you want to move with the camera.
/// (For example, the Trackport3D's headlight is implemented
/// this way.)
后面还有 139 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
