export type BoundingBoxGizmoTheme = HandleGizmoTheme; /** * Draws corner brackets around the world bounds of the attached nodes, with a dot at each node's * origin. Face and corner handles resize the bounds, scaling each node along its local axes * nearest the world axes. * * ```javascript * const layer = Gizmo.createLayer(app, 'Bounds', undefined, true); * const gizmo = new BoundingBoxGizmo(cameraComponent, layer); * gizmo.attach([entity]); * ``` * * Relevant Engine API examples: * * - [Bounding Box Gizmo](https://playcanvas.github.io/#/gizmos/bounding-box) * - [Editor](https://playcanvas.github.io/#/misc/editor) * * @category Gizmo */ export class BoundingBoxGizmo extends HandleGizmo { /** * Creates a new BoundingBoxGizmo object. * * @param {CameraComponent} camera - The camera component. * @param {Layer} layer - The render layer. * @example * const gizmo = new BoundingBoxGizmo(camera, layer); */ constructor(camera: CameraComponent, layer: Layer); /** * Whether to show handles at the center of each face. Defaults to true. * * @type {boolean} */ faceHandles: boolean; /** * Whether to show handles at the corners. Defaults to true. * * @type {boolean} */ cornerHandles: boolean; /** * Whether a resize keeps the center in place. Defaults to false. * * @type {boolean} */ centered: boolean; /** * Whether corner handles scale evenly. Defaults to false. * * @type {boolean} */ uniform: boolean; /** * Whether to join the brackets with dashed edges. Defaults to true. * * @type {boolean} */ edges: boolean; /** * The arm length as a fraction of the half edge. Defaults to 0.3. * * @type {number} */ armLength: number; /** * The padding on each side, in world units. Defaults to 0.01. * * @type {number} */ padding: number; /** * The arm thickness in CSS pixels. Defaults to 2. * * @type {number} */ armThickness: number; /** * The bounds gathered this frame. * * @type {BoundingBox} * @private */ private _bounds; /** * Whether no bounds were gathered this frame. * * @type {boolean} * @private */ private _empty; /** * The box center. * * @private */ private _center; /** * The box half extents, padding included. * * @private */ private _halfExtents; /** * The center at the start of a resize. * * @private */ private _startCenter; /** * The half extents at the start of a resize, padding included. * * @private */ private _startHalfExtents; /** * The positions of the attached nodes at the start of a resize. * * @type {Vec3[]} * @private */ private _startPositions; /** * The local scales of the attached nodes at the start of a resize. * * @type {Vec3[]} * @private */ private _startScales; /** * Adds the bounds of an enabled node's render, model and gsplat components. * * @param {GraphNode} node - The node to add the bounds of. * @private */ private _addNode; /** * Adds a box to the bounds. * * @param {BoundingBox} aabb - The box to add. * @private */ private _add; /** * Adds the bounds of the visible mesh instances. * * @param {readonly MeshInstance[]} meshInstances - The mesh instances to add. * @private */ private _addMeshInstances; /** * Draws the corner brackets and dashed edges. * * @param {Vec3[]} corners - The world corners, indexed by their x, y and z bits. * @private */ private _drawBrackets; } import type { HandleGizmoTheme } from './handle-gizmo.js'; import { HandleGizmo } from './handle-gizmo.js'; import type { CameraComponent } from '../../../framework/components/camera/component.js'; import type { Layer } from '../../../scene/layer.js';