@galacean/engine-design 2.0.0-alpha.6 → 2.0.0-alpha.61
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/main.js +1094 -0
- package/dist/main.js.map +1 -0
- package/dist/module.js +1081 -0
- package/dist/module.js.map +1 -0
- package/package.json +3 -2
- package/types/index.d.ts +2 -2
- package/types/physics/ICollider.d.ts +6 -3
- package/types/physics/ICollision.d.ts +6 -3
- package/types/physics/IDynamicCollider.d.ts +20 -8
- package/types/physics/IPhysics.d.ts +6 -16
- package/types/physics/IPhysicsEvents.d.ts +25 -0
- package/types/physics/IPhysicsMaterial.d.ts +10 -0
- package/types/physics/IPhysicsScene.d.ts +84 -23
- package/types/physics/IStaticCollider.d.ts +10 -0
- package/types/physics/index.d.ts +2 -1
- package/types/physics/joints/IJoint.d.ts +1 -1
- package/types/physics/shape/IColliderShape.d.ts +5 -0
- package/types/physics/shape/IMeshColliderShape.d.ts +4 -5
- package/types/shader-compiler/ICondition.d.ts +131 -0
- package/types/shader-compiler/IPrecompiledShader.d.ts +20 -0
- package/types/shader-compiler/IShaderCompiler.d.ts +33 -0
- package/types/shader-compiler/IShaderProgramSource.d.ts +14 -0
- package/types/shader-compiler/PreprocessorExpression.d.ts +174 -0
- package/types/shader-compiler/ShaderIncludePath.d.ts +7 -0
- package/types/shader-compiler/index.d.ts +12 -0
- package/types/shader-compiler/shaderSource/IShaderPassSource.d.ts +34 -0
- package/types/spine/ISpineAnimation.d.ts +4 -0
- package/types/spine/ISpineAnimationState.d.ts +17 -0
- package/types/spine/ISpineAnimationStateData.d.ts +5 -0
- package/types/spine/ISpineAnimationStateListener.d.ts +10 -0
- package/types/spine/ISpineBone.d.ts +21 -0
- package/types/spine/ISpineBoneData.d.ts +3 -0
- package/types/spine/ISpineConstraint.d.ts +5 -0
- package/types/spine/ISpineConstraintData.d.ts +3 -0
- package/types/spine/ISpineEvent.d.ts +9 -0
- package/types/spine/ISpineGeometry.d.ts +17 -0
- package/types/spine/ISpinePhysics.d.ts +7 -0
- package/types/spine/ISpinePhysicsConstraint.d.ts +11 -0
- package/types/spine/ISpineRuntime.d.ts +52 -0
- package/types/spine/ISpineSkeleton.d.ts +21 -0
- package/types/spine/ISpineSkeletonData.d.ts +15 -0
- package/types/spine/ISpineSkin.d.ts +5 -0
- package/types/spine/ISpineSlot.d.ts +9 -0
- package/types/spine/ISpineTextureAtlas.d.ts +6 -0
- package/types/spine/ISpineTrackEntry.d.ts +23 -0
- package/types/spine/SpineCapability.d.ts +8 -0
- package/types/spine/index.d.ts +21 -0
- package/types/xr/IXRDevice.d.ts +3 -4
- package/types/xr/IXRSession.d.ts +7 -7
- package/types/renderingHardwareInterface/IHardwareRenderer.d.ts +0 -6
- package/types/renderingHardwareInterface/IPlatformPrimitive.d.ts +0 -5
- package/types/renderingHardwareInterface/IPlatformShaderProgram.d.ts +0 -4
- package/types/renderingHardwareInterface/index.d.ts +0 -3
- package/types/shader-lab/IShaderLab.d.ts +0 -22
- package/types/shader-lab/IShaderProgramSource.d.ts +0 -4
- package/types/shader-lab/index.d.ts +0 -8
- package/types/shader-lab/shaderSource/IShaderPassSource.d.ts +0 -13
- /package/types/{shader-lab → shader-compiler}/shaderSource/IRenderStates.d.ts +0 -0
- /package/types/{shader-lab → shader-compiler}/shaderSource/IShaderPosition.d.ts +0 -0
- /package/types/{shader-lab → shader-compiler}/shaderSource/IShaderSource.d.ts +0 -0
- /package/types/{shader-lab → shader-compiler}/shaderSource/IStatement.d.ts +0 -0
- /package/types/{shader-lab → shader-compiler}/shaderSource/ISubShaderSource.d.ts +0 -0
package/types/physics/index.d.ts
CHANGED
|
@@ -2,10 +2,11 @@ export type { ICharacterController } from "./ICharacterController";
|
|
|
2
2
|
export type { ICollider } from "./ICollider";
|
|
3
3
|
export type { IDynamicCollider } from "./IDynamicCollider";
|
|
4
4
|
export type { IPhysics } from "./IPhysics";
|
|
5
|
-
export type { IPhysicsMaterial } from "./IPhysicsMaterial";
|
|
5
|
+
export type { IPhysicsMaterial, IPhysicsMaterialProperties } from "./IPhysicsMaterial";
|
|
6
6
|
export type { IPhysicsScene } from "./IPhysicsScene";
|
|
7
7
|
export type { IPhysicsManager } from "./IPhysicsManager";
|
|
8
8
|
export type { IStaticCollider } from "./IStaticCollider";
|
|
9
9
|
export type { ICollision } from "./ICollision";
|
|
10
|
+
export type { IContactEvent, ITriggerEvent, IPhysicsEvents } from "./IPhysicsEvents";
|
|
10
11
|
export * from "./joints/index";
|
|
11
12
|
export * from "./shape/index";
|
|
@@ -7,7 +7,7 @@ export interface IJoint {
|
|
|
7
7
|
/**
|
|
8
8
|
* The connected collider.
|
|
9
9
|
*/
|
|
10
|
-
setConnectedCollider(value: ICollider): void;
|
|
10
|
+
setConnectedCollider(value: ICollider | null | undefined): void;
|
|
11
11
|
/**
|
|
12
12
|
* The connected anchor position.
|
|
13
13
|
* @remarks If connectedCollider is set, this anchor is relative offset, or the anchor is world position.
|
|
@@ -34,6 +34,11 @@ export interface IColliderShape {
|
|
|
34
34
|
* @param value - True for TriggerShape, false for SimulationShape
|
|
35
35
|
*/
|
|
36
36
|
setIsTrigger(value: boolean): void;
|
|
37
|
+
/**
|
|
38
|
+
* Enables this shape for raycasts, shape casts, and overlap queries without changing collision response.
|
|
39
|
+
* @param value - Whether the shape participates in scene queries
|
|
40
|
+
*/
|
|
41
|
+
setIsSceneQuery(value: boolean): void;
|
|
37
42
|
/**
|
|
38
43
|
* Get the distance between a point and the shape.
|
|
39
44
|
* @param point - Location in world space you want to find the closest point to
|
|
@@ -5,12 +5,11 @@ import { IColliderShape } from "./IColliderShape";
|
|
|
5
5
|
*/
|
|
6
6
|
export interface IMeshColliderShape extends IColliderShape {
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* Update mesh data without changing the geometry type.
|
|
9
9
|
* @param positions - Vertex positions
|
|
10
|
-
* @param indices -
|
|
11
|
-
* @param isConvex - Whether to use convex mesh (true) or triangle mesh (false)
|
|
10
|
+
* @param indices - Index array (null for convex mesh)
|
|
12
11
|
* @param cookingFlags - Cooking flags
|
|
13
|
-
* @returns Whether the
|
|
12
|
+
* @returns Whether the update succeeded; failure leaves the shape unchanged
|
|
14
13
|
*/
|
|
15
|
-
setMeshData(positions: Vector3[], indices: Uint8Array | Uint16Array | Uint32Array | null,
|
|
14
|
+
setMeshData(positions: Vector3[], indices: Uint8Array | Uint16Array | Uint32Array | null, cookingFlags: number): boolean;
|
|
16
15
|
}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tests whether a macro is defined.
|
|
3
|
+
*/
|
|
4
|
+
export interface DefinedCondition {
|
|
5
|
+
/** Serialized node discriminator. */
|
|
6
|
+
t: "def";
|
|
7
|
+
/** Macro name tested by `defined`. */
|
|
8
|
+
m: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Tests whether a macro is not defined.
|
|
12
|
+
*/
|
|
13
|
+
export interface NotDefinedCondition {
|
|
14
|
+
/** Serialized node discriminator. */
|
|
15
|
+
t: "ndef";
|
|
16
|
+
/** Macro name tested by the negated definition check. */
|
|
17
|
+
m: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Compares one macro value with a signed 32-bit constant.
|
|
21
|
+
*/
|
|
22
|
+
export interface CompareCondition {
|
|
23
|
+
/** Serialized node discriminator. */
|
|
24
|
+
t: "cmp";
|
|
25
|
+
/** Macro whose numeric value is compared. */
|
|
26
|
+
m: string;
|
|
27
|
+
/** Comparison operator. */
|
|
28
|
+
op: "==" | "!=" | "<" | "<=" | ">" | ">=";
|
|
29
|
+
/** Signed 32-bit right operand. */
|
|
30
|
+
v: number;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Logical conjunction of two preprocessor conditions.
|
|
34
|
+
*/
|
|
35
|
+
export interface AndCondition {
|
|
36
|
+
/** Serialized node discriminator. */
|
|
37
|
+
t: "and";
|
|
38
|
+
/** Left operand. */
|
|
39
|
+
l: Condition;
|
|
40
|
+
/** Right operand. */
|
|
41
|
+
r: Condition;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Logical disjunction of two preprocessor conditions.
|
|
45
|
+
*/
|
|
46
|
+
export interface OrCondition {
|
|
47
|
+
/** Serialized node discriminator. */
|
|
48
|
+
t: "or";
|
|
49
|
+
/** Left operand. */
|
|
50
|
+
l: Condition;
|
|
51
|
+
/** Right operand. */
|
|
52
|
+
r: Condition;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Logical negation of a preprocessor condition.
|
|
56
|
+
*/
|
|
57
|
+
export interface NotCondition {
|
|
58
|
+
/** Serialized node discriminator. */
|
|
59
|
+
t: "not";
|
|
60
|
+
/** Negated operand. */
|
|
61
|
+
c: Condition;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Constant boolean produced when numeric literals resolve statically
|
|
65
|
+
* (e.g. #define FOO 3 → #if 3 == 3 → always true).
|
|
66
|
+
*/
|
|
67
|
+
export interface BoolCondition {
|
|
68
|
+
/** Serialized node discriminator. */
|
|
69
|
+
t: "bool";
|
|
70
|
+
/** Constant boolean value. */
|
|
71
|
+
v: boolean;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Signed 32-bit integer literal in a preprocessor expression.
|
|
75
|
+
*/
|
|
76
|
+
export interface NumericCondition {
|
|
77
|
+
/** Serialized node discriminator. */
|
|
78
|
+
t: "num";
|
|
79
|
+
/** Signed 32-bit value. */
|
|
80
|
+
v: number;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Identifier whose value is supplied by the active macro set.
|
|
84
|
+
*/
|
|
85
|
+
export interface IdentifierCondition {
|
|
86
|
+
/** Serialized node discriminator. */
|
|
87
|
+
t: "id";
|
|
88
|
+
/** Macro identifier resolved during variant evaluation. */
|
|
89
|
+
m: string;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Arithmetic or bitwise unary expression.
|
|
93
|
+
*/
|
|
94
|
+
export interface UnaryCondition {
|
|
95
|
+
/** Serialized node discriminator. */
|
|
96
|
+
t: "unary";
|
|
97
|
+
/** Unary operator. */
|
|
98
|
+
op: "+" | "-" | "~";
|
|
99
|
+
/** Unary operand. */
|
|
100
|
+
c: Condition;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Arithmetic, bitwise, or relational binary expression.
|
|
104
|
+
*/
|
|
105
|
+
export interface BinaryCondition {
|
|
106
|
+
/** Serialized node discriminator. */
|
|
107
|
+
t: "binary";
|
|
108
|
+
/** Binary operator. */
|
|
109
|
+
op: "|" | "^" | "&" | "==" | "!=" | "<" | "<=" | ">" | ">=" | "<<" | ">>" | "+" | "-" | "*" | "/" | "%";
|
|
110
|
+
/** Left operand. */
|
|
111
|
+
l: Condition;
|
|
112
|
+
/** Right operand. */
|
|
113
|
+
r: Condition;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Expression that must be macro-expanded before its parsed tree is final.
|
|
117
|
+
*/
|
|
118
|
+
export interface DeferredCondition {
|
|
119
|
+
/** Serialized node discriminator. */
|
|
120
|
+
t: "deferred";
|
|
121
|
+
/** Expression text retained for macro expansion. */
|
|
122
|
+
e: string;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Serializable preprocessor condition evaluated against the active macro set.
|
|
126
|
+
*/
|
|
127
|
+
export type Condition = DefinedCondition | NotDefinedCondition | CompareCondition | AndCondition | OrCondition | NotCondition | BoolCondition | NumericCondition | IdentifierCondition | UnaryCondition | BinaryCondition | DeferredCondition;
|
|
128
|
+
/**
|
|
129
|
+
* Preprocessor instruction tuple: `[directive, ...operands]`.
|
|
130
|
+
*/
|
|
131
|
+
export type ShaderInstruction = readonly [number, ...(string | number | string[] | Condition)[]];
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { IShaderProgramSource } from "./IShaderProgramSource";
|
|
2
|
+
export interface IPrecompiledShader {
|
|
3
|
+
name: string;
|
|
4
|
+
platformTarget: number;
|
|
5
|
+
subShaders: IPrecompiledSubShader[];
|
|
6
|
+
}
|
|
7
|
+
export interface IPrecompiledSubShader {
|
|
8
|
+
name: string;
|
|
9
|
+
tags?: Record<string, number | string | boolean>;
|
|
10
|
+
passes: IPrecompiledPass[];
|
|
11
|
+
}
|
|
12
|
+
export interface IPrecompiledPass extends Pick<IShaderProgramSource, "vertexShaderInstructions" | "fragmentShaderInstructions" | "vertexOutputNames"> {
|
|
13
|
+
name: string;
|
|
14
|
+
isUsePass: boolean;
|
|
15
|
+
tags?: Record<string, number | string | boolean>;
|
|
16
|
+
renderStates: {
|
|
17
|
+
constantMap: Record<string, number | string | boolean | number[]>;
|
|
18
|
+
variableMap: Record<string, string>;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { IShaderProgramSource } from "./IShaderProgramSource";
|
|
2
|
+
import { IShaderSource } from "./shaderSource/IShaderSource";
|
|
3
|
+
/**
|
|
4
|
+
* Shader compiler interface.
|
|
5
|
+
*/
|
|
6
|
+
export interface IShaderCompiler {
|
|
7
|
+
/**
|
|
8
|
+
* @internal
|
|
9
|
+
* Bind the live logical include registry used by runtime shader creation.
|
|
10
|
+
* @param includeMap - Canonical include keys mapped to GLSL chunk sources.
|
|
11
|
+
*/
|
|
12
|
+
_setIncludeMap(includeMap: Readonly<Record<string, string | undefined>>): void;
|
|
13
|
+
/**
|
|
14
|
+
* @internal
|
|
15
|
+
* Parse shader source code to get the source structure of shader.
|
|
16
|
+
* @param sourceCode - Complete ShaderLab source.
|
|
17
|
+
* @returns Parsed ShaderLab source structure.
|
|
18
|
+
* @throws Error when source-structure parsing fails.
|
|
19
|
+
*/
|
|
20
|
+
_parseShaderSource(sourceCode: string): IShaderSource;
|
|
21
|
+
/**
|
|
22
|
+
* @internal
|
|
23
|
+
* Parse shader pass source code.
|
|
24
|
+
* @param shaderPassSource - GLSL source contained by one ShaderLab pass.
|
|
25
|
+
* @param vertexEntry - Vertex entry function name.
|
|
26
|
+
* @param fragmentEntry - Fragment entry function name.
|
|
27
|
+
* @param backend - Backend-specific shader target.
|
|
28
|
+
* @param sourceFile - Canonical root source location used to resolve relative `#include` directives.
|
|
29
|
+
* @param sourceScopeStarts - Inherited ShaderLab content boundaries from source parsing.
|
|
30
|
+
* @returns Generated stage program, or `undefined` after a blocking parser or backend error.
|
|
31
|
+
*/
|
|
32
|
+
_parseShaderPass(shaderPassSource: string, vertexEntry: string, fragmentEntry: string, backend: any, sourceFile?: string, sourceScopeStarts?: readonly number[]): IShaderProgramSource | undefined;
|
|
33
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ShaderInstruction } from "./ICondition";
|
|
2
|
+
/** Backend output before runtime macro and inherited-declaration selection. */
|
|
3
|
+
export interface IShaderProgramSource {
|
|
4
|
+
/** Unselected vertex text for inspection; use the instruction stream to compile a variant. */
|
|
5
|
+
vertex: string;
|
|
6
|
+
/** Unselected fragment text for inspection; use the instruction stream to compile a variant. */
|
|
7
|
+
fragment: string;
|
|
8
|
+
/** Source vertex output names mapped to their generated GLSL names. */
|
|
9
|
+
vertexOutputNames?: Readonly<Record<string, string>>;
|
|
10
|
+
/** Vertex program, including declaration ownership that cannot be recovered from the text view. */
|
|
11
|
+
vertexShaderInstructions?: ShaderInstruction[];
|
|
12
|
+
/** Fragment program, including declaration ownership that cannot be recovered from the text view. */
|
|
13
|
+
fragmentShaderInstructions?: ShaderInstruction[];
|
|
14
|
+
}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import type { Condition } from "./ICondition";
|
|
2
|
+
/**
|
|
3
|
+
* Location and certainty of a preprocessor-expression parse failure.
|
|
4
|
+
*/
|
|
5
|
+
export interface PreprocessorExpressionParseError {
|
|
6
|
+
/** Human-readable syntax error. */
|
|
7
|
+
readonly message: string;
|
|
8
|
+
/** Zero-based start offset in the expression. */
|
|
9
|
+
readonly start: number;
|
|
10
|
+
/** Zero-based exclusive end offset in the expression. */
|
|
11
|
+
readonly end: number;
|
|
12
|
+
/** Whether macro expansion cannot make the expression valid. */
|
|
13
|
+
readonly certain: boolean;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Successful preprocessor-expression parse.
|
|
17
|
+
*/
|
|
18
|
+
export interface ParsedPreprocessorExpression {
|
|
19
|
+
readonly ok: true;
|
|
20
|
+
/** Serializable expression tree. */
|
|
21
|
+
readonly condition: Condition;
|
|
22
|
+
/** Whether evaluation depends on macro replacement text. */
|
|
23
|
+
readonly hasExpandableIdentifier: boolean;
|
|
24
|
+
/** Definite evaluation failure that is independent of macro state. */
|
|
25
|
+
readonly evaluationError?: string;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Failed preprocessor-expression parse.
|
|
29
|
+
*/
|
|
30
|
+
export interface InvalidPreprocessorExpression {
|
|
31
|
+
readonly ok: false;
|
|
32
|
+
/** Structured parse failure. */
|
|
33
|
+
readonly error: PreprocessorExpressionParseError;
|
|
34
|
+
/** Whether an identifier may expand into missing syntax. */
|
|
35
|
+
readonly hasExpandableIdentifier: boolean;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Result of parsing a preprocessor expression.
|
|
39
|
+
*/
|
|
40
|
+
export type PreprocessorExpressionParseResult = ParsedPreprocessorExpression | InvalidPreprocessorExpression;
|
|
41
|
+
/**
|
|
42
|
+
* Resolves identifiers and macro-definition checks while evaluating an expression tree.
|
|
43
|
+
*/
|
|
44
|
+
export interface PreprocessorExpressionContext {
|
|
45
|
+
/**
|
|
46
|
+
* Resolves an identifier to a signed 32-bit integer.
|
|
47
|
+
* @param name - Macro identifier.
|
|
48
|
+
* @returns Resolved integer value; undefined identifiers return zero.
|
|
49
|
+
*/
|
|
50
|
+
resolveIdentifier(name: string): number;
|
|
51
|
+
/**
|
|
52
|
+
* Tests whether a macro exists.
|
|
53
|
+
* @param name - Macro identifier.
|
|
54
|
+
* @returns Whether the identifier is defined.
|
|
55
|
+
*/
|
|
56
|
+
isDefined(name: string): boolean;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Resolves the subset of macro state known during source preprocessing.
|
|
60
|
+
*
|
|
61
|
+
* `undefined` means that the caller must preserve both possibilities. This keeps include
|
|
62
|
+
* reachability conservative when a macro may be supplied by the runtime configuration.
|
|
63
|
+
*/
|
|
64
|
+
export interface PartiallyKnownPreprocessorExpressionContext {
|
|
65
|
+
/**
|
|
66
|
+
* Resolves an identifier against known source macro state.
|
|
67
|
+
* @param name - Macro identifier.
|
|
68
|
+
* @returns Known value, definite error, or an empty result when the value depends on external macro state.
|
|
69
|
+
*/
|
|
70
|
+
resolveIdentifier(name: string): PartiallyKnownPreprocessorExpressionResult;
|
|
71
|
+
/**
|
|
72
|
+
* Resolves whether a macro is defined.
|
|
73
|
+
* @param name - Macro identifier.
|
|
74
|
+
* @returns Known definition state, or `undefined` when supplied externally.
|
|
75
|
+
*/
|
|
76
|
+
isDefined(name: string): boolean | undefined;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Result of evaluating an expression against incomplete macro state.
|
|
80
|
+
*/
|
|
81
|
+
export interface PartiallyKnownPreprocessorExpressionResult {
|
|
82
|
+
/** Known signed 32-bit value, absent when external macro state still matters. */
|
|
83
|
+
readonly value?: number;
|
|
84
|
+
/** Definite failure reached without assuming an external macro value. */
|
|
85
|
+
readonly error?: string;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* One object-like or function-like shader macro.
|
|
89
|
+
*/
|
|
90
|
+
export interface PreprocessorExpressionMacro {
|
|
91
|
+
/** Replacement-list source before parameter substitution. */
|
|
92
|
+
readonly body: string;
|
|
93
|
+
/** Function parameters; absent for an object-like macro. */
|
|
94
|
+
readonly parameters?: readonly string[];
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Result of token-aware preprocessor-expression macro expansion.
|
|
98
|
+
*/
|
|
99
|
+
export interface PreprocessorExpressionExpansionResult {
|
|
100
|
+
/** Comment-free, token-normalized expanded expression. */
|
|
101
|
+
readonly expression: string;
|
|
102
|
+
/** Deterministic expansion failure. */
|
|
103
|
+
readonly error?: string;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Result of shader source macro expansion, including a deterministic failure when expansion stops.
|
|
107
|
+
*/
|
|
108
|
+
export interface ShaderMacroExpansionResult {
|
|
109
|
+
/** Expanded source with preprocessing token boundaries and comments preserved. */
|
|
110
|
+
readonly source: string;
|
|
111
|
+
/** Deterministic expansion failure. */
|
|
112
|
+
readonly error?: string;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Parses the complete integer-expression grammar used by `#if` and `#elif`.
|
|
116
|
+
* @param expression - Text after the preprocessor directive.
|
|
117
|
+
* @returns A serializable tree or a structured parse failure.
|
|
118
|
+
*/
|
|
119
|
+
export declare function parsePreprocessorExpression(expression: string): PreprocessorExpressionParseResult;
|
|
120
|
+
/**
|
|
121
|
+
* Resolves `defined` operators and removes comments with the expression parser's tokenization rules.
|
|
122
|
+
* @param expression - Expression before ordinary macro replacement.
|
|
123
|
+
* @param isDefined - Resolves whether one macro name is defined, or returns `undefined` when external state decides.
|
|
124
|
+
* @returns Token-normalized expression with every known `defined` operator replaced by `0` or `1`.
|
|
125
|
+
*/
|
|
126
|
+
export declare function resolvePreprocessorDefinedOperators(expression: string, isDefined: (name: string) => boolean | undefined): string;
|
|
127
|
+
/**
|
|
128
|
+
* Expands object-like and function-like macros with the expression parser's tokenization rules.
|
|
129
|
+
* @param expression - Expression after any caller-owned `defined` resolution.
|
|
130
|
+
* @param resolveMacro - Resolves source or runtime macro definitions by name.
|
|
131
|
+
* @returns Token-normalized expansion or a deterministic depth error.
|
|
132
|
+
*/
|
|
133
|
+
export declare function expandPreprocessorExpressionMacros(expression: string, resolveMacro: (name: string) => PreprocessorExpressionMacro | undefined): PreprocessorExpressionExpansionResult;
|
|
134
|
+
/**
|
|
135
|
+
* Expands shader macros using the same argument prescan and rescan rules as conditional expressions.
|
|
136
|
+
* @param source - Shader text without macro definition or conditional directives.
|
|
137
|
+
* @param resolveMacro - Resolves the macro state active at this source location.
|
|
138
|
+
* @returns Expanded shader source, or a deterministic expansion-limit error.
|
|
139
|
+
*/
|
|
140
|
+
export declare function expandShaderMacros(source: string, resolveMacro: (name: string) => PreprocessorExpressionMacro | undefined): ShaderMacroExpansionResult;
|
|
141
|
+
/**
|
|
142
|
+
* Evaluates an expression whose result is independent of macro state.
|
|
143
|
+
* @param expression - Complete preprocessor expression text.
|
|
144
|
+
* @returns 32-bit result, or `undefined` when the expression is invalid, state-dependent, or unevaluable.
|
|
145
|
+
*/
|
|
146
|
+
export declare function evaluateContextFreePreprocessorExpression(expression: string): number | undefined;
|
|
147
|
+
/**
|
|
148
|
+
* Evaluates a parsed condition whose result is independent of macro state.
|
|
149
|
+
* @param condition - Parsed preprocessor expression tree.
|
|
150
|
+
* @returns 32-bit result, or `undefined` when macro state or an invalid operation affects the result.
|
|
151
|
+
*/
|
|
152
|
+
export declare function evaluateContextFreePreprocessorCondition(condition: Condition): number | undefined;
|
|
153
|
+
/**
|
|
154
|
+
* Evaluates the part of a preprocessor expression determined by known source macro state.
|
|
155
|
+
* @param condition - Parsed preprocessor expression tree.
|
|
156
|
+
* @param context - Partially known macro values and definition states.
|
|
157
|
+
* @returns 32-bit result, or `undefined` when any reachable input remains unknown.
|
|
158
|
+
*/
|
|
159
|
+
export declare function evaluatePartiallyKnownPreprocessorCondition(condition: Condition, context: PartiallyKnownPreprocessorExpressionContext): number | undefined;
|
|
160
|
+
/**
|
|
161
|
+
* Evaluates the known portion of an expression while preserving definite evaluation failures.
|
|
162
|
+
* @param condition - Parsed preprocessor expression tree.
|
|
163
|
+
* @param context - Partially known macro values and definition states.
|
|
164
|
+
* @returns Known value, definite error, or an empty result when external state still matters.
|
|
165
|
+
*/
|
|
166
|
+
export declare function evaluatePartiallyKnownPreprocessorConditionResult(condition: Condition, context: PartiallyKnownPreprocessorExpressionContext): PartiallyKnownPreprocessorExpressionResult;
|
|
167
|
+
/**
|
|
168
|
+
* Evaluates a parsed preprocessor expression with signed 32-bit arithmetic matching ANGLE's preprocessor.
|
|
169
|
+
* @param condition - Serializable expression tree.
|
|
170
|
+
* @param context - Active macro value and definition resolver.
|
|
171
|
+
* @returns Signed 32-bit result; nonzero values are true.
|
|
172
|
+
* @throws Error when an active expression divides by zero or contains a deferred node.
|
|
173
|
+
*/
|
|
174
|
+
export declare function evaluatePreprocessorExpression(condition: Condition, context: PreprocessorExpressionContext): number;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts a registered shader-include key to its canonical lookup form.
|
|
3
|
+
* @param includeKey - Logical project path, project-root path, or absolute URL.
|
|
4
|
+
* @returns Canonical registry key without the virtual shader-root prefix.
|
|
5
|
+
* @throws Error when the key is empty or an absolute URL is malformed.
|
|
6
|
+
*/
|
|
7
|
+
export declare function normalizeShaderIncludeKey(includeKey: string): string;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type { IShaderCompiler } from "./IShaderCompiler";
|
|
2
|
+
export type { Condition, DefinedCondition, NotDefinedCondition, CompareCondition, BoolCondition, NumericCondition, IdentifierCondition, UnaryCondition, BinaryCondition, DeferredCondition, ShaderInstruction } from "./ICondition";
|
|
3
|
+
export * from "./PreprocessorExpression";
|
|
4
|
+
export * from "./ShaderIncludePath";
|
|
5
|
+
export type { IPrecompiledShader, IPrecompiledSubShader, IPrecompiledPass } from "./IPrecompiledShader";
|
|
6
|
+
export type { IShaderProgramSource as IShaderInfo } from "./IShaderProgramSource";
|
|
7
|
+
export type { IRenderStates } from "./shaderSource/IRenderStates";
|
|
8
|
+
export type { IShaderPassSource } from "./shaderSource/IShaderPassSource";
|
|
9
|
+
export type { IShaderPosition } from "./shaderSource/IShaderPosition";
|
|
10
|
+
export type { IShaderSource } from "./shaderSource/IShaderSource";
|
|
11
|
+
export type { IStatement } from "./shaderSource/IStatement";
|
|
12
|
+
export type { ISubShaderSource } from "./shaderSource/ISubShaderSource";
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { IRenderStates } from "./IRenderStates";
|
|
2
|
+
import { IShaderPosition } from "./IShaderPosition";
|
|
3
|
+
import { IStatement } from "./IStatement";
|
|
4
|
+
/** Parsed ShaderLab pass structure before backend generation. */
|
|
5
|
+
export interface IShaderPassSource {
|
|
6
|
+
/** Pass name. */
|
|
7
|
+
name: string;
|
|
8
|
+
/** ShaderLab statements inherited by or declared on the pass. */
|
|
9
|
+
pendingContents: IStatement[];
|
|
10
|
+
/** Whether the pass references another pass through `UsePass`. */
|
|
11
|
+
isUsePass: boolean;
|
|
12
|
+
/** User-defined pass tags. */
|
|
13
|
+
tags?: Record<string, number | string | boolean>;
|
|
14
|
+
/** Parsed render-state constants and variables. */
|
|
15
|
+
renderStates: IRenderStates;
|
|
16
|
+
/** Shader source code. */
|
|
17
|
+
contents: string;
|
|
18
|
+
/** Start offsets of Shader, SubShader, and Pass content layers in `contents`. */
|
|
19
|
+
contentScopeStarts: readonly number[];
|
|
20
|
+
/** Vertex entry-point name. */
|
|
21
|
+
vertexEntry: string;
|
|
22
|
+
/** Fragment entry-point name. */
|
|
23
|
+
fragmentEntry: string;
|
|
24
|
+
/** Source range of the vertex entry-point name. */
|
|
25
|
+
vertexEntryLocation?: {
|
|
26
|
+
start: IShaderPosition;
|
|
27
|
+
end: IShaderPosition;
|
|
28
|
+
};
|
|
29
|
+
/** Source range of the fragment entry-point name. */
|
|
30
|
+
fragmentEntryLocation?: {
|
|
31
|
+
start: IShaderPosition;
|
|
32
|
+
end: IShaderPosition;
|
|
33
|
+
};
|
|
34
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ISpineAnimationStateData } from "./ISpineAnimationStateData";
|
|
2
|
+
import type { ISpineAnimationStateListener } from "./ISpineAnimationStateListener";
|
|
3
|
+
import type { ISpineTrackEntry } from "./ISpineTrackEntry";
|
|
4
|
+
export interface ISpineAnimationState {
|
|
5
|
+
readonly data: ISpineAnimationStateData;
|
|
6
|
+
timeScale: number;
|
|
7
|
+
setAnimation(track: number, name: string, loop: boolean): ISpineTrackEntry;
|
|
8
|
+
addAnimation(track: number, name: string, loop: boolean, delay: number): ISpineTrackEntry;
|
|
9
|
+
setEmptyAnimation(track: number, mixDuration: number): ISpineTrackEntry;
|
|
10
|
+
addEmptyAnimation(track: number, mixDuration: number, delay: number): ISpineTrackEntry;
|
|
11
|
+
setEmptyAnimations(mixDuration: number): void;
|
|
12
|
+
getCurrent(track: number): ISpineTrackEntry | null;
|
|
13
|
+
clearTrack(track: number): void;
|
|
14
|
+
clearTracks(): void;
|
|
15
|
+
addListener(listener: ISpineAnimationStateListener): void;
|
|
16
|
+
clearListeners(): void;
|
|
17
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ISpineEvent } from "./ISpineEvent";
|
|
2
|
+
import type { ISpineTrackEntry } from "./ISpineTrackEntry";
|
|
3
|
+
export interface ISpineAnimationStateListener {
|
|
4
|
+
start?(entry: ISpineTrackEntry): void;
|
|
5
|
+
interrupt?(entry: ISpineTrackEntry): void;
|
|
6
|
+
end?(entry: ISpineTrackEntry): void;
|
|
7
|
+
dispose?(entry: ISpineTrackEntry): void;
|
|
8
|
+
complete?(entry: ISpineTrackEntry): void;
|
|
9
|
+
event?(entry: ISpineTrackEntry, event: ISpineEvent): void;
|
|
10
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ISpineBoneData } from "./ISpineBoneData";
|
|
2
|
+
export interface ISpineBone {
|
|
3
|
+
readonly data: ISpineBoneData;
|
|
4
|
+
/** Local pose, before constraints. */
|
|
5
|
+
x: number;
|
|
6
|
+
y: number;
|
|
7
|
+
rotation: number;
|
|
8
|
+
scaleX: number;
|
|
9
|
+
scaleY: number;
|
|
10
|
+
shearX: number;
|
|
11
|
+
shearY: number;
|
|
12
|
+
/** Evaluated world transform. */
|
|
13
|
+
readonly a: number;
|
|
14
|
+
readonly b: number;
|
|
15
|
+
readonly c: number;
|
|
16
|
+
readonly d: number;
|
|
17
|
+
readonly worldX: number;
|
|
18
|
+
readonly worldY: number;
|
|
19
|
+
isActive(): boolean;
|
|
20
|
+
setToSetupPose(): void;
|
|
21
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** Receives CPU geometry synchronously from a backend, in skeleton draw order.
|
|
2
|
+
* The shared renderer owns the output buffers and batches. Backends may reuse their input arrays after append returns.
|
|
3
|
+
*/
|
|
4
|
+
export interface ISpineGeometry<TTexture> {
|
|
5
|
+
readonly tintBlack: boolean;
|
|
6
|
+
/** Append one drawable attachment after world vertex calculation and clipping.
|
|
7
|
+
* Input vertices contain x, y, r, g, b, a, u, v, followed by dark r, g, b, a when tintBlack is enabled.
|
|
8
|
+
* Colors are unassociated (straight) sRGB values; the shared shader converts RGB to linear.
|
|
9
|
+
* Textures use straight alpha, validated at the asset boundary.
|
|
10
|
+
* Only vertexCount vertices and indexCount indices are consumed; indices are local to this attachment.
|
|
11
|
+
* drawOrder is the slot's index in the skeleton draw order, including slots without geometry.
|
|
12
|
+
* slotIndex is its stable index in Skeleton.slots, independent of animated draw order.
|
|
13
|
+
* Blend modes: normal=0, additive=1, multiply=2, screen=3.
|
|
14
|
+
* The input arrays are copied during this call and are not retained.
|
|
15
|
+
*/
|
|
16
|
+
append(vertices: ArrayLike<number>, vertexCount: number, indices: ArrayLike<number>, indexCount: number, texture: TTexture, blendMode: 0 | 1 | 2 | 3, drawOrder: number, slotIndex: number): void;
|
|
17
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ISpinePhysicsConstraint } from "./ISpinePhysicsConstraint";
|
|
2
|
+
/** Physics participates in the skeleton's ordered constraint evaluation, not a separate simulation. */
|
|
3
|
+
export interface ISpinePhysics {
|
|
4
|
+
readonly physicsConstraints: readonly ISpinePhysicsConstraint[];
|
|
5
|
+
physicsTranslate(x: number, y: number): void;
|
|
6
|
+
physicsRotate(x: number, y: number, degrees: number): void;
|
|
7
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ISpineConstraint } from "./ISpineConstraint";
|
|
2
|
+
export interface ISpinePhysicsConstraint extends ISpineConstraint {
|
|
3
|
+
inertia: number;
|
|
4
|
+
strength: number;
|
|
5
|
+
damping: number;
|
|
6
|
+
massInverse: number;
|
|
7
|
+
wind: number;
|
|
8
|
+
gravity: number;
|
|
9
|
+
mix: number;
|
|
10
|
+
reset(): void;
|
|
11
|
+
}
|