SphereGeometry
Generates a sphere geometry assignable to any mesh.
[SphereGeometry](/reference/geometries/sphere_geometry)
creates a UV sphere composed of triangles, configurable via radius, width segments (longitude), and height segments (latitude). It’s useful for rendering planets, lighting probes, collision volumes, or decorative primitives.
cpp
auto geometry = vglx::SphereGeometry::Create({
.radius = 1.5f,
.width_segments = 48,
.height_segments = 24
});
auto mesh = vglx::Mesh::Create(geometry, UnlitMaterial::Create(0x049EF4));
my_scene->Add(mesh);
INFO
Derives from Geometry and inherits all public properties and methods.
Construction
Constructors
SphereGeometry()
cpp
vglx::SphereGeometry::SphereGeometry(const Parameters ¶ms)
Parameter | Description |
---|---|
params | SphereGeometry::Parameters |
Constructs a SphereGeometry object.
Factories preferred
SphereGeometry::Create() auto
cpp
static auto vglx::SphereGeometry::Create()
Creates a shared pointer to a SphereGeometry object with default parameters.
SphereGeometry::Create() auto
cpp
static auto vglx::SphereGeometry::Create(const Parameters ¶ms)
Parameter | Description |
---|---|
params | SphereGeometry::Parameters |
Creates a shared pointer to a SphereGeometry object.
Types
SphereGeometry::Parameters struct
Parameters for constructing a SphereGeometry object.
Name | Type | Description |
---|---|---|
height_segments | unsigned | Subdivisions along the height. |
radius | float | Radius of the sphere. |
width_segments | unsigned | Subdivisions along the width. |