@xviewer.js/core 1.0.1 → 1.0.3

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.
Files changed (54) hide show
  1. package/dist/{main.js → main.cjs} +2226 -2403
  2. package/dist/main.cjs.map +1 -0
  3. package/dist/module.js +2055 -2251
  4. package/dist/module.js.map +1 -1
  5. package/package.json +3 -3
  6. package/types/Mount.d.ts +2 -1
  7. package/types/SystemInfo.d.ts +1 -4
  8. package/types/Utils.d.ts +4 -4
  9. package/types/Viewer.d.ts +2 -5
  10. package/types/asset/{aLoader.d.ts → Loader.d.ts} +1 -1
  11. package/types/asset/ResourceManager.d.ts +4 -4
  12. package/types/cinestation/CinestationBlendDefinition.d.ts +4 -4
  13. package/types/components/AccumulativeShadows.d.ts +68 -0
  14. package/types/components/Center.d.ts +44 -0
  15. package/types/components/index.d.ts +2 -0
  16. package/types/constants.d.ts +1 -0
  17. package/types/index.d.ts +1 -2
  18. package/types/loaders/BINLoader.d.ts +8 -0
  19. package/types/loaders/{aEXRLoader.d.ts → EXRLoader.d.ts} +2 -2
  20. package/types/loaders/{aFBXLoader.d.ts → FBXLoader.d.ts} +2 -2
  21. package/types/loaders/{aGLTFLoader.d.ts → GLTFLoader.d.ts} +2 -2
  22. package/types/loaders/{aHDRLoader.d.ts → HDRLoader.d.ts} +2 -2
  23. package/types/loaders/{aJSONLoader.d.ts → JSONLoader.d.ts} +2 -2
  24. package/types/loaders/{aTextureLoader.d.ts → TextureLoader.d.ts} +2 -2
  25. package/types/loaders/index.d.ts +7 -6
  26. package/types/materials/DiscardMaterial.d.ts +5 -0
  27. package/types/math/index.d.ts +1 -0
  28. package/types/plugins/DropFile.d.ts +3 -1
  29. package/types/plugins/UI.d.ts +30 -0
  30. package/types/plugins/index.d.ts +1 -0
  31. package/types/shaderMaterial.d.ts +8 -0
  32. package/types/types.d.ts +20 -17
  33. package/dist/main.js.map +0 -1
  34. package/types/Plugin.d.ts +0 -4
  35. package/types/PluginManager.d.ts +0 -17
  36. package/types/components/PerformanceMonitor.d.ts +0 -48
  37. package/types/plugins/BoxProjectionPlugin.d.ts +0 -20
  38. package/types/plugins/DebugPlugin.d.ts +0 -10
  39. package/types/plugins/DebugScene.d.ts +0 -8
  40. package/types/plugins/DropFilePlugin.d.ts +0 -18
  41. package/types/plugins/EnvironmentPlugin.d.ts +0 -41
  42. package/types/plugins/PerformanceMonitorPlugin.d.ts +0 -48
  43. package/types/tween/Group.d.ts +0 -16
  44. package/types/tween/Interpolation.d.ts +0 -19
  45. package/types/tween/Now.d.ts +0 -2
  46. package/types/tween/Sequence.d.ts +0 -7
  47. package/types/tween/Tween.d.ts +0 -98
  48. package/types/tween/TweenChain.d.ts +0 -26
  49. package/types/tween/TweenGroup.d.ts +0 -17
  50. package/types/tween/TweenManager.d.ts +0 -8
  51. package/types/tween/Version.d.ts +0 -1
  52. package/types/tween/index.d.ts +0 -6
  53. package/types/tween/mainGroup.d.ts +0 -2
  54. /package/types/{tween → math}/Easing.d.ts +0 -0
package/types/Plugin.d.ts DELETED
@@ -1,4 +0,0 @@
1
- import { Component } from "./Component";
2
- export declare class Plugin extends Component {
3
- isPlugin: boolean;
4
- }
@@ -1,17 +0,0 @@
1
- import { Plugin } from "./Plugin";
2
- import { Viewer } from "./Viewer";
3
- import { __C } from "./types";
4
- export declare class PluginManager {
5
- private _viewer;
6
- private _plugins;
7
- private _pluginsMap;
8
- get viewer(): Viewer;
9
- constructor(viewer: Viewer);
10
- destroy(): void;
11
- update(dt: number): void;
12
- render(dt: number): void;
13
- traversePlugins(callback: (plugin: Plugin) => void): void;
14
- getPlugin<T extends Plugin>(plugin: new (...args: any[]) => T, autoAdd?: boolean): T;
15
- addPlugin<T extends Plugin, K extends __C<T>>(plugin: T | K & __C<T>): T;
16
- removePlugin<T extends Plugin, K extends __C<T>>(plugin: T | K & __C<T>): void;
17
- }
@@ -1,48 +0,0 @@
1
- import { Component } from "../Component";
2
- type PerformanceMonitorProps = {
3
- /** How much time in milliseconds to collect an average fps, 250 */
4
- ms?: number;
5
- /** How many interations of averages to collect, 10 */
6
- iterations?: number;
7
- /** The percentage of iterations that are matched against the lower and upper bounds, 0.75 */
8
- threshold?: number;
9
- /** A function that receive the max device refreshrate to determine lower and upper bounds which create a margin where neither incline nor decline should happen, (refreshrate) => (refreshrate > 90 ? [50, 90] : [50, 60]) */
10
- bounds?: (refreshrate: number) => [lower: number, upper: number];
11
- /** How many times it can inline or decline before onFallback is called, Infinity */
12
- flipflops?: number;
13
- /** The factor increases and decreases between 0-1, this prop sets the starting value, 0.5 */
14
- factor?: number;
15
- /** The step that gets added or subtracted to or from the factor on each incline/decline, 0.1 */
16
- step?: number;
17
- /** When performance is higher than the upper bound (good!) */
18
- onIncline?: (monitor: PerformanceMonitor) => void;
19
- /** When performance is lower than the upper bound (bad!) */
20
- onDecline?: (monitor: PerformanceMonitor) => void;
21
- /** Incline and decline will change the factor, this will trigger when that happened */
22
- onChange?: (monitor: PerformanceMonitor) => void;
23
- /** Called after when the number of flipflops is reached, it indicates instability, use the function to set a fixed baseline */
24
- onFallback?: (monitor: PerformanceMonitor) => void;
25
- };
26
- type PerformanceMonitorSubscriber = {
27
- onIncline?: (monitor: PerformanceMonitor) => void;
28
- /** When performance is lower than the upper bound (bad!) */
29
- onDecline?: (monitor: PerformanceMonitor) => void;
30
- /** Incline and decline will change the factor, this will trigger when that happened */
31
- onChange?: (monitor: PerformanceMonitor) => void;
32
- /** Called after when the number of flipflops is reached, it indicates instability, use the function to set a fixed baseline */
33
- onFallback?: (monitor: PerformanceMonitor) => void;
34
- };
35
- export declare class PerformanceMonitor extends Component {
36
- fps: number;
37
- index: number;
38
- factor: number;
39
- flipped: number;
40
- refreshrate: number;
41
- fallback: boolean;
42
- frames: any[];
43
- averages: any[];
44
- subscriptions: Map<any, any>;
45
- subscribe(subscriber: PerformanceMonitorSubscriber): void;
46
- constructor({ iterations, ms, threshold, step, factor: _factor, flipflops, bounds, onIncline, onDecline, onChange, onFallback, }: PerformanceMonitorProps);
47
- }
48
- export {};
@@ -1,20 +0,0 @@
1
- import { Vector3, Vector4, WebGLProgramParametersWithUniforms } from "three";
2
- import { Plugin } from "../Plugin";
3
- export declare class BoxProjectionPlugin extends Plugin {
4
- private _center;
5
- private _boxMin;
6
- private _boxMax;
7
- private _helper;
8
- private _debug;
9
- get debug(): boolean;
10
- set debug(v: boolean);
11
- get center(): Vector4;
12
- set center(v: Vector4);
13
- get boxMin(): Vector3;
14
- set boxMin(v: Vector3);
15
- get boxMax(): Vector3;
16
- set boxMax(v: Vector3);
17
- constructor();
18
- onUpdate(dt: number): void;
19
- useBoxProjection(shader: WebGLProgramParametersWithUniforms): void;
20
- }
@@ -1,10 +0,0 @@
1
- import { Object3D, Scene } from "three";
2
- import { Plugin } from "../Plugin";
3
- import { Viewer } from "../Viewer";
4
- export declare class DebugPlugin extends Plugin {
5
- static Instance(viewer: Viewer): any;
6
- scene: Scene;
7
- add(node: Object3D): Object3D<import("three").Object3DEventMap>;
8
- remove(node: Object3D): Object3D<import("three").Object3DEventMap>;
9
- onRender(dt: number): void;
10
- }
@@ -1,8 +0,0 @@
1
- import { Object3D, Scene } from "three";
2
- import { Mount } from "../Mount";
3
- export declare class DebugScene extends Mount {
4
- scene: Scene;
5
- add(node: Object3D): Object3D<import("three").Object3DEventMap>;
6
- remove(node: Object3D): Object3D<import("three").Object3DEventMap>;
7
- update(dt: number): void;
8
- }
@@ -1,18 +0,0 @@
1
- import { Plugin } from "../Plugin";
2
- export declare class DropFilePlugin extends Plugin {
3
- private _onLoad;
4
- private _onError;
5
- private _extensions;
6
- constructor({ onLoad, onError, extension, }?: {
7
- onLoad?: Function;
8
- onError?: Function;
9
- extension?: string | string[];
10
- });
11
- install(): void;
12
- uninstall(): void;
13
- private _onDrogOver;
14
- private _onDrop;
15
- private _loadItemList;
16
- private _loadFiles;
17
- private _loadFile;
18
- }
@@ -1,41 +0,0 @@
1
- import { Object3D, Scene, Texture, TextureDataType, Vector3 } from "three";
2
- import { Plugin } from "../Plugin";
3
- export declare class EnvironmentPlugin extends Plugin {
4
- static readonly Quality: {
5
- LOW: number;
6
- MEDIUM: number;
7
- HIGH: number;
8
- ULTRA: number;
9
- };
10
- private _scene;
11
- private _cubeCamera;
12
- private _reflectPass;
13
- private _mipBlurPass;
14
- private _mergeInfo;
15
- private _debug;
16
- private _debugNode;
17
- private _elapsed;
18
- get debug(): boolean;
19
- set debug(v: boolean);
20
- get envMap(): Texture;
21
- quality: number;
22
- envMapIntensity: number;
23
- reflectExposure: number;
24
- reflectBlurIntensity: number;
25
- interval: number;
26
- manual: boolean;
27
- constructor({ envMap, scene, near, far, layer, resolution, floatType, position, }?: {
28
- envMap?: Texture;
29
- scene?: Scene | Object3D;
30
- performance?: number;
31
- resolution?: number;
32
- layer?: number;
33
- near?: number;
34
- far?: number;
35
- floatType?: boolean | TextureDataType;
36
- position?: Vector3;
37
- });
38
- onRender(dt: number): void;
39
- manualFrame(): void;
40
- private _renderFrame;
41
- }
@@ -1,48 +0,0 @@
1
- import { Plugin } from "../Plugin";
2
- type PerformanceMonitorProps = {
3
- /** How much time in milliseconds to collect an average fps, 250 */
4
- ms?: number;
5
- /** How many interations of averages to collect, 10 */
6
- iterations?: number;
7
- /** The percentage of iterations that are matched against the lower and upper bounds, 0.75 */
8
- threshold?: number;
9
- /** A function that receive the max device refreshrate to determine lower and upper bounds which create a margin where neither incline nor decline should happen, (refreshrate) => (refreshrate > 90 ? [50, 90] : [50, 60]) */
10
- bounds?: (refreshrate: number) => [lower: number, upper: number];
11
- /** How many times it can inline or decline before onFallback is called, Infinity */
12
- flipflops?: number;
13
- /** The factor increases and decreases between 0-1, this prop sets the starting value, 0.5 */
14
- factor?: number;
15
- /** The step that gets added or subtracted to or from the factor on each incline/decline, 0.1 */
16
- step?: number;
17
- /** When performance is higher than the upper bound (good!) */
18
- onIncline?: (monitor: PerformanceMonitorPlugin) => void;
19
- /** When performance is lower than the upper bound (bad!) */
20
- onDecline?: (monitor: PerformanceMonitorPlugin) => void;
21
- /** Incline and decline will change the factor, this will trigger when that happened */
22
- onChange?: (monitor: PerformanceMonitorPlugin) => void;
23
- /** Called after when the number of flipflops is reached, it indicates instability, use the function to set a fixed baseline */
24
- onFallback?: (monitor: PerformanceMonitorPlugin) => void;
25
- };
26
- type PerformanceMonitorSubscriber = {
27
- onIncline?: (monitor: PerformanceMonitorPlugin) => void;
28
- /** When performance is lower than the upper bound (bad!) */
29
- onDecline?: (monitor: PerformanceMonitorPlugin) => void;
30
- /** Incline and decline will change the factor, this will trigger when that happened */
31
- onChange?: (monitor: PerformanceMonitorPlugin) => void;
32
- /** Called after when the number of flipflops is reached, it indicates instability, use the function to set a fixed baseline */
33
- onFallback?: (monitor: PerformanceMonitorPlugin) => void;
34
- };
35
- export declare class PerformanceMonitorPlugin extends Plugin {
36
- fps: number;
37
- index: number;
38
- factor: number;
39
- flipped: number;
40
- refreshrate: number;
41
- fallback: boolean;
42
- frames: any[];
43
- averages: any[];
44
- subscriptions: Map<any, any>;
45
- subscribe(subscriber: PerformanceMonitorSubscriber): void;
46
- constructor({ iterations, ms, threshold, step, factor: _factor, flipflops, bounds, onIncline, onDecline, onChange, onFallback, }: PerformanceMonitorProps);
47
- }
48
- export {};
@@ -1,16 +0,0 @@
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
- }
@@ -1,19 +0,0 @@
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 };
@@ -1,2 +0,0 @@
1
- declare const now: () => number;
2
- export { now };
@@ -1,7 +0,0 @@
1
- /**
2
- * Utils
3
- */
4
- export declare class Sequence {
5
- private static _nextId;
6
- static nextId(): number;
7
- }
@@ -1,98 +0,0 @@
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 { TweenGroup } from './TweenGroup';
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 _headTweenStartFired;
48
- constructor(_object: T, _group?: TweenGroup | false);
49
- getId(): number;
50
- getObject(): T;
51
- getGroup(): false | TweenGroup;
52
- isPlaying(): boolean;
53
- isPaused(): boolean;
54
- getDuration(): number;
55
- from(properties: UnknownProps): this;
56
- to(target: UnknownProps, duration?: number): this;
57
- duration(duration?: number): this;
58
- dynamic(dynamic?: boolean): this;
59
- start(time: number, overrideStartingValues?: boolean): this;
60
- startFromCurrentValues(time?: number): this;
61
- private _setupProperties;
62
- stop(): this;
63
- end(): this;
64
- pause(time: number): this;
65
- resume(time: number): this;
66
- stopChainedTweens(): this;
67
- group(group?: TweenGroup): this;
68
- call(callback: (object: T) => void): this;
69
- delay(amount?: number): this;
70
- union(headTween: Tween<T>, tailTween: Tween<T>): this;
71
- repeat(times?: number): this;
72
- repeatDelay(amount?: number): this;
73
- yoyo(yoyo?: boolean): this;
74
- easing(easingFunction?: EasingFunction): this;
75
- interpolation(interpolationFunction?: InterpolationFunction): this;
76
- chain(...tweens: Array<Tween<any>>): this;
77
- unchain(...tweens: Array<Tween<any>>): this;
78
- onStart(callback?: (object: T) => void): this;
79
- onEveryStart(callback?: (object: T) => void): this;
80
- onUpdate(callback?: (object: T, elapsed: number) => void): this;
81
- onRepeat(callback?: (object: T) => void): this;
82
- onComplete(callback?: (object: T) => void): this;
83
- onStop(callback?: (object: T) => void): this;
84
- private _goToEnd;
85
- /**
86
- * @returns true if the tween is still playing after the update, false
87
- * otherwise (calling update on a paused tween still returns true because
88
- * it is still playing, just paused).
89
- */
90
- update(time: number, autoStart?: boolean): boolean;
91
- private _calculateElapsedPortion;
92
- private _calculateCompletionStatus;
93
- private _processRepetition;
94
- private _updateProperties;
95
- private _handleRelativeValue;
96
- private _swapEndStartRepeatValues;
97
- }
98
- export type UnknownProps = Record<string, any>;
@@ -1,26 +0,0 @@
1
- import { Tween } from "./Tween";
2
- import { TweenGroup } from "./TweenGroup";
3
- export declare class TweenChain {
4
- private _obj;
5
- private _group;
6
- private _tween;
7
- private _chainedTween;
8
- constructor(object: Object, group?: TweenGroup);
9
- start(): this;
10
- pause(): this;
11
- stop(): this;
12
- repeat(times: number): this;
13
- union(): this;
14
- call(callback: (object: Object) => void): this;
15
- delay(amount: number): this;
16
- to(properties: Record<string, any>, duration?: number, props?: {
17
- from?: Record<string, any>;
18
- easing?: (amount: number) => number;
19
- onStart?: (object: Object) => void;
20
- onStop?: (object: Object) => void;
21
- onComplete?: (object: Object) => void;
22
- onUpdate?: (object: Object, elapsed: number) => void;
23
- onRepeat?: (object: Object) => void;
24
- }): this;
25
- _chainTween(): Tween<Object>;
26
- }
@@ -1,17 +0,0 @@
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 TweenGroup {
9
- private _tweens;
10
- private _tweensAddedDuringUpdate;
11
- getAll(): Array<Tween<UnknownProps>>;
12
- removeAll(): void;
13
- removeOf(target: Object): void;
14
- add(tween: Tween<UnknownProps>): void;
15
- remove(tween: Tween<UnknownProps>): void;
16
- update(time: number, preserve?: boolean): boolean;
17
- }
@@ -1,8 +0,0 @@
1
- import { TweenChain } from "./TweenChain";
2
- export declare class TweenManager {
3
- private _group;
4
- update(dt: number): void;
5
- timeline(target: Object): TweenChain;
6
- killAll(): void;
7
- killOf(target: Object): void;
8
- }
@@ -1 +0,0 @@
1
- export declare const VERSION = "23.1.2";
@@ -1,6 +0,0 @@
1
- export { TweenGroup } from "./TweenGroup";
2
- export { TweenChain } from "./TweenChain";
3
- export { TweenManager } from "./TweenManager";
4
- export { Tween } from "./Tween";
5
- export type { EasingFunction } from "./Easing";
6
- export { Easing } from "./Easing";
@@ -1,2 +0,0 @@
1
- import { TweenGroup } from './TweenGroup';
2
- export declare const mainGroup: TweenGroup;
File without changes