SphereGeometry
Generates a sphere geometry assignable to any mesh.
SphereGeometry 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()
Constructs a SphereGeometry object.
cpp
SphereGeometry::SphereGeometry(const Parameters& params);| Parameter | Description |
|---|---|
| params | SphereGeometry::Parameters |
Factories preferred
SphereGeometry::Create() auto
Creates a shared pointer to a SphereGeometry object with default parameters.
cpp
static auto SphereGeometry::Create();SphereGeometry::Create() auto
Creates a shared pointer to a SphereGeometry object.
cpp
static auto SphereGeometry::Create(const Parameters& params);| Parameter | Description |
|---|---|
| params | SphereGeometry::Parameters |
Types
SphereGeometry::Parameters struct
Parameters for constructing a SphereGeometry object.
| Parameter | Description |
|---|---|
| radius float | Radius of the sphere. |
| width_segments unsigned | Subdivisions along the width. |
| height_segments unsigned | Subdivisions along the height. |