Commonly used WPF 3D classes (1)

Source: Internet
Author: User
Document directory
  • Geometry3D
  • MeshGeometry3D
  • Model3D
  • GeometryModel3D
  • Visual3D
  • ModelVisual3D
  • Viewport3D
  • Viewport2DVisual3D
  • Viewport3DVisual
Geometry3D

Abstract class, used to define the geometric data of objects and can be used to calculate HitTest and BoundingBox

 

MeshGeometry3D

A subclass of Geometry3D that defines the coordinates of the mesh vertex, triangle vertex, normal, and Texture (Texture ).

Common attributes: Positions, TriangleIndices, Noramls, TextureCoordinates

 

Model-related class (model = geometric data + deformation (location, rotation, size) + material) Model3D

Abstract class, indicating a 3D model, subclass: Light, GeometryModel3D, Model3DGroup

 

GeometryModel3D

The subclass of Model3D not only contains the ry of the object's geometric data, but also contains the material Matrial of the object, deformation Transform

<GeometryModel3DGeometry= "{StaticResource myTeapot}">

<GeometryModel3D.Material>
<DiffuseMaterial>
<DiffuseMaterial. Brush>
<SolidColorBrush Color = "Blue" Opacity = "1.0"/> </DiffuseMaterial. Brush>
</DiffuseMaterial>
</GeometryModel3D. Material>

<GeometryModel3D.Transform>
<RotateTransform3D>
<RotateTransform3D. Rotation>
<AxisAngleRotation3D x: Name = "myAngleRotation" Axis = "0, 3, 0" Angle = "1"/>
</RotateTransform3D. Rotation>
</RotateTransform3D>
</GeometryModel3D. Transform>

</GeometryModel3D>

----------------------------------------------------------------------

<GeometryModel3D>  <GeometryModel3D.Geometry>          <MeshGeometry3D               Positions="-1 -1 0  1 -1 0  -1 1 0  1 1 0"              Normals="0 0 1  0 0 1  0 0 1  0 0 1"              TextureCoordinates="0 1  1 1  0 0  1 0   "              TriangleIndices="0 1 2  1 3 2" />      </GeometryModel3D.Geometry>      <GeometryModel3D.Material>          <DiffuseMaterial>              <DiffuseMaterial.Brush>                  <SolidColorBrush Color="Cyan" Opacity="0.3"/>              </DiffuseMaterial.Brush>          </DiffuseMaterial>      </GeometryModel3D.Material>      <GeometryModel3D.Transform>          <TranslateTransform3D            OffsetX="2" OffsetY="0" OffsetZ="-1"   >          </TranslateTransform3D>      </GeometryModel3D.Transform>  </GeometryModel3D>

Multiple GeometryModel3D instances can share a Geometry3D instance. You only need to set Material that is not available, and Transform can present different objects.

 

 

Visual-related class (including a Model3D object) Visual3D

Visual has the following responsibilities:

  • Output display
  • Transformations
  • Hittesting
  • Clipping
  • Bounding box calculations

The following functions are not available:

  • Event handling
  • Layout
  • Styles
  • Data binding
  • Globalization

Abstract class. Viewport3D. Children is a set of Visual3D objects.

The Visual3D class has a property: Visual3DModel. The property type is Model3D.

Class Visual3D

{

Model3D Visual3DModel {get; set ;}

}

 

ModelVisual3D

Added attributes such as Content and Children to the subclass of Visual3D.

 

Confusing names: Visual3D, ModelVisual3D, Model3D, and Visual3DModel (attribute name)

 

Viewport3D

Responsible for rendering 3D objects, HitTest, which is roughly composed of Camera + A set of ModelVisual3D objects (Lights + multiple GeometryModel3D objects)

Viewport2DVisual3D

It is used to place a 2D object, such as a Button or TextBlock, on a 3D object.

<Viewport2DVisual3D Geometry="{StaticResource plane}">
<Viewport2DVisual3D.Material> <DiffuseMaterial Viewport2DVisual3D.IsVisualHostMaterial="true" /> </Viewport2DVisual3D.Material> <Button>3.5!</Button> </Viewport2DVisual3D>
Viewport3DVisual

Draw a group of 3D objects on a 2D Object

 

UIElement3D (event supported)

UIElement3D

ModelUIElement3D: similar to ModelVisual3D, but supports events

ContainerUIElement3D: a set of ModelUIElement3D, but does not represent itself

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.