Table of Contents

Class PolygonProceduralModel

Namespace
Stride.CommunityToolkit.Rendering.ProceduralModels
Assembly
Stride.CommunityToolkit.dll

Generates a planar polygon mesh (convex fan triangulation) from an arbitrary set of 2D vertices.

public class PolygonProceduralModel : PrimitiveProceduralModelBase, IProceduralModel
Inheritance
PolygonProceduralModel
Implements
Inherited Members

Properties

Vertices

Vertex positions (XY plane) defining the polygon outline. Must contain at least 3 vertices.

public Vector2[] Vertices { get; set; }

Property Value

Vector2[]

Methods

CreateMesh(Vector2[], float, float, bool)

Builds a new mesh for the given points (no caching). Assumes convex ordering; uses fan triangulation.

public static GeometricMeshData<VertexPositionNormalTexture> CreateMesh(Vector2[] points, float uScale = 1, float vScale = 1, bool toLeftHanded = false)

Parameters

points Vector2[]
uScale float
vScale float
toLeftHanded bool

Returns

GeometricMeshData<VertexPositionNormalTexture>

CreatePrimitiveMeshData()

protected override GeometricMeshData<VertexPositionNormalTexture> CreatePrimitiveMeshData()

Returns

GeometricMeshData<VertexPositionNormalTexture>

CreateRectangle(Vector2)

Convenience factory for an axis-aligned rectangle centered at the origin.

public static PolygonProceduralModel CreateRectangle(Vector2 size)

Parameters

size Vector2

Returns

PolygonProceduralModel

CreateTriangle(Vector2)

Convenience factory for an isosceles triangle centered at the origin.

public static PolygonProceduralModel CreateTriangle(Vector2 size)

Parameters

size Vector2

Returns

PolygonProceduralModel

New(Vector2[], float, float, bool)

Creates (or retrieves from cache) a mesh for the supplied polygon vertex list.

public static GeometricMeshData<VertexPositionNormalTexture> New(Vector2[] vertices, float uScale = 1, float vScale = 1, bool toLeftHanded = false)

Parameters

vertices Vector2[]
uScale float
vScale float
toLeftHanded bool

Returns

GeometricMeshData<VertexPositionNormalTexture>