Skip to content

CylinderGeometry

Generates a cylinder geometry assignable to any mesh.

CylinderGeometry 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()

Constructs a CylinderGeometry object.

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

Factories preferred


CylinderGeometry::Create() auto

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

cpp
static auto CylinderGeometry::Create();

CylinderGeometry::Create() auto

Creates a shared pointer to a CylinderGeometry object.

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

Types

CylinderGeometry::Parameters struct

ParameterDescription
radius_top floatTop radius of the cylinder.
radius_bottom floatBottom radius of the cylinder.
height floatHeight of the cylinder.
radial_segments unsigned intSubdivisions along the radius.
height_segments unsigned intSubdivisions along the height.
open_ended boolWhether the cylinder is open ended.

Released under the MIT License.