Foundation: three-dimensional mesh geometry

Source: Internet
Author: User

In the classes that make up the Microsoft Windows presentation Foundation, those classes in the System.Windows.Media.Media3D namespace are prominent. The purpose of these classes is to enable mainstream Windows® applications to display three-dimensional graphics. Like Windows presentation Foundation 2D graphics, 3D graphics can often be accessed easily with Extensible Application Markup Language (XAML), but the similarity between them is very small. 3D graphics programming involves very different concepts and conventions. Where the same part of the 2D is the area of the brush: you always use a 2D brush to cover the surface of the 3D visual area.

Figure 1 shows the hello3d, which is a 3D version of the traditional "Hello, World" program. If you are running Windows Vista™ or Windows XP with the Microsoft®.net Framework 3.0 runtime installed, just use the Internet explorer® to start the XAML code that produces the graphic, from And you can see the image (see Figure 2).

Figure 1 Hello3d Image

3D viewing area

In 3D graphics programming, there are no lines, Bézier spline curves, rectangles, or ellipses. Each 3D object is a collection of triangles in the three-dimensional coordinate space. Triangles are the basic units of 3D programming, because each individual triangle can always define a plane, and a set of triangles can mimic a stereo object or even simulate a surface. As you delve into 3D programming, you will look at everything in your life with triangles.

As Hello3d.xaml shows, the 3D view is made up of Viewport3D elements. A 3D scene requires one or more geometrymodel3d types of objects, one or more light sources, and a camera that controls how the 3D object is projected onto the 2D surface to control how the viewer sees the image.

The GeometryModel3D element has three important attributes: Geometry, Material, and backmaterial. The Geometry property is set to the MeshGeometry3D element, which is used to describe the visual object based on the coordinate points and triangles. The Material and Backmaterial properties describe how the front and rear surfaces of an object are shaded. In Hello3d.xaml, these two properties are set to objects of the diffusematerial type. The Material attribute is VisualBrush, consisting of TextBlock containing the word "Hello, world". The Backmaterial property is just a red brush. (If you want to see the back of the object, change the camera Position property to "0 0-5" and change the Lookdirection to "0 0 1".) )

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.