WasmGPU.geometry.sphere¶
Summary¶
WasmGPU.geometry.sphere builds geometry data for a primitive or procedural shape. The returned Geometry can be reused by multiple meshes.
Syntax¶
WasmGPU.geometry.sphere(radius?: number, widthSegments?: number, heightSegments?: number): Geometry
const result = wgpu.geometry.sphere(radius, widthSegments, heightSegments);
Parameters¶
| Name | Type | Required | Description |
|---|---|---|---|
radius |
number |
No | Radius value used by circular/spherical primitives. |
widthSegments |
number |
No | Numeric input controlling widthSegments for this operation. |
heightSegments |
number |
No | Numeric input controlling heightSegments for this operation. |
Returns¶
Geometry - Generated Geometry object containing vertex/index data and computed bounds.
Type Details¶
Example¶
const canvas = document.querySelector("canvas");
const wgpu = await WasmGPU.create(canvas);
const radius = 1;
const widthSegments = 1;
const heightSegments = 1;
const result = wgpu.geometry.sphere(radius, widthSegments, heightSegments);
console.log(result);
See Also¶
- WasmGPU.geometry.box
- WasmGPU.geometry.cartesianCurve
- WasmGPU.geometry.cartesianSurface
- WasmGPU.geometry.circle
- WasmGPU.geometry.custom
- WasmGPU.geometry.cylinder
- WasmGPU.geometry.ellipse
- WasmGPU.geometry.line
- WasmGPU.geometry.parametricCurve
- WasmGPU.geometry.parametricSurface
- WasmGPU.geometry.plane
- WasmGPU.geometry.point