Skip to main content

Crate ferroui_media3d

Crate ferroui_media3d 

Source
Expand description

WPF-style 3D for FerroUI (#608, docs/porting/media3d.md).

The values of System.Windows.Media.Media3D, with WPF’s names and behaviour and Rust types: Point3D, Vector3D, Size3D, Rect3D, Point4D, Matrix3D and Quaternion, with double-precision components (narrowed to single precision only when a scene is handed to the GPU). Their operators are the traits of std::ops, the members WPF guards with exceptions return a Result, and each value parses and writes WPF’s text form in the invariant culture ("0,0,5", "Identity", "Empty"), which is also the form markup writes them in.

The scene model of Viewport3D, with WPF’s classes and properties:

A Viewport3DVisual compiles its scene into an immutable Scene3DSnapshot (world matrices, shared meshes, material layers, lights in world space, the camera with its planes fitted to the scene, and three generations), which Viewport3D draws through the render-data operation DrawScene3D; the renderers are in another crate.

register_types adds the classes, the markup metadata of the values and collections (their text converters) and the XML namespace of the framework to the tables of the markup loader.

Structs§

AmbientLight
WPF’s AmbientLight: light of the same colour everywhere, from no direction.
AxisAngleRotation3D
WPF’s AxisAngleRotation3D: a rotation by Angle degrees about Axis, counterclockwise when the axis points at the viewer. An axis of (nearly) zero length is no rotation.
Camera
WPF’s Camera: the base of the cameras, with a Transform that places the camera in the world.
CameraVTable
The virtual table of the class.
DiffuseMaterial
WPF’s DiffuseMaterial: its Brush, filtered by Color, lit by the lights (the ambient lights through AmbientColor).
DirectionalLight
WPF’s DirectionalLight: parallel light travelling along Direction ((0, 0, -1) by default).
EmissiveMaterial
WPF’s EmissiveMaterial: its Brush, filtered by Color, added without light.
Geometry3D
WPF’s Geometry3D: the base of the 3D geometries.
Geometry3DVTable
The virtual table of the class.
GeometryModel3D
WPF’s GeometryModel3D: a Geometry drawn with Material on its front faces (counterclockwise to the camera) and BackMaterial on its back faces.
Int32Collection
WPF’s Int32Collection: the triangle indices of a mesh. Its text form is the numbers separated by white space or commas ("0 1 2", "0,1,2").
Light
WPF’s Light: the base of the lights, with a Color (white by default).
Material
WPF’s Material: the base of the materials.
MaterialCollection
WPF’s MaterialCollection: the children of a MaterialGroup.
MaterialGroup
WPF’s MaterialGroup: its Children drawn in order, each over the ones before.
Matrix3D
A 4x4 transformation of 3D space, with double-precision elements (WPF’s System.Windows.Media.Media3D.Matrix3D).
MatrixCamera
WPF’s MatrixCamera: the camera of a ViewMatrix and a ProjectionMatrix.
MatrixTransform3D
WPF’s MatrixTransform3D: the transform of its Matrix.
MeshData
The compiled form of a scene, shared with the renderers (defined by the base library, which the backends depend on). The triangles of a mesh, in single precision, shared by every model and snapshot that draws it.
MeshGeometry3D
WPF’s MeshGeometry3D: Positions, Normals, TextureCoordinates and TriangleIndices.
Model3D
WPF’s Model3D: the base of the models and the lights.
Model3DCollection
WPF’s Model3DCollection: the children of a Model3DGroup.
Model3DGroup
WPF’s Model3DGroup: its Children under its transform.
Model3DVTable
The virtual table of the class.
ModelVisual3D
WPF’s ModelVisual3D: shows the model of its Content and its Children.
OrthographicCamera
WPF’s OrthographicCamera: a parallel projection Width wide (2 by default).
PerspectiveCamera
WPF’s PerspectiveCamera: a perspective projection with a horizontal FieldOfView in degrees (45 by default).
Point3D
A location in 3D space, with double-precision coordinates (WPF’s System.Windows.Media.Media3D.Point3D).
Point3DCollection
WPF’s Point3DCollection: the positions of a mesh. Its text form is the points separated by white space, each x,y,z ("0,0,0 1,0,0 0,1,0").
Point4D
A point in homogeneous coordinates (x, y, z, w), with double-precision coordinates (WPF’s System.Windows.Media.Media3D.Point4D). A Point3D is the point with w 1; a projective Matrix3D transforms a Point4D without the divide by w.
PointLight
WPF’s PointLight: light in every direction from Position.
PointLightBase
WPF’s PointLightBase: light from Position, as far as Range (infinite by default), attenuated by 1 / (ConstantAttenuation + LinearAttenuation d + QuadraticAttenuation d^2) (1, 0 and 0 by default).
ProjectionCamera
WPF’s ProjectionCamera: a camera at Position looking along LookDirection with UpDirection up, between NearPlaneDistance and FarPlaneDistance.
Quaternion
A rotation in 3D space, with double-precision components (WPF’s System.Windows.Media.Media3D.Quaternion): (x, y, z) is the axis scaled by the sine of half the angle, w the cosine of half the angle.
QuaternionRotation3D
WPF’s QuaternionRotation3D: the rotation of its Quaternion.
Rect3D
An axis-aligned box in 3D space: a location (its corner of least coordinates) and a size, with double-precision values (WPF’s System.Windows.Media.Media3D.Rect3D). The bounds of the 3D scene model are boxes.
RotateTransform3D
WPF’s RotateTransform3D: the rotation of its Rotation about the center (CenterX, CenterY, CenterZ). Without a rotation it is the identity.
Rotation3D
WPF’s Rotation3D: the base of the rotations.
Rotation3DVTable
The virtual table of the class.
ScaleTransform3D
WPF’s ScaleTransform3D: a scale by ScaleX, ScaleY and ScaleZ about the center (CenterX, CenterY, CenterZ).
Scene3DBounds
The compiled form of a scene, shared with the renderers (defined by the base library, which the backends depend on). An axis-aligned box in single precision: the bounds of a mesh or of a scene.
Scene3DCamera
The compiled form of a scene, shared with the renderers (defined by the base library, which the backends depend on). The camera of a snapshot: its matrices for the aspect ratio of the viewport.
Scene3DFrame
The compiled form of a scene, shared with the renderers (defined by the base library, which the backends depend on). What a drawing context is asked to draw: a snapshot, over bounds (the viewport in the current coordinates of the context, whose transform maps them to the target).
Scene3DMaterialLayer
The compiled form of a scene, shared with the renderers (defined by the base library, which the backends depend on). One layer of the material of a model: a MaterialGroup is flattened into its layers, in order, each drawn over the ones before.
Scene3DModel
The compiled form of a scene, shared with the renderers (defined by the base library, which the backends depend on). A model to draw: a GeometryModel3D with its world matrix and its materials.
Scene3DSnapshot
The compiled form of a scene, shared with the renderers (defined by the base library, which the backends depend on). An immutable, shared scene: see the documentation of the module.
Size3D
The extent of a box in 3D space, with double-precision dimensions (WPF’s System.Windows.Media.Media3D.Size3D).
SpecularMaterial
WPF’s SpecularMaterial: highlights of its Brush, filtered by Color, as sharp as SpecularPower (40 by default), added to what is below.
SpotLight
WPF’s SpotLight: light from Position in a cone along Direction, full inside InnerConeAngle (180 degrees by default) and none beyond OuterConeAngle (90 degrees by default), both full angles in degrees.
Transform3D
WPF’s Transform3D: the base of the 3D transforms.
Transform3DCollection
WPF’s Transform3DCollection: the children of a Transform3DGroup.
Transform3DGroup
WPF’s Transform3DGroup: its Children applied in order (the first one first).
Transform3DVTable
The virtual table of the class.
TranslateTransform3D
WPF’s TranslateTransform3D: a translation by OffsetX, OffsetY and OffsetZ.
Vector3D
A displacement in 3D space, with double-precision components (WPF’s System.Windows.Media.Media3D.Vector3D).
Vector3DCollection
WPF’s Vector3DCollection: the normals of a mesh, in the text form of Point3DCollection.
Viewport3D
WPF’s Viewport3D: the scene of its Camera and Children (the visuals of a Viewport3DVisual, which this control hosts), drawn over its arranged bounds.
Viewport3DVisual
WPF’s Viewport3DVisual; see the documentation of the module.
Visual3D
WPF’s Visual3D: the base of the 3D visuals, with a Transform.
Visual3DCollection
WPF’s Visual3DCollection: the children of a ModelVisual3D, a Viewport3DVisual and a Viewport3D.

Enums§

Matrix3DError
The error of Matrix3D::invert: the matrix has no inverse (its determinant is zero, within the tolerance of Matrix3D::has_inverse). WPF throws InvalidOperationException.
QuaternionError
The error of Quaternion::from_axis_angle: the axis is the zero vector, which names no rotation. WPF throws InvalidOperationException.
Scene3DCameraKind
The compiled form of a scene, shared with the renderers (defined by the base library, which the backends depend on). The kind of the camera a snapshot was made with.
Scene3DChange
What a change of a scene object changes in a compiled scene: which generation of the snapshot it bumps.
Scene3DLight
The compiled form of a scene, shared with the renderers (defined by the base library, which the backends depend on). A light in world space.
Scene3DMaterialKind
The compiled form of a scene, shared with the renderers (defined by the base library, which the backends depend on). What a material layer adds to the colour of a model.
Size3DError
The error of the members of Size3D and Rect3D that WPF guards: a negative dimension (WPF’s ArgumentException), or a change of the Empty value (WPF’s InvalidOperationException).

Statics§

ASSEMBLY
What this crate states about itself for markup: its assembly name and the namespaces the XML namespace of the framework maps to (see the documentation of the module for the one name they share with the base library).

Traits§

CameraImpl
The overridable members introduced by the class.
CameraImplExt
Access to the base implementations of the overridable members.
Geometry3DImpl
The overridable members introduced by the class.
Geometry3DImplExt
Access to the base implementations of the overridable members.
Model3DImpl
The overridable members introduced by the class.
Model3DImplExt
Access to the base implementations of the overridable members.
Rotation3DImpl
The overridable members introduced by the class.
Rotation3DImplExt
Access to the base implementations of the overridable members.
Transform3DImpl
The overridable members introduced by the class.
Transform3DImplExt
Access to the base implementations of the overridable members.

Functions§

register_types
Registers the namespaces, the classes, the markup metadata and the assembly of this crate (and those of the control library and the base library) with the tables of known types, and the nullable forms of the values and the collections with the untyped value conversions. Cheap and idempotent; nothing is initialised until a type is used.