WPF 3D Common classes (1)

Source: Internet
Author: User

Original: WPF 3D common Class (1)

Geometric Data related classes Geometry3d

Abstract class, used to define the geometry data of an object, can be used to calculate hittest and BoundingBox

MeshGeometry3D

Geometry3d, defines the vertices of the mesh, triangle vertices, normals, Texture (texture) coordinates

Common properties: Positions, Triangleindices, NORAMLS, texturecoordinates

Model-related classes (model = Geometry data + deformation (position, rotation, size) + material) Model3D

Abstract class, which represents a 3D model, subclasses are: Light, GeometryModel3D, Model3DGroup

GeometryModel3D

Model3D sub-class, not only contains the object geometry data geometry, also contains the object material matrial, deformation transform

<geometrymodel3d Geometry= "{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>

Instances of multiple GeometryModel3D can share an instance of Geometry3d, and transform can render different objects by simply setting the material.

A visual-related class (containing a Model3D object) Visual3D

The responsibilities of visual are:

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

Features that are not included are:

    • Event Handling
    • Layout
    • Styles
    • Data binding
    • Globalization

Abstract class, Viewport3d.children is a collection of Visual3D objects

The Visual3D class has an attribute Visual3dmodel, and the type of the property is Model3D

Class Visual3D

{

Model3D Visual3dmodel {get;set;}

}

ModelVisual3D

Visual3D subclasses, add content, children and other attributes

Easily confusing names: Visual3D, ModelVisual3D, Model3D, Visual3dmodel (attribute name)

Viewport3D

Responsible for rendering 3D objects, HitTest, roughly by Camera + a set of ModelVisual3D objects (Lights + multiple GeometryModel3D objects)

Viewport2dvisual3d

For placing a 2D object, such as a button, TextBlock on a 3D object

<viewport2dvisual3d geometry="{StaticResource plane}">
<Viewport2DVisual3D.Material> <diffusematerial viewport2dvisual3d.isvisualhostmaterial=" True " /> </Viewport2DVisual3D.Material> <Button>3.5!</Button> </Viewport2DVisual3D>
Viewport3DVisual

To draw a set of 3D objects on a 2D object

UIElement3D (Support event)

UIElement3D

Modeluielement3d: Similar to ModelVisual3D, but supports events

Containeruielement3d: A set of Modeluielement3d, but does not express itself

WPF 3D Common Class (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.