@galacean/effects-threejs 1.2.0 → 2.0.0-alpha.0
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/dist/index.d.ts +3 -2
- package/dist/index.js +18396 -17908
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +4 -4
- package/dist/index.min.js.map +1 -1
- package/dist/index.mjs +18359 -17880
- package/dist/index.mjs.map +1 -1
- package/dist/material/three-material.d.ts +4 -2
- package/dist/three-composition.d.ts +8 -19
- package/dist/three-display-object.d.ts +12 -5
- package/dist/three-engine.d.ts +14 -0
- package/dist/three-geometry.d.ts +1 -1
- package/dist/three-mesh.d.ts +4 -2
- package/dist/three-sprite-component.d.ts +41 -0
- package/dist/three-texture.d.ts +29 -2
- package/package.json +2 -2
- package/dist/three-render-frame.d.ts +0 -57
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { MaterialProps, Texture, UniformValue, MaterialDestroyOptions, UndefinedAble, Engine, math } from '@galacean/effects-core';
|
|
1
|
+
import type { MaterialProps, Texture, UniformValue, MaterialDestroyOptions, UndefinedAble, Engine, math, GlobalUniforms, Renderer } from '@galacean/effects-core';
|
|
2
2
|
import { Material } from '@galacean/effects-core';
|
|
3
3
|
import * as THREE from 'three';
|
|
4
4
|
type Matrix4 = math.Matrix4;
|
|
@@ -28,7 +28,7 @@ export declare class ThreeMaterial extends Material {
|
|
|
28
28
|
*
|
|
29
29
|
* @param props - 材质属性
|
|
30
30
|
*/
|
|
31
|
-
constructor(engine: Engine, props
|
|
31
|
+
constructor(engine: Engine, props?: MaterialProps);
|
|
32
32
|
/**
|
|
33
33
|
* 设置 uniform 变量值的回调函数
|
|
34
34
|
*
|
|
@@ -36,6 +36,7 @@ export declare class ThreeMaterial extends Material {
|
|
|
36
36
|
* @param value - uniform 变量值
|
|
37
37
|
*/
|
|
38
38
|
onSetUniformValue(name: string, value: UniformValue): void;
|
|
39
|
+
use(render: Renderer, globalUniforms: GlobalUniforms): void;
|
|
39
40
|
/**
|
|
40
41
|
* 移除 uniform 变量值的回调函数
|
|
41
42
|
*
|
|
@@ -163,6 +164,7 @@ export declare class ThreeMaterial extends Material {
|
|
|
163
164
|
isKeywordEnabled(keyword: string): boolean;
|
|
164
165
|
clone(props?: MaterialProps): Material;
|
|
165
166
|
cloneUniforms(sourceMaterial: Material): void;
|
|
167
|
+
fromData(data: any): void;
|
|
166
168
|
dispose(destroyOptions?: MaterialDestroyOptions): void;
|
|
167
169
|
}
|
|
168
170
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Scene, ShaderLibrary, Transform, MeshRendererOptions, EventSystem, VFXItemContent, VFXItem, MessageItem, CompositionProps } from '@galacean/effects-core';
|
|
1
|
+
import type { Scene, ShaderLibrary, Transform, MeshRendererOptions, EventSystem, VFXItemContent, VFXItem, MessageItem, CompositionProps, CompositionSourceManager } from '@galacean/effects-core';
|
|
2
2
|
import { Composition } from '@galacean/effects-core';
|
|
3
3
|
import type THREE from 'three';
|
|
4
4
|
/**
|
|
@@ -50,15 +50,15 @@ export interface CompositionBaseProps {
|
|
|
50
50
|
*/
|
|
51
51
|
onPlayerPause?: (item: VFXItem<VFXItemContent>) => void;
|
|
52
52
|
}
|
|
53
|
-
export interface ThreeCompositionProps extends
|
|
53
|
+
export interface ThreeCompositionProps extends CompositionProps {
|
|
54
54
|
/**
|
|
55
|
-
*
|
|
55
|
+
* Three.js 中的相机对象
|
|
56
56
|
*/
|
|
57
|
-
|
|
57
|
+
threeCamera?: THREE.Camera;
|
|
58
58
|
/**
|
|
59
|
-
*
|
|
59
|
+
* Three.js 中的 Group 对象
|
|
60
60
|
*/
|
|
61
|
-
|
|
61
|
+
threeGroup?: THREE.Group;
|
|
62
62
|
}
|
|
63
63
|
/**
|
|
64
64
|
* composition 抽象类的实现
|
|
@@ -68,23 +68,12 @@ export declare class ThreeComposition extends Composition {
|
|
|
68
68
|
* 发射器形状缓存 map
|
|
69
69
|
*/
|
|
70
70
|
static shape: Record<string, number>;
|
|
71
|
-
|
|
72
|
-
* 相机参数
|
|
73
|
-
*/
|
|
74
|
-
threeCamera: THREE.Camera;
|
|
75
|
-
constructor(props: CompositionProps, scene: Scene);
|
|
76
|
-
/**
|
|
77
|
-
* 开始
|
|
78
|
-
*/
|
|
79
|
-
createRenderFrame(): void;
|
|
71
|
+
constructor(props: ThreeCompositionProps, scene: Scene, compositionSourceManager: CompositionSourceManager);
|
|
80
72
|
/**
|
|
81
73
|
* 更新 video texture 数据
|
|
82
74
|
*/
|
|
83
75
|
updateVideo(): void;
|
|
84
|
-
|
|
85
|
-
* 更新相机
|
|
86
|
-
*/
|
|
87
|
-
updateCamera(): void;
|
|
76
|
+
prepareRender(): void;
|
|
88
77
|
/**
|
|
89
78
|
* 获取 render 参数
|
|
90
79
|
*
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { EventSystem,
|
|
1
|
+
import type { EventSystem, SceneLoadOptions, Renderer, Composition, SceneLoadType, SceneWithOptionsType } from '@galacean/effects-core';
|
|
2
|
+
import { AssetManager } from '@galacean/effects-core';
|
|
2
3
|
import * as THREE from 'three';
|
|
3
4
|
import { ThreeComposition } from './three-composition';
|
|
4
5
|
export type ThreeDisplayObjectOptions = {
|
|
@@ -22,10 +23,13 @@ export type ThreeDisplayObjectOptions = {
|
|
|
22
23
|
*/
|
|
23
24
|
export declare class ThreeDisplayObject extends THREE.Group {
|
|
24
25
|
compositions: ThreeComposition[];
|
|
25
|
-
camera
|
|
26
|
+
camera?: THREE.Camera;
|
|
26
27
|
renderer: Renderer;
|
|
27
28
|
readonly width: number;
|
|
28
29
|
readonly height: number;
|
|
30
|
+
assetManager: AssetManager;
|
|
31
|
+
private baseCompositionIndex;
|
|
32
|
+
env: string;
|
|
29
33
|
/**
|
|
30
34
|
*
|
|
31
35
|
* @param context
|
|
@@ -36,15 +40,18 @@ export declare class ThreeDisplayObject extends THREE.Group {
|
|
|
36
40
|
*/
|
|
37
41
|
get currentComposition(): ThreeComposition;
|
|
38
42
|
/**
|
|
39
|
-
*
|
|
40
|
-
* @param
|
|
43
|
+
* 加载动画资源
|
|
44
|
+
* @param scene - 一个或一组 URL 或者通过 URL 请求的 JSONObject 或者 Scene 对象
|
|
41
45
|
* @param options - 加载可选参数
|
|
42
46
|
* @returns
|
|
43
47
|
*/
|
|
44
|
-
loadScene(
|
|
48
|
+
loadScene(scene: SceneLoadType, options?: SceneLoadOptions): Promise<Composition>;
|
|
49
|
+
loadScene(scene: SceneLoadType[], options?: SceneLoadOptions): Promise<Composition[]>;
|
|
50
|
+
private createComposition;
|
|
45
51
|
/**
|
|
46
52
|
*
|
|
47
53
|
* @param delta
|
|
48
54
|
*/
|
|
49
55
|
update(delta: number): void;
|
|
50
56
|
}
|
|
57
|
+
export declare function isSceneWithOptions(scene: any): scene is SceneWithOptionsType;
|
package/dist/three-engine.d.ts
CHANGED
|
@@ -1,4 +1,18 @@
|
|
|
1
|
+
import type { Composition } from '@galacean/effects-core';
|
|
1
2
|
import { Engine } from '@galacean/effects-core';
|
|
3
|
+
import type * as THREE from 'three';
|
|
4
|
+
export interface ThreeEngineOptions {
|
|
5
|
+
threeCamera?: THREE.Camera;
|
|
6
|
+
composition: Composition;
|
|
7
|
+
threeGroup: THREE.Group;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* 挂载着合成需要的全局对象等
|
|
11
|
+
*/
|
|
2
12
|
export declare class ThreeEngine extends Engine {
|
|
13
|
+
threeCamera?: THREE.Camera;
|
|
14
|
+
threeGroup: THREE.Group;
|
|
15
|
+
composition: Composition;
|
|
3
16
|
constructor(gl: WebGL2RenderingContext | WebGLRenderingContext);
|
|
17
|
+
setOptions(threeEngineOptions: ThreeEngineOptions): void;
|
|
4
18
|
}
|
package/dist/three-geometry.d.ts
CHANGED
package/dist/three-mesh.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Geometry, Material, MaterialDestroyOptions, MeshDestroyOptions, GeometryMeshProps, Sortable, Engine } from '@galacean/effects-core';
|
|
1
|
+
import type { Geometry, Material, MaterialDestroyOptions, MeshDestroyOptions, GeometryMeshProps, Sortable, Engine, Renderer } from '@galacean/effects-core';
|
|
2
2
|
import { DestroyOptions, Mesh } from '@galacean/effects-core';
|
|
3
3
|
import * as THREE from 'three';
|
|
4
4
|
/**
|
|
@@ -13,7 +13,7 @@ export declare class ThreeMesh extends Mesh implements Sortable {
|
|
|
13
13
|
* 构造函数
|
|
14
14
|
* @param props - mesh 创建参数
|
|
15
15
|
*/
|
|
16
|
-
constructor(engine: Engine, props
|
|
16
|
+
constructor(engine: Engine, props?: GeometryMeshProps);
|
|
17
17
|
/**
|
|
18
18
|
* 设置 mesh 的渲染顺序
|
|
19
19
|
*
|
|
@@ -49,10 +49,12 @@ export declare class ThreeMesh extends Mesh implements Sortable {
|
|
|
49
49
|
* @param destroy 销毁参数
|
|
50
50
|
*/
|
|
51
51
|
setMaterial(mtl: Material, destroy?: MaterialDestroyOptions | DestroyOptions.keep): void;
|
|
52
|
+
start(): void;
|
|
52
53
|
/**
|
|
53
54
|
* 重建方法
|
|
54
55
|
*/
|
|
55
56
|
restore(): void;
|
|
57
|
+
render(renderer: Renderer): void;
|
|
56
58
|
/**
|
|
57
59
|
* 销毁方法
|
|
58
60
|
*
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { Renderer, SpriteItemProps } from '@galacean/effects-core';
|
|
2
|
+
import { SpriteComponent } from '@galacean/effects-core';
|
|
3
|
+
import * as THREE from 'three';
|
|
4
|
+
export declare class ThreeSpriteComponent extends SpriteComponent {
|
|
5
|
+
threeMesh: THREE.Mesh | THREE.LineSegments;
|
|
6
|
+
/**
|
|
7
|
+
* 设置 mesh 的渲染顺序
|
|
8
|
+
*
|
|
9
|
+
* @param v - 顺序 index
|
|
10
|
+
*/
|
|
11
|
+
set priority(v: number);
|
|
12
|
+
/**
|
|
13
|
+
* 获取 mesh 的渲染顺序
|
|
14
|
+
*/
|
|
15
|
+
get priority(): number;
|
|
16
|
+
/**
|
|
17
|
+
* TODO: 待移除
|
|
18
|
+
* 设置 mesh 可见性
|
|
19
|
+
*
|
|
20
|
+
* @param val - 可见性开关
|
|
21
|
+
*/
|
|
22
|
+
setVisible(val: boolean): void;
|
|
23
|
+
/**
|
|
24
|
+
* TODO: 待移除
|
|
25
|
+
* 获取 mesh 的可见性
|
|
26
|
+
*
|
|
27
|
+
* @returns
|
|
28
|
+
*/
|
|
29
|
+
getVisible(): boolean;
|
|
30
|
+
get enabled(): boolean;
|
|
31
|
+
set enabled(value: boolean);
|
|
32
|
+
/**
|
|
33
|
+
* 销毁方法
|
|
34
|
+
*
|
|
35
|
+
*/
|
|
36
|
+
dispose(): void;
|
|
37
|
+
fromData(data: SpriteItemProps): void;
|
|
38
|
+
start(): void;
|
|
39
|
+
render(renderer: Renderer): void;
|
|
40
|
+
onDestroy(): void;
|
|
41
|
+
}
|
package/dist/three-texture.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { TextureDataType, TextureSourceOptions } from '@galacean/effects-core';
|
|
1
|
+
import type { Engine, TextureDataType, TextureSourceOptions } from '@galacean/effects-core';
|
|
2
2
|
import { Texture, TextureSourceType } from '@galacean/effects-core';
|
|
3
3
|
import * as THREE from 'three';
|
|
4
4
|
/**
|
|
@@ -26,7 +26,7 @@ export declare class ThreeTexture extends Texture {
|
|
|
26
26
|
* @param data - 纹理数据
|
|
27
27
|
* @param options - 纹理选项
|
|
28
28
|
*/
|
|
29
|
-
constructor(data?: TextureDataType, options?: TextureSourceOptions);
|
|
29
|
+
constructor(engine: Engine, data?: TextureDataType, options?: TextureSourceOptions);
|
|
30
30
|
/**
|
|
31
31
|
* 更新纹理数据
|
|
32
32
|
* @param options - 纹理选项
|
|
@@ -55,6 +55,9 @@ export declare class ThreeTexture extends Texture {
|
|
|
55
55
|
name?: string | undefined;
|
|
56
56
|
anisotropic?: number | undefined;
|
|
57
57
|
flipY?: boolean | undefined;
|
|
58
|
+
/**
|
|
59
|
+
* THREE 纹理对象
|
|
60
|
+
*/
|
|
58
61
|
premultiplyAlpha?: boolean | undefined;
|
|
59
62
|
keepImageSource?: boolean | undefined;
|
|
60
63
|
format: number | THREE.PixelFormat;
|
|
@@ -72,6 +75,9 @@ export declare class ThreeTexture extends Texture {
|
|
|
72
75
|
name?: string | undefined;
|
|
73
76
|
anisotropic?: number | undefined;
|
|
74
77
|
flipY?: boolean | undefined;
|
|
78
|
+
/**
|
|
79
|
+
* THREE 纹理对象
|
|
80
|
+
*/
|
|
75
81
|
premultiplyAlpha?: boolean | undefined;
|
|
76
82
|
keepImageSource?: boolean | undefined;
|
|
77
83
|
format: number | THREE.PixelFormat;
|
|
@@ -90,6 +96,9 @@ export declare class ThreeTexture extends Texture {
|
|
|
90
96
|
name?: string | undefined;
|
|
91
97
|
anisotropic?: number | undefined;
|
|
92
98
|
flipY?: boolean | undefined;
|
|
99
|
+
/**
|
|
100
|
+
* THREE 纹理对象
|
|
101
|
+
*/
|
|
93
102
|
premultiplyAlpha?: boolean | undefined;
|
|
94
103
|
keepImageSource?: boolean | undefined;
|
|
95
104
|
format: number | THREE.PixelFormat;
|
|
@@ -107,6 +116,9 @@ export declare class ThreeTexture extends Texture {
|
|
|
107
116
|
name?: string | undefined;
|
|
108
117
|
anisotropic?: number | undefined;
|
|
109
118
|
flipY?: boolean | undefined;
|
|
119
|
+
/**
|
|
120
|
+
* THREE 纹理对象
|
|
121
|
+
*/
|
|
110
122
|
premultiplyAlpha?: boolean | undefined;
|
|
111
123
|
keepImageSource?: boolean | undefined;
|
|
112
124
|
format: number | THREE.PixelFormat;
|
|
@@ -124,6 +136,9 @@ export declare class ThreeTexture extends Texture {
|
|
|
124
136
|
name?: string | undefined;
|
|
125
137
|
anisotropic?: number | undefined;
|
|
126
138
|
flipY?: boolean | undefined;
|
|
139
|
+
/**
|
|
140
|
+
* THREE 纹理对象
|
|
141
|
+
*/
|
|
127
142
|
premultiplyAlpha?: boolean | undefined;
|
|
128
143
|
keepImageSource?: boolean | undefined;
|
|
129
144
|
format: number | THREE.PixelFormat;
|
|
@@ -144,6 +159,9 @@ export declare class ThreeTexture extends Texture {
|
|
|
144
159
|
name?: string | undefined;
|
|
145
160
|
anisotropic?: number | undefined;
|
|
146
161
|
flipY?: boolean | undefined;
|
|
162
|
+
/**
|
|
163
|
+
* THREE 纹理对象
|
|
164
|
+
*/
|
|
147
165
|
premultiplyAlpha?: boolean | undefined;
|
|
148
166
|
keepImageSource?: boolean | undefined;
|
|
149
167
|
format: number | THREE.PixelFormat;
|
|
@@ -160,6 +178,9 @@ export declare class ThreeTexture extends Texture {
|
|
|
160
178
|
name?: string | undefined;
|
|
161
179
|
anisotropic?: number | undefined;
|
|
162
180
|
flipY?: boolean | undefined;
|
|
181
|
+
/**
|
|
182
|
+
* THREE 纹理对象
|
|
183
|
+
*/
|
|
163
184
|
premultiplyAlpha?: boolean | undefined;
|
|
164
185
|
keepImageSource?: boolean | undefined;
|
|
165
186
|
format: number | THREE.PixelFormat;
|
|
@@ -177,6 +198,9 @@ export declare class ThreeTexture extends Texture {
|
|
|
177
198
|
name?: string | undefined;
|
|
178
199
|
anisotropic?: number | undefined;
|
|
179
200
|
flipY?: boolean | undefined;
|
|
201
|
+
/**
|
|
202
|
+
* THREE 纹理对象
|
|
203
|
+
*/
|
|
180
204
|
premultiplyAlpha?: boolean | undefined;
|
|
181
205
|
keepImageSource?: boolean | undefined;
|
|
182
206
|
format: number | THREE.PixelFormat;
|
|
@@ -194,6 +218,9 @@ export declare class ThreeTexture extends Texture {
|
|
|
194
218
|
name?: string | undefined;
|
|
195
219
|
anisotropic?: number | undefined;
|
|
196
220
|
flipY?: boolean | undefined;
|
|
221
|
+
/**
|
|
222
|
+
* THREE 纹理对象
|
|
223
|
+
*/
|
|
197
224
|
premultiplyAlpha?: boolean | undefined;
|
|
198
225
|
keepImageSource?: boolean | undefined;
|
|
199
226
|
format: number | THREE.PixelFormat;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@galacean/effects-threejs",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-alpha.0",
|
|
4
4
|
"description": "Galacean Effects runtime threejs plugin for the web",
|
|
5
5
|
"module": "./dist/index.mjs",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"registry": "https://registry.npmjs.org"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@galacean/effects-core": "
|
|
46
|
+
"@galacean/effects-core": "2.0.0-alpha.0"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"three": "^0.149.0",
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import type { Mesh, RenderPass, Texture, RenderFrameOptions } from '@galacean/effects-core';
|
|
2
|
-
import { RenderFrame } from '@galacean/effects-core';
|
|
3
|
-
import * as THREE from 'three';
|
|
4
|
-
/**
|
|
5
|
-
* runtime 中对渲染中的一帧的流程管理对象
|
|
6
|
-
* THREE 对此抽象类的实现
|
|
7
|
-
*/
|
|
8
|
-
export declare class ThreeRenderFrame extends RenderFrame {
|
|
9
|
-
group: THREE.Group;
|
|
10
|
-
threeCamera: THREE.Camera | undefined;
|
|
11
|
-
constructor(options: RenderFrameOptions);
|
|
12
|
-
/**
|
|
13
|
-
* 设置 pass 数组
|
|
14
|
-
*
|
|
15
|
-
* @param passes - pass 数组
|
|
16
|
-
*/
|
|
17
|
-
setRenderPasses(passes: RenderPass[]): void;
|
|
18
|
-
/**
|
|
19
|
-
* 添加 render pass
|
|
20
|
-
*
|
|
21
|
-
* @param pass - render pass 对象
|
|
22
|
-
*/
|
|
23
|
-
addRenderPass(pass: RenderPass): void;
|
|
24
|
-
/**
|
|
25
|
-
* 创建资源(滤镜元素会用到)
|
|
26
|
-
*/
|
|
27
|
-
createResource(): void;
|
|
28
|
-
/**
|
|
29
|
-
* 创建默认 mesh(滤镜元素会用到)
|
|
30
|
-
*
|
|
31
|
-
* @param semantics - mesh 创建参数
|
|
32
|
-
*/
|
|
33
|
-
createCopyMesh(semantics?: {
|
|
34
|
-
tex?: string;
|
|
35
|
-
size?: string;
|
|
36
|
-
blend?: boolean;
|
|
37
|
-
depthTexture?: Texture;
|
|
38
|
-
}): Mesh;
|
|
39
|
-
/**
|
|
40
|
-
* 添加 mesh 到默认 render pass 中
|
|
41
|
-
*
|
|
42
|
-
* @param mesh - mesh 对象
|
|
43
|
-
*/
|
|
44
|
-
addMeshToDefaultRenderPass(mesh: Mesh): void;
|
|
45
|
-
/**
|
|
46
|
-
* 从默认 render pass 删除 mesh
|
|
47
|
-
*
|
|
48
|
-
* @param mesh - mesh 对象
|
|
49
|
-
*/
|
|
50
|
-
removeMeshFromDefaultRenderPass(mesh: Mesh): void;
|
|
51
|
-
updateMatrix(): void;
|
|
52
|
-
updateUniform(): void;
|
|
53
|
-
/**
|
|
54
|
-
* 主要用来做 group 和 composition 的清理
|
|
55
|
-
*/
|
|
56
|
-
dispose(): void;
|
|
57
|
-
}
|