本文整理汇总了C#中System.Windows.Media.Media3D.Visual3D类的典型用法代码示例。如果您正苦于以下问题:C# Visual3D类的具体用法?C# Visual3D怎么用?C# Visual3D使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Visual3D类属于System.Windows.Media.Media3D命名空间,在下文中一共展示了Visual3D类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddContours
private void AddContours(Visual3D model1, int o, int m, int n)
{
var bounds = Visual3DHelper.FindBounds(model1, Transform3D.Identity);
for (int i = 1; i < n; i++)
{
this.ContourPlane = new Plane3D(new Point3D(0, 0, bounds.Location.Z + bounds.Size.Z * i / n), new Vector3D(0, 0, 1));
Visual3DHelper.Traverse<GeometryModel3D>(model1, this.AddContours);
}
for (int i = 1; i < m; i++)
{
this.ContourPlane = new Plane3D(new Point3D(0, bounds.Location.Y + bounds.Size.Y * i / m, 0), new Vector3D(0, 1, 0));
Visual3DHelper.Traverse<GeometryModel3D>(model1, this.AddContours);
}
for (int i = 1; i < o; i++)
{
this.ContourPlane = new Plane3D(new Point3D(bounds.Location.X + bounds.Size.X * i / o, 0, 0), new Vector3D(1, 0, 0));
Visual3DHelper.Traverse<GeometryModel3D>(model1, this.AddContours);
}
}
示例2: ManipulatorControl
public ManipulatorControl(ManipulatorType type, Visual3D visual)
{
targetVisual = visual;
Type = type;
Transform = targetVisual.Transform;
Diameter = 0.5;
double l = 5;
switch (type)
{
case ManipulatorType.TranslateX:
Normal = new Vector3D(0, 0, 1);
Direction = new Vector3D(l, 0, 0);
Fill = Brushes.Red;
break;
case ManipulatorType.TranslateY:
Normal = new Vector3D(0, 0, 1);
Direction = new Vector3D(0, l, 0);
Fill = Brushes.Green;
break;
case ManipulatorType.TranslateZ:
Normal = new Vector3D(0, 1, 0);
Direction = new Vector3D(0, 0, l);
Fill = Brushes.Blue;
break;
}
}
示例3: BlipVisual
public BlipVisual(Visual3D visual, bool isVisualUpright, TranslateTransform3D translate, AxisAngleRotation3D rotate)
{
this.Visual = visual;
this.IsVisualUpright = isVisualUpright;
this.Translate = translate;
this.Rotate = rotate;
}
示例4: Export
public void Export(Visual3D visual)
{
object obj = visual;
if (CreateResourceDictionary)
obj = WrapInResourceDictionary(obj);
XamlWriter.Save(obj, xw);
}
示例5: RemoveChild
public static void RemoveChild(DependencyObject parent, Visual3D v3d)
{
var parentAsModelVisual3D = parent as ModelVisual3D;
if (parentAsModelVisual3D != null)
{
parentAsModelVisual3D.Children.Remove(v3d);
}
}
示例6: Visual3DClickedEventArgs
public Visual3DClickedEventArgs(Visual3D visual, MouseButtonState left, MouseButtonState right, bool hasMoved, Point position)
{
_Visual = visual;
_LeftButton = left;
_RightButton = right;
_HasMoved = hasMoved;
_MousePosition = position;
}
示例7: HitTest
public Point3D? HitTest(Visual3D reference, Point3D point, Vector3D direction)
{
if (reference != null)
{
var hitParams = new RayHitTestParameters(point, direction);
hit = false;
VisualTreeHelper.HitTest(reference, null, HitTestCallback, hitParams);
if (hit)
{
return hitTestValue;
}
}
return null;
}
示例8: IsTransparent
/// <summary>
/// Determines whether the specified visual is transparent.
/// </summary>
/// <param name="v">The v.</param>
/// <returns>
/// <c>true</c> if the specified visual is transparent; otherwise, <c>false</c>.
/// </returns>
public static bool IsTransparent(Visual3D v)
{
var mv3D = v as ModelVisual3D;
if (mv3D != null)
{
// check if Model3D is transparent
if (IsTransparent(mv3D.Content))
return true;
// check if any child Visual3D are transparent
return mv3D.Children.Any(IsTransparent);
}
return false;
}
示例9: CreateClone
/// <summary>
/// Create a clone of a Visual3D
/// </summary>
/// <param name="v">
/// a Visual3D
/// </param>
/// <returns>
/// the clone
/// </returns>
public static Visual3D CreateClone(Visual3D v)
{
if (v is ModelUIElement3D)
{
var m = v as ModelUIElement3D;
if (m.Model != null)
{
/*if (m.Model.CanFreeze)
m.Model.Freeze();
if (m.Model.IsFrozen)*/
{
var clonedModel = m.Model.Clone();
var clonedElement = new ModelUIElement3D();
clonedElement.Transform = m.Transform;
clonedElement.Model = clonedModel;
return clonedElement;
}
}
}
if (v is ModelVisual3D)
{
var m = v as ModelVisual3D;
var clone = new ModelVisual3D();
clone.Transform = m.Transform;
if (m.Content != null && m.Content.CanFreeze)
{
m.Content.Freeze();
var clonedModel = m.Content.Clone();
clone.Content = clonedModel;
}
if (m.Children.Count > 0)
{
foreach (var child in m.Children)
{
var clonedChild = CreateClone(child);
clone.Children.Add(clonedChild);
}
}
return clone;
}
return null;
}
示例10: RayMeshGeometry3DHitTestResult
//------------------------------------------------------
//
// Constructors
//
//------------------------------------------------------
#region Constructors
internal RayMeshGeometry3DHitTestResult(
Visual3D visualHit,
Model3D modelHit,
MeshGeometry3D meshHit,
Point3D pointHit,
double distanceToRayOrigin,
int vertexIndex1,
int vertexIndex2,
int vertexIndex3,
Point barycentricCoordinate) : base (visualHit, modelHit)
{
_meshHit = meshHit;
_pointHit = pointHit;
_distanceToRayOrigin = distanceToRayOrigin;
_vertexIndex1 = vertexIndex1;
_vertexIndex2 = vertexIndex2;
_vertexIndex3 = vertexIndex3;
_barycentricCoordinate = barycentricCoordinate;
}
示例11: PropagateFlags
/// <summary>
/// Propagates the flags up to the root.
/// </summary>
/// <remarks>
/// The walk stops on a node with all of the required flags set.
/// </remarks>
internal static void PropagateFlags(
Visual3D e,
VisualFlags flags,
VisualProxyFlags proxyFlags)
{
while ((e != null) &&
(!e.CheckFlagsAnd(flags) || !e.CheckFlagsOnAllChannels(proxyFlags)))
{
// These asserts are mostly for documentation when diffing the 2D/3D
// implementations.
Debug.Assert(!e.CheckFlagsOr(VisualFlags.ShouldPostRender),
"Visual3Ds should never be the root of a tree.");
Debug.Assert(!e.CheckFlagsOr(VisualFlags.NodeIsCyclicBrushRoot),
"Visual3Ds should never be the root of an ICyclicBrush.");
e.SetFlags(true, flags);
e.SetFlagsOnAllChannels(true, proxyFlags);
// If our 3D parent is null call back into VisualTreeUtils to potentially
// continue the walk in 2D.
if (e._3DParent == null)
{
Viewport3DVisual viewport = e.InternalVisualParent as Viewport3DVisual;
Debug.Assert((viewport == null) == (e.InternalVisualParent == null),
"Viewport3DVisual is the only supported 2D parent of a 3D visual.");
if(viewport != null)
{
// We must notify the 2D visual that its contents have changed.
// This will cause the 2D visual to set it's content dirty flag
// and continue the propagation of IsDirtyForRender/Precompute.
viewport.Visual3DTreeChanged();
// continue propagating flags up the 2D world
Visual.PropagateFlags(viewport, flags, proxyFlags);
}
// Stop propagating. We are at the root of the 3D subtree.
return;
}
e = e._3DParent;
}
}
示例12: DoAnyChildrenHaveABitSet
/// <summary>
/// Check all the children for a bit.
/// </summary>
internal static bool DoAnyChildrenHaveABitSet(Visual3D pe,
VisualFlags flag)
{
int count = pe.InternalVisual2DOr3DChildrenCount;
for (int i = 0; i < count; i++)
{
DependencyObject child = pe.InternalGet2DOr3DVisualChild(i);
Visual v = null;
Visual3D v3D = null;
VisualTreeUtils.AsNonNullVisual(child, out v, out v3D);
if (v != null && v.CheckFlagsAnd(flag))
{
return true;
}
else if (v3D != null && v3D.CheckFlagsAnd(flag))
{
return true;
}
}
return false;
}
示例13: TryTransformToViewport3DVisual
/// <summary>
/// Computes the transformation matrix to go from a 3D point in the given Visual3D's coordinate space out in to
/// the Viewport3DVisual.
/// </summary>
internal static bool TryTransformToViewport3DVisual(Visual3D visual3D, out Viewport3DVisual viewport, out Matrix3D matrix)
{
matrix = GetWorldTransformationMatrix(visual3D, out viewport);
if (viewport != null)
{
matrix *= GetWorldToViewportTransform3D(viewport.Camera, viewport.Viewport);
return true;
}
else
{
return false;
}
}
示例14: GetWorldTransformationMatrix
/// <summary>
/// Gets the object space to world space transformation for the given Visual3D
/// </summary>
/// <param name="visual">The visual whose world space transform should be found</param>
/// <returns>The world space transformation</returns>
internal static Matrix3D GetWorldTransformationMatrix(Visual3D visual)
{
Viewport3DVisual ignored;
return GetWorldTransformationMatrix(visual, out ignored);
}
示例15: BillboardGeometryBuilder
/// <summary>
/// Initializes a new instance of the <see cref="BillboardGeometryBuilder"/> class.
/// </summary>
/// <param name="visual">
/// The visual.
/// </param>
public BillboardGeometryBuilder(Visual3D visual)
: base(visual)
{
}