PlaneGeometry
Generated geometry representing a flat 2D plane.
PlaneGeometry creates a rectangular, axis-aligned plane centered at the origin in local space. Its orientation selects which axis the plane faces, its width and height define the plane’s extents along the two remaining axes, and optional subdivision counts allow the plane to be tessellated for deformation, smooth shading, or procedural effects.
cpp
auto geometry = vglx::PlaneGeometry::Create({
.width = 5.0f,
.height = 3.0f,
.width_segments = 2,
.height_segments = 2,
.orientation = vglx::PlaneGeometry::Orientation::FaceY
});
auto material = vglx::PhongMaterial::Create({.color = 0x049EF4u});
my_scene->Add(vglx::Mesh::Create(geometry, material));INFO
Derives from Geometry and inherits all public properties and methods.
Construction
Constructors
PlaneGeometry()
Constructs a plane geometry.
cpp
PlaneGeometry::PlaneGeometry(const Parameters& params);| Parameter | Description |
|---|---|
| params | Initialization parameters used to generate the plane. |
Factories preferred
PlaneGeometry::Create() std::shared_ptr<PlaneGeometry>
Creates a shared instance of PlaneGeometry with default parameters.
cpp
static std::shared_ptr<PlaneGeometry> PlaneGeometry::Create();PlaneGeometry::Create() std::shared_ptr<PlaneGeometry>
Creates a shared instance of PlaneGeometry with custom parameters.
cpp
static std::shared_ptr<PlaneGeometry> PlaneGeometry::Create(const Parameters& params);| Parameter | Description |
|---|---|
| params | Initialization parameters used to generate the plane. |
Types
PlaneGeometry::Orientation enum
Determines which axis the plane faces in local space.
| Value | Description |
|---|---|
| FaceX | Normal points along +X (plane spans the ZY axes). |
| FaceY | Normal points along +Y (plane spans the XZ axes). |
| FaceZ | Normal points along +Z (plane spans the XY axes). |
PlaneGeometry::Parameters struct
Parameters for constructing a PlaneGeometry object.
| Parameter | Description |
|---|---|
| width float | Width of the plane. |
| height float | Height of the plane. |
| width_segments unsigned | Subdivisions along the plane's width. |
| height_segments unsigned | Subdivisions along the plane's height. |
| orientation Orientation | Axis the plane faces in local space. |