packages/MaterialDesignThemes.2.5.1/src/net45/Plane3D.cs
(开头部分) 10KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Markup;
using System.Windows.Media;
using System.Windows.Media.Media3D;
namespace MaterialDesignThemes.Wpf
{
/// <summary>
/// View a control on a 3D plane.
/// </summary>
/// <remarks>
/// Taken from http://blogs.msdn.com/greg_schechter/archive/2007/10/26/enter-the-planerator-dead-simple-3d-in-wpf-with-a-stupid-name.aspx , Greg Schechter - Fall 2007
/// </remarks>
[ContentProperty("Child")]
public class Plane3D : FrameworkElement
{
private FrameworkElement _logicalChild;
private FrameworkElement _visualChild;
private FrameworkElement _originalChild;
private readonly QuaternionRotation3D _quaternionRotation = new QuaternionRotation3D();
private readonly RotateTransform3D _rotationTransform = new RotateTransform3D();
private Viewport3D _viewport3D;
private readonly ScaleTransform3D _scaleTransform = new ScaleTransform3D();
private static readonly Point3D[] Mesh = { new Point3D(0, 0, 0), new Point3D(0, 1, 0), new Point3D(1, 1, 0), new Point3D(1, 0, 0) };
private static readonly Point[] TexCoords = { new Point(0, 1), new Point(0, 0), new Point(1, 0), new Point(1, 1) };
private static readonly int[] Indices = { 0, 2, 1, 0, 3, 2 };
private static readonly Vector3D XAxis = new Vector3D(1, 0, 0);
private static readonly Vector3D YAxis = new Vector3D(0, 1, 0);
private static readonly Vector3D ZAxis = new Vector3D(0, 0, 1);
public static readonly DependencyProperty RotationXProperty =
DependencyProperty.Register("RotationX", typeof(double), typeof(Plane3D), new UIPropertyMetadata(0.0, (d, args) => ((Plane3D)d).UpdateRotation()));
public double RotationX
{
get { return (double)GetValue(RotationXProperty); }
set { SetValue(RotationXProperty, value); }
}
public static readonly DependencyProperty RotationYProperty =
DependencyProperty.Register("RotationY", typeof(double), typeof(Plane3D), new UIPropertyMetadata(0.0, (d, args) => ((Plane3D)d).UpdateRotation()));
public double RotationY
{
get { return (double)GetValue(RotationYProperty); }
set { SetValue(RotationYProperty, value); }
}
public static readonly DependencyProperty RotationZProperty =
DependencyProperty.Register("RotationZ", typeof(double), typeof(Plane3D), new UIPropertyMetadata(0.0, (d, args) => ((Plane3D)d).UpdateRotation()));
public double RotationZ
{
get { return (double)GetValue(RotationZProperty); }
set { SetValue(RotationZProperty, value); }
后面还有 203 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。