archgine 1.0.34 → 1.0.38
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/lib/applications/app-cvs.d.ts +11 -0
- package/lib/applications/app-offscreen.d.ts +19 -0
- package/lib/applications/application.d.ts +13 -10
- package/lib/controls/interactive-controls.d.ts +2 -2
- package/lib/controls/orbit-controller.d.ts +2 -2
- package/lib/controls/orbit-controls.d.ts +8 -8
- package/lib/core/camera2.d.ts +3 -16
- package/lib/core/object2.d.ts +3 -1
- package/lib/core/ope-view.d.ts +40 -0
- package/lib/core/view.d.ts +4 -6
- package/lib/environment.worker.js +1421 -10445
- package/lib/extras/adapter.d.ts +13 -8
- package/lib/extras/app.d.ts +0 -72
- package/lib/extras/chef.d.ts +3 -9
- package/lib/extras/interfaces.d.ts +6 -2
- package/lib/extras/svg-app.d.ts +7 -6
- package/lib/extras/svg-chef.d.ts +15 -5
- package/lib/extras/svg-view.d.ts +3 -2
- package/lib/geometries/circle-geo2.d.ts +14 -0
- package/lib/geometries/geo2.d.ts +28 -0
- package/lib/geometries/geometry2.d.ts +0 -7
- package/lib/geometries/polygon-geo2.d.ts +6 -0
- package/lib/geometries/polyline-geo2.d.ts +22 -0
- package/lib/helpers/axes-helper.d.ts +2 -3
- package/lib/helpers/axes-helper2.d.ts +19 -0
- package/lib/helpers/canvas-helper.d.ts +6 -8
- package/lib/index.d.ts +3 -1
- package/lib/index.mjs +8035 -10258
- package/lib/index.umd.js +33 -38
- package/lib/interfaces.d.ts +110 -123
- package/lib/loaders/svg-loader.d.ts +0 -61
- package/lib/materials/mat2.d.ts +33 -0
- package/lib/materials/text-mat2.d.ts +53 -0
- package/lib/math/box2.d.ts +1 -1
- package/lib/math/matrix3.d.ts +3 -0
- package/lib/math/vector2.d.ts +0 -1
- package/lib/objects/group2.d.ts +0 -3
- package/lib/objects/shape.d.ts +0 -1
- package/lib/objects/shape2.d.ts +22 -0
- package/lib/renderer.worker.js +12842 -0
- package/lib/renderers/binding-states.d.ts +36 -0
- package/lib/renderers/buffer-renderer.d.ts +19 -0
- package/lib/renderers/cvs-renderer.d.ts +30 -0
- package/lib/renderers/render-lists.d.ts +29 -0
- package/lib/renderers/render-states.d.ts +18 -0
- package/lib/renderers/render-target.d.ts +26 -0
- package/lib/renderers/renderer.d.ts +26 -0
- package/lib/renders/render-target.d.ts +2 -2
- package/lib/renders/renderer2.d.ts +2 -1
- package/lib/scenes/loading-scene.d.ts +4 -4
- package/lib/{extras → scenes}/main-scene.d.ts +6 -3
- package/lib/scenes/scene.d.ts +0 -1
- package/lib/scenes/static-scene.d.ts +0 -2
- package/lib/scenes/svg-scene.d.ts +6 -5
- package/lib/shapes/svg.d.ts +0 -18
- package/lib/shapes2/arrow.d.ts +6 -0
- package/lib/shapes2/axes.d.ts +35 -0
- package/lib/shapes2/circle.d.ts +10 -0
- package/lib/shapes2/polygon.d.ts +9 -0
- package/lib/shapes2/text.d.ts +21 -0
- package/lib/textures/texture.d.ts +2 -2
- package/lib/utils/svg.d.ts +7 -0
- package/lib/utils/utils.d.ts +2 -0
- package/lib/workers/app-offscreen.worker.d.ts +0 -0
- package/lib/workers/renderer.worker.d.ts +1 -0
- package/package.json +1 -2
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Application } from './application';
|
|
2
|
+
import { IAppOffscreenConfig } from './app-offscreen';
|
|
3
|
+
import { MainScene } from '../scenes/main-scene';
|
|
4
|
+
export declare class AppCvs<Config extends IAppOffscreenConfig> extends Application<Config> {
|
|
5
|
+
params: Config;
|
|
6
|
+
mainScene: MainScene<Config>;
|
|
7
|
+
constructor(config?: Config);
|
|
8
|
+
destroy(): void;
|
|
9
|
+
load(url?: string, layers?: string[]): Promise<void>;
|
|
10
|
+
trans2MainScene(): void;
|
|
11
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { IApplicationConfig } from './application';
|
|
2
|
+
import { OpeView } from '../core/ope-view';
|
|
3
|
+
export interface IAppOffscreenConfig extends IApplicationConfig {
|
|
4
|
+
}
|
|
5
|
+
export declare class AppOffscreen<Config extends IAppOffscreenConfig> {
|
|
6
|
+
params: Config;
|
|
7
|
+
cvs: OffscreenCanvas;
|
|
8
|
+
worker: Worker;
|
|
9
|
+
view: OpeView<Config>;
|
|
10
|
+
readonly workerMessageHandler: (e: MessageEvent) => void;
|
|
11
|
+
constructor(config?: Config);
|
|
12
|
+
destroy(): void;
|
|
13
|
+
bindEvents(): void;
|
|
14
|
+
unbindEvents(): void;
|
|
15
|
+
handleWorkerMessage(e: MessageEvent): void;
|
|
16
|
+
resize(): void;
|
|
17
|
+
load(url: string, layers?: string[], lv?: number): Promise<void>;
|
|
18
|
+
start(): void;
|
|
19
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { IRenderer2, IRenderer2Config } from '../interfaces';
|
|
1
2
|
import { default as EventDispatcher } from '../core/event-dispatcher';
|
|
2
|
-
import { IRenderer2Config } from '../interfaces';
|
|
3
|
-
import { default as Scene } from '../scenes/scene';
|
|
4
3
|
import { default as Box2 } from '../math/box2';
|
|
5
|
-
import { default as Renderer2 } from '../renders/renderer2';
|
|
6
4
|
import { View } from '../core/view';
|
|
5
|
+
import { EffectComposer } from '../effects/effect-composer';
|
|
6
|
+
import { default as Scene } from '../scenes/scene';
|
|
7
7
|
export interface IApplicationConfig extends IRenderer2Config {
|
|
8
8
|
frameInterval?: number;
|
|
9
9
|
syncDelay?: number;
|
|
@@ -11,7 +11,7 @@ export interface IApplicationConfig extends IRenderer2Config {
|
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
13
|
* @author Dio Zhu
|
|
14
|
-
* @since 2024.
|
|
14
|
+
* @since 2024.11.13
|
|
15
15
|
*/
|
|
16
16
|
export declare abstract class Application<Config extends IApplicationConfig> extends EventDispatcher {
|
|
17
17
|
name: string;
|
|
@@ -19,13 +19,15 @@ export declare abstract class Application<Config extends IApplicationConfig> ext
|
|
|
19
19
|
scenes: Scene[];
|
|
20
20
|
nextScenes: Scene[];
|
|
21
21
|
nextBoundingBox: Box2;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
loadingScene: Scene;
|
|
23
|
+
composer: EffectComposer;
|
|
24
|
+
renderer: IRenderer2;
|
|
25
|
+
view: View<any>;
|
|
26
|
+
readonly runningHandler: (time: DOMHighResTimeStamp) => void;
|
|
25
27
|
protected constructor(config?: Config);
|
|
26
28
|
destroy(): void;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
+
get isLoadingScene(): boolean;
|
|
30
|
+
trans2LoadingScene(): void;
|
|
29
31
|
hasScene(scene: Scene): boolean;
|
|
30
32
|
pushScene(scene: Scene): void;
|
|
31
33
|
clearScenes(): void;
|
|
@@ -35,5 +37,6 @@ export declare abstract class Application<Config extends IApplicationConfig> ext
|
|
|
35
37
|
trans2Scenes(...scenes: Scene[]): void;
|
|
36
38
|
start(): void;
|
|
37
39
|
/** @description application's lifeCycle */
|
|
38
|
-
running(): void;
|
|
40
|
+
running(time: DOMHighResTimeStamp): void;
|
|
41
|
+
stop(): void;
|
|
39
42
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { OrbitControls } from './orbit-controls';
|
|
2
|
-
import { ICamera2
|
|
2
|
+
import { ICamera2 } from '../interfaces';
|
|
3
3
|
export declare class InteractiveControls extends OrbitControls {
|
|
4
4
|
name: string;
|
|
5
5
|
mouseButtons: any;
|
|
6
6
|
private readonly clickHandler;
|
|
7
|
-
constructor(camera: ICamera2, domElement:
|
|
7
|
+
constructor(camera: ICamera2, domElement: HTMLElement);
|
|
8
8
|
destroy(): void;
|
|
9
9
|
bindMapEvents(): void;
|
|
10
10
|
unbindMapEvents(): void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ICamera2, IVector2 } from '../interfaces';
|
|
1
|
+
import { ICamera2, IOrbitController, IVector2 } from '../interfaces';
|
|
2
2
|
import { default as EventDispatcher } from '../core/event-dispatcher';
|
|
3
|
-
export declare class OrbitController extends EventDispatcher {
|
|
3
|
+
export declare class OrbitController extends EventDispatcher implements IOrbitController {
|
|
4
4
|
name: string;
|
|
5
5
|
isSvg: boolean;
|
|
6
6
|
dom: HTMLElement;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { default as Vector2 } from '../math/vector2';
|
|
2
2
|
import { default as EventDispatcher } from '../core/event-dispatcher';
|
|
3
|
-
import { ICamera2,
|
|
3
|
+
import { ICamera2, IMatrix3, IVector2 } from '../interfaces';
|
|
4
4
|
interface IScene {
|
|
5
5
|
}
|
|
6
6
|
export interface IOrbitControlsConfig {
|
|
@@ -22,7 +22,7 @@ export interface IOrbitControlsConfig {
|
|
|
22
22
|
export declare class OrbitControls extends EventDispatcher {
|
|
23
23
|
name: string;
|
|
24
24
|
camera: ICamera2;
|
|
25
|
-
domElement:
|
|
25
|
+
domElement: HTMLElement;
|
|
26
26
|
domOffset: Vector2;
|
|
27
27
|
enableNegateControl: boolean;
|
|
28
28
|
focus: Vector2;
|
|
@@ -44,20 +44,22 @@ export declare class OrbitControls extends EventDispatcher {
|
|
|
44
44
|
ONE: TouchEnum;
|
|
45
45
|
TWO: TouchEnum;
|
|
46
46
|
};
|
|
47
|
-
private _lastPosition;
|
|
48
47
|
target0: IVector2;
|
|
49
48
|
position0: IVector2;
|
|
50
49
|
scene: IScene | null;
|
|
51
50
|
enabled: boolean;
|
|
52
51
|
state: number;
|
|
53
52
|
EPS: number;
|
|
53
|
+
scaled: number;
|
|
54
|
+
rotateTheta: number;
|
|
55
|
+
enableDamping: boolean;
|
|
56
|
+
dampingFactor: number;
|
|
57
|
+
private _lastPosition;
|
|
54
58
|
private pointers;
|
|
55
59
|
private pointerPositions;
|
|
56
|
-
scaled: number;
|
|
57
60
|
private rotateStart;
|
|
58
61
|
private rotateEnd;
|
|
59
62
|
private rotateDelta;
|
|
60
|
-
rotateTheta: number;
|
|
61
63
|
private panStart;
|
|
62
64
|
private panEnd;
|
|
63
65
|
private panDelta;
|
|
@@ -66,15 +68,13 @@ export declare class OrbitControls extends EventDispatcher {
|
|
|
66
68
|
private dollyEnd;
|
|
67
69
|
private dollyDelta;
|
|
68
70
|
private dollyOffset;
|
|
69
|
-
enableDamping: boolean;
|
|
70
|
-
dampingFactor: number;
|
|
71
71
|
private readonly contextMenuHandler;
|
|
72
72
|
private readonly pointerDownHandler;
|
|
73
73
|
private readonly pointerUpHandler;
|
|
74
74
|
private readonly pointerCancelHandler;
|
|
75
75
|
private readonly pointerMoveHandler;
|
|
76
76
|
private readonly wheelHandler;
|
|
77
|
-
constructor(camera: ICamera2, domElement:
|
|
77
|
+
constructor(camera: ICamera2, domElement: HTMLElement);
|
|
78
78
|
destroy(): void;
|
|
79
79
|
update(): void;
|
|
80
80
|
pan(deltaX: number, deltaY: number): void;
|
package/lib/core/camera2.d.ts
CHANGED
|
@@ -1,28 +1,15 @@
|
|
|
1
1
|
import { default as Vector2 } from '../math/vector2';
|
|
2
|
-
import { ICamera2, ICamera2Position, IObject2, IVector2 } from '../interfaces';
|
|
2
|
+
import { ICamera2, ICamera2Config, ICamera2Position, IObject2, IVector2 } from '../interfaces';
|
|
3
3
|
import { default as Matrix3 } from '../math/matrix3';
|
|
4
4
|
import { Object2 } from './object2';
|
|
5
5
|
import { default as Box2 } from '../math/box2';
|
|
6
|
-
export interface ICamera2Config {
|
|
7
|
-
width?: number;
|
|
8
|
-
height?: number;
|
|
9
|
-
aspect?: number;
|
|
10
|
-
left?: number;
|
|
11
|
-
right?: number;
|
|
12
|
-
top?: number;
|
|
13
|
-
bottom?: number;
|
|
14
|
-
eye?: number[];
|
|
15
|
-
up?: number[];
|
|
16
|
-
helperEnable?: boolean;
|
|
17
|
-
flipY?: boolean;
|
|
18
|
-
}
|
|
19
6
|
interface IView {
|
|
20
7
|
enabled: boolean;
|
|
21
8
|
width: number;
|
|
22
9
|
height: number;
|
|
23
10
|
offset: IVector2;
|
|
24
11
|
}
|
|
25
|
-
export default class Camera2<Config extends ICamera2Config
|
|
12
|
+
export default class Camera2<Config extends ICamera2Config> extends Object2 implements ICamera2 {
|
|
26
13
|
readonly isCamera: boolean;
|
|
27
14
|
type: string;
|
|
28
15
|
name: string;
|
|
@@ -61,7 +48,7 @@ export default class Camera2<Config extends ICamera2Config = ICamera2Config> ext
|
|
|
61
48
|
toJSON(): any;
|
|
62
49
|
fromJSON(o: any): void;
|
|
63
50
|
clone(): any;
|
|
64
|
-
copy(source: Camera2
|
|
51
|
+
copy(source: Camera2<Config>, recursive?: boolean): IObject2;
|
|
65
52
|
}
|
|
66
53
|
export declare enum CAMERA_ENUM {
|
|
67
54
|
UPDATE = "update"
|
package/lib/core/object2.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export declare class Object2 extends EventDispatcher implements IObject2 {
|
|
|
16
16
|
name: string;
|
|
17
17
|
type: string;
|
|
18
18
|
featureKey: string;
|
|
19
|
-
|
|
19
|
+
_version: number;
|
|
20
20
|
parent: IObject2 | undefined;
|
|
21
21
|
children: IObject2[];
|
|
22
22
|
up: Vector2;
|
|
@@ -54,6 +54,8 @@ export declare class Object2 extends EventDispatcher implements IObject2 {
|
|
|
54
54
|
private _autoSort;
|
|
55
55
|
constructor(config?: IObject2Config);
|
|
56
56
|
set needsUpdate(v: boolean);
|
|
57
|
+
get version(): number;
|
|
58
|
+
set version(v: number);
|
|
57
59
|
destroy(): void;
|
|
58
60
|
setPosition(v: IVector2): this;
|
|
59
61
|
translate(x: number, y: number): void;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { IBox2, ICamera2, ICamera2Config, ICanvas, IRenderer2Config, IView } from '../interfaces';
|
|
2
|
+
import { IOrbitControlsConfig } from '../controls/orbit-controls';
|
|
3
|
+
import { default as Scene } from '../scenes/scene';
|
|
4
|
+
import { OrbitController } from '../controls/orbit-controller';
|
|
5
|
+
import { default as Box2 } from '../math/box2';
|
|
6
|
+
import { IAxesHelperConfig } from '../helpers/axes-helper';
|
|
7
|
+
export interface IViewConfig extends IRenderer2Config {
|
|
8
|
+
name?: string;
|
|
9
|
+
cvs?: ICanvas;
|
|
10
|
+
camera?: ICamera2Config;
|
|
11
|
+
controls?: IOrbitControlsConfig;
|
|
12
|
+
axesHelper?: IAxesHelperConfig;
|
|
13
|
+
alignStageCenter?: boolean;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* @author Dio Zhu 2024.8.22
|
|
17
|
+
*/
|
|
18
|
+
export declare class OpeView<Config extends IViewConfig> implements IView {
|
|
19
|
+
name: string;
|
|
20
|
+
params: Config;
|
|
21
|
+
visible: boolean;
|
|
22
|
+
cvs: ICanvas | undefined;
|
|
23
|
+
scene: Scene | undefined;
|
|
24
|
+
scenes: Scene[];
|
|
25
|
+
camera: ICamera2 | undefined;
|
|
26
|
+
controller?: OrbitController;
|
|
27
|
+
constructor(config?: Config);
|
|
28
|
+
destroy(): void;
|
|
29
|
+
initController(camera?: ICamera2, dom?: HTMLElement): void;
|
|
30
|
+
handleCameraChanged(e: any): void;
|
|
31
|
+
reset(): void;
|
|
32
|
+
bindScene(scene: Scene): void;
|
|
33
|
+
resetCameraByBoundingBox(box: IBox2, animate?: boolean): void;
|
|
34
|
+
computeScenesBoundingBox(scenes: Scene[], target?: Box2): Box2;
|
|
35
|
+
expandScenesBoundingBox(scenes: Scene[], box?: Box2): void;
|
|
36
|
+
/**
|
|
37
|
+
* @see Application.running
|
|
38
|
+
*/
|
|
39
|
+
update(time?: DOMHighResTimeStamp): void;
|
|
40
|
+
}
|
package/lib/core/view.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { IBox2, ICamera2, ICanvas, IRenderer2Config, IView } from '../interfaces';
|
|
1
|
+
import { IBox2, ICamera2, ICamera2Config, ICanvas, IRenderer2Config, IView } from '../interfaces';
|
|
2
2
|
import { IOrbitControlsConfig } from '../controls/orbit-controls';
|
|
3
|
-
import { ICamera2Config } from './camera2';
|
|
4
3
|
import { default as Scene } from '../scenes/scene';
|
|
5
4
|
import { OrbitController } from '../controls/orbit-controller';
|
|
6
5
|
import { default as Box2 } from '../math/box2';
|
|
@@ -20,7 +19,6 @@ export declare class View<Config extends IViewConfig> implements IView {
|
|
|
20
19
|
name: string;
|
|
21
20
|
params: Config;
|
|
22
21
|
visible: boolean;
|
|
23
|
-
container: HTMLElement;
|
|
24
22
|
cvs: ICanvas | undefined;
|
|
25
23
|
scene: Scene | undefined;
|
|
26
24
|
scenes: Scene[];
|
|
@@ -28,15 +26,15 @@ export declare class View<Config extends IViewConfig> implements IView {
|
|
|
28
26
|
controller?: OrbitController;
|
|
29
27
|
constructor(config?: Config);
|
|
30
28
|
destroy(): void;
|
|
31
|
-
|
|
29
|
+
bindScene(scene: Scene): void;
|
|
30
|
+
fullscreen(padding?: number, animate?: boolean): void;
|
|
32
31
|
handleCameraChanged(e: any): void;
|
|
33
32
|
reset(): void;
|
|
34
|
-
bindScene(scene: Scene): void;
|
|
35
33
|
resetCameraByBoundingBox(box: IBox2, animate?: boolean): void;
|
|
36
34
|
computeScenesBoundingBox(scenes: Scene[], target?: Box2): Box2;
|
|
37
35
|
expandScenesBoundingBox(scenes: Scene[], box?: Box2): void;
|
|
38
36
|
/**
|
|
39
37
|
* @see Application.running
|
|
40
38
|
*/
|
|
41
|
-
update(): void;
|
|
39
|
+
update(time?: DOMHighResTimeStamp): void;
|
|
42
40
|
}
|