GeometryModel3D を手書き

             //TriangleIndices="0 1 2  0 2 3 "
             //Positions="0 0 0,  1 0 0, 1 1 0, 0 1 0"
             //TextureCoordinates="0,1 1,1 1,0 0,0 "
             //Normals="0,0,1 0,0,1 0,0,1 0,0,1"

            MeshGeometry3D mg3d = new MeshGeometry3D();
            mg3d.Positions = new Point3DCollection { new Point3D(0, 0, 0), new Point3D(1, 0, 0), new Point3D(1, 1, 0), new Point3D(0, 1, 0) };
            mg3d.TriangleIndices = new Int32Collection { 0,1,2,0,2,3};
            mg3d.TextureCoordinates = new PointCollection{ new Point(0, 1), new Point(1, 1), new Point(1, 0), new Point(0, 0)};
            mg3d.Normals = new Vector3DCollection { new Vector3D(0, 0, 1), new Vector3D(0, 0, 1), new Vector3D(0, 0, 1), new Vector3D(0, 0, 1) };

            GeometryModel3D gm3d = new GeometryModel3D();

            MediaElement me = new MediaElement();
            me.Source = new Uri(@"……….\Wildlife.wmv");

            TextBlock someText = new TextBlock();
            FontSizeConverter myFontSizeConverter = new FontSizeConverter();
            someText.FontSize = (double)myFontSizeConverter.ConvertFrom("30pt");
            someText.Text = "Hello, World!";

            VisualBrush vb = new VisualBrush();
            vb.Visual = someText;
または
            vb.Visual = me;

            gm3d.Material = new DiffuseMaterial(vb);
            gm3d.Geometry = mg3d;

            this.BoxOR9.Children.Add(gm3d);

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です