本文整理汇总了C#中System.Windows.Media.Media3D.PerspectiveCamera类的典型用法代码示例。如果您正苦于以下问题:C# PerspectiveCamera类的具体用法?C# PerspectiveCamera怎么用?C# PerspectiveCamera使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PerspectiveCamera类属于System.Windows.Media.Media3D命名空间,在下文中一共展示了PerspectiveCamera类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: defineCamera
PerspectiveCamera defineCamera(double maxLegLength) {
var camera = new PerspectiveCamera();
camera.Position = new Point3D(maxLegLength, maxLegLength, maxLegLength).Multiply(1.6);
camera.LookDirection = new Vector3D(-100, -100, -100);
camera.UpDirection = new Vector3D(0, 0, 1);
return camera;
}
开发者ID:HDRoby,项目名称:3DOFLeg,代码行数:7,代码来源:MainWindow.xaml.cs
示例2: SyncCamera
public void SyncCamera(PerspectiveCamera camera)
{
this.Camera.Position = camera.Position;
this.Camera.LookDirection = camera.LookDirection;
this.Camera.UpDirection = camera.UpDirection;
this.Camera.FieldOfView = camera.FieldOfView;
}
开发者ID:charlierix,项目名称:AsteroidMiner,代码行数:7,代码来源:ShipCameraTester.xaml.cs
示例3: VisualTree3DView
public VisualTree3DView(Visual visual)
{
DirectionalLight directionalLight1 = new DirectionalLight(Colors.White, new Vector3D(0, 0, 1));
DirectionalLight directionalLight2 = new DirectionalLight(Colors.White, new Vector3D(0, 0, -1));
double z = 0;
Model3D model = this.ConvertVisualToModel3D(visual, ref z);
Model3DGroup group = new Model3DGroup();
group.Children.Add(directionalLight1);
group.Children.Add(directionalLight2);
group.Children.Add(model);
this.zScaleTransform = new ScaleTransform3D();
group.Transform = this.zScaleTransform;
ModelVisual3D modelVisual = new ModelVisual3D();
modelVisual.Content = group;
Rect3D bounds = model.Bounds;
double fieldOfView = 45;
Point3D lookAtPoint = new Point3D(bounds.X + bounds.SizeX / 2, bounds.Y + bounds.SizeY / 2, bounds.Z + bounds.SizeZ / 2);
double cameraDistance = 0.5 * bounds.SizeX / Math.Tan(0.5 * fieldOfView * Math.PI / 180);
Point3D position = lookAtPoint - new Vector3D(0, 0, cameraDistance);
Camera camera = new PerspectiveCamera(position, new Vector3D(0, 0, 1), new Vector3D(0, -1, 0), fieldOfView);
this.zScaleTransform.CenterZ = lookAtPoint.Z;
this.Children.Add(modelVisual);
this.Camera = camera;
this.ClipToBounds = false;
this.Width = 500;
this.Height = 500;
this.trackballBehavior = new TrackballBehavior(this, lookAtPoint);
}
开发者ID:JonGonard,项目名称:snoopwpf,代码行数:35,代码来源:VisualTree3DView.cs
示例4: ViewportOffline
public ViewportOffline(Color background)
{
this.Viewport = new Viewport3D();
// The initial values don't really matter. The camera will be moved before taking a picture
_camera = new PerspectiveCamera(new Point3D(0, 0, 25), new Vector3D(0, 0, -1), new Vector3D(0, 1, 0), 45d);
this.Viewport.Camera = _camera;
// The lights need to be passed in as CameraPoolVisual objects
//Model3DGroup lightGroup = new Model3DGroup();
//lightGroup.Children.Add(new AmbientLight(UtilityWPF.ColorFromHex("808080")));
//lightGroup.Children.Add(new DirectionalLight(UtilityWPF.ColorFromHex("FFFFFF"), new Vector3D(1, -1, -1)));
//lightGroup.Children.Add(new DirectionalLight(UtilityWPF.ColorFromHex("303030"), new Vector3D(-1, 1, 1)));
//ModelVisual3D lightModel = new ModelVisual3D();
//lightModel.Content = lightGroup;
//this.Viewport.Children.Add(lightModel);
_background = background;
// Viewport3D won't render to a bitmap when it's not part of the visual tree, but a border containing a viewport will
Border border = new Border();
border.Background = new SolidColorBrush(_background);
border.Child = this.Viewport;
_control = border;
}
开发者ID:charlierix,项目名称:AsteroidMiner,代码行数:27,代码来源:CameraPool.cs
示例5: ItemSelectDragLogic
public ItemSelectDragLogic(Map map, PerspectiveCamera camera, Viewport3D viewport, UIElement visual)
{
_map = map;
_camera = camera;
_viewport = viewport;
_visual = visual;
}
开发者ID:charlierix,项目名称:AsteroidMiner,代码行数:7,代码来源:ItemSelectDragLogic.cs
示例6: CameraHelper
public CameraHelper(Player player, PerspectiveCamera camera, PerspectiveCamera cameraMap, MinimapHelper blips)
{
_player = player;
_camera = camera;
_cameraMap = cameraMap;
_blips = blips;
}
开发者ID:charlierix,项目名称:AsteroidMiner,代码行数:7,代码来源:CameraHelper.cs
示例7: Camera2D
public Camera2D(PerspectiveCamera camera)
{
_originalCamera = camera;
_originalCamera.LookDirection = new Vector3D(0, 0.25, -1);
Focused = true;
}
开发者ID:bakerj76,项目名称:RogueTyper,代码行数:7,代码来源:Camera2D.cs
示例8: StructureControl
/// <summary>
/// Initializes a new instance of the <see cref="StructureControl"/> class and sets up visual elements for rendering.
/// </summary>
/// <param name="pdbViewer">The PDB viewer.</param>
internal StructureControl(PdbViewer pdbViewer)
{
this.pdbViewer = pdbViewer;
NameScope.SetNameScope(this, new NameScope());
this.viewport = new Viewport3D();
this.viewport.ClipToBounds = true;
this.Children.Add(this.viewport);
this.camera = new PerspectiveCamera();
this.camera.Position = new Point3D(0, 0, cameraOffset);
this.viewport.Camera = this.camera;
ModelVisual3D lightingVisual = new ModelVisual3D();
this.viewport.Children.Add(lightingVisual);
Model3DGroup lightingModel = new Model3DGroup();
lightingVisual.Content = lightingModel;
PointLight pointLight = new PointLight(Colors.White, new Point3D(-4, 4, 8));
lightingModel.Children.Add(pointLight);
AmbientLight ambientLight = new AmbientLight(Color.FromRgb(32, 32, 32));
lightingModel.Children.Add(ambientLight);
this.moleculeVisual = new ModelVisual3D();
viewport.Children.Add(this.moleculeVisual);
Transform3DGroup transformGroup = new Transform3DGroup();
this.moleculeVisual.Transform = transformGroup;
this.translateTransform = new TranslateTransform3D();
transformGroup.Children.Add(this.translateTransform);
this.scaleTransform = new ScaleTransform3D();
transformGroup.Children.Add(this.scaleTransform);
this.rotateTransform = new RotateTransform3D();
this.rotateTransform.Rotation = new QuaternionRotation3D();
transformGroup.Children.Add(this.rotateTransform);
this.selectionRectangle = new Rectangle();
this.selectionRectangle.Stroke = Brushes.White;
this.selectionRectangle.Fill = new SolidColorBrush(Color.FromArgb(32, 255, 255, 255));
this.selectionRectangle.Visibility = Visibility.Hidden;
this.Children.Add(this.selectionRectangle);
this.testLabel = new Label();
this.testLabel.Foreground = Brushes.White;
this.testLabel.FontSize = 20;
this.testLabel.HorizontalAlignment = HorizontalAlignment.Left;
this.testLabel.VerticalAlignment = VerticalAlignment.Center;
this.Children.Add(this.testLabel);
this.clip = 1;
this.slab = 0;
this.UpdateClipping();
}
开发者ID:alkampfergit,项目名称:BaktunShell,代码行数:63,代码来源:StructureControl.cs
示例9: TrackBallRoam
public TrackBallRoam(PerspectiveCamera camera)
{
_camera = camera;
_autoscroll = new AutoScrollEmulator();
_autoscroll.AutoScroll += new AutoScrollHandler(Autoscroll_AutoScroll);
_autoscroll.CursorChanged += new EventHandler(Autoscroll_CursorChanged);
}
开发者ID:charlierix,项目名称:AsteroidMiner,代码行数:8,代码来源:TrackBall.cs
示例10: TrackballGrabber
public TrackballGrabber(FrameworkElement eventSource, Viewport3D viewport, double sphereRadius, Color hoverLightColor)
{
if (viewport.Camera == null || !(viewport.Camera is PerspectiveCamera))
{
throw new ArgumentException("This class requires a perspective camera to be tied to the viewport");
}
_eventSource = eventSource;
_viewport = viewport;
_camera = (PerspectiveCamera)viewport.Camera;
this.SyncedLights = new List<Model3D>();
this.HoverVisuals = new ObservableCollection<Visual3D>();
this.HoverVisuals.CollectionChanged += HoverVisuals_CollectionChanged;
_eventSource.MouseEnter += new System.Windows.Input.MouseEventHandler(EventSource_MouseEnter);
_eventSource.MouseLeave += new System.Windows.Input.MouseEventHandler(EventSource_MouseLeave);
_eventSource.MouseDown += new System.Windows.Input.MouseButtonEventHandler(EventSource_MouseDown);
_eventSource.MouseUp += new System.Windows.Input.MouseButtonEventHandler(EventSource_MouseUp);
_eventSource.MouseMove += new System.Windows.Input.MouseEventHandler(EventSource_MouseMove);
#region Sphere
// Material
_sphereMaterials = new MaterialGroup();
_sphereMaterials.Children.Add(new DiffuseMaterial(new SolidColorBrush(Color.FromArgb(25, 255, 255, 255))));
// This gets added/removed on mouse enter/leave
_sphereMaterialHover = new SpecularMaterial(new SolidColorBrush(Color.FromArgb(64, 128, 128, 128)), 33d);
// Geometry Model
GeometryModel3D geometry = new GeometryModel3D();
geometry.Material = _sphereMaterials;
geometry.BackMaterial = _sphereMaterials;
geometry.Geometry = UtilityWPF.GetSphere_LatLon(20, sphereRadius);
// Model Visual
_sphereModel = new ModelVisual3D();
_sphereModel.Content = geometry;
// Add it
_viewport.Children.Add(_sphereModel);
#endregion
#region Hover Light
// Light
PointLight hoverLight = new PointLight();
hoverLight.Color = hoverLightColor;
hoverLight.Range = sphereRadius * 10;
_hoverLight = new ModelVisual3D();
_hoverLight.Content = hoverLight;
#endregion
}
开发者ID:charlierix,项目名称:AsteroidMiner,代码行数:57,代码来源:TrackballGrabber.cs
示例11: CameraManipulator
public CameraManipulator(IScene scene)
{
this.scene = scene;
this.camera = new PerspectiveCamera();
this.UpDirection = new Vector3D(-1, -1, 2)/Math.Sqrt(6);
this.SetCameraPosition(this.scene.Center +
new Vector3D(1, 1, 1)*this.scene.Radius*4/Math.Sqrt(3));
}
开发者ID:oleksadobrianskyy,项目名称:ModelViewer3D,代码行数:9,代码来源:CameraManipulator.cs
示例12: UpdateCamera
public void UpdateCamera(PerspectiveCamera camera)
{
cameraDir.Text = camera.LookDirection.Format("f1");
cameraEye.Text = camera.Position.Format("f1");
cameraUp.Text = camera.UpDirection.Format("f1");
nearPlane.Text = camera.NearPlaneDistance.ToString("f1");
farPlane.Text = camera.FarPlaneDistance.ToString("f1");
fov.Text = camera.FieldOfView.ToString("f1");
}
开发者ID:kobush,项目名称:ManagedOpenNI,代码行数:9,代码来源:CameraPropertyView.xaml.cs
示例13: AddCamera
private void AddCamera() {
PerspectiveCamera camera=new PerspectiveCamera();
camera.Position=new Point3D(0,3.3,8);//in WPF, z axis is positive coming out from the screen toward the viewer.
//camera.FarPlaneDistance=20;
camera.LookDirection=new Vector3D(0,-.4,-1);
//camera.UpDirection=new Vector3D(0,1,0);
//camera.NearPlaneDistance=0;
camera.FieldOfView=45;
myViewport.Camera=camera;
}
开发者ID:mnisl,项目名称:OD,代码行数:10,代码来源:Wpf3dControl.xaml.cs
示例14: WiggleView3D
public WiggleView3D()
{
InitializeComponent();
RightCamera = new PerspectiveCamera();
BindViewports(View1, null, true, true);
CompositionTarget.Rendering += CompositionTarget_Rendering;
UpdateTimer();
watch.Start();
}
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:11,代码来源:WiggleView3D.xaml.cs
示例15: Reset
/// <summary>
/// Resets the specified perspective camera.
/// </summary>
/// <param name="camera">The camera.</param>
public static void Reset(PerspectiveCamera camera)
{
if (camera == null)
return;
camera.Position = new Point3D(2, 16, 20);
camera.LookDirection = new Vector3D(-2, -16, -20);
camera.UpDirection = new Vector3D(0, 0, 1);
camera.FieldOfView = 45;
camera.NearPlaneDistance = 0.1;
camera.FarPlaneDistance = 100000;
}
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:15,代码来源:CameraHelper.cs
示例16: setupViewport
public Viewport3D setupViewport(PerspectiveCamera p1, double height, double width)
{
vp = new Viewport3D();
vp.IsHitTestVisible = false;
vp.Camera = p1;
vp.Height = height;
vp.Width = width;
return vp;
}
开发者ID:robinj,项目名称:parse-client,代码行数:11,代码来源:ViewportCalibrator.cs
示例17: Copy
/// <summary>
/// Copies all members of the source <see cref="Camera"/>.
/// </summary>
/// <param name="source">Source camera.</param>
/// <param name="dest">Destination camera.</param>
public static void Copy(PerspectiveCamera source, PerspectiveCamera dest)
{
if (source == null || dest == null)
return;
dest.LookDirection = source.LookDirection;
dest.Position = source.Position;
dest.UpDirection = source.UpDirection;
dest.FieldOfView = source.FieldOfView;
dest.NearPlaneDistance = source.NearPlaneDistance;
dest.FarPlaneDistance = source.FarPlaneDistance;
}
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:17,代码来源:CameraHelper.cs
示例18: IsVisible
public static bool IsVisible(PerspectiveCamera camera, Point3D worldPoint)
{
var local = ProjectionCameraExtension.GetWorldToLocal(camera).Transform(worldPoint);
// camera lookdirection is along -Z axis
if (local.Z >= 0.0) return false;
var deg2rad = 0.01745329;
var distance = Abs(local.Z);
var frustrumHeight = 2.0 * distance * Tan(camera.FieldOfView*deg2rad*0.5);
if (Abs(local.X) > frustrumHeight / 2.0) return false;
if(Abs(local.Y) > frustrumHeight/2.0) return false;
return true;
}
开发者ID:node-net,项目名称:Node.Net,代码行数:12,代码来源:PerspectiveCamera.Extension.cs
示例19: GetTransformedPerspectiveCamera
public static PerspectiveCamera GetTransformedPerspectiveCamera(PerspectiveCamera camera, Transform3D transform)
{
return new PerspectiveCamera
{
LookDirection = transform.Transform(camera.LookDirection),
UpDirection = transform.Transform(camera.UpDirection),
FieldOfView = camera.FieldOfView,
FarPlaneDistance = camera.FarPlaneDistance,
NearPlaneDistance = camera.NearPlaneDistance,
Position = transform.Transform(camera.Position)
};
}
开发者ID:node-net,项目名称:Node.Net,代码行数:12,代码来源:PerspectiveCamera.Extension.cs
示例20: setupCamera
public PerspectiveCamera setupCamera()
{
pc = new PerspectiveCamera();
//Kinect defaults
pc.FarPlaneDistance = 8000;
pc.NearPlaneDistance = 100;
pc.FieldOfView = 10;
pc.Position = new Point3D(300, 200, -1000);
pc.LookDirection = new Vector3D(0, 0, 1);
pc.UpDirection = new Vector3D(0, -1, 0);
return pc;
}
开发者ID:robinj,项目名称:parse-client,代码行数:14,代码来源:ViewportCalibrator.cs
注:本文中的System.Windows.Media.Media3D.PerspectiveCamera类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论