@galacean/engine-core 2.0.0-alpha.51 → 2.0.0-alpha.53

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.
Files changed (51) hide show
  1. package/dist/main.js +9901 -8312
  2. package/dist/main.js.map +1 -1
  3. package/dist/module.js +9900 -8314
  4. package/dist/module.js.map +1 -1
  5. package/package.json +3 -5
  6. package/types/ComponentsManager.d.ts +3 -0
  7. package/types/RenderPipeline/RenderElement.d.ts +1 -1
  8. package/types/Renderer.d.ts +1 -1
  9. package/types/Scene.d.ts +1 -1
  10. package/types/Signal.d.ts +2 -0
  11. package/types/graphic/ElementRangeMapping.d.ts +9 -0
  12. package/types/graphic/TransformFeedbackPrimitive.d.ts +18 -28
  13. package/types/graphic/TransformFeedbackSimulator.d.ts +18 -18
  14. package/types/particle/ParticleBounds.d.ts +87 -0
  15. package/types/particle/ParticleBufferUtils.d.ts +18 -11
  16. package/types/particle/ParticleGenerator.d.ts +58 -85
  17. package/types/particle/ParticleRenderer.d.ts +22 -21
  18. package/types/particle/ParticleSubEmitterSpawnState.d.ts +35 -0
  19. package/types/particle/ParticleSystemManager.d.ts +17 -0
  20. package/types/particle/ParticleTransformFeedbackSimulator.d.ts +29 -29
  21. package/types/particle/enums/ParticleInheritVelocityMode.d.ts +14 -0
  22. package/types/particle/enums/ParticleRandomSubSeeds.d.ts +2 -1
  23. package/types/particle/enums/ParticleSubEmitterType.d.ts +4 -1
  24. package/types/particle/enums/attributes/ParticleFeedbackVertexAttribute.d.ts +3 -1
  25. package/types/particle/enums/attributes/ParticleInstanceVertexAttribute.d.ts +10 -8
  26. package/types/particle/index.d.ts +2 -0
  27. package/types/particle/modules/BirthSubEmitterCommand.d.ts +29 -0
  28. package/types/particle/modules/BirthSubEmitterState.d.ts +9 -0
  29. package/types/particle/modules/DeathSubEmitterCommand.d.ts +19 -0
  30. package/types/particle/modules/EmissionModule.d.ts +23 -12
  31. package/types/particle/modules/EmissionState.d.ts +13 -0
  32. package/types/particle/modules/InheritVelocityModule.d.ts +86 -0
  33. package/types/particle/modules/MainModule.d.ts +13 -7
  34. package/types/particle/modules/ParticleCompositeCurve.d.ts +4 -0
  35. package/types/particle/modules/SubEmitter.d.ts +5 -4
  36. package/types/particle/modules/SubEmittersModule.d.ts +70 -16
  37. package/types/particle/modules/VelocityOverLifetimeModule.d.ts +8 -7
  38. package/types/physics/Collider.d.ts +1 -3
  39. package/types/physics/DynamicCollider.d.ts +7 -8
  40. package/types/physics/PhysicsScene.d.ts +43 -1
  41. package/types/physics/shape/ColliderShape.d.ts +5 -2
  42. package/types/renderingHardwareInterface/IPlatformTransformFeedbackPrimitive.d.ts +10 -11
  43. package/types/shader/Shader.d.ts +13 -4
  44. package/types/shader/ShaderFactory.d.ts +9 -0
  45. package/types/shader/ShaderMacroProcessor.d.ts +10 -28
  46. package/types/shader/ShaderPass.d.ts +4 -8
  47. package/types/shader/enums/ShaderPreprocessorDirective.d.ts +7 -1
  48. package/types/shader/index.d.ts +1 -0
  49. package/types/shader/state/BlendState.d.ts +1 -1
  50. package/types/shader/state/RenderState.d.ts +1 -1
  51. package/types/physics/enums/ColliderShapeChangeFlag.d.ts +0 -8
@@ -1,32 +1,53 @@
1
- import { Color, Vector3 } from "@galacean/engine-math";
1
+ import type { ICloneHook } from "../../clone/ICloneHook";
2
+ import type { ElementRangeMapping } from "../../graphic/ElementRangeMapping";
2
3
  import { ParticleSubEmitterInheritProperty } from "../enums/ParticleSubEmitterInheritProperty";
3
4
  import { ParticleSubEmitterType } from "../enums/ParticleSubEmitterType";
4
- import { ParticleRenderer } from "../ParticleRenderer";
5
+ import type { ParticleRenderer } from "../ParticleRenderer";
6
+ import { BirthSubEmitterCommand } from "./BirthSubEmitterCommand";
7
+ import { DeathSubEmitterCommand } from "./DeathSubEmitterCommand";
5
8
  import { ParticleGeneratorModule } from "./ParticleGeneratorModule";
6
9
  import { SubEmitter } from "./SubEmitter";
7
10
  /**
8
- * Fires sub-emitters on parent particle lifecycle events (Birth / Death).
9
- * @remarks Requires WebGL2; the module stays inactive on WebGL1.
11
+ * @internal
10
12
  */
11
- export declare class SubEmittersModule extends ParticleGeneratorModule {
12
- private static _cycleVisited;
13
- private static _cycleStack;
14
- private static _wouldCreateCycle;
13
+ export type ParticleSubEmitterCommand = BirthSubEmitterCommand | DeathSubEmitterCommand;
14
+ /**
15
+ * Fires sub-emitters on parent particle birth or death.
16
+ * @remarks
17
+ * Birth uses the target's emission settings on each parent particle's simulated age.
18
+ * The target's `simulationSpeed` affects only spawned particles.
19
+ * Requires WebGL2. Birth does not support Rate over Distance.
20
+ */
21
+ export declare class SubEmittersModule extends ParticleGeneratorModule implements ICloneHook<SubEmittersModule> {
22
+ private static readonly _cycleVisited;
23
+ private static readonly _cycleStack;
15
24
  private _subEmitters;
25
+ private readonly _probabilityRand;
26
+ private readonly _startDelayRand;
27
+ private readonly _birthStatePool;
28
+ private readonly _birthCommandPool;
29
+ private readonly _deathCommandPool;
30
+ private _birthCommandScratch;
31
+ private _birthRequests;
32
+ private _birthRequestCount;
33
+ private _birthStatesByParticle;
34
+ private _particleSequence;
35
+ get enabled(): boolean;
36
+ set enabled(value: boolean);
16
37
  /**
17
38
  * The configured sub-emitters.
18
39
  */
19
40
  get subEmitters(): readonly SubEmitter[];
20
- private _probabilityRand;
21
41
  /**
22
42
  * Add a sub-emitter slot.
23
43
  * @param emitter - Target particle renderer
24
44
  * @param type - Trigger event (`Birth` / `Death`)
25
45
  * @param inheritProperties - Bitmask of properties inherited from the parent particle
26
- * @param emitProbability - Per-event fire probability [0, 1]
27
- * @param emitCount - Number of sub particles emitted per parent event
46
+ * @param emitProbability - Per-parent-particle probability [0, 1]
47
+ * @param deathEmitCount - Number of sub particles emitted when the parent dies
48
+ * @returns The created sub-emitter slot.
28
49
  */
29
- addSubEmitter(emitter: ParticleRenderer, type: ParticleSubEmitterType, inheritProperties?: ParticleSubEmitterInheritProperty, emitProbability?: number, emitCount?: number): void;
50
+ addSubEmitter(emitter: ParticleRenderer, type: ParticleSubEmitterType, inheritProperties?: ParticleSubEmitterInheritProperty, emitProbability?: number, deathEmitCount?: number): SubEmitter;
30
51
  /**
31
52
  * Remove the sub-emitter at the given index.
32
53
  * @param index - Index of the sub-emitter to remove
@@ -36,12 +57,30 @@ export declare class SubEmittersModule extends ParticleGeneratorModule {
36
57
  * Remove all sub-emitter slots.
37
58
  */
38
59
  clear(): void;
39
- get enabled(): boolean;
40
- set enabled(value: boolean);
41
60
  /**
42
61
  * @internal
43
62
  */
44
- _dispatchEvent(type: ParticleSubEmitterType, worldPosition: Vector3, parentColor: Color, parentSize: Vector3, parentRotation: Vector3, worldDirection?: Vector3): void;
63
+ _prepareDeathCommands(ringIndex: number, frameTime: number, trajectoryDuration: number): void;
64
+ /**
65
+ * @internal
66
+ */
67
+ _beginBirthCommands(): void;
68
+ /**
69
+ * @internal
70
+ */
71
+ _prepareBirthCommandsForParticle(ringIndex: number, bornTime: number, lifetime: number, frameLastPlayTime: number, framePlayTime: number, frameSimulationStart: number): void;
72
+ /**
73
+ * @internal
74
+ */
75
+ _retireParticle(ringIndex: number): void;
76
+ /**
77
+ * @internal
78
+ */
79
+ _retireAllBirthStates(): void;
80
+ /**
81
+ * @internal
82
+ */
83
+ _remapBirthStates(newParticleCount: number, mappings: ReadonlyArray<ElementRangeMapping>): void;
45
84
  /**
46
85
  * @internal
47
86
  */
@@ -49,9 +88,24 @@ export declare class SubEmittersModule extends ParticleGeneratorModule {
49
88
  /**
50
89
  * @internal
51
90
  */
52
- _hasSubEmitterOfType(type: ParticleSubEmitterType): boolean;
91
+ _hasSubEmitterOfType(type: ParticleSubEmitterType, scheduledOnly: boolean): boolean;
92
+ /**
93
+ * @inheritdoc
94
+ */
95
+ _onClone(target: SubEmittersModule): void;
53
96
  /**
54
97
  * @internal
55
98
  */
56
99
  _validateEmitter(emitter: ParticleRenderer): void;
100
+ /**
101
+ * @internal
102
+ */
103
+ _onSlotChanged(slot: SubEmitter): void;
104
+ private _resetBirthSubEmitterState;
105
+ private _recycleBirthState;
106
+ private _notifyTopologyChanged;
107
+ private _isTargetInSourceUpdateGraph;
108
+ private _validateEmitterScenes;
109
+ private _validateEmitterScene;
110
+ private static _wouldCreateCycle;
57
111
  }
@@ -1,9 +1,9 @@
1
1
  import { Rand, Vector3 } from "@galacean/engine-math";
2
2
  import { ShaderMacro } from "../../shader";
3
- import { ShaderData } from "../../shader/ShaderData";
3
+ import type { ShaderData } from "../../shader/ShaderData";
4
4
  import { ShaderProperty } from "../../shader/ShaderProperty";
5
5
  import { ParticleSimulationSpace } from "../enums/ParticleSimulationSpace";
6
- import { ParticleGenerator } from "../ParticleGenerator";
6
+ import type { ParticleGenerator } from "../ParticleGenerator";
7
7
  import { ParticleCompositeCurve } from "./ParticleCompositeCurve";
8
8
  import { ParticleGeneratorModule } from "./ParticleGeneratorModule";
9
9
  /**
@@ -71,7 +71,7 @@ export declare class VelocityOverLifetimeModule extends ParticleGeneratorModule
71
71
  /** @internal */
72
72
  static readonly _radialMaxCurveProperty: ShaderProperty;
73
73
  /** @internal */
74
- static readonly _offsetProperty: ShaderProperty;
74
+ static readonly _centerOffsetProperty: ShaderProperty;
75
75
  /** @internal */
76
76
  _velocityRand: Rand;
77
77
  private _velocityMinConstant;
@@ -79,7 +79,7 @@ export declare class VelocityOverLifetimeModule extends ParticleGeneratorModule
79
79
  private _velocityMacro;
80
80
  private _randomModeMacro;
81
81
  private _orbitalMinConstant;
82
- private _orbitalConstant;
82
+ private _orbitalMaxConstant;
83
83
  private _orbitalMacro;
84
84
  private _orbitalRandomModeMacro;
85
85
  private _radialMacro;
@@ -91,9 +91,11 @@ export declare class VelocityOverLifetimeModule extends ParticleGeneratorModule
91
91
  private _orbitalY;
92
92
  private _orbitalZ;
93
93
  private _radial;
94
- private _offset;
94
+ private _centerOffset;
95
95
  private _space;
96
96
  private readonly _onTransformFeedbackDirty;
97
+ get enabled(): boolean;
98
+ set enabled(value: boolean);
97
99
  /**
98
100
  * Velocity over lifetime for x axis.
99
101
  */
@@ -143,8 +145,6 @@ export declare class VelocityOverLifetimeModule extends ParticleGeneratorModule
143
145
  */
144
146
  get space(): ParticleSimulationSpace;
145
147
  set space(value: ParticleSimulationSpace);
146
- get enabled(): boolean;
147
- set enabled(value: boolean);
148
148
  constructor(generator: ParticleGenerator);
149
149
  /**
150
150
  * @internal
@@ -170,5 +170,6 @@ export declare class VelocityOverLifetimeModule extends ParticleGeneratorModule
170
170
  * @internal
171
171
  */
172
172
  _isRandomMode(): boolean;
173
+ private _createOrbitalRadialCurve;
173
174
  private _onOrbitalRadialChange;
174
175
  }
@@ -5,7 +5,6 @@ import { Component } from "../Component";
5
5
  import { Entity } from "../Entity";
6
6
  import { Layer } from "../Layer";
7
7
  import { ColliderShape } from "./shape/ColliderShape";
8
- import { ColliderShapeChangeFlag } from "./enums/ColliderShapeChangeFlag";
9
8
  /**
10
9
  * Base class for all colliders.
11
10
  * @decorator `@dependentComponents(Transform, DependentMode.CheckOnly)`
@@ -72,7 +71,7 @@ export declare class Collider extends Component implements ICloneHook<Collider>
72
71
  /**
73
72
  * @internal
74
73
  */
75
- _handleShapesChanged(changeType: ColliderShapeChangeFlag): void;
74
+ _handleShapesChanged(): void;
76
75
  /**
77
76
  * @internal
78
77
  */
@@ -84,5 +83,4 @@ export declare class Collider extends Component implements ICloneHook<Collider>
84
83
  protected _onDestroy(): void;
85
84
  protected _addNativeShape(shape: ColliderShape): void;
86
85
  protected _removeNativeShape(shape: ColliderShape): void;
87
- private _setCollisionLayer;
88
86
  }
@@ -1,7 +1,6 @@
1
1
  import { Quaternion, Vector3 } from "@galacean/engine-math";
2
2
  import { Entity } from "../Entity";
3
3
  import { Collider } from "./Collider";
4
- import { ColliderShapeChangeFlag } from "./enums/ColliderShapeChangeFlag";
5
4
  import { ColliderShape } from "./shape/ColliderShape";
6
5
  /**
7
6
  * A dynamic collider can act with self-defined movement or physical force.
@@ -52,26 +51,26 @@ export declare class DynamicCollider extends Collider {
52
51
  get mass(): number;
53
52
  set mass(value: number);
54
53
  /**
55
- * Whether or not to calculate the center of mass automatically, if true, the center of mass will be calculated based on the associated shapes.
56
- * @remarks Affected by the position, rotation of the shapes.
54
+ * Whether the center of mass is calculated automatically from the attached shapes.
55
+ * @remarks Disabling this preserves the current value.
57
56
  */
58
57
  get automaticCenterOfMass(): boolean;
59
58
  set automaticCenterOfMass(value: boolean);
60
59
  /**
61
60
  * The center of mass relative to the transform's origin.
62
- * @remarks The center of mass is automatically calculated, if you want to set it manually, please set automaticCenterOfMass to false.
61
+ * @remarks Set `automaticCenterOfMass` to false before changing this value.
63
62
  */
64
63
  get centerOfMass(): Vector3;
65
64
  set centerOfMass(value: Vector3);
66
65
  /**
67
- * Whether or not to calculate the inertia tensor automatically, if true, the inertia tensor will be calculated based on the associated shapes and mass.
68
- * @remarks Affected by the position, rotation of the shapes and the mass of the collider.
66
+ * Whether the inertia tensor is calculated automatically from the attached shapes and mass.
67
+ * @remarks Disabling this preserves the current value.
69
68
  */
70
69
  get automaticInertiaTensor(): boolean;
71
70
  set automaticInertiaTensor(value: boolean);
72
71
  /**
73
72
  * The diagonal inertia tensor of mass relative to the center of mass.
74
- * @remarks The inertia tensor is automatically calculated, if you want to set it manually, please set automaticInertiaTensor to false.
73
+ * @remarks Set `automaticInertiaTensor` to false before changing this value.
75
74
  */
76
75
  get inertiaTensor(): Vector3;
77
76
  set inertiaTensor(value: Vector3);
@@ -188,7 +187,7 @@ export declare class DynamicCollider extends Collider {
188
187
  /**
189
188
  * @internal
190
189
  */
191
- _handleShapesChanged(changeType: ColliderShapeChangeFlag): void;
190
+ _handleShapesChanged(): void;
192
191
  protected _syncNative(): void;
193
192
  private _setMassAndUpdateInertia;
194
193
  private _setLinearVelocity;
@@ -12,6 +12,8 @@ export declare class PhysicsScene {
12
12
  private static _collision;
13
13
  private static _identityQuaternion;
14
14
  private static _tempDirection;
15
+ private static _raycastHitPool;
16
+ private static _raycastSeenHits;
15
17
  private static _scriptIndexSetter;
16
18
  private _scene;
17
19
  private _restTime;
@@ -90,6 +92,46 @@ export declare class PhysicsScene {
90
92
  * @returns Returns True if the ray intersects with a collider, otherwise false.
91
93
  */
92
94
  raycast(ray: Ray, distance: number, layerMask: Layer, outHitResult: HitResult): boolean;
95
+ /**
96
+ * Casts a ray and writes all hits in unspecified order.
97
+ * @param ray - World-space ray; its direction is normalized internally
98
+ * @param outHitResults - Receives the hits, reusing existing objects; resized to the hit count
99
+ * @returns Whether any hit was found
100
+ *
101
+ * @remarks All result objects, including caller-supplied ones, are borrowed and overwritten on reuse.
102
+ * Copy values to retain them. Unused objects are cleared and recycled for other queries.
103
+ * Reuse the array without clearing it; manually removed objects are not pooled.
104
+ * Do not share objects across output arrays or resubmit recycled objects. Duplicate entries share the last write.
105
+ */
106
+ raycastAll(ray: Ray, outHitResults: HitResult[]): boolean;
107
+ /**
108
+ * Casts a ray and writes all hits in unspecified order.
109
+ * @param ray - World-space ray; its direction is normalized internally
110
+ * @param distance - Maximum query distance; non-positive values return no hits
111
+ * @param outHitResults - Receives the hits, reusing existing objects; resized to the hit count
112
+ * @returns Whether any hit was found
113
+ *
114
+ * @remarks All result objects, including caller-supplied ones, are borrowed and overwritten on reuse.
115
+ * Copy values to retain them. Unused objects are cleared and recycled for other queries.
116
+ * Reuse the array without clearing it; manually removed objects are not pooled.
117
+ * Do not share objects across output arrays or resubmit recycled objects. Duplicate entries share the last write.
118
+ */
119
+ raycastAll(ray: Ray, distance: number, outHitResults: HitResult[]): boolean;
120
+ /**
121
+ * Casts a ray and optionally writes all hits in unspecified order.
122
+ * @param ray - World-space ray; its direction is normalized internally
123
+ * @param distance - Maximum query distance; defaults to `Number.MAX_VALUE`
124
+ * @param layerMask - Collision layers to include; defaults to `Layer.Everything`
125
+ * @param outHitResults - Receives the hits; resized to the hit count. Omit to test for a hit only
126
+ * @returns Whether any hit was found
127
+ *
128
+ * @remarks All result objects, including caller-supplied ones, are borrowed and overwritten on reuse.
129
+ * Copy values to retain them. Unused objects are cleared and recycled for other queries.
130
+ * Reuse the array without clearing it; manually removed objects are not pooled.
131
+ * Do not share objects across output arrays or resubmit recycled objects. Duplicate entries share the last write.
132
+ * Non-positive distances or directions that cannot be normalized clear the output; hits at distance 0 are ignored.
133
+ */
134
+ raycastAll(ray: Ray, distance?: number, layerMask?: Layer, outHitResults?: HitResult[]): boolean;
93
135
  /**
94
136
  * Casts a box through the Scene and returns true if there is any hit.
95
137
  * @param center - The center of the box
@@ -320,7 +362,7 @@ export declare class PhysicsScene {
320
362
  private _dispatchEvents;
321
363
  private static _normalizeDirection;
322
364
  private _setGravity;
323
- private _createPreFilter;
324
365
  private _createHitCallback;
366
+ private _setHitResult;
325
367
  private _clearHitResult;
326
368
  }
@@ -18,15 +18,18 @@ export declare abstract class ColliderShape extends DataObject implements IClone
18
18
  protected _id: number;
19
19
  protected _material: PhysicsMaterial;
20
20
  private _isTrigger;
21
+ private _isSceneQuery;
21
22
  private _rotation;
22
23
  private _position;
23
24
  private _contactOffset;
24
25
  /**
25
26
  * @internal
26
27
  * @beta
27
- * Whether raycast can select it.
28
+ * Whether this shape participates in scene queries, including raycasts, shape casts, and overlap queries.
29
+ * This does not affect collision response.
28
30
  */
29
- isSceneQuery: boolean;
31
+ get isSceneQuery(): boolean;
32
+ set isSceneQuery(value: boolean);
30
33
  /**
31
34
  * Collider owner of this shape.
32
35
  */
@@ -1,23 +1,22 @@
1
+ import type { IPlatformShaderProgram } from "@galacean/engine-design";
2
+ import type { VertexBufferBinding } from "../graphic/VertexBufferBinding";
3
+ import type { VertexElement } from "../graphic/VertexElement";
1
4
  /**
2
5
  * Platform interface for Transform Feedback primitive operations.
3
6
  * @internal
4
7
  */
5
8
  export interface IPlatformTransformFeedbackPrimitive {
6
9
  /**
7
- * Update vertex layout. Auto-rebuilds when program changes.
10
+ * Bind the read layout, rebuilding cached state when its inputs change.
8
11
  * @param program - Shader program (for attribute locations)
9
- * @param readBinding - Current read buffer binding
10
- * @param writeBinding - Current write buffer binding
12
+ * @param bindingA - First feedback buffer binding
13
+ * @param bindingB - Second feedback buffer binding
11
14
  * @param feedbackElements - Vertex elements for feedback buffer
12
- * @param inputBinding - Input buffer binding
13
- * @param inputElements - Vertex elements for input buffer
14
- */
15
- updateVertexLayout(program: any, readBinding: any, writeBinding: any, feedbackElements: any[], inputBinding: any, inputElements: any[]): void;
16
- /**
17
- * Bind attribute state for the given read direction.
15
+ * @param inputBindings - Input buffer bindings
16
+ * @param inputElements - Vertex elements for input buffers
18
17
  * @param readIsA - Whether to use direction A as read
19
18
  */
20
- bind(readIsA: boolean): void;
19
+ bind(program: IPlatformShaderProgram, bindingA: VertexBufferBinding, bindingB: VertexBufferBinding, feedbackElements: VertexElement[], inputBindings: VertexBufferBinding[], inputElements: VertexElement[], readIsA: boolean): void;
21
20
  /**
22
21
  * Unbind attribute state.
23
22
  */
@@ -30,7 +29,7 @@ export interface IPlatformTransformFeedbackPrimitive {
30
29
  */
31
30
  draw(mode: number, first: number, count: number): void;
32
31
  /**
33
- * Invalidate cached state, forcing rebuild on next updateVertexLayout.
32
+ * Invalidate cached state, forcing rebuild on next bind.
34
33
  */
35
34
  invalidate(): void;
36
35
  /**
@@ -33,13 +33,12 @@ export declare class Shader implements IReferable {
33
33
  *
34
34
  * @param shaderSource - Shader code
35
35
  * @param platformTarget - Shader platform target, @defaultValue ShaderLanguage.GLSLES100
36
- * @param path - Shader location path, used to resolve relative `#include` paths in ShaderLab source
37
36
  * @returns The shader, or `undefined` if its name already exists.
38
37
  *
39
38
  * @throws
40
39
  * Throw string exception if the shader compiler has not been enabled properly.
41
40
  */
42
- static create(shaderSource: string, platformTarget?: ShaderLanguage, path?: string): Shader | undefined;
41
+ static create(shaderSource: string, platformTarget?: ShaderLanguage): Shader | undefined;
43
42
  /**
44
43
  * Create a shader.
45
44
  * @param name - Name of the shader
@@ -54,6 +53,16 @@ export declare class Shader implements IReferable {
54
53
  * @returns The shader, or `undefined` if its name already exists.
55
54
  */
56
55
  static create(name: string, subShaders: SubShader[]): Shader | undefined;
56
+ /**
57
+ * Creates a shader while retaining loader-owned source location metadata for relative includes.
58
+ * @param shaderSource - Complete ShaderLab source.
59
+ * @param platformTarget - Shader backend target.
60
+ * @param sourceFile - Canonical source location supplied by an asset loader or authoring tool.
61
+ * @returns The compiled shader, or `undefined` if its name already exists.
62
+ * @throws When the shader compiler is unavailable or a pass cannot be compiled.
63
+ * @internal
64
+ */
65
+ static _createFromSource(shaderSource: string, platformTarget?: ShaderLanguage, sourceFile?: string): Shader | undefined;
57
66
  /**
58
67
  * Find a shader by name.
59
68
  * @param name - Name of the shader
@@ -86,11 +95,11 @@ export declare class Shader implements IReferable {
86
95
  * Compile shader variant by macro name list.
87
96
  *
88
97
  * @remarks
89
- * Usually a shader contains some macros,any combination of macros is called shader variant.
98
+ * Skips Transform Feedback passes, which require a runtime-provided output layout.
90
99
  *
91
100
  * @param engine - Engine to which the shader variant belongs
92
101
  * @param macros - Macro name list
93
- * @returns Is the compiled shader variant valid
102
+ * @returns Whether the variant is valid; false if all passes are skipped.
94
103
  */
95
104
  compileVariant(engine: Engine, macros: string[]): boolean;
96
105
  /**
@@ -22,11 +22,20 @@ export declare class ShaderFactory {
22
22
  * Register a chunk source so `#include` resolves it.
23
23
  * @param includeName - The path key referenced in `#include "..."`.
24
24
  * @param includeSource - GLSL chunk source text.
25
+ * @throws Error when the key is empty, malformed, or already registered after normalization.
25
26
  */
26
27
  static registerInclude(includeName: string, includeSource: string): void;
27
28
  /**
28
29
  * Remove a registered shader chunk.
29
30
  * @param includeName - The path key passed to `registerInclude`.
31
+ * @throws Error when the key is empty or malformed.
32
+ */
33
+ static unregisterInclude(includeName: string): void;
34
+ /**
35
+ * Remove a registered shader chunk.
36
+ * @param includeName - The path key passed to `registerInclude`.
37
+ * @deprecated Use `unregisterInclude`.
38
+ * @throws Error when the key is empty or malformed.
30
39
  */
31
40
  static unRegisterInclude(includeName: string): void;
32
41
  /**
@@ -1,4 +1,4 @@
1
- import type { ShaderInstruction } from "@galacean/engine-design";
1
+ import { type ShaderInstruction } from "@galacean/engine-design";
2
2
  /**
3
3
  * @internal
4
4
  */
@@ -6,16 +6,21 @@ export declare class ShaderMacroProcessor {
6
6
  private static _valueMacros;
7
7
  private static _funcMacros;
8
8
  private static _shaderChunks;
9
+ private static readonly _declarationGroups;
10
+ private static readonly _activeDeclarations;
11
+ private static readonly _ownedChunks;
12
+ private static readonly _references;
13
+ private static readonly _reachableDeclarations;
14
+ private static readonly _pendingDeclarations;
9
15
  private static _out;
10
- private static _expandedNames;
11
16
  private static _macroFirstChars;
12
17
  private static _macroFirstCharsDirty;
13
- private static _replaceWordParts;
14
- private static _parsedFuncArgs;
18
+ private static readonly _expressionContext;
15
19
  /**
16
20
  * Evaluate a flat instruction array with active macros.
17
21
  * Macros are expanded immediately when text chunks are collected,
18
22
  * using the current macro state at that point (conforming to GLSL/C99 §6.10 standard).
23
+ * Declaration ownership filters buffered text after execution; it never skips macro directives.
19
24
  * @param instructions - Pre-parsed instruction array
20
25
  * @param macros - Active runtime macros
21
26
  * @returns Pure GLSL string with all conditionals resolved and macros expanded
@@ -26,35 +31,12 @@ export declare class ShaderMacroProcessor {
26
31
  * Returns the chunk as-is if no expandable macros exist.
27
32
  */
28
33
  private static _expandChunk;
29
- /**
30
- * Recursively expand macro substitution results until no more macros remain.
31
- * @param macroExpansion - Intermediate text from a macro substitution that may contain further macro references
32
- * @param valueMacros - Current value macro definitions
33
- * @param funcMacros - Current function macro definitions
34
- * @param expandedNames - Macro names already on the expansion chain, prevents circular references (C99 §6.10.3.4)
35
- */
36
- private static _recursiveExpandMacro;
37
- /**
38
- * Substitute function macro params in body.
39
- */
40
- private static _expandFuncBody;
41
34
  /**
42
35
  * Evaluate a compound condition tree.
43
36
  */
44
37
  private static _evalCondition;
45
- /**
46
- * Evaluate a comparison operator.
47
- */
38
+ private static _evalDeferredCondition;
48
39
  private static _compareValues;
49
- /**
50
- * Parse function macro call arguments.
51
- * Returns reusable static result object to avoid allocation.
52
- */
53
- private static _parseFuncArgs;
54
- /**
55
- * Replace all whole-word occurrences of `word` in `text` with `replacement`.
56
- */
57
- private static _replaceWord;
58
40
  /**
59
41
  * Concatenate shader chunks with consecutive blank lines collapsed to a single newline.
60
42
  */
@@ -13,8 +13,8 @@ import { RenderState } from "./state/RenderState";
13
13
  export declare class ShaderPass extends ShaderPart {
14
14
  /** @internal */
15
15
  static _shaderPassCounter: number;
16
- /** @internal */
17
- static _shaderRootPath: string;
16
+ private static _shaderMacroList;
17
+ private static _macroMap;
18
18
  /** @internal */
19
19
  _platformTarget: ShaderLanguage;
20
20
  /** @internal - Flat instruction array for vertex shader. */
@@ -29,10 +29,6 @@ export declare class ShaderPass extends ShaderPart {
29
29
  _renderStateDataMap: Record<number, ShaderProperty>;
30
30
  /** @internal */
31
31
  _shaderProgramMaps: ShaderProgramMap[];
32
- /** @internal Transform feedback output varyings (WebGL2 only). */
33
- _feedbackVaryings?: string[];
34
- private static _shaderMacroList;
35
- private static _macroMap;
36
32
  /**
37
33
  * Create a shader pass from precompiled instructions.
38
34
  * @param name - Shader pass name
@@ -45,7 +41,7 @@ export declare class ShaderPass extends ShaderPart {
45
41
  /**
46
42
  * @internal
47
43
  */
48
- _getShaderProgram(engine: Engine, macroCollection: ShaderMacroCollection): ShaderProgram;
44
+ _getShaderProgram(engine: Engine, macroCollection: ShaderMacroCollection, feedbackVaryings?: string[]): ShaderProgram;
49
45
  /**
50
46
  * @internal
51
47
  */
@@ -53,6 +49,6 @@ export declare class ShaderPass extends ShaderPart {
53
49
  /**
54
50
  * @internal
55
51
  */
56
- _compileShaderProgram(engine: Engine, macroCollection: ShaderMacroCollection): ShaderProgram;
52
+ _compileShaderProgram(engine: Engine, macroCollection: ShaderMacroCollection, feedbackVaryings?: string[]): ShaderProgram;
57
53
  private _compileShaderSource;
58
54
  }
@@ -12,5 +12,11 @@ export declare enum ShaderPreprocessorDirective {
12
12
  Define = 7,
13
13
  DefineVal = 8,
14
14
  DefineFunc = 9,
15
- Undef = 10
15
+ Undef = 10,
16
+ /** Activates a declaration: [ownerId, groupId, sourceScope]. */
17
+ Declaration = 11,
18
+ /** Text retained when any listed declaration is selected and reachable: [text, ...ownerIds]. */
19
+ OwnedText = 12,
20
+ /** Declaration dependency: [fromOwnerId, toOwnerId]; owner zero denotes a stage root. */
21
+ Reference = 13
16
22
  }
@@ -7,6 +7,7 @@ export { RenderQueueType } from "./enums/RenderQueueType";
7
7
  export { RenderStateElementKey } from "./enums/RenderStateElementKey";
8
8
  export { ShaderDataGroup } from "./enums/ShaderDataGroup";
9
9
  export { ShaderLanguage } from "./enums/ShaderLanguage";
10
+ export { ShaderPreprocessorDirective } from "./enums/ShaderPreprocessorDirective";
10
11
  export { ShaderPropertyType } from "./enums/ShaderPropertyType";
11
12
  export { StencilOperation } from "./enums/StencilOperation";
12
13
  export { Shader } from "./Shader";
@@ -21,7 +21,7 @@ export declare class BlendState extends DataObject {
21
21
  /**
22
22
  * @internal
23
23
  */
24
- _applyShaderDataValue(renderStateDataMap: Record<number, ShaderProperty>, shaderData: ShaderData): void;
24
+ _applyShaderDataValue(renderStateDataMap: Record<number, ShaderProperty>, shaderData: ShaderData, renderElementData?: ShaderData): void;
25
25
  /**
26
26
  * @internal
27
27
  * Apply the current blend state by comparing with the last blend state.
@@ -24,7 +24,7 @@ export declare class RenderState extends DataObject {
24
24
  /**
25
25
  * @internal
26
26
  */
27
- _applyStates(engine: Engine, frontFaceInvert: boolean, renderStateDataMap: Record<number, ShaderProperty>, shaderData: ShaderData, customRenderStates?: RenderStateElementMap | null): void;
27
+ _applyStates(engine: Engine, frontFaceInvert: boolean, renderStateDataMap: Record<number, ShaderProperty>, shaderData: ShaderData, customRenderStates?: RenderStateElementMap | null, renderElementData?: ShaderData): void;
28
28
  /**
29
29
  * @internal
30
30
  */
@@ -1,8 +0,0 @@
1
- /**
2
- * @internal
3
- */
4
- export declare enum ColliderShapeChangeFlag {
5
- Property = 1,
6
- Count = 2,
7
- Both = 3
8
- }