@galacean/engine-core 1.4.0-alpha.1 → 1.4.0-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/dist/main.js +1616 -855
  2. package/dist/main.js.map +1 -1
  3. package/dist/module.js +1606 -855
  4. package/dist/module.js.map +1 -1
  5. package/package.json +3 -3
  6. package/types/Camera.d.ts +4 -0
  7. package/types/Engine.d.ts +12 -0
  8. package/types/RenderPipeline/BasicRenderPipeline.d.ts +1 -0
  9. package/types/RenderPipeline/Blitter.d.ts +28 -0
  10. package/types/RenderPipeline/index.d.ts +2 -1
  11. package/types/Scene.d.ts +3 -0
  12. package/types/asset/AssetType.d.ts +3 -1
  13. package/types/material/BaseMaterial.d.ts +4 -2
  14. package/types/material/PBRMaterial.d.ts +70 -5
  15. package/types/material/enums/Refraction.d.ts +9 -0
  16. package/types/material/index.d.ts +1 -0
  17. package/types/physics/CharacterController.d.ts +2 -2
  18. package/types/physics/Collision.d.ts +18 -0
  19. package/types/physics/ContactPoint.d.ts +14 -0
  20. package/types/physics/DynamicCollider.d.ts +8 -2
  21. package/types/physics/PhysicsMaterial.d.ts +4 -0
  22. package/types/physics/index.d.ts +2 -0
  23. package/types/physics/joint/Joint.d.ts +7 -6
  24. package/types/physics/joint/JointLimits.d.ts +2 -2
  25. package/types/physics/shape/ColliderShape.d.ts +9 -2
  26. package/types/physics/shape/PlaneColliderShape.d.ts +2 -0
  27. package/types/postProcess/PostProcess.d.ts +60 -0
  28. package/types/postProcess/PostProcessEffect.d.ts +26 -0
  29. package/types/postProcess/PostProcessEffectParameter.d.ts +25 -0
  30. package/types/postProcess/PostProcessManager.d.ts +37 -1
  31. package/types/postProcess/PostProcessPass.d.ts +50 -0
  32. package/types/postProcess/PostProcessUberPass.d.ts +25 -0
  33. package/types/postProcess/effects/BloomEffect.d.ts +22 -64
  34. package/types/postProcess/effects/TonemappingEffect.d.ts +6 -16
  35. package/types/postProcess/index.d.ts +6 -2
  36. package/types/shader/Shader.d.ts +1 -1
@@ -0,0 +1,50 @@
1
+ import { EngineObject } from "../base";
2
+ import { Camera } from "../Camera";
3
+ import { RenderTarget, Texture2D } from "../texture";
4
+ import { PostProcessManager } from "./PostProcessManager";
5
+ /**
6
+ * Controls when the post process pass executes.
7
+ */
8
+ export declare enum PostProcessPassEvent {
9
+ /** Before the uber pass. */
10
+ BeforeUber = 0,
11
+ /** After the uber pass. */
12
+ AfterUber = 100
13
+ }
14
+ /**
15
+ * Post process pass.
16
+ */
17
+ export declare abstract class PostProcessPass extends EngineObject {
18
+ private _event;
19
+ private _isActive;
20
+ /**
21
+ * When the post process pass is rendered.
22
+ * @remarks
23
+ * Users can also inject pass events in a specific point by doing PostProcessPassEvent + offset.
24
+ */
25
+ get event(): PostProcessPassEvent;
26
+ set event(value: PostProcessPassEvent);
27
+ /**
28
+ * Whether the post process pass is active.
29
+ */
30
+ get isActive(): boolean;
31
+ set isActive(value: boolean);
32
+ /**
33
+ * Whether the post process pass is valid in current post process manager.
34
+ * @remarks
35
+ * This method can be overridden to control the pass's real validity.
36
+ * @param postProcessManager - The post process manager
37
+ */
38
+ isValid(postProcessManager: PostProcessManager): boolean;
39
+ /**
40
+ * Execute the post process pass if it is active.
41
+ * @param camera - The camera used to render
42
+ * @param srcTexture - The source texture from last render target
43
+ * @param destTarget - The destination render target
44
+ */
45
+ abstract onRender(camera: Camera, srcTexture: Texture2D, destTarget: RenderTarget): void;
46
+ /**
47
+ * @inheritdoc
48
+ */
49
+ _onDestroy(): void;
50
+ }
@@ -0,0 +1,25 @@
1
+ import { Camera } from "../Camera";
2
+ import { Engine } from "../Engine";
3
+ import { RenderTarget, Texture2D } from "../texture";
4
+ import { PostProcessPass } from "./PostProcessPass";
5
+ import { PostProcessManager } from "./PostProcessManager";
6
+ export declare class PostProcessUberPass extends PostProcessPass {
7
+ static readonly UBER_SHADER_NAME = "UberPost";
8
+ private _uberMaterial;
9
+ private _bloomMaterial;
10
+ private _mipDownRT;
11
+ private _mipUpRT;
12
+ constructor(engine: Engine);
13
+ /** @inheritdoc */
14
+ isValid(postProcessManager: PostProcessManager): boolean;
15
+ /**
16
+ * @inheritdoc
17
+ */
18
+ onRender(camera: Camera, srcTexture: Texture2D, destTarget: RenderTarget): void;
19
+ /**
20
+ * @inheritdoc
21
+ */
22
+ _onDestroy(): void;
23
+ private _setupBloom;
24
+ private _releaseBloomRenderTargets;
25
+ }
@@ -1,94 +1,52 @@
1
1
  import { Color } from "@galacean/engine-math";
2
- import { RenderContext } from "../../RenderPipeline/RenderContext";
3
- import { Material } from "../../material";
4
2
  import { Texture2D } from "../../texture";
3
+ import { PostProcessEffect } from "../PostProcessEffect";
4
+ import { PostProcessEffectParameter } from "../PostProcessEffectParameter";
5
5
  /**
6
6
  * This controls the size of the bloom texture.
7
7
  */
8
8
  export declare enum BloomDownScaleMode {
9
- /**
10
- * Use this to select half size as the starting resolution.
11
- */
9
+ /** Use this to select half size as the starting resolution. */
12
10
  Half = 0,
13
- /**
14
- * Use this to select quarter size as the starting resolution.
15
- */
11
+ /** Use this to select quarter size as the starting resolution. */
16
12
  Quarter = 1
17
13
  }
18
- export declare class BloomEffect {
19
- private _uberMaterial;
14
+ export declare class BloomEffect extends PostProcessEffect {
20
15
  static readonly SHADER_NAME = "PostProcessEffect Bloom";
21
- private static _hqMacro;
22
- private static _dirtMacro;
23
- private static _bloomParams;
24
- private static _lowMipTextureProp;
25
- private static _lowMipTexelSizeProp;
26
- private static _enableMacro;
27
- private static _bloomTextureProp;
28
- private static _dirtTextureProp;
29
- private static _tintProp;
30
- private static _bloomIntensityParams;
31
- private static _dirtTilingOffsetProp;
32
- private _bloomMaterial;
33
- private _threshold;
34
- private _scatter;
35
- private _highQualityFiltering;
36
- private _mipDownRT;
37
- private _mipUpRT;
38
- private _maxIterations;
39
- private _enabled;
16
+ /**
17
+ * Controls whether to use bicubic sampling instead of bilinear sampling for the upSampling passes.
18
+ * @remarks This is slightly more expensive but helps getting smoother visuals.
19
+ */
20
+ highQualityFiltering: PostProcessEffectParameter<boolean>;
40
21
  /**
41
22
  * Controls the starting resolution that this effect begins processing.
42
23
  */
43
- downScale: BloomDownScaleMode;
24
+ downScale: PostProcessEffectParameter<BloomDownScaleMode>;
44
25
  /**
45
- * Indicates whether the post process effect is enabled.
26
+ * Specifies a Texture to add smudges or dust to the bloom effect.
46
27
  */
47
- get enabled(): boolean;
48
- set enabled(value: boolean);
28
+ dirtTexture: PostProcessEffectParameter<Texture2D>;
49
29
  /**
50
30
  * Set the level of brightness to filter out pixels under this level.
51
31
  * @remarks This value is expressed in gamma-space.
52
32
  */
53
- get threshold(): number;
54
- set threshold(value: number);
33
+ threshold: PostProcessEffectParameter<number>;
55
34
  /**
56
35
  * Controls the radius of the bloom effect.
57
36
  */
58
- get scatter(): number;
59
- set scatter(value: number);
37
+ scatter: PostProcessEffectParameter<number>;
60
38
  /**
61
39
  * Controls the strength of the bloom effect.
62
40
  */
63
- get intensity(): number;
64
- set intensity(value: number);
65
- /**
66
- * Specifies the tint of the bloom effect.
67
- */
68
- get tint(): Color;
69
- set tint(value: Color);
70
- /**
71
- * Controls whether to use bicubic sampling instead of bilinear sampling for the upSampling passes.
72
- * @remarks This is slightly more expensive but helps getting smoother visuals.
73
- */
74
- get highQualityFiltering(): boolean;
75
- set highQualityFiltering(value: boolean);
41
+ intensity: PostProcessEffectParameter<number>;
76
42
  /**
77
- * Specifies a Texture to add smudges or dust to the bloom effect.
43
+ * Controls the strength of the lens dirt.
78
44
  */
79
- get dirtTexture(): Texture2D;
80
- set dirtTexture(value: Texture2D);
45
+ dirtIntensity: PostProcessEffectParameter<number>;
81
46
  /**
82
- * Controls the strength of the lens dirt.
47
+ * Specifies the tint of the bloom effect.
83
48
  */
84
- get dirtIntensity(): number;
85
- set dirtIntensity(value: number);
86
- constructor(_uberMaterial: Material);
87
- onRender(context: RenderContext, srcTexture: Texture2D): void;
88
- private _calculateMipCount;
89
- private _prefilter;
90
- private _downsample;
91
- private _upsample;
92
- private _setupUber;
93
- private _releaseRenderTargets;
49
+ tint: PostProcessEffectParameter<Color>;
50
+ /** @inheritdoc */
51
+ isValid(): boolean;
94
52
  }
@@ -1,35 +1,25 @@
1
- import { Material } from "../../material";
1
+ import { PostProcessEffect } from "../PostProcessEffect";
2
+ import { PostProcessEffectParameter } from "../PostProcessEffectParameter";
2
3
  /**
3
4
  * Options to select a tonemapping algorithm to use.
4
5
  */
5
6
  export declare enum TonemappingMode {
6
7
  /**
7
- * Neutral tonemapper
8
+ * Neutral tonemapper.
8
9
  * @remarks Use this option if you only want range-remapping with minimal impact on color hue and saturation.
9
10
  */
10
11
  Neutral = 0,
11
12
  /**
12
- * ACES Filmic reference tonemapper (custom approximation)
13
+ * ACES Filmic reference tonemapper (custom approximation).
13
14
  * @remarks
14
15
  * Use this option to apply a close approximation of the reference ACES tonemapper for a more filmic look.
15
16
  * It is more contrasted than Neutral and has an effect on actual color hue and saturation.
16
17
  */
17
18
  ACES = 1
18
19
  }
19
- export declare class TonemappingEffect {
20
- private _uberMaterial;
21
- private static _enableMacro;
22
- private _mode;
23
- private _enabled;
24
- /**
25
- * Indicates whether the post process effect is enabled.
26
- */
27
- get enabled(): boolean;
28
- set enabled(value: boolean);
20
+ export declare class TonemappingEffect extends PostProcessEffect {
29
21
  /**
30
22
  * Use this to select a tonemapping algorithm to use.
31
23
  */
32
- get mode(): TonemappingMode;
33
- set mode(value: TonemappingMode);
34
- constructor(_uberMaterial: Material);
24
+ mode: PostProcessEffectParameter<TonemappingMode>;
35
25
  }
@@ -1,3 +1,7 @@
1
- import { _PostProcessManager } from "./PostProcessManager";
2
1
  export * from "./effects";
3
- export { _PostProcessManager };
2
+ export { PostProcess } from "./PostProcess";
3
+ export { PostProcessEffect } from "./PostProcessEffect";
4
+ export { PostProcessEffectParameter } from "./PostProcessEffectParameter";
5
+ export { PostProcessManager } from "./PostProcessManager";
6
+ export { PostProcessPass, PostProcessPassEvent } from "./PostProcessPass";
7
+ export { PostProcessUberPass } from "./PostProcessUberPass";
@@ -18,7 +18,7 @@ export declare class Shader implements IReferable {
18
18
  * ShaderLab must be enabled first as follows:
19
19
  * ```ts
20
20
  * // Import shaderLab
21
- * import { ShaderLab } from "@galacean/engine-shader-lab";
21
+ * import { ShaderLab } from "@galacean/engine-shaderlab";
22
22
  * // Create engine with shaderLab
23
23
  * const engine = await WebGLEngine.create({ canvas: "canvas", shader: new ShaderLab() });
24
24
  * ...