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
Tessellation
Gets or sets the tessellation for the semicircle ends (higher values = smoother curves).
public int Tessellation { get; set; }
Property Value
TotalHeight
Gets or sets the total height of the capsule (including the two semicircles).
public float TotalHeight { get; set; }
Property Value
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
floatTotal capsule height including semicircular ends.
radius
floatRadius of the semicircular ends.
tessellation
intSegments used for each semicircle (minimum clamped internally).
uScale
floatTexture U scale factor.
vScale
floatTexture V scale factor.
toLeftHanded
boolIf 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
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
floatTotal capsule height including semicircular ends.
radius
floatRadius of the semicircular ends.
tessellation
intSegments used for each semicircle (minimum clamped internally).
uScale
floatTexture U scale factor.
vScale
floatTexture V scale factor.
toLeftHanded
boolIf true, reverses winding for left‑handed coordinates.
Returns
- GeometricMeshData<VertexPositionNormalTexture>
Mesh data for the requested capsule.