@galacean/engine-core 2.0.0-alpha.32 → 2.0.0-alpha.34
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 +20366 -19329
- package/dist/main.js.map +1 -1
- package/dist/module.js +20364 -19330
- package/dist/module.js.map +1 -1
- package/package.json +3 -3
- package/types/Entity.d.ts +4 -4
- package/types/RenderPipeline/BasicRenderPipeline.d.ts +1 -1
- package/types/RenderPipeline/RenderElement.d.ts +17 -6
- package/types/RenderPipeline/index.d.ts +2 -1
- package/types/Renderer.d.ts +7 -9
- package/types/animation/Animator.d.ts +14 -8
- package/types/animation/AnimatorStateInstance.d.ts +38 -0
- package/types/animation/AnimatorStateMachine.d.ts +2 -2
- package/types/animation/index.d.ts +1 -0
- package/types/asset/AssetType.d.ts +1 -1
- package/types/graphic/enums/BufferBindFlag.d.ts +3 -1
- package/types/particle/ParticleGenerator.d.ts +3 -0
- package/types/particle/ParticleMaterial.d.ts +3 -1
- package/types/particle/index.d.ts +1 -0
- package/types/particle/modules/CustomDataModule.d.ts +82 -0
- package/types/particle/modules/EmissionModule.d.ts +5 -0
- package/types/shader/ShaderBlockProperty.d.ts +1 -0
- package/types/shader/ShaderData.d.ts +2 -0
- package/types/shader/ShaderFactory.d.ts +29 -2
- package/types/shader/ShaderPass.d.ts +0 -1
- package/types/shader/ShaderProgramMap.d.ts +1 -0
- package/types/shader/enums/ConstantBufferBindingPoint.d.ts +1 -0
- package/types/trail/TrailRenderer.d.ts +1 -1
- package/types/RenderPipeline/SubRenderElement.d.ts +0 -22
- /package/types/RenderPipeline/{BatchUtils.d.ts → InstanceBuffer.d.ts} +0 -0
- /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.
|
|
3
|
+
"version": "2.0.0-alpha.34",
|
|
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.
|
|
21
|
+
"@galacean/engine-math": "2.0.0-alpha.34"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@galacean/engine-design": "2.0.0-alpha.
|
|
24
|
+
"@galacean/engine-design": "2.0.0-alpha.34"
|
|
25
25
|
},
|
|
26
26
|
"scripts": {
|
|
27
27
|
"b:types": "tsc"
|
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
|
|
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
|
|
118
|
-
* @returns The
|
|
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
|
|
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
|
|
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 {
|
|
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
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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 {
|
|
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";
|
package/types/Renderer.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BoundingBox,
|
|
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
|
|
115
|
+
* Update once per frame per renderer.
|
|
121
116
|
*/
|
|
122
117
|
protected _update(context: RenderContext): void;
|
|
123
|
-
|
|
124
|
-
|
|
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 {
|
|
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
|
|
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):
|
|
73
|
+
getCurrentAnimatorState(layerIndex: number): AnimatorStateInstance | null;
|
|
72
74
|
/**
|
|
73
|
-
* Get the state
|
|
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
|
|
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):
|
|
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
|
|
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
|
|
47
|
+
/** AudioClip, include ogg, wav, mp3, m4a, aac and flac. */
|
|
48
48
|
Audio = "Audio",
|
|
49
49
|
/** Project asset. */
|
|
50
50
|
Project = "project",
|
|
@@ -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
|
*/
|
|
@@ -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,82 @@
|
|
|
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 _reservedPrefixPattern;
|
|
19
|
+
private static readonly _zeroCurveArray;
|
|
20
|
+
private static readonly _zeroGradientColorArray;
|
|
21
|
+
private static readonly _zeroGradientAlphaArray;
|
|
22
|
+
private static readonly _zeroColor;
|
|
23
|
+
private static readonly _zeroVector4;
|
|
24
|
+
private _curves;
|
|
25
|
+
private _gradients;
|
|
26
|
+
private _curveStreams;
|
|
27
|
+
private _gradientStreams;
|
|
28
|
+
/**
|
|
29
|
+
* Curves keyed by name.
|
|
30
|
+
*/
|
|
31
|
+
get curves(): ReadonlyMap<string, ParticleCompositeCurve>;
|
|
32
|
+
/**
|
|
33
|
+
* Gradients keyed by name.
|
|
34
|
+
*/
|
|
35
|
+
get gradients(): ReadonlyMap<string, ParticleCompositeGradient>;
|
|
36
|
+
/**
|
|
37
|
+
* Add a scalar curve. Shader-side uniforms by `curve.mode`:
|
|
38
|
+
*
|
|
39
|
+
* | Mode | Uniforms |
|
|
40
|
+
* |--------------|-----------------------------------------|
|
|
41
|
+
* | Constant | `float renderer_<name>MaxConst` |
|
|
42
|
+
* | TwoConstants | + `float renderer_<name>MinConst` |
|
|
43
|
+
* | Curve | `vec2 renderer_<name>MaxGradient[4]` |
|
|
44
|
+
* | TwoCurves | + `vec2 renderer_<name>MinGradient[4]` |
|
|
45
|
+
*
|
|
46
|
+
* @param name - Must contain only letters, digits, or underscores, and not already be in use.
|
|
47
|
+
* @param curve - Stored by reference.
|
|
48
|
+
*/
|
|
49
|
+
addCurve(name: string, curve: ParticleCompositeCurve): void;
|
|
50
|
+
/**
|
|
51
|
+
* Add a color gradient. Shader-side uniforms by `gradient.mode`:
|
|
52
|
+
*
|
|
53
|
+
* | Mode | Uniforms |
|
|
54
|
+
* |--------------|-----------------------------------------------------------------------------------------------------------------------|
|
|
55
|
+
* | Constant | `vec4 renderer_<name>MaxConst` |
|
|
56
|
+
* | TwoConstants | + `vec4 renderer_<name>MinConst` |
|
|
57
|
+
* | Gradient | `vec4 renderer_<name>MaxGradientColor[4]`, `vec2 renderer_<name>MaxGradientAlpha[4]`, `vec4 renderer_<name>KeysCount` |
|
|
58
|
+
* | TwoGradients | + `vec4 renderer_<name>MinGradientColor[4]`, `vec2 renderer_<name>MinGradientAlpha[4]` |
|
|
59
|
+
*
|
|
60
|
+
* `KeysCount` packs `(colorMin, alphaMin, colorMax, alphaMax)` last-keyframe times for shader-side normalization;
|
|
61
|
+
* in single-Gradient mode the min lanes mirror the max lanes.
|
|
62
|
+
*
|
|
63
|
+
* @param name - Same validation as {@link addCurve}.
|
|
64
|
+
* @param gradient - Stored by reference.
|
|
65
|
+
*/
|
|
66
|
+
addGradient(name: string, gradient: ParticleCompositeGradient): void;
|
|
67
|
+
/**
|
|
68
|
+
* Remove a curve. Shader uniforms read 0 after removal.
|
|
69
|
+
* @param name - The name passed to {@link addCurve}
|
|
70
|
+
*/
|
|
71
|
+
removeCurve(name: string): void;
|
|
72
|
+
/**
|
|
73
|
+
* Remove a gradient. Shader uniforms read 0 after removal.
|
|
74
|
+
* @param name - The name passed to {@link addGradient}
|
|
75
|
+
*/
|
|
76
|
+
removeGradient(name: string): void;
|
|
77
|
+
private _uploadCurveStream;
|
|
78
|
+
private _uploadGradientStream;
|
|
79
|
+
private _zeroCurveUniforms;
|
|
80
|
+
private _zeroGradientUniforms;
|
|
81
|
+
private _validateName;
|
|
82
|
+
}
|
|
@@ -6,11 +6,15 @@ 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 _distanceAccumulator;
|
|
16
|
+
private _lastEmitPosition;
|
|
17
|
+
private _hasLastEmitPosition;
|
|
14
18
|
private _bursts;
|
|
15
19
|
private _currentBurstIndex;
|
|
16
20
|
private _burstRand;
|
|
@@ -48,6 +52,7 @@ export declare class EmissionModule extends ParticleGeneratorModule {
|
|
|
48
52
|
*/
|
|
49
53
|
clearBurst(): void;
|
|
50
54
|
private _emitByRateOverTime;
|
|
55
|
+
private _emitByRateOverDistance;
|
|
51
56
|
private _emitByBurst;
|
|
52
57
|
private _emitBySubBurst;
|
|
53
58
|
}
|
|
@@ -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,
|
|
4
|
-
*
|
|
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 {};
|
|
@@ -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
|
-
}
|
|
File without changes
|
|
File without changes
|