Skip to content

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);
ParameterDescription
paramsInitialization 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);
ParameterDescription
paramsInitialization parameters used to generate the plane.

Types

PlaneGeometry::Orientation enum

Determines which axis the plane faces in local space.

ValueDescription
FaceXNormal points along +X (plane spans the ZY axes).
FaceYNormal points along +Y (plane spans the XZ axes).
FaceZNormal points along +Z (plane spans the XY axes).

PlaneGeometry::Parameters struct

Parameters for constructing a PlaneGeometry object.

ParameterDescription
width floatWidth of the plane.
height floatHeight of the plane.
width_segments unsignedSubdivisions along the plane's width.
height_segments unsignedSubdivisions along the plane's height.
orientation OrientationAxis the plane faces in local space.

Released under the MIT License.