Table of Contents

Class ImmediateDebugPrimitives

Namespace
Stride.CommunityToolkit.DebugShapes
Assembly
Stride.CommunityToolkit.DebugShapes.dll

Provides methods for generating geometric primitives for debug visualization.

public static class ImmediateDebugPrimitives
Inheritance
ImmediateDebugPrimitives

Remarks

This type is the public entry point; the heavier mesh generation lives in Stride.CommunityToolkit.DebugShapes.CircularDebugPrimitives (circle, cylinder, cone) and Stride.CommunityToolkit.DebugShapes.SphericalDebugPrimitives (sphere, capsule), with the shared wireframe uv constants in Stride.CommunityToolkit.DebugShapes.DebugPrimitiveUv.

Methods

CopyFromGeometricPrimitive(GeometricMeshData<VertexPositionNormalTexture>, ref VertexPositionTexture[], ref int[])

Copies vertex positions and texture coordinates from a geometric primitive to arrays for rendering.

public static void CopyFromGeometricPrimitive(GeometricMeshData<VertexPositionNormalTexture> primitiveData, ref VertexPositionTexture[] vertices, ref int[] indices)

Parameters

primitiveData GeometricMeshData<VertexPositionNormalTexture>

The source geometric mesh data.

vertices VertexPositionTexture[]

The destination vertex array.

indices int[]

The destination index array.

GenerateCapsule(float, float, int, int)

Generates a capsule mesh with optional UV splits.

public static (VertexPositionTexture[] Vertices, int[] Indices) GenerateCapsule(float length, float radius, int tessellations, int uvSplits = 4)

Parameters

length float

The length of the capsule (distance between hemispheres).

radius float

The radius of the capsule.

tessellations int

The number of segments used to approximate the capsule.

uvSplits int

The number of UV splits for wireframe rendering.

Returns

(VertexPositionTexture[] Vertices, int[] Indices)

Arrays of vertices and indices representing the capsule.

GenerateCircle(float, int, int, float, bool, int)

Generates a circle mesh with optional UV splits and offset.

public static (VertexPositionTexture[] Vertices, int[] Indices) GenerateCircle(float radius = 0.5, int tessellations = 16, int uvSplits = 0, float yOffset = 0, bool isFlipped = false, int uvOffset = 0)

Parameters

radius float

The radius of the circle.

tessellations int

The number of segments used to approximate the circle.

uvSplits int

The number of UV splits for wireframe rendering.

yOffset float

Vertical offset for the circle.

isFlipped bool

Whether to flip the winding order.

uvOffset int

Offset for UV splits.

Returns

(VertexPositionTexture[] Vertices, int[] Indices)

Arrays of vertices and indices representing the circle.

GenerateCone(float, float, int, int, int)

Generates a cone mesh with optional UV splits for the top and bottom.

public static (VertexPositionTexture[] Vertices, int[] Indices) GenerateCone(float height, float radius, int tessellations, int uvSplits = 4, int uvSplitsBottom = 0)

Parameters

height float

The height of the cone.

radius float

The radius of the base of the cone.

tessellations int

The number of segments used to approximate the cone.

uvSplits int

The number of UV splits for wireframe rendering (top).

uvSplitsBottom int

The number of UV splits for wireframe rendering (bottom).

Returns

(VertexPositionTexture[] Vertices, int[] Indices)

Arrays of vertices and indices representing the cone.

GenerateCube(float)

Generates a cube mesh with the specified size.

public static (VertexPositionTexture[] Vertices, int[] Indices) GenerateCube(float size = 1)

Parameters

size float

The size of the cube.

Returns

(VertexPositionTexture[] Vertices, int[] Indices)

Arrays of vertices and indices representing the cube.

GenerateCylinder(float, float, int, int, int?)

Generates a cylinder mesh with optional UV splits and circle side splits.

public static (VertexPositionTexture[] Vertices, int[] Indices) GenerateCylinder(float height = 1, float radius = 0.5, int tessellations = 16, int uvSplits = 4, int? uvSidesForCircle = null)

Parameters

height float

The height of the cylinder.

radius float

The radius of the cylinder.

tessellations int

The number of segments used to approximate the cylinder.

uvSplits int

The number of UV splits for wireframe rendering.

uvSidesForCircle int?

Number of sides for the circle caps (optional).

Returns

(VertexPositionTexture[] Vertices, int[] Indices)

Arrays of vertices and indices representing the cylinder.

GenerateQuad(float, float)

Generates a quad (rectangle) mesh with the specified width and height.

public static (VertexPositionTexture[] Vertices, int[] Indices) GenerateQuad(float width, float height)

Parameters

width float

The width of the quad.

height float

The height of the quad.

Returns

(VertexPositionTexture[] Vertices, int[] Indices)

Arrays of vertices and indices representing the quad.

GenerateSphere(float, int, int, int)

Generates a sphere mesh with optional UV splits and vertical offset.

public static (VertexPositionTexture[] Vertices, int[] Indices) GenerateSphere(float radius = 0.5, int tessellations = 16, int uvSplits = 4, int uvSplitOffsetVertical = 0)

Parameters

radius float

The radius of the sphere.

tessellations int

The number of segments used to approximate the sphere.

uvSplits int

The number of UV splits for wireframe rendering.

uvSplitOffsetVertical int

Vertical offset for UV splits.

Returns

(VertexPositionTexture[] Vertices, int[] Indices)

Arrays of vertices and indices representing the sphere.

GetCircleVector(int, int)

Calculates a vector on the circumference of a circle in the XZ plane.

public static Vector3 GetCircleVector(int i, int tessellation)

Parameters

i int

The index of the segment.

tessellation int

The total number of segments in the circle.

Returns

Vector3

A Vector3 representing the position on the circle.