Table of Contents

Class CapsuleProceduralModel

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

Procedurally generates a 2D capsule (stadium) mesh composed of two semicircles and a central rectangle. Mesh instances are cached per dimension/tessellation/UV combination for reuse.

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

Properties

Radius

Gets or sets the radius of the capsule.

public float Radius { get; set; }

Property Value

float

Tessellation

Gets or sets the tessellation for the semicircle ends (higher values = smoother curves).

public int Tessellation { get; set; }

Property Value

int

TotalHeight

Gets or sets the total height of the capsule (including the two semicircles).

public float TotalHeight { get; set; }

Property Value

float

Methods

CreateMesh(float, float, int, float, float, bool)

Builds a new capsule mesh (without caching) using provided parameters.

public static GeometricMeshData<VertexPositionNormalTexture> CreateMesh(float height = 1, float radius = 0.25, int tessellation = 16, float uScale = 1, float vScale = 1, bool toLeftHanded = false)

Parameters

height float

Total capsule height including semicircular ends.

radius float

Radius of the semicircular ends.

tessellation int

Segments used for each semicircle (minimum clamped internally).

uScale float

Texture U scale factor.

vScale float

Texture V scale factor.

toLeftHanded bool

If true, reverses winding for left‑handed coordinates.

Returns

GeometricMeshData<VertexPositionNormalTexture>

Mesh data for the requested capsule.

CreatePrimitiveMeshData()

Creates mesh data using current property values, honoring UV scale.

protected override GeometricMeshData<VertexPositionNormalTexture> CreatePrimitiveMeshData()

Returns

GeometricMeshData<VertexPositionNormalTexture>

New(float, float, int, float, float, bool)

Retrieves (or builds and caches) a capsule mesh with the specified dimensions and options.

public static GeometricMeshData<VertexPositionNormalTexture> New(float height = 1, float radius = 0.25, int tessellation = 16, float uScale = 1, float vScale = 1, bool toLeftHanded = false)

Parameters

height float

Total capsule height including semicircular ends.

radius float

Radius of the semicircular ends.

tessellation int

Segments used for each semicircle (minimum clamped internally).

uScale float

Texture U scale factor.

vScale float

Texture V scale factor.

toLeftHanded bool

If true, reverses winding for left‑handed coordinates.

Returns

GeometricMeshData<VertexPositionNormalTexture>

Mesh data for the requested capsule.