本文整理汇总了C#中System.Windows.Controls.Viewport3D类的典型用法代码示例。如果您正苦于以下问题:C# Viewport3D类的具体用法?C# Viewport3D怎么用?C# Viewport3D使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Viewport3D类属于System.Windows.Controls命名空间,在下文中一共展示了Viewport3D类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Create3DViewPort
private void Create3DViewPort()
{
var hvp3d = new HelixViewport3D();
Viewport3D vp3d = new Viewport3D();
var lights = new DefaultLights();
var tp = new Teapot();
hvp3d.Children.Add(lights);
hvp3d.Children.Add(tp);
vp3d = hvp3d.Viewport;
tata.Children.Add(vp3d); // comenter ca pour test
/* MEGA TEST DE L'ESPACE SUBSAHARIEN */
RenderTargetBitmap bmp = new RenderTargetBitmap(800, 800, 96, 96, PixelFormats.Pbgra32);
var rect = new Rect(0, 0, 800, 800);
vp3d.Measure(new Size(800, 800));
vp3d.Arrange(rect);
vp3d.InvalidateVisual();
bmp.Render(vp3d);
PngBitmapEncoder png = new PngBitmapEncoder();
png.Frames.Add(BitmapFrame.Create(bmp));
String filepath = "C:\\Users\\Remi\\Desktop\\canardmasque.png";
using (Stream stm = File.Create(filepath))
{
png.Save(stm);
}
}
开发者ID:remi-hernandez,项目名称:renderHelixViewPort3d,代码行数:32,代码来源:MainWindow.xaml.cs
示例2: AddVehiclePoints
private ScreenSpaceLines3D AddVehiclePoints(Viewport3D mainViewport, Point3D[] pointsArray)
{
ScreenSpaceLines3D wireVehicle=new ScreenSpaceLines3D();
Color color = Colors.Red;
const int width = 1;
wireVehicle.Thickness = width;
wireVehicle.Color = color;
wireVehicle.Points.Add(pointsArray[0]);
wireVehicle.Points.Add(pointsArray[1]);
wireVehicle.Points.Add(pointsArray[1]);
wireVehicle.Points.Add(pointsArray[2]);
wireVehicle.Points.Add(pointsArray[2]);
wireVehicle.Points.Add(pointsArray[3]);
wireVehicle.Points.Add(pointsArray[3]);
wireVehicle.Points.Add(pointsArray[0]);
wireVehicle.Points.Add(pointsArray[4]);
wireVehicle.Points.Add(pointsArray[5]);
wireVehicle.Points.Add(pointsArray[5]);
wireVehicle.Points.Add(pointsArray[6]);
wireVehicle.Points.Add(pointsArray[6]);
wireVehicle.Points.Add(pointsArray[7]);
wireVehicle.Points.Add(pointsArray[7]);
wireVehicle.Points.Add(pointsArray[4]);
wireVehicle.Points.Add(pointsArray[0]);
wireVehicle.Points.Add(pointsArray[4]);
wireVehicle.Points.Add(pointsArray[1]);
wireVehicle.Points.Add(pointsArray[5]);
wireVehicle.Points.Add(pointsArray[2]);
wireVehicle.Points.Add(pointsArray[6]);
wireVehicle.Points.Add(pointsArray[3]);
wireVehicle.Points.Add(pointsArray[7]);
return wireVehicle;
}
开发者ID:RadSt,项目名称:WPF-App-For-Ref,代码行数:34,代码来源:Calculation3D.cs
示例3: render
public GeometryModel3D[] render()
{
Model3DGroup modelGroup = new Model3DGroup();
Viewport3D visualisation = new Viewport3D();
ModelVisual3D modelsVisual = new ModelVisual3D();
int depthPoint = 0;
//Setup viewport environment
init = new ViewportCalibrator(this.cp);
visualisation = init.setupViewport(init.setupCamera(), this.cp.ActualHeight, this.cp.ActualWidth);
//Create triangle mesh
for (int y = 0; y < 480; y += pos)
{
for (int x = 0; x < 640; x += pos)
{
pts[depthPoint] = Triangle(x, y, pos);
pts[depthPoint].Transform = new TranslateTransform3D(0, 0, 0);
modelGroup.Children.Add(pts[depthPoint]);
depthPoint++;
}
}
//Add mesh to visualisation and viewport/canvas
modelGroup.Children.Add(init.setupDirectionalLights(Colors.White));
modelsVisual.Content = modelGroup;
visualisation.Children.Add(modelsVisual);
cp.Children.Add(visualisation);
Canvas.SetTop(visualisation, 0);
Canvas.SetLeft(visualisation, 0);
return pts;
}
开发者ID:robinj,项目名称:parse-client,代码行数:34,代码来源:TriangularPointCloud.cs
示例4: JuegoPiano
public JuegoPiano(Viewport3D viewport3D)
{
Jugadores = new Dictionary<int,Jugador>();
//Se inicializa el teclado con el número de octavas
Teclado = new Teclado(2);
Teclado.Draw3D(viewport3D);
this.Viewport3D = viewport3D;
//init WS
pianoWSDuplexClient = new PianoWSDuplexClient();
pianoWSDuplexClient.SetEjecutarNotaAction(delegate(string nota) {
Tecla tecla = Teclado.Teclas[nota];
tecla.UpdatePosition(new Point3D(0, - tecla.Dimensiones.Alto, 0));
tecla.Sonar();
//Timer para regresar la tecla a su lugar original
DispatcherTimer dispatcherTimer = new DispatcherTimer();
dispatcherTimer.Tick += new EventHandler((Action<object, EventArgs>)delegate(object sender, EventArgs e)
{
tecla.UpdatePosition(new Point3D(0, 0, 0));
(sender as DispatcherTimer).Stop();
});
dispatcherTimer.Interval = new TimeSpan(0, 0, 0, 1);
dispatcherTimer.Start();
});
}
开发者ID:hongo2001,项目名称:PianoVirtual-Kinect,代码行数:25,代码来源:JuegoPiano.cs
示例5: PointVisualizer
// These are used by the 2 constructor overloads that don't take int
//private ModelVisual3D _dotModel = null;
//private ModelVisual3D _velocityModel = null;
//private ModelVisual3D _accelerationModel = null;
#endregion
#region Constructor
public PointVisualizer(Viewport3D viewport, SharedVisuals sharedVisuals)
{
_viewport = viewport;
_sharedVisuals = sharedVisuals;
_items = new ItemProperties[3];
// Position
_items[INDEX_POSITION] = new ItemProperties();
_items[INDEX_POSITION].IsPoint = true;
_items[INDEX_POSITION].Color = Colors.Magenta;
_items[INDEX_POSITION].SizeMultiplier = 1d;
// Velocity
_items[INDEX_VELOCITY] = new ItemProperties();
_items[INDEX_VELOCITY].IsPoint = false;
_items[INDEX_VELOCITY].Color = Colors.Chartreuse;
_items[INDEX_VELOCITY].SizeMultiplier = 1d;
// Acceleration
_items[INDEX_ACCELERATION] = new ItemProperties();
_items[INDEX_ACCELERATION].IsPoint = false;
_items[INDEX_ACCELERATION].Color = Colors.Gold;
_items[INDEX_ACCELERATION].SizeMultiplier = 1d;
}
开发者ID:charlierix,项目名称:AsteroidMiner,代码行数:34,代码来源:PointVisualizer.cs
示例6: Export_SimpleModel_ValidOutput
public void Export_SimpleModel_ValidOutput()
{
string path = "temp.x3d";
var runner = new CrossThreadTestRunner();
runner.RunInSTA(
delegate
{
Console.WriteLine(Thread.CurrentThread.GetApartmentState());
var vp = new Viewport3D();
vp.Camera = CameraHelper.CreateDefaultCamera();
vp.Width = 1280;
vp.Height = 720;
vp.Children.Add(new DefaultLightsVisual3D());
var box = new BoxVisual3D();
box.UpdateModel();
vp.Children.Add(box);
using (var e = new X3DExporter(path))
{
e.Export(vp);
}
});
var result = Validate(path);
Assert.IsNull(result, result);
}
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:28,代码来源:X3DExporterTests.cs
示例7: Point3DtoPoint2D
/// <summary>
/// Code adapted from HelixToolkit.Wpf.Viewport3DHelper.Point3DtoPoint2D obtained from http://github.com/helix-toolkit/helix-toolkit
/// License: helix-toolkit.LICENSE.txt
/// </summary>
/// <param name="viewport"></param>
/// <param name="point"></param>
/// <returns></returns>
public static Point Point3DtoPoint2D(Viewport3D viewport, Point3D point)
{
var matrix = GetTotalTransform(viewport);
var pointTransformed = matrix.Transform(point);
var pt = new Point(pointTransformed.X, pointTransformed.Y);
return pt;
}
开发者ID:node-net,项目名称:Node.Net,代码行数:14,代码来源:Viewport3D.Extension.cs
示例8: FlipTransition
public FlipTransition()
{
_viewport = TransitionResources["3DCube"] as Viewport3D;
_rootModel = (_viewport.Children[0] as ModelVisual3D).Content as Model3DGroup;
_cubeModelContainer = _rootModel.Children[1] as Model3DGroup;
}
开发者ID:slytsal,项目名称:nmtmdz,代码行数:7,代码来源:FlipTransition.cs
示例9: StereoControl
public StereoControl()
{
viewport = new Viewport3D();
Camera = CameraHelper.CreateDefaultCamera();
Camera.Changed += Camera_Changed;
Children = new ObservableCollection<Visual3D>();
}
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:7,代码来源:StereoControl.cs
示例10: Export
/// <summary>
/// Exports the specified viewport.
/// </summary>
/// <param name="viewport">
/// The viewport.
/// </param>
public void Export(Viewport3D viewport)
{
int m = this.OversamplingMultiplier;
var background = this.Background;
if (background == null)
{
background = Brushes.Transparent;
}
var bmp = Viewport3DHelper.RenderBitmap(viewport, background, m);
BitmapEncoder encoder;
string ext = Path.GetExtension(this.FileName);
switch (ext.ToLower())
{
case ".jpg":
var jpg = new JpegBitmapEncoder();
jpg.Frames.Add(BitmapFrame.Create(bmp));
encoder = jpg;
break;
case ".png":
var png = new PngBitmapEncoder();
png.Frames.Add(BitmapFrame.Create(bmp));
encoder = png;
break;
default:
throw new InvalidOperationException("Not supported file format.");
}
using (Stream stm = File.Create(this.FileName))
{
encoder.Save(stm);
}
}
开发者ID:sivarajankumar,项目名称:dentalsmile,代码行数:40,代码来源:BitmapExporter.cs
示例11: drawTor
public static void drawTor(Point3D center, double R, double r, int N, int n, Color color, Viewport3D mainViewport)
{
if (n < 2 || N < 2)
{
return;
}
Model3DGroup tor = new Model3DGroup();
Point3D[,] points = new Point3D[N, n];
for (int i = 0; i < N; i++)
{
for (int j = 0; j < n; j++)
{
points[i, j] = getPositionTor(R, r, i * 360 / (N - 1), j * 360 / (n - 1));
points[i, j] += (Vector3D)center;
}
}
Point3D[] p = new Point3D[4];
for (int i = 0; i < N - 1; i++)
{
for (int j = 0; j < n - 1; j++)
{
p[0] = points[i, j];
p[1] = points[i + 1, j];
p[2] = points[i + 1, j + 1];
p[3] = points[i, j + 1];
drawTriangle(p[0], p[1], p[2], color, mainViewport);
drawTriangle(p[2], p[3], p[0], color, mainViewport);
}
}
}
开发者ID:Mexahoid,项目名称:CSF,代码行数:34,代码来源:LoTVLogics.cs
示例12: ExplosionWithVisual
public ExplosionWithVisual(Point3D centerPoint, double waveSpeed, double forceAtCenter, double maxRadius, Viewport3D viewport, double visualStartRadius)
: base(centerPoint, waveSpeed, forceAtCenter, maxRadius)
{
_viewport = viewport;
_visualStartRadius = visualStartRadius;
CreateVisual();
}
开发者ID:charlierix,项目名称:AsteroidMiner,代码行数:7,代码来源:Explosion.cs
示例13: 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
示例14: Draw
public void Draw(Viewport3D mainViewport)
{
foreach (PianoKey pk in _PianoKeys)
{
pk.Draw(mainViewport);
}
}
开发者ID:hempnall,项目名称:pianokeyboard,代码行数:7,代码来源:Piano.cs
示例15: ExportSimpleModel
/// <summary>
/// Exports a simple model in a STA.
/// </summary>
/// <param name="e">The exporter.</param>
/// <param name="stream">The stream.</param>
protected void ExportSimpleModel(IExporter e, Stream stream)
{
Exception exception = null;
CrossThreadTestRunner.RunInSTA(
() =>
{
var vp = new Viewport3D { Camera = CameraHelper.CreateDefaultCamera(), Width = 1280, Height = 720 };
vp.Children.Add(new DefaultLights());
var box = new BoxVisual3D();
box.UpdateModel();
vp.Children.Add(box);
try
{
e.Export(vp, stream);
}
catch (Exception ex)
{
exception = ex;
}
});
if (exception != null)
{
throw exception;
}
}
开发者ID:JeremyAnsel,项目名称:helix-toolkit,代码行数:31,代码来源:ExporterTests.cs
示例16: 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
示例17: GenieTransition
public GenieTransition()
{
_viewport =
Application.LoadComponent(new Uri("/FluidKit;component/Controls/Transition/Genie/Genie.xaml",
UriKind.Relative)) as Viewport3D;
_slidingScreen = _viewport.FindName("SlidingScreen") as GeometryModel3D;
NameScope.GetNameScope(_viewport).UnregisterName("SlidingScreen");
}
开发者ID:GroupXTech,项目名称:Yatse2,代码行数:8,代码来源:GenieTransition.cs
示例18: Export
public void Export(Viewport3D viewport)
{
object obj = viewport;
if (CreateResourceDictionary)
obj = WrapInResourceDictionary(obj);
XamlWriter.Save(obj, xw);
}
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:8,代码来源:XamlExporter.cs
示例19: BeginTransition3D
protected override void BeginTransition3D(TransitionElement transitionElement, ContentPresenter oldContent, ContentPresenter newContent, Viewport3D viewport)
{
Brush clone = CreateBrush(oldContent);
Size size = transitionElement.RenderSize;
MeshGeometry3D leftDoor = CreateMesh(new Point3D(),
new Vector3D(size.Width / 2, 0, 0),
new Vector3D(0, size.Height, 0),
1,
1,
new Rect(0, 0, 0.5, 1));
GeometryModel3D leftDoorGeometry = new GeometryModel3D();
leftDoorGeometry.Geometry = leftDoor;
leftDoorGeometry.Material = new DiffuseMaterial(clone);
AxisAngleRotation3D leftRotation = new AxisAngleRotation3D(new Vector3D(0, 1, 0), 0);
leftDoorGeometry.Transform = new RotateTransform3D(leftRotation);
GeometryModel3D rightDoorGeometry = new GeometryModel3D();
MeshGeometry3D rightDoor = CreateMesh(new Point3D(size.Width / 2, 0, 0),
new Vector3D(size.Width / 2, 0, 0),
new Vector3D(0, size.Height, 0),
1,
1,
new Rect(0.5, 0, 0.5, 1));
rightDoorGeometry.Geometry = rightDoor;
rightDoorGeometry.Material = new DiffuseMaterial(clone);
AxisAngleRotation3D rightRotation = new AxisAngleRotation3D(new Vector3D(0, 1, 0), 0);
rightDoorGeometry.Transform = new RotateTransform3D(rightRotation, size.Width, 0, 0);
Model3DGroup doors = new Model3DGroup();
doors.Children.Add(leftDoorGeometry);
doors.Children.Add(rightDoorGeometry);
ModelVisual3D model = new ModelVisual3D();
model.Content = doors;
// Replace old content in visual tree with new 3d model
transitionElement.HideContent(oldContent);
viewport.Children.Add(model);
DoubleAnimation da = new DoubleAnimation(90 - 0.5 * FieldOfView, Duration);
leftRotation.BeginAnimation(AxisAngleRotation3D.AngleProperty, da);
da = new DoubleAnimation(-(90 - 0.5 * FieldOfView), Duration);
rightRotation.BeginAnimation(AxisAngleRotation3D.AngleProperty, da);
da = new DoubleAnimation(0, Duration);
da.Completed += delegate
{
EndTransition(transitionElement, oldContent, newContent);
};
clone.BeginAnimation(Brush.OpacityProperty, da);
}
开发者ID:bradsjm,项目名称:LaJustPowerMeter,代码行数:58,代码来源:DoorTransition.cs
示例20: Draw
public static void Draw(Teclado teclado, Viewport3D viewport3D, Dimensiones dimTeclaBlanca, Dimensiones dimTeclaNegra)
{
Dictionary<string, Tecla> teclas = teclado.Teclas;
int numTeclas = teclas.Count;
double separacionTeclas = 0.02;
double offsetX = -calcularAnchoTeclado(teclado, dimTeclaBlanca.Ancho, separacionTeclas)/2;
//Dimensiones auxiliares con margen
Dimensiones dimTeclaNegraConMargen = new Dimensiones();
dimTeclaNegraConMargen.Ancho = dimTeclaNegra.Ancho + separacionTeclas * 2;
dimTeclaNegraConMargen.Profundidad = dimTeclaNegra.Profundidad + separacionTeclas;
dimTeclaNegraConMargen.Alto = dimTeclaNegra.Alto;
for (int i = 0, iTeclaBlanca = 0; i < numTeclas; i++)
{
Tecla tecla = teclas.ElementAt(i).Value;
Tecla teclaAnterior = (i == 0) ? null : teclas.ElementAt(i - 1).Value;
Tecla teclaSiguiente = (i == numTeclas - 1) ? null : teclas.ElementAt(i + 1).Value;
double posicionX = offsetX + iTeclaBlanca * dimTeclaBlanca.Ancho;
posicionX += iTeclaBlanca * separacionTeclas;
ModelVisual3D model = null;
// tecla blanca
if (typeof(TeclaBlanca3D) == tecla.GetType())
{
if (isTeclaBlanca(teclaAnterior))
{
if (isTeclaBlanca(teclaSiguiente))
{
//blanca con anterior blanca y siguiente blanca
model = DrawTeclaBlancaTipoA(tecla, dimTeclaBlanca, posicionX, BrushesTeclas.Blanco);
}
else
{
//blanca con anterior blanca y siguiente negra;
model = DrawTeclaBlancaTipoB(tecla, dimTeclaBlanca, dimTeclaNegraConMargen, posicionX, BrushesTeclas.Blanco);
}
}
else
{
if (isTeclaBlanca(teclaSiguiente))
{
//blanca con anterior negra y siguiente blanca
model = DrawTeclaBlancaTipoC(tecla, dimTeclaBlanca, dimTeclaNegraConMargen, posicionX, BrushesTeclas.Blanco);
}
else
{
//blanca con anterior negra y siguiente negra;
model = DrawTeclaBlancaTipoD(tecla, dimTeclaBlanca, dimTeclaNegraConMargen, posicionX, BrushesTeclas.Blanco);
}
}
iTeclaBlanca++;
}
else //tecla negra
{
posicionX += separacionTeclas;
model = DrawTeclaNegra(tecla, dimTeclaNegra, posicionX, BrushesTeclas.Negro);
}
viewport3D.Children.Add(model);
}
}
开发者ID:hongo2001,项目名称:PianoVirtual-Kinect,代码行数:58,代码来源:TecladoDrawer3D.cs
注:本文中的System.Windows.Controls.Viewport3D类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论