@galacean/effects-core 1.1.2 → 1.1.4
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-manager.d.ts +130 -0
- package/dist/camera.d.ts +183 -0
- package/dist/comp-vfx-item.d.ts +71 -0
- package/dist/composition-source-manager.d.ts +45 -0
- package/dist/composition.d.ts +406 -0
- package/dist/config.d.ts +7 -0
- package/dist/constants.d.ts +11 -0
- package/dist/downloader.d.ts +83 -0
- package/dist/engine.d.ts +38 -0
- package/dist/filter.d.ts +63 -0
- package/dist/filters/alpha-frame.d.ts +5 -0
- package/dist/filters/alpha-mask.d.ts +5 -0
- package/dist/filters/bloom.d.ts +8 -0
- package/dist/filters/camera-move.d.ts +5 -0
- package/dist/filters/delay.d.ts +14 -0
- package/dist/filters/distortion.d.ts +5 -0
- package/dist/filters/gaussian.d.ts +27 -0
- package/dist/filters/index.d.ts +2 -0
- package/dist/filters/lum.d.ts +5 -0
- package/dist/filters/utils.d.ts +7 -0
- package/dist/gl/create-gl-context.d.ts +9 -0
- package/dist/gl/gpu-time.d.ts +5 -0
- package/dist/gl/index.d.ts +6 -0
- package/dist/index.d.ts +31 -0
- package/dist/index.js +110 -81
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +110 -81
- package/dist/index.mjs.map +1 -1
- package/dist/libs/earcut.d.ts +37 -0
- package/dist/material/index.d.ts +4 -0
- package/dist/material/material-data-block.d.ts +27 -0
- package/dist/material/material.d.ts +347 -0
- package/dist/material/types.d.ts +66 -0
- package/dist/material/utils.d.ts +17 -0
- package/dist/math/float16array-wrapper.d.ts +5 -0
- package/dist/math/index.d.ts +4 -0
- package/dist/math/translate.d.ts +10 -0
- package/dist/math/utils.d.ts +19 -0
- package/dist/math/value-getter.d.ts +127 -0
- package/dist/paas-texture-cache.d.ts +24 -0
- package/dist/pass-render-level.d.ts +1 -0
- package/dist/plugin-system.d.ts +34 -0
- package/dist/plugins/cal/calculate-item.d.ts +84 -0
- package/dist/plugins/cal/calculate-loader.d.ts +3 -0
- package/dist/plugins/cal/calculate-vfx-item.d.ts +26 -0
- package/dist/plugins/camera/camera-controller-node.d.ts +17 -0
- package/dist/plugins/camera/camera-vfx-item-loader.d.ts +3 -0
- package/dist/plugins/camera/camera-vfx-item.d.ts +13 -0
- package/dist/plugins/index.d.ts +26 -0
- package/dist/plugins/interact/click-handler.d.ts +66 -0
- package/dist/plugins/interact/event-system.d.ts +37 -0
- package/dist/plugins/interact/interact-item.d.ts +2 -0
- package/dist/plugins/interact/interact-loader.d.ts +13 -0
- package/dist/plugins/interact/interact-mesh.d.ts +16 -0
- package/dist/plugins/interact/interact-vfx-item.d.ts +28 -0
- package/dist/plugins/particle/burst.d.ts +21 -0
- package/dist/plugins/particle/link.d.ts +21 -0
- package/dist/plugins/particle/particle-loader.d.ts +18 -0
- package/dist/plugins/particle/particle-mesh.d.ts +164 -0
- package/dist/plugins/particle/particle-system.d.ts +197 -0
- package/dist/plugins/particle/particle-vfx-item.d.ts +27 -0
- package/dist/plugins/particle/trail-mesh.d.ts +61 -0
- package/dist/plugins/plugin.d.ts +125 -0
- package/dist/plugins/sprite/filter-sprite-vfx-item.d.ts +13 -0
- package/dist/plugins/sprite/sprite-group.d.ts +95 -0
- package/dist/plugins/sprite/sprite-item.d.ts +106 -0
- package/dist/plugins/sprite/sprite-loader.d.ts +20 -0
- package/dist/plugins/sprite/sprite-mesh.d.ts +67 -0
- package/dist/plugins/sprite/sprite-vfx-item.d.ts +33 -0
- package/dist/plugins/text/text-item.d.ts +117 -0
- package/dist/plugins/text/text-layout.d.ts +28 -0
- package/dist/plugins/text/text-loader.d.ts +18 -0
- package/dist/plugins/text/text-mesh.d.ts +15 -0
- package/dist/plugins/text/text-style.d.ts +67 -0
- package/dist/plugins/text/text-vfx-item.d.ts +28 -0
- package/dist/polyfill.d.ts +4 -0
- package/dist/render/create-copy-shader.d.ts +6 -0
- package/dist/render/frame-buffer.d.ts +48 -0
- package/dist/render/geometry.d.ts +118 -0
- package/dist/render/global-volume.d.ts +15 -0
- package/dist/render/gpu-capability.d.ts +49 -0
- package/dist/render/index.d.ts +12 -0
- package/dist/render/mesh.d.ts +82 -0
- package/dist/render/post-process-pass.d.ts +37 -0
- package/dist/render/render-buffer.d.ts +20 -0
- package/dist/render/render-frame.d.ts +269 -0
- package/dist/render/render-pass.d.ts +309 -0
- package/dist/render/renderer.d.ts +62 -0
- package/dist/render/shader.d.ts +97 -0
- package/dist/render/types.d.ts +5 -0
- package/dist/scene.d.ts +30 -0
- package/dist/semantic-map.d.ts +14 -0
- package/dist/shader/index.d.ts +30 -0
- package/dist/shape/2d-shape.d.ts +32 -0
- package/dist/shape/cone.d.ts +11 -0
- package/dist/shape/donut.d.ts +9 -0
- package/dist/shape/earcut.d.ts +1 -0
- package/dist/shape/geometry.d.ts +30 -0
- package/dist/shape/index.d.ts +3 -0
- package/dist/shape/shape.d.ts +21 -0
- package/dist/shape/sphere.d.ts +15 -0
- package/dist/shape/texture-shape.d.ts +11 -0
- package/dist/template-image/index.d.ts +67 -0
- package/dist/template-image/qcanvas-viewer.d.ts +21 -0
- package/dist/template-image/qtext.d.ts +96 -0
- package/dist/template-image/template-v1.d.ts +27 -0
- package/dist/template-image/text-metrics.d.ts +18 -0
- package/dist/texture/index.d.ts +5 -0
- package/dist/texture/ktx-texture.d.ts +21 -0
- package/dist/texture/texture-factory.d.ts +13 -0
- package/dist/texture/texture.d.ts +78 -0
- package/dist/texture/types.d.ts +165 -0
- package/dist/texture/utils.d.ts +5 -0
- package/dist/ticker.d.ts +48 -0
- package/dist/transform.d.ts +221 -0
- package/dist/utils/array.d.ts +19 -0
- package/dist/utils/asserts.d.ts +2 -0
- package/dist/utils/color.d.ts +10 -0
- package/dist/utils/device.d.ts +4 -0
- package/dist/utils/image-data.d.ts +10 -0
- package/dist/utils/index.d.ts +67 -0
- package/dist/utils/sortable.d.ts +23 -0
- package/dist/utils/timeline-component.d.ts +39 -0
- package/dist/vfx-item.d.ts +361 -0
- package/package.json +2 -2
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Shape, ShapeGeneratorOptions, ShapeParticle } from '.';
|
|
2
|
+
export declare class TextureShape implements Shape {
|
|
3
|
+
width: number;
|
|
4
|
+
height: number;
|
|
5
|
+
block: number[];
|
|
6
|
+
anchors: Float32Array;
|
|
7
|
+
arcMode: number;
|
|
8
|
+
random: number;
|
|
9
|
+
constructor(arg: any);
|
|
10
|
+
generate(opt: ShapeGeneratorOptions): ShapeParticle;
|
|
11
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
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 | number | string[] | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* @param {string|HTMLImageElement} url
|
|
36
|
+
* @param {TemplateContentV2} [template]
|
|
37
|
+
* @param {Record<string, number | string>} [variables]
|
|
38
|
+
* @param {TemplateOptions} [opts]
|
|
39
|
+
* @param {boolean} [flipY]
|
|
40
|
+
* @returns
|
|
41
|
+
*/
|
|
42
|
+
export declare function combineImageTemplate2(url: string | HTMLImageElement, template?: TemplateContentV2, variables?: Record<string, number | string>, opts?: TemplateOptions, flipY?: boolean): Promise<HTMLCanvasElement>;
|
|
43
|
+
/**
|
|
44
|
+
* @internal
|
|
45
|
+
* @deprecated since 2.0.0 - use `combineImageTemplate2` instead
|
|
46
|
+
*/
|
|
47
|
+
export declare function combineImageTemplate2Async(url: string | HTMLImageElement, template?: TemplateContentV2, variables?: Record<string, number | string>, opts?: TemplateOptions, flipY?: boolean): Promise<HTMLCanvasElement | ImageData>;
|
|
48
|
+
/**
|
|
49
|
+
* @param url
|
|
50
|
+
* @param template
|
|
51
|
+
* @param variables
|
|
52
|
+
* @param opts
|
|
53
|
+
* @param flipY
|
|
54
|
+
* @returns
|
|
55
|
+
*/
|
|
56
|
+
export declare function combineImageTemplate(url: string | HTMLImageElement, template: TemplateContentV1 | TemplateContentV2, variables: Record<string, number | string>, opts?: {
|
|
57
|
+
templateScale?: number;
|
|
58
|
+
canvas?: HTMLCanvasElement;
|
|
59
|
+
}, flipY?: boolean): Promise<HTMLCanvasElement>;
|
|
60
|
+
/**
|
|
61
|
+
* @internal
|
|
62
|
+
* @deprecated since 2.0.0 - use `combineImageTemplate` instead
|
|
63
|
+
*/
|
|
64
|
+
export declare function combineImageTemplateAsync(url: string | HTMLImageElement, template: TemplateContentV1 | TemplateContentV2, variables: Record<string, number | string>, opts?: {
|
|
65
|
+
templateScale?: number;
|
|
66
|
+
canvas?: HTMLCanvasElement;
|
|
67
|
+
}, flipY?: boolean): Promise<HTMLCanvasElement | HTMLImageElement | ImageData>;
|
|
@@ -0,0 +1,21 @@
|
|
|
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 };
|
|
@@ -0,0 +1,96 @@
|
|
|
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 };
|
|
@@ -0,0 +1,27 @@
|
|
|
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>;
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Texture2DSourceOptionsCompressed, TextureDataType } from './types';
|
|
2
|
+
export declare class KTXTexture {
|
|
3
|
+
private readonly arrayBuffer;
|
|
4
|
+
private readonly baseOffset;
|
|
5
|
+
glType: number;
|
|
6
|
+
glTypeSize: number;
|
|
7
|
+
glFormat: number;
|
|
8
|
+
glInternalFormat: number;
|
|
9
|
+
glBaseInternalFormat: number;
|
|
10
|
+
pixelWidth: number;
|
|
11
|
+
pixelHeight: number;
|
|
12
|
+
loadType: number;
|
|
13
|
+
pixelDepth: number;
|
|
14
|
+
numberOfArrayElements: number;
|
|
15
|
+
numberOfFaces: number;
|
|
16
|
+
numberOfMipmapLevels: number;
|
|
17
|
+
bytesOfKeyValueData: number;
|
|
18
|
+
constructor(arrayBuffer: ArrayBuffer, facesExpected: number, baseOffset?: number);
|
|
19
|
+
mipmaps(loadMipmaps: boolean): TextureDataType[];
|
|
20
|
+
}
|
|
21
|
+
export declare function getKTXTextureOptions(data: ArrayBuffer): Texture2DSourceOptionsCompressed;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { TextureConfigOptions, TextureFactorySourceFrom, TextureSourceOptions } from './types';
|
|
2
|
+
import type { Texture } from './texture';
|
|
3
|
+
export declare class TextureFactory {
|
|
4
|
+
reloadPending: Record<string, boolean>;
|
|
5
|
+
constructor();
|
|
6
|
+
reload(texture: Texture): Promise<void>;
|
|
7
|
+
canOffloadTexture(sourceFrom?: TextureFactorySourceFrom): boolean;
|
|
8
|
+
loadSource(sourceFrom: TextureFactorySourceFrom, config?: TextureConfigOptions): Promise<TextureSourceOptions>;
|
|
9
|
+
private loadMipmapImages;
|
|
10
|
+
private loadCubeMap;
|
|
11
|
+
}
|
|
12
|
+
export declare function getDefaultTextureFactory(): TextureFactory;
|
|
13
|
+
export declare function setDefaultTextureFactory(factory: TextureFactory): void;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { TextureSourceType } from './types';
|
|
2
|
+
import type { TextureFactorySourceFrom, TextureSourceOptions, TextureDataType } from './types';
|
|
3
|
+
import type { Engine } from '../engine';
|
|
4
|
+
/**
|
|
5
|
+
* Texture 抽象类
|
|
6
|
+
*/
|
|
7
|
+
export declare abstract class Texture {
|
|
8
|
+
/**
|
|
9
|
+
* Texture 名称
|
|
10
|
+
*/
|
|
11
|
+
name: string;
|
|
12
|
+
sourceFrom?: TextureFactorySourceFrom;
|
|
13
|
+
sourceType?: TextureSourceType;
|
|
14
|
+
source: TextureSourceOptions;
|
|
15
|
+
engine: Engine;
|
|
16
|
+
/**
|
|
17
|
+
* Texture 高度
|
|
18
|
+
*/
|
|
19
|
+
width: number;
|
|
20
|
+
/**
|
|
21
|
+
* Texture 宽度
|
|
22
|
+
*/
|
|
23
|
+
height: number;
|
|
24
|
+
/**
|
|
25
|
+
* Texture 的全局唯一 id
|
|
26
|
+
*/
|
|
27
|
+
readonly id: string;
|
|
28
|
+
protected destroyed: boolean;
|
|
29
|
+
protected offloaded: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* 创建一个新的 Texture 对象。
|
|
32
|
+
*/
|
|
33
|
+
static create: (engine: Engine, options: TextureSourceOptions) => Texture;
|
|
34
|
+
/**
|
|
35
|
+
* 通过数据创建 Texture 对象。
|
|
36
|
+
* @param data - 要创建的 Texture 数据
|
|
37
|
+
* @param options - 可选的 Texture 选项
|
|
38
|
+
*/
|
|
39
|
+
static createWithData: (engine: Engine, data?: TextureDataType, options?: Record<string, any>) => Texture;
|
|
40
|
+
constructor();
|
|
41
|
+
get isDestroyed(): boolean;
|
|
42
|
+
/**
|
|
43
|
+
* 获取 Texture 的宽度。
|
|
44
|
+
*/
|
|
45
|
+
getWidth(): number;
|
|
46
|
+
/**
|
|
47
|
+
* 获取 Texture 的高度。
|
|
48
|
+
*/
|
|
49
|
+
getHeight(): number;
|
|
50
|
+
uploadCurrentVideoFrame(): void;
|
|
51
|
+
/**
|
|
52
|
+
* 释放 Texture GPU 资源。
|
|
53
|
+
* 注意:该方法只释放资源,并不销毁 GPU textureBuffer 对象。
|
|
54
|
+
* @override
|
|
55
|
+
*/
|
|
56
|
+
offloadData(): void;
|
|
57
|
+
/**
|
|
58
|
+
* 重新加载 Texture GPU 资源。
|
|
59
|
+
* @override
|
|
60
|
+
*/
|
|
61
|
+
reloadData(): void;
|
|
62
|
+
/**
|
|
63
|
+
* 更新 Texture 源数据。
|
|
64
|
+
* @param options - 创建 Texture 选项
|
|
65
|
+
*/
|
|
66
|
+
abstract updateSource(options: TextureSourceOptions): void;
|
|
67
|
+
/**
|
|
68
|
+
* 销毁当前资源。
|
|
69
|
+
*/
|
|
70
|
+
abstract dispose(): void;
|
|
71
|
+
/**
|
|
72
|
+
* 初始化 GPU 资源
|
|
73
|
+
* @override
|
|
74
|
+
*/
|
|
75
|
+
initialize(): void;
|
|
76
|
+
protected assembleOptions(options: TextureSourceOptions): TextureSourceOptions;
|
|
77
|
+
}
|
|
78
|
+
export declare function generateHalfFloatTexture(engine: Engine, data: Uint16Array, width: number, height: number): Texture;
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import type * as spec from '@galacean/effects-specification';
|
|
2
|
+
type DataRange = [start: number, length: number];
|
|
3
|
+
type ImageSource = HTMLImageElement | HTMLCanvasElement;
|
|
4
|
+
export declare enum TextureLoadAction {
|
|
5
|
+
whatever = 0,
|
|
6
|
+
clear = 2
|
|
7
|
+
}
|
|
8
|
+
export declare enum TextureSourceType {
|
|
9
|
+
none = 0,
|
|
10
|
+
data = 1,
|
|
11
|
+
image = 2,
|
|
12
|
+
compressed = 3,
|
|
13
|
+
video = 4,
|
|
14
|
+
canvas = 5,
|
|
15
|
+
framebuffer = 6,
|
|
16
|
+
mipmaps = 7
|
|
17
|
+
}
|
|
18
|
+
export type TextureSourceCubeData = [
|
|
19
|
+
TEXTURE_CUBE_MAP_POSITIVE_X: ImageSource | {
|
|
20
|
+
data: spec.TypedArray;
|
|
21
|
+
width: number;
|
|
22
|
+
height: number;
|
|
23
|
+
},
|
|
24
|
+
TEXTURE_CUBE_MAP_NEGATIVE_X: ImageSource | {
|
|
25
|
+
data: spec.TypedArray;
|
|
26
|
+
width: number;
|
|
27
|
+
height: number;
|
|
28
|
+
},
|
|
29
|
+
TEXTURE_CUBE_MAP_POSITIVE_Y: ImageSource | {
|
|
30
|
+
data: spec.TypedArray;
|
|
31
|
+
width: number;
|
|
32
|
+
height: number;
|
|
33
|
+
},
|
|
34
|
+
TEXTURE_CUBE_MAP_NEGATIVE_Y: ImageSource | {
|
|
35
|
+
data: spec.TypedArray;
|
|
36
|
+
width: number;
|
|
37
|
+
height: number;
|
|
38
|
+
},
|
|
39
|
+
TEXTURE_CUBE_MAP_POSITIVE_Z: ImageSource | {
|
|
40
|
+
data: spec.TypedArray;
|
|
41
|
+
width: number;
|
|
42
|
+
height: number;
|
|
43
|
+
},
|
|
44
|
+
TEXTURE_CUBE_MAP_NEGATIVE_Z: ImageSource | {
|
|
45
|
+
data: spec.TypedArray;
|
|
46
|
+
width: number;
|
|
47
|
+
height: number;
|
|
48
|
+
}
|
|
49
|
+
];
|
|
50
|
+
export type TextureCubeSourceURLMap = [
|
|
51
|
+
TEXTURE_CUBE_MAP_POSITIVE_X: string,
|
|
52
|
+
TEXTURE_CUBE_MAP_NEGATIVE_X: string,
|
|
53
|
+
TEXTURE_CUBE_MAP_POSITIVE_Y: string,
|
|
54
|
+
TEXTURE_CUBE_MAP_NEGATIVE_Y: string,
|
|
55
|
+
TEXTURE_CUBE_MAP_POSITIVE_Z: string,
|
|
56
|
+
TEXTURE_CUBE_MAP_NEGATIVE_Z: string
|
|
57
|
+
];
|
|
58
|
+
export type TextureFactorySource2DBinaryMipmapsFrom = {
|
|
59
|
+
target?: WebGLRenderingContext['TEXTURE_2D'];
|
|
60
|
+
type: TextureSourceType.mipmaps;
|
|
61
|
+
bin: string;
|
|
62
|
+
mipmaps: DataRange[];
|
|
63
|
+
};
|
|
64
|
+
export type TextureFactorySourceCubeBinaryMipmapsFrom = {
|
|
65
|
+
target: WebGLRenderingContext['TEXTURE_CUBE_MAP'];
|
|
66
|
+
type: TextureSourceType.mipmaps;
|
|
67
|
+
bin: string;
|
|
68
|
+
mipmaps: [
|
|
69
|
+
TEXTURE_CUBE_MAP_POSITIVE_X: DataRange,
|
|
70
|
+
TEXTURE_CUBE_MAP_NEGATIVE_X: DataRange,
|
|
71
|
+
TEXTURE_CUBE_MAP_POSITIVE_Y: DataRange,
|
|
72
|
+
TEXTURE_CUBE_MAP_NEGATIVE_Y: DataRange,
|
|
73
|
+
TEXTURE_CUBE_MAP_POSITIVE_Z: DataRange,
|
|
74
|
+
TEXTURE_CUBE_MAP_NEGATIVE_Z: DataRange
|
|
75
|
+
][];
|
|
76
|
+
};
|
|
77
|
+
export interface TextureFactorySource2DFrom {
|
|
78
|
+
type: TextureSourceType.image | TextureSourceType.video;
|
|
79
|
+
url: string;
|
|
80
|
+
target?: WebGLRenderingContext['TEXTURE_2D'];
|
|
81
|
+
}
|
|
82
|
+
export type TextureFactorySourceCubeFrom = {
|
|
83
|
+
type: TextureSourceType.image;
|
|
84
|
+
map: TextureCubeSourceURLMap | string[];
|
|
85
|
+
target: WebGLRenderingContext['TEXTURE_CUBE_MAP'];
|
|
86
|
+
};
|
|
87
|
+
export interface TextureFactorySourceCubeMipmapsFrom {
|
|
88
|
+
type: TextureSourceType.mipmaps;
|
|
89
|
+
target: WebGLRenderingContext['TEXTURE_CUBE_MAP'];
|
|
90
|
+
maps: TextureCubeSourceURLMap[] | string[][];
|
|
91
|
+
}
|
|
92
|
+
export interface TextureFactorySource2DMipmapsFrom {
|
|
93
|
+
type: TextureSourceType.mipmaps;
|
|
94
|
+
target?: WebGLRenderingContext['TEXTURE_2D'];
|
|
95
|
+
urls: string[];
|
|
96
|
+
}
|
|
97
|
+
export interface TextureFactorySourceFromCompressed {
|
|
98
|
+
type: TextureSourceType.compressed;
|
|
99
|
+
url: string;
|
|
100
|
+
target?: number;
|
|
101
|
+
}
|
|
102
|
+
export type TextureFactorySourceFrom = TextureFactorySource2DBinaryMipmapsFrom | TextureFactorySourceCubeBinaryMipmapsFrom | TextureFactorySource2DFrom | TextureFactorySourceCubeFrom | TextureFactorySourceCubeMipmapsFrom | TextureFactorySource2DMipmapsFrom | TextureFactorySourceFromCompressed;
|
|
103
|
+
export interface TextureConfigOptions extends spec.TextureConfigOptionsBase {
|
|
104
|
+
sourceFrom?: TextureFactorySourceFrom;
|
|
105
|
+
}
|
|
106
|
+
export interface TextureOptionsBase extends TextureConfigOptions, spec.TextureFormatOptions {
|
|
107
|
+
}
|
|
108
|
+
export interface TextureCubeSourceOptionsImage extends TextureOptionsBase {
|
|
109
|
+
sourceType: TextureSourceType.image | TextureSourceType.data;
|
|
110
|
+
target: WebGLRenderingContext['TEXTURE_CUBE_MAP'];
|
|
111
|
+
cube: TextureSourceCubeData;
|
|
112
|
+
}
|
|
113
|
+
export interface TextureCubeSourceOptionsImageMipmaps extends TextureOptionsBase {
|
|
114
|
+
sourceType?: TextureSourceType.mipmaps;
|
|
115
|
+
mipmaps: TextureSourceCubeData[];
|
|
116
|
+
target: WebGLRenderingContext['TEXTURE_CUBE_MAP'];
|
|
117
|
+
}
|
|
118
|
+
export type TextureCubeSourceOptions = TextureCubeSourceOptionsImage | TextureCubeSourceOptionsImageMipmaps;
|
|
119
|
+
export type TextureDataType = {
|
|
120
|
+
data: spec.TypedArray;
|
|
121
|
+
width: number;
|
|
122
|
+
height: number;
|
|
123
|
+
};
|
|
124
|
+
export interface Texture2DSourceOptionsImage extends TextureOptionsBase {
|
|
125
|
+
sourceType?: TextureSourceType.image;
|
|
126
|
+
image: ImageSource;
|
|
127
|
+
target?: WebGLRenderingContext['TEXTURE_2D'];
|
|
128
|
+
generateMipmap?: boolean;
|
|
129
|
+
}
|
|
130
|
+
export interface Texture2DSourceOptionsData extends TextureOptionsBase {
|
|
131
|
+
sourceType?: TextureSourceType.data;
|
|
132
|
+
data: TextureDataType;
|
|
133
|
+
target?: WebGLRenderingContext['TEXTURE_2D'];
|
|
134
|
+
}
|
|
135
|
+
export interface Texture2DSourceOptionsVideo extends TextureOptionsBase {
|
|
136
|
+
sourceType?: TextureSourceType.video;
|
|
137
|
+
video: HTMLVideoElement;
|
|
138
|
+
target?: WebGLRenderingContext['TEXTURE_2D'];
|
|
139
|
+
generateMipmap?: boolean;
|
|
140
|
+
}
|
|
141
|
+
export interface Texture2DSourceOptionsImageMipmaps extends TextureOptionsBase {
|
|
142
|
+
sourceType?: TextureSourceType.mipmaps;
|
|
143
|
+
mipmaps: (ImageSource | TextureDataType)[];
|
|
144
|
+
target?: WebGLRenderingContext['TEXTURE_2D'];
|
|
145
|
+
}
|
|
146
|
+
export interface Texture2DSourceOptionsCompressed extends TextureOptionsBase {
|
|
147
|
+
sourceType?: TextureSourceType.compressed;
|
|
148
|
+
mipmaps: TextureDataType[];
|
|
149
|
+
target?: WebGLRenderingContext['TEXTURE_2D'] | WebGLRenderingContext['TEXTURE_CUBE_MAP'];
|
|
150
|
+
}
|
|
151
|
+
export interface Texture2DSourceOptionsFrameBuffer extends TextureOptionsBase {
|
|
152
|
+
sourceType: TextureSourceType.framebuffer;
|
|
153
|
+
data?: {
|
|
154
|
+
width: number;
|
|
155
|
+
height: number;
|
|
156
|
+
};
|
|
157
|
+
target?: WebGLRenderingContext['TEXTURE_2D'];
|
|
158
|
+
}
|
|
159
|
+
export interface Texture2DSourceOptionsNone extends TextureOptionsBase {
|
|
160
|
+
sourceType?: TextureSourceType.none;
|
|
161
|
+
target?: GLenum;
|
|
162
|
+
}
|
|
163
|
+
export type Texture2DSourceOptions = Texture2DSourceOptionsImage | Texture2DSourceOptionsData | Texture2DSourceOptionsVideo | Texture2DSourceOptionsImageMipmaps | Texture2DSourceOptionsCompressed | Texture2DSourceOptionsFrameBuffer | Texture2DSourceOptionsNone;
|
|
164
|
+
export type TextureSourceOptions = Texture2DSourceOptions | TextureCubeSourceOptions;
|
|
165
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type * as spec from '@galacean/effects-specification';
|
|
2
|
+
import type { Texture2DSourceOptions, TextureCubeSourceOptions } from './types';
|
|
3
|
+
type TextureJSONOptions = spec.SerializedTextureSource & spec.TextureConfigOptionsBase & spec.TextureFormatOptions;
|
|
4
|
+
export declare function deserializeMipmapTexture(texOpts: TextureJSONOptions, bins: ArrayBuffer[], files?: spec.BinaryFile[]): Promise<Texture2DSourceOptions | TextureCubeSourceOptions>;
|
|
5
|
+
export {};
|
package/dist/ticker.d.ts
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 定时器类
|
|
3
|
+
*/
|
|
4
|
+
export declare class Ticker {
|
|
5
|
+
tickers: ((dt: number) => void)[];
|
|
6
|
+
private paused;
|
|
7
|
+
private lastTime;
|
|
8
|
+
private targetFPS;
|
|
9
|
+
private interval;
|
|
10
|
+
private intervalId;
|
|
11
|
+
private resetTickers;
|
|
12
|
+
constructor(fps?: number);
|
|
13
|
+
/**
|
|
14
|
+
* FPS 帧率设置
|
|
15
|
+
*/
|
|
16
|
+
getFPS(): number;
|
|
17
|
+
setFPS(fps: number): void;
|
|
18
|
+
/**
|
|
19
|
+
* 获取定时器暂停标志位
|
|
20
|
+
* @returns 暂停标志位
|
|
21
|
+
*/
|
|
22
|
+
getPaused(): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* 定时器开始方法
|
|
25
|
+
*/
|
|
26
|
+
start(): void;
|
|
27
|
+
/**
|
|
28
|
+
* 定时器停止方法
|
|
29
|
+
*/
|
|
30
|
+
stop(): void;
|
|
31
|
+
/**
|
|
32
|
+
* 定时器暂停方法
|
|
33
|
+
*/
|
|
34
|
+
pause(): void;
|
|
35
|
+
/**
|
|
36
|
+
* 定时器恢复方法
|
|
37
|
+
*/
|
|
38
|
+
resume(): void;
|
|
39
|
+
/**
|
|
40
|
+
* 定时器 tick 方法
|
|
41
|
+
*/
|
|
42
|
+
tick(): void;
|
|
43
|
+
/**
|
|
44
|
+
* 定时器添加计时方法
|
|
45
|
+
* @param ticker - 定时器类
|
|
46
|
+
*/
|
|
47
|
+
add(ticker: (dt: number) => void): void;
|
|
48
|
+
}
|