BoxGeometry
Generates a box geometry assignable to any mesh.
BoxGeometry 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()
Constructs a BoxGeometry object.
cpp
BoxGeometry::BoxGeometry(const Parameters& params);| Parameter | Description |
|---|---|
| params | BoxGeometry::Parameters |
Factories preferred
BoxGeometry::Create() auto
Creates a shared pointer to a BoxGeometry object with default parameters.
cpp
static auto BoxGeometry::Create();BoxGeometry::Create() auto
Creates a shared pointer to a BoxGeometry object.
cpp
static auto BoxGeometry::Create(const Parameters& params);| Parameter | Description |
|---|---|
| params | BoxGeometry::Parameters |
Types
BoxGeometry::Parameters struct
Parameters for constructing a BoxGeometry object.
| Parameter | Description |
|---|---|
| width float | Width of the box. |
| height float | Height of the box. |
| depth float | Depth of the box. |
| width_segments unsigned | Subdivisions along the X-axis. |
| height_segments unsigned | Subdivisions along the Y-axis. |
| depth_segments unsigned | Subdivisions along the Z-axis. |