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);| Parameter | Description |
|---|---|
| params | CylinderGeometry::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);| Parameter | Description |
|---|---|
| params | CylinderGeometry::Parameters |
Types
CylinderGeometry::Parameters struct
| Parameter | Description |
|---|---|
| radius_top float | Top radius of the cylinder. |
| radius_bottom float | Bottom radius of the cylinder. |
| height float | Height of the cylinder. |
| radial_segments unsigned int | Subdivisions along the radius. |
| height_segments unsigned int | Subdivisions along the height. |
| open_ended bool | Whether the cylinder is open ended. |