@xviewer.js/core 1.0.0-alpha.33 → 1.0.0-alpha.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xviewer.js/core",
3
- "version": "1.0.0-alpha.33",
3
+ "version": "1.0.0-alpha.34",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "sideEffects": false,
package/types/Viewer.d.ts CHANGED
@@ -114,7 +114,6 @@ export declare class Viewer extends EventEmitter {
114
114
  loadAsset(props: AssetProperties & TextureSettings): Promise<any>;
115
115
  addLoader(Loader: LoaderConstructor): void;
116
116
  load({ url, ext, onProgress, castShadow, receiveShadow, ...props }: AssetProperties & __P<Object3D, typeof Object3D>): Promise<any>;
117
- tween(target: Object): import("./tween").Tween<Object>;
118
117
  timeline(target: Object): import("./tween").TweenChain;
119
118
  killTweensOf(target: Object): void;
120
119
  traverseMaterials(callback: (mat: Material) => void): void;
@@ -1,8 +1,8 @@
1
1
  export declare const CinestationBlendStyle: {
2
- Linear: (amount: number) => number;
3
- QuadraticIn: (amount: number) => number;
4
- QuadraticOut: (amount: number) => number;
5
- QuadraticInOut: (amount: number) => number;
2
+ Linear: import("../tween").EasingFunction;
3
+ QuadraticIn: import("../tween").EasingFunction;
4
+ QuadraticOut: import("../tween").EasingFunction;
5
+ QuadraticInOut: import("../tween").EasingFunction;
6
6
  };
7
7
  export type CinestationBlendStyle = typeof CinestationBlendStyle[keyof typeof CinestationBlendStyle];
8
8
  export declare class CinestationBlendDefinition {
@@ -7,9 +7,7 @@ export declare class CinestationBrain extends Component<PerspectiveCamera> {
7
7
  private _vcamSolo;
8
8
  private _vcams;
9
9
  private _lerpTime;
10
- private _isChanged;
11
10
  brainBlend: CinestationBlendDefinition;
12
- onChanged: (v: boolean) => void;
13
11
  get vcam(): VirtualCamera;
14
12
  get vcams(): VirtualCamera[];
15
13
  lastUpdate(dt: number): void;
@@ -1,27 +1,28 @@
1
- import { Object3D, Quaternion, Spherical, Vector2, Vector3 } from "three";
1
+ import { Euler, Object3D, Quaternion, Vector2, Vector3 } from "three";
2
2
  import { VirtualCamera } from "./VirtualCamera";
3
3
  export declare class FreelookVirtualCamera extends VirtualCamera {
4
4
  static __loc0: Vector2;
5
5
  static __loc1: Vector2;
6
6
  static __center: Vector2;
7
7
  static __preCenter: Vector2;
8
- static __moveDelta: Vector2;
9
- static __worldPos: Vector3;
8
+ static __panDelta: Vector2;
9
+ static __panTarget: Vector2;
10
+ static __rotateDelta: Vector2;
10
11
  static __posDelta: Vector3;
11
12
  static __xAxis: Vector3;
12
13
  static __yAxis: Vector3;
13
14
  static __quat: Quaternion;
14
- static __spherical: Spherical;
15
- static __offsetDelta: Vector3;
16
15
  private _button;
17
16
  private _touchID;
18
- private _distanceDelta;
19
17
  private _preLoc0;
20
18
  private _preLoc1;
21
- private _rotateDelta;
22
- private _panDelta;
19
+ private _spherical;
20
+ private _lookAtPosition;
21
+ private _lookAtOffset;
23
22
  private _tempSmoothing;
24
- private _lookAtOffsetDelta;
23
+ private _targetFov;
24
+ private _targetLookAtOffset;
25
+ private _targetSpherical;
25
26
  forbidX: boolean;
26
27
  forbidY: boolean;
27
28
  forbidZ: boolean;
@@ -44,6 +45,8 @@ export declare class FreelookVirtualCamera extends VirtualCamera {
44
45
  onEnable(): void;
45
46
  onDisable(): void;
46
47
  reset(): void;
48
+ get lookAtPosition(): Vector3;
49
+ private _setSpherical;
47
50
  private _onPointerDown;
48
51
  private _onPointerUp;
49
52
  private _onPointerMove;
@@ -51,8 +54,10 @@ export declare class FreelookVirtualCamera extends VirtualCamera {
51
54
  private _onTouchStart;
52
55
  private _onTouchMove;
53
56
  private _calculateDistanceScale;
54
- private _calculateRotateDelta;
57
+ private _calculateRotatelDelta;
55
58
  private _calculatePanDelta;
56
- gotoPOI(position: Vector3, lookAt: Vector3, smoothing?: number): void;
59
+ private _calculateLookAtOffset;
60
+ private _calculateSpherical;
61
+ gotoPOI(springLength: number, rotation?: Euler, lookAt?: Vector3, fov?: number, smoothing?: number): void;
57
62
  update(dt: number): void;
58
63
  }
@@ -14,12 +14,9 @@ export declare class VirtualCamera extends Component<Object3D & {
14
14
  far: number;
15
15
  correctPosition: Vector3;
16
16
  correctRotation: Quaternion;
17
- lookaheadPosition: Vector3;
18
- lookAtOffset: Vector3;
19
17
  brain: CinestationBrain;
20
18
  get finalPosition(): Vector3;
21
19
  get finalRotation(): Quaternion;
22
20
  onLoad(): void;
23
21
  onDestroy(): void;
24
- update(dt: number): void;
25
22
  }
@@ -1,9 +1,9 @@
1
- import { Quaternion } from "three";
2
- export declare function VInterpTo(current: any, target: any, deltaTime: any, speed: any, out?: any): any;
3
- export declare function VInterpConstantTo(current: any, target: any, deltaTime: any, speed: any, out?: any): any;
1
+ import { Quaternion, Vector3 } from "three";
2
+ export declare function VInterpTo(current: Vector3, target: Vector3, deltaTime: number, speed: number, out?: Vector3): Vector3;
3
+ export declare function VInterpConstantTo(current: Vector3, target: Vector3, deltaTime: number, speed: number, out?: Vector3): Vector3;
4
4
  export declare function Quat_Equals(a: Quaternion, b: Quaternion, epsilon?: number): boolean;
5
5
  export declare function Quat_AngularDistance(a: Quaternion, b: Quaternion): number;
6
6
  export declare function QInterpTo(current: Quaternion, target: Quaternion, deltaTime: number, speed: number): Quaternion;
7
- export declare function QInterpConstantTo(current: any, target: any, deltaTime: any, speed: any, out?: any): any;
8
- export declare function FInterpTo(current: any, target: any, deltaTime: any, speed: any): any;
9
- export declare function FInterpConstantTo(current: any, target: any, deltaTime: any, speed: any): any;
7
+ export declare function QInterpConstantTo(current: Quaternion, target: Quaternion, deltaTime: number, speed: number, out?: Quaternion): Quaternion;
8
+ export declare function FInterpTo(current: number, target: number, deltaTime: number, speed: number): number;
9
+ export declare function FInterpConstantTo(current: number, target: number, deltaTime: number, speed: number): number;
@@ -0,0 +1,25 @@
1
+ export type EasingFunction = (amount: number) => number;
2
+ export type EasingFunctionGroup = {
3
+ In: EasingFunction;
4
+ Out: EasingFunction;
5
+ InOut: EasingFunction;
6
+ };
7
+ /**
8
+ * The Ease class provides a collection of easing functions for use with tween.js.
9
+ */
10
+ export declare const Easing: Readonly<{
11
+ Linear: Readonly<EasingFunctionGroup & {
12
+ None: EasingFunction;
13
+ }>;
14
+ Quadratic: Readonly<EasingFunctionGroup>;
15
+ Cubic: Readonly<EasingFunctionGroup>;
16
+ Quartic: Readonly<EasingFunctionGroup>;
17
+ Quintic: Readonly<EasingFunctionGroup>;
18
+ Sinusoidal: Readonly<EasingFunctionGroup>;
19
+ Exponential: Readonly<EasingFunctionGroup>;
20
+ Circular: Readonly<EasingFunctionGroup>;
21
+ Elastic: Readonly<EasingFunctionGroup>;
22
+ Back: Readonly<EasingFunctionGroup>;
23
+ Bounce: Readonly<EasingFunctionGroup>;
24
+ generatePow(power?: number): EasingFunctionGroup;
25
+ }>;
@@ -0,0 +1,16 @@
1
+ import type { Tween, UnknownProps } from './Tween';
2
+ /**
3
+ * Controlling groups of tweens
4
+ *
5
+ * Using the TWEEN singleton to manage your tweens can cause issues in large apps with many components.
6
+ * In these cases, you may want to create your own smaller groups of tween
7
+ */
8
+ export declare class Group {
9
+ private _tweens;
10
+ private _tweensAddedDuringUpdate;
11
+ getAll(): Array<Tween<UnknownProps>>;
12
+ removeAll(): void;
13
+ add(tween: Tween<UnknownProps>): void;
14
+ remove(tween: Tween<UnknownProps>): void;
15
+ update(time?: number, preserve?: boolean): boolean;
16
+ }
@@ -0,0 +1,19 @@
1
+ /**
2
+ *
3
+ */
4
+ export type InterpolationFunction = (v: number[], k: number) => number;
5
+ /**
6
+ *
7
+ */
8
+ declare const Interpolation: {
9
+ Linear: (v: number[], k: number) => number;
10
+ Bezier: (v: number[], k: number) => number;
11
+ CatmullRom: (v: number[], k: number) => number;
12
+ Utils: {
13
+ Linear: (p0: number, p1: number, t: number) => number;
14
+ Bernstein: (n: number, i: number) => number;
15
+ Factorial: (n: number) => number;
16
+ CatmullRom: (p0: number, p1: number, p2: number, p3: number, t: number) => number;
17
+ };
18
+ };
19
+ export { Interpolation };
@@ -0,0 +1,2 @@
1
+ declare const now: () => number;
2
+ export { now };
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Utils
3
+ */
4
+ export declare class Sequence {
5
+ private static _nextId;
6
+ static nextId(): number;
7
+ }
@@ -0,0 +1,96 @@
1
+ /**
2
+ * Tween.js - Licensed under the MIT license
3
+ * https://github.com/tweenjs/tween.js
4
+ * ----------------------------------------------
5
+ *
6
+ * See https://github.com/tweenjs/tween.js/graphs/contributors for the full list of contributors.
7
+ * Thank you all, you're awesome!
8
+ */
9
+ import type { EasingFunction } from './Easing';
10
+ import type { InterpolationFunction } from './Interpolation';
11
+ import type { Group } from './Group';
12
+ export declare class Tween<T extends UnknownProps> {
13
+ private _object;
14
+ private _group;
15
+ private _isPaused;
16
+ private _pauseStart;
17
+ private _valuesStart;
18
+ private _valuesEnd;
19
+ private _valuesStartRepeat;
20
+ private _duration;
21
+ private _isDynamic;
22
+ private _initialRepeat;
23
+ private _repeat;
24
+ private _repeatDelayTime?;
25
+ private _yoyo;
26
+ private _isPlaying;
27
+ private _reversed;
28
+ private _delayTime;
29
+ private _startTime;
30
+ private _easingFunction;
31
+ private _interpolationFunction;
32
+ private _chainedTweens;
33
+ private _onStartCallback?;
34
+ private _onStartCallbackFired;
35
+ private _onEveryStartCallback?;
36
+ private _onEveryStartCallbackFired;
37
+ private _onUpdateCallback?;
38
+ private _onRepeatCallback?;
39
+ private _onCompleteCallback?;
40
+ private _onStopCallback?;
41
+ private _onFinishCallback?;
42
+ private _id;
43
+ private _isChainStopped;
44
+ private _propertiesAreSetUp;
45
+ private _headTween;
46
+ private _tailTween;
47
+ private _headStart;
48
+ constructor(_object: T, _group?: Group | false);
49
+ getId(): number;
50
+ isPlaying(): boolean;
51
+ isPaused(): boolean;
52
+ getDuration(): number;
53
+ from(properties: UnknownProps): this;
54
+ to(target: UnknownProps, duration?: number): this;
55
+ duration(duration?: number): this;
56
+ dynamic(dynamic?: boolean): this;
57
+ start(time?: number, overrideStartingValues?: boolean): this;
58
+ startFromCurrentValues(time?: number): this;
59
+ private _setupProperties;
60
+ stop(): this;
61
+ end(): this;
62
+ pause(time?: number): this;
63
+ resume(time?: number): this;
64
+ stopChainedTweens(): this;
65
+ group(group?: Group): this;
66
+ call(callback: (object: T) => void): this;
67
+ delay(amount?: number): this;
68
+ union(headTween: Tween<T>, tailTween: Tween<T>): this;
69
+ repeat(times?: number): this;
70
+ repeatDelay(amount?: number): this;
71
+ yoyo(yoyo?: boolean): this;
72
+ easing(easingFunction?: EasingFunction): this;
73
+ interpolation(interpolationFunction?: InterpolationFunction): this;
74
+ chain(...tweens: Array<Tween<any>>): this;
75
+ unchain(...tweens: Array<Tween<any>>): this;
76
+ onStart(callback?: (object: T) => void): this;
77
+ onEveryStart(callback?: (object: T) => void): this;
78
+ onUpdate(callback?: (object: T, elapsed: number) => void): this;
79
+ onRepeat(callback?: (object: T) => void): this;
80
+ onComplete(callback?: (object: T) => void): this;
81
+ onStop(callback?: (object: T) => void): this;
82
+ private _goToEnd;
83
+ /**
84
+ * @returns true if the tween is still playing after the update, false
85
+ * otherwise (calling update on a paused tween still returns true because
86
+ * it is still playing, just paused).
87
+ */
88
+ update(time?: number, autoStart?: boolean): boolean;
89
+ private _calculateElapsedPortion;
90
+ private _calculateCompletionStatus;
91
+ private _processRepetition;
92
+ private _updateProperties;
93
+ private _handleRelativeValue;
94
+ private _swapEndStartRepeatValues;
95
+ }
96
+ export type UnknownProps = Record<string, any>;
@@ -1,4 +1,5 @@
1
- import { Group, Tween } from "./tween";
1
+ import { Tween } from "./Tween";
2
+ import { Group } from "./Group";
2
3
  export declare class TweenChain {
3
4
  private _object;
4
5
  private _group;
@@ -1,10 +1,8 @@
1
1
  import { TweenChain } from "./TweenChain";
2
- import { Tween } from "./tween";
3
2
  export declare class TweenManager {
4
3
  private _group;
5
4
  destroy(): void;
6
5
  update(time: number): void;
7
- tween(target: Object): Tween<Object>;
8
6
  timeline(target: Object): TweenChain;
9
7
  killTweensOf(target: Object): void;
10
8
  }
@@ -0,0 +1 @@
1
+ export declare const VERSION = "23.1.2";
@@ -1,3 +1,5 @@
1
1
  export { TweenChain } from "./TweenChain";
2
2
  export { TweenManager } from "./TweenManager";
3
- export { Tween, Easing } from "./tween";
3
+ export { Tween } from "./Tween";
4
+ export type { EasingFunction } from "./Easing";
5
+ export { Easing } from "./Easing";
@@ -0,0 +1,2 @@
1
+ import { Group } from './Group';
2
+ export declare const mainGroup: Group;
@@ -1,18 +0,0 @@
1
- import { BufferGeometry, ColorRepresentation, Matrix4, Mesh, Vector3, WebGLRenderTarget, ShaderMaterial } from "three";
2
- export declare class Reflector extends Mesh<BufferGeometry, ShaderMaterial> {
3
- isReflector: boolean;
4
- constructor(options?: {
5
- textureWidth?: number;
6
- textureHeight?: number;
7
- clipBias?: number;
8
- multisample?: number;
9
- color?: ColorRepresentation;
10
- normal?: Vector3;
11
- material?: ShaderMaterial;
12
- geometry?: BufferGeometry;
13
- layer?: number;
14
- });
15
- getTextureMatrix: () => Matrix4;
16
- getRenderTarget: () => WebGLRenderTarget;
17
- dispose: () => void;
18
- }
@@ -1 +0,0 @@
1
- export { Reflector } from "./Reflector";