@galacean/effects-specification 2.0.1 → 2.1.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/es/assets.d.ts +95 -0
- package/es/assets.js +18 -0
- package/es/buitin-object-guid.d.ts +1 -0
- package/es/buitin-object-guid.js +1 -0
- package/es/components.d.ts +2 -5
- package/es/components.js +2 -0
- package/es/index.d.ts +4 -1
- package/es/index.js +4 -1
- package/es/item/audio-item.d.ts +46 -0
- package/es/item/audio-item.js +1 -0
- package/es/item/effect-item.d.ts +6 -0
- package/es/item/particle-item.d.ts +2 -2
- package/es/item/spine-item.d.ts +4 -0
- package/es/item/video-item.d.ts +82 -0
- package/es/item/video-item.js +1 -0
- package/es/item.d.ts +3 -1
- package/es/scene.d.ts +18 -6
- package/es/texture.d.ts +45 -0
- package/es/texture.js +1 -0
- package/es/type.d.ts +12 -15
- package/es/type.js +8 -0
- package/package.json +1 -1
- package/es/image.d.ts +0 -123
- package/es/image.js +0 -9
package/es/assets.d.ts
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import type { RenderLevel } from './type';
|
|
2
|
+
/**
|
|
3
|
+
* 资源基类
|
|
4
|
+
*/
|
|
5
|
+
export interface AssetBase {
|
|
6
|
+
/**
|
|
7
|
+
* 资源 ID
|
|
8
|
+
*/
|
|
9
|
+
id: string;
|
|
10
|
+
/**
|
|
11
|
+
* 资源类型
|
|
12
|
+
*/
|
|
13
|
+
url: string;
|
|
14
|
+
/**
|
|
15
|
+
* 渲染等级
|
|
16
|
+
* 如果没有设置,按照 B+ 处理
|
|
17
|
+
*/
|
|
18
|
+
renderLevel?: RenderLevel;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* 动态换图类型
|
|
22
|
+
* @since 1.1.0
|
|
23
|
+
*/
|
|
24
|
+
export declare enum BackgroundType {
|
|
25
|
+
video = "video",
|
|
26
|
+
image = "image"
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* 多媒体资源类型
|
|
30
|
+
* @since 2.1.0
|
|
31
|
+
*/
|
|
32
|
+
export declare enum MultimediaType {
|
|
33
|
+
video = "video",
|
|
34
|
+
audio = "audio"
|
|
35
|
+
}
|
|
36
|
+
export interface TemplateContent {
|
|
37
|
+
/**
|
|
38
|
+
* 当 template 宽高和 image 不相同时,会对 template 进行缩放,使其和 image 相同。
|
|
39
|
+
*/
|
|
40
|
+
width: number;
|
|
41
|
+
height: number;
|
|
42
|
+
background?: {
|
|
43
|
+
type: BackgroundType;
|
|
44
|
+
name: string;
|
|
45
|
+
url: string | HTMLImageElement;
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
export type TemplateVariables = Record<string, string | string[] | HTMLImageElement | HTMLImageElement[]>;
|
|
49
|
+
export type ImageSource = Image | TemplateImage | CompressedImage;
|
|
50
|
+
/**
|
|
51
|
+
* 纹理贴图属性
|
|
52
|
+
*/
|
|
53
|
+
export interface Image extends AssetBase {
|
|
54
|
+
/**
|
|
55
|
+
* WebP 地址
|
|
56
|
+
* 如果运行时支持 WebP,则优先使用 WebP
|
|
57
|
+
*/
|
|
58
|
+
webp?: string;
|
|
59
|
+
/**
|
|
60
|
+
* AVIF 地址
|
|
61
|
+
* 如果运行时支持 AVIF,则优先使用 AVIF
|
|
62
|
+
* @since 2.0.0
|
|
63
|
+
*/
|
|
64
|
+
avif?: string;
|
|
65
|
+
/**
|
|
66
|
+
* 是否使用 mipmap
|
|
67
|
+
* loader 发布压缩纹理的时候会根据此参数决定是否生成压缩纹理
|
|
68
|
+
* @default false
|
|
69
|
+
*/
|
|
70
|
+
mipmap?: boolean;
|
|
71
|
+
/**
|
|
72
|
+
* 图片 Y 轴的方向,如果 Y 轴向上(与 OpenGL 相同)则为 1
|
|
73
|
+
* 如果 Y 轴向下(与 OpenGL 相反)则为 -1,图片再绘制数据模板的时候需要翻转绘制
|
|
74
|
+
* @default 1
|
|
75
|
+
*/
|
|
76
|
+
oriY?: 1 | -1;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* 模板贴图属性
|
|
80
|
+
*/
|
|
81
|
+
export interface TemplateImage extends Image {
|
|
82
|
+
template: TemplateContent;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* 压缩贴图属性
|
|
86
|
+
*/
|
|
87
|
+
export interface CompressedImage extends Image {
|
|
88
|
+
/**
|
|
89
|
+
* 压缩贴图地址
|
|
90
|
+
*/
|
|
91
|
+
compressed: {
|
|
92
|
+
astc?: string;
|
|
93
|
+
pvrtc?: string;
|
|
94
|
+
};
|
|
95
|
+
}
|
package/es/assets.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 动态换图类型
|
|
3
|
+
* @since 1.1.0
|
|
4
|
+
*/
|
|
5
|
+
export var BackgroundType;
|
|
6
|
+
(function (BackgroundType) {
|
|
7
|
+
BackgroundType["video"] = "video";
|
|
8
|
+
BackgroundType["image"] = "image";
|
|
9
|
+
})(BackgroundType || (BackgroundType = {}));
|
|
10
|
+
/**
|
|
11
|
+
* 多媒体资源类型
|
|
12
|
+
* @since 2.1.0
|
|
13
|
+
*/
|
|
14
|
+
export var MultimediaType;
|
|
15
|
+
(function (MultimediaType) {
|
|
16
|
+
MultimediaType["video"] = "video";
|
|
17
|
+
MultimediaType["audio"] = "audio";
|
|
18
|
+
})(MultimediaType || (MultimediaType = {}));
|
package/es/buitin-object-guid.js
CHANGED
package/es/components.d.ts
CHANGED
|
@@ -32,6 +32,8 @@ export declare enum DataType {
|
|
|
32
32
|
TreeComponent = "TreeComponent",
|
|
33
33
|
AnimationComponent = "AnimationComponent",
|
|
34
34
|
SpineComponent = "SpineComponent",
|
|
35
|
+
VideoComponent = "VideoComponent",
|
|
36
|
+
AudioComponent = "AudioComponent",
|
|
35
37
|
TimelineClip = "TimelineClip"
|
|
36
38
|
}
|
|
37
39
|
export interface DataPath {
|
|
@@ -193,11 +195,6 @@ export interface ShaderData extends EffectsObjectData {
|
|
|
193
195
|
fragment: string;
|
|
194
196
|
properties?: string;
|
|
195
197
|
}
|
|
196
|
-
export interface EffectComponentData extends ComponentData {
|
|
197
|
-
_priority: number;
|
|
198
|
-
materials: DataPath[];
|
|
199
|
-
geometry: DataPath;
|
|
200
|
-
}
|
|
201
198
|
export interface EffectsPackageData {
|
|
202
199
|
fileSummary: FileSummary;
|
|
203
200
|
exportObjects: EffectsObjectData[];
|
package/es/components.js
CHANGED
|
@@ -34,6 +34,8 @@ export var DataType;
|
|
|
34
34
|
DataType["TreeComponent"] = "TreeComponent";
|
|
35
35
|
DataType["AnimationComponent"] = "AnimationComponent";
|
|
36
36
|
DataType["SpineComponent"] = "SpineComponent";
|
|
37
|
+
DataType["VideoComponent"] = "VideoComponent";
|
|
38
|
+
DataType["AudioComponent"] = "AudioComponent";
|
|
37
39
|
// Non-EffectObject
|
|
38
40
|
DataType["TimelineClip"] = "TimelineClip";
|
|
39
41
|
})(DataType || (DataType = {}));
|
package/es/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export * from './type';
|
|
2
2
|
export * from './composition';
|
|
3
|
-
export * from './
|
|
3
|
+
export * from './texture';
|
|
4
4
|
export * from './constants';
|
|
5
5
|
export * from './number-expression';
|
|
6
6
|
export * from './scene';
|
|
@@ -17,6 +17,8 @@ export * from './item/sprite-item';
|
|
|
17
17
|
export * from './item/spine-item';
|
|
18
18
|
export * from './item/effect-item';
|
|
19
19
|
export * from './item/text-item';
|
|
20
|
+
export * from './item/video-item';
|
|
21
|
+
export * from './item/audio-item';
|
|
20
22
|
export * from './item/model';
|
|
21
23
|
export * from './vfx-item-data';
|
|
22
24
|
export * from './animation-clip-data';
|
|
@@ -26,3 +28,4 @@ export * from './components';
|
|
|
26
28
|
export * from './vfx-item-data';
|
|
27
29
|
export * from './buitin-object-guid';
|
|
28
30
|
export * from './timeline';
|
|
31
|
+
export * from './assets';
|
package/es/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export * from './type';
|
|
2
2
|
export * from './composition';
|
|
3
|
-
export * from './
|
|
3
|
+
export * from './texture';
|
|
4
4
|
export * from './constants';
|
|
5
5
|
export * from './number-expression';
|
|
6
6
|
export * from './scene';
|
|
@@ -17,6 +17,8 @@ export * from './item/sprite-item';
|
|
|
17
17
|
export * from './item/spine-item';
|
|
18
18
|
export * from './item/effect-item';
|
|
19
19
|
export * from './item/text-item';
|
|
20
|
+
export * from './item/video-item';
|
|
21
|
+
export * from './item/audio-item';
|
|
20
22
|
export * from './item/model';
|
|
21
23
|
export * from './vfx-item-data';
|
|
22
24
|
export * from './animation-clip-data';
|
|
@@ -26,3 +28,4 @@ export * from './components';
|
|
|
26
28
|
export * from './vfx-item-data';
|
|
27
29
|
export * from './buitin-object-guid';
|
|
28
30
|
export * from './timeline';
|
|
31
|
+
export * from './assets';
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { ComponentData, DataPath } from '../components';
|
|
2
|
+
import type { ItemType } from '../type';
|
|
3
|
+
import type { BaseItem } from './base-item';
|
|
4
|
+
/**
|
|
5
|
+
* 音频元素
|
|
6
|
+
*/
|
|
7
|
+
export interface AudioItem extends BaseItem {
|
|
8
|
+
/**
|
|
9
|
+
* 元素类型(指定为 audio)
|
|
10
|
+
*/
|
|
11
|
+
type: ItemType.audio;
|
|
12
|
+
/**
|
|
13
|
+
* 音频元素基础属性
|
|
14
|
+
*/
|
|
15
|
+
content: AudioComponentData;
|
|
16
|
+
}
|
|
17
|
+
export interface AudioContentOptions {
|
|
18
|
+
/**
|
|
19
|
+
* 音频链接,索引到 scene 中的 audios 数组
|
|
20
|
+
*/
|
|
21
|
+
audio: DataPath;
|
|
22
|
+
/**
|
|
23
|
+
* 音频播放速度
|
|
24
|
+
* @default 1
|
|
25
|
+
*/
|
|
26
|
+
playbackRate?: number;
|
|
27
|
+
/**
|
|
28
|
+
* 是否静音播放
|
|
29
|
+
* @default false
|
|
30
|
+
*/
|
|
31
|
+
muted?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* 音频音量大小
|
|
34
|
+
* @default 1
|
|
35
|
+
*/
|
|
36
|
+
volume?: number;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* 音频组件属性
|
|
40
|
+
*/
|
|
41
|
+
export interface AudioComponentData extends ComponentData {
|
|
42
|
+
/**
|
|
43
|
+
* 音频元素基础属性
|
|
44
|
+
*/
|
|
45
|
+
options: AudioContentOptions;
|
|
46
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/es/item/effect-item.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ComponentData, DataPath } from '../components';
|
|
1
2
|
import type { ItemType, PositionOverLifetime, RotationOverLifetime, SizeOverLifetime } from '../type';
|
|
2
3
|
import type { BaseItem, EndBehavior } from './base-item';
|
|
3
4
|
/**
|
|
@@ -33,3 +34,8 @@ export interface EffectContent {
|
|
|
33
34
|
*/
|
|
34
35
|
positionOverLifetime?: PositionOverLifetime;
|
|
35
36
|
}
|
|
37
|
+
export interface EffectComponentData extends ComponentData {
|
|
38
|
+
_priority: number;
|
|
39
|
+
materials: DataPath[];
|
|
40
|
+
geometry: DataPath;
|
|
41
|
+
}
|
|
@@ -2,7 +2,7 @@ import type { ItemType, RendererOptions, TextureSheetAnimation, BlendingMode, Sp
|
|
|
2
2
|
import type { FixedNumberExpression, NumberExpression, GradientColor, vec3, FixedVec3Expression, ColorExpression, FunctionExpression } from '../number-expression';
|
|
3
3
|
import type { BaseItem, EndBehavior } from './base-item';
|
|
4
4
|
import type { ParticleShape } from './particle-shape';
|
|
5
|
-
import type { ComponentData } from '../components';
|
|
5
|
+
import type { ComponentData, DataPath } from '../components';
|
|
6
6
|
/**
|
|
7
7
|
* 粒子交互行为
|
|
8
8
|
*/
|
|
@@ -472,7 +472,7 @@ export interface ParticleTrail {
|
|
|
472
472
|
/**
|
|
473
473
|
* 拖尾贴图
|
|
474
474
|
*/
|
|
475
|
-
texture?:
|
|
475
|
+
texture?: DataPath;
|
|
476
476
|
/**
|
|
477
477
|
* 位置受父节点影响
|
|
478
478
|
* 拖尾+图层绑定同一个父节点时使用
|
package/es/item/spine-item.d.ts
CHANGED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import type { ComponentData, DataPath } from '../components';
|
|
2
|
+
import type { RGBAColorValue } from '../number-expression';
|
|
3
|
+
import type { SizeOverLifetime, RotationOverLifetime, PositionOverLifetime, ColorOverLifetime, InteractBehavior, RendererOptions, ItemType } from '../type';
|
|
4
|
+
import type { BaseItem, EndBehavior } from './base-item';
|
|
5
|
+
/**
|
|
6
|
+
* 视频元素
|
|
7
|
+
*/
|
|
8
|
+
export interface VideoItem extends BaseItem {
|
|
9
|
+
/**
|
|
10
|
+
* 元素类型(指定为 video)
|
|
11
|
+
*/
|
|
12
|
+
type: ItemType.video;
|
|
13
|
+
/**
|
|
14
|
+
* 视频元素渲染信息
|
|
15
|
+
*/
|
|
16
|
+
content: VideoComponentData;
|
|
17
|
+
endBehavior: EndBehavior;
|
|
18
|
+
}
|
|
19
|
+
export interface VideoContentOptions {
|
|
20
|
+
/**
|
|
21
|
+
* 元素基础颜色
|
|
22
|
+
* @default [255,255,255,255]
|
|
23
|
+
*/
|
|
24
|
+
startColor?: RGBAColorValue;
|
|
25
|
+
/**
|
|
26
|
+
* 视频链接,索引到 scene 中的 videos 数组
|
|
27
|
+
*/
|
|
28
|
+
video: DataPath;
|
|
29
|
+
/**
|
|
30
|
+
* 视频播放速度
|
|
31
|
+
* @default 1
|
|
32
|
+
*/
|
|
33
|
+
playbackRate?: number;
|
|
34
|
+
/**
|
|
35
|
+
* 是否静音播放
|
|
36
|
+
* @default false
|
|
37
|
+
*/
|
|
38
|
+
muted?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* 视频音量大小
|
|
41
|
+
* @default 1
|
|
42
|
+
*/
|
|
43
|
+
volume?: number;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* 视频组件属性
|
|
47
|
+
*/
|
|
48
|
+
export interface VideoComponentData extends ComponentData {
|
|
49
|
+
/**
|
|
50
|
+
* 视频元素基础属性
|
|
51
|
+
*/
|
|
52
|
+
options: VideoContentOptions;
|
|
53
|
+
/**
|
|
54
|
+
* 视频元素材质渲染属性
|
|
55
|
+
*/
|
|
56
|
+
renderer: RendererOptions;
|
|
57
|
+
/**
|
|
58
|
+
* 视频元素大小变化属性
|
|
59
|
+
*/
|
|
60
|
+
sizeOverLifetime?: SizeOverLifetime;
|
|
61
|
+
/**
|
|
62
|
+
* 视频元素旋转变化属性
|
|
63
|
+
*/
|
|
64
|
+
rotationOverLifetime?: RotationOverLifetime;
|
|
65
|
+
/**
|
|
66
|
+
* 视频元素位置变化属性
|
|
67
|
+
*/
|
|
68
|
+
positionOverLifetime?: PositionOverLifetime;
|
|
69
|
+
/**
|
|
70
|
+
* 视频元素色彩变化属性
|
|
71
|
+
*/
|
|
72
|
+
colorOverLifetime?: ColorOverLifetime;
|
|
73
|
+
/**
|
|
74
|
+
* 视频元素交互
|
|
75
|
+
*/
|
|
76
|
+
interaction?: {
|
|
77
|
+
/**
|
|
78
|
+
* 交互行为
|
|
79
|
+
*/
|
|
80
|
+
behavior: InteractBehavior;
|
|
81
|
+
};
|
|
82
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/es/item.d.ts
CHANGED
|
@@ -8,7 +8,9 @@ import type { ModelCameraItem, ModelLightItem, ModelMeshItem, ModelSkyboxItem, M
|
|
|
8
8
|
import type { CameraItem } from './item/camera-item';
|
|
9
9
|
import type { CompositionItem } from './item/composition-item';
|
|
10
10
|
import type { TextItem } from './item/text-item';
|
|
11
|
+
import type { VideoItem } from './item/video-item';
|
|
12
|
+
import type { AudioItem } from './item/audio-item';
|
|
11
13
|
/**
|
|
12
14
|
* Item 基类,无对应元素
|
|
13
15
|
*/
|
|
14
|
-
export type Item = SpriteItem | ParticleItem | NullItem | PluginItem | InteractItem | CameraItem | TextItem | ModelMeshItem<'json'> | ModelSkyboxItem<'json'> | ModelTreeItem<'json'> | ModelLightItem | ModelCameraItem | SpineItem | CompositionItem | ModelMeshItem<'studio'> | ModelSkyboxItem<'studio'> | ModelTreeItem<'studio'>;
|
|
16
|
+
export type Item = SpriteItem | ParticleItem | NullItem | PluginItem | InteractItem | CameraItem | TextItem | VideoItem | AudioItem | ModelMeshItem<'json'> | ModelSkyboxItem<'json'> | ModelTreeItem<'json'> | ModelLightItem | ModelCameraItem | SpineItem | CompositionItem | ModelMeshItem<'studio'> | ModelSkyboxItem<'studio'> | ModelTreeItem<'studio'>;
|
package/es/scene.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import type { Composition, CompositionData } from './composition';
|
|
2
2
|
import type { SpineResource } from './item/spine-item';
|
|
3
|
-
import type { PlayerVersion,
|
|
4
|
-
import type {
|
|
3
|
+
import type { PlayerVersion, ShapeGeometry } from './type';
|
|
4
|
+
import type { TextureDefine } from './texture';
|
|
5
5
|
import type { FontBase, FontDefine } from './text';
|
|
6
6
|
import type { BinaryFile } from './binary';
|
|
7
7
|
import type { ComponentData, EffectsObjectData, GeometryData, MaterialData, ShaderData } from './components';
|
|
8
8
|
import type { VFXItemData } from './vfx-item-data';
|
|
9
9
|
import type { AnimationClipData } from './animation-clip-data';
|
|
10
|
+
import type { AssetBase, ImageSource } from './assets';
|
|
10
11
|
/**
|
|
11
12
|
* runtime 2.0 之前的场景信息
|
|
12
13
|
* 素材信息存放于统一数据结构中
|
|
@@ -50,7 +51,7 @@ export interface JSONSceneLegacy {
|
|
|
50
51
|
/**
|
|
51
52
|
* 贴图信息
|
|
52
53
|
*/
|
|
53
|
-
images:
|
|
54
|
+
images: ImageSource[];
|
|
54
55
|
/**
|
|
55
56
|
* 根据合成ID,每个合成用到的 image 的数组索引
|
|
56
57
|
*/
|
|
@@ -62,7 +63,7 @@ export interface JSONSceneLegacy {
|
|
|
62
63
|
/**
|
|
63
64
|
* 蒙版形状信息
|
|
64
65
|
*/
|
|
65
|
-
shapes:
|
|
66
|
+
shapes: ShapeGeometry[];
|
|
66
67
|
/**
|
|
67
68
|
* 插件类型信息
|
|
68
69
|
* 'model@1.0'
|
|
@@ -107,6 +108,7 @@ export interface JSONScene {
|
|
|
107
108
|
* JSON 版本
|
|
108
109
|
*
|
|
109
110
|
* 3.0 EC 改造、移除滤镜元素
|
|
111
|
+
* 3.1 音视频
|
|
110
112
|
*/
|
|
111
113
|
version: string;
|
|
112
114
|
/**
|
|
@@ -131,7 +133,7 @@ export interface JSONScene {
|
|
|
131
133
|
/**
|
|
132
134
|
* 贴图信息
|
|
133
135
|
*/
|
|
134
|
-
images:
|
|
136
|
+
images: ImageSource[];
|
|
135
137
|
/**
|
|
136
138
|
* 根据合成 ID,每个合成用到的 image 的数组索引
|
|
137
139
|
*/
|
|
@@ -143,7 +145,7 @@ export interface JSONScene {
|
|
|
143
145
|
/**
|
|
144
146
|
* 蒙版形状信息
|
|
145
147
|
*/
|
|
146
|
-
shapes:
|
|
148
|
+
shapes: ShapeGeometry[];
|
|
147
149
|
/**
|
|
148
150
|
* 插件类型信息
|
|
149
151
|
* 'model@1.0'
|
|
@@ -154,6 +156,16 @@ export interface JSONScene {
|
|
|
154
156
|
* 数据模板下掉可以不要 FontBase[]
|
|
155
157
|
*/
|
|
156
158
|
fonts?: FontBase[] | FontDefine[];
|
|
159
|
+
/**
|
|
160
|
+
* 视频资源
|
|
161
|
+
* @since 2.0.0
|
|
162
|
+
*/
|
|
163
|
+
videos?: AssetBase[];
|
|
164
|
+
/**
|
|
165
|
+
* 音频资源
|
|
166
|
+
* @since 2.0.0
|
|
167
|
+
*/
|
|
168
|
+
audios?: AssetBase[];
|
|
157
169
|
/**
|
|
158
170
|
* 二进制文件地址
|
|
159
171
|
*/
|
package/es/texture.d.ts
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { BinaryPointer } from './binary';
|
|
2
|
+
import type { DataType } from './components';
|
|
3
|
+
export interface TextureFormatOptions {
|
|
4
|
+
format?: GLenum;
|
|
5
|
+
internalFormat?: GLenum;
|
|
6
|
+
type?: GLenum;
|
|
7
|
+
}
|
|
8
|
+
export interface TextureConfigOptionsBase {
|
|
9
|
+
generateMipmap?: boolean;
|
|
10
|
+
id?: string;
|
|
11
|
+
dataType?: DataType.Texture;
|
|
12
|
+
name?: string;
|
|
13
|
+
wrapS?: GLenum;
|
|
14
|
+
wrapT?: GLenum;
|
|
15
|
+
magFilter?: GLenum;
|
|
16
|
+
minFilter?: GLenum;
|
|
17
|
+
anisotropic?: number;
|
|
18
|
+
flipY?: boolean;
|
|
19
|
+
premultiplyAlpha?: boolean;
|
|
20
|
+
keepImageSource?: boolean;
|
|
21
|
+
}
|
|
22
|
+
export type SerializedTextureCubeMipmap = [
|
|
23
|
+
TEXTURE_CUBE_MAP_POSITIVE_X: BinaryPointer,
|
|
24
|
+
TEXTURE_CUBE_MAP_NEGATIVE_X: BinaryPointer,
|
|
25
|
+
TEXTURE_CUBE_MAP_POSITIVE_Y: BinaryPointer,
|
|
26
|
+
TEXTURE_CUBE_MAP_NEGATIVE_Y: BinaryPointer,
|
|
27
|
+
TEXTURE_CUBE_MAP_POSITIVE_Z: BinaryPointer,
|
|
28
|
+
TEXTURE_CUBE_MAP_NEGATIVE_Z: BinaryPointer
|
|
29
|
+
];
|
|
30
|
+
export interface SerializedTexture2DImageSource extends TextureConfigOptionsBase, TextureFormatOptions {
|
|
31
|
+
target?: WebGLRenderingContext['TEXTURE_2D'];
|
|
32
|
+
source: number;
|
|
33
|
+
}
|
|
34
|
+
export interface SerializedTexture2DMipmapSource extends TextureConfigOptionsBase, TextureFormatOptions {
|
|
35
|
+
target?: WebGLRenderingContext['TEXTURE_2D'];
|
|
36
|
+
mipmaps: BinaryPointer[];
|
|
37
|
+
}
|
|
38
|
+
export interface SerializedTextureCube extends TextureConfigOptionsBase, TextureFormatOptions {
|
|
39
|
+
target: WebGLRenderingContext['TEXTURE_CUBE_MAP'];
|
|
40
|
+
mipmaps: SerializedTextureCubeMipmap[];
|
|
41
|
+
}
|
|
42
|
+
export type SerializedTexture2D = SerializedTexture2DImageSource | SerializedTexture2DMipmapSource;
|
|
43
|
+
export type SerializedTextureSource = SerializedTexture2D | SerializedTextureCube;
|
|
44
|
+
export type TextureJSONOptions = SerializedTextureSource;
|
|
45
|
+
export type TextureDefine = TextureJSONOptions;
|
package/es/texture.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/es/type.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { DataPath } from './components';
|
|
1
2
|
import type { FixedVec3Expression, vec2, vec3, GradientColor, ShapePoints, ShapeSplits, FixedNumberExpression } from './number-expression';
|
|
2
3
|
/**
|
|
3
4
|
* 播放器版本
|
|
@@ -31,19 +32,6 @@ export interface GLTF {
|
|
|
31
32
|
*/
|
|
32
33
|
reuse: boolean;
|
|
33
34
|
}
|
|
34
|
-
/**
|
|
35
|
-
* 形状属性
|
|
36
|
-
*/
|
|
37
|
-
export interface Shape {
|
|
38
|
-
/**
|
|
39
|
-
* 形状 ID
|
|
40
|
-
*/
|
|
41
|
-
id: number;
|
|
42
|
-
/**
|
|
43
|
-
* 形状数据
|
|
44
|
-
*/
|
|
45
|
-
shape: number[];
|
|
46
|
-
}
|
|
47
35
|
/**
|
|
48
36
|
* 插件参数
|
|
49
37
|
*/
|
|
@@ -457,7 +445,7 @@ export interface RendererOptions {
|
|
|
457
445
|
/**
|
|
458
446
|
* 贴图,索引到 scene 中的 images 数组
|
|
459
447
|
*/
|
|
460
|
-
texture?:
|
|
448
|
+
texture?: DataPath;
|
|
461
449
|
/**
|
|
462
450
|
* 蒙版模式
|
|
463
451
|
* @default none
|
|
@@ -543,7 +531,15 @@ export declare enum ItemType {
|
|
|
543
531
|
/**
|
|
544
532
|
* 节点元素
|
|
545
533
|
*/
|
|
546
|
-
node = "node"
|
|
534
|
+
node = "node",
|
|
535
|
+
/**
|
|
536
|
+
* 视频元素
|
|
537
|
+
*/
|
|
538
|
+
video = "video",
|
|
539
|
+
/**
|
|
540
|
+
* 音频元素
|
|
541
|
+
*/
|
|
542
|
+
audio = "audio"
|
|
547
543
|
}
|
|
548
544
|
/**
|
|
549
545
|
* 渲染模式
|
|
@@ -670,3 +666,4 @@ export declare enum RenderFace {
|
|
|
670
666
|
Back = "Back",
|
|
671
667
|
Front = "Front"
|
|
672
668
|
}
|
|
669
|
+
export type HTMLImageLike = HTMLImageElement | HTMLCanvasElement | HTMLVideoElement;
|
package/es/type.js
CHANGED
|
@@ -264,6 +264,14 @@ export var ItemType;
|
|
|
264
264
|
* 节点元素
|
|
265
265
|
*/
|
|
266
266
|
ItemType["node"] = "node";
|
|
267
|
+
/**
|
|
268
|
+
* 视频元素
|
|
269
|
+
*/
|
|
270
|
+
ItemType["video"] = "video";
|
|
271
|
+
/**
|
|
272
|
+
* 音频元素
|
|
273
|
+
*/
|
|
274
|
+
ItemType["audio"] = "audio";
|
|
267
275
|
})(ItemType || (ItemType = {}));
|
|
268
276
|
/**
|
|
269
277
|
* 渲染模式
|
package/package.json
CHANGED
package/es/image.d.ts
DELETED
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
import type { RenderLevel } from './type';
|
|
2
|
-
import type { BinaryPointer } from './binary';
|
|
3
|
-
import type { DataType } from './components';
|
|
4
|
-
export interface TextureFormatOptions {
|
|
5
|
-
format?: GLenum;
|
|
6
|
-
internalFormat?: GLenum;
|
|
7
|
-
type?: GLenum;
|
|
8
|
-
}
|
|
9
|
-
export interface TextureConfigOptionsBase {
|
|
10
|
-
generateMipmap?: boolean;
|
|
11
|
-
id?: string;
|
|
12
|
-
dataType?: DataType.Texture;
|
|
13
|
-
name?: string;
|
|
14
|
-
wrapS?: GLenum;
|
|
15
|
-
wrapT?: GLenum;
|
|
16
|
-
magFilter?: GLenum;
|
|
17
|
-
minFilter?: GLenum;
|
|
18
|
-
anisotropic?: number;
|
|
19
|
-
flipY?: boolean;
|
|
20
|
-
premultiplyAlpha?: boolean;
|
|
21
|
-
keepImageSource?: boolean;
|
|
22
|
-
}
|
|
23
|
-
export type SerializedTextureCubeMipmap = [
|
|
24
|
-
TEXTURE_CUBE_MAP_POSITIVE_X: BinaryPointer,
|
|
25
|
-
TEXTURE_CUBE_MAP_NEGATIVE_X: BinaryPointer,
|
|
26
|
-
TEXTURE_CUBE_MAP_POSITIVE_Y: BinaryPointer,
|
|
27
|
-
TEXTURE_CUBE_MAP_NEGATIVE_Y: BinaryPointer,
|
|
28
|
-
TEXTURE_CUBE_MAP_POSITIVE_Z: BinaryPointer,
|
|
29
|
-
TEXTURE_CUBE_MAP_NEGATIVE_Z: BinaryPointer
|
|
30
|
-
];
|
|
31
|
-
export interface SerializedTexture2DImageSource extends TextureConfigOptionsBase, TextureFormatOptions {
|
|
32
|
-
target?: WebGLRenderingContext['TEXTURE_2D'];
|
|
33
|
-
source: number;
|
|
34
|
-
}
|
|
35
|
-
export interface SerializedTexture2DMipmapSource extends TextureConfigOptionsBase, TextureFormatOptions {
|
|
36
|
-
target?: WebGLRenderingContext['TEXTURE_2D'];
|
|
37
|
-
mipmaps: BinaryPointer[];
|
|
38
|
-
}
|
|
39
|
-
export interface SerializedTextureCube extends TextureConfigOptionsBase, TextureFormatOptions {
|
|
40
|
-
target: WebGLRenderingContext['TEXTURE_CUBE_MAP'];
|
|
41
|
-
mipmaps: SerializedTextureCubeMipmap[];
|
|
42
|
-
}
|
|
43
|
-
export type SerializedTexture2D = SerializedTexture2DImageSource | SerializedTexture2DMipmapSource;
|
|
44
|
-
export type SerializedTextureSource = SerializedTexture2D | SerializedTextureCube;
|
|
45
|
-
export type TextureJSONOptions = SerializedTextureSource;
|
|
46
|
-
export type TextureDefine = TextureJSONOptions;
|
|
47
|
-
/**
|
|
48
|
-
* 动态换图类型
|
|
49
|
-
* @since 1.1.0
|
|
50
|
-
*/
|
|
51
|
-
export declare enum BackgroundType {
|
|
52
|
-
video = "video",
|
|
53
|
-
image = "image"
|
|
54
|
-
}
|
|
55
|
-
export interface TemplateContent {
|
|
56
|
-
/**
|
|
57
|
-
* 当 template 宽高和 image 不相同时,会对 template 进行缩放,使其和 image 相同。
|
|
58
|
-
*/
|
|
59
|
-
width: number;
|
|
60
|
-
height: number;
|
|
61
|
-
background?: {
|
|
62
|
-
type: BackgroundType;
|
|
63
|
-
name: string;
|
|
64
|
-
url: string | HTMLImageElement;
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
export type TemplateVariables = Record<string, string | string[] | HTMLImageElement | HTMLImageElement[]>;
|
|
68
|
-
/**
|
|
69
|
-
* 纹理贴图属性
|
|
70
|
-
*/
|
|
71
|
-
export interface Image {
|
|
72
|
-
id: string;
|
|
73
|
-
/**
|
|
74
|
-
* 纹理贴图地址
|
|
75
|
-
*/
|
|
76
|
-
url: string;
|
|
77
|
-
/**
|
|
78
|
-
* WebP 地址
|
|
79
|
-
* 如果运行时支持 WebP,则优先使用 WebP
|
|
80
|
-
*/
|
|
81
|
-
webp?: string;
|
|
82
|
-
/**
|
|
83
|
-
* AVIF 地址
|
|
84
|
-
* 如果运行时支持 AVIF,则优先使用 AVIF
|
|
85
|
-
* @since 2.0.0
|
|
86
|
-
*/
|
|
87
|
-
avif?: string;
|
|
88
|
-
/**
|
|
89
|
-
* 纹理贴图渲染等级
|
|
90
|
-
* 如果没有设置,按照 B+ 处理
|
|
91
|
-
*/
|
|
92
|
-
renderLevel?: RenderLevel;
|
|
93
|
-
/**
|
|
94
|
-
* 是否使用 mipmap
|
|
95
|
-
* loader 发布压缩纹理的时候会根据此参数决定是否生成压缩纹理
|
|
96
|
-
* @default false
|
|
97
|
-
*/
|
|
98
|
-
mipmap?: boolean;
|
|
99
|
-
/**
|
|
100
|
-
* 图片 Y 轴的方向,如果 Y 轴向上(与 OpenGL 相同)则为 1
|
|
101
|
-
* 如果 Y 轴向下(与 OpenGL 相反)则为 -1,图片再绘制数据模板的时候需要翻转绘制
|
|
102
|
-
* @default 1
|
|
103
|
-
*/
|
|
104
|
-
oriY?: 1 | -1;
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* 模板贴图属性
|
|
108
|
-
*/
|
|
109
|
-
export interface TemplateImage extends Image {
|
|
110
|
-
template: TemplateContent;
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* 压缩贴图属性
|
|
114
|
-
*/
|
|
115
|
-
export interface CompressedImage extends Image {
|
|
116
|
-
/**
|
|
117
|
-
* 压缩贴图地址
|
|
118
|
-
*/
|
|
119
|
-
compressed: {
|
|
120
|
-
astc?: string;
|
|
121
|
-
pvrtc?: string;
|
|
122
|
-
};
|
|
123
|
-
}
|