Custom geometry for filled planar polygons. More...
| Import Statement: | import Clayground.Canvas3D |
Poly3DGeometry triangulates one outer ring of 2D points plus any number of inner rings (holes) into a filled, planar mesh. It is typically used through the Poly3D component rather than directly.
The mesh is indexed and carries positions and one shared face normal - the smallest layout that draws a filled area. Asking for edges swaps in a second layout that adds the barycentric channel the wireframe shader reads; which of the two is in use is not something a caller has to think about.
Example usage:
import QtQuick3D import Clayground.Canvas3D Model { geometry: Poly3DGeometry { vertices: [Qt.vector2d(0, 0), Qt.vector2d(100, 0), Qt.vector2d(50, 80)] } materials: DefaultMaterial { diffuseColor: "#0f9d9a" } }
See also Poly3D.
edgeColor : color |
Absolute edge color; a visible alpha is what counts as set.
edgeColorFactor : real |
Darkening factor applied to the fill when edgeColor is unset.
edgeMode : enumeration |
Which lines the wireframe draws.
| Constant | Description |
|---|---|
Poly3DGeometry.FaceBorders | the polygon outline only (default) |
Poly3DGeometry.Triangles | every edge of the triangulation |
edgeThickness : real |
Edge line thickness in pixels.
extrude : real |
How far the polygon rises along the plane normal.
0, the default, is a flat area. Anything above it turns the ring into a prism: the ring is the base, side walls rise along the plane normal and a cap closes the top. Holes get walls too. Defaults to 0.
hasEdgeAttributes : bool |
Whether the uploaded buffer carries the barycentric channel.
holes : list<list<vector2d>> |
Inner rings cut out of the polygon.
Each entry is a ring in the same format as vertices. Rings that lie outside the outer ring or overlap each other are not repaired.
plane : enumeration |
Which world plane the 2D points map to.
| Constant | Description |
|---|---|
Poly3DGeometry.XZ | (u, v) becomes (u, 0, v), normal +Y (default) |
Poly3DGeometry.XY | (u, v) becomes (u, v, 0), normal +Z |
Poly3DGeometry.YZ | (u, v) becomes (0, u, v), normal +X |
showEdges : bool |
Whether the polygon draws its own edges.
Setting it true for the first time rebuilds the mesh in the layout that carries the barycentric channel. That layout is kept from then on, so toggling the property afterwards costs a uniform write rather than a rebuild. Defaults to false.
surfaceOffset : real |
How far the finished mesh is slid along the plane normal.
Applied after the ring is triangulated and after extrude, so a prism is displaced rather than resized: the height keeps measuring from the ring's own plane. Negative values push the polygon the other way. Defaults to 0, which leaves the mesh byte for byte as it would be without the property.
vertices : list<vector2d> |
The outer ring of the polygon.
A list of 2D points in the polygon's plane. The ring closes implicitly, so a repeated last point is dropped. Winding does not matter - it is normalised while building.