Skip to content

CylinderGeometry

Generates a cylinder geometry assignable to any mesh.

[CylinderGeometry](/reference/geometries/cylinder_geometry) creates a 3D cylinder composed of triangle primitives, with configurable top and bottom radii, height, and segment subdivisions. It can also be open-ended, excluding the caps.

cpp
auto geometry = vglx::CylinderGeometry::Create({
    .radius_top = 0.8f,
    .radius_bottom = 1.0f,
    .height = 2.5f,
    .radial_segments = 32,
    .height_segments = 3,
    .open_ended = false
});

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


CylinderGeometry()

cpp
vglx::CylinderGeometry::CylinderGeometry(const Parameters &params)
ParameterDescription
paramsCylinderGeometry::Parameters

Constructs a CylinderGeometry object.

Factories preferred


CylinderGeometry::Create() auto

cpp
static auto vglx::CylinderGeometry::Create()

Creates a shared pointer to a CylinderGeometry object with default parameters.

CylinderGeometry::Create() auto

cpp
static auto vglx::CylinderGeometry::Create(const Parameters &params)
ParameterDescription
paramsCylinderGeometry::Parameters

Creates a shared pointer to a CylinderGeometry object.

Types

CylinderGeometry::Parameters struct

NameTypeDescription
heightfloatHeight of the cylinder.
height_segmentsunsigned intSubdivisions along the height.
open_endedboolWhether the cylinder is open ended.
radial_segmentsunsigned intSubdivisions along the radius.
radius_bottomfloatBottom radius of the cylinder.
radius_topfloatTop radius of the cylinder.

Released under the MIT License.