@babylonjs/core 9.10.1 → 9.11.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 (58) hide show
  1. package/AudioV2/abstractAudio/subNodes/audioAnalyzerSubNode.d.ts +2 -0
  2. package/AudioV2/abstractAudio/subNodes/audioAnalyzerSubNode.js.map +1 -1
  3. package/AudioV2/abstractAudio/subProperties/abstractAudioAnalyzer.d.ts +13 -3
  4. package/AudioV2/abstractAudio/subProperties/abstractAudioAnalyzer.js +16 -0
  5. package/AudioV2/abstractAudio/subProperties/abstractAudioAnalyzer.js.map +1 -1
  6. package/AudioV2/abstractAudio/subProperties/audioAnalyzer.d.ts +4 -0
  7. package/AudioV2/abstractAudio/subProperties/audioAnalyzer.js +22 -0
  8. package/AudioV2/abstractAudio/subProperties/audioAnalyzer.js.map +1 -1
  9. package/AudioV2/webAudio/subNodes/webAudioAnalyzerSubNode.d.ts +6 -0
  10. package/AudioV2/webAudio/subNodes/webAudioAnalyzerSubNode.js +22 -5
  11. package/AudioV2/webAudio/subNodes/webAudioAnalyzerSubNode.js.map +1 -1
  12. package/Compute/computeEffect.d.ts +6 -0
  13. package/Compute/computeEffect.js +3 -0
  14. package/Compute/computeEffect.js.map +1 -1
  15. package/Compute/computeShader.pure.d.ts +4 -0
  16. package/Compute/computeShader.pure.js +1 -0
  17. package/Compute/computeShader.pure.js.map +1 -1
  18. package/Engines/Native/nativeInterfaces.d.ts +10 -1
  19. package/Engines/Native/nativeInterfaces.js.map +1 -1
  20. package/Engines/WebGPU/Extensions/engine.computeShader.pure.js +154 -2
  21. package/Engines/WebGPU/Extensions/engine.computeShader.pure.js.map +1 -1
  22. package/Engines/abstractEngine.pure.d.ts +7 -1
  23. package/Engines/abstractEngine.pure.js +34 -4
  24. package/Engines/abstractEngine.pure.js.map +1 -1
  25. package/Engines/engine.pure.d.ts +0 -7
  26. package/Engines/engine.pure.js +0 -34
  27. package/Engines/engine.pure.js.map +1 -1
  28. package/Engines/thinNativeEngine.pure.js +15 -8
  29. package/Engines/thinNativeEngine.pure.js.map +1 -1
  30. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCancelDelayBlock.pure.js +1 -1
  31. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCancelDelayBlock.pure.js.map +1 -1
  32. package/Materials/PBR/pbrMaterial.pure.d.ts +6 -0
  33. package/Materials/PBR/pbrMaterial.pure.js +8 -0
  34. package/Materials/PBR/pbrMaterial.pure.js.map +1 -1
  35. package/Materials/Textures/Procedurals/noiseProceduralTexture.pure.js +17 -5
  36. package/Materials/Textures/Procedurals/noiseProceduralTexture.pure.js.map +1 -1
  37. package/Materials/effect.pure.d.ts +2 -2
  38. package/Materials/effect.pure.js +12 -6
  39. package/Materials/effect.pure.js.map +1 -1
  40. package/Materials/meshDebugPluginMaterial.pure.js +15 -13
  41. package/Materials/meshDebugPluginMaterial.pure.js.map +1 -1
  42. package/Misc/tools.pure.js +11 -4
  43. package/Misc/tools.pure.js.map +1 -1
  44. package/Particles/computeShaderParticleSystem.pure.js +5 -1
  45. package/Particles/computeShaderParticleSystem.pure.js.map +1 -1
  46. package/Particles/gpuParticleSystem.pure.d.ts +1 -0
  47. package/Particles/gpuParticleSystem.pure.js +17 -1
  48. package/Particles/gpuParticleSystem.pure.js.map +1 -1
  49. package/ShadersWGSL/gpuRenderParticles.fragment.d.ts +5 -0
  50. package/ShadersWGSL/gpuRenderParticles.fragment.js +50 -0
  51. package/ShadersWGSL/gpuRenderParticles.fragment.js.map +1 -0
  52. package/ShadersWGSL/gpuRenderParticles.vertex.d.ts +5 -0
  53. package/ShadersWGSL/gpuRenderParticles.vertex.js +120 -0
  54. package/ShadersWGSL/gpuRenderParticles.vertex.js.map +1 -0
  55. package/ShadersWGSL/noise.fragment.d.ts +5 -0
  56. package/ShadersWGSL/noise.fragment.js +18 -0
  57. package/ShadersWGSL/noise.fragment.js.map +1 -0
  58. package/package.json +1 -1
@@ -0,0 +1,5 @@
1
+ /** @internal */
2
+ export declare const gpuRenderParticlesPixelShaderWGSL: {
3
+ name: string;
4
+ shader: string;
5
+ };
@@ -0,0 +1,50 @@
1
+ // Do not edit.
2
+ import { ShaderStore } from "../Engines/shaderStore.js";
3
+ import { clipPlaneFragmentDeclarationWGSL } from "./ShadersInclude/clipPlaneFragmentDeclaration.js";
4
+ import { imageProcessingDeclarationWGSL } from "./ShadersInclude/imageProcessingDeclaration.js";
5
+ import { logDepthDeclarationWGSL } from "./ShadersInclude/logDepthDeclaration.js";
6
+ import { helperFunctionsWGSL } from "./ShadersInclude/helperFunctions.js";
7
+ import { imageProcessingFunctionsWGSL } from "./ShadersInclude/imageProcessingFunctions.js";
8
+ import { fogFragmentDeclarationWGSL } from "./ShadersInclude/fogFragmentDeclaration.js";
9
+ import { clipPlaneFragmentWGSL } from "./ShadersInclude/clipPlaneFragment.js";
10
+ import { logDepthFragmentWGSL } from "./ShadersInclude/logDepthFragment.js";
11
+ import { fogFragmentWGSL } from "./ShadersInclude/fogFragment.js";
12
+ const name = "gpuRenderParticlesPixelShader";
13
+ const shader = `var diffuseSamplerSampler: sampler;var diffuseSampler: texture_2d<f32>;varying vUV: vec2f;varying vColor: vec4f;
14
+ #include<clipPlaneFragmentDeclaration>
15
+ #include<imageProcessingDeclaration>
16
+ #include<logDepthDeclaration>
17
+ #include<helperFunctions>
18
+ #include<imageProcessingFunctions>
19
+ #include<fogFragmentDeclaration>
20
+ @fragment
21
+ fn main(input: FragmentInputs)->FragmentOutputs {
22
+ #include<clipPlaneFragment>
23
+ let textureColor: vec4f=textureSample(diffuseSampler,diffuseSamplerSampler,input.vUV);var baseColor: vec4f=textureColor*input.vColor;
24
+ #ifdef BLENDMULTIPLYMODE
25
+ let alpha: f32=input.vColor.a*textureColor.a;baseColor=vec4f(baseColor.rgb*alpha+vec3f(1.0)*(1.0-alpha),baseColor.a);
26
+ #endif
27
+ #include<logDepthFragment>
28
+ #include<fogFragment>(color,baseColor)
29
+ #ifdef IMAGEPROCESSINGPOSTPROCESS
30
+ baseColor=vec4f(toLinearSpaceVec3(baseColor.rgb),baseColor.a);
31
+ #else
32
+ #ifdef IMAGEPROCESSING
33
+ baseColor=vec4f(toLinearSpaceVec3(baseColor.rgb),baseColor.a);baseColor=applyImageProcessing(baseColor);
34
+ #endif
35
+ #endif
36
+ fragmentOutputs.color=baseColor;}
37
+ `;
38
+ // Sideeffect
39
+ if (!ShaderStore.ShadersStoreWGSL[name]) {
40
+ ShaderStore.ShadersStoreWGSL[name] = shader;
41
+ }
42
+ const includes = [clipPlaneFragmentDeclarationWGSL, imageProcessingDeclarationWGSL, logDepthDeclarationWGSL, helperFunctionsWGSL, imageProcessingFunctionsWGSL, fogFragmentDeclarationWGSL, clipPlaneFragmentWGSL, logDepthFragmentWGSL, fogFragmentWGSL];
43
+ for (const inc of includes) {
44
+ if (!ShaderStore.IncludesShadersStoreWGSL[inc.name]) {
45
+ ShaderStore.IncludesShadersStoreWGSL[inc.name] = inc.shader;
46
+ }
47
+ }
48
+ /** @internal */
49
+ export const gpuRenderParticlesPixelShaderWGSL = { name, shader };
50
+ //# sourceMappingURL=gpuRenderParticles.fragment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gpuRenderParticles.fragment.js","sourceRoot":"","sources":["../../../../dev/core/src/ShadersWGSL/gpuRenderParticles.fragment.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,gCAAgC,EAAE,MAAM,+CAA+C,CAAC;AACjG,OAAO,EAAE,8BAA8B,EAAE,MAAM,6CAA6C,CAAC;AAC7F,OAAO,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAC;AAC/E,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,EAAE,4BAA4B,EAAE,MAAM,2CAA2C,CAAC;AACzF,OAAO,EAAE,0BAA0B,EAAE,MAAM,yCAAyC,CAAC;AACrF,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAE/D,MAAM,IAAI,GAAG,+BAA+B,CAAC;AAC7C,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;CAwBd,CAAC;AACF,aAAa;AACb,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC;IACtC,WAAW,CAAC,gBAAgB,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AAChD,CAAC;AACD,MAAM,QAAQ,GAAG,CAAC,gCAAgC,EAAE,8BAA8B,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,4BAA4B,EAAE,0BAA0B,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,eAAe,CAAC,CAAC;AAC1P,KAAK,MAAM,GAAG,IAAI,QAAQ,EAAE,CAAC;IACzB,IAAI,CAAC,WAAW,CAAC,wBAAwB,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;QAClD,WAAW,CAAC,wBAAwB,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC;IAChE,CAAC;AACL,CAAC;AAED,gBAAgB;AAChB,MAAM,CAAC,MAAM,iCAAiC,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../Engines/shaderStore\";\nimport { clipPlaneFragmentDeclarationWGSL } from \"./ShadersInclude/clipPlaneFragmentDeclaration\";\nimport { imageProcessingDeclarationWGSL } from \"./ShadersInclude/imageProcessingDeclaration\";\nimport { logDepthDeclarationWGSL } from \"./ShadersInclude/logDepthDeclaration\";\nimport { helperFunctionsWGSL } from \"./ShadersInclude/helperFunctions\";\nimport { imageProcessingFunctionsWGSL } from \"./ShadersInclude/imageProcessingFunctions\";\nimport { fogFragmentDeclarationWGSL } from \"./ShadersInclude/fogFragmentDeclaration\";\nimport { clipPlaneFragmentWGSL } from \"./ShadersInclude/clipPlaneFragment\";\nimport { logDepthFragmentWGSL } from \"./ShadersInclude/logDepthFragment\";\nimport { fogFragmentWGSL } from \"./ShadersInclude/fogFragment\";\n\nconst name = \"gpuRenderParticlesPixelShader\";\nconst shader = `var diffuseSamplerSampler: sampler;var diffuseSampler: texture_2d<f32>;varying vUV: vec2f;varying vColor: vec4f;\n#include<clipPlaneFragmentDeclaration>\n#include<imageProcessingDeclaration>\n#include<logDepthDeclaration>\n#include<helperFunctions>\n#include<imageProcessingFunctions>\n#include<fogFragmentDeclaration>\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {\n#include<clipPlaneFragment>\nlet textureColor: vec4f=textureSample(diffuseSampler,diffuseSamplerSampler,input.vUV);var baseColor: vec4f=textureColor*input.vColor;\n#ifdef BLENDMULTIPLYMODE\nlet alpha: f32=input.vColor.a*textureColor.a;baseColor=vec4f(baseColor.rgb*alpha+vec3f(1.0)*(1.0-alpha),baseColor.a);\n#endif\n#include<logDepthFragment>\n#include<fogFragment>(color,baseColor)\n#ifdef IMAGEPROCESSINGPOSTPROCESS\nbaseColor=vec4f(toLinearSpaceVec3(baseColor.rgb),baseColor.a);\n#else\n#ifdef IMAGEPROCESSING\nbaseColor=vec4f(toLinearSpaceVec3(baseColor.rgb),baseColor.a);baseColor=applyImageProcessing(baseColor);\n#endif\n#endif\nfragmentOutputs.color=baseColor;}\n`;\n// Sideeffect\nif (!ShaderStore.ShadersStoreWGSL[name]) {\n ShaderStore.ShadersStoreWGSL[name] = shader;\n}\nconst includes = [clipPlaneFragmentDeclarationWGSL, imageProcessingDeclarationWGSL, logDepthDeclarationWGSL, helperFunctionsWGSL, imageProcessingFunctionsWGSL, fogFragmentDeclarationWGSL, clipPlaneFragmentWGSL, logDepthFragmentWGSL, fogFragmentWGSL];\nfor (const inc of includes) {\n if (!ShaderStore.IncludesShadersStoreWGSL[inc.name]) {\n ShaderStore.IncludesShadersStoreWGSL[inc.name] = inc.shader;\n }\n}\n\n/** @internal */\nexport const gpuRenderParticlesPixelShaderWGSL = { name, shader };\n"]}
@@ -0,0 +1,5 @@
1
+ /** @internal */
2
+ export declare const gpuRenderParticlesVertexShaderWGSL: {
3
+ name: string;
4
+ shader: string;
5
+ };
@@ -0,0 +1,120 @@
1
+ // Do not edit.
2
+ import { ShaderStore } from "../Engines/shaderStore.js";
3
+ import { clipPlaneVertexDeclarationWGSL } from "./ShadersInclude/clipPlaneVertexDeclaration.js";
4
+ import { fogVertexDeclarationWGSL } from "./ShadersInclude/fogVertexDeclaration.js";
5
+ import { logDepthDeclarationWGSL } from "./ShadersInclude/logDepthDeclaration.js";
6
+ import { clipPlaneVertexWGSL } from "./ShadersInclude/clipPlaneVertex.js";
7
+ import { fogVertexWGSL } from "./ShadersInclude/fogVertex.js";
8
+ import { logDepthVertexWGSL } from "./ShadersInclude/logDepthVertex.js";
9
+ const name = "gpuRenderParticlesVertexShader";
10
+ const shader = `uniform view: mat4x4f;uniform projection: mat4x4f;uniform translationPivot: vec2f;uniform worldOffset: vec3f;
11
+ #ifdef LOCAL
12
+ uniform emitterWM: mat4x4f;
13
+ #endif
14
+ attribute position: vec3f;attribute age: f32;attribute life: f32;attribute size: vec3f;
15
+ #if !defined(BILLBOARD) || defined(BILLBOARDSTRETCHED_LOCAL)
16
+ attribute initialDirection: vec3f;
17
+ #endif
18
+ #ifdef BILLBOARDSTRETCHED
19
+ attribute direction: vec3f;
20
+ #endif
21
+ attribute angle: f32;
22
+ #ifdef ANIMATESHEET
23
+ attribute cellIndex: f32;
24
+ #endif
25
+ attribute offset: vec2f;attribute uv: vec2f;varying vUV: vec2f;varying vColor: vec4f;varying vPositionW: vec3f;
26
+ #if defined(BILLBOARD) && !defined(BILLBOARDY) && !defined(BILLBOARDSTRETCHED)
27
+ uniform invView: mat4x4f;
28
+ #endif
29
+ #include<clipPlaneVertexDeclaration>
30
+ #include<fogVertexDeclaration>
31
+ #include<logDepthDeclaration>
32
+ #ifdef COLORGRADIENTS
33
+ var colorGradientSamplerSampler: sampler;var colorGradientSampler: texture_2d<f32>;
34
+ #ifdef COLORGRADIENTS_COLOR2
35
+ attribute seed: vec4f;
36
+ #endif
37
+ #else
38
+ uniform colorDead: vec4f;attribute color: vec4f;
39
+ #endif
40
+ #ifdef ANIMATESHEET
41
+ uniform sheetInfos: vec3f;
42
+ #endif
43
+ #ifdef BILLBOARD
44
+ uniform eyePosition: vec3f;
45
+ #endif
46
+ fn particleBasePosition()->vec3f {
47
+ #ifdef LOCAL
48
+ return (uniforms.emitterWM*vec4f(vertexInputs.position,1.0)).xyz+uniforms.worldOffset;
49
+ #else
50
+ return vertexInputs.position+uniforms.worldOffset;
51
+ #endif
52
+ }
53
+ fn rotate(yaxis: vec3f,rotatedCorner: vec3f)->vec3f {let xaxis: vec3f=normalize(cross(vec3f(0.0,1.0,0.0),yaxis));let zaxis: vec3f=normalize(cross(yaxis,xaxis));let rotMatrix: mat3x3f=mat3x3f(xaxis,yaxis,zaxis);return particleBasePosition()+rotMatrix*rotatedCorner;}
54
+ #ifdef BILLBOARDSTRETCHED
55
+ fn rotateAlign(toCamera: vec3f,rotatedCorner: vec3f)->vec3f {let normalizedToCamera: vec3f=normalize(toCamera);
56
+ #ifdef BILLBOARDSTRETCHED_LOCAL
57
+ let normalizedCrossDirToCamera: vec3f=normalize(cross(normalize(vertexInputs.initialDirection),normalizedToCamera));let row1: vec3f=normalize(vertexInputs.initialDirection);
58
+ #else
59
+ let normalizedCrossDirToCamera: vec3f=normalize(cross(normalize(vertexInputs.direction),normalizedToCamera));let row1: vec3f=normalize(cross(normalizedToCamera,normalizedCrossDirToCamera));
60
+ #endif
61
+ let rotMatrix: mat3x3f=mat3x3f(normalizedCrossDirToCamera,row1,normalizedToCamera);return particleBasePosition()+rotMatrix*rotatedCorner;}
62
+ #endif
63
+ @vertex
64
+ fn main(input: VertexInputs)->FragmentInputs {
65
+ #ifdef EMITRATECTRL
66
+ let shouldCullParticle: bool=vertexInputs.life>0.0 && vertexInputs.age>=vertexInputs.life;
67
+ #endif
68
+ #ifdef ANIMATESHEET
69
+ let rowOffset: f32=floor(vertexInputs.cellIndex/uniforms.sheetInfos.z);let columnOffset: f32=vertexInputs.cellIndex-rowOffset*uniforms.sheetInfos.z;let uvScale: vec2f=uniforms.sheetInfos.xy;let uvOffset: vec2f=vec2f(vertexInputs.uv.x,1.0-vertexInputs.uv.y);vertexOutputs.vUV=(uvOffset+vec2f(columnOffset,rowOffset))*uvScale;
70
+ #else
71
+ vertexOutputs.vUV=vertexInputs.uv;
72
+ #endif
73
+ let ratio: f32=min(1.0,vertexInputs.age/vertexInputs.life);
74
+ #ifdef COLORGRADIENTS
75
+ #ifdef COLORGRADIENTS_COLOR2
76
+ let vColor1: vec4f=textureSampleLevel(colorGradientSampler,colorGradientSamplerSampler,vec2f(ratio,0.25),0.0);let vColor2: vec4f=textureSampleLevel(colorGradientSampler,colorGradientSamplerSampler,vec2f(ratio,0.75),0.0);vertexOutputs.vColor=mix(vColor1,vColor2,vertexInputs.seed.x);
77
+ #else
78
+ vertexOutputs.vColor=textureSampleLevel(colorGradientSampler,colorGradientSamplerSampler,vec2f(ratio,0.0),0.0);
79
+ #endif
80
+ #else
81
+ vertexOutputs.vColor=vertexInputs.color*vec4f(1.0-ratio)+uniforms.colorDead*vec4f(ratio);
82
+ #endif
83
+ let cornerPos: vec2f=(vertexInputs.offset-uniforms.translationPivot)*vertexInputs.size.yz*vertexInputs.size.x;
84
+ #ifdef BILLBOARD
85
+ var rotatedCorner: vec4f;rotatedCorner.w=0.0;
86
+ #ifdef BILLBOARDY
87
+ rotatedCorner.x=cornerPos.x*cos(vertexInputs.angle)-cornerPos.y*sin(vertexInputs.angle);rotatedCorner.z=cornerPos.x*sin(vertexInputs.angle)+cornerPos.y*cos(vertexInputs.angle);rotatedCorner.y=0.0;rotatedCorner.x+=uniforms.translationPivot.x;rotatedCorner.z+=uniforms.translationPivot.y;var yaxis: vec3f=vertexInputs.position+uniforms.worldOffset-uniforms.eyePosition;yaxis.y=0.0;vertexOutputs.vPositionW=rotate(normalize(yaxis),rotatedCorner.xyz);let viewPosition: vec4f=uniforms.view*vec4f(vertexOutputs.vPositionW,1.0);
88
+ #elif defined(BILLBOARDSTRETCHED)
89
+ rotatedCorner.x=cornerPos.x*cos(vertexInputs.angle)-cornerPos.y*sin(vertexInputs.angle);rotatedCorner.y=cornerPos.x*sin(vertexInputs.angle)+cornerPos.y*cos(vertexInputs.angle);rotatedCorner.z=0.0;rotatedCorner.x+=uniforms.translationPivot.x;rotatedCorner.y+=uniforms.translationPivot.y;let toCamera: vec3f=vertexInputs.position+uniforms.worldOffset-uniforms.eyePosition;vertexOutputs.vPositionW=rotateAlign(toCamera,rotatedCorner.xyz);let viewPosition: vec4f=uniforms.view*vec4f(vertexOutputs.vPositionW,1.0);
90
+ #else
91
+ rotatedCorner.x=cornerPos.x*cos(vertexInputs.angle)-cornerPos.y*sin(vertexInputs.angle);rotatedCorner.y=cornerPos.x*sin(vertexInputs.angle)+cornerPos.y*cos(vertexInputs.angle);rotatedCorner.z=0.0;rotatedCorner.x+=uniforms.translationPivot.x;rotatedCorner.y+=uniforms.translationPivot.y;let viewPosition: vec4f=uniforms.view*vec4f(particleBasePosition(),1.0)+rotatedCorner;vertexOutputs.vPositionW=(uniforms.invView*viewPosition).xyz;
92
+ #endif
93
+ #else
94
+ var rotatedCorner: vec3f;rotatedCorner.x=cornerPos.x*cos(vertexInputs.angle)-cornerPos.y*sin(vertexInputs.angle);rotatedCorner.y=0.0;rotatedCorner.z=cornerPos.x*sin(vertexInputs.angle)+cornerPos.y*cos(vertexInputs.angle);rotatedCorner.x+=uniforms.translationPivot.x;rotatedCorner.z+=uniforms.translationPivot.y;let yaxis: vec3f=normalize(vertexInputs.initialDirection);vertexOutputs.vPositionW=rotate(yaxis,rotatedCorner);let viewPosition: vec4f=uniforms.view*vec4f(vertexOutputs.vPositionW,1.0);
95
+ #endif
96
+ vertexOutputs.position=uniforms.projection*viewPosition;
97
+ #if defined(CLIPPLANE) || defined(CLIPPLANE2) || defined(CLIPPLANE3) || defined(CLIPPLANE4) || defined(CLIPPLANE5) || defined(CLIPPLANE6) || defined(FOG)
98
+ let worldPos: vec4f=vec4f(vertexOutputs.vPositionW,1.0);
99
+ #endif
100
+ #include<clipPlaneVertex>
101
+ #include<fogVertex>
102
+ #include<logDepthVertex>
103
+ #ifdef EMITRATECTRL
104
+ if (shouldCullParticle) {vertexOutputs.position=vec4f(0.0,0.0,2.0,1.0);vertexOutputs.vColor=vec4f(0.0);vertexOutputs.vUV=vec2f(0.0);vertexOutputs.vPositionW=vec3f(0.0);}
105
+ #endif
106
+ }
107
+ `;
108
+ // Sideeffect
109
+ if (!ShaderStore.ShadersStoreWGSL[name]) {
110
+ ShaderStore.ShadersStoreWGSL[name] = shader;
111
+ }
112
+ const includes = [clipPlaneVertexDeclarationWGSL, fogVertexDeclarationWGSL, logDepthDeclarationWGSL, clipPlaneVertexWGSL, fogVertexWGSL, logDepthVertexWGSL];
113
+ for (const inc of includes) {
114
+ if (!ShaderStore.IncludesShadersStoreWGSL[inc.name]) {
115
+ ShaderStore.IncludesShadersStoreWGSL[inc.name] = inc.shader;
116
+ }
117
+ }
118
+ /** @internal */
119
+ export const gpuRenderParticlesVertexShaderWGSL = { name, shader };
120
+ //# sourceMappingURL=gpuRenderParticles.vertex.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gpuRenderParticles.vertex.js","sourceRoot":"","sources":["../../../../dev/core/src/ShadersWGSL/gpuRenderParticles.vertex.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,8BAA8B,EAAE,MAAM,6CAA6C,CAAC;AAC7F,OAAO,EAAE,wBAAwB,EAAE,MAAM,uCAAuC,CAAC;AACjF,OAAO,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAC;AAC/E,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAErE,MAAM,IAAI,GAAG,gCAAgC,CAAC;AAC9C,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiGd,CAAC;AACF,aAAa;AACb,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC;IACtC,WAAW,CAAC,gBAAgB,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AAChD,CAAC;AACD,MAAM,QAAQ,GAAG,CAAC,8BAA8B,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,aAAa,EAAE,kBAAkB,CAAC,CAAC;AAC7J,KAAK,MAAM,GAAG,IAAI,QAAQ,EAAE,CAAC;IACzB,IAAI,CAAC,WAAW,CAAC,wBAAwB,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;QAClD,WAAW,CAAC,wBAAwB,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC;IAChE,CAAC;AACL,CAAC;AAED,gBAAgB;AAChB,MAAM,CAAC,MAAM,kCAAkC,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../Engines/shaderStore\";\nimport { clipPlaneVertexDeclarationWGSL } from \"./ShadersInclude/clipPlaneVertexDeclaration\";\nimport { fogVertexDeclarationWGSL } from \"./ShadersInclude/fogVertexDeclaration\";\nimport { logDepthDeclarationWGSL } from \"./ShadersInclude/logDepthDeclaration\";\nimport { clipPlaneVertexWGSL } from \"./ShadersInclude/clipPlaneVertex\";\nimport { fogVertexWGSL } from \"./ShadersInclude/fogVertex\";\nimport { logDepthVertexWGSL } from \"./ShadersInclude/logDepthVertex\";\n\nconst name = \"gpuRenderParticlesVertexShader\";\nconst shader = `uniform view: mat4x4f;uniform projection: mat4x4f;uniform translationPivot: vec2f;uniform worldOffset: vec3f;\n#ifdef LOCAL\nuniform emitterWM: mat4x4f;\n#endif\nattribute position: vec3f;attribute age: f32;attribute life: f32;attribute size: vec3f;\n#if !defined(BILLBOARD) || defined(BILLBOARDSTRETCHED_LOCAL)\nattribute initialDirection: vec3f;\n#endif\n#ifdef BILLBOARDSTRETCHED\nattribute direction: vec3f;\n#endif\nattribute angle: f32;\n#ifdef ANIMATESHEET\nattribute cellIndex: f32;\n#endif\nattribute offset: vec2f;attribute uv: vec2f;varying vUV: vec2f;varying vColor: vec4f;varying vPositionW: vec3f;\n#if defined(BILLBOARD) && !defined(BILLBOARDY) && !defined(BILLBOARDSTRETCHED)\nuniform invView: mat4x4f;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<fogVertexDeclaration>\n#include<logDepthDeclaration>\n#ifdef COLORGRADIENTS\nvar colorGradientSamplerSampler: sampler;var colorGradientSampler: texture_2d<f32>;\n#ifdef COLORGRADIENTS_COLOR2\nattribute seed: vec4f;\n#endif\n#else\nuniform colorDead: vec4f;attribute color: vec4f;\n#endif\n#ifdef ANIMATESHEET\nuniform sheetInfos: vec3f;\n#endif\n#ifdef BILLBOARD\nuniform eyePosition: vec3f;\n#endif\nfn particleBasePosition()->vec3f {\n#ifdef LOCAL\nreturn (uniforms.emitterWM*vec4f(vertexInputs.position,1.0)).xyz+uniforms.worldOffset;\n#else\nreturn vertexInputs.position+uniforms.worldOffset;\n#endif\n}\nfn rotate(yaxis: vec3f,rotatedCorner: vec3f)->vec3f {let xaxis: vec3f=normalize(cross(vec3f(0.0,1.0,0.0),yaxis));let zaxis: vec3f=normalize(cross(yaxis,xaxis));let rotMatrix: mat3x3f=mat3x3f(xaxis,yaxis,zaxis);return particleBasePosition()+rotMatrix*rotatedCorner;}\n#ifdef BILLBOARDSTRETCHED\nfn rotateAlign(toCamera: vec3f,rotatedCorner: vec3f)->vec3f {let normalizedToCamera: vec3f=normalize(toCamera);\n#ifdef BILLBOARDSTRETCHED_LOCAL\nlet normalizedCrossDirToCamera: vec3f=normalize(cross(normalize(vertexInputs.initialDirection),normalizedToCamera));let row1: vec3f=normalize(vertexInputs.initialDirection);\n#else\nlet normalizedCrossDirToCamera: vec3f=normalize(cross(normalize(vertexInputs.direction),normalizedToCamera));let row1: vec3f=normalize(cross(normalizedToCamera,normalizedCrossDirToCamera));\n#endif\nlet rotMatrix: mat3x3f=mat3x3f(normalizedCrossDirToCamera,row1,normalizedToCamera);return particleBasePosition()+rotMatrix*rotatedCorner;}\n#endif\n@vertex\nfn main(input: VertexInputs)->FragmentInputs {\n#ifdef EMITRATECTRL\nlet shouldCullParticle: bool=vertexInputs.life>0.0 && vertexInputs.age>=vertexInputs.life;\n#endif\n#ifdef ANIMATESHEET\nlet rowOffset: f32=floor(vertexInputs.cellIndex/uniforms.sheetInfos.z);let columnOffset: f32=vertexInputs.cellIndex-rowOffset*uniforms.sheetInfos.z;let uvScale: vec2f=uniforms.sheetInfos.xy;let uvOffset: vec2f=vec2f(vertexInputs.uv.x,1.0-vertexInputs.uv.y);vertexOutputs.vUV=(uvOffset+vec2f(columnOffset,rowOffset))*uvScale;\n#else\nvertexOutputs.vUV=vertexInputs.uv;\n#endif\nlet ratio: f32=min(1.0,vertexInputs.age/vertexInputs.life);\n#ifdef COLORGRADIENTS\n#ifdef COLORGRADIENTS_COLOR2\nlet vColor1: vec4f=textureSampleLevel(colorGradientSampler,colorGradientSamplerSampler,vec2f(ratio,0.25),0.0);let vColor2: vec4f=textureSampleLevel(colorGradientSampler,colorGradientSamplerSampler,vec2f(ratio,0.75),0.0);vertexOutputs.vColor=mix(vColor1,vColor2,vertexInputs.seed.x);\n#else\nvertexOutputs.vColor=textureSampleLevel(colorGradientSampler,colorGradientSamplerSampler,vec2f(ratio,0.0),0.0);\n#endif\n#else\nvertexOutputs.vColor=vertexInputs.color*vec4f(1.0-ratio)+uniforms.colorDead*vec4f(ratio);\n#endif\nlet cornerPos: vec2f=(vertexInputs.offset-uniforms.translationPivot)*vertexInputs.size.yz*vertexInputs.size.x;\n#ifdef BILLBOARD\nvar rotatedCorner: vec4f;rotatedCorner.w=0.0;\n#ifdef BILLBOARDY\nrotatedCorner.x=cornerPos.x*cos(vertexInputs.angle)-cornerPos.y*sin(vertexInputs.angle);rotatedCorner.z=cornerPos.x*sin(vertexInputs.angle)+cornerPos.y*cos(vertexInputs.angle);rotatedCorner.y=0.0;rotatedCorner.x+=uniforms.translationPivot.x;rotatedCorner.z+=uniforms.translationPivot.y;var yaxis: vec3f=vertexInputs.position+uniforms.worldOffset-uniforms.eyePosition;yaxis.y=0.0;vertexOutputs.vPositionW=rotate(normalize(yaxis),rotatedCorner.xyz);let viewPosition: vec4f=uniforms.view*vec4f(vertexOutputs.vPositionW,1.0);\n#elif defined(BILLBOARDSTRETCHED)\nrotatedCorner.x=cornerPos.x*cos(vertexInputs.angle)-cornerPos.y*sin(vertexInputs.angle);rotatedCorner.y=cornerPos.x*sin(vertexInputs.angle)+cornerPos.y*cos(vertexInputs.angle);rotatedCorner.z=0.0;rotatedCorner.x+=uniforms.translationPivot.x;rotatedCorner.y+=uniforms.translationPivot.y;let toCamera: vec3f=vertexInputs.position+uniforms.worldOffset-uniforms.eyePosition;vertexOutputs.vPositionW=rotateAlign(toCamera,rotatedCorner.xyz);let viewPosition: vec4f=uniforms.view*vec4f(vertexOutputs.vPositionW,1.0);\n#else\nrotatedCorner.x=cornerPos.x*cos(vertexInputs.angle)-cornerPos.y*sin(vertexInputs.angle);rotatedCorner.y=cornerPos.x*sin(vertexInputs.angle)+cornerPos.y*cos(vertexInputs.angle);rotatedCorner.z=0.0;rotatedCorner.x+=uniforms.translationPivot.x;rotatedCorner.y+=uniforms.translationPivot.y;let viewPosition: vec4f=uniforms.view*vec4f(particleBasePosition(),1.0)+rotatedCorner;vertexOutputs.vPositionW=(uniforms.invView*viewPosition).xyz;\n#endif\n#else\nvar rotatedCorner: vec3f;rotatedCorner.x=cornerPos.x*cos(vertexInputs.angle)-cornerPos.y*sin(vertexInputs.angle);rotatedCorner.y=0.0;rotatedCorner.z=cornerPos.x*sin(vertexInputs.angle)+cornerPos.y*cos(vertexInputs.angle);rotatedCorner.x+=uniforms.translationPivot.x;rotatedCorner.z+=uniforms.translationPivot.y;let yaxis: vec3f=normalize(vertexInputs.initialDirection);vertexOutputs.vPositionW=rotate(yaxis,rotatedCorner);let viewPosition: vec4f=uniforms.view*vec4f(vertexOutputs.vPositionW,1.0);\n#endif\nvertexOutputs.position=uniforms.projection*viewPosition;\n#if defined(CLIPPLANE) || defined(CLIPPLANE2) || defined(CLIPPLANE3) || defined(CLIPPLANE4) || defined(CLIPPLANE5) || defined(CLIPPLANE6) || defined(FOG)\nlet worldPos: vec4f=vec4f(vertexOutputs.vPositionW,1.0);\n#endif\n#include<clipPlaneVertex>\n#include<fogVertex>\n#include<logDepthVertex>\n#ifdef EMITRATECTRL\nif (shouldCullParticle) {vertexOutputs.position=vec4f(0.0,0.0,2.0,1.0);vertexOutputs.vColor=vec4f(0.0);vertexOutputs.vUV=vec2f(0.0);vertexOutputs.vPositionW=vec3f(0.0);}\n#endif\n}\n`;\n// Sideeffect\nif (!ShaderStore.ShadersStoreWGSL[name]) {\n ShaderStore.ShadersStoreWGSL[name] = shader;\n}\nconst includes = [clipPlaneVertexDeclarationWGSL, fogVertexDeclarationWGSL, logDepthDeclarationWGSL, clipPlaneVertexWGSL, fogVertexWGSL, logDepthVertexWGSL];\nfor (const inc of includes) {\n if (!ShaderStore.IncludesShadersStoreWGSL[inc.name]) {\n ShaderStore.IncludesShadersStoreWGSL[inc.name] = inc.shader;\n }\n}\n\n/** @internal */\nexport const gpuRenderParticlesVertexShaderWGSL = { name, shader };\n"]}
@@ -0,0 +1,5 @@
1
+ /** @internal */
2
+ export declare const noisePixelShaderWGSL: {
3
+ name: string;
4
+ shader: string;
5
+ };
@@ -0,0 +1,18 @@
1
+ // Do not edit.
2
+ import { ShaderStore } from "../Engines/shaderStore.js";
3
+ const name = "noisePixelShader";
4
+ const shader = `uniform brightness: f32;uniform persistence: f32;uniform timeScale: f32;varying vUV: vec2f;fn hash22(input: vec2f)->vec2f {var p=vec2f(dot(input,vec2f(127.1,311.7)),dot(input,vec2f(269.5,183.3)));p=-vec2f(1.0)+2.0*fract(sin(p)*43758.5453123);return sin(p*6.283+uniforms.timeScale);}
5
+ fn interpolationNoise(p: vec2f)->f32 {let pi=floor(p);let pf=p-pi;let w=pf*pf*(vec2f(3.0)-2.0*pf);let f00=dot(hash22(pi+vec2f(0.0,0.0)),pf-vec2f(0.0,0.0));let f01=dot(hash22(pi+vec2f(0.0,1.0)),pf-vec2f(0.0,1.0));let f10=dot(hash22(pi+vec2f(1.0,0.0)),pf-vec2f(1.0,0.0));let f11=dot(hash22(pi+vec2f(1.0,1.0)),pf-vec2f(1.0,1.0));let xm1=mix(f00,f10,w.x);let xm2=mix(f01,f11,w.x);return mix(xm1,xm2,w.y);}
6
+ fn perlinNoise2D(x: f32,y: f32)->f32 {var sum=0.0;var frequency=0.0;var amplitude=0.0;for (var i=0; i<OCTAVES; i++) {frequency=pow(2.0,f32(i));amplitude=pow(uniforms.persistence,f32(i));sum=sum+interpolationNoise(vec2f(x*frequency,y*frequency))*amplitude;}
7
+ return sum;}
8
+ #define CUSTOM_FRAGMENT_DEFINITIONS
9
+ @fragment
10
+ fn main(input: FragmentInputs)->FragmentOutputs {let x=abs(input.vUV.x);let y=abs(input.vUV.y);let noise=uniforms.brightness+(1.0-uniforms.brightness)*perlinNoise2D(x,y);fragmentOutputs.color=vec4f(noise,noise,noise,1.0);}
11
+ `;
12
+ // Sideeffect
13
+ if (!ShaderStore.ShadersStoreWGSL[name]) {
14
+ ShaderStore.ShadersStoreWGSL[name] = shader;
15
+ }
16
+ /** @internal */
17
+ export const noisePixelShaderWGSL = { name, shader };
18
+ //# sourceMappingURL=noise.fragment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"noise.fragment.js","sourceRoot":"","sources":["../../../../dev/core/src/ShadersWGSL/noise.fragment.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAErD,MAAM,IAAI,GAAG,kBAAkB,CAAC;AAChC,MAAM,MAAM,GAAG;;;;;;;CAOd,CAAC;AACF,aAAa;AACb,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC;IACtC,WAAW,CAAC,gBAAgB,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AAChD,CAAC;AAED,gBAAgB;AAChB,MAAM,CAAC,MAAM,oBAAoB,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../Engines/shaderStore\";\n\nconst name = \"noisePixelShader\";\nconst shader = `uniform brightness: f32;uniform persistence: f32;uniform timeScale: f32;varying vUV: vec2f;fn hash22(input: vec2f)->vec2f {var p=vec2f(dot(input,vec2f(127.1,311.7)),dot(input,vec2f(269.5,183.3)));p=-vec2f(1.0)+2.0*fract(sin(p)*43758.5453123);return sin(p*6.283+uniforms.timeScale);}\nfn interpolationNoise(p: vec2f)->f32 {let pi=floor(p);let pf=p-pi;let w=pf*pf*(vec2f(3.0)-2.0*pf);let f00=dot(hash22(pi+vec2f(0.0,0.0)),pf-vec2f(0.0,0.0));let f01=dot(hash22(pi+vec2f(0.0,1.0)),pf-vec2f(0.0,1.0));let f10=dot(hash22(pi+vec2f(1.0,0.0)),pf-vec2f(1.0,0.0));let f11=dot(hash22(pi+vec2f(1.0,1.0)),pf-vec2f(1.0,1.0));let xm1=mix(f00,f10,w.x);let xm2=mix(f01,f11,w.x);return mix(xm1,xm2,w.y);}\nfn perlinNoise2D(x: f32,y: f32)->f32 {var sum=0.0;var frequency=0.0;var amplitude=0.0;for (var i=0; i<OCTAVES; i++) {frequency=pow(2.0,f32(i));amplitude=pow(uniforms.persistence,f32(i));sum=sum+interpolationNoise(vec2f(x*frequency,y*frequency))*amplitude;}\nreturn sum;}\n#define CUSTOM_FRAGMENT_DEFINITIONS\n@fragment\nfn main(input: FragmentInputs)->FragmentOutputs {let x=abs(input.vUV.x);let y=abs(input.vUV.y);let noise=uniforms.brightness+(1.0-uniforms.brightness)*perlinNoise2D(x,y);fragmentOutputs.color=vec4f(noise,noise,noise,1.0);}\n`;\n// Sideeffect\nif (!ShaderStore.ShadersStoreWGSL[name]) {\n ShaderStore.ShadersStoreWGSL[name] = shader;\n}\n\n/** @internal */\nexport const noisePixelShaderWGSL = { name, shader };\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@babylonjs/core",
3
- "version": "9.10.1",
3
+ "version": "9.11.0",
4
4
  "main": "index.js",
5
5
  "module": "index.js",
6
6
  "types": "index.d.ts",