GeometryFactory is a set of pure functions that create BufferGeometry instances from a GeometryConfig. It supports six primitives plus extrusion from SVG paths. Every mesh it creates has castShadow and receiveShadow set to true.
| Parameter | Default | Range | Description |
|---|---|---|---|
| width | 1 | > 0 | Width along X |
| height | 1 | > 0 | Height along Y |
| depth | 1 | > 0 | Depth along Z |
| widthSegments | 1 | 1-10 | Subdivisions along width |
| heightSegments | 1 | 1-10 | Subdivisions along height |
| depthSegments | 1 | 1-10 | Subdivisions along depth |
| Parameter | Default | Range | Description |
|---|---|---|---|
| radius | 0.5 | > 0 | Sphere radius |
| widthSegments / segments | 32 | 3-64 | Horizontal segments. Higher is smoother |
| heightSegments | half of widthSegments | 2-32 | Vertical segments |
Height segments default to Math.max(2, Math.round(widthSegments / 2)) when not specified.
| Parameter | Default | Range | Description |
|---|---|---|---|
| radiusTop | 0.5 | >= 0 | Top circle radius. Set to 0 for a cone shape |
| radiusBottom | 0.5 | >= 0 | Bottom circle radius |
| height | 1 | > 0 | Height along Y |
| radialSegments / segments | 16 | 3-64 | Faces around the circumference |
| Parameter | Default | Range | Description |
|---|---|---|---|
| radius | 0.5 | > 0 | Base circle radius |
| height | 1 | > 0 | Height from base to apex |
| radialSegments / segments | 16 | 3-64 | Faces around the circumference |
| Parameter | Default | Range | Description |
|---|---|---|---|
| radius | 0.5 | > 0 | Distance from torus center to tube center |
| tubeRadius | 0.2 | > 0 | Radius of the tube cross-section |
| radialSegments | 16 | 3-32 | Segments around the tube cross-section |
| tubularSegments / segments | 100 | 3-200 | Segments around the ring |
| Parameter | Default | Range | Description |
|---|---|---|---|
| radius | 0.5 | > 0 | Radius of the capsule |
| height | 1 | > 0 | Length of the middle cylindrical section |
| radialSegments / segments | 16 | 3-64 | Segments around the circumference |
Cap segments are hardcoded to 8.
extrudeFromShapes() takes an array of THREE.Shape objects parsed from SVG paths and creates an ExtrudeGeometry, centered after creation.
| Parameter | Default | Range | Description |
|---|---|---|---|
| extrudeDepth | 0.5 | 0.01-5 | How far the shape is extruded along Z |
| bevelEnabled | true | — | Whether to add beveled edges |
| bevelThickness | 0.05 | 0-0.5 | How deep the bevel cuts into the shape |
| bevelSize | 0.03 | 0-0.5 | How far the bevel extends outward |
| bevelSegments | 3 | 1-8 | Smoothness of the bevel curve |
At bevelSegments: 1 the bevel is a simple chamfer; at higher values it becomes a smooth curve.