@babylonjs/core 8.30.4 → 8.31.0

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 (63) hide show
  1. package/Engines/abstractEngine.js +2 -2
  2. package/Engines/abstractEngine.js.map +1 -1
  3. package/FrameGraph/Node/Blocks/PostProcesses/convolutionPostProcessBlock.d.ts +30 -0
  4. package/FrameGraph/Node/Blocks/PostProcesses/convolutionPostProcessBlock.js +105 -0
  5. package/FrameGraph/Node/Blocks/PostProcesses/convolutionPostProcessBlock.js.map +1 -0
  6. package/FrameGraph/Node/Blocks/PostProcesses/screenSpaceCurvaturePostProcessBlock.d.ts +39 -0
  7. package/FrameGraph/Node/Blocks/PostProcesses/screenSpaceCurvaturePostProcessBlock.js +86 -0
  8. package/FrameGraph/Node/Blocks/PostProcesses/screenSpaceCurvaturePostProcessBlock.js.map +1 -0
  9. package/FrameGraph/Node/Blocks/PostProcesses/sharpenPostProcessBlock.d.ts +34 -0
  10. package/FrameGraph/Node/Blocks/PostProcesses/sharpenPostProcessBlock.js +74 -0
  11. package/FrameGraph/Node/Blocks/PostProcesses/sharpenPostProcessBlock.js.map +1 -0
  12. package/FrameGraph/Node/Blocks/index.d.ts +3 -0
  13. package/FrameGraph/Node/Blocks/index.js +3 -0
  14. package/FrameGraph/Node/Blocks/index.js.map +1 -1
  15. package/FrameGraph/Tasks/PostProcesses/convolutionTask.d.ts +17 -0
  16. package/FrameGraph/Tasks/PostProcesses/convolutionTask.js +23 -0
  17. package/FrameGraph/Tasks/PostProcesses/convolutionTask.js.map +1 -0
  18. package/FrameGraph/Tasks/PostProcesses/screenSpaceCurvatureTask.d.ts +22 -0
  19. package/FrameGraph/Tasks/PostProcesses/screenSpaceCurvatureTask.js +27 -0
  20. package/FrameGraph/Tasks/PostProcesses/screenSpaceCurvatureTask.js.map +1 -0
  21. package/FrameGraph/Tasks/PostProcesses/sharpenTask.d.ts +17 -0
  22. package/FrameGraph/Tasks/PostProcesses/sharpenTask.js +23 -0
  23. package/FrameGraph/Tasks/PostProcesses/sharpenTask.js.map +1 -0
  24. package/FrameGraph/index.d.ts +3 -0
  25. package/FrameGraph/index.js +3 -0
  26. package/FrameGraph/index.js.map +1 -1
  27. package/Materials/Background/backgroundMaterial.js +1 -1
  28. package/Materials/Background/backgroundMaterial.js.map +1 -1
  29. package/Materials/materialHelper.functions.d.ts +2 -1
  30. package/Materials/materialHelper.functions.js +3 -2
  31. package/Materials/materialHelper.functions.js.map +1 -1
  32. package/Materials/standardMaterial.js +1 -1
  33. package/Materials/standardMaterial.js.map +1 -1
  34. package/Meshes/GaussianSplatting/gaussianSplattingMesh.d.ts +15 -0
  35. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js +21 -0
  36. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -1
  37. package/PostProcesses/convolutionPostProcess.d.ts +4 -2
  38. package/PostProcesses/convolutionPostProcess.js +32 -22
  39. package/PostProcesses/convolutionPostProcess.js.map +1 -1
  40. package/PostProcesses/index.d.ts +3 -0
  41. package/PostProcesses/index.js +3 -0
  42. package/PostProcesses/index.js.map +1 -1
  43. package/PostProcesses/screenSpaceCurvaturePostProcess.d.ts +6 -2
  44. package/PostProcesses/screenSpaceCurvaturePostProcess.js +37 -13
  45. package/PostProcesses/screenSpaceCurvaturePostProcess.js.map +1 -1
  46. package/PostProcesses/sharpenPostProcess.d.ts +6 -3
  47. package/PostProcesses/sharpenPostProcess.js +39 -24
  48. package/PostProcesses/sharpenPostProcess.js.map +1 -1
  49. package/PostProcesses/thinConvolutionPostProcess.d.ts +59 -0
  50. package/PostProcesses/thinConvolutionPostProcess.js +83 -0
  51. package/PostProcesses/thinConvolutionPostProcess.js.map +1 -0
  52. package/PostProcesses/thinScreenSpaceCurvaturePostProcess.d.ts +36 -0
  53. package/PostProcesses/thinScreenSpaceCurvaturePostProcess.js +61 -0
  54. package/PostProcesses/thinScreenSpaceCurvaturePostProcess.js.map +1 -0
  55. package/PostProcesses/thinSharpenPostProcess.d.ts +40 -0
  56. package/PostProcesses/thinSharpenPostProcess.js +64 -0
  57. package/PostProcesses/thinSharpenPostProcess.js.map +1 -0
  58. package/Rendering/objectRenderer.js +3 -1
  59. package/Rendering/objectRenderer.js.map +1 -1
  60. package/ShadersWGSL/screenSpaceCurvature.fragment.d.ts +5 -0
  61. package/ShadersWGSL/screenSpaceCurvature.fragment.js +25 -0
  62. package/ShadersWGSL/screenSpaceCurvature.fragment.js.map +1 -0
  63. package/package.json +1 -1
@@ -0,0 +1,59 @@
1
+ import type { Nullable, AbstractEngine, EffectWrapperCreationOptions } from "../index.js";
2
+ import { EffectWrapper } from "../Materials/effectRenderer.js";
3
+ /**
4
+ * Post process used to apply a convolution effect
5
+ */
6
+ export declare class ThinConvolutionPostProcess extends EffectWrapper {
7
+ /**
8
+ * Edge detection 0 see https://en.wikipedia.org/wiki/Kernel_(image_processing)
9
+ */
10
+ static EdgeDetect0Kernel: number[];
11
+ /**
12
+ * Edge detection 1 see https://en.wikipedia.org/wiki/Kernel_(image_processing)
13
+ */
14
+ static EdgeDetect1Kernel: number[];
15
+ /**
16
+ * Edge detection 2 see https://en.wikipedia.org/wiki/Kernel_(image_processing)
17
+ */
18
+ static EdgeDetect2Kernel: number[];
19
+ /**
20
+ * Kernel to sharpen an image see https://en.wikipedia.org/wiki/Kernel_(image_processing)
21
+ */
22
+ static SharpenKernel: number[];
23
+ /**
24
+ * Kernel to emboss an image see https://en.wikipedia.org/wiki/Kernel_(image_processing)
25
+ */
26
+ static EmbossKernel: number[];
27
+ /**
28
+ * Kernel to blur an image see https://en.wikipedia.org/wiki/Kernel_(image_processing)
29
+ */
30
+ static GaussianKernel: number[];
31
+ /**
32
+ * The fragment shader url
33
+ */
34
+ static readonly FragmentUrl = "convolution";
35
+ /**
36
+ * The list of uniforms used by the effect
37
+ */
38
+ static readonly Uniforms: string[];
39
+ protected _gatherImports(useWebGPU: boolean, list: Promise<any>[]): void;
40
+ /**
41
+ * Constructs a new convolution post process
42
+ * @param name Name of the effect
43
+ * @param engine Engine to use to render the effect. If not provided, the last created engine will be used
44
+ * @param kernel Array of 9 values corresponding to the 3x3 kernel to be applied
45
+ * @param options Options to configure the effect
46
+ */
47
+ constructor(name: string, engine: Nullable<AbstractEngine> | undefined, kernel: number[], options?: EffectWrapperCreationOptions);
48
+ /** Array of 9 values corresponding to the 3x3 kernel to be applied */
49
+ kernel: number[];
50
+ /**
51
+ * The width of the source texture
52
+ */
53
+ textureWidth: number;
54
+ /**
55
+ * The height of the source texture
56
+ */
57
+ textureHeight: number;
58
+ bind(noDefaultBindings?: boolean): void;
59
+ }
@@ -0,0 +1,83 @@
1
+ import { EffectWrapper } from "../Materials/effectRenderer.js";
2
+ import { Engine } from "../Engines/engine.js";
3
+ /**
4
+ * Post process used to apply a convolution effect
5
+ */
6
+ export class ThinConvolutionPostProcess extends EffectWrapper {
7
+ _gatherImports(useWebGPU, list) {
8
+ if (useWebGPU) {
9
+ this._webGPUReady = true;
10
+ list.push(import("../ShadersWGSL/convolution.fragment.js"));
11
+ }
12
+ else {
13
+ list.push(import("../Shaders/convolution.fragment.js"));
14
+ }
15
+ }
16
+ /**
17
+ * Constructs a new convolution post process
18
+ * @param name Name of the effect
19
+ * @param engine Engine to use to render the effect. If not provided, the last created engine will be used
20
+ * @param kernel Array of 9 values corresponding to the 3x3 kernel to be applied
21
+ * @param options Options to configure the effect
22
+ */
23
+ constructor(name, engine = null, kernel, options) {
24
+ super({
25
+ ...options,
26
+ name,
27
+ engine: engine || Engine.LastCreatedEngine,
28
+ useShaderStore: true,
29
+ useAsPostProcess: true,
30
+ fragmentShader: ThinConvolutionPostProcess.FragmentUrl,
31
+ uniforms: ThinConvolutionPostProcess.Uniforms,
32
+ });
33
+ /**
34
+ * The width of the source texture
35
+ */
36
+ this.textureWidth = 0;
37
+ /**
38
+ * The height of the source texture
39
+ */
40
+ this.textureHeight = 0;
41
+ this.kernel = kernel;
42
+ }
43
+ bind(noDefaultBindings = false) {
44
+ super.bind(noDefaultBindings);
45
+ const effect = this._drawWrapper.effect;
46
+ effect.setFloat2("screenSize", this.textureWidth, this.textureHeight);
47
+ effect.setArray("kernel", this.kernel);
48
+ }
49
+ }
50
+ // Statics
51
+ /**
52
+ * Edge detection 0 see https://en.wikipedia.org/wiki/Kernel_(image_processing)
53
+ */
54
+ ThinConvolutionPostProcess.EdgeDetect0Kernel = [1, 0, -1, 0, 0, 0, -1, 0, 1];
55
+ /**
56
+ * Edge detection 1 see https://en.wikipedia.org/wiki/Kernel_(image_processing)
57
+ */
58
+ ThinConvolutionPostProcess.EdgeDetect1Kernel = [0, 1, 0, 1, -4, 1, 0, 1, 0];
59
+ /**
60
+ * Edge detection 2 see https://en.wikipedia.org/wiki/Kernel_(image_processing)
61
+ */
62
+ ThinConvolutionPostProcess.EdgeDetect2Kernel = [-1, -1, -1, -1, 8, -1, -1, -1, -1];
63
+ /**
64
+ * Kernel to sharpen an image see https://en.wikipedia.org/wiki/Kernel_(image_processing)
65
+ */
66
+ ThinConvolutionPostProcess.SharpenKernel = [0, -1, 0, -1, 5, -1, 0, -1, 0];
67
+ /**
68
+ * Kernel to emboss an image see https://en.wikipedia.org/wiki/Kernel_(image_processing)
69
+ */
70
+ ThinConvolutionPostProcess.EmbossKernel = [-2, -1, 0, -1, 1, 1, 0, 1, 2];
71
+ /**
72
+ * Kernel to blur an image see https://en.wikipedia.org/wiki/Kernel_(image_processing)
73
+ */
74
+ ThinConvolutionPostProcess.GaussianKernel = [0, 1, 0, 1, 1, 1, 0, 1, 0];
75
+ /**
76
+ * The fragment shader url
77
+ */
78
+ ThinConvolutionPostProcess.FragmentUrl = "convolution";
79
+ /**
80
+ * The list of uniforms used by the effect
81
+ */
82
+ ThinConvolutionPostProcess.Uniforms = ["kernel", "screenSize"];
83
+ //# sourceMappingURL=thinConvolutionPostProcess.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"thinConvolutionPostProcess.js","sourceRoot":"","sources":["../../../../dev/core/src/P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AQ,GAAG,CAAC,QAAQ,EAAE,YAAY,CAAC,AAA3B,CAA4B","sourcesContent":["import type { Nullable, AbstractEngine, EffectWrapperCreationOptions } from \"core/index\";\r\nimport { EffectWrapper } from \"../Materials/effectRenderer\";\r\nimport { Engine } from \"../Engines/engine\";\r\n\r\n/**\r\n * Post process used to apply a convolution effect\r\n */\r\nexport class ThinConvolutionPostProcess extends EffectWrapper {\r\n // Statics\r\n /**\r\n * Edge detection 0 see https://en.wikipedia.org/wiki/Kernel_(image_processing)\r\n */\r\n public static EdgeDetect0Kernel = [1, 0, -1, 0, 0, 0, -1, 0, 1];\r\n /**\r\n * Edge detection 1 see https://en.wikipedia.org/wiki/Kernel_(image_processing)\r\n */\r\n public static EdgeDetect1Kernel = [0, 1, 0, 1, -4, 1, 0, 1, 0];\r\n /**\r\n * Edge detection 2 see https://en.wikipedia.org/wiki/Kernel_(image_processing)\r\n */\r\n public static EdgeDetect2Kernel = [-1, -1, -1, -1, 8, -1, -1, -1, -1];\r\n /**\r\n * Kernel to sharpen an image see https://en.wikipedia.org/wiki/Kernel_(image_processing)\r\n */\r\n public static SharpenKernel = [0, -1, 0, -1, 5, -1, 0, -1, 0];\r\n /**\r\n * Kernel to emboss an image see https://en.wikipedia.org/wiki/Kernel_(image_processing)\r\n */\r\n public static EmbossKernel = [-2, -1, 0, -1, 1, 1, 0, 1, 2];\r\n /**\r\n * Kernel to blur an image see https://en.wikipedia.org/wiki/Kernel_(image_processing)\r\n */\r\n public static GaussianKernel = [0, 1, 0, 1, 1, 1, 0, 1, 0];\r\n\r\n /**\r\n * The fragment shader url\r\n */\r\n public static readonly FragmentUrl = \"convolution\";\r\n\r\n /**\r\n * The list of uniforms used by the effect\r\n */\r\n public static readonly Uniforms = [\"kernel\", \"screenSize\"];\r\n\r\n protected override _gatherImports(useWebGPU: boolean, list: Promise<any>[]) {\r\n if (useWebGPU) {\r\n this._webGPUReady = true;\r\n list.push(import(\"../ShadersWGSL/convolution.fragment\"));\r\n } else {\r\n list.push(import(\"../Shaders/convolution.fragment\"));\r\n }\r\n }\r\n\r\n /**\r\n * Constructs a new convolution post process\r\n * @param name Name of the effect\r\n * @param engine Engine to use to render the effect. If not provided, the last created engine will be used\r\n * @param kernel Array of 9 values corresponding to the 3x3 kernel to be applied\r\n * @param options Options to configure the effect\r\n */\r\n constructor(name: string, engine: Nullable<AbstractEngine> = null, kernel: number[], options?: EffectWrapperCreationOptions) {\r\n super({\r\n ...options,\r\n name,\r\n engine: engine || Engine.LastCreatedEngine!,\r\n useShaderStore: true,\r\n useAsPostProcess: true,\r\n fragmentShader: ThinConvolutionPostProcess.FragmentUrl,\r\n uniforms: ThinConvolutionPostProcess.Uniforms,\r\n });\r\n\r\n this.kernel = kernel;\r\n }\r\n\r\n /** Array of 9 values corresponding to the 3x3 kernel to be applied */\r\n public kernel: number[];\r\n\r\n /**\r\n * The width of the source texture\r\n */\r\n public textureWidth: number = 0;\r\n\r\n /**\r\n * The height of the source texture\r\n */\r\n public textureHeight: number = 0;\r\n\r\n public override bind(noDefaultBindings = false) {\r\n super.bind(noDefaultBindings);\r\n\r\n const effect = this._drawWrapper.effect!;\r\n\r\n effect.setFloat2(\"screenSize\", this.textureWidth, this.textureHeight);\r\n effect.setArray(\"kernel\", this.kernel);\r\n }\r\n}\r\n"]}
@@ -0,0 +1,36 @@
1
+ import type { Nullable, AbstractEngine, EffectWrapperCreationOptions } from "../index.js";
2
+ import { EffectWrapper } from "../Materials/effectRenderer.js";
3
+ /**
4
+ * Post process used to apply a screen space curvature post process
5
+ */
6
+ export declare class ThinScreenSpaceCurvaturePostProcess extends EffectWrapper {
7
+ /**
8
+ * The fragment shader url
9
+ */
10
+ static readonly FragmentUrl = "screenSpaceCurvature";
11
+ /**
12
+ * The list of uniforms used by the effect
13
+ */
14
+ static readonly Uniforms: string[];
15
+ /**
16
+ * The list of samplers used by the effect
17
+ */
18
+ static readonly Samplers: string[];
19
+ protected _gatherImports(useWebGPU: boolean, list: Promise<any>[]): void;
20
+ /**
21
+ * Constructs a new screen space curvature post process
22
+ * @param name Name of the effect
23
+ * @param engine Engine to use to render the effect. If not provided, the last created engine will be used
24
+ * @param options Options to configure the effect
25
+ */
26
+ constructor(name: string, engine?: Nullable<AbstractEngine>, options?: EffectWrapperCreationOptions);
27
+ /**
28
+ * Defines how much ridge the curvature effect displays.
29
+ */
30
+ ridge: number;
31
+ /**
32
+ * Defines how much valley the curvature effect displays.
33
+ */
34
+ valley: number;
35
+ bind(noDefaultBindings?: boolean): void;
36
+ }
@@ -0,0 +1,61 @@
1
+ import { EffectWrapper } from "../Materials/effectRenderer.js";
2
+ import { Engine } from "../Engines/engine.js";
3
+ /**
4
+ * Post process used to apply a screen space curvature post process
5
+ */
6
+ export class ThinScreenSpaceCurvaturePostProcess extends EffectWrapper {
7
+ _gatherImports(useWebGPU, list) {
8
+ if (useWebGPU) {
9
+ this._webGPUReady = true;
10
+ list.push(import("../ShadersWGSL/screenSpaceCurvature.fragment.js"));
11
+ }
12
+ else {
13
+ list.push(import("../Shaders/screenSpaceCurvature.fragment.js"));
14
+ }
15
+ }
16
+ /**
17
+ * Constructs a new screen space curvature post process
18
+ * @param name Name of the effect
19
+ * @param engine Engine to use to render the effect. If not provided, the last created engine will be used
20
+ * @param options Options to configure the effect
21
+ */
22
+ constructor(name, engine = null, options) {
23
+ super({
24
+ ...options,
25
+ name,
26
+ engine: engine || Engine.LastCreatedEngine,
27
+ useShaderStore: true,
28
+ useAsPostProcess: true,
29
+ fragmentShader: ThinScreenSpaceCurvaturePostProcess.FragmentUrl,
30
+ uniforms: ThinScreenSpaceCurvaturePostProcess.Uniforms,
31
+ samplers: ThinScreenSpaceCurvaturePostProcess.Samplers,
32
+ });
33
+ /**
34
+ * Defines how much ridge the curvature effect displays.
35
+ */
36
+ this.ridge = 1;
37
+ /**
38
+ * Defines how much valley the curvature effect displays.
39
+ */
40
+ this.valley = 1;
41
+ }
42
+ bind(noDefaultBindings = false) {
43
+ super.bind(noDefaultBindings);
44
+ const effect = this._drawWrapper.effect;
45
+ effect.setFloat("curvature_ridge", 0.5 / Math.max(this.ridge * this.ridge, 1e-4));
46
+ effect.setFloat("curvature_valley", 0.7 / Math.max(this.valley * this.valley, 1e-4));
47
+ }
48
+ }
49
+ /**
50
+ * The fragment shader url
51
+ */
52
+ ThinScreenSpaceCurvaturePostProcess.FragmentUrl = "screenSpaceCurvature";
53
+ /**
54
+ * The list of uniforms used by the effect
55
+ */
56
+ ThinScreenSpaceCurvaturePostProcess.Uniforms = ["curvature_ridge", "curvature_valley"];
57
+ /**
58
+ * The list of samplers used by the effect
59
+ */
60
+ ThinScreenSpaceCurvaturePostProcess.Samplers = ["normalSampler"];
61
+ //# sourceMappingURL=thinScreenSpaceCurvaturePostProcess.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"thinScreenSpaceCurvaturePostProcess.js","sourceRoot":"","sources":["../../../../dev/core/src/PostProcesses/thinScreenSpaceCurvaturePostProcess.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE3C;;GAEG;AACH,MAAM,OAAO,mCAAoC,SAAQ,aAAa;IAgB/C,cAAc,CAAC,SAAkB,EAAE,IAAoB;QACtE,IAAI,SAAS,EAAE,CAAC;YACZ,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;YACzB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,8CAA8C,CAAC,CAAC,CAAC;QACtE,CAAC;aAAM,CAAC;YACJ,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,0CAA0C,CAAC,CAAC,CAAC;QAClE,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACH,YAAY,IAAY,EAAE,SAAmC,IAAI,EAAE,OAAsC;QACrG,KAAK,CAAC;YACF,GAAG,OAAO;YACV,IAAI;YACJ,MAAM,EAAE,MAAM,IAAI,MAAM,CAAC,iBAAkB;YAC3C,cAAc,EAAE,IAAI;YACpB,gBAAgB,EAAE,IAAI;YACtB,cAAc,EAAE,mCAAmC,CAAC,WAAW;YAC/D,QAAQ,EAAE,mCAAmC,CAAC,QAAQ;YACtD,QAAQ,EAAE,mCAAmC,CAAC,QAAQ;SACzD,CAAC,CAAC;QAGP;;WAEG;QACI,UAAK,GAAW,CAAC,CAAC;QAEzB;;WAEG;QACI,WAAM,GAAW,CAAC,CAAC;IAV1B,CAAC;IAYe,IAAI,CAAC,iBAAiB,GAAG,KAAK;QAC1C,KAAK,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;QAE9B,MAAM,MAAM,GAAG,IAAI,CAAC,YAAY,CAAC,MAAO,CAAC;QAEzC,MAAM,CAAC,QAAQ,CAAC,iBAAiB,EAAE,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;QAClF,MAAM,CAAC,QAAQ,CAAC,kBAAkB,EAAE,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC;IACzF,CAAC;;AA5DD;;GAEG;AACoB,+CAAW,GAAG,sBAAsB,AAAzB,CAA0B;AAE5D;;GAEG;AACoB,4CAAQ,GAAG,CAAC,iBAAiB,EAAE,kBAAkB,CAAC,AAA1C,CAA2C;AAE1E;;GAEG;AACoB,4CAAQ,GAAG,CAAC,eAAe,CAAC,AAApB,CAAqB","sourcesContent":["import type { Nullable, AbstractEngine, EffectWrapperCreationOptions } from \"core/index\";\r\nimport { EffectWrapper } from \"../Materials/effectRenderer\";\r\nimport { Engine } from \"../Engines/engine\";\r\n\r\n/**\r\n * Post process used to apply a screen space curvature post process\r\n */\r\nexport class ThinScreenSpaceCurvaturePostProcess extends EffectWrapper {\r\n /**\r\n * The fragment shader url\r\n */\r\n public static readonly FragmentUrl = \"screenSpaceCurvature\";\r\n\r\n /**\r\n * The list of uniforms used by the effect\r\n */\r\n public static readonly Uniforms = [\"curvature_ridge\", \"curvature_valley\"];\r\n\r\n /**\r\n * The list of samplers used by the effect\r\n */\r\n public static readonly Samplers = [\"normalSampler\"];\r\n\r\n protected override _gatherImports(useWebGPU: boolean, list: Promise<any>[]) {\r\n if (useWebGPU) {\r\n this._webGPUReady = true;\r\n list.push(import(\"../ShadersWGSL/screenSpaceCurvature.fragment\"));\r\n } else {\r\n list.push(import(\"../Shaders/screenSpaceCurvature.fragment\"));\r\n }\r\n }\r\n\r\n /**\r\n * Constructs a new screen space curvature post process\r\n * @param name Name of the effect\r\n * @param engine Engine to use to render the effect. If not provided, the last created engine will be used\r\n * @param options Options to configure the effect\r\n */\r\n constructor(name: string, engine: Nullable<AbstractEngine> = null, options?: EffectWrapperCreationOptions) {\r\n super({\r\n ...options,\r\n name,\r\n engine: engine || Engine.LastCreatedEngine!,\r\n useShaderStore: true,\r\n useAsPostProcess: true,\r\n fragmentShader: ThinScreenSpaceCurvaturePostProcess.FragmentUrl,\r\n uniforms: ThinScreenSpaceCurvaturePostProcess.Uniforms,\r\n samplers: ThinScreenSpaceCurvaturePostProcess.Samplers,\r\n });\r\n }\r\n\r\n /**\r\n * Defines how much ridge the curvature effect displays.\r\n */\r\n public ridge: number = 1;\r\n\r\n /**\r\n * Defines how much valley the curvature effect displays.\r\n */\r\n public valley: number = 1;\r\n\r\n public override bind(noDefaultBindings = false) {\r\n super.bind(noDefaultBindings);\r\n\r\n const effect = this._drawWrapper.effect!;\r\n\r\n effect.setFloat(\"curvature_ridge\", 0.5 / Math.max(this.ridge * this.ridge, 1e-4));\r\n effect.setFloat(\"curvature_valley\", 0.7 / Math.max(this.valley * this.valley, 1e-4));\r\n }\r\n}\r\n"]}
@@ -0,0 +1,40 @@
1
+ import type { Nullable, AbstractEngine, EffectWrapperCreationOptions } from "../index.js";
2
+ import { EffectWrapper } from "../Materials/effectRenderer.js";
3
+ /**
4
+ * Post process used to apply a sharpen effect
5
+ */
6
+ export declare class ThinSharpenPostProcess extends EffectWrapper {
7
+ /**
8
+ * The fragment shader url
9
+ */
10
+ static readonly FragmentUrl = "sharpen";
11
+ /**
12
+ * The list of uniforms used by the effect
13
+ */
14
+ static readonly Uniforms: string[];
15
+ protected _gatherImports(useWebGPU: boolean, list: Promise<any>[]): void;
16
+ /**
17
+ * Constructs a new sharpen post process
18
+ * @param name Name of the effect
19
+ * @param engine Engine to use to render the effect. If not provided, the last created engine will be used
20
+ * @param options Options to configure the effect
21
+ */
22
+ constructor(name: string, engine?: Nullable<AbstractEngine>, options?: EffectWrapperCreationOptions);
23
+ /**
24
+ * How much of the original color should be applied. Setting this to 0 will display edge detection. (default: 1)
25
+ */
26
+ colorAmount: number;
27
+ /**
28
+ * How much sharpness should be applied (default: 0.3)
29
+ */
30
+ edgeAmount: number;
31
+ /**
32
+ * The width of the source texture
33
+ */
34
+ textureWidth: number;
35
+ /**
36
+ * The height of the source texture
37
+ */
38
+ textureHeight: number;
39
+ bind(noDefaultBindings?: boolean): void;
40
+ }
@@ -0,0 +1,64 @@
1
+ import { EffectWrapper } from "../Materials/effectRenderer.js";
2
+ import { Engine } from "../Engines/engine.js";
3
+ /**
4
+ * Post process used to apply a sharpen effect
5
+ */
6
+ export class ThinSharpenPostProcess extends EffectWrapper {
7
+ _gatherImports(useWebGPU, list) {
8
+ if (useWebGPU) {
9
+ this._webGPUReady = true;
10
+ list.push(import("../ShadersWGSL/sharpen.fragment.js"));
11
+ }
12
+ else {
13
+ list.push(import("../Shaders/sharpen.fragment.js"));
14
+ }
15
+ }
16
+ /**
17
+ * Constructs a new sharpen post process
18
+ * @param name Name of the effect
19
+ * @param engine Engine to use to render the effect. If not provided, the last created engine will be used
20
+ * @param options Options to configure the effect
21
+ */
22
+ constructor(name, engine = null, options) {
23
+ super({
24
+ ...options,
25
+ name,
26
+ engine: engine || Engine.LastCreatedEngine,
27
+ useShaderStore: true,
28
+ useAsPostProcess: true,
29
+ fragmentShader: ThinSharpenPostProcess.FragmentUrl,
30
+ uniforms: ThinSharpenPostProcess.Uniforms,
31
+ });
32
+ /**
33
+ * How much of the original color should be applied. Setting this to 0 will display edge detection. (default: 1)
34
+ */
35
+ this.colorAmount = 1.0;
36
+ /**
37
+ * How much sharpness should be applied (default: 0.3)
38
+ */
39
+ this.edgeAmount = 0.3;
40
+ /**
41
+ * The width of the source texture
42
+ */
43
+ this.textureWidth = 0;
44
+ /**
45
+ * The height of the source texture
46
+ */
47
+ this.textureHeight = 0;
48
+ }
49
+ bind(noDefaultBindings = false) {
50
+ super.bind(noDefaultBindings);
51
+ const effect = this._drawWrapper.effect;
52
+ effect.setFloat2("screenSize", this.textureWidth, this.textureHeight);
53
+ effect.setFloat2("sharpnessAmounts", this.edgeAmount, this.colorAmount);
54
+ }
55
+ }
56
+ /**
57
+ * The fragment shader url
58
+ */
59
+ ThinSharpenPostProcess.FragmentUrl = "sharpen";
60
+ /**
61
+ * The list of uniforms used by the effect
62
+ */
63
+ ThinSharpenPostProcess.Uniforms = ["sharpnessAmounts", "screenSize"];
64
+ //# sourceMappingURL=thinSharpenPostProcess.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"thinSharpenPostProcess.js","sourceRoot":"","sources":["../../../../dev/core/src/PostProcesses/thinSharpenPostProcess.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE3C;;GAEG;AACH,MAAM,OAAO,sBAAuB,SAAQ,aAAa;IAWlC,cAAc,CAAC,SAAkB,EAAE,IAAoB;QACtE,IAAI,SAAS,EAAE,CAAC;YACZ,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;YACzB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,iCAAiC,CAAC,CAAC,CAAC;QACzD,CAAC;aAAM,CAAC;YACJ,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,6BAA6B,CAAC,CAAC,CAAC;QACrD,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACH,YAAY,IAAY,EAAE,SAAmC,IAAI,EAAE,OAAsC;QACrG,KAAK,CAAC;YACF,GAAG,OAAO;YACV,IAAI;YACJ,MAAM,EAAE,MAAM,IAAI,MAAM,CAAC,iBAAkB;YAC3C,cAAc,EAAE,IAAI;YACpB,gBAAgB,EAAE,IAAI;YACtB,cAAc,EAAE,sBAAsB,CAAC,WAAW;YAClD,QAAQ,EAAE,sBAAsB,CAAC,QAAQ;SAC5C,CAAC,CAAC;QAGP;;WAEG;QACI,gBAAW,GAAW,GAAG,CAAC;QACjC;;WAEG;QACI,eAAU,GAAW,GAAG,CAAC;QAEhC;;WAEG;QACI,iBAAY,GAAW,CAAC,CAAC;QAEhC;;WAEG;QACI,kBAAa,GAAW,CAAC,CAAC;IAnBjC,CAAC;IAqBe,IAAI,CAAC,iBAAiB,GAAG,KAAK;QAC1C,KAAK,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;QAE9B,MAAM,MAAM,GAAG,IAAI,CAAC,YAAY,CAAC,MAAO,CAAC;QAEzC,MAAM,CAAC,SAAS,CAAC,YAAY,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;QACtE,MAAM,CAAC,SAAS,CAAC,kBAAkB,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;IAC5E,CAAC;;AA/DD;;GAEG;AACoB,kCAAW,GAAG,SAAS,AAAZ,CAAa;AAE/C;;GAEG;AACoB,+BAAQ,GAAG,CAAC,kBAAkB,EAAE,YAAY,CAAC,AAArC,CAAsC","sourcesContent":["import type { Nullable, AbstractEngine, EffectWrapperCreationOptions } from \"core/index\";\r\nimport { EffectWrapper } from \"../Materials/effectRenderer\";\r\nimport { Engine } from \"../Engines/engine\";\r\n\r\n/**\r\n * Post process used to apply a sharpen effect\r\n */\r\nexport class ThinSharpenPostProcess extends EffectWrapper {\r\n /**\r\n * The fragment shader url\r\n */\r\n public static readonly FragmentUrl = \"sharpen\";\r\n\r\n /**\r\n * The list of uniforms used by the effect\r\n */\r\n public static readonly Uniforms = [\"sharpnessAmounts\", \"screenSize\"];\r\n\r\n protected override _gatherImports(useWebGPU: boolean, list: Promise<any>[]) {\r\n if (useWebGPU) {\r\n this._webGPUReady = true;\r\n list.push(import(\"../ShadersWGSL/sharpen.fragment\"));\r\n } else {\r\n list.push(import(\"../Shaders/sharpen.fragment\"));\r\n }\r\n }\r\n\r\n /**\r\n * Constructs a new sharpen post process\r\n * @param name Name of the effect\r\n * @param engine Engine to use to render the effect. If not provided, the last created engine will be used\r\n * @param options Options to configure the effect\r\n */\r\n constructor(name: string, engine: Nullable<AbstractEngine> = null, options?: EffectWrapperCreationOptions) {\r\n super({\r\n ...options,\r\n name,\r\n engine: engine || Engine.LastCreatedEngine!,\r\n useShaderStore: true,\r\n useAsPostProcess: true,\r\n fragmentShader: ThinSharpenPostProcess.FragmentUrl,\r\n uniforms: ThinSharpenPostProcess.Uniforms,\r\n });\r\n }\r\n\r\n /**\r\n * How much of the original color should be applied. Setting this to 0 will display edge detection. (default: 1)\r\n */\r\n public colorAmount: number = 1.0;\r\n /**\r\n * How much sharpness should be applied (default: 0.3)\r\n */\r\n public edgeAmount: number = 0.3;\r\n\r\n /**\r\n * The width of the source texture\r\n */\r\n public textureWidth: number = 0;\r\n\r\n /**\r\n * The height of the source texture\r\n */\r\n public textureHeight: number = 0;\r\n\r\n public override bind(noDefaultBindings = false) {\r\n super.bind(noDefaultBindings);\r\n\r\n const effect = this._drawWrapper.effect!;\r\n\r\n effect.setFloat2(\"screenSize\", this.textureWidth, this.textureHeight);\r\n effect.setFloat2(\"sharpnessAmounts\", this.edgeAmount, this.colorAmount);\r\n }\r\n}\r\n"]}
@@ -317,7 +317,9 @@ export class ObjectRenderer {
317
317
  if (this._currentSceneUBOIndex >= this._sceneUBOs.length) {
318
318
  this._createSceneUBO();
319
319
  }
320
- return this._sceneUBOs[this._currentSceneUBOIndex++];
320
+ const ubo = this._sceneUBOs[this._currentSceneUBOIndex++];
321
+ ubo.unbindEffect();
322
+ return ubo;
321
323
  }
322
324
  /**
323
325
  * Resets the refresh counter of the renderer and start back from scratch.