123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136 |
- import type { Observer } from "../Misc/observable";
- import { Observable } from "../Misc/observable";
- import type { Nullable } from "../types";
- import type { PointerInfo } from "../Events/pointerEvents";
- import { Vector3 } from "../Maths/math.vector";
- import { Color3 } from "../Maths/math.color";
- import "../Meshes/Builders/linesBuilder";
- import type { AbstractMesh } from "../Meshes/abstractMesh";
- import { Mesh } from "../Meshes/mesh";
- import type { Node } from "../node";
- import { PointerDragBehavior } from "../Behaviors/Meshes/pointerDragBehavior";
- import type { IGizmo } from "./gizmo";
- import { Gizmo } from "./gizmo";
- import { UtilityLayerRenderer } from "../Rendering/utilityLayerRenderer";
- import { StandardMaterial } from "../Materials/standardMaterial";
- import type { RotationGizmo } from "./rotationGizmo";
- import { ShaderMaterial } from "../Materials/shaderMaterial";
- /**
- * Interface for plane rotation gizmo
- */
- export interface IPlaneRotationGizmo extends IGizmo {
- /** Drag behavior responsible for the gizmos dragging interactions */
- dragBehavior: PointerDragBehavior;
- /** Drag distance in babylon units that the gizmo will snap to when dragged */
- snapDistance: number;
- /** Sensitivity factor for dragging */
- sensitivity: number;
- /**
- * Event that fires each time the gizmo snaps to a new location.
- * * snapDistance is the change in distance
- */
- onSnapObservable: Observable<{
- snapDistance: number;
- }>;
- /** Accumulated relative angle value for rotation on the axis. */
- angle: number;
- /** If the gizmo is enabled */
- isEnabled: boolean;
- /** Default material used to render when gizmo is not disabled or hovered */
- coloredMaterial: StandardMaterial;
- /** Material used to render when gizmo is hovered with mouse */
- hoverMaterial: StandardMaterial;
- /** Color used to render the drag angle sector when gizmo is rotated with mouse */
- rotationColor: Color3;
- /** Material used to render when gizmo is disabled. typically grey. */
- disableMaterial: StandardMaterial;
- }
- /**
- * Single plane rotation gizmo
- */
- export declare class PlaneRotationGizmo extends Gizmo implements IPlaneRotationGizmo {
- /**
- * Drag behavior responsible for the gizmos dragging interactions
- */
- dragBehavior: PointerDragBehavior;
- protected _pointerObserver: Nullable<Observer<PointerInfo>>;
- /**
- * Rotation distance in radians that the gizmo will snap to (Default: 0)
- */
- snapDistance: number;
- /**
- * Event that fires each time the gizmo snaps to a new location.
- * * snapDistance is the change in distance
- */
- onSnapObservable: Observable<{
- snapDistance: number;
- }>;
- /**
- * The maximum angle between the camera and the rotation allowed for interaction
- * If a rotation plane appears 'flat', a lower value allows interaction.
- */
- static MaxDragAngle: number;
- /**
- * Accumulated relative angle value for rotation on the axis. Reset to 0 when a dragStart occurs
- */
- angle: number;
- /**
- * Custom sensitivity value for the drag strength
- */
- sensitivity: number;
- /** Default material used to render when gizmo is not disabled or hovered */
- get coloredMaterial(): StandardMaterial;
- /** Material used to render when gizmo is hovered with mouse */
- get hoverMaterial(): StandardMaterial;
- /** Color used to render the drag angle sector when gizmo is rotated with mouse */
- set rotationColor(color: Color3);
- /** Material used to render when gizmo is disabled. typically grey. */
- get disableMaterial(): StandardMaterial;
- protected _isEnabled: boolean;
- protected _parent: Nullable<RotationGizmo>;
- protected _coloredMaterial: StandardMaterial;
- protected _hoverMaterial: StandardMaterial;
- protected _disableMaterial: StandardMaterial;
- protected _gizmoMesh: Mesh;
- protected _rotationDisplayPlane: Mesh;
- protected _dragging: boolean;
- protected _angles: Vector3;
- protected static _RotationGizmoVertexShader: string;
- protected static _RotationGizmoFragmentShader: string;
- protected _rotationShaderMaterial: ShaderMaterial;
- /**
- * Creates a PlaneRotationGizmo
- * @param planeNormal The normal of the plane which the gizmo will be able to rotate on
- * @param color The color of the gizmo
- * @param gizmoLayer The utility layer the gizmo will be added to
- * @param tessellation Amount of tessellation to be used when creating rotation circles
- * @param parent
- * @param useEulerRotation Use and update Euler angle instead of quaternion
- * @param thickness display gizmo axis thickness
- * @param hoverColor The color of the gizmo when hovering over and dragging
- * @param disableColor The Color of the gizmo when its disabled
- */
- constructor(planeNormal: Vector3, color?: Color3, gizmoLayer?: UtilityLayerRenderer, tessellation?: number, parent?: Nullable<RotationGizmo>, useEulerRotation?: boolean, thickness?: number, hoverColor?: Color3, disableColor?: Color3);
- /**
- * @internal
- * Create Geometry for Gizmo
- * @param parentMesh
- * @param thickness
- * @param tessellation
- * @returns
- */
- protected _createGizmoMesh(parentMesh: AbstractMesh, thickness: number, tessellation: number): {
- rotationMesh: Mesh;
- collider: Mesh;
- };
- protected _attachedNodeChanged(value: Nullable<Node>): void;
- /**
- * If the gizmo is enabled
- */
- set isEnabled(value: boolean);
- get isEnabled(): boolean;
- /**
- * Disposes of the gizmo
- */
- dispose(): void;
- }
|