import { Camera } from "@babylonjs/core/Cameras/camera"; import { Matrix, Vector3 } from "@babylonjs/core/Maths/math.vector"; import { Observable } from "@babylonjs/core/Misc/observable"; import type { Scene } from "@babylonjs/core/scene"; import type { Nullable } from "@babylonjs/core/types"; import type { IMmdBindableCameraAnimation } from "./Animation/IMmdBindableAnimation"; import type { IMmdRuntimeCameraAnimation } from "./Animation/IMmdRuntimeAnimation"; import type { MmdCompositeRuntimeCameraAnimation } from "./Animation/mmdCompositeRuntimeCameraAnimation"; import type { MmdRuntimeCameraAnimation } from "./Animation/mmdRuntimeCameraAnimation"; import type { MmdRuntimeCameraAnimationContainer } from "./Animation/mmdRuntimeCameraAnimationContainer"; import type { IMmdCamera } from "./IMmdCamera"; import type { MmdRuntimeAnimationHandle } from "./mmdRuntimeAnimationHandle"; type RuntimeCameraAnimation = MmdRuntimeCameraAnimation | MmdRuntimeCameraAnimationContainer | MmdCompositeRuntimeCameraAnimation | IMmdRuntimeCameraAnimation; /** * MMD camera * * The MMD camera is a type of Arc Rotate Camera that determines the transform of the camera by the center position, rotation(yaw pitch roll), and distance parameters */ export declare class MmdCamera extends Camera implements IMmdCamera { /** * Gets or sets a boolean indicating that the scaling of the parent hierarchy will not be taken in account by the camera */ ignoreParentScaling: boolean; /** * Define the current target of the camera (default: (0, 10, 0)) */ target: Vector3; /** * Define the current rotation of the camera */ rotation: Vector3; /** * Define the current distance of the camera from its target (default: -45) */ distance: number; private readonly _viewMatrix; /** * Observable triggered when the current animation is changed * * Value is 30fps frame time duration of the animation */ readonly onAnimationDurationChangedObservable: Observable; private readonly _animationHandleMap; private _currentAnimation; /** * Creates a new MMD camera * @param name Defines the name of the camera in the scene * @param target Defines the target of the camera * @param scene Defines the scene the camera belongs too * @param setActiveOnSceneIfNoneActive Defines if the camera should be set as active after creation if no other camera have been defined in the scene */ constructor(name: string, target?: Vector3, scene?: Scene, setActiveOnSceneIfNoneActive?: boolean); /** * Define the current local position of the camera in the scene */ get position(): Vector3; set position(value: Vector3); /** * Update the position of the camera based on the target, distance, and rotation values * * position is automatically updated when view matrix is computed, so you usually don't need to call this method */ updatePosition(): void; /** * Bind the animation to the camera and return a handle to the runtime animation * @param animation MMD animation or MMD camera animation group to add * @returns A handle to the runtime animation */ createRuntimeAnimation(animation: IMmdBindableCameraAnimation): MmdRuntimeAnimationHandle; /** * Destroy a runtime animation by its handle * @param handle The handle of the runtime animation to destroy * @returns True if the animation was destroyed, false if it was not found */ destroyRuntimeAnimation(handle: MmdRuntimeAnimationHandle): boolean; /** * Set the current animation of the camera * * If handle is null, the current animation will be cleared * * @param handle The handle of the animation to set as current * @throws {Error} if the animation with the handle is not found */ setRuntimeAnimation(handle: Nullable): void; /** * Get the runtime animation map of the camera */ get runtimeAnimations(): ReadonlyMap; /** * Get the current animation of the camera */ get currentAnimation(): Nullable; /** * Duration of the animation in 30fps frame time */ get animationFrameTimeDuration(): number; /** * Animate the camera * @param frameTime The 30fps frame time */ animate(frameTime: number): void; private _storedTarget; private _storedRotation; private _storedDistance; /** * Store current camera state of the camera (fov, target, rotation, etc..) * @returns the camera */ storeState(): Camera; /** * Restored camera state. You must call storeState() first * @returns whether it was successful or not * @internal */ _restoreStateValues(): boolean; /** @internal */ _initCache(): void; /** * @internal */ _updateCache(ignoreParentClass?: boolean): void; /** @internal */ _isSynchronizedViewMatrix(): boolean; private static readonly _RotationMatrix; private static readonly _UpVector; private static readonly _TargetVector; /** @internal */ _getViewMatrix(): Matrix; /** * Gets the current object class name. * @returns the class name */ getClassName(): string; } export {};