@galacean/effects-specification 0.0.1
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/README.md +28 -0
- package/dist/fallback/camera.d.ts +2 -0
- package/dist/fallback/filter.d.ts +2 -0
- package/dist/fallback/index.d.ts +12 -0
- package/dist/fallback/interact.d.ts +2 -0
- package/dist/fallback/migration.d.ts +5 -0
- package/dist/fallback/particle.d.ts +2 -0
- package/dist/fallback/sprite.d.ts +3 -0
- package/dist/fallback/utils.d.ts +29 -0
- package/dist/fallback.js +1664 -0
- package/dist/fallback.js.map +1 -0
- package/dist/fallback.mjs +1639 -0
- package/dist/fallback.mjs.map +1 -0
- package/dist/index.js +689 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +674 -0
- package/dist/index.mjs.map +1 -0
- package/dist/src/binary.d.ts +60 -0
- package/dist/src/composition.d.ts +111 -0
- package/dist/src/constants.d.ts +11 -0
- package/dist/src/image.d.ts +123 -0
- package/dist/src/index.d.ts +22 -0
- package/dist/src/item/base-item.d.ts +110 -0
- package/dist/src/item/camera-item.d.ts +69 -0
- package/dist/src/item/composition-item.d.ts +56 -0
- package/dist/src/item/filter-item.d.ts +99 -0
- package/dist/src/item/interact-item.d.ts +85 -0
- package/dist/src/item/model/binary.d.ts +85 -0
- package/dist/src/item/model/camera.d.ts +33 -0
- package/dist/src/item/model/index.d.ts +35 -0
- package/dist/src/item/model/light.d.ts +72 -0
- package/dist/src/item/model/material.d.ts +84 -0
- package/dist/src/item/model/mesh.d.ts +69 -0
- package/dist/src/item/model/render.d.ts +41 -0
- package/dist/src/item/model/skybox.d.ts +50 -0
- package/dist/src/item/model/tree.d.ts +65 -0
- package/dist/src/item/null-item.d.ts +46 -0
- package/dist/src/item/particle-item.d.ts +412 -0
- package/dist/src/item/particle-shape.d.ts +212 -0
- package/dist/src/item/plugin-item.d.ts +46 -0
- package/dist/src/item/spine-item.d.ts +93 -0
- package/dist/src/item/sprite-item.d.ts +71 -0
- package/dist/src/item/text-item.d.ts +172 -0
- package/dist/src/item.d.ts +17 -0
- package/dist/src/numberExpression.d.ts +279 -0
- package/dist/src/scene.d.ts +92 -0
- package/dist/src/text.d.ts +183 -0
- package/dist/src/type.d.ts +643 -0
- package/package.json +67 -0
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { BaseItem, ItemEndBehavior } from './base-item';
|
|
2
|
+
import type { ItemType, RotationOverLifetime } from '../type';
|
|
3
|
+
import type { FixedNumberExpression, FixedVec3Expression } from '../numberExpression';
|
|
4
|
+
import type { CameraClipMode } from '../composition';
|
|
5
|
+
export interface CameraItem extends BaseItem {
|
|
6
|
+
/**
|
|
7
|
+
* 元素类型[指定为model]
|
|
8
|
+
*/
|
|
9
|
+
type: ItemType.camera;
|
|
10
|
+
/**
|
|
11
|
+
* 相机元素渲染信息
|
|
12
|
+
*/
|
|
13
|
+
content: CameraContent;
|
|
14
|
+
endBehavior: ItemEndBehavior;
|
|
15
|
+
}
|
|
16
|
+
export interface CameraContent {
|
|
17
|
+
/**
|
|
18
|
+
* 相机元素基本属性
|
|
19
|
+
*/
|
|
20
|
+
options: {
|
|
21
|
+
/**
|
|
22
|
+
* 视角属性
|
|
23
|
+
*/
|
|
24
|
+
fov: number;
|
|
25
|
+
/**
|
|
26
|
+
* 相机远平面
|
|
27
|
+
*/
|
|
28
|
+
far: number;
|
|
29
|
+
/**
|
|
30
|
+
* 相机近平面
|
|
31
|
+
*/
|
|
32
|
+
near: number;
|
|
33
|
+
/**
|
|
34
|
+
* 相机剪裁模式
|
|
35
|
+
*/
|
|
36
|
+
clipMode?: CameraClipMode;
|
|
37
|
+
/**
|
|
38
|
+
* 默认不提供,等于canvas width/height
|
|
39
|
+
*/
|
|
40
|
+
aspect?: number;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* 相机元素旋转变化属性
|
|
44
|
+
*/
|
|
45
|
+
rotationOverLifetime?: RotationOverLifetime;
|
|
46
|
+
/**
|
|
47
|
+
* 相机元素位置变化属性
|
|
48
|
+
*/
|
|
49
|
+
positionOverLifetime?: CameraPositionOverLifetime;
|
|
50
|
+
}
|
|
51
|
+
export interface CameraPositionOverLifetime {
|
|
52
|
+
/**
|
|
53
|
+
* x轴位置变化信息
|
|
54
|
+
*/
|
|
55
|
+
linearX?: FixedNumberExpression;
|
|
56
|
+
/**
|
|
57
|
+
* y轴位置变化信息
|
|
58
|
+
*/
|
|
59
|
+
linearY?: FixedNumberExpression;
|
|
60
|
+
/**
|
|
61
|
+
* z轴位置变化信息
|
|
62
|
+
*/
|
|
63
|
+
linearZ?: FixedNumberExpression;
|
|
64
|
+
/**
|
|
65
|
+
* 路径
|
|
66
|
+
* @default [0,0,0]
|
|
67
|
+
*/
|
|
68
|
+
path?: FixedVec3Expression;
|
|
69
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { BaseItem, ItemEndBehavior } from './base-item';
|
|
2
|
+
import type { SizeOverLifetime, RotationOverLifetime, ColorOverLifetime, ItemType } from '../type';
|
|
3
|
+
import type { RGBAColorValue, vec3 } from '../numberExpression';
|
|
4
|
+
import type { PositionOverLifetime } from '../type';
|
|
5
|
+
/**
|
|
6
|
+
* 预合成元素
|
|
7
|
+
*/
|
|
8
|
+
export interface CompositionItem extends BaseItem {
|
|
9
|
+
/**
|
|
10
|
+
* 元素类型[指定为composition]
|
|
11
|
+
*/
|
|
12
|
+
type: ItemType.composition;
|
|
13
|
+
/**
|
|
14
|
+
* 预合成元素渲染信息
|
|
15
|
+
*/
|
|
16
|
+
content: CompositionContent;
|
|
17
|
+
endBehavior: ItemEndBehavior;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* 预合成元素
|
|
21
|
+
*/
|
|
22
|
+
export interface CompositionContent {
|
|
23
|
+
/**
|
|
24
|
+
* 预合成元素基础属性
|
|
25
|
+
*/
|
|
26
|
+
options: {
|
|
27
|
+
/**
|
|
28
|
+
* 引用的合成id
|
|
29
|
+
*/
|
|
30
|
+
refId: string;
|
|
31
|
+
/**
|
|
32
|
+
* 预合成元素宽高
|
|
33
|
+
*/
|
|
34
|
+
size?: vec3;
|
|
35
|
+
/**
|
|
36
|
+
* 预合成元素基础颜色
|
|
37
|
+
*/
|
|
38
|
+
startColor?: RGBAColorValue;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* 预合成元素大小变化属性
|
|
42
|
+
*/
|
|
43
|
+
sizeOverLifetime?: SizeOverLifetime;
|
|
44
|
+
/**
|
|
45
|
+
* 预合成元素旋转变化属性
|
|
46
|
+
*/
|
|
47
|
+
rotationOverLifetime?: RotationOverLifetime;
|
|
48
|
+
/**
|
|
49
|
+
* 预合成元素位置变化属性
|
|
50
|
+
*/
|
|
51
|
+
positionOverLifetime?: PositionOverLifetime;
|
|
52
|
+
/**
|
|
53
|
+
* 预合成元素色彩变化属性
|
|
54
|
+
*/
|
|
55
|
+
colorOverLifetime?: ColorOverLifetime;
|
|
56
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import type { BaseItem, ColorOverLifetime, FixedNumberExpression, FixedVec3Expression, FunctionExpression, ItemEndBehavior, ItemType, MaskMode, NumberExpression, RenderMode, RotationOverLifetime, ShapeGeometry, SideMode, SizeOverLifetime, SpriteContentOptions, vec2, vec3 } from '../index';
|
|
2
|
+
export interface FilterItem extends BaseItem {
|
|
3
|
+
type: ItemType.filter;
|
|
4
|
+
content: FilterContent;
|
|
5
|
+
endBehavior: ItemEndBehavior;
|
|
6
|
+
}
|
|
7
|
+
export declare type FilterParams = NoneFilterParams | GaussianFilterParams | BloomFilterPrams | DelayFilterPrams | DistortionFilterParams | CameraMoveFilterParams | AlphaMaskFilterParams | AlphaFrameFilterParams;
|
|
8
|
+
export interface FilterContent {
|
|
9
|
+
options: SpriteContentOptions;
|
|
10
|
+
filter: FilterParams;
|
|
11
|
+
renderer?: FilterContentRenderer;
|
|
12
|
+
colorOverLifetime?: ColorOverLifetime;
|
|
13
|
+
/**
|
|
14
|
+
* 图层元素大小变化属性
|
|
15
|
+
*/
|
|
16
|
+
sizeOverLifetime?: SizeOverLifetime;
|
|
17
|
+
/**
|
|
18
|
+
* 图层元素旋转变化属性
|
|
19
|
+
*/
|
|
20
|
+
rotationOverLifetime?: RotationOverLifetime;
|
|
21
|
+
/**
|
|
22
|
+
* 图层元素位置变化属性
|
|
23
|
+
*/
|
|
24
|
+
positionOverLifetime?: FilterPositionOverLifetime;
|
|
25
|
+
}
|
|
26
|
+
export interface FilterPositionOverLifetime {
|
|
27
|
+
path: FixedVec3Expression;
|
|
28
|
+
}
|
|
29
|
+
export interface BaseFilterParams {
|
|
30
|
+
name: string;
|
|
31
|
+
/**
|
|
32
|
+
* 边缘透明度
|
|
33
|
+
* @default 1
|
|
34
|
+
*/
|
|
35
|
+
feather?: FunctionExpression;
|
|
36
|
+
}
|
|
37
|
+
export interface NoneFilterParams extends BaseFilterParams {
|
|
38
|
+
name: 'none';
|
|
39
|
+
}
|
|
40
|
+
export interface GaussianFilterParams extends BaseFilterParams {
|
|
41
|
+
name: 'gaussian';
|
|
42
|
+
radius: number;
|
|
43
|
+
}
|
|
44
|
+
export interface DelayFilterPrams extends BaseFilterParams {
|
|
45
|
+
name: 'delay';
|
|
46
|
+
}
|
|
47
|
+
export interface BloomFilterPrams extends BaseFilterParams {
|
|
48
|
+
name: 'bloom';
|
|
49
|
+
colorThreshold?: vec3;
|
|
50
|
+
bloomAddon?: FixedNumberExpression;
|
|
51
|
+
colorAddon?: FixedNumberExpression;
|
|
52
|
+
radius?: number;
|
|
53
|
+
}
|
|
54
|
+
export interface DistortionFilterParams extends BaseFilterParams {
|
|
55
|
+
name: 'distortion';
|
|
56
|
+
center?: vec2;
|
|
57
|
+
direction?: vec2;
|
|
58
|
+
period: NumberExpression;
|
|
59
|
+
waveMovement: NumberExpression;
|
|
60
|
+
strength: NumberExpression;
|
|
61
|
+
}
|
|
62
|
+
export interface CameraMoveFilterParams extends BaseFilterParams {
|
|
63
|
+
name: 'cameraMove';
|
|
64
|
+
position?: FixedVec3Expression;
|
|
65
|
+
}
|
|
66
|
+
export interface AlphaMaskFilterParams extends BaseFilterParams {
|
|
67
|
+
name: 'alphaMask';
|
|
68
|
+
xOpacity: FixedNumberExpression;
|
|
69
|
+
yOpacity: FixedNumberExpression;
|
|
70
|
+
}
|
|
71
|
+
export interface AlphaFrameFilterParams extends BaseFilterParams {
|
|
72
|
+
name: 'alphaFrame';
|
|
73
|
+
colorRange?: [x: number, y: number];
|
|
74
|
+
alphaRange?: [x: number, y: number];
|
|
75
|
+
}
|
|
76
|
+
export declare const BloomFilterThresholdAvgColor = 0;
|
|
77
|
+
export interface FilterContentRenderer {
|
|
78
|
+
/**
|
|
79
|
+
* 渲染模式
|
|
80
|
+
*/
|
|
81
|
+
renderMode?: RenderMode;
|
|
82
|
+
/**
|
|
83
|
+
* 锚点信息
|
|
84
|
+
*/
|
|
85
|
+
anchor?: vec2;
|
|
86
|
+
/**
|
|
87
|
+
* 单双面模式
|
|
88
|
+
*/
|
|
89
|
+
side?: SideMode;
|
|
90
|
+
/**
|
|
91
|
+
* 蒙版模式
|
|
92
|
+
* @default none
|
|
93
|
+
*/
|
|
94
|
+
maskMode?: MaskMode;
|
|
95
|
+
/**
|
|
96
|
+
* 形状
|
|
97
|
+
*/
|
|
98
|
+
shape?: number | ShapeGeometry;
|
|
99
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import type { InteractBehavior, InteractType, ItemType } from '../type';
|
|
2
|
+
import type { RGBAColor } from '../numberExpression';
|
|
3
|
+
import type { BaseItem, ItemEndBehavior } from './base-item';
|
|
4
|
+
/**
|
|
5
|
+
* 交互元素
|
|
6
|
+
*/
|
|
7
|
+
export interface InteractItem extends BaseItem {
|
|
8
|
+
/**
|
|
9
|
+
* 元素类型[指定为interact]
|
|
10
|
+
*/
|
|
11
|
+
type: ItemType.interact;
|
|
12
|
+
/**
|
|
13
|
+
* 交互元素渲染信息
|
|
14
|
+
*/
|
|
15
|
+
content: InteractContent;
|
|
16
|
+
endBehavior: ItemEndBehavior;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* 交互元素渲染属性
|
|
20
|
+
*/
|
|
21
|
+
export interface InteractContent {
|
|
22
|
+
/**
|
|
23
|
+
* 交互元素基础属性
|
|
24
|
+
*/
|
|
25
|
+
options: InteractOption;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* 交互元素基础属性
|
|
29
|
+
*/
|
|
30
|
+
export declare type InteractOption = ClickInteractOption | MessageInteractOption | DragInteractOption;
|
|
31
|
+
/**
|
|
32
|
+
* 点击交互元素基础属性
|
|
33
|
+
*/
|
|
34
|
+
export interface ClickInteractOption {
|
|
35
|
+
/**
|
|
36
|
+
* 交互元素类型
|
|
37
|
+
*/
|
|
38
|
+
type: InteractType;
|
|
39
|
+
/**
|
|
40
|
+
* 面板展示开关
|
|
41
|
+
*/
|
|
42
|
+
showPreview: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* 预览颜色属性
|
|
45
|
+
*/
|
|
46
|
+
previewColor: RGBAColor;
|
|
47
|
+
/**
|
|
48
|
+
* 交互触发行为
|
|
49
|
+
*/
|
|
50
|
+
behavior: InteractBehavior;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* 拖拽交互元素基础属性
|
|
54
|
+
*/
|
|
55
|
+
export interface MessageInteractOption {
|
|
56
|
+
/**
|
|
57
|
+
* 交互元素类型
|
|
58
|
+
*/
|
|
59
|
+
type: InteractType;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* 拖拽交互元素基础属性
|
|
63
|
+
*/
|
|
64
|
+
export interface DragInteractOption {
|
|
65
|
+
/**
|
|
66
|
+
* 交互元素类型
|
|
67
|
+
*/
|
|
68
|
+
type: InteractType;
|
|
69
|
+
/**
|
|
70
|
+
* 在编辑器中启用
|
|
71
|
+
*/
|
|
72
|
+
enableInEditor: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* x轴拖拽范围
|
|
75
|
+
*/
|
|
76
|
+
dxRange?: [min: number, max: number];
|
|
77
|
+
/**
|
|
78
|
+
* y轴拖拽范围
|
|
79
|
+
*/
|
|
80
|
+
dyRange?: [min: number, max: number];
|
|
81
|
+
/**
|
|
82
|
+
* 目标
|
|
83
|
+
*/
|
|
84
|
+
target: string;
|
|
85
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import type { Binary, BinaryEnv, BinaryPointer, TypedArray } from '../../binary';
|
|
2
|
+
import type { BufferType } from './mesh';
|
|
3
|
+
/**
|
|
4
|
+
* Attribute binding information
|
|
5
|
+
* size: attribute size. the size attribute of vec4|vec3|vec2 is 4|3|2
|
|
6
|
+
* stride: used for interleaved attributes, 2 vec4 stride is 4 * 2 * Float32Array.BYTES_PER_ELEMENTS
|
|
7
|
+
* offset: offset for interleaved attributes, 1 vec4 offset is 4 * Float32Array.BYTES_PER_ELEMENTS
|
|
8
|
+
* normalize: attributed should be normalized
|
|
9
|
+
*
|
|
10
|
+
* Attribute 的绑定信息
|
|
11
|
+
* size:向量的大小,vec4|vec3|vec2 的大小分别为 4|3|2
|
|
12
|
+
* stride:如果使用交错存储顶点,2个 vec4 的 stride 为 2 * 4 * Float32Array.BYTES_PER_ELEMENTS
|
|
13
|
+
* offset:交错顶点的数据偏移,1个 vec4 的偏移为 4 * Float32Array.BYTES_PER_ELEMENTS
|
|
14
|
+
*/
|
|
15
|
+
export interface AttributeBase {
|
|
16
|
+
size: number;
|
|
17
|
+
stride?: number;
|
|
18
|
+
offset?: number;
|
|
19
|
+
instanceDivisor?: number;
|
|
20
|
+
normalize?: boolean;
|
|
21
|
+
}
|
|
22
|
+
export interface AttributeWithDataSource extends AttributeBase {
|
|
23
|
+
/**
|
|
24
|
+
* 如果使用 interleaved attribute,此字段表示数据共享的 attribute
|
|
25
|
+
*/
|
|
26
|
+
dataSource: string;
|
|
27
|
+
/**
|
|
28
|
+
* use FLOAT by default
|
|
29
|
+
*/
|
|
30
|
+
type?: BufferType;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* if data provided, type can be inferred from its data
|
|
34
|
+
* if data not provided, type will be FLOAT by default
|
|
35
|
+
* releasable is false by default,
|
|
36
|
+
* if releasable set true, geometry.getAttributeData will return null after data send to gpu buffer
|
|
37
|
+
*
|
|
38
|
+
* 如果有 data 字段,type 会根据数据进行推断
|
|
39
|
+
* 如果没有 data 字段,type 默认为 FLOAT
|
|
40
|
+
* releasable 默认为 false,如果为 true,在数据被提交到 GPU buffer 后 geometry.getAttributeData 方法返回 null
|
|
41
|
+
*/
|
|
42
|
+
export interface AttributeWithData extends AttributeBase {
|
|
43
|
+
data?: TypedArray;
|
|
44
|
+
releasable?: boolean;
|
|
45
|
+
type?: BufferType;
|
|
46
|
+
}
|
|
47
|
+
export interface AttributeWithDataPointer extends AttributeBase {
|
|
48
|
+
data: BinaryPointer;
|
|
49
|
+
releasable?: boolean;
|
|
50
|
+
type?: BufferType;
|
|
51
|
+
}
|
|
52
|
+
export interface AttributeWithType extends AttributeBase {
|
|
53
|
+
/**
|
|
54
|
+
* 如果使用interleaved attribute,此字段表示数据共享的attribute
|
|
55
|
+
*/
|
|
56
|
+
dataSource: string;
|
|
57
|
+
type: BufferType;
|
|
58
|
+
}
|
|
59
|
+
export declare type AttributeJSON = AttributeWithDataPointer | AttributeWithType | AttributeWithDataSource;
|
|
60
|
+
export interface GeometryOptionsJSON {
|
|
61
|
+
name?: string;
|
|
62
|
+
attributes: Record<string, AttributeJSON>;
|
|
63
|
+
indices?: {
|
|
64
|
+
data: BinaryPointer;
|
|
65
|
+
releasable?: boolean;
|
|
66
|
+
};
|
|
67
|
+
mode?: GLenum;
|
|
68
|
+
drawCount?: number;
|
|
69
|
+
drawStart?: number;
|
|
70
|
+
instanceCount?: number;
|
|
71
|
+
bufferUsage?: GLenum;
|
|
72
|
+
/**
|
|
73
|
+
* 粒子最大数量,适用于无法更新 GPU 缓存长度的引擎接入
|
|
74
|
+
*/
|
|
75
|
+
maxVertex?: number;
|
|
76
|
+
}
|
|
77
|
+
export declare type GeometryPointer<T extends BinaryEnv> = T extends 'studio' ? any : GeometryOptionsJSON;
|
|
78
|
+
/**
|
|
79
|
+
* studio 中是 `Texture` 对象
|
|
80
|
+
* json 中是 `GLTFTexture<'json'>` 类型,`imageFileId` 是二进制指针
|
|
81
|
+
* runtime 中是 `scene.textures` 数组的 `index`,`textures` 的创建由 Player 负责
|
|
82
|
+
*/
|
|
83
|
+
export declare type TexturePointer<T extends BinaryEnv> = T extends 'studio' ? any : number;
|
|
84
|
+
export declare type SkyboxCubeTexturePointer<T extends BinaryEnv> = T extends 'studio' ? any : number;
|
|
85
|
+
export declare type ModelAnimationTrackDataPointer<T extends BinaryEnv> = Binary<Float32Array, Float32Array, T>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { BaseItem, ItemEndBehavior } from '../base-item';
|
|
2
|
+
import type { CameraOptions } from '../../composition';
|
|
3
|
+
import type { RotationOverLifetime, PositionOverLifetime } from '../../type';
|
|
4
|
+
export interface ModelCameraOptions extends CameraOptions {
|
|
5
|
+
parent?: number;
|
|
6
|
+
/**
|
|
7
|
+
* 默认不提供,等于 canvas 的 `width/height`
|
|
8
|
+
*/
|
|
9
|
+
aspect?: number;
|
|
10
|
+
}
|
|
11
|
+
export interface ModelCameraContent {
|
|
12
|
+
/**
|
|
13
|
+
* 3D相机元素基础属性
|
|
14
|
+
*/
|
|
15
|
+
options: ModelCameraOptions;
|
|
16
|
+
/**
|
|
17
|
+
* 3D相机元素旋转变化属性
|
|
18
|
+
*/
|
|
19
|
+
rotationOverLifetime?: RotationOverLifetime;
|
|
20
|
+
/**
|
|
21
|
+
* 3D相机元素位置变化属性
|
|
22
|
+
*/
|
|
23
|
+
positionOverLifetime?: PositionOverLifetime;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* 3D相机元素
|
|
27
|
+
*/
|
|
28
|
+
export interface ModelCameraItem extends BaseItem {
|
|
29
|
+
type: 'camera';
|
|
30
|
+
pluginName: 'model';
|
|
31
|
+
content: ModelCameraContent;
|
|
32
|
+
endBehavior: ItemEndBehavior;
|
|
33
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export * from './skybox';
|
|
2
|
+
export * from './light';
|
|
3
|
+
export * from './mesh';
|
|
4
|
+
export * from './tree';
|
|
5
|
+
export * from './camera';
|
|
6
|
+
export * from './material';
|
|
7
|
+
export * from './binary';
|
|
8
|
+
export * from './render';
|
|
9
|
+
/***
|
|
10
|
+
* 一个 meshItem 打包出来的 json 案例:
|
|
11
|
+
*
|
|
12
|
+
* {
|
|
13
|
+
* type:'mesh',
|
|
14
|
+
* pluginName:'model',
|
|
15
|
+
* content:{
|
|
16
|
+
* options:{
|
|
17
|
+
* skins:{},
|
|
18
|
+
* primitives:[
|
|
19
|
+
* {
|
|
20
|
+
* material:{
|
|
21
|
+
* baseColorFactor:[0,0.5,1,1],
|
|
22
|
+
* baseColorTexture: {
|
|
23
|
+
* magFilter:33071,
|
|
24
|
+
* imageFileId:[0,556,1342]
|
|
25
|
+
* }
|
|
26
|
+
* },
|
|
27
|
+
* geometry:[0,0,556]
|
|
28
|
+
* }
|
|
29
|
+
* ]
|
|
30
|
+
* }
|
|
31
|
+
*
|
|
32
|
+
* }
|
|
33
|
+
* }
|
|
34
|
+
* bins:[{url:'https://to/some/bin'}]
|
|
35
|
+
*/
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { RGBAColorValue } from '../../numberExpression';
|
|
2
|
+
import type { BaseItem, ItemEndBehavior } from '../base-item';
|
|
3
|
+
import type { RotationOverLifetime, PositionOverLifetime, ItemType } from '../../type';
|
|
4
|
+
export interface ModelLightBaseOptions {
|
|
5
|
+
/**
|
|
6
|
+
* 挂靠的父节点
|
|
7
|
+
*/
|
|
8
|
+
parent?: number;
|
|
9
|
+
/**
|
|
10
|
+
* 灯光颜色,线性空间
|
|
11
|
+
* @default [255,255,255]
|
|
12
|
+
*/
|
|
13
|
+
color: RGBAColorValue;
|
|
14
|
+
/**
|
|
15
|
+
* 灯光强度
|
|
16
|
+
* @default 1
|
|
17
|
+
*/
|
|
18
|
+
intensity: number;
|
|
19
|
+
}
|
|
20
|
+
export interface ModelLightPointOptions extends ModelLightBaseOptions {
|
|
21
|
+
lightType: 'point';
|
|
22
|
+
/**
|
|
23
|
+
* @default Infinity
|
|
24
|
+
*/
|
|
25
|
+
range: number;
|
|
26
|
+
}
|
|
27
|
+
export interface ModelLightSpotOptions extends ModelLightBaseOptions {
|
|
28
|
+
lightType: 'spot';
|
|
29
|
+
/**
|
|
30
|
+
* @default Infinity
|
|
31
|
+
*/
|
|
32
|
+
range: number;
|
|
33
|
+
/**
|
|
34
|
+
* @default 0
|
|
35
|
+
*/
|
|
36
|
+
innerConeAngle: number;
|
|
37
|
+
/**
|
|
38
|
+
* 默认值45度,PI/4
|
|
39
|
+
* @default 45
|
|
40
|
+
*/
|
|
41
|
+
outerConeAngle: number;
|
|
42
|
+
}
|
|
43
|
+
export interface ModelLightDirOptions extends ModelLightBaseOptions {
|
|
44
|
+
lightType: 'directional';
|
|
45
|
+
}
|
|
46
|
+
export interface ModelAmbientLightOptions extends ModelLightBaseOptions {
|
|
47
|
+
lightType: 'ambient';
|
|
48
|
+
}
|
|
49
|
+
export declare type ModelLightOptions = ModelLightPointOptions | ModelLightDirOptions | ModelLightSpotOptions | ModelAmbientLightOptions;
|
|
50
|
+
export interface ModelLightContent {
|
|
51
|
+
/**
|
|
52
|
+
* 灯光元素基础属性
|
|
53
|
+
*/
|
|
54
|
+
options: ModelLightOptions;
|
|
55
|
+
/**
|
|
56
|
+
* 灯光元素旋转变化属性
|
|
57
|
+
*/
|
|
58
|
+
rotationOverLifetime?: RotationOverLifetime;
|
|
59
|
+
/**
|
|
60
|
+
* 灯光元素位置变化属性
|
|
61
|
+
*/
|
|
62
|
+
positionOverLifetime?: PositionOverLifetime;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* 灯光元素
|
|
66
|
+
*/
|
|
67
|
+
export interface ModelLightItem extends BaseItem {
|
|
68
|
+
type: ItemType.light;
|
|
69
|
+
pluginName: 'model';
|
|
70
|
+
content: ModelLightContent;
|
|
71
|
+
endBehavior: ItemEndBehavior;
|
|
72
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import type { RGBAColorValue, vec2 } from '../../numberExpression';
|
|
2
|
+
import type { BinaryEnv } from '../../binary';
|
|
3
|
+
import type { SideMode } from '../../type';
|
|
4
|
+
import type { TexturePointer } from './binary';
|
|
5
|
+
export interface ModelTextureTransform {
|
|
6
|
+
offset?: vec2;
|
|
7
|
+
rotation?: number;
|
|
8
|
+
scale?: vec2;
|
|
9
|
+
}
|
|
10
|
+
export declare enum MaterialType {
|
|
11
|
+
unlit = "unlit",
|
|
12
|
+
pbr = "pbr",
|
|
13
|
+
hair = "hair"
|
|
14
|
+
}
|
|
15
|
+
export declare enum MaterialBlending {
|
|
16
|
+
opaque = 100,
|
|
17
|
+
masked = 101,
|
|
18
|
+
translucent = 102,
|
|
19
|
+
additive = 103
|
|
20
|
+
}
|
|
21
|
+
export declare type MaterialOptions<T extends BinaryEnv> = MaterialUnlitOptions<T> | MaterialPBROptions<T>;
|
|
22
|
+
export interface MaterialUnlitOptions<T extends BinaryEnv> {
|
|
23
|
+
name: string;
|
|
24
|
+
type: MaterialType.unlit;
|
|
25
|
+
baseColorFactor: RGBAColorValue;
|
|
26
|
+
baseColorTexture?: TexturePointer<T>;
|
|
27
|
+
baseColorTextureTransform?: ModelTextureTransform;
|
|
28
|
+
baseColorTextureCoordinate?: number;
|
|
29
|
+
depthMask?: boolean;
|
|
30
|
+
blending?: MaterialBlending;
|
|
31
|
+
side?: SideMode;
|
|
32
|
+
alphaCutOff?: number;
|
|
33
|
+
}
|
|
34
|
+
export interface MaterialPBRBaseOptions<T extends BinaryEnv> {
|
|
35
|
+
name: string;
|
|
36
|
+
baseColorFactor: RGBAColorValue;
|
|
37
|
+
baseColorTexture?: TexturePointer<T>;
|
|
38
|
+
baseColorTextureTransform?: ModelTextureTransform;
|
|
39
|
+
baseColorTextureCoordinate?: number;
|
|
40
|
+
useSpecularAA?: boolean;
|
|
41
|
+
metallicFactor: number;
|
|
42
|
+
roughnessFactor: number;
|
|
43
|
+
metallicRoughnessTexture?: TexturePointer<T>;
|
|
44
|
+
metallicRoughnessTextureTransform?: ModelTextureTransform;
|
|
45
|
+
metallicRoughnessTextureCoordinate?: number;
|
|
46
|
+
normalTexture?: TexturePointer<T>;
|
|
47
|
+
normalTextureScale?: number;
|
|
48
|
+
normalTextureTransform?: ModelTextureTransform;
|
|
49
|
+
normalTextureCoordinate?: number;
|
|
50
|
+
occlusionTexture?: TexturePointer<T>;
|
|
51
|
+
occlusionTextureStrength?: number;
|
|
52
|
+
occlusionTextureTransform?: ModelTextureTransform;
|
|
53
|
+
occlusionTextureCoordinate?: number;
|
|
54
|
+
emissiveFactor: RGBAColorValue;
|
|
55
|
+
emissiveIntensity: number;
|
|
56
|
+
emissiveTexture?: TexturePointer<T>;
|
|
57
|
+
emissiveTextureTransform?: ModelTextureTransform;
|
|
58
|
+
emissiveTextureCoordinate?: number;
|
|
59
|
+
depthMask?: boolean;
|
|
60
|
+
blending?: MaterialBlending;
|
|
61
|
+
side?: SideMode;
|
|
62
|
+
alphaCutOff?: number;
|
|
63
|
+
enableShadow?: boolean;
|
|
64
|
+
}
|
|
65
|
+
export interface MaterialPBROptions<T extends BinaryEnv> extends MaterialPBRBaseOptions<T> {
|
|
66
|
+
/**
|
|
67
|
+
* 增加 pbr 类型参数
|
|
68
|
+
*/
|
|
69
|
+
type: MaterialType.pbr;
|
|
70
|
+
}
|
|
71
|
+
export interface MaterialHairOptions<T extends BinaryEnv> extends MaterialPBRBaseOptions<T> {
|
|
72
|
+
/**
|
|
73
|
+
* 增加头发相关参数
|
|
74
|
+
*/
|
|
75
|
+
type: MaterialType.hair;
|
|
76
|
+
specularShiftTexture?: TexturePointer<T>;
|
|
77
|
+
specularPower?: number;
|
|
78
|
+
specularScale?: number;
|
|
79
|
+
specularWidth?: number;
|
|
80
|
+
primaryColor?: RGBAColorValue;
|
|
81
|
+
primaryShift?: number;
|
|
82
|
+
secondaryColor?: RGBAColorValue;
|
|
83
|
+
secondaryShift?: number;
|
|
84
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { BinaryEnv } from '../../binary';
|
|
2
|
+
import type { BaseItem, ItemEndBehavior } from '../base-item';
|
|
3
|
+
import type { MaterialOptions } from './material';
|
|
4
|
+
import type { GeometryPointer } from './binary';
|
|
5
|
+
import type { vec3 } from '../../numberExpression';
|
|
6
|
+
import type { InteractBehavior, ItemType } from '../../type';
|
|
7
|
+
import type { ModelAnimationTrackDataPointer } from './binary';
|
|
8
|
+
export declare type BufferType = WebGLRenderingContext['FLOAT'] | WebGLRenderingContext['INT'] | WebGLRenderingContext['SHORT'] | WebGLRenderingContext['BYTE'] | WebGLRenderingContext['UNSIGNED_INT'] | WebGLRenderingContext['UNSIGNED_SHORT'] | WebGLRenderingContext['UNSIGNED_BYTE'];
|
|
9
|
+
export interface PrimitiveOptions<T extends BinaryEnv> {
|
|
10
|
+
geometry: GeometryPointer<T>;
|
|
11
|
+
material: MaterialOptions<T>;
|
|
12
|
+
}
|
|
13
|
+
export interface SkinOptions<T extends BinaryEnv> {
|
|
14
|
+
name?: string;
|
|
15
|
+
joints: number[];
|
|
16
|
+
skeleton?: number;
|
|
17
|
+
inverseBindMatrices?: ModelAnimationTrackDataPointer<T>;
|
|
18
|
+
}
|
|
19
|
+
export interface ModelMeshOptions<T extends BinaryEnv> {
|
|
20
|
+
skin?: SkinOptions<T>;
|
|
21
|
+
primitives: PrimitiveOptions<T>[];
|
|
22
|
+
weights?: number[];
|
|
23
|
+
hide?: boolean;
|
|
24
|
+
parent?: number;
|
|
25
|
+
}
|
|
26
|
+
export declare enum ModelBoundingType {
|
|
27
|
+
box = 2,
|
|
28
|
+
sphere = 3
|
|
29
|
+
}
|
|
30
|
+
export interface ModelItemBoundingBox {
|
|
31
|
+
behavior?: InteractBehavior | number;
|
|
32
|
+
type: ModelBoundingType.box;
|
|
33
|
+
/**
|
|
34
|
+
* 包围形状相对于元素位置的偏移
|
|
35
|
+
* @default [0,0,0]
|
|
36
|
+
*/
|
|
37
|
+
center?: vec3;
|
|
38
|
+
/**
|
|
39
|
+
* 包围盒的 xyz 长度,当 type 为 box 时生效
|
|
40
|
+
*/
|
|
41
|
+
size?: vec3;
|
|
42
|
+
}
|
|
43
|
+
export interface ModelItemBoundingSphere {
|
|
44
|
+
behavior?: InteractBehavior | number;
|
|
45
|
+
/**
|
|
46
|
+
* 包围形状相对于元素位置的偏移
|
|
47
|
+
* @default [0,0,0]
|
|
48
|
+
*/
|
|
49
|
+
center?: vec3;
|
|
50
|
+
type: ModelBoundingType.sphere;
|
|
51
|
+
/**
|
|
52
|
+
* 包围球的半径,当 type 为 sphere 时生效
|
|
53
|
+
*/
|
|
54
|
+
radius: number;
|
|
55
|
+
}
|
|
56
|
+
export declare type ModelItemBounding = ModelItemBoundingBox | ModelItemBoundingSphere;
|
|
57
|
+
export interface ModelMeshItemContent<T extends BinaryEnv> {
|
|
58
|
+
options: ModelMeshOptions<T>;
|
|
59
|
+
interaction?: ModelItemBounding;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* 模型元素
|
|
63
|
+
*/
|
|
64
|
+
export interface ModelMeshItem<T extends BinaryEnv> extends BaseItem {
|
|
65
|
+
type: ItemType.mesh;
|
|
66
|
+
pluginName: 'model';
|
|
67
|
+
content: ModelMeshItemContent<T>;
|
|
68
|
+
endBehavior: ItemEndBehavior;
|
|
69
|
+
}
|