← Back to Docs
  • index.html
  • Clayground
  • Clayground.Canvas3D
  • Box3DGeometry
  • Clayground 2025.2
  • Box3DGeometry QML Type

    Custom geometry for 3D boxes with edge rendering support. More...

    Import Statement: import Clayground.Canvas3D

    Properties

    Detailed Description

    Box3DGeometry provides the geometry data for rendering 3D boxes with customizable dimensions, face scaling, and edge rendering. It is typically used internally by the Box3D QML component.

    The geometry is centered on the X and Z axes, with the origin at the bottom center (Y=0 is the floor).

    Example usage:

    import QtQuick3D
    import Clayground.Canvas3D
    
    Model {
        geometry: Box3DGeometry {
            size: Qt.vector3d(2, 3, 2)
            showEdges: true
            edgeThickness: 0.05
        }
        materials: DefaultMaterial { diffuseColor: "red" }
    }

    See also Box3D.

    Property Documentation

    edgeColorFactor : real

    Darkening factor for edge colors.

    A value between 0 and 1 that determines how dark the edges appear relative to the base color. Lower values create darker edges. Defaults to 0.4.


    edgeMask : int

    Bitmask controlling which edges are visible.

    Use the EdgeFlags enum values combined with bitwise OR to select specific edges. Defaults to AllEdges.

    ConstantDescription
    Box3DGeometry.AllEdgesShow all edges (0xFF)
    Box3DGeometry.TopEdgesShow only top face edges
    Box3DGeometry.BottomEdgesShow only bottom face edges
    Box3DGeometry.FrontEdgesShow only front face edges
    Box3DGeometry.BackEdgesShow only back face edges
    Box3DGeometry.LeftEdgesShow only left face edges
    Box3DGeometry.RightEdgesShow only right face edges

    edgeThickness : real

    The thickness of edge lines in normalized units.

    Controls how thick the edge lines appear. Defaults to 0.03.


    faceScale : vector2d

    Scale factor applied to the selected face.

    When scaledFace is set to a specific face, this vector determines how much that face is scaled in its local X and Y dimensions. Useful for creating pyramids, trapezoids, and other non-uniform shapes.

    Defaults to (1, 1).


    scaledFace : enumeration

    Which face of the box should be scaled.

    ConstantDescription
    Box3DGeometry.NoFaceNo face scaling (default)
    Box3DGeometry.TopFaceScale the top face
    Box3DGeometry.BottomFaceScale the bottom face
    Box3DGeometry.FrontFaceScale the front face
    Box3DGeometry.BackFaceScale the back face
    Box3DGeometry.LeftFaceScale the left face
    Box3DGeometry.RightFaceScale the right face

    showEdges : bool

    Whether to render edge lines on the box.

    When true, dark lines are drawn along the edges of the box for a cartoon-style appearance. Defaults to true.


    size : vector3d

    The dimensions of the box as a 3D vector (width, height, depth).

    Defaults to (1, 1, 1).