@galacean/effects-core 2.10.0-alpha.1 → 2.10.0-alpha.3
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/components/component.d.ts +4 -0
- package/dist/components/frame-component.d.ts +10 -0
- package/dist/components/index.d.ts +2 -3
- package/dist/components/mesh-component.d.ts +1 -1
- package/dist/components/ui-canvas.d.ts +28 -0
- package/dist/components/ui-control.d.ts +38 -0
- package/dist/composition.d.ts +19 -13
- package/dist/engine.d.ts +49 -12
- package/dist/gui/control.d.ts +189 -0
- package/dist/gui/index.d.ts +2 -0
- package/dist/gui/roots.d.ts +79 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +4759 -1898
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4737 -1895
- package/dist/index.mjs.map +1 -1
- package/dist/input/enums.d.ts +65 -0
- package/dist/input/index.d.ts +2 -0
- package/dist/input/input-event.d.ts +77 -0
- package/dist/plugins/interact/event-system.d.ts +49 -2
- package/dist/plugins/particle/particle-mesh.d.ts +4 -1
- package/dist/plugins/particle/particle-system.d.ts +7 -0
- package/dist/plugins/particle/trail-mesh.d.ts +4 -0
- package/dist/plugins/shape/shape-component.d.ts +1 -0
- package/dist/plugins/sprite/sprite-item.d.ts +1 -0
- package/dist/render/buffer.d.ts +33 -0
- package/dist/render/data-buffer.d.ts +39 -0
- package/dist/render/geometry.d.ts +72 -94
- package/dist/render/gpu-capability.d.ts +2 -0
- package/dist/render/graphics.d.ts +2 -0
- package/dist/render/index.d.ts +3 -0
- package/dist/render/shader.d.ts +2 -1
- package/dist/render/text-cache.d.ts +8 -9
- package/dist/render/vertex-buffer.d.ts +72 -0
- package/dist/transform.d.ts +7 -0
- package/dist/vfx-item.d.ts +4 -0
- package/package.json +1 -1
- package/dist/components/canvas-item.d.ts +0 -131
- package/dist/components/canvas-layer.d.ts +0 -23
- package/dist/components/control.d.ts +0 -18
- package/dist/rect-transform.d.ts +0 -145
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
export declare enum MouseFilter {
|
|
2
|
+
Stop = 0,
|
|
3
|
+
Pass = 1,
|
|
4
|
+
Ignore = 2
|
|
5
|
+
}
|
|
6
|
+
export declare enum MouseBehaviorRecursive {
|
|
7
|
+
Inherited = 0,
|
|
8
|
+
Disabled = 1,
|
|
9
|
+
Enabled = 2
|
|
10
|
+
}
|
|
11
|
+
export declare enum MouseButton {
|
|
12
|
+
None = 0,
|
|
13
|
+
Left = 1,
|
|
14
|
+
Right = 2,
|
|
15
|
+
Middle = 3,
|
|
16
|
+
WheelUp = 4,
|
|
17
|
+
WheelDown = 5,
|
|
18
|
+
WheelLeft = 6,
|
|
19
|
+
WheelRight = 7,
|
|
20
|
+
Xbutton1 = 8,
|
|
21
|
+
Xbutton2 = 9
|
|
22
|
+
}
|
|
23
|
+
export declare enum MouseButtonMask {
|
|
24
|
+
None = 0,
|
|
25
|
+
Left = 1,
|
|
26
|
+
Right = 2,
|
|
27
|
+
Middle = 4,
|
|
28
|
+
Xbutton1 = 128,
|
|
29
|
+
Xbutton2 = 256
|
|
30
|
+
}
|
|
31
|
+
export declare enum FocusMode {
|
|
32
|
+
None = 0,
|
|
33
|
+
Click = 1,
|
|
34
|
+
All = 2,
|
|
35
|
+
Accessibility = 3
|
|
36
|
+
}
|
|
37
|
+
export declare enum FocusBehaviorRecursive {
|
|
38
|
+
Inherited = 0,
|
|
39
|
+
Disabled = 1,
|
|
40
|
+
Enabled = 2
|
|
41
|
+
}
|
|
42
|
+
export declare enum KeyLocation {
|
|
43
|
+
Unspecified = 0,
|
|
44
|
+
Left = 1,
|
|
45
|
+
Right = 2
|
|
46
|
+
}
|
|
47
|
+
export declare enum CursorShape {
|
|
48
|
+
Arrow = 0,
|
|
49
|
+
Ibeam = 1,
|
|
50
|
+
PointingHand = 2,
|
|
51
|
+
Cross = 3,
|
|
52
|
+
Wait = 4,
|
|
53
|
+
Busy = 5,
|
|
54
|
+
Drag = 6,
|
|
55
|
+
CanDrop = 7,
|
|
56
|
+
Forbidden = 8,
|
|
57
|
+
Vsize = 9,
|
|
58
|
+
Hsize = 10,
|
|
59
|
+
Bdiagsize = 11,
|
|
60
|
+
Fdiagsize = 12,
|
|
61
|
+
Move = 13,
|
|
62
|
+
Vsplit = 14,
|
|
63
|
+
Hsplit = 15,
|
|
64
|
+
Help = 16
|
|
65
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import type { Matrix3 } from '@galacean/effects-math/es/core/matrix3';
|
|
2
|
+
import { Vector2 } from '@galacean/effects-math/es/core/vector2';
|
|
3
|
+
import { KeyLocation, MouseButton, MouseButtonMask } from './enums';
|
|
4
|
+
export declare class InputEvent {
|
|
5
|
+
static readonly deviceIdEmulation = -1;
|
|
6
|
+
static readonly deviceIdInternal = -2;
|
|
7
|
+
static readonly deviceIdKeyboard = 16;
|
|
8
|
+
static readonly deviceIdMouse = 32;
|
|
9
|
+
device: number;
|
|
10
|
+
pressed: boolean;
|
|
11
|
+
canceled: boolean;
|
|
12
|
+
isPressed(): boolean;
|
|
13
|
+
isReleased(): boolean;
|
|
14
|
+
isCanceled(): boolean;
|
|
15
|
+
isEcho(): boolean;
|
|
16
|
+
xformedBy(transform: Matrix3): InputEvent;
|
|
17
|
+
}
|
|
18
|
+
export declare class InputEventWithModifiers extends InputEvent {
|
|
19
|
+
commandOrControlAutoremap: boolean;
|
|
20
|
+
shiftPressed: boolean;
|
|
21
|
+
altPressed: boolean;
|
|
22
|
+
metaPressed: boolean;
|
|
23
|
+
ctrlPressed: boolean;
|
|
24
|
+
protected copyModifiersTo(event: InputEventWithModifiers): void;
|
|
25
|
+
xformedBy(transform: Matrix3): InputEventWithModifiers;
|
|
26
|
+
}
|
|
27
|
+
export declare class InputEventKey extends InputEventWithModifiers {
|
|
28
|
+
keycode: string;
|
|
29
|
+
physicalKeycode: string;
|
|
30
|
+
keyLabel: string;
|
|
31
|
+
unicode: number;
|
|
32
|
+
location: KeyLocation;
|
|
33
|
+
echo: boolean;
|
|
34
|
+
isEcho(): boolean;
|
|
35
|
+
xformedBy(transform: Matrix3): InputEventKey;
|
|
36
|
+
}
|
|
37
|
+
export declare class InputEventMouse extends InputEventWithModifiers {
|
|
38
|
+
buttonMask: MouseButtonMask;
|
|
39
|
+
position: Vector2;
|
|
40
|
+
globalPosition: Vector2;
|
|
41
|
+
protected copyMouseTo(event: InputEventMouse): void;
|
|
42
|
+
xformedBy(transform: Matrix3): InputEventMouse;
|
|
43
|
+
}
|
|
44
|
+
export declare class InputEventMouseButton extends InputEventMouse {
|
|
45
|
+
factor: number;
|
|
46
|
+
buttonIndex: MouseButton;
|
|
47
|
+
doubleClick: boolean;
|
|
48
|
+
xformedBy(transform: Matrix3): InputEventMouseButton;
|
|
49
|
+
}
|
|
50
|
+
export declare class InputEventMouseMotion extends InputEventMouse {
|
|
51
|
+
tilt: Vector2;
|
|
52
|
+
pressure: number;
|
|
53
|
+
relative: Vector2;
|
|
54
|
+
screenRelative: Vector2;
|
|
55
|
+
velocity: Vector2;
|
|
56
|
+
screenVelocity: Vector2;
|
|
57
|
+
penInverted: boolean;
|
|
58
|
+
xformedBy(transform: Matrix3): InputEventMouseMotion;
|
|
59
|
+
}
|
|
60
|
+
export declare class InputEventScreenTouch extends InputEvent {
|
|
61
|
+
index: number;
|
|
62
|
+
position: Vector2;
|
|
63
|
+
doubleTap: boolean;
|
|
64
|
+
xformedBy(transform: Matrix3): InputEventScreenTouch;
|
|
65
|
+
}
|
|
66
|
+
export declare class InputEventScreenDrag extends InputEvent {
|
|
67
|
+
index: number;
|
|
68
|
+
position: Vector2;
|
|
69
|
+
relative: Vector2;
|
|
70
|
+
screenRelative: Vector2;
|
|
71
|
+
velocity: Vector2;
|
|
72
|
+
screenVelocity: Vector2;
|
|
73
|
+
pressure: number;
|
|
74
|
+
tilt: Vector2;
|
|
75
|
+
penInverted: boolean;
|
|
76
|
+
xformedBy(transform: Matrix3): InputEventScreenDrag;
|
|
77
|
+
}
|
|
@@ -29,20 +29,67 @@ export declare enum PointerEventType {
|
|
|
29
29
|
export declare class EventSystem implements Disposable {
|
|
30
30
|
engine: Engine;
|
|
31
31
|
allowPropagation: boolean;
|
|
32
|
-
enabled: boolean;
|
|
33
32
|
skipPointerMovePicking: boolean;
|
|
33
|
+
private readonly emulateMouseFromTouch;
|
|
34
|
+
private readonly emulateTouchFromMouse;
|
|
35
|
+
private _enabled;
|
|
34
36
|
private handlers;
|
|
35
37
|
private nativeHandlers;
|
|
36
38
|
private target;
|
|
39
|
+
private mouseState;
|
|
40
|
+
private touchStates;
|
|
41
|
+
private mouseFromTouchIndex;
|
|
42
|
+
private touchFromMousePressed;
|
|
43
|
+
private addedTabIndex;
|
|
44
|
+
private addedOutlineStyle;
|
|
37
45
|
constructor(engine: Engine, allowPropagation?: boolean);
|
|
46
|
+
get enabled(): boolean;
|
|
47
|
+
set enabled(value: boolean);
|
|
38
48
|
bindListeners(target: HTMLCanvasElement | null): void;
|
|
39
49
|
dispatchEvent(type: string, event: TouchEventType): void;
|
|
40
50
|
addEventListener(type: string, callback: (event: TouchEventType) => void): () => void;
|
|
41
51
|
removeEventListener(type: string, callback: (event: TouchEventType) => void): void;
|
|
52
|
+
dispose(): void;
|
|
53
|
+
private onNativeWheel;
|
|
54
|
+
private onNativeKeyDown;
|
|
55
|
+
private onNativeKeyUp;
|
|
56
|
+
private onNativeMouseDown;
|
|
57
|
+
private onNativeMouseMove;
|
|
58
|
+
private onNativeMouseUp;
|
|
59
|
+
private onNativeTouchStart;
|
|
60
|
+
private onNativeTouchMove;
|
|
61
|
+
private onNativeTouchEnd;
|
|
62
|
+
private onNativeTouchCancel;
|
|
63
|
+
private onWindowBlur;
|
|
64
|
+
private handleNativeMouseDown;
|
|
65
|
+
private handleNativeKey;
|
|
66
|
+
private handleNativeTouchEnd;
|
|
67
|
+
private pushNativeMouseButton;
|
|
68
|
+
private pushNativeMouseMotion;
|
|
69
|
+
private pushNativeScreenTouch;
|
|
70
|
+
private pushNativeScreenDrag;
|
|
71
|
+
private pushEmulatedMouseButton;
|
|
72
|
+
private pushEmulatedMouseMotion;
|
|
73
|
+
private pushMouseButton;
|
|
74
|
+
private pushWheelButton;
|
|
75
|
+
private pushMouseMotion;
|
|
76
|
+
private pushScreenTouch;
|
|
77
|
+
private pushScreenDrag;
|
|
78
|
+
private copyMouseFields;
|
|
42
79
|
private onClick;
|
|
43
80
|
private onPointerDown;
|
|
44
81
|
private onPointerUp;
|
|
45
82
|
private onPointerMove;
|
|
46
83
|
private handlePointerEvent;
|
|
47
|
-
|
|
84
|
+
private createPointerState;
|
|
85
|
+
private updatePointerState;
|
|
86
|
+
private getVelocity;
|
|
87
|
+
private isClick;
|
|
88
|
+
private createPointerEvent;
|
|
89
|
+
private getCanvasPosition;
|
|
90
|
+
private consumeNativeEvent;
|
|
91
|
+
private preventTouchDefaults;
|
|
92
|
+
private focusTarget;
|
|
93
|
+
private addNativeHandler;
|
|
94
|
+
private unbindListeners;
|
|
48
95
|
}
|
|
@@ -139,11 +139,11 @@ export declare class ParticleMesh implements ParticleMeshData {
|
|
|
139
139
|
private cachedRotationMatrix;
|
|
140
140
|
private cachedLinearMove;
|
|
141
141
|
private tempMatrix3;
|
|
142
|
+
private readonly attributeData;
|
|
142
143
|
VERT_MAX_KEY_FRAME_COUNT: number;
|
|
143
144
|
constructor(engine: Engine, props: ParticleMeshProps);
|
|
144
145
|
getPointColor(index: number): number[];
|
|
145
146
|
clearPoints(): void;
|
|
146
|
-
resetGeometryData(geometry: Geometry): void;
|
|
147
147
|
onUpdate(dt: number): void;
|
|
148
148
|
minusTime(time: number): void;
|
|
149
149
|
removePoint(index: number): void;
|
|
@@ -151,6 +151,9 @@ export declare class ParticleMesh implements ParticleMeshData {
|
|
|
151
151
|
private applyTranslation;
|
|
152
152
|
private applyRotation;
|
|
153
153
|
private applyLinearMove;
|
|
154
|
+
private getAttributeData;
|
|
155
|
+
private setAttributeData;
|
|
156
|
+
private setAttributeSubData;
|
|
154
157
|
private expandArray;
|
|
155
158
|
}
|
|
156
159
|
export declare function getParticleMeshShader(item: spec.ParticleItem, gpuCapability: GPUCapability, env?: string): {
|
|
@@ -171,6 +171,13 @@ export declare class ParticleSystem extends Component implements Maskable {
|
|
|
171
171
|
private update;
|
|
172
172
|
drawStencilMask(maskRef: number): void;
|
|
173
173
|
onDestroy(): void;
|
|
174
|
+
/**
|
|
175
|
+
* @hidden
|
|
176
|
+
* Internal utility.
|
|
177
|
+
* Not part of the public API — do not rely on this in your code.
|
|
178
|
+
*/
|
|
179
|
+
rebuild(): void;
|
|
180
|
+
dispose(): void;
|
|
174
181
|
getParticleBoxes(): {
|
|
175
182
|
center: Vector3;
|
|
176
183
|
size: Vector3;
|
|
@@ -41,6 +41,7 @@ export declare class TrailMesh {
|
|
|
41
41
|
checkVertexDistance: boolean;
|
|
42
42
|
private pointStart;
|
|
43
43
|
private trailCursors;
|
|
44
|
+
private readonly attributeData;
|
|
44
45
|
constructor(engine: Engine, props: TrailMeshProps);
|
|
45
46
|
get time(): number;
|
|
46
47
|
set time(t: number);
|
|
@@ -52,5 +53,8 @@ export declare class TrailMesh {
|
|
|
52
53
|
getPointStartPos(index: number): Vector3;
|
|
53
54
|
setPointStartPos(index: number, pos: Vector3): void;
|
|
54
55
|
onUpdate(escapeTime: number): any;
|
|
56
|
+
private getAttributeData;
|
|
57
|
+
private setAttributeData;
|
|
58
|
+
private setAttributeSubData;
|
|
55
59
|
}
|
|
56
60
|
export declare function getTrailMeshShader(trails: spec.ParticleTrail, particleMaxCount: number, name: string, gpuCapability: GPUCapability, env?: string): ShaderWithSource;
|
|
@@ -158,6 +158,7 @@ export declare class ShapeComponent extends RendererComponent implements Maskabl
|
|
|
158
158
|
getBoundingBox(): BoundingBoxTriangle;
|
|
159
159
|
getBoundingBoxInfo(): BoundingBoxInfo;
|
|
160
160
|
private buildGeometryFromPath;
|
|
161
|
+
private updateAttributeData;
|
|
161
162
|
private computeScreenScale;
|
|
162
163
|
private buildPath;
|
|
163
164
|
private updateMaterials;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { Engine } from '../engine';
|
|
2
|
+
import type { Disposable } from '../utils';
|
|
3
|
+
import type { DataArray } from './data-buffer';
|
|
4
|
+
import { DataBuffer } from './data-buffer';
|
|
5
|
+
import { VertexBuffer } from './vertex-buffer';
|
|
6
|
+
/**
|
|
7
|
+
* 管理顶点数据及其对应的后端缓冲区。
|
|
8
|
+
*/
|
|
9
|
+
export declare class Buffer implements Disposable {
|
|
10
|
+
readonly engine: Engine;
|
|
11
|
+
readonly byteStride: number;
|
|
12
|
+
private data?;
|
|
13
|
+
private buffer?;
|
|
14
|
+
private readonly updatable;
|
|
15
|
+
private readonly instanced;
|
|
16
|
+
private readonly divisor;
|
|
17
|
+
private readonly label?;
|
|
18
|
+
private isAlreadyOwned;
|
|
19
|
+
private _isDisposed;
|
|
20
|
+
constructor(engine: Engine, data: DataArray | DataBuffer, updatable: boolean, stride?: number, postponeInternalCreation?: boolean, instanced?: boolean, useBytes?: boolean, divisor?: number, label?: string);
|
|
21
|
+
get isDisposed(): boolean;
|
|
22
|
+
get capacity(): number;
|
|
23
|
+
isUpdatable(): boolean;
|
|
24
|
+
getData(): DataArray | undefined;
|
|
25
|
+
getBuffer(): DataBuffer | undefined;
|
|
26
|
+
getStrideSize(): number;
|
|
27
|
+
createVertexBuffer(kind: string, offset: number, size: number, stride?: number, instanced?: boolean, useBytes?: boolean, divisor?: number): VertexBuffer;
|
|
28
|
+
create(data?: DataArray): void;
|
|
29
|
+
update(data: DataArray): void;
|
|
30
|
+
updateDirectly(data: DataArray, offset: number, vertexCount?: number, useBytes?: boolean): void;
|
|
31
|
+
dispose(): void;
|
|
32
|
+
private getDataBufferOptions;
|
|
33
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type * as spec from '@galacean/effects-specification';
|
|
2
|
+
export type DataArray = number[] | ArrayBuffer | ArrayBufferView;
|
|
3
|
+
export type IndicesArray = number[] | Int32Array | Uint32Array | Uint16Array;
|
|
4
|
+
export type IndexData = Int32Array | Uint32Array | Uint16Array;
|
|
5
|
+
export declare enum BufferUsage {
|
|
6
|
+
Stream = 35040,
|
|
7
|
+
Static = 35044,
|
|
8
|
+
Dynamic = 35048
|
|
9
|
+
}
|
|
10
|
+
export declare enum BufferDataType {
|
|
11
|
+
Byte = 5120,
|
|
12
|
+
UnsignedByte = 5121,
|
|
13
|
+
Short = 5122,
|
|
14
|
+
UnsignedShort = 5123,
|
|
15
|
+
Int = 5124,
|
|
16
|
+
UnsignedInt = 5125,
|
|
17
|
+
Float = 5126
|
|
18
|
+
}
|
|
19
|
+
export interface DataBufferOptions {
|
|
20
|
+
usage: number;
|
|
21
|
+
type: number;
|
|
22
|
+
byteStride: number;
|
|
23
|
+
instanceDivisor: number;
|
|
24
|
+
label?: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* 后端缓冲区的最小抽象,只保存资源状态。
|
|
28
|
+
*/
|
|
29
|
+
export declare class DataBuffer {
|
|
30
|
+
references: number;
|
|
31
|
+
capacity: number;
|
|
32
|
+
is32Bits: boolean;
|
|
33
|
+
get underlyingResource(): unknown;
|
|
34
|
+
}
|
|
35
|
+
export declare function getBytesPerElement(type: number): number;
|
|
36
|
+
export declare function getDataType(data: DataArray): BufferDataType;
|
|
37
|
+
export declare function getDataByteLength(data: DataArray): number;
|
|
38
|
+
export declare function toBufferView(data: DataArray): ArrayBufferView;
|
|
39
|
+
export declare function createTypedArray(type: number, length: number): spec.TypedArray;
|
|
@@ -1,26 +1,28 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as spec from '@galacean/effects-specification';
|
|
2
2
|
import type { Engine } from '../engine';
|
|
3
3
|
import { EffectsObject } from '../effects-object';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export type GeometryDrawMode =
|
|
4
|
+
import { Buffer } from './buffer';
|
|
5
|
+
import type { DataBuffer, IndexData, IndicesArray } from './data-buffer';
|
|
6
|
+
import { VertexBuffer } from './vertex-buffer';
|
|
7
|
+
import type { ShaderVariant } from './shader';
|
|
8
|
+
export type GeometryDrawMode = number;
|
|
9
9
|
export type Attribute = spec.AttributeWithData | spec.AttributeWithDataPointer | spec.AttributeWithType | spec.AttributeWithDataSource;
|
|
10
10
|
export interface GeometryProps {
|
|
11
11
|
name?: string;
|
|
12
12
|
attributes: Record<string, Attribute>;
|
|
13
13
|
indices?: {
|
|
14
|
-
data:
|
|
15
|
-
releasable?: boolean;
|
|
14
|
+
data: IndexData;
|
|
16
15
|
};
|
|
17
16
|
mode?: GeometryDrawMode;
|
|
18
17
|
drawCount?: number;
|
|
19
18
|
drawStart?: number;
|
|
20
19
|
instanceCount?: number;
|
|
21
|
-
bufferUsage?: WebGLRenderingContext['STATIC_DRAW'] | WebGLRenderingContext['DYNAMIC_DRAW'];
|
|
22
20
|
/**
|
|
23
|
-
*
|
|
21
|
+
* 顶点和索引缓冲区的使用方式,默认使用静态缓冲区。
|
|
22
|
+
*/
|
|
23
|
+
bufferUsage?: number;
|
|
24
|
+
/**
|
|
25
|
+
* 为初始空缓冲区预留的最大顶点数量。
|
|
24
26
|
*/
|
|
25
27
|
maxVertex?: number;
|
|
26
28
|
}
|
|
@@ -30,93 +32,69 @@ export interface SkinProps {
|
|
|
30
32
|
inverseBindMatrices?: number[];
|
|
31
33
|
}
|
|
32
34
|
/**
|
|
33
|
-
*
|
|
35
|
+
* 几何数据、属性布局和绘制范围的后端无关实现。
|
|
34
36
|
*/
|
|
35
|
-
export declare
|
|
36
|
-
|
|
37
|
-
* Geometry 的名称
|
|
38
|
-
*/
|
|
37
|
+
export declare class Geometry extends EffectsObject {
|
|
38
|
+
static create: (engine: Engine, props?: GeometryProps) => Geometry;
|
|
39
39
|
name: string;
|
|
40
|
-
/**
|
|
41
|
-
* 子网格数据
|
|
42
|
-
*/
|
|
43
40
|
subMeshes: spec.SubMesh[];
|
|
44
|
-
/**
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
abstract setIndexSubData(offset: number, data: spec.TypedArray): void;
|
|
90
|
-
/**
|
|
91
|
-
* 设置 Geometry 绘制的 drawStart
|
|
92
|
-
* @param value 要设置的 drawStart 值
|
|
93
|
-
*/
|
|
94
|
-
abstract setDrawStart(count: number): void;
|
|
95
|
-
/**
|
|
96
|
-
* 获取当前 Geometry 的 drawStart
|
|
97
|
-
*/
|
|
98
|
-
abstract getDrawStart(): number;
|
|
99
|
-
/**
|
|
100
|
-
* 设置 Geometry 绘制的 drawCount。
|
|
101
|
-
* @param count 要设置的 drawCount 值
|
|
102
|
-
*/
|
|
103
|
-
abstract setDrawCount(count: number): void;
|
|
104
|
-
/**
|
|
105
|
-
* 获取当前 Geometry 的 drawcount
|
|
106
|
-
*/
|
|
107
|
-
abstract getDrawCount(): number;
|
|
108
|
-
/**
|
|
109
|
-
* 获取当前 Geometry 关联的蒙皮数据
|
|
110
|
-
*/
|
|
111
|
-
abstract getSkinProps(): SkinProps;
|
|
112
|
-
/**
|
|
113
|
-
* 初始化 GPU 资源
|
|
114
|
-
* @override
|
|
115
|
-
*/
|
|
41
|
+
/** @hide */
|
|
42
|
+
mode: GeometryDrawMode;
|
|
43
|
+
/** @hide */
|
|
44
|
+
instanceCount: number;
|
|
45
|
+
private vertexBuffers;
|
|
46
|
+
private indices;
|
|
47
|
+
private drawCount;
|
|
48
|
+
private drawStart;
|
|
49
|
+
private skin;
|
|
50
|
+
private indexBuffer?;
|
|
51
|
+
private disposed;
|
|
52
|
+
private initialized;
|
|
53
|
+
private options?;
|
|
54
|
+
private bufferUsage;
|
|
55
|
+
private vertexArrayObjects?;
|
|
56
|
+
/** @hide */
|
|
57
|
+
constructor(engine: Engine, props?: GeometryProps);
|
|
58
|
+
/** @hide */
|
|
59
|
+
isDisposed(): boolean;
|
|
60
|
+
/** @hide */
|
|
61
|
+
getVertexBuffer(name: string): VertexBuffer | undefined;
|
|
62
|
+
/** @hide */
|
|
63
|
+
setVerticesBuffer(vertexBuffer: VertexBuffer, disposeExistingBuffer?: boolean): void;
|
|
64
|
+
/** @hide */
|
|
65
|
+
getAttributeBuffer(name: string): Buffer | undefined;
|
|
66
|
+
getAttributeData(name: string): spec.TypedArray | undefined;
|
|
67
|
+
setAttributeData(name: string, data: spec.TypedArray): void;
|
|
68
|
+
setAttributeSubData(name: string, offset: number, data: spec.TypedArray): void;
|
|
69
|
+
getAttributeStride(name: string): number;
|
|
70
|
+
getAttributeNames(): string[];
|
|
71
|
+
/** @hide */
|
|
72
|
+
getIndexBuffer(): DataBuffer | undefined;
|
|
73
|
+
getIndexData(): IndexData;
|
|
74
|
+
/** @hide */
|
|
75
|
+
getIndexType(): number;
|
|
76
|
+
setIndexData(data: IndicesArray): void;
|
|
77
|
+
setIndexSubData(offset: number, data: IndicesArray): void;
|
|
78
|
+
setDrawStart(start: number): void;
|
|
79
|
+
getDrawStart(): number;
|
|
80
|
+
setDrawCount(count: number): void;
|
|
81
|
+
getDrawCount(): number;
|
|
82
|
+
getSkinProps(): SkinProps;
|
|
83
|
+
/** @hide */
|
|
84
|
+
bind(shader: ShaderVariant): void;
|
|
85
|
+
private releaseVertexArrayObject;
|
|
116
86
|
initialize(): void;
|
|
117
|
-
/**
|
|
118
|
-
* 几何数据刷新
|
|
119
|
-
*/
|
|
120
87
|
flush(): void;
|
|
88
|
+
/** @hide */
|
|
89
|
+
restore(): void;
|
|
90
|
+
fromData(data: spec.GeometryData): void;
|
|
91
|
+
dispose(): void;
|
|
92
|
+
private processProps;
|
|
93
|
+
private releaseCurrentBuffers;
|
|
94
|
+
private disposeVertexArrayObjects;
|
|
95
|
+
private createIndexBuffer;
|
|
96
|
+
private releaseIndexBuffer;
|
|
97
|
+
private forEachVertexBuffer;
|
|
121
98
|
}
|
|
122
|
-
export declare
|
|
99
|
+
export declare const BYTES_TYPE_MAP: Record<string, number>;
|
|
100
|
+
export declare function generateEmptyTypedArray(type: number): spec.TypedArray;
|
|
@@ -17,6 +17,7 @@ export declare class Graphics {
|
|
|
17
17
|
private geometry;
|
|
18
18
|
private coloredMaterial;
|
|
19
19
|
private texturedMaterial;
|
|
20
|
+
private textMaterial;
|
|
20
21
|
private readonly lineShape;
|
|
21
22
|
private readonly bezierShape;
|
|
22
23
|
private readonly triangleShape;
|
|
@@ -62,6 +63,7 @@ export declare class Graphics {
|
|
|
62
63
|
* 提交当前累积的顶点到 renderer,清空缓冲(批次内部 flush 不重置 batchType)
|
|
63
64
|
*/
|
|
64
65
|
private flushBatch;
|
|
66
|
+
private updateAttributeData;
|
|
65
67
|
/**
|
|
66
68
|
* 线段顶点按顺序连接 (p0-p1, p1-p2, p2-p3, ...)
|
|
67
69
|
* @param points - 点数组,格式 [x1,y1,x2,y2,...],至少需要2个点(4个数值)
|
package/dist/render/index.d.ts
CHANGED
|
@@ -7,6 +7,9 @@ export * from './shader';
|
|
|
7
7
|
export * from './gpu-capability';
|
|
8
8
|
export * from './mesh';
|
|
9
9
|
export * from './geometry';
|
|
10
|
+
export * from './data-buffer';
|
|
11
|
+
export * from './buffer';
|
|
12
|
+
export * from './vertex-buffer';
|
|
10
13
|
export * from './framebuffer';
|
|
11
14
|
export * from './renderer';
|
|
12
15
|
export * from './graphics';
|
package/dist/render/shader.d.ts
CHANGED
|
@@ -57,8 +57,9 @@ export interface SharedShaderWithSource {
|
|
|
57
57
|
export type ShaderWithSource = SharedShaderWithSource;
|
|
58
58
|
export declare abstract class ShaderVariant extends EffectsObject {
|
|
59
59
|
readonly source: ShaderWithSource;
|
|
60
|
+
readonly key: string;
|
|
60
61
|
shader: Shader;
|
|
61
|
-
constructor(engine: Engine, source: ShaderWithSource);
|
|
62
|
+
constructor(engine: Engine, source: ShaderWithSource, key: string);
|
|
62
63
|
initialize(): void;
|
|
63
64
|
abstract setFloat(name: string, value: number): void;
|
|
64
65
|
abstract setInt(name: string, value: number): void;
|
|
@@ -9,19 +9,14 @@ export type FontWeight = 'normal' | 'bold' | number;
|
|
|
9
9
|
*/
|
|
10
10
|
export type FontStyle = 'normal' | 'italic';
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
13
|
-
* 但 quad 仍按 1x 逻辑尺寸绘制 — 双线性 downsample 后比原 1x 渲染清晰得多
|
|
14
|
-
*/
|
|
15
|
-
export declare const FONT_SCALE = 2;
|
|
16
|
-
/**
|
|
17
|
-
* 单张字符 atlas 的边长(像素,scale 后的实际像素,非逻辑尺寸)。
|
|
12
|
+
* 单张字符 atlas 的逻辑边长。实际 canvas 像素尺寸会乘以渲染 resolution。
|
|
18
13
|
* 512×512 在 24px 字号下约可容纳 250+ 字形,常见 demo 文本足够
|
|
19
14
|
*/
|
|
20
15
|
export declare const ATLAS_SIZE = 512;
|
|
21
16
|
/**
|
|
22
17
|
* 单个字形在 atlas 中的位置 / 度量。
|
|
23
18
|
*
|
|
24
|
-
* `px/py/pw/ph` 是 atlas canvas 像素(
|
|
19
|
+
* `px/py/pw/ph` 是 atlas canvas 像素(resolution 后,含四周 padding)。
|
|
25
20
|
* `advance` 是逻辑像素光标前进量(1x,不含 padding)— quad 宽度含 padding,
|
|
26
21
|
* 但相邻字只按 advance 前进,padding 区透明因此重叠无妨。
|
|
27
22
|
* `paddingLeft` 是逻辑像素左侧留白(1x),quad 起点左偏此量使字形 ink 落在 cursorX
|
|
@@ -47,12 +42,14 @@ export type GlyphInfo = {
|
|
|
47
42
|
export declare class GlyphAtlas {
|
|
48
43
|
private engine;
|
|
49
44
|
private readonly scaledFontString;
|
|
50
|
-
/** atlas canvas(像素 = ATLAS_SIZE ×
|
|
45
|
+
/** atlas canvas(像素 = ATLAS_SIZE × resolution,自有不进 canvasPool) */
|
|
51
46
|
readonly canvas: HTMLCanvasElement;
|
|
52
47
|
/** 与 canvas 绑定的纹理,内容变更后通过 updateSource 重传 */
|
|
53
48
|
readonly texture: Texture;
|
|
54
49
|
/** cell 高(逻辑像素,含 padding),用于 quad 高度 */
|
|
55
50
|
readonly lineHeight: number;
|
|
51
|
+
/** 字形 canvas 的像素密度,与 Pixi 的纹理 resolution 语义一致。 */
|
|
52
|
+
readonly resolution: number;
|
|
56
53
|
private readonly ctx;
|
|
57
54
|
private readonly glyphs;
|
|
58
55
|
/** baseline 距 cell 顶距离(像素,scale 后,含顶部 padding) */
|
|
@@ -74,7 +71,7 @@ export declare class GlyphAtlas {
|
|
|
74
71
|
/** baseline 距 cell 顶距离(像素,scale 后,仅 ascent 部分,不含 padding) */
|
|
75
72
|
ascentPx: number,
|
|
76
73
|
/** baseline 距 cell 底距离(像素,scale 后,仅 descent 部分) */
|
|
77
|
-
descentPx: number, fontStyle: FontStyle);
|
|
74
|
+
descentPx: number, fontStyle: FontStyle, resolution: number);
|
|
78
75
|
/**
|
|
79
76
|
* 取(必要时渲染并打包)单字。返回 GlyphInfo 或 null(atlas 已满)
|
|
80
77
|
*/
|
|
@@ -99,6 +96,7 @@ export declare class TextCache {
|
|
|
99
96
|
private engine;
|
|
100
97
|
/** fontKey -> 该字体的字符 atlas */
|
|
101
98
|
private readonly atlases;
|
|
99
|
+
private resolution;
|
|
102
100
|
constructor(engine: Engine);
|
|
103
101
|
/**
|
|
104
102
|
* 取(必要时新建)对应字体的字符 atlas
|
|
@@ -114,4 +112,5 @@ export declare class TextCache {
|
|
|
114
112
|
* 清空所有 atlas 并 dispose 对应纹理。Engine dispose 时调用
|
|
115
113
|
*/
|
|
116
114
|
dispose(): void;
|
|
115
|
+
private clear;
|
|
117
116
|
}
|