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 ¶ms)
Parameter | Description |
---|---|
params | CylinderGeometry::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 ¶ms)
Parameter | Description |
---|---|
params | CylinderGeometry::Parameters |
Creates a shared pointer to a CylinderGeometry object.
Types
CylinderGeometry::Parameters struct
Name | Type | Description |
---|---|---|
height | float | Height of the cylinder. |
height_segments | unsigned int | Subdivisions along the height. |
open_ended | bool | Whether the cylinder is open ended. |
radial_segments | unsigned int | Subdivisions along the radius. |
radius_bottom | float | Bottom radius of the cylinder. |
radius_top | float | Top radius of the cylinder. |