@galacean/effects-core 2.0.0-alpha.7 → 2.0.0-alpha.9
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/asset-loader.d.ts +11 -88
- package/dist/asset-manager.d.ts +1 -80
- package/dist/canvas-pool.d.ts +10 -0
- package/dist/composition.d.ts +7 -2
- package/dist/constants.d.ts +0 -1
- package/dist/downloader.d.ts +4 -0
- package/dist/effects-object.d.ts +2 -2
- package/dist/engine.d.ts +4 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.js +12477 -13766
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10970 -12242
- package/dist/index.mjs.map +1 -1
- package/dist/material/material.d.ts +16 -3
- package/dist/material/types.d.ts +0 -5
- package/dist/material/utils.d.ts +1 -1
- package/dist/plugin-system.d.ts +1 -2
- package/dist/plugins/camera/camera-controller-node.d.ts +1 -1
- package/dist/plugins/particle/particle-mesh.d.ts +0 -1
- package/dist/plugins/plugin.d.ts +1 -2
- package/dist/plugins/sprite/sprite-item.d.ts +13 -3
- package/dist/plugins/text/text-item.d.ts +1 -0
- package/dist/render/create-copy-shader.d.ts +1 -1
- package/dist/render/index.d.ts +1 -0
- package/dist/render/render-frame.d.ts +2 -2
- package/dist/render/render-pass.d.ts +2 -2
- package/dist/{semantic-map.d.ts → render/semantic-map.d.ts} +4 -4
- package/dist/render/shader.d.ts +3 -3
- package/dist/scene.d.ts +79 -3
- package/dist/shader/index.d.ts +0 -10
- package/dist/template-image.d.ts +10 -0
- package/dist/texture/texture.d.ts +6 -0
- package/dist/vfx-item.d.ts +1 -2
- package/package.json +2 -2
- package/dist/template-image/index.d.ts +0 -68
- package/dist/template-image/qcanvas-viewer.d.ts +0 -21
- package/dist/template-image/qtext.d.ts +0 -96
- package/dist/template-image/template-v1.d.ts +0 -27
- package/dist/template-image/text-metrics.d.ts +0 -18
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Matrix3, Matrix4, Quaternion, Vector2, Vector3, Vector4 } from '@galacean/effects-math/es/core/index';
|
|
2
|
-
import type { GlobalUniforms, Renderer, ShaderWithSource } from '../render';
|
|
1
|
+
import type { Matrix3, Matrix4, Quaternion, Vector2, Vector3, Vector4, Color } from '@galacean/effects-math/es/core/index';
|
|
2
|
+
import type { GlobalUniforms, Renderer, Shader, ShaderWithSource } from '../render';
|
|
3
3
|
import type { Texture } from '../texture';
|
|
4
4
|
import type { DestroyOptions, Disposable } from '../utils';
|
|
5
5
|
import type { UniformSemantic, UniformValue } from './types';
|
|
@@ -55,7 +55,9 @@ export interface MaterialProps {
|
|
|
55
55
|
* Material 抽象类
|
|
56
56
|
*/
|
|
57
57
|
export declare abstract class Material extends EffectsObject implements Disposable {
|
|
58
|
+
shader: Shader;
|
|
58
59
|
shaderSource: ShaderWithSource;
|
|
60
|
+
stringTags: Record<string, string>;
|
|
59
61
|
readonly uniformSemantics: Record<string, UniformSemantic>;
|
|
60
62
|
readonly renderType: MaterialRenderType;
|
|
61
63
|
readonly name: string;
|
|
@@ -247,6 +249,17 @@ export declare abstract class Material extends EffectsObject implements Disposab
|
|
|
247
249
|
* @param value - 要设置的 uniform 数据
|
|
248
250
|
*/
|
|
249
251
|
abstract setVector4(name: string, value: Vector4): void;
|
|
252
|
+
/**
|
|
253
|
+
* 获取 Material 的 Color 类型的 uniform 数据
|
|
254
|
+
* @param name
|
|
255
|
+
*/
|
|
256
|
+
abstract getColor(name: string): Color | null;
|
|
257
|
+
/**
|
|
258
|
+
* 设置 Color 类型的 uniform 的数据
|
|
259
|
+
* @param name - uniform 名称
|
|
260
|
+
* @param value - 要设置的 uniform 数据
|
|
261
|
+
*/
|
|
262
|
+
abstract setColor(name: string, value: Color): void;
|
|
250
263
|
/**
|
|
251
264
|
* 获取 Material 的 Quaternion 类型的 uniform 数据
|
|
252
265
|
* @param name
|
|
@@ -320,7 +333,7 @@ export declare abstract class Material extends EffectsObject implements Disposab
|
|
|
320
333
|
*/
|
|
321
334
|
abstract hasUniform(name: string): boolean;
|
|
322
335
|
/******** 预留接口,暂时不用实现 ***********************/
|
|
323
|
-
abstract enableMacro(keyword: string): void;
|
|
336
|
+
abstract enableMacro(keyword: string, value?: boolean | number): void;
|
|
324
337
|
abstract disableMacro(keyword: string): void;
|
|
325
338
|
abstract isMacroEnabled(keyword: string): boolean;
|
|
326
339
|
/***************************************************/
|
package/dist/material/types.d.ts
CHANGED
|
@@ -33,11 +33,6 @@ export interface MaterialStates extends MaterialBlendingStates, MaterialStencilS
|
|
|
33
33
|
polygonOffset?: [factor: number, units: number];
|
|
34
34
|
polygonOffsetFill?: boolean;
|
|
35
35
|
}
|
|
36
|
-
export interface FilterMaterialStates extends MaterialStates {
|
|
37
|
-
blendMode?: spec.BlendingMode;
|
|
38
|
-
side?: spec.SideMode;
|
|
39
|
-
maskMode?: spec.MaskMode;
|
|
40
|
-
}
|
|
41
36
|
export interface MaterialDataBlockDestroyOptions {
|
|
42
37
|
textures?: DestroyOptions;
|
|
43
38
|
}
|
package/dist/material/utils.d.ts
CHANGED
|
@@ -14,4 +14,4 @@ export declare function getPreMultiAlpha(blending?: number): number;
|
|
|
14
14
|
export declare function createShaderWithMarcos(marcos: ShaderMarcos, shader: string, shaderType: ShaderType, level: number): string;
|
|
15
15
|
export declare function setBlendMode(material: Material, blendMode?: number): void;
|
|
16
16
|
export declare function setSideMode(material: Material, side: spec.SideMode): void;
|
|
17
|
-
export declare function setMaskMode(material: Material, maskMode:
|
|
17
|
+
export declare function setMaskMode(material: Material, maskMode: spec.MaskMode): void;
|
package/dist/plugin-system.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import type * as spec from '@galacean/effects-specification';
|
|
2
|
-
import type { SceneLoadOptions } from './asset-manager';
|
|
3
2
|
import type { Composition } from './composition';
|
|
4
3
|
import type { Plugin, PluginConstructor } from './plugins';
|
|
5
4
|
import type { RenderFrame, Renderer } from './render';
|
|
6
|
-
import type { Scene } from './scene';
|
|
5
|
+
import type { Scene, SceneLoadOptions } from './scene';
|
|
7
6
|
import type { VFXItemConstructor, VFXItemProps } from './vfx-item';
|
|
8
7
|
import { VFXItem } from './vfx-item';
|
|
9
8
|
export declare const pluginLoaderMap: Record<string, PluginConstructor>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Euler, Vector3 } from '@galacean/effects-math/es/core/index';
|
|
2
|
-
import
|
|
2
|
+
import * as spec from '@galacean/effects-specification';
|
|
3
3
|
import { ItemBehaviour } from '../../components';
|
|
4
4
|
import type { Engine } from '../../engine';
|
|
5
5
|
export declare class CameraController extends ItemBehaviour {
|
package/dist/plugins/plugin.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type * as spec from '@galacean/effects-specification';
|
|
2
|
-
import type { SceneLoadOptions } from '../
|
|
3
|
-
import type { Scene } from '../scene';
|
|
2
|
+
import type { Scene, SceneLoadOptions } from '../scene';
|
|
4
3
|
import type { VFXItem } from '../vfx-item';
|
|
5
4
|
import type { RenderFrame, Renderer } from '../render';
|
|
6
5
|
import type { Composition } from '../composition';
|
|
@@ -23,9 +23,6 @@ export interface SpriteItemProps extends Omit<spec.SpriteContent, 'renderer'> {
|
|
|
23
23
|
shape: GeometryFromShape;
|
|
24
24
|
texture: Texture;
|
|
25
25
|
} & Omit<spec.RendererOptions, 'texture'>;
|
|
26
|
-
filter?: {
|
|
27
|
-
feather: number | spec.FunctionExpression;
|
|
28
|
-
} & Omit<spec.FilterParams, 'feather'>;
|
|
29
26
|
}
|
|
30
27
|
/**
|
|
31
28
|
* 图层元素基础属性, 经过处理后的 spec.SpriteContent.options
|
|
@@ -112,6 +109,19 @@ export declare class SpriteComponent extends RendererComponent {
|
|
|
112
109
|
* 获取当前 Mesh 的可见性。
|
|
113
110
|
*/
|
|
114
111
|
getVisible(): boolean;
|
|
112
|
+
/**
|
|
113
|
+
* 设置当前图层的颜色
|
|
114
|
+
* > Tips: 透明度也属于颜色的一部分,当有透明度/颜色 K 帧变化时,该 API 会失效
|
|
115
|
+
* @since 2.0.0
|
|
116
|
+
* @param color - 颜色值
|
|
117
|
+
*/
|
|
118
|
+
setColor(color: vec4): void;
|
|
119
|
+
/**
|
|
120
|
+
* 设置当前 Mesh 的纹理
|
|
121
|
+
* @since 2.0.0
|
|
122
|
+
* @param texture - 纹理对象
|
|
123
|
+
*/
|
|
124
|
+
setTexture(texture: Texture): void;
|
|
115
125
|
render(renderer: Renderer): void;
|
|
116
126
|
start(): void;
|
|
117
127
|
update(dt: number): void;
|
|
@@ -4,6 +4,7 @@ import type { SpriteItemProps } from '../sprite/sprite-item';
|
|
|
4
4
|
import { SpriteComponent } from '../sprite/sprite-item';
|
|
5
5
|
import { TextLayout } from './text-layout';
|
|
6
6
|
import { TextStyle } from './text-style';
|
|
7
|
+
export declare const DEFAULT_FONTS: string[];
|
|
7
8
|
/**
|
|
8
9
|
* @since 2.0.0
|
|
9
10
|
* @internal
|
|
@@ -2,5 +2,5 @@ import type { SharedShaderWithSource } from './shader';
|
|
|
2
2
|
export declare const EFFECTS_COPY_MESH_NAME = "effects-internal-copy";
|
|
3
3
|
export declare const COPY_MESH_SHADER_ID = "effects-internal-copy-mesh";
|
|
4
4
|
export declare const COPY_VERTEX_SHADER = "\n#ifdef WEBGL2\n#define vsIn in\n#define vsOut out\n#else\n#define vsIn attribute\n#define vsOut varying\n#endif\nprecision highp float;\nvsIn vec2 aPos;\nvsOut vec2 vTex;\nvoid main(){\n gl_Position = vec4(aPos,0.,1.0);\n vTex = (aPos + vec2(1.0))/2.;\n}";
|
|
5
|
-
export declare const COPY_FRAGMENT_SHADER:
|
|
5
|
+
export declare const COPY_FRAGMENT_SHADER = "precision mediump float;\n#ifdef WEBGL2\n#define fsIn in\n#define fsOut out\n#define texture2D texture\n#else\n#define fsIn varying\n#endif\nfsIn vec2 vTex;\n#ifdef WEBGL2\nlayout (location = 0) out vec4 fragColor;\n#else\n#define fragColor gl_FragColor\n#endif\n\n#ifdef DEPTH_TEXTURE\nuniform sampler2D uDepth;\n#ifndef WEBGL2\n#extension GL_EXT_frag_depth : enable\n#define gl_FragDepth gl_FragDepthEXT\n#endif\n#endif\nvoid main(){\n #ifdef DEPTH_TEXTURE\n gl_FragDepth = texture2D(uDepth,vTex).r;\n #endif\n}\n";
|
|
6
6
|
export declare function createCopyShader(level: number, writeDepth?: boolean): SharedShaderWithSource;
|
package/dist/render/index.d.ts
CHANGED
|
@@ -4,8 +4,8 @@ import { Vector2, Vector4 } from '@galacean/effects-math/es/core/index';
|
|
|
4
4
|
import type { Camera } from '../camera';
|
|
5
5
|
import type { UniformValue } from '../material';
|
|
6
6
|
import { PassTextureCache } from '../paas-texture-cache';
|
|
7
|
-
import type { SemanticFunc } from '
|
|
8
|
-
import { SemanticMap } from '
|
|
7
|
+
import type { SemanticFunc } from './semantic-map';
|
|
8
|
+
import { SemanticMap } from './semantic-map';
|
|
9
9
|
import { Texture } from '../texture';
|
|
10
10
|
import type { Disposable } from '../utils';
|
|
11
11
|
import { DestroyOptions } from '../utils';
|
|
@@ -5,8 +5,8 @@ import type { RendererComponent } from '../components';
|
|
|
5
5
|
import type { Engine } from '../engine';
|
|
6
6
|
import type { MeshDestroyOptions, Renderer } from '../render';
|
|
7
7
|
import { FrameBuffer } from '../render';
|
|
8
|
-
import type { SemanticGetter } from '
|
|
9
|
-
import { SemanticMap } from '
|
|
8
|
+
import type { SemanticGetter } from './semantic-map';
|
|
9
|
+
import { SemanticMap } from './semantic-map';
|
|
10
10
|
import type { TextureConfigOptions, TextureLoadAction } from '../texture';
|
|
11
11
|
import { Texture } from '../texture';
|
|
12
12
|
import type { Disposable, Sortable } from '../utils';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { UniformValue } from '
|
|
2
|
-
import type { RenderingData } from '
|
|
3
|
-
import type { Disposable } from '
|
|
1
|
+
import type { UniformValue } from '../material';
|
|
2
|
+
import type { RenderingData } from '.';
|
|
3
|
+
import type { Disposable } from '../utils';
|
|
4
4
|
export type SemanticFunc = (state: RenderingData) => UniformValue | undefined;
|
|
5
5
|
export type SemanticGetter = UniformValue | SemanticFunc;
|
|
6
6
|
export declare class SemanticMap implements Disposable {
|
|
@@ -8,7 +8,7 @@ export declare class SemanticMap implements Disposable {
|
|
|
8
8
|
constructor(semantics?: Record<string, SemanticGetter>);
|
|
9
9
|
toObject(): Record<string, SemanticGetter>;
|
|
10
10
|
setSemantic(name: string, value?: SemanticGetter): void;
|
|
11
|
-
getSemanticValue(name: string, state: RenderingData): number | Float32Array | Int32Array | Float64Array | Uint8Array | Uint32Array | Uint16Array | Int8Array | Int16Array | number[] | number[][] | import("@galacean/effects-
|
|
11
|
+
getSemanticValue(name: string, state: RenderingData): number | Float32Array | Int32Array | Float64Array | Uint8Array | Uint32Array | Uint16Array | Int8Array | Int16Array | number[] | number[][] | import("@galacean/effects-core").Texture | import("@galacean/effects-math/es/core").Vector2 | import("@galacean/effects-math/es/core").Vector3 | import("@galacean/effects-math/es/core").Vector4 | import("@galacean/effects-math/es/core").Matrix3 | import("@galacean/effects-math/es/core").Matrix4 | import("@galacean/effects-core").Texture[] | import("packages/effects-core/src/material/types").UniformStruct | import("packages/effects-core/src/material/types").UniformStruct[] | SemanticFunc | undefined;
|
|
12
12
|
hasSemanticValue(name: string): boolean;
|
|
13
13
|
dispose(): void;
|
|
14
14
|
}
|
package/dist/render/shader.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import type * as spec from '@galacean/effects-specification';
|
|
2
2
|
import { EffectsObject } from '../effects-object';
|
|
3
3
|
import type { Engine } from '../engine';
|
|
4
4
|
export type ShaderMarcos = [key: string, value: string | number | boolean][];
|
|
@@ -85,9 +85,9 @@ export declare abstract class ShaderVariant extends EffectsObject {
|
|
|
85
85
|
constructor(engine: Engine, source: ShaderWithSource);
|
|
86
86
|
}
|
|
87
87
|
export declare class Shader extends EffectsObject {
|
|
88
|
-
shaderData: ShaderData;
|
|
88
|
+
shaderData: spec.ShaderData;
|
|
89
89
|
createVariant(macros?: Record<string, number | boolean>): ShaderVariant;
|
|
90
|
-
fromData(data: ShaderData): void;
|
|
90
|
+
fromData(data: spec.ShaderData): void;
|
|
91
91
|
}
|
|
92
92
|
export interface ShaderLibrary {
|
|
93
93
|
readonly shaderResults: {
|
package/dist/scene.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import type * as spec from '@galacean/effects-specification';
|
|
2
|
-
import type { SceneType } from './asset-manager';
|
|
3
2
|
import type { Texture } from './texture';
|
|
4
3
|
import type { PluginSystem } from './plugin-system';
|
|
5
4
|
export type ImageSource = spec.TemplateImage | spec.Image | spec.CompressedImage;
|
|
6
5
|
/**
|
|
7
|
-
*
|
|
6
|
+
* 场景类型
|
|
8
7
|
*/
|
|
9
8
|
export interface Scene {
|
|
10
9
|
readonly jsonScene: spec.JSONScene;
|
|
@@ -27,4 +26,81 @@ export interface Scene {
|
|
|
27
26
|
url: SceneType;
|
|
28
27
|
usedImages: Record<number, boolean>;
|
|
29
28
|
}
|
|
30
|
-
|
|
29
|
+
/**
|
|
30
|
+
* 场景加载参数
|
|
31
|
+
*/
|
|
32
|
+
export interface SceneLoadOptions {
|
|
33
|
+
/**
|
|
34
|
+
* 动态数据的参数
|
|
35
|
+
* key 是 JSON 中配置的字段名
|
|
36
|
+
* value 是要使用的值,图片使用 url 链接
|
|
37
|
+
* 图片链接可以使用数组传递,如果第一个加载失败,将尝试使用第二个地址
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ``` ts
|
|
41
|
+
* {
|
|
42
|
+
* variables: {
|
|
43
|
+
* bg: ['url','fallback_url'], // 如果两个图片都失败,将会触发加载失败
|
|
44
|
+
* fg: 'url' // 如果图片加载失败,将会触发加载失败,
|
|
45
|
+
* amount: 88.8,
|
|
46
|
+
* name: 'abc'
|
|
47
|
+
* }
|
|
48
|
+
* }
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
variables?: Record<string, number | string | string[]>;
|
|
52
|
+
/**
|
|
53
|
+
* 是否使用压缩纹理
|
|
54
|
+
*/
|
|
55
|
+
useCompressedTexture?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* 渲染分级。
|
|
58
|
+
* 分级之后,只会加载当前渲染等级的资源。
|
|
59
|
+
* 当渲染等级被设置为 B 后,player 的 fps 会降到 30 帧
|
|
60
|
+
* @default 's'
|
|
61
|
+
*/
|
|
62
|
+
renderLevel?: spec.RenderLevel;
|
|
63
|
+
/**
|
|
64
|
+
* 资源加载超时,时间单位秒
|
|
65
|
+
* @default 10s
|
|
66
|
+
*/
|
|
67
|
+
timeout?: number;
|
|
68
|
+
/***
|
|
69
|
+
* 用于给 plugin 的加载数据
|
|
70
|
+
* key/value 的内容由 plugin 自己实现
|
|
71
|
+
*/
|
|
72
|
+
pluginData?: Record<string, any>;
|
|
73
|
+
/**
|
|
74
|
+
* 场景加载时的环境(加载后把 env 结果写入 scene)
|
|
75
|
+
* @default '' - 编辑器中为 'editor'
|
|
76
|
+
*/
|
|
77
|
+
env?: string;
|
|
78
|
+
/**
|
|
79
|
+
* 加载后是否自动播放
|
|
80
|
+
* @default true
|
|
81
|
+
*/
|
|
82
|
+
autoplay?: boolean;
|
|
83
|
+
/**
|
|
84
|
+
* 合成播放完成后是否需要再使用,是的话生命周期结束后不会 `dispose`
|
|
85
|
+
* @default false
|
|
86
|
+
*/
|
|
87
|
+
reusable?: boolean;
|
|
88
|
+
/**
|
|
89
|
+
* 播放速度,当速度为负数时,合成倒播
|
|
90
|
+
*/
|
|
91
|
+
speed?: number;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* 接受用于加载的数据类型
|
|
95
|
+
*/
|
|
96
|
+
export type SceneURLType = {
|
|
97
|
+
url: string;
|
|
98
|
+
};
|
|
99
|
+
export type SceneType = string | Scene | SceneURLType | Record<string, any>;
|
|
100
|
+
export type SceneWithOptionsType = {
|
|
101
|
+
options: SceneLoadOptions;
|
|
102
|
+
};
|
|
103
|
+
export type SceneLoadType = SceneType | SceneWithOptionsType;
|
|
104
|
+
export declare function isSceneJSON(scene: any): scene is Scene;
|
|
105
|
+
export declare function isSceneURL(scene: any): scene is Scene;
|
|
106
|
+
export declare function isSceneWithOptions(scene: any): scene is SceneWithOptionsType;
|
package/dist/shader/index.d.ts
CHANGED
|
@@ -11,16 +11,6 @@ export { default as particleVert } from './particle.vert.glsl';
|
|
|
11
11
|
export { default as trailVert } from './trail.vert.glsl';
|
|
12
12
|
export { default as value } from './value.glsl';
|
|
13
13
|
export { default as valueDefine } from './value-define.glsl';
|
|
14
|
-
export { default as copyFrag } from './adjust/copy.frag.glsl';
|
|
15
|
-
export { default as alphaFrameFrag } from './adjust/alpha-frame.frag.glsl';
|
|
16
|
-
export { default as alphaMaskFrag } from './adjust/alpha-mask.frag.glsl';
|
|
17
|
-
export { default as cameraMoveFrag } from './adjust/camera-move.frag.glsl';
|
|
18
|
-
export { default as cameraMoveVert } from './adjust/camera-move.vert.glsl';
|
|
19
|
-
export { default as delayFrag } from './adjust/delay.frag.glsl';
|
|
20
|
-
export { default as distortionFrag } from './adjust/distortion.frag.glsl';
|
|
21
|
-
export { default as distortionVert } from './adjust/distortion.vert.glsl';
|
|
22
|
-
export { default as bloomMixVert } from './adjust/bloom-mix.frag.glsl';
|
|
23
|
-
export { default as bloomThresholdVert } from './adjust/bloom-threshold.frag.glsl';
|
|
24
14
|
export { default as screenMeshVert } from './post-processing/screen-mesh.vert.glsl';
|
|
25
15
|
export { default as colorGradingFrag } from './post-processing/color-grading.frag.glsl';
|
|
26
16
|
export { default as gaussianDownFrag } from './post-processing/gaussian-down.frag.glsl';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { TemplateContent } from '@galacean/effects-specification';
|
|
2
|
+
export declare function getBackgroundImage(template: TemplateContent, variables?: Record<string, number | string | string[]>): string | number | string[] | undefined;
|
|
3
|
+
/**
|
|
4
|
+
* @param url
|
|
5
|
+
* @param template
|
|
6
|
+
* @param variables
|
|
7
|
+
* @param options
|
|
8
|
+
* @returns
|
|
9
|
+
*/
|
|
10
|
+
export declare function combineImageTemplate(url: string | HTMLImageElement, template?: TemplateContent, variables?: Record<string, number | string>): Promise<HTMLImageElement>;
|
|
@@ -31,6 +31,12 @@ export declare abstract class Texture extends EffectsObject {
|
|
|
31
31
|
* 创建一个新的 Texture 对象。
|
|
32
32
|
*/
|
|
33
33
|
static create: (engine: Engine, options?: TextureSourceOptions) => Texture;
|
|
34
|
+
/**
|
|
35
|
+
* 通过 URL 创建 Texture 对象。
|
|
36
|
+
* @param url - 要创建的 Texture URL
|
|
37
|
+
* @since 2.0.0
|
|
38
|
+
*/
|
|
39
|
+
static fromImage(url: string, engine: Engine): Promise<Texture>;
|
|
34
40
|
/**
|
|
35
41
|
* 通过数据创建 Texture 对象。
|
|
36
42
|
* @param data - 要创建的 Texture 数据
|
package/dist/vfx-item.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Vector3 } from '@galacean/effects-math/es/core/vector3';
|
|
2
2
|
import * as spec from '@galacean/effects-specification';
|
|
3
|
-
import {
|
|
3
|
+
import type { VFXItemData } from './asset-loader';
|
|
4
4
|
import { RendererComponent } from './components';
|
|
5
5
|
import type { Component } from './components/component';
|
|
6
6
|
import { ItemBehaviour } from './components/component';
|
|
@@ -258,7 +258,6 @@ export declare class VFXItem<T extends VFXItemContent> extends EffectsObject imp
|
|
|
258
258
|
}
|
|
259
259
|
export declare namespace Item {
|
|
260
260
|
function is<T extends spec.Item>(item: spec.Item, type: spec.ItemType): item is T;
|
|
261
|
-
function isFilter(item: spec.Item): item is spec.FilterItem;
|
|
262
261
|
function isComposition(item: spec.Item): item is spec.CompositionItem;
|
|
263
262
|
function isParticle(item: spec.Item): item is spec.ParticleItem;
|
|
264
263
|
function isNull(item: spec.Item): item is spec.NullItem;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@galacean/effects-core",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.9",
|
|
4
4
|
"description": "Galacean Effects runtime core for the web",
|
|
5
5
|
"module": "./dist/index.mjs",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"registry": "https://registry.npmjs.org"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@galacean/effects-specification": "2.0.0-alpha.
|
|
45
|
+
"@galacean/effects-specification": "2.0.0-alpha.8",
|
|
46
46
|
"@galacean/effects-math": "1.1.0-alpha.0",
|
|
47
47
|
"uuid": "9.0.1"
|
|
48
48
|
},
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import type { TemplateContentV1, TemplateContentV2 } from '@galacean/effects-specification';
|
|
2
|
-
export * from './qcanvas-viewer';
|
|
3
|
-
export * from './qtext';
|
|
4
|
-
export * from './template-v1';
|
|
5
|
-
export declare const DEFAULT_FONTS: string[];
|
|
6
|
-
export interface TextLayout {
|
|
7
|
-
x: number;
|
|
8
|
-
y: number;
|
|
9
|
-
width: number;
|
|
10
|
-
height: number;
|
|
11
|
-
}
|
|
12
|
-
export interface TemplateOptions {
|
|
13
|
-
templateScale?: number;
|
|
14
|
-
canvas?: HTMLCanvasElement;
|
|
15
|
-
textLayouts?: TextLayout[];
|
|
16
|
-
debug?: boolean;
|
|
17
|
-
borderColor?: string;
|
|
18
|
-
borderWidth?: number;
|
|
19
|
-
flipY?: boolean;
|
|
20
|
-
scaleX?: number;
|
|
21
|
-
scaleY?: number;
|
|
22
|
-
toData?: boolean;
|
|
23
|
-
}
|
|
24
|
-
declare class CanvasPool {
|
|
25
|
-
readonly elements: HTMLCanvasElement[];
|
|
26
|
-
constructor();
|
|
27
|
-
dispose(): void;
|
|
28
|
-
getCanvas(): HTMLCanvasElement;
|
|
29
|
-
saveCanvas(cvs: HTMLCanvasElement): void;
|
|
30
|
-
}
|
|
31
|
-
export declare const canvasPool: CanvasPool;
|
|
32
|
-
export declare function getDefaultTemplateCanvasPool(): CanvasPool;
|
|
33
|
-
export declare function getBackgroundImage(template: TemplateContentV2, variables?: Record<string, number | string | string[]>): string | string[];
|
|
34
|
-
export declare function loadMedia(url: string | string[], loadFn: (url: string) => Promise<any>): Promise<any>;
|
|
35
|
-
/**
|
|
36
|
-
* @param {string|HTMLImageElement} url
|
|
37
|
-
* @param {TemplateContentV2} [template]
|
|
38
|
-
* @param {Record<string, number | string>} [variables]
|
|
39
|
-
* @param {TemplateOptions} [opts]
|
|
40
|
-
* @param {boolean} [flipY]
|
|
41
|
-
* @returns
|
|
42
|
-
*/
|
|
43
|
-
export declare function combineImageTemplate2(url: string | HTMLImageElement, template?: TemplateContentV2, variables?: Record<string, number | string>, opts?: TemplateOptions, flipY?: boolean): Promise<HTMLCanvasElement>;
|
|
44
|
-
/**
|
|
45
|
-
* @internal
|
|
46
|
-
* @deprecated since 2.0.0 - use `combineImageTemplate2` instead
|
|
47
|
-
*/
|
|
48
|
-
export declare function combineImageTemplate2Async(url: string | HTMLImageElement, template?: TemplateContentV2, variables?: Record<string, number | string>, opts?: TemplateOptions, flipY?: boolean): Promise<HTMLCanvasElement | ImageData>;
|
|
49
|
-
/**
|
|
50
|
-
* @param url
|
|
51
|
-
* @param template
|
|
52
|
-
* @param variables
|
|
53
|
-
* @param opts
|
|
54
|
-
* @param flipY
|
|
55
|
-
* @returns
|
|
56
|
-
*/
|
|
57
|
-
export declare function combineImageTemplate(url: string | HTMLImageElement, template: TemplateContentV1 | TemplateContentV2, variables: Record<string, number | string>, opts?: {
|
|
58
|
-
templateScale?: number;
|
|
59
|
-
canvas?: HTMLCanvasElement;
|
|
60
|
-
}, flipY?: boolean): Promise<HTMLCanvasElement>;
|
|
61
|
-
/**
|
|
62
|
-
* @internal
|
|
63
|
-
* @deprecated since 2.0.0 - use `combineImageTemplate` instead
|
|
64
|
-
*/
|
|
65
|
-
export declare function combineImageTemplateAsync(url: string | HTMLImageElement, template: TemplateContentV1 | TemplateContentV2, variables: Record<string, number | string>, opts?: {
|
|
66
|
-
templateScale?: number;
|
|
67
|
-
canvas?: HTMLCanvasElement;
|
|
68
|
-
}, flipY?: boolean): Promise<HTMLCanvasElement | HTMLImageElement | ImageData>;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { QText } from './qtext';
|
|
2
|
-
declare class QCanvasViewer {
|
|
3
|
-
width: number;
|
|
4
|
-
height: number;
|
|
5
|
-
background: HTMLImageElement;
|
|
6
|
-
scaleX: number;
|
|
7
|
-
scaleY: number;
|
|
8
|
-
renderCanvas: HTMLCanvasElement;
|
|
9
|
-
renderContext: CanvasRenderingContext2D;
|
|
10
|
-
textList: QText[];
|
|
11
|
-
devicePixelRatio: number;
|
|
12
|
-
flipY: boolean;
|
|
13
|
-
constructor(canvas: string | HTMLCanvasElement, width: number, height: number, scaleX?: number, scaleY?: number, flipY?: boolean);
|
|
14
|
-
initDimension(width: number, height: number, scaleX?: number, scaleY?: number): void;
|
|
15
|
-
clearText(): void;
|
|
16
|
-
clearCanvasWithContext(ctx: CanvasRenderingContext2D): void;
|
|
17
|
-
clearCanvas(): void;
|
|
18
|
-
addObject(text: QText): void;
|
|
19
|
-
render(): void;
|
|
20
|
-
}
|
|
21
|
-
export { QCanvasViewer };
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import type { QCanvasViewer } from './qcanvas-viewer';
|
|
2
|
-
import type { IFontMetrics } from './text-metrics';
|
|
3
|
-
declare enum QTextWrapMode {
|
|
4
|
-
Default = 0,
|
|
5
|
-
Clip = 1,
|
|
6
|
-
Ellipsis = 2
|
|
7
|
-
}
|
|
8
|
-
interface QTextOptions {
|
|
9
|
-
left?: number;
|
|
10
|
-
top?: number;
|
|
11
|
-
maxWidth?: number;
|
|
12
|
-
fontFamily?: string;
|
|
13
|
-
fontSize?: number;
|
|
14
|
-
fontWeight?: string;
|
|
15
|
-
align?: string;
|
|
16
|
-
verticalAlign?: string;
|
|
17
|
-
padding?: number;
|
|
18
|
-
letterSpacing?: number;
|
|
19
|
-
wrap?: QTextWrapMode;
|
|
20
|
-
color?: string;
|
|
21
|
-
fontStyle?: string;
|
|
22
|
-
angle?: number;
|
|
23
|
-
name?: string;
|
|
24
|
-
}
|
|
25
|
-
interface QChar {
|
|
26
|
-
left: number;
|
|
27
|
-
top: number;
|
|
28
|
-
char: string;
|
|
29
|
-
width: number;
|
|
30
|
-
heigh: number;
|
|
31
|
-
font: string;
|
|
32
|
-
fontSize: number;
|
|
33
|
-
isEllipsis: boolean;
|
|
34
|
-
scale: number;
|
|
35
|
-
index: number;
|
|
36
|
-
}
|
|
37
|
-
declare class QText {
|
|
38
|
-
left: number;
|
|
39
|
-
top: number;
|
|
40
|
-
width?: number;
|
|
41
|
-
height?: number;
|
|
42
|
-
text: string;
|
|
43
|
-
name: string;
|
|
44
|
-
fontSize: number;
|
|
45
|
-
fontFamily: string;
|
|
46
|
-
color: string;
|
|
47
|
-
letterSpacing: number;
|
|
48
|
-
maxLineWidth: number;
|
|
49
|
-
wrap: QTextWrapMode;
|
|
50
|
-
fontStyle: 'normal' | 'italic' | 'oblique' | 'initial' | 'inherit';
|
|
51
|
-
textAlign: 'center' | 'end' | 'left' | 'right' | 'start';
|
|
52
|
-
textBaseline: 'alphabetic' | 'bottom' | 'hanging' | 'ideographic' | 'middle' | 'top';
|
|
53
|
-
scaleX: number;
|
|
54
|
-
scaleY: number;
|
|
55
|
-
angle: number;
|
|
56
|
-
active: boolean;
|
|
57
|
-
padding: number;
|
|
58
|
-
fontWeight: string;
|
|
59
|
-
chars: QChar[];
|
|
60
|
-
borderColor: string;
|
|
61
|
-
borderWidth: number;
|
|
62
|
-
fontProperties: IFontMetrics;
|
|
63
|
-
fontVariant: string;
|
|
64
|
-
private viewer;
|
|
65
|
-
private originX;
|
|
66
|
-
private originY;
|
|
67
|
-
private ellipsis;
|
|
68
|
-
constructor(text: string, options: QTextOptions);
|
|
69
|
-
update(): void;
|
|
70
|
-
render(): void;
|
|
71
|
-
init(viewer: QCanvasViewer): void;
|
|
72
|
-
getLayout(): {
|
|
73
|
-
x: number;
|
|
74
|
-
y: number;
|
|
75
|
-
width: number;
|
|
76
|
-
height: number;
|
|
77
|
-
};
|
|
78
|
-
private updateDimension;
|
|
79
|
-
private configTextStyle;
|
|
80
|
-
private getFontDesc;
|
|
81
|
-
private configTextLayout;
|
|
82
|
-
private setRenderTransform;
|
|
83
|
-
private renderText;
|
|
84
|
-
private drawCharsInTextBox;
|
|
85
|
-
private addEllipsisToChars;
|
|
86
|
-
private createCharsFromText;
|
|
87
|
-
private addOffsetToChars;
|
|
88
|
-
private clipCharsWithTextBox;
|
|
89
|
-
private cloneChars;
|
|
90
|
-
private replaceCharWithEllipsis;
|
|
91
|
-
private findEllipsisPositionAndReplaceCharsFromLeft;
|
|
92
|
-
private findEllipsisPositionAndReplaceCharsFromRight;
|
|
93
|
-
private drawCharsFromLeft;
|
|
94
|
-
private drawBorders;
|
|
95
|
-
}
|
|
96
|
-
export { QText, QTextOptions, QTextWrapMode };
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { TemplateContentV1 } from '@galacean/effects-specification';
|
|
2
|
-
export declare function requestAsync(url: string, opt?: {
|
|
3
|
-
responseType?: XMLHttpRequestResponseType;
|
|
4
|
-
method?: string;
|
|
5
|
-
data?: Document | XMLHttpRequestBodyInit | null;
|
|
6
|
-
}): Promise<unknown>;
|
|
7
|
-
/**
|
|
8
|
-
*
|
|
9
|
-
* @param url
|
|
10
|
-
* @param template
|
|
11
|
-
* @param variables
|
|
12
|
-
* @param opts
|
|
13
|
-
* @param flipY
|
|
14
|
-
* @returns
|
|
15
|
-
*/
|
|
16
|
-
export declare function combineImageTemplate1(url: string | HTMLImageElement, template: TemplateContentV1, variables: Record<string, number | string | HTMLImageElement>, opts?: {
|
|
17
|
-
templateScale?: number;
|
|
18
|
-
canvas?: HTMLCanvasElement;
|
|
19
|
-
}, flipY?: boolean): Promise<HTMLCanvasElement>;
|
|
20
|
-
/**
|
|
21
|
-
* @internal
|
|
22
|
-
* @deprecated since 2.0.0 - use `combineImageTemplate1` instead
|
|
23
|
-
*/
|
|
24
|
-
export declare function combineImageTemplate1Async(url: string | HTMLImageElement, template: TemplateContentV1, variables: Record<string, number | string | HTMLImageElement>, opts?: {
|
|
25
|
-
templateScale?: number;
|
|
26
|
-
canvas?: HTMLCanvasElement;
|
|
27
|
-
}, flipY?: boolean): Promise<HTMLCanvasElement>;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export interface IFontMetrics {
|
|
2
|
-
ascent: number;
|
|
3
|
-
descent: number;
|
|
4
|
-
fontSize: number;
|
|
5
|
-
}
|
|
6
|
-
export declare class TextMetrics {
|
|
7
|
-
static _fonts: {
|
|
8
|
-
[font: string]: IFontMetrics;
|
|
9
|
-
};
|
|
10
|
-
static METRICS_STRING: string;
|
|
11
|
-
static BASELINE_SYMBOL: string;
|
|
12
|
-
static BASELINE_MULTIPLIER: number;
|
|
13
|
-
static HEIGHT_MULTIPLIER: number;
|
|
14
|
-
private static __canvas;
|
|
15
|
-
private static __context;
|
|
16
|
-
static measureFont(font: string): IFontMetrics;
|
|
17
|
-
static get _canvas(): HTMLCanvasElement;
|
|
18
|
-
}
|