Skip to content

ConeGeometry

Generated geometry representing a cone.

ConeGeometry constructs a mesh for a cone aligned along the +Y axis. It is defined by a radius at the base, a height, optional segmentation along both radial and vertical directions, and an option to create an open or closed bottom cap. The geometry is centered in local space with its tip at +Y.

cpp
auto geometry = vglx::ConeGeometry::Create({
  .radius = 0.5f,
  .height = 2.0f,
  .radial_segments = 32,
  .height_segments = 4,
  .open_ended = false
});

auto material = vglx::PhongMaterial::Create(0xF2B632);

my_scene->Add(vglx::Mesh::Create(geometry, material));

INFO

Derives from CylinderGeometry and inherits all public properties and methods.

Construction

Constructors


ConeGeometry()

Constructs a cone geometry.

cpp
ConeGeometry::ConeGeometry(const Parameters& params);
ParameterDescription
paramsInitialization parameters for constructing the geometry.

Factories preferred


ConeGeometry::Create() std::shared_ptr<ConeGeometry>

Creates a shared instance of ConeGeometry with default parameters.

cpp
static std::shared_ptr<ConeGeometry> ConeGeometry::Create();

ConeGeometry::Create() std::shared_ptr<ConeGeometry>

Creates a shared instance of ConeGeometry with custom parameters.

cpp
static std::shared_ptr<ConeGeometry> ConeGeometry::Create(const Parameters& params);
ParameterDescription
paramsInitialization parameters for constructing the geometry.

Types

ConeGeometry::Parameters struct

Parameters for constructing a ConeGeometry object.

ParameterDescription
radius floatBase radius of the cone.
height floatHeight along the +Y axis.
radial_segments unsignedNumber of radial subdivisions.
height_segments unsignedNumber of vertical subdivisions.
open_ended boolIf true, the bottom cap is omitted.

Released under the MIT License.