0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

cscの作法 その591

Posted at

概要

cscの作法、調べてみた。
wpf3d、やってみた。

写真

image.png

サンプルコード


using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Media.Media3D;

class Main3d: Window {
	public Main3d() {
		var pos = new Point3DCollection();
		pos.Add(new Point3D(1, 0, 0));
		pos.Add(new Point3D(0, 1, 0));
		pos.Add(new Point3D(0, 0, 0));
		var model = new GeometryModel3D();
		model.Geometry = new MeshGeometry3D() {
			Positions = pos
		};
		model.Material = new DiffuseMaterial(Brushes.LightGreen);
		var light = new DirectionalLight();
		var cam = new PerspectiveCamera();
		cam.Position = new Point3D(0, 0, 5);
		var vp3d = new Viewport3D();
		vp3d.Camera = cam;
		vp3d.Children.Add(new ModelVisual3D() {
			Content = model
		});
		vp3d.Children.Add(new ModelVisual3D() {
			Content = light
		});
		Width = 400;
		Height = 400;
		Content = vp3d;
	}
	[STAThread]
	static void Main() {
		var wnd = new Main3d();
		wnd.ShowDialog();
	}
}



以上。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?