BoxGeometry
Generates a box geometry assignable to any mesh.
[BoxGeometry](/reference/geometries/box_geometry)
creates a 3D box or rectangular box composed of triangles, based on configurable width, height, and depth. Optional segment parameters allow for subdividing each face, enabling smoother lighting or custom deformation effects.
cpp
auto geometry = vglx::BoxGeometry::Create({
.width = 2.0f,
.height = 1.0f,
.depth = 3.0f,
.width_segments = 2,
.height_segments = 2,
.depth_segments = 2
});
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
BoxGeometry()
cpp
vglx::BoxGeometry::BoxGeometry(const Parameters ¶ms)
Parameter | Description |
---|---|
params | BoxGeometry::Parameters |
Constructs a BoxGeometry object.
Factories preferred
BoxGeometry::Create() auto
cpp
static auto vglx::BoxGeometry::Create()
Creates a shared pointer to a BoxGeometry object with default parameters.
BoxGeometry::Create() auto
cpp
static auto vglx::BoxGeometry::Create(const Parameters ¶ms)
Parameter | Description |
---|---|
params | BoxGeometry::Parameters |
Creates a shared pointer to a BoxGeometry object.
Types
BoxGeometry::Parameters struct
Parameters for constructing a BoxGeometry object.
Name | Type | Description |
---|---|---|
depth | float | Depth of the box. |
depth_segments | unsigned | Subdivisions along the Z-axis. |
height | float | Height of the box. |
height_segments | unsigned | Subdivisions along the Y-axis. |
width | float | Width of the box. |
width_segments | unsigned | Subdivisions along the X-axis. |