Class Procedural2DModelBuilder
- Namespace
- Stride.CommunityToolkit.Rendering.ProceduralModels
- Assembly
- Stride.CommunityToolkit.dll
A helper class for generating 2D procedural models based on a specified primitive model type and size.
public static class Procedural2DModelBuilder
- Inheritance
-
Procedural2DModelBuilder
Methods
Build(Primitive2DModelType, Vector2?, float)
Generates a 2D procedural model based on the specified primitive model type, size, and depth.
public static PrimitiveProceduralModelBase Build(Primitive2DModelType type, Vector2? size = null, float depth = 0)
Parameters
type
Primitive2DModelTypeThe type of 2D primitive model to create (e.g., Circle, Square, Triangle).
size
Vector2?The size parameters for the model as a Vector2, where X and Y represent the dimensions. If null, default dimensions for the model type will be used.
depth
floatThe depth of the 2D model, which affects its thickness in 3D space.
Returns
- PrimitiveProceduralModelBase
A PrimitiveProceduralModelBase object representing the generated 2D model. The dimensions of the model will be determined by the provided
size
anddepth
, or default dimensions ifsize
is null.
Remarks
This method creates different types of 2D procedural models (such as Rectangle, Circle, etc.) with the specified size and depth. The depth adds a third dimension to the 2D shape, turning it into a 3D object (e.g., a 2D rectangle becomes a 3D rectangular prism).
Exceptions
- InvalidOperationException
Thrown when an unsupported
type
is specified.