@galacean/engine-core 2.0.0-alpha.33 → 2.0.0-alpha.35

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 (34) hide show
  1. package/dist/main.js +20388 -19303
  2. package/dist/main.js.map +1 -1
  3. package/dist/module.js +20385 -19304
  4. package/dist/module.js.map +1 -1
  5. package/package.json +3 -3
  6. package/types/EngineEventType.d.ts +13 -0
  7. package/types/Entity.d.ts +4 -4
  8. package/types/RenderPipeline/BasicRenderPipeline.d.ts +1 -1
  9. package/types/RenderPipeline/RenderElement.d.ts +17 -6
  10. package/types/RenderPipeline/index.d.ts +2 -1
  11. package/types/Renderer.d.ts +7 -9
  12. package/types/animation/Animator.d.ts +14 -8
  13. package/types/animation/AnimatorStateInstance.d.ts +38 -0
  14. package/types/animation/AnimatorStateMachine.d.ts +2 -2
  15. package/types/animation/index.d.ts +1 -0
  16. package/types/asset/AssetType.d.ts +1 -1
  17. package/types/graphic/enums/BufferBindFlag.d.ts +3 -1
  18. package/types/index.d.ts +2 -1
  19. package/types/particle/ParticleGenerator.d.ts +3 -0
  20. package/types/particle/ParticleMaterial.d.ts +3 -1
  21. package/types/particle/ParticleRenderer.d.ts +1 -1
  22. package/types/particle/index.d.ts +1 -0
  23. package/types/particle/modules/CustomDataModule.d.ts +81 -0
  24. package/types/particle/modules/EmissionModule.d.ts +7 -0
  25. package/types/shader/ShaderBlockProperty.d.ts +1 -0
  26. package/types/shader/ShaderData.d.ts +2 -0
  27. package/types/shader/ShaderFactory.d.ts +29 -2
  28. package/types/shader/ShaderPass.d.ts +0 -1
  29. package/types/shader/ShaderProgramMap.d.ts +1 -0
  30. package/types/shader/enums/ConstantBufferBindingPoint.d.ts +1 -0
  31. package/types/trail/TrailRenderer.d.ts +1 -1
  32. package/types/RenderPipeline/SubRenderElement.d.ts +0 -22
  33. /package/types/RenderPipeline/{BatchUtils.d.ts → InstanceBuffer.d.ts} +0 -0
  34. /package/types/{shader/ShaderProgramPool.d.ts → RenderPipeline/VertexMergeBatcher.d.ts} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@galacean/engine-core",
3
- "version": "2.0.0-alpha.33",
3
+ "version": "2.0.0-alpha.35",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org"
@@ -18,10 +18,10 @@
18
18
  "types/**/*"
19
19
  ],
20
20
  "dependencies": {
21
- "@galacean/engine-math": "2.0.0-alpha.33"
21
+ "@galacean/engine-math": "2.0.0-alpha.35"
22
22
  },
23
23
  "devDependencies": {
24
- "@galacean/engine-design": "2.0.0-alpha.33"
24
+ "@galacean/engine-design": "2.0.0-alpha.35"
25
25
  },
26
26
  "scripts": {
27
27
  "b:types": "tsc"
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Engine event type.
3
+ */
4
+ export declare enum EngineEventType {
5
+ /** Dispatched when the engine starts running. */
6
+ Run = "run",
7
+ /** Dispatched when the engine shuts down. */
8
+ Shutdown = "shutdown",
9
+ /** Dispatched when the graphic device is lost. */
10
+ DeviceLost = "devicelost",
11
+ /** Dispatched when the graphic device is restored. */
12
+ DeviceRestored = "devicerestored"
13
+ }
package/types/Entity.d.ts CHANGED
@@ -109,19 +109,19 @@ export declare class Entity extends EngineObject {
109
109
  * @deprecated Please use `children` property instead.
110
110
  * Find child entity by index.
111
111
  * @param index - The index of the child entity
112
- * @returns The component which be found
112
+ * @returns The entity that was found
113
113
  */
114
114
  getChild(index: number): Entity;
115
115
  /**
116
116
  * Find entity by name.
117
- * @param name - The name of the entity which want to be found
118
- * @returns The component which be found
117
+ * @param name - The name of the entity to find
118
+ * @returns The entity that was found
119
119
  */
120
120
  findByName(name: string): Entity;
121
121
  /**
122
122
  * Find the entity by path.
123
123
  * @param path - The path of the entity eg: /entity
124
- * @returns The component which be found
124
+ * @returns The entity that was found
125
125
  */
126
126
  findByPath(path: string): Entity;
127
127
  /**
@@ -42,7 +42,7 @@ export declare class BasicRenderPipeline {
42
42
  * @param renderElement - Render element
43
43
  */
44
44
  pushRenderElement(context: RenderContext, renderElement: RenderElement): void;
45
- private pushRenderElementByType;
45
+ private _pushRenderElementByType;
46
46
  private _drawBackgroundTexture;
47
47
  private _prepareRender;
48
48
  }
@@ -1,12 +1,23 @@
1
+ import { Renderer } from "../Renderer";
2
+ import { Primitive, SubMesh } from "../graphic";
3
+ import { Material } from "../material";
4
+ import { ShaderData, SubShader } from "../shader";
5
+ import { Texture2D } from "../texture";
1
6
  import { IPoolElement } from "../utils/ObjectPool";
2
- import { RenderQueueFlags } from "./BasicRenderPipeline";
3
- import { SubRenderElement } from "./SubRenderElement";
7
+ import { SubPrimitiveChunk } from "./SubPrimitiveChunk";
4
8
  export declare class RenderElement implements IPoolElement {
5
9
  priority: number;
6
10
  distanceForSort: number;
7
- subRenderElements: SubRenderElement[];
8
- renderQueueFlags: RenderQueueFlags;
9
- set(priority: number, distanceForSort: number): void;
10
- addSubRenderElement(element: SubRenderElement): void;
11
+ component: Renderer;
12
+ primitive: Primitive;
13
+ material: Material;
14
+ subPrimitive: SubMesh;
15
+ subShader: SubShader;
16
+ shaderData?: ShaderData;
17
+ instancedRenderers: Renderer[];
18
+ subDistancePriority: number;
19
+ texture?: Texture2D;
20
+ subChunk?: SubPrimitiveChunk;
21
+ set(component: Renderer, material: Material, primitive: Primitive, subPrimitive: SubMesh, texture?: Texture2D, subChunk?: SubPrimitiveChunk): void;
11
22
  dispose(): void;
12
23
  }
@@ -1,5 +1,6 @@
1
1
  export { BasicRenderPipeline, RenderQueueFlags } from "./BasicRenderPipeline";
2
- export { BatchUtils } from "./BatchUtils";
2
+ export { VertexMergeBatcher } from "./VertexMergeBatcher";
3
3
  export { Blitter } from "./Blitter";
4
+ export { RenderElement } from "./RenderElement";
4
5
  export { RenderQueue } from "./RenderQueue";
5
6
  export { PipelineStage } from "./enums/PipelineStage";
@@ -1,4 +1,4 @@
1
- import { BoundingBox, Matrix, Vector4 } from "@galacean/engine-math";
1
+ import { BoundingBox, Vector4 } from "@galacean/engine-math";
2
2
  import { Component } from "./Component";
3
3
  import { Entity } from "./Entity";
4
4
  import { RenderContext } from "./RenderPipeline/RenderContext";
@@ -13,13 +13,9 @@ import { ShaderData } from "./shader/ShaderData";
13
13
  export declare class Renderer extends Component {
14
14
  private static _tempVector0;
15
15
  private static _receiveShadowMacro;
16
- private static _localMatrixProperty;
17
- private static _worldMatrixProperty;
18
16
  private static _mvMatrixProperty;
19
17
  private static _mvpMatrixProperty;
20
- private static _mvInvMatrixProperty;
21
18
  private static _normalMatrixProperty;
22
- private static _rendererLayerProperty;
23
19
  _renderFrameCount: number;
24
20
  _maskLayer: SpriteMaskLayer;
25
21
  protected _overrideUpdate: boolean;
@@ -31,7 +27,6 @@ export declare class Renderer extends Component {
31
27
  private _shaderData;
32
28
  private _mvMatrix;
33
29
  private _mvpMatrix;
34
- private _mvInvMatrix;
35
30
  private _normalMatrix;
36
31
  private _materialsInstanced;
37
32
  private _priority;
@@ -117,11 +112,14 @@ export declare class Renderer extends Component {
117
112
  setMaterials(materials: Material[]): void;
118
113
  update(deltaTime: number): void;
119
114
  /**
120
- * Update once per frame per renderer, not influenced by batched.
115
+ * Update once per frame per renderer.
121
116
  */
122
117
  protected _update(context: RenderContext): void;
123
- protected _updateWorldViewRelatedShaderData(context: RenderContext, worldMatrix: Matrix, batched: boolean): void;
124
- protected _updateProjectionRelatedShaderData(context: RenderContext, worldMatrix: Matrix, batched: boolean): void;
118
+ /**
119
+ * Update transform shader data for world-space vertices (2D renderers).
120
+ * Vertices are already in world space, so model matrix is identity.
121
+ */
122
+ protected _updateWorldSpaceTransformShaderData(context: RenderContext, onlyMVP: boolean): void;
125
123
  protected _updateBounds(worldBounds: BoundingBox): void;
126
124
  protected _render(context: RenderContext): void;
127
125
  private _createInstanceMaterial;
@@ -3,13 +3,14 @@ import { Component } from "../Component";
3
3
  import { AnimatorController } from "./AnimatorController";
4
4
  import { AnimatorControllerLayer } from "./AnimatorControllerLayer";
5
5
  import { AnimatorControllerParameter, AnimatorControllerParameterValue } from "./AnimatorControllerParameter";
6
- import { AnimatorState } from "./AnimatorState";
6
+ import { AnimatorStateInstance } from "./AnimatorStateInstance";
7
7
  import { AnimatorCullingMode } from "./enums/AnimatorCullingMode";
8
8
  /**
9
9
  * The controller of the animation system.
10
10
  */
11
11
  export declare class Animator extends Component {
12
12
  private static _passedTriggerParameterNames;
13
+ private static _tempScripts;
13
14
  /** Culling mode of this Animator. */
14
15
  cullingMode: AnimatorCullingMode;
15
16
  /** The playback speed of the Animator, 1.0 is normal playback speed. */
@@ -19,7 +20,6 @@ export declare class Animator extends Component {
19
20
  protected _updateMark: number;
20
21
  private _animatorLayersData;
21
22
  private _curveOwnerPool;
22
- private _animationEventHandlerPool;
23
23
  private _parametersValueMap;
24
24
  private _tempAnimatorStateInfo;
25
25
  private _controlledRenderers;
@@ -65,16 +65,21 @@ export declare class Animator extends Component {
65
65
  */
66
66
  update(deltaTime: number): void;
67
67
  /**
68
- * Get the playing state from the target layerIndex.
68
+ * Get the state instance currently playing on the target layer.
69
69
  * @param layerIndex - The layer index
70
+ * @returns The state instance, or null if nothing is playing
71
+ * @remarks The returned instance is tied to the current controller's layer data. After a controller structure change (layers added or removed), the instance is invalidated; re-call this method to get a fresh one.
70
72
  */
71
- getCurrentAnimatorState(layerIndex: number): AnimatorState;
73
+ getCurrentAnimatorState(layerIndex: number): AnimatorStateInstance | null;
72
74
  /**
73
- * Get the state by name.
75
+ * Get the state instance for a named state on this Animator.
76
+ * Overrides on the returned instance only affect this Animator.
74
77
  * @param stateName - The state name
75
- * @param layerIndex - The layer index(default -1). If layer is -1, find the first state with the given state name
78
+ * @param layerIndex - The layer index (default -1, searches all layers)
79
+ * @returns The state instance, or null if no state matches
80
+ * @remarks The returned instance is tied to the current controller's layer data. After a controller structure change (layers added or removed), the instance is invalidated; re-call this method to get a fresh one.
76
81
  */
77
- findAnimatorState(stateName: string, layerIndex?: number): AnimatorState;
82
+ findAnimatorState(stateName: string, layerIndex?: number): AnimatorStateInstance | null;
78
83
  /**
79
84
  * Get the layer by name.
80
85
  * @param name - The layer's name.
@@ -107,12 +112,13 @@ export declare class Animator extends Component {
107
112
  * @param name - The name of the trigger parameter
108
113
  */
109
114
  deactivateTriggerParameter(name: string): void;
115
+ private _resetIfControllerUpdated;
110
116
  protected _onDestroy(): void;
111
117
  private _crossFade;
112
118
  private _getAnimatorStateInfo;
113
119
  private _getAnimatorStateData;
114
120
  private _saveAnimatorStateData;
115
- private _saveAnimatorEventHandlers;
121
+ private _ensureEventHandlers;
116
122
  private _clearCrossData;
117
123
  private _addCrossOwner;
118
124
  private _prepareCrossFading;
@@ -0,0 +1,38 @@
1
+ import { AnimationClip } from "./AnimationClip";
2
+ import { WrapMode } from "./enums/WrapMode";
3
+ /**
4
+ * Per-Animator view of an `AnimatorState`.
5
+ *
6
+ * Override fields (speed, wrapMode) are scoped to this Animator; unset fields
7
+ * fall through to the underlying state asset.
8
+ */
9
+ export declare class AnimatorStateInstance {
10
+ private _speed;
11
+ private _wrapMode;
12
+ /**
13
+ * The name of the underlying state.
14
+ */
15
+ get name(): string;
16
+ /**
17
+ * The animation clip of the underlying state.
18
+ */
19
+ get clip(): AnimationClip;
20
+ /**
21
+ * The normalized clip start time of the underlying state.
22
+ */
23
+ get clipStartTime(): number;
24
+ /**
25
+ * The normalized clip end time of the underlying state.
26
+ */
27
+ get clipEndTime(): number;
28
+ /**
29
+ * Playback speed for this Animator; overrides the underlying state when set.
30
+ */
31
+ get speed(): number;
32
+ set speed(value: number);
33
+ /**
34
+ * Wrap mode for this Animator; overrides the underlying state when set.
35
+ */
36
+ get wrapMode(): WrapMode;
37
+ set wrapMode(value: WrapMode);
38
+ }
@@ -12,9 +12,9 @@ export declare class AnimatorStateMachine {
12
12
  private _engine;
13
13
  /**
14
14
  * The state will be played automatically.
15
- * @remarks When the Animator's AnimatorController changed or the Animator's onEnable be triggered.
15
+ * @remarks When the Animator's AnimatorController changed or the Animator's onEnable be triggered. Cleared to `null` if the state is removed via `removeState`.
16
16
  */
17
- defaultState: AnimatorState;
17
+ defaultState: AnimatorState | null;
18
18
  private _statesMap;
19
19
  /**
20
20
  * The list of entry transitions in the state machine.
@@ -10,6 +10,7 @@ export { Animator } from "./Animator";
10
10
  export { AnimatorController } from "./AnimatorController";
11
11
  export { AnimatorControllerLayer } from "./AnimatorControllerLayer";
12
12
  export { AnimatorState } from "./AnimatorState";
13
+ export { AnimatorStateInstance } from "./AnimatorStateInstance";
13
14
  export { AnimatorStateMachine } from "./AnimatorStateMachine";
14
15
  export { AnimatorStateTransition } from "./AnimatorStateTransition";
15
16
  export { AnimatorConditionMode } from "./enums/AnimatorConditionMode";
@@ -44,7 +44,7 @@ export declare enum AssetType {
44
44
  Font = "Font",
45
45
  /** Source Font, include ttf, otf and woff. */
46
46
  SourceFont = "SourceFont",
47
- /** AudioClip, include ogg, wav and mp3. */
47
+ /** AudioClip, include ogg, wav, mp3, m4a, aac and flac. */
48
48
  Audio = "Audio",
49
49
  /** Project asset. */
50
50
  Project = "project",
@@ -5,5 +5,7 @@ export declare enum BufferBindFlag {
5
5
  /** Vertex buffer binding flag. */
6
6
  VertexBuffer = 0,
7
7
  /** Index buffer binding flag. */
8
- IndexBuffer = 1
8
+ IndexBuffer = 1,
9
+ /** Constant buffer binding flag (WebGL2 only). */
10
+ ConstantBuffer = 2
9
11
  }
package/types/index.d.ts CHANGED
@@ -14,8 +14,9 @@ export { dependentComponents, DependentMode } from "./ComponentsDependencies";
14
14
  export { Camera } from "./Camera";
15
15
  export { Transform, TransformModifyFlags } from "./Transform";
16
16
  export { BoolUpdateFlag } from "./BoolUpdateFlag";
17
- export type { EngineSettings } from "./EngineSettings";
18
17
  export type { EngineConfiguration } from "./Engine";
18
+ export { EngineEventType } from "./EngineEventType";
19
+ export type { EngineSettings } from "./EngineSettings";
19
20
  export type { ComponentConstructor } from "./Entity";
20
21
  export { request } from "./asset/request";
21
22
  export type { RequestConfig } from "./asset/request";
@@ -1,5 +1,6 @@
1
1
  import { ParticleStopMode } from "./enums/ParticleStopMode";
2
2
  import { ColorOverLifetimeModule } from "./modules/ColorOverLifetimeModule";
3
+ import { CustomDataModule } from "./modules/CustomDataModule";
3
4
  import { EmissionModule } from "./modules/EmissionModule";
4
5
  import { ForceOverLifetimeModule } from "./modules/ForceOverLifetimeModule";
5
6
  import { LimitVelocityOverLifetimeModule } from "./modules/LimitVelocityOverLifetimeModule";
@@ -47,6 +48,8 @@ export declare class ParticleGenerator {
47
48
  readonly textureSheetAnimation: TextureSheetAnimationModule;
48
49
  /** Noise module. */
49
50
  readonly noise: NoiseModule;
51
+ /** Custom data module. */
52
+ readonly customData: CustomDataModule;
50
53
  private _isPlaying;
51
54
  private _instanceBufferResized;
52
55
  private _waitProcessRetiredElementCount;
@@ -1,5 +1,6 @@
1
1
  import { Engine } from "../Engine";
2
2
  import { EffectMaterial } from "../material/EffectMaterial";
3
+ import { Shader } from "../shader/Shader";
3
4
  /**
4
5
  * Particle Material.
5
6
  */
@@ -7,8 +8,9 @@ export declare class ParticleMaterial extends EffectMaterial {
7
8
  /**
8
9
  * Create a particle material instance.
9
10
  * @param engine - Engine to which the material belongs
11
+ * @param shader - Shader used by the material
10
12
  */
11
- constructor(engine: Engine);
13
+ constructor(engine: Engine, shader?: Shader);
12
14
  /**
13
15
  * @inheritdoc
14
16
  */
@@ -25,9 +25,9 @@ export declare class ParticleRenderer extends Renderer {
25
25
  lengthScale: number;
26
26
  /** The pivot of particle. */
27
27
  pivot: Vector3;
28
+ private _mesh;
28
29
  private _renderMode;
29
30
  private _currentRenderModeMacro;
30
- private _mesh;
31
31
  private _supportInstancedArrays;
32
32
  /**
33
33
  * Specifies how particles are rendered.
@@ -9,6 +9,7 @@ export { ParticleSimulationSpace } from "./enums/ParticleSimulationSpace";
9
9
  export { ParticleStopMode } from "./enums/ParticleStopMode";
10
10
  export { Burst } from "./modules/Burst";
11
11
  export { ColorOverLifetimeModule } from "./modules/ColorOverLifetimeModule";
12
+ export { CustomDataModule } from "./modules/CustomDataModule";
12
13
  export { EmissionModule } from "./modules/EmissionModule";
13
14
  export { MainModule } from "./modules/MainModule";
14
15
  export { ParticleCompositeCurve } from "./modules/ParticleCompositeCurve";
@@ -0,0 +1,81 @@
1
+ import { ParticleCompositeCurve } from "./ParticleCompositeCurve";
2
+ import { ParticleCompositeGradient } from "./ParticleCompositeGradient";
3
+ import { ParticleGeneratorModule } from "./ParticleGeneratorModule";
4
+ /**
5
+ * Custom data module — exposes any number of named per-particle data channels
6
+ * (scalars or colors) readable from a custom particle shader by their generated
7
+ * `renderer_<name>...` uniforms.
8
+ *
9
+ * Each stream is one uniform shared across the drawcall, not a per-particle
10
+ * attribute (unlike Unity's `SetCustomParticleData`); shader-side
11
+ * differentiation must mix in `a_Random*` / `normalizedAge` / etc.
12
+ *
13
+ * Register streams BEFORE attaching the entity to the scene — `ParticleRenderer._onEnable`
14
+ * uploads on the first frame and won't see entries added afterward.
15
+ */
16
+ export declare class CustomDataModule extends ParticleGeneratorModule {
17
+ private static readonly _streamNamePattern;
18
+ private static readonly _zeroCurveArray;
19
+ private static readonly _zeroGradientColorArray;
20
+ private static readonly _zeroGradientAlphaArray;
21
+ private static readonly _zeroColor;
22
+ private static readonly _zeroVector4;
23
+ private _curves;
24
+ private _gradients;
25
+ private _curveStreams;
26
+ private _gradientStreams;
27
+ /**
28
+ * Curves keyed by name.
29
+ */
30
+ get curves(): ReadonlyMap<string, ParticleCompositeCurve>;
31
+ /**
32
+ * Gradients keyed by name.
33
+ */
34
+ get gradients(): ReadonlyMap<string, ParticleCompositeGradient>;
35
+ /**
36
+ * Add a scalar curve. Shader-side uniforms by `curve.mode`:
37
+ *
38
+ * | Mode | Uniforms |
39
+ * |--------------|-----------------------------------------|
40
+ * | Constant | `float renderer_<name>MaxConst` |
41
+ * | TwoConstants | + `float renderer_<name>MinConst` |
42
+ * | Curve | `vec2 renderer_<name>MaxGradient[4]` |
43
+ * | TwoCurves | + `vec2 renderer_<name>MinGradient[4]` |
44
+ *
45
+ * @param name - Must contain only letters, digits, or underscores, and not already be in use.
46
+ * @param curve - Stored by reference.
47
+ */
48
+ addCurve(name: string, curve: ParticleCompositeCurve): void;
49
+ /**
50
+ * Add a color gradient. Shader-side uniforms by `gradient.mode`:
51
+ *
52
+ * | Mode | Uniforms |
53
+ * |--------------|-----------------------------------------------------------------------------------------------------------------------|
54
+ * | Constant | `vec4 renderer_<name>MaxConst` |
55
+ * | TwoConstants | + `vec4 renderer_<name>MinConst` |
56
+ * | Gradient | `vec4 renderer_<name>MaxGradientColor[4]`, `vec2 renderer_<name>MaxGradientAlpha[4]`, `vec4 renderer_<name>KeysCount` |
57
+ * | TwoGradients | + `vec4 renderer_<name>MinGradientColor[4]`, `vec2 renderer_<name>MinGradientAlpha[4]` |
58
+ *
59
+ * `KeysCount` packs `(colorMin, alphaMin, colorMax, alphaMax)` last-keyframe times for shader-side normalization;
60
+ * in single-Gradient mode the min lanes mirror the max lanes.
61
+ *
62
+ * @param name - Same validation as {@link addCurve}.
63
+ * @param gradient - Stored by reference.
64
+ */
65
+ addGradient(name: string, gradient: ParticleCompositeGradient): void;
66
+ /**
67
+ * Remove a curve. Shader uniforms read 0 after removal.
68
+ * @param name - The name passed to {@link addCurve}
69
+ */
70
+ removeCurve(name: string): void;
71
+ /**
72
+ * Remove a gradient. Shader uniforms read 0 after removal.
73
+ * @param name - The name passed to {@link addGradient}
74
+ */
75
+ removeGradient(name: string): void;
76
+ private _uploadCurveStream;
77
+ private _uploadGradientStream;
78
+ private _zeroCurveUniforms;
79
+ private _zeroGradientUniforms;
80
+ private _validateName;
81
+ }
@@ -6,11 +6,16 @@ import { BaseShape } from "./shape/BaseShape";
6
6
  * The EmissionModule of a Particle Generator.
7
7
  */
8
8
  export declare class EmissionModule extends ParticleGeneratorModule {
9
+ private static _tempEmitPosition;
9
10
  /** The rate of particle emission. */
10
11
  rateOverTime: ParticleCompositeCurve;
11
12
  /** The rate at which the emitter spawns new particles over distance. */
12
13
  rateOverDistance: ParticleCompositeCurve;
13
14
  _shape: BaseShape;
15
+ private _shapeMacro;
16
+ private _distanceAccumulator;
17
+ private _lastEmitPosition;
18
+ private _hasLastEmitPosition;
14
19
  private _bursts;
15
20
  private _currentBurstIndex;
16
21
  private _burstRand;
@@ -48,6 +53,8 @@ export declare class EmissionModule extends ParticleGeneratorModule {
48
53
  */
49
54
  clearBurst(): void;
50
55
  private _emitByRateOverTime;
56
+ private _emitByRateOverDistance;
57
+ private _evaluateRate;
51
58
  private _emitByBurst;
52
59
  private _emitBySubBurst;
53
60
  }
@@ -0,0 +1 @@
1
+ export {};
@@ -8,6 +8,7 @@ import { ShaderProperty } from "./ShaderProperty";
8
8
  * Shader data collection,Correspondence includes shader properties data and macros data.
9
9
  */
10
10
  export declare class ShaderData implements IReferable, IClone {
11
+ private _batchSharedFields;
11
12
  private _macroMap;
12
13
  private _refCount;
13
14
  /**
@@ -346,5 +347,6 @@ export declare class ShaderData implements IReferable, IClone {
346
347
  getProperties(out: ShaderProperty[]): void;
347
348
  clone(): ShaderData;
348
349
  cloneTo(target: ShaderData): void;
350
+ private _updateRendererBatchSharedFields;
349
351
  }
350
352
  export type ShaderPropertyValueType = number | Vector2 | Vector3 | Vector4 | Color | Matrix | Texture | Texture[] | Int32Array | Float32Array;
@@ -1,12 +1,22 @@
1
+ import { Engine } from "../Engine";
1
2
  /**
2
3
  * Shader registry and GLSL utilities. Holds the `#include` lookup table
3
- * the runtime preprocessor reads, and the GLSL ES 100 → 300 syntax
4
- * converter the WebGL2 path uses.
4
+ * the runtime preprocessor reads, the GLSL ES 100 → 300 syntax converter
5
+ * the WebGL2 path uses, and the GPU-instancing UBO injector that
6
+ * `ShaderPass` runs over compiled GLSL source.
5
7
  */
6
8
  export declare class ShaderFactory {
9
+ static readonly RENDERER_INSTANCE_BLOCK_NAME = "RendererInstanceData";
10
+ static readonly uniformBlockBindingMap: Record<number, number>;
7
11
  static readonly includeMap: Record<string, string>;
8
12
  static readonly shaderExtension: string;
13
+ private static readonly _std140TypeInfoMap;
9
14
  private static readonly _has300OutInFragReg;
15
+ private static readonly _derivedDefines;
16
+ private static readonly _builtinRendererUniforms;
17
+ private static readonly _cameraMatrixCandidates;
18
+ private static readonly _uboUniformRegex;
19
+ private static _packFuncMap;
10
20
  /**
11
21
  * Register a chunk source so `#include` resolves it.
12
22
  * @param includeName - The path key referenced in `#include "..."`.
@@ -24,5 +34,22 @@ export declare class ShaderFactory {
24
34
  * @param isFrag - Whether it is a fragment shader.
25
35
  */
26
36
  static convertTo300(shader: string, isFrag?: boolean): string;
37
+ /**
38
+ * Scan VS/FS for renderer-group `uniform` declarations, replace them with a shared
39
+ * std140 UBO (instanced array), and emit `#define` remapping so original uniform
40
+ * names resolve to `rendererData[instanceID].field`.
41
+ *
42
+ * Inputs are expected to be already preprocessor-evaluated (no `#ifdef` left).
43
+ */
44
+ static injectInstanceUBO(engine: Engine, vertexSource: string, fragmentSource: string): {
45
+ vertexSource: string;
46
+ fragmentSource: string;
47
+ instanceLayout: InstanceBufferLayout | null;
48
+ };
49
+ private static _scanInstanceUniforms;
50
+ private static _buildLayout;
51
+ private static _buildMissingCameraDecls;
52
+ private static _buildUBODeclaration;
53
+ private static _buildFieldDefines;
27
54
  private static _replaceMRTShader;
28
55
  }
@@ -16,6 +16,5 @@ export declare class ShaderPass extends ShaderPart {
16
16
  * @param tags - Tags
17
17
  */
18
18
  constructor(name: string, vertexShaderInstructions: ShaderInstruction[], fragmentShaderInstructions: ShaderInstruction[], platformTarget: ShaderLanguage, tags?: Record<string, number | string | boolean>);
19
- private _getCanonicalShaderProgram;
20
19
  private _compileShaderSource;
21
20
  }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -85,6 +85,6 @@ export declare class TrailRenderer extends Renderer {
85
85
  private _addPoint;
86
86
  private _getActivePointCount;
87
87
  private _addActivePointsToVertexBuffer;
88
- private _addSubRenderElement;
88
+ private _addRenderElement;
89
89
  private _onTextureScaleChanged;
90
90
  }
@@ -1,22 +0,0 @@
1
- import { Renderer } from "../Renderer";
2
- import { Primitive, SubMesh } from "../graphic";
3
- import { Material } from "../material";
4
- import { ShaderData, ShaderPass } from "../shader";
5
- import { Texture2D } from "../texture";
6
- import { IPoolElement } from "../utils/ObjectPool";
7
- import { RenderQueueFlags } from "./BasicRenderPipeline";
8
- import { SubPrimitiveChunk } from "./SubPrimitiveChunk";
9
- export declare class SubRenderElement implements IPoolElement {
10
- component: Renderer;
11
- primitive: Primitive;
12
- material: Material;
13
- subPrimitive: SubMesh;
14
- shaderPasses: ReadonlyArray<ShaderPass>;
15
- shaderData?: ShaderData;
16
- batched: boolean;
17
- renderQueueFlags: RenderQueueFlags;
18
- texture?: Texture2D;
19
- subChunk?: SubPrimitiveChunk;
20
- set(component: Renderer, material: Material, primitive: Primitive, subPrimitive: SubMesh, texture?: Texture2D, subChunk?: SubPrimitiveChunk): void;
21
- dispose(): void;
22
- }