@babylonjs/procedural-textures 5.19.0 → 5.22.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/brick/brickProceduralTexture.fragment.js +16 -3
  2. package/brick/brickProceduralTexture.fragment.js.map +1 -1
  3. package/brick/brickProceduralTexture.js +58 -79
  4. package/brick/brickProceduralTexture.js.map +1 -1
  5. package/cloud/cloudProceduralTexture.fragment.js +14 -3
  6. package/cloud/cloudProceduralTexture.fragment.js.map +1 -1
  7. package/cloud/cloudProceduralTexture.js +58 -79
  8. package/cloud/cloudProceduralTexture.js.map +1 -1
  9. package/fire/fireProceduralTexture.fragment.js +7 -3
  10. package/fire/fireProceduralTexture.fragment.js.map +1 -1
  11. package/fire/fireProceduralTexture.js +85 -126
  12. package/fire/fireProceduralTexture.js.map +1 -1
  13. package/grass/grassProceduralTexture.fragment.js +12 -3
  14. package/grass/grassProceduralTexture.fragment.js.map +1 -1
  15. package/grass/grassProceduralTexture.js +36 -49
  16. package/grass/grassProceduralTexture.js.map +1 -1
  17. package/legacy/legacy-brick.js +2 -2
  18. package/legacy/legacy-brick.js.map +1 -1
  19. package/legacy/legacy-cloud.js +2 -2
  20. package/legacy/legacy-cloud.js.map +1 -1
  21. package/legacy/legacy-fire.js +2 -2
  22. package/legacy/legacy-fire.js.map +1 -1
  23. package/legacy/legacy-grass.js +2 -2
  24. package/legacy/legacy-grass.js.map +1 -1
  25. package/legacy/legacy-marble.js +2 -2
  26. package/legacy/legacy-marble.js.map +1 -1
  27. package/legacy/legacy-normalMap.js +2 -2
  28. package/legacy/legacy-normalMap.js.map +1 -1
  29. package/legacy/legacy-perlinNoise.js +2 -2
  30. package/legacy/legacy-perlinNoise.js.map +1 -1
  31. package/legacy/legacy-road.js +2 -2
  32. package/legacy/legacy-road.js.map +1 -1
  33. package/legacy/legacy-starfield.js +2 -2
  34. package/legacy/legacy-starfield.js.map +1 -1
  35. package/legacy/legacy-wood.js +2 -2
  36. package/legacy/legacy-wood.js.map +1 -1
  37. package/legacy/legacy.js +2 -2
  38. package/legacy/legacy.js.map +1 -1
  39. package/marble/marbleProceduralTexture.fragment.js +3 -3
  40. package/marble/marbleProceduralTexture.fragment.js.map +1 -1
  41. package/marble/marbleProceduralTexture.js +58 -79
  42. package/marble/marbleProceduralTexture.js.map +1 -1
  43. package/normalMap/normalMapProceduralTexture.fragment.js +7 -3
  44. package/normalMap/normalMapProceduralTexture.fragment.js.map +1 -1
  45. package/normalMap/normalMapProceduralTexture.js +33 -42
  46. package/normalMap/normalMapProceduralTexture.js.map +1 -1
  47. package/package.json +2 -5
  48. package/perlinNoise/perlinNoiseProceduralTexture.fragment.js +41 -3
  49. package/perlinNoise/perlinNoiseProceduralTexture.fragment.js.map +1 -1
  50. package/perlinNoise/perlinNoiseProceduralTexture.js +35 -40
  51. package/perlinNoise/perlinNoiseProceduralTexture.js.map +1 -1
  52. package/road/roadProceduralTexture.fragment.js +13 -3
  53. package/road/roadProceduralTexture.fragment.js.map +1 -1
  54. package/road/roadProceduralTexture.js +25 -34
  55. package/road/roadProceduralTexture.js.map +1 -1
  56. package/starfield/starfieldProceduralTexture.fragment.js +18 -3
  57. package/starfield/starfieldProceduralTexture.fragment.js.map +1 -1
  58. package/starfield/starfieldProceduralTexture.js +136 -185
  59. package/starfield/starfieldProceduralTexture.js.map +1 -1
  60. package/wood/woodProceduralTexture.fragment.js +12 -3
  61. package/wood/woodProceduralTexture.fragment.js.map +1 -1
  62. package/wood/woodProceduralTexture.js +36 -49
  63. package/wood/woodProceduralTexture.js.map +1 -1
@@ -1,9 +1,22 @@
1
1
  // Do not edit.
2
2
  import { ShaderStore } from "@babylonjs/core/Engines/shaderStore.js";
3
- var name = "brickProceduralTexturePixelShader";
4
- var shader = "precision highp float;varying vec2 vPosition;varying vec2 vUV;uniform float numberOfBricksHeight;uniform float numberOfBricksWidth;uniform vec3 brickColor;uniform vec3 jointColor;float rand(vec2 n) {return fract(cos(dot(n,vec2(12.9898,4.1414)))*43758.5453);}\nfloat noise(vec2 n) {const vec2 d=vec2(0.0,1.0);vec2 b=floor(n),f=smoothstep(vec2(0.0),vec2(1.0),fract(n));return mix(mix(rand(b),rand(b+d.yx),f.x),mix(rand(b+d.xy),rand(b+d.yy),f.x),f.y);}\nfloat fbm(vec2 n) {float total=0.0,amplitude=1.0;for (int i=0; i<4; i++) {total+=noise(n)*amplitude;n+=n;amplitude*=0.5;}\nreturn total;}\nfloat roundF(float number){return sign(number)*floor(abs(number)+0.5);}\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{float brickW=1.0/numberOfBricksWidth;float brickH=1.0/numberOfBricksHeight;float jointWPercentage=0.01;float jointHPercentage=0.05;vec3 color=brickColor;float yi=vUV.y/brickH;float nyi=roundF(yi);float xi=vUV.x/brickW;if (mod(floor(yi),2.0)==0.0){xi=xi-0.5;}\nfloat nxi=roundF(xi);vec2 brickvUV=vec2((xi-floor(xi))/brickH,(yi-floor(yi))/ brickW);if (yi<nyi+jointHPercentage && yi>nyi-jointHPercentage){color=mix(jointColor,vec3(0.37,0.25,0.25),(yi-nyi)/jointHPercentage+0.2);}\nelse if (xi<nxi+jointWPercentage && xi>nxi-jointWPercentage){color=mix(jointColor,vec3(0.44,0.44,0.44),(xi-nxi)/jointWPercentage+0.2);}\nelse {float brickColorSwitch=mod(floor(yi)+floor(xi),3.0);if (brickColorSwitch==0.0)\ncolor=mix(color,vec3(0.33,0.33,0.33),0.3);else if (brickColorSwitch==2.0)\ncolor=mix(color,vec3(0.11,0.11,0.11),0.3);}\ngl_FragColor=vec4(color,1.0);}";
3
+ const name = "brickProceduralTexturePixelShader";
4
+ const shader = `precision highp float;varying vec2 vPosition;varying vec2 vUV;uniform float numberOfBricksHeight;uniform float numberOfBricksWidth;uniform vec3 brickColor;uniform vec3 jointColor;float rand(vec2 n) {return fract(cos(dot(n,vec2(12.9898,4.1414)))*43758.5453);}
5
+ float noise(vec2 n) {const vec2 d=vec2(0.0,1.0);vec2 b=floor(n),f=smoothstep(vec2(0.0),vec2(1.0),fract(n));return mix(mix(rand(b),rand(b+d.yx),f.x),mix(rand(b+d.xy),rand(b+d.yy),f.x),f.y);}
6
+ float fbm(vec2 n) {float total=0.0,amplitude=1.0;for (int i=0; i<4; i++) {total+=noise(n)*amplitude;n+=n;amplitude*=0.5;}
7
+ return total;}
8
+ float roundF(float number){return sign(number)*floor(abs(number)+0.5);}
9
+ #define CUSTOM_FRAGMENT_DEFINITIONS
10
+ void main(void)
11
+ {float brickW=1.0/numberOfBricksWidth;float brickH=1.0/numberOfBricksHeight;float jointWPercentage=0.01;float jointHPercentage=0.05;vec3 color=brickColor;float yi=vUV.y/brickH;float nyi=roundF(yi);float xi=vUV.x/brickW;if (mod(floor(yi),2.0)==0.0){xi=xi-0.5;}
12
+ float nxi=roundF(xi);vec2 brickvUV=vec2((xi-floor(xi))/brickH,(yi-floor(yi))/ brickW);if (yi<nyi+jointHPercentage && yi>nyi-jointHPercentage){color=mix(jointColor,vec3(0.37,0.25,0.25),(yi-nyi)/jointHPercentage+0.2);}
13
+ else if (xi<nxi+jointWPercentage && xi>nxi-jointWPercentage){color=mix(jointColor,vec3(0.44,0.44,0.44),(xi-nxi)/jointWPercentage+0.2);}
14
+ else {float brickColorSwitch=mod(floor(yi)+floor(xi),3.0);if (brickColorSwitch==0.0)
15
+ color=mix(color,vec3(0.33,0.33,0.33),0.3);else if (brickColorSwitch==2.0)
16
+ color=mix(color,vec3(0.11,0.11,0.11),0.3);}
17
+ gl_FragColor=vec4(color,1.0);}`;
5
18
  // Sideeffect
6
19
  ShaderStore.ShadersStore[name] = shader;
7
20
  /** @hidden */
8
- export var brickProceduralTexturePixelShader = { name: name, shader: shader };
21
+ export const brickProceduralTexturePixelShader = { name, shader };
9
22
  //# sourceMappingURL=brickProceduralTexture.fragment.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"brickProceduralTexture.fragment.js","sourceRoot":"","sources":["../../../../../lts/proceduralTextures/generated/brick/brickProceduralTexture.fragment.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,+CAAiC;AAEvD,IAAM,IAAI,GAAG,mCAAmC,CAAC;AACjD,IAAM,MAAM,GAAG,miDAagB,CAAC;AAChC,aAAa;AACb,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACxC,cAAc;AACd,MAAM,CAAC,IAAM,iCAAiC,GAAG,EAAE,IAAI,MAAA,EAAE,MAAM,QAAA,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"core/Engines/shaderStore\";\n\nconst name = \"brickProceduralTexturePixelShader\";\nconst shader = `precision highp float;varying vec2 vPosition;varying vec2 vUV;uniform float numberOfBricksHeight;uniform float numberOfBricksWidth;uniform vec3 brickColor;uniform vec3 jointColor;float rand(vec2 n) {return fract(cos(dot(n,vec2(12.9898,4.1414)))*43758.5453);}\nfloat noise(vec2 n) {const vec2 d=vec2(0.0,1.0);vec2 b=floor(n),f=smoothstep(vec2(0.0),vec2(1.0),fract(n));return mix(mix(rand(b),rand(b+d.yx),f.x),mix(rand(b+d.xy),rand(b+d.yy),f.x),f.y);}\nfloat fbm(vec2 n) {float total=0.0,amplitude=1.0;for (int i=0; i<4; i++) {total+=noise(n)*amplitude;n+=n;amplitude*=0.5;}\nreturn total;}\nfloat roundF(float number){return sign(number)*floor(abs(number)+0.5);}\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{float brickW=1.0/numberOfBricksWidth;float brickH=1.0/numberOfBricksHeight;float jointWPercentage=0.01;float jointHPercentage=0.05;vec3 color=brickColor;float yi=vUV.y/brickH;float nyi=roundF(yi);float xi=vUV.x/brickW;if (mod(floor(yi),2.0)==0.0){xi=xi-0.5;}\nfloat nxi=roundF(xi);vec2 brickvUV=vec2((xi-floor(xi))/brickH,(yi-floor(yi))/ brickW);if (yi<nyi+jointHPercentage && yi>nyi-jointHPercentage){color=mix(jointColor,vec3(0.37,0.25,0.25),(yi-nyi)/jointHPercentage+0.2);}\nelse if (xi<nxi+jointWPercentage && xi>nxi-jointWPercentage){color=mix(jointColor,vec3(0.44,0.44,0.44),(xi-nxi)/jointWPercentage+0.2);}\nelse {float brickColorSwitch=mod(floor(yi)+floor(xi),3.0);if (brickColorSwitch==0.0)\ncolor=mix(color,vec3(0.33,0.33,0.33),0.3);else if (brickColorSwitch==2.0)\ncolor=mix(color,vec3(0.11,0.11,0.11),0.3);}\ngl_FragColor=vec4(color,1.0);}`;\n// Sideeffect\nShaderStore.ShadersStore[name] = shader;\n/** @hidden */\nexport const brickProceduralTexturePixelShader = { name, shader };\n"]}
1
+ {"version":3,"file":"brickProceduralTexture.fragment.js","sourceRoot":"","sources":["../../../../../lts/proceduralTextures/generated/brick/brickProceduralTexture.fragment.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,+CAAiC;AAEvD,MAAM,IAAI,GAAG,mCAAmC,CAAC;AACjD,MAAM,MAAM,GAAG;;;;;;;;;;;;;+BAagB,CAAC;AAChC,aAAa;AACb,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACxC,cAAc;AACd,MAAM,CAAC,MAAM,iCAAiC,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"core/Engines/shaderStore\";\n\nconst name = \"brickProceduralTexturePixelShader\";\nconst shader = `precision highp float;varying vec2 vPosition;varying vec2 vUV;uniform float numberOfBricksHeight;uniform float numberOfBricksWidth;uniform vec3 brickColor;uniform vec3 jointColor;float rand(vec2 n) {return fract(cos(dot(n,vec2(12.9898,4.1414)))*43758.5453);}\nfloat noise(vec2 n) {const vec2 d=vec2(0.0,1.0);vec2 b=floor(n),f=smoothstep(vec2(0.0),vec2(1.0),fract(n));return mix(mix(rand(b),rand(b+d.yx),f.x),mix(rand(b+d.xy),rand(b+d.yy),f.x),f.y);}\nfloat fbm(vec2 n) {float total=0.0,amplitude=1.0;for (int i=0; i<4; i++) {total+=noise(n)*amplitude;n+=n;amplitude*=0.5;}\nreturn total;}\nfloat roundF(float number){return sign(number)*floor(abs(number)+0.5);}\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{float brickW=1.0/numberOfBricksWidth;float brickH=1.0/numberOfBricksHeight;float jointWPercentage=0.01;float jointHPercentage=0.05;vec3 color=brickColor;float yi=vUV.y/brickH;float nyi=roundF(yi);float xi=vUV.x/brickW;if (mod(floor(yi),2.0)==0.0){xi=xi-0.5;}\nfloat nxi=roundF(xi);vec2 brickvUV=vec2((xi-floor(xi))/brickH,(yi-floor(yi))/ brickW);if (yi<nyi+jointHPercentage && yi>nyi-jointHPercentage){color=mix(jointColor,vec3(0.37,0.25,0.25),(yi-nyi)/jointHPercentage+0.2);}\nelse if (xi<nxi+jointWPercentage && xi>nxi-jointWPercentage){color=mix(jointColor,vec3(0.44,0.44,0.44),(xi-nxi)/jointWPercentage+0.2);}\nelse {float brickColorSwitch=mod(floor(yi)+floor(xi),3.0);if (brickColorSwitch==0.0)\ncolor=mix(color,vec3(0.33,0.33,0.33),0.3);else if (brickColorSwitch==2.0)\ncolor=mix(color,vec3(0.11,0.11,0.11),0.3);}\ngl_FragColor=vec4(color,1.0);}`;\n// Sideeffect\nShaderStore.ShadersStore[name] = shader;\n/** @hidden */\nexport const brickProceduralTexturePixelShader = { name, shader };\n"]}
@@ -1,80 +1,61 @@
1
- import { __decorate, __extends } from "tslib";
1
+ import { __decorate } from "@babylonjs/core/tslib.es6.js";
2
2
  import { serialize, serializeAsColor3, SerializationHelper } from "@babylonjs/core/Misc/decorators.js";
3
3
  import { Color3 } from "@babylonjs/core/Maths/math.color.js";
4
4
  import { ProceduralTexture } from "@babylonjs/core/Materials/Textures/Procedurals/proceduralTexture.js";
5
5
  import { RegisterClass } from "@babylonjs/core/Misc/typeStore.js";
6
6
  import "./brickProceduralTexture.fragment.js";
7
- var BrickProceduralTexture = /** @class */ (function (_super) {
8
- __extends(BrickProceduralTexture, _super);
9
- function BrickProceduralTexture(name, size, scene, fallbackTexture, generateMipMaps) {
10
- if (scene === void 0) { scene = null; }
11
- var _this = _super.call(this, name, size, "brickProceduralTexture", scene, fallbackTexture, generateMipMaps) || this;
12
- _this._numberOfBricksHeight = 15;
13
- _this._numberOfBricksWidth = 5;
14
- _this._jointColor = new Color3(0.72, 0.72, 0.72);
15
- _this._brickColor = new Color3(0.77, 0.47, 0.4);
16
- _this.updateShaderUniforms();
17
- return _this;
7
+ export class BrickProceduralTexture extends ProceduralTexture {
8
+ constructor(name, size, scene = null, fallbackTexture, generateMipMaps) {
9
+ super(name, size, "brickProceduralTexture", scene, fallbackTexture, generateMipMaps);
10
+ this._numberOfBricksHeight = 15;
11
+ this._numberOfBricksWidth = 5;
12
+ this._jointColor = new Color3(0.72, 0.72, 0.72);
13
+ this._brickColor = new Color3(0.77, 0.47, 0.4);
14
+ this.updateShaderUniforms();
18
15
  }
19
- BrickProceduralTexture.prototype.updateShaderUniforms = function () {
16
+ updateShaderUniforms() {
20
17
  this.setFloat("numberOfBricksHeight", this._numberOfBricksHeight);
21
18
  this.setFloat("numberOfBricksWidth", this._numberOfBricksWidth);
22
19
  this.setColor3("brickColor", this._brickColor);
23
20
  this.setColor3("jointColor", this._jointColor);
24
- };
25
- Object.defineProperty(BrickProceduralTexture.prototype, "numberOfBricksHeight", {
26
- get: function () {
27
- return this._numberOfBricksHeight;
28
- },
29
- set: function (value) {
30
- this._numberOfBricksHeight = value;
31
- this.updateShaderUniforms();
32
- },
33
- enumerable: false,
34
- configurable: true
35
- });
36
- Object.defineProperty(BrickProceduralTexture.prototype, "numberOfBricksWidth", {
37
- get: function () {
38
- return this._numberOfBricksWidth;
39
- },
40
- set: function (value) {
41
- this._numberOfBricksWidth = value;
42
- this.updateShaderUniforms();
43
- },
44
- enumerable: false,
45
- configurable: true
46
- });
47
- Object.defineProperty(BrickProceduralTexture.prototype, "jointColor", {
48
- get: function () {
49
- return this._jointColor;
50
- },
51
- set: function (value) {
52
- this._jointColor = value;
53
- this.updateShaderUniforms();
54
- },
55
- enumerable: false,
56
- configurable: true
57
- });
58
- Object.defineProperty(BrickProceduralTexture.prototype, "brickColor", {
59
- get: function () {
60
- return this._brickColor;
61
- },
62
- set: function (value) {
63
- this._brickColor = value;
64
- this.updateShaderUniforms();
65
- },
66
- enumerable: false,
67
- configurable: true
68
- });
21
+ }
22
+ get numberOfBricksHeight() {
23
+ return this._numberOfBricksHeight;
24
+ }
25
+ set numberOfBricksHeight(value) {
26
+ this._numberOfBricksHeight = value;
27
+ this.updateShaderUniforms();
28
+ }
29
+ get numberOfBricksWidth() {
30
+ return this._numberOfBricksWidth;
31
+ }
32
+ set numberOfBricksWidth(value) {
33
+ this._numberOfBricksWidth = value;
34
+ this.updateShaderUniforms();
35
+ }
36
+ get jointColor() {
37
+ return this._jointColor;
38
+ }
39
+ set jointColor(value) {
40
+ this._jointColor = value;
41
+ this.updateShaderUniforms();
42
+ }
43
+ get brickColor() {
44
+ return this._brickColor;
45
+ }
46
+ set brickColor(value) {
47
+ this._brickColor = value;
48
+ this.updateShaderUniforms();
49
+ }
69
50
  /**
70
51
  * Serializes this brick procedural texture
71
52
  * @returns a serialized brick procedural texture object
72
53
  */
73
- BrickProceduralTexture.prototype.serialize = function () {
74
- var serializationObject = SerializationHelper.Serialize(this, _super.prototype.serialize.call(this));
54
+ serialize() {
55
+ const serializationObject = SerializationHelper.Serialize(this, super.serialize());
75
56
  serializationObject.customType = "BABYLON.BrickProceduralTexture";
76
57
  return serializationObject;
77
- };
58
+ }
78
59
  /**
79
60
  * Creates a Brick Procedural Texture from parsed brick procedural texture data
80
61
  * @param parsedTexture defines parsed texture data
@@ -82,24 +63,22 @@ var BrickProceduralTexture = /** @class */ (function (_super) {
82
63
  * @param rootUrl defines the root URL containing brick procedural texture information
83
64
  * @returns a parsed Brick Procedural Texture
84
65
  */
85
- BrickProceduralTexture.Parse = function (parsedTexture, scene, rootUrl) {
86
- var texture = SerializationHelper.Parse(function () { return new BrickProceduralTexture(parsedTexture.name, parsedTexture._size, scene, undefined, parsedTexture._generateMipMaps); }, parsedTexture, scene, rootUrl);
66
+ static Parse(parsedTexture, scene, rootUrl) {
67
+ const texture = SerializationHelper.Parse(() => new BrickProceduralTexture(parsedTexture.name, parsedTexture._size, scene, undefined, parsedTexture._generateMipMaps), parsedTexture, scene, rootUrl);
87
68
  return texture;
88
- };
89
- __decorate([
90
- serialize()
91
- ], BrickProceduralTexture.prototype, "numberOfBricksHeight", null);
92
- __decorate([
93
- serialize()
94
- ], BrickProceduralTexture.prototype, "numberOfBricksWidth", null);
95
- __decorate([
96
- serializeAsColor3()
97
- ], BrickProceduralTexture.prototype, "jointColor", null);
98
- __decorate([
99
- serializeAsColor3()
100
- ], BrickProceduralTexture.prototype, "brickColor", null);
101
- return BrickProceduralTexture;
102
- }(ProceduralTexture));
103
- export { BrickProceduralTexture };
69
+ }
70
+ }
71
+ __decorate([
72
+ serialize()
73
+ ], BrickProceduralTexture.prototype, "numberOfBricksHeight", null);
74
+ __decorate([
75
+ serialize()
76
+ ], BrickProceduralTexture.prototype, "numberOfBricksWidth", null);
77
+ __decorate([
78
+ serializeAsColor3()
79
+ ], BrickProceduralTexture.prototype, "jointColor", null);
80
+ __decorate([
81
+ serializeAsColor3()
82
+ ], BrickProceduralTexture.prototype, "brickColor", null);
104
83
  RegisterClass("BABYLON.BrickProceduralTexture", BrickProceduralTexture);
105
84
  //# sourceMappingURL=brickProceduralTexture.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"brickProceduralTexture.js","sourceRoot":"","sources":["../../../../../lts/proceduralTextures/generated/brick/brickProceduralTexture.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,2CAA6B;AACzF,OAAO,EAAE,MAAM,EAAE,4CAA8B;AAE/C,OAAO,EAAE,iBAAiB,EAAE,4EAA8D;AAE1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CAAgC,EAAE,sBAAsB,CAAC,CAAC","sourcesContent":["import { serialize, serializeAsColor3, SerializationHelper } from \"core/Misc/decorators\";\r\nimport { Color3 } from \"core/Maths/math.color\";\r\nimport type { Texture } from \"core/Materials/Textures/texture\";\r\nimport { ProceduralTexture } from \"core/Materials/Textures/Procedurals/proceduralTexture\";\r\nimport type { Scene } from \"core/scene\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport type { Nullable } from \"core/types\";\r\n\r\nimport \"./brickProceduralTexture.fragment\";\r\n\r\nexport class BrickProceduralTexture extends ProceduralTexture {\r\n private _numberOfBricksHeight: number = 15;\r\n private _numberOfBricksWidth: number = 5;\r\n private _jointColor = new Color3(0.72, 0.72, 0.72);\r\n private _brickColor = new Color3(0.77, 0.47, 0.4);\r\n\r\n constructor(name: string, size: number, scene: Nullable<Scene> = null, fallbackTexture?: Texture, generateMipMaps?: boolean) {\r\n super(name, size, \"brickProceduralTexture\", scene, fallbackTexture, generateMipMaps);\r\n this.updateShaderUniforms();\r\n }\r\n\r\n public updateShaderUniforms() {\r\n this.setFloat(\"numberOfBricksHeight\", this._numberOfBricksHeight);\r\n this.setFloat(\"numberOfBricksWidth\", this._numberOfBricksWidth);\r\n this.setColor3(\"brickColor\", this._brickColor);\r\n this.setColor3(\"jointColor\", this._jointColor);\r\n }\r\n\r\n @serialize()\r\n public get numberOfBricksHeight(): number {\r\n return this._numberOfBricksHeight;\r\n }\r\n\r\n public set numberOfBricksHeight(value: number) {\r\n this._numberOfBricksHeight = value;\r\n this.updateShaderUniforms();\r\n }\r\n\r\n @serialize()\r\n public get numberOfBricksWidth(): number {\r\n return this._numberOfBricksWidth;\r\n }\r\n\r\n public set numberOfBricksWidth(value: number) {\r\n this._numberOfBricksWidth = value;\r\n this.updateShaderUniforms();\r\n }\r\n\r\n @serializeAsColor3()\r\n public get jointColor(): Color3 {\r\n return this._jointColor;\r\n }\r\n\r\n public set jointColor(value: Color3) {\r\n this._jointColor = value;\r\n this.updateShaderUniforms();\r\n }\r\n\r\n @serializeAsColor3()\r\n public get brickColor(): Color3 {\r\n return this._brickColor;\r\n }\r\n\r\n public set brickColor(value: Color3) {\r\n this._brickColor = value;\r\n this.updateShaderUniforms();\r\n }\r\n\r\n /**\r\n * Serializes this brick procedural texture\r\n * @returns a serialized brick procedural texture object\r\n */\r\n public serialize(): any {\r\n const serializationObject = SerializationHelper.Serialize(this, super.serialize());\r\n serializationObject.customType = \"BABYLON.BrickProceduralTexture\";\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Creates a Brick Procedural Texture from parsed brick procedural texture data\r\n * @param parsedTexture defines parsed texture data\r\n * @param scene defines the current scene\r\n * @param rootUrl defines the root URL containing brick procedural texture information\r\n * @returns a parsed Brick Procedural Texture\r\n */\r\n public static Parse(parsedTexture: any, scene: Scene, rootUrl: string): BrickProceduralTexture {\r\n const texture = SerializationHelper.Parse(\r\n () => new BrickProceduralTexture(parsedTexture.name, parsedTexture._size, scene, undefined, parsedTexture._generateMipMaps),\r\n parsedTexture,\r\n scene,\r\n rootUrl\r\n );\r\n\r\n return texture;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.BrickProceduralTexture\", BrickProceduralTexture);\r\n"]}
1
+ {"version":3,"file":"brickProceduralTexture.js","sourceRoot":"","sources":["../../../../../lts/proceduralTextures/generated/brick/brickProceduralTexture.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,2CAA6B;AACzF,OAAO,EAAE,MAAM,EAAE,4CAA8B;AAE/C,OAAO,EAAE,iBAAiB,EAAE,4EAA8D;AAE1F,OAAO,EAAE,aAAa,EAAE,0CAA4B;AAGpD,OAAO,mCAAmC,CAAC;AAE3C,MAAM,OAAO,sBAAuB,SAAQ,iBAAiB;IAMzD,YAAY,IAAY,EAAE,IAAY,EAAE,QAAyB,IAAI,EAAE,eAAyB,EAAE,eAAyB;QACvH,KAAK,CAAC,IAAI,EAAE,I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oB,EAAE,CAAC;IAChC,CAAC;IAGD,IAAW,UAAU;QACjB,OAAO,IAAI,CAAC,WAAW,CAAC;IAC5B,CAAC;IAED,IAAW,UAAU,CAAC,KAAa;QAC/B,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;QACzB,IAAI,CAAC,oBAAoB,EAAE,CAAC;IAChC,CAAC;IAED;;;OAGG;IACI,SAAS;QACZ,MAAM,mBAAmB,GAAG,mBAAmB,CAAC,SAAS,CAAC,IAAI,EAAE,KAAK,CAAC,SAAS,EAAE,CAAC,CAAC;QACnF,mBAAmB,CAAC,UAAU,GAAG,gCAAgC,CAAC;QAElE,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAED;;;;;;OAMG;IACI,MAAM,CAAC,KAAK,CAAC,aAAkB,EAAE,KAAY,EAAE,OAAe;QACjE,MAAM,OAAO,GAAG,mBAAmB,CAAC,KAAK,CACrC,GAAG,EAAE,CAAC,IAAI,sBAAsB,CAAC,aAAa,CAAC,IAAI,EAAE,aAAa,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,aAAa,CAAC,gBAAgB,CAAC,EAC3H,aAAa,EACb,KAAK,EACL,OAAO,CACV,CAAC;QAEF,OAAO,OAAO,CAAC;IACnB,CAAC;CACJ;AAnEG;IADC,SAAS,EAAE;kEAGX;AAQD;IADC,SAAS,EAAE;iEAGX;AAQD;IADC,iBAAiB,EAAE;wDAGnB;AAQD;IADC,iBAAiB,EAAE;wDAGnB;AAqCL,aAAa,CAAC,gCAAgC,EAAE,sBAAsB,CAAC,CAAC","sourcesContent":["import { serialize, serializeAsColor3, SerializationHelper } from \"core/Misc/decorators\";\r\nimport { Color3 } from \"core/Maths/math.color\";\r\nimport type { Texture } from \"core/Materials/Textures/texture\";\r\nimport { ProceduralTexture } from \"core/Materials/Textures/Procedurals/proceduralTexture\";\r\nimport type { Scene } from \"core/scene\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport type { Nullable } from \"core/types\";\r\n\r\nimport \"./brickProceduralTexture.fragment\";\r\n\r\nexport class BrickProceduralTexture extends ProceduralTexture {\r\n private _numberOfBricksHeight: number = 15;\r\n private _numberOfBricksWidth: number = 5;\r\n private _jointColor = new Color3(0.72, 0.72, 0.72);\r\n private _brickColor = new Color3(0.77, 0.47, 0.4);\r\n\r\n constructor(name: string, size: number, scene: Nullable<Scene> = null, fallbackTexture?: Texture, generateMipMaps?: boolean) {\r\n super(name, size, \"brickProceduralTexture\", scene, fallbackTexture, generateMipMaps);\r\n this.updateShaderUniforms();\r\n }\r\n\r\n public updateShaderUniforms() {\r\n this.setFloat(\"numberOfBricksHeight\", this._numberOfBricksHeight);\r\n this.setFloat(\"numberOfBricksWidth\", this._numberOfBricksWidth);\r\n this.setColor3(\"brickColor\", this._brickColor);\r\n this.setColor3(\"jointColor\", this._jointColor);\r\n }\r\n\r\n @serialize()\r\n public get numberOfBricksHeight(): number {\r\n return this._numberOfBricksHeight;\r\n }\r\n\r\n public set numberOfBricksHeight(value: number) {\r\n this._numberOfBricksHeight = value;\r\n this.updateShaderUniforms();\r\n }\r\n\r\n @serialize()\r\n public get numberOfBricksWidth(): number {\r\n return this._numberOfBricksWidth;\r\n }\r\n\r\n public set numberOfBricksWidth(value: number) {\r\n this._numberOfBricksWidth = value;\r\n this.updateShaderUniforms();\r\n }\r\n\r\n @serializeAsColor3()\r\n public get jointColor(): Color3 {\r\n return this._jointColor;\r\n }\r\n\r\n public set jointColor(value: Color3) {\r\n this._jointColor = value;\r\n this.updateShaderUniforms();\r\n }\r\n\r\n @serializeAsColor3()\r\n public get brickColor(): Color3 {\r\n return this._brickColor;\r\n }\r\n\r\n public set brickColor(value: Color3) {\r\n this._brickColor = value;\r\n this.updateShaderUniforms();\r\n }\r\n\r\n /**\r\n * Serializes this brick procedural texture\r\n * @returns a serialized brick procedural texture object\r\n */\r\n public serialize(): any {\r\n const serializationObject = SerializationHelper.Serialize(this, super.serialize());\r\n serializationObject.customType = \"BABYLON.BrickProceduralTexture\";\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Creates a Brick Procedural Texture from parsed brick procedural texture data\r\n * @param parsedTexture defines parsed texture data\r\n * @param scene defines the current scene\r\n * @param rootUrl defines the root URL containing brick procedural texture information\r\n * @returns a parsed Brick Procedural Texture\r\n */\r\n public static Parse(parsedTexture: any, scene: Scene, rootUrl: string): BrickProceduralTexture {\r\n const texture = SerializationHelper.Parse(\r\n () => new BrickProceduralTexture(parsedTexture.name, parsedTexture._size, scene, undefined, parsedTexture._generateMipMaps),\r\n parsedTexture,\r\n scene,\r\n rootUrl\r\n );\r\n\r\n return texture;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.BrickProceduralTexture\", BrickProceduralTexture);\r\n"]}
@@ -1,9 +1,20 @@
1
1
  // Do not edit.
2
2
  import { ShaderStore } from "@babylonjs/core/Engines/shaderStore.js";
3
- var name = "cloudProceduralTexturePixelShader";
4
- var shader = "precision highp float;varying vec2 vUV;uniform vec4 skyColor;uniform vec4 cloudColor;uniform float amplitude;uniform int numOctaves;float rand(vec2 n) {return fract(cos(dot(n,vec2(12.9898,4.1414)))*43758.5453);}\nfloat noise(vec2 n) {const vec2 d=vec2(0.0,1.0);vec2 b=floor(n),f=smoothstep(vec2(0.0),vec2(1.0),fract(n));return mix(mix(rand(b),rand(b+d.yx),f.x),mix(rand(b+d.xy),rand(b+d.yy),f.x),f.y);}\nfloat fbm(vec2 n) {float total=0.0,ampl=amplitude;\n#ifdef WEBGL2\nfor (int i=0; i<numOctaves; i++) {\n#else\nfor (int i=0; i<4; i++) {\n#endif\ntotal+=noise(n)*ampl;n+=n;ampl*=0.5;}\nreturn total;}\nvoid main() {vec2 p=vUV*12.0;vec4 c=mix(skyColor,cloudColor,fbm(p));gl_FragColor=c;}\n";
3
+ const name = "cloudProceduralTexturePixelShader";
4
+ const shader = `precision highp float;varying vec2 vUV;uniform vec4 skyColor;uniform vec4 cloudColor;uniform float amplitude;uniform int numOctaves;float rand(vec2 n) {return fract(cos(dot(n,vec2(12.9898,4.1414)))*43758.5453);}
5
+ float noise(vec2 n) {const vec2 d=vec2(0.0,1.0);vec2 b=floor(n),f=smoothstep(vec2(0.0),vec2(1.0),fract(n));return mix(mix(rand(b),rand(b+d.yx),f.x),mix(rand(b+d.xy),rand(b+d.yy),f.x),f.y);}
6
+ float fbm(vec2 n) {float total=0.0,ampl=amplitude;
7
+ #ifdef WEBGL2
8
+ for (int i=0; i<numOctaves; i++) {
9
+ #else
10
+ for (int i=0; i<4; i++) {
11
+ #endif
12
+ total+=noise(n)*ampl;n+=n;ampl*=0.5;}
13
+ return total;}
14
+ void main() {vec2 p=vUV*12.0;vec4 c=mix(skyColor,cloudColor,fbm(p));gl_FragColor=c;}
15
+ `;
5
16
  // Sideeffect
6
17
  ShaderStore.ShadersStore[name] = shader;
7
18
  /** @hidden */
8
- export var cloudProceduralTexturePixelShader = { name: name, shader: shader };
19
+ export const cloudProceduralTexturePixelShader = { name, shader };
9
20
  //# sourceMappingURL=cloudProceduralTexture.fragment.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"cloudProceduralTexture.fragment.js","sourceRoot":"","sources":["../../../../../lts/proceduralTextures/generated/cloud/cloudProceduralTexture.fragment.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,+CAAiC;AAEvD,IAAM,IAAI,GAAG,mCAAmC,CAAC;AACjD,IAAM,MAAM,GAAG,orBAWd,CAAC;AACF,aAAa;AACb,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACxC,cAAc;AACd,MAAM,CAAC,IAAM,iCAAiC,GAAG,EAAE,IAAI,MAAA,EAAE,MAAM,QAAA,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"core/Engines/shaderStore\";\n\nconst name = \"cloudProceduralTexturePixelShader\";\nconst shader = `precision highp float;varying vec2 vUV;uniform vec4 skyColor;uniform vec4 cloudColor;uniform float amplitude;uniform int numOctaves;float rand(vec2 n) {return fract(cos(dot(n,vec2(12.9898,4.1414)))*43758.5453);}\nfloat noise(vec2 n) {const vec2 d=vec2(0.0,1.0);vec2 b=floor(n),f=smoothstep(vec2(0.0),vec2(1.0),fract(n));return mix(mix(rand(b),rand(b+d.yx),f.x),mix(rand(b+d.xy),rand(b+d.yy),f.x),f.y);}\nfloat fbm(vec2 n) {float total=0.0,ampl=amplitude;\n#ifdef WEBGL2\nfor (int i=0; i<numOctaves; i++) {\n#else\nfor (int i=0; i<4; i++) {\n#endif\ntotal+=noise(n)*ampl;n+=n;ampl*=0.5;}\nreturn total;}\nvoid main() {vec2 p=vUV*12.0;vec4 c=mix(skyColor,cloudColor,fbm(p));gl_FragColor=c;}\n`;\n// Sideeffect\nShaderStore.ShadersStore[name] = shader;\n/** @hidden */\nexport const cloudProceduralTexturePixelShader = { name, shader };\n"]}
1
+ {"version":3,"file":"cloudProceduralTexture.fragment.js","sourceRoot":"","sources":["../../../../../lts/proceduralTextures/generated/cloud/cloudProceduralTexture.fragment.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,+CAAiC;AAEvD,MAAM,IAAI,GAAG,mCAAmC,CAAC;AACjD,MAAM,MAAM,GAAG;;;;;;;;;;;CAWd,CAAC;AACF,aAAa;AACb,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACxC,cAAc;AACd,MAAM,CAAC,MAAM,iCAAiC,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"core/Engines/shaderStore\";\n\nconst name = \"cloudProceduralTexturePixelShader\";\nconst shader = `precision highp float;varying vec2 vUV;uniform vec4 skyColor;uniform vec4 cloudColor;uniform float amplitude;uniform int numOctaves;float rand(vec2 n) {return fract(cos(dot(n,vec2(12.9898,4.1414)))*43758.5453);}\nfloat noise(vec2 n) {const vec2 d=vec2(0.0,1.0);vec2 b=floor(n),f=smoothstep(vec2(0.0),vec2(1.0),fract(n));return mix(mix(rand(b),rand(b+d.yx),f.x),mix(rand(b+d.xy),rand(b+d.yy),f.x),f.y);}\nfloat fbm(vec2 n) {float total=0.0,ampl=amplitude;\n#ifdef WEBGL2\nfor (int i=0; i<numOctaves; i++) {\n#else\nfor (int i=0; i<4; i++) {\n#endif\ntotal+=noise(n)*ampl;n+=n;ampl*=0.5;}\nreturn total;}\nvoid main() {vec2 p=vUV*12.0;vec4 c=mix(skyColor,cloudColor,fbm(p));gl_FragColor=c;}\n`;\n// Sideeffect\nShaderStore.ShadersStore[name] = shader;\n/** @hidden */\nexport const cloudProceduralTexturePixelShader = { name, shader };\n"]}
@@ -1,80 +1,61 @@
1
- import { __decorate, __extends } from "tslib";
1
+ import { __decorate } from "@babylonjs/core/tslib.es6.js";
2
2
  import { serialize, serializeAsColor4, SerializationHelper } from "@babylonjs/core/Misc/decorators.js";
3
3
  import { Color4 } from "@babylonjs/core/Maths/math.color.js";
4
4
  import { ProceduralTexture } from "@babylonjs/core/Materials/Textures/Procedurals/proceduralTexture.js";
5
5
  import { RegisterClass } from "@babylonjs/core/Misc/typeStore.js";
6
6
  import "./cloudProceduralTexture.fragment.js";
7
- var CloudProceduralTexture = /** @class */ (function (_super) {
8
- __extends(CloudProceduralTexture, _super);
9
- function CloudProceduralTexture(name, size, scene, fallbackTexture, generateMipMaps) {
10
- if (scene === void 0) { scene = null; }
11
- var _this = _super.call(this, name, size, "cloudProceduralTexture", scene, fallbackTexture, generateMipMaps) || this;
12
- _this._skyColor = new Color4(0.15, 0.68, 1.0, 1.0);
13
- _this._cloudColor = new Color4(1, 1, 1, 1.0);
14
- _this._amplitude = 1;
15
- _this._numOctaves = 4;
16
- _this.updateShaderUniforms();
17
- return _this;
7
+ export class CloudProceduralTexture extends ProceduralTexture {
8
+ constructor(name, size, scene = null, fallbackTexture, generateMipMaps) {
9
+ super(name, size, "cloudProceduralTexture", scene, fallbackTexture, generateMipMaps);
10
+ this._skyColor = new Color4(0.15, 0.68, 1.0, 1.0);
11
+ this._cloudColor = new Color4(1, 1, 1, 1.0);
12
+ this._amplitude = 1;
13
+ this._numOctaves = 4;
14
+ this.updateShaderUniforms();
18
15
  }
19
- CloudProceduralTexture.prototype.updateShaderUniforms = function () {
16
+ updateShaderUniforms() {
20
17
  this.setColor4("skyColor", this._skyColor);
21
18
  this.setColor4("cloudColor", this._cloudColor);
22
19
  this.setFloat("amplitude", this._amplitude);
23
20
  this.setInt("numOctaves", this._numOctaves);
24
- };
25
- Object.defineProperty(CloudProceduralTexture.prototype, "skyColor", {
26
- get: function () {
27
- return this._skyColor;
28
- },
29
- set: function (value) {
30
- this._skyColor = value;
31
- this.updateShaderUniforms();
32
- },
33
- enumerable: false,
34
- configurable: true
35
- });
36
- Object.defineProperty(CloudProceduralTexture.prototype, "cloudColor", {
37
- get: function () {
38
- return this._cloudColor;
39
- },
40
- set: function (value) {
41
- this._cloudColor = value;
42
- this.updateShaderUniforms();
43
- },
44
- enumerable: false,
45
- configurable: true
46
- });
47
- Object.defineProperty(CloudProceduralTexture.prototype, "amplitude", {
48
- get: function () {
49
- return this._amplitude;
50
- },
51
- set: function (value) {
52
- this._amplitude = value;
53
- this.updateShaderUniforms();
54
- },
55
- enumerable: false,
56
- configurable: true
57
- });
58
- Object.defineProperty(CloudProceduralTexture.prototype, "numOctaves", {
59
- get: function () {
60
- return this._numOctaves;
61
- },
62
- set: function (value) {
63
- this._numOctaves = value;
64
- this.updateShaderUniforms();
65
- },
66
- enumerable: false,
67
- configurable: true
68
- });
21
+ }
22
+ get skyColor() {
23
+ return this._skyColor;
24
+ }
25
+ set skyColor(value) {
26
+ this._skyColor = value;
27
+ this.updateShaderUniforms();
28
+ }
29
+ get cloudColor() {
30
+ return this._cloudColor;
31
+ }
32
+ set cloudColor(value) {
33
+ this._cloudColor = value;
34
+ this.updateShaderUniforms();
35
+ }
36
+ get amplitude() {
37
+ return this._amplitude;
38
+ }
39
+ set amplitude(value) {
40
+ this._amplitude = value;
41
+ this.updateShaderUniforms();
42
+ }
43
+ get numOctaves() {
44
+ return this._numOctaves;
45
+ }
46
+ set numOctaves(value) {
47
+ this._numOctaves = value;
48
+ this.updateShaderUniforms();
49
+ }
69
50
  /**
70
51
  * Serializes this cloud procedural texture
71
52
  * @returns a serialized cloud procedural texture object
72
53
  */
73
- CloudProceduralTexture.prototype.serialize = function () {
74
- var serializationObject = SerializationHelper.Serialize(this, _super.prototype.serialize.call(this));
54
+ serialize() {
55
+ const serializationObject = SerializationHelper.Serialize(this, super.serialize());
75
56
  serializationObject.customType = "BABYLON.CloudProceduralTexture";
76
57
  return serializationObject;
77
- };
58
+ }
78
59
  /**
79
60
  * Creates a Cloud Procedural Texture from parsed cloud procedural texture data
80
61
  * @param parsedTexture defines parsed texture data
@@ -82,24 +63,22 @@ var CloudProceduralTexture = /** @class */ (function (_super) {
82
63
  * @param rootUrl defines the root URL containing cloud procedural texture information
83
64
  * @returns a parsed Cloud Procedural Texture
84
65
  */
85
- CloudProceduralTexture.Parse = function (parsedTexture, scene, rootUrl) {
86
- var texture = SerializationHelper.Parse(function () { return new CloudProceduralTexture(parsedTexture.name, parsedTexture._size, scene, undefined, parsedTexture._generateMipMaps); }, parsedTexture, scene, rootUrl);
66
+ static Parse(parsedTexture, scene, rootUrl) {
67
+ const texture = SerializationHelper.Parse(() => new CloudProceduralTexture(parsedTexture.name, parsedTexture._size, scene, undefined, parsedTexture._generateMipMaps), parsedTexture, scene, rootUrl);
87
68
  return texture;
88
- };
89
- __decorate([
90
- serializeAsColor4()
91
- ], CloudProceduralTexture.prototype, "skyColor", null);
92
- __decorate([
93
- serializeAsColor4()
94
- ], CloudProceduralTexture.prototype, "cloudColor", null);
95
- __decorate([
96
- serialize()
97
- ], CloudProceduralTexture.prototype, "amplitude", null);
98
- __decorate([
99
- serialize()
100
- ], CloudProceduralTexture.prototype, "numOctaves", null);
101
- return CloudProceduralTexture;
102
- }(ProceduralTexture));
103
- export { CloudProceduralTexture };
69
+ }
70
+ }
71
+ __decorate([
72
+ serializeAsColor4()
73
+ ], CloudProceduralTexture.prototype, "skyColor", null);
74
+ __decorate([
75
+ serializeAsColor4()
76
+ ], CloudProceduralTexture.prototype, "cloudColor", null);
77
+ __decorate([
78
+ serialize()
79
+ ], CloudProceduralTexture.prototype, "amplitude", null);
80
+ __decorate([
81
+ serialize()
82
+ ], CloudProceduralTexture.prototype, "numOctaves", null);
104
83
  RegisterClass("BABYLON.CloudProceduralTexture", CloudProceduralTexture);
105
84
  //# sourceMappingURL=cloudProceduralTexture.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"cloudProceduralTexture.js","sourceRoot":"","sources":["../../../../../lts/proceduralTextures/generated/cloud/cloudProceduralTexture.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,2CAA6B;AACzF,OAAO,EAAE,MAAM,EAAE,4CAA8B;AAE/C,OAAO,EAAE,iBAAiB,EAAE,4EAA8D;AAE1F,OAAO,EAAE,aAAa,EAAE,0CAA4B;AAGpD,OAAO,mCAAmC,CAAC;AAE3C;IAA4C,0CAAiB;IAMzD,gCAAY,IAAY,EAAE,IAAY,EAAE,KAA6B,EAAE,eAAyB,EAAE,eAAyB;QAAnF,sBAAA,EAAA,YAA6B;QAArE,YACI,kBAAM,IAAI,EAAE,IAAI,EAAE,wBAAwB,EAAE,KAAK,EAAE,eAAe,EAAE,eAAe,CAAC,SAEvF;QARO,eAAS,GAAG,IAAI,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;QAC7C,iBAAW,GAAG,IAAI,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC;QACvC,gBAAU,GAAG,CAAC,CAAC;QACf,iBAAW,GAAG,CAAC,CAAC;QAIpB,KAAI,CAAC,oBAAoB,EAAE,CAAC;;IAChC,CAAC;IAEM,qDAAoB,GAA3B;QACI,IAAI,CAAC,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C,CAAC;QAElE,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAED;;;;;;OAMG;IACW,4BAAK,GAAnB,UAAoB,aAAkB,EAAE,KAAY,EAAE,OAAe;QACjE,IAAM,OAAO,GAAG,mBAAmB,CAAC,KAAK,CACrC,cAAM,OAAA,IAAI,sBAAsB,CAAC,aAAa,CAAC,IAAI,EAAE,aAAa,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,aAAa,CAAC,gBAAgB,CAAC,EAArH,CAAqH,EAC3H,aAAa,EACb,KAAK,EACL,OAAO,CACV,CAAC;QAEF,OAAO,OAAO,CAAC;IACnB,CAAC;IAlED;QADC,iBAAiB,EAAE;0DAGnB;IAQD;QADC,iBAAiB,EAAE;4DAGnB;IAQD;QADC,SAAS,EAAE;2DAGX;IAQD;QADC,SAAS,EAAE;4DAGX;IAmCL,6BAAC;CAAA,AAtFD,CAA4C,iBAAiB,GAsF5D;SAtFY,sBAAsB;AAwFnC,aAAa,CAAC,gCAAgC,EAAE,sBAAsB,CAAC,CAAC","sourcesContent":["import { serialize, serializeAsColor4, SerializationHelper } from \"core/Misc/decorators\";\r\nimport { Color4 } from \"core/Maths/math.color\";\r\nimport type { Texture } from \"core/Materials/Textures/texture\";\r\nimport { ProceduralTexture } from \"core/Materials/Textures/Procedurals/proceduralTexture\";\r\nimport type { Scene } from \"core/scene\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport type { Nullable } from \"core/types\";\r\n\r\nimport \"./cloudProceduralTexture.fragment\";\r\n\r\nexport class CloudProceduralTexture extends ProceduralTexture {\r\n private _skyColor = new Color4(0.15, 0.68, 1.0, 1.0);\r\n private _cloudColor = new Color4(1, 1, 1, 1.0);\r\n private _amplitude = 1;\r\n private _numOctaves = 4;\r\n\r\n constructor(name: string, size: number, scene: Nullable<Scene> = null, fallbackTexture?: Texture, generateMipMaps?: boolean) {\r\n super(name, size, \"cloudProceduralTexture\", scene, fallbackTexture, generateMipMaps);\r\n this.updateShaderUniforms();\r\n }\r\n\r\n public updateShaderUniforms() {\r\n this.setColor4(\"skyColor\", this._skyColor);\r\n this.setColor4(\"cloudColor\", this._cloudColor);\r\n this.setFloat(\"amplitude\", this._amplitude);\r\n this.setInt(\"numOctaves\", this._numOctaves);\r\n }\r\n\r\n @serializeAsColor4()\r\n public get skyColor(): Color4 {\r\n return this._skyColor;\r\n }\r\n\r\n public set skyColor(value: Color4) {\r\n this._skyColor = value;\r\n this.updateShaderUniforms();\r\n }\r\n\r\n @serializeAsColor4()\r\n public get cloudColor(): Color4 {\r\n return this._cloudColor;\r\n }\r\n\r\n public set cloudColor(value: Color4) {\r\n this._cloudColor = value;\r\n this.updateShaderUniforms();\r\n }\r\n\r\n @serialize()\r\n public get amplitude(): number {\r\n return this._amplitude;\r\n }\r\n\r\n public set amplitude(value: number) {\r\n this._amplitude = value;\r\n this.updateShaderUniforms();\r\n }\r\n\r\n @serialize()\r\n public get numOctaves(): number {\r\n return this._numOctaves;\r\n }\r\n\r\n public set numOctaves(value: number) {\r\n this._numOctaves = value;\r\n this.updateShaderUniforms();\r\n }\r\n\r\n /**\r\n * Serializes this cloud procedural texture\r\n * @returns a serialized cloud procedural texture object\r\n */\r\n public serialize(): any {\r\n const serializationObject = SerializationHelper.Serialize(this, super.serialize());\r\n serializationObject.customType = \"BABYLON.CloudProceduralTexture\";\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Creates a Cloud Procedural Texture from parsed cloud procedural texture data\r\n * @param parsedTexture defines parsed texture data\r\n * @param scene defines the current scene\r\n * @param rootUrl defines the root URL containing cloud procedural texture information\r\n * @returns a parsed Cloud Procedural Texture\r\n */\r\n public static Parse(parsedTexture: any, scene: Scene, rootUrl: string): CloudProceduralTexture {\r\n const texture = SerializationHelper.Parse(\r\n () => new CloudProceduralTexture(parsedTexture.name, parsedTexture._size, scene, undefined, parsedTexture._generateMipMaps),\r\n parsedTexture,\r\n scene,\r\n rootUrl\r\n );\r\n\r\n return texture;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.CloudProceduralTexture\", CloudProceduralTexture);\r\n"]}
1
+ {"version":3,"file":"cloudProceduralTexture.js","sourceRoot":"","sources":["../../../../../lts/proceduralTextures/generated/cloud/cloudProceduralTexture.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,2CAA6B;AACzF,OAAO,EAAE,MAAM,EAAE,4CAA8B;AAE/C,OAAO,EAAE,iBAAiB,EAAE,4EAA8D;AAE1F,OAAO,EAAE,aAAa,EAAE,0CAA4B;AAGpD,OAAO,mCAAmC,CAAC;AAE3C,MAAM,OAAO,sBAAuB,SAAQ,iBAAiB;IAMzD,YAAY,IAAY,EAAE,IAAY,EAAE,QAAyB,IAAI,EAAE,eAAyB,EAAE,eAAyB;QACvH,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,wBAAwB,EAAE,KAAK,EAAE,eAAe,EAAE,eAAe,CAAC,CAAC;QANjF,cAAS,GAAG,IAAI,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;QAC7C,gBAAW,GAAG,IAAI,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC;QACvC,eAAU,GAAG,CAAC,CAAC;QACf,gBAAW,GAAG,CAAC,CAAC;QAIpB,IAAI,CAAC,oBAAoB,EAAE,CAAC;IAChC,CAAC;IAEM,oBAAoB;QACvB,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;QAC3C,IAAI,CAAC,SAAS,CAAC,YAAY,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;QAC/C,IAAI,CAAC,QAAQ,CAAC,WAAW,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;QAC5C,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;IAChD,CAAC;IAGD,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EAC3H,aAAa,EACb,KAAK,EACL,OAAO,CACV,CAAC;QAEF,OAAO,OAAO,CAAC;IACnB,CAAC;CACJ;AAnEG;IADC,iBAAiB,EAAE;sDAGnB;AAQD;IADC,iBAAiB,EAAE;wDAGnB;AAQD;IADC,SAAS,EAAE;uDAGX;AAQD;IADC,SAAS,EAAE;wDAGX;AAqCL,aAAa,CAAC,gCAAgC,EAAE,sBAAsB,CAAC,CAAC","sourcesContent":["import { serialize, serializeAsColor4, SerializationHelper } from \"core/Misc/decorators\";\r\nimport { Color4 } from \"core/Maths/math.color\";\r\nimport type { Texture } from \"core/Materials/Textures/texture\";\r\nimport { ProceduralTexture } from \"core/Materials/Textures/Procedurals/proceduralTexture\";\r\nimport type { Scene } from \"core/scene\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport type { Nullable } from \"core/types\";\r\n\r\nimport \"./cloudProceduralTexture.fragment\";\r\n\r\nexport class CloudProceduralTexture extends ProceduralTexture {\r\n private _skyColor = new Color4(0.15, 0.68, 1.0, 1.0);\r\n private _cloudColor = new Color4(1, 1, 1, 1.0);\r\n private _amplitude = 1;\r\n private _numOctaves = 4;\r\n\r\n constructor(name: string, size: number, scene: Nullable<Scene> = null, fallbackTexture?: Texture, generateMipMaps?: boolean) {\r\n super(name, size, \"cloudProceduralTexture\", scene, fallbackTexture, generateMipMaps);\r\n this.updateShaderUniforms();\r\n }\r\n\r\n public updateShaderUniforms() {\r\n this.setColor4(\"skyColor\", this._skyColor);\r\n this.setColor4(\"cloudColor\", this._cloudColor);\r\n this.setFloat(\"amplitude\", this._amplitude);\r\n this.setInt(\"numOctaves\", this._numOctaves);\r\n }\r\n\r\n @serializeAsColor4()\r\n public get skyColor(): Color4 {\r\n return this._skyColor;\r\n }\r\n\r\n public set skyColor(value: Color4) {\r\n this._skyColor = value;\r\n this.updateShaderUniforms();\r\n }\r\n\r\n @serializeAsColor4()\r\n public get cloudColor(): Color4 {\r\n return this._cloudColor;\r\n }\r\n\r\n public set cloudColor(value: Color4) {\r\n this._cloudColor = value;\r\n this.updateShaderUniforms();\r\n }\r\n\r\n @serialize()\r\n public get amplitude(): number {\r\n return this._amplitude;\r\n }\r\n\r\n public set amplitude(value: number) {\r\n this._amplitude = value;\r\n this.updateShaderUniforms();\r\n }\r\n\r\n @serialize()\r\n public get numOctaves(): number {\r\n return this._numOctaves;\r\n }\r\n\r\n public set numOctaves(value: number) {\r\n this._numOctaves = value;\r\n this.updateShaderUniforms();\r\n }\r\n\r\n /**\r\n * Serializes this cloud procedural texture\r\n * @returns a serialized cloud procedural texture object\r\n */\r\n public serialize(): any {\r\n const serializationObject = SerializationHelper.Serialize(this, super.serialize());\r\n serializationObject.customType = \"BABYLON.CloudProceduralTexture\";\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Creates a Cloud Procedural Texture from parsed cloud procedural texture data\r\n * @param parsedTexture defines parsed texture data\r\n * @param scene defines the current scene\r\n * @param rootUrl defines the root URL containing cloud procedural texture information\r\n * @returns a parsed Cloud Procedural Texture\r\n */\r\n public static Parse(parsedTexture: any, scene: Scene, rootUrl: string): CloudProceduralTexture {\r\n const texture = SerializationHelper.Parse(\r\n () => new CloudProceduralTexture(parsedTexture.name, parsedTexture._size, scene, undefined, parsedTexture._generateMipMaps),\r\n parsedTexture,\r\n scene,\r\n rootUrl\r\n );\r\n\r\n return texture;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.CloudProceduralTexture\", CloudProceduralTexture);\r\n"]}
@@ -1,9 +1,13 @@
1
1
  // Do not edit.
2
2
  import { ShaderStore } from "@babylonjs/core/Engines/shaderStore.js";
3
- var name = "fireProceduralTexturePixelShader";
4
- var shader = "precision highp float;uniform float time;uniform vec3 c1;uniform vec3 c2;uniform vec3 c3;uniform vec3 c4;uniform vec3 c5;uniform vec3 c6;uniform vec2 speed;uniform float shift;uniform float alphaThreshold;varying vec2 vUV;float rand(vec2 n) {return fract(cos(dot(n,vec2(12.9898,4.1414)))*43758.5453);}\nfloat noise(vec2 n) {const vec2 d=vec2(0.0,1.0);vec2 b=floor(n),f=smoothstep(vec2(0.0),vec2(1.0),fract(n));return mix(mix(rand(b),rand(b+d.yx),f.x),mix(rand(b+d.xy),rand(b+d.yy),f.x),f.y);}\nfloat fbm(vec2 n) {float total=0.0,amplitude=1.0;for (int i=0; i<4; i++) {total+=noise(n)*amplitude;n+=n;amplitude*=0.5;}\nreturn total;}\nvoid main() {vec2 p=vUV*8.0;float q=fbm(p-time*0.1);vec2 r=vec2(fbm(p+q+time*speed.x-p.x-p.y),fbm(p+q-time*speed.y));vec3 c=mix(c1,c2,fbm(p+r))+mix(c3,c4,r.x)-mix(c5,c6,r.y);vec3 color=c*cos(shift*vUV.y);float luminance=dot(color.rgb,vec3(0.3,0.59,0.11));gl_FragColor=vec4(color,luminance*alphaThreshold+(1.0-alphaThreshold));}";
3
+ const name = "fireProceduralTexturePixelShader";
4
+ const shader = `precision highp float;uniform float time;uniform vec3 c1;uniform vec3 c2;uniform vec3 c3;uniform vec3 c4;uniform vec3 c5;uniform vec3 c6;uniform vec2 speed;uniform float shift;uniform float alphaThreshold;varying vec2 vUV;float rand(vec2 n) {return fract(cos(dot(n,vec2(12.9898,4.1414)))*43758.5453);}
5
+ float noise(vec2 n) {const vec2 d=vec2(0.0,1.0);vec2 b=floor(n),f=smoothstep(vec2(0.0),vec2(1.0),fract(n));return mix(mix(rand(b),rand(b+d.yx),f.x),mix(rand(b+d.xy),rand(b+d.yy),f.x),f.y);}
6
+ float fbm(vec2 n) {float total=0.0,amplitude=1.0;for (int i=0; i<4; i++) {total+=noise(n)*amplitude;n+=n;amplitude*=0.5;}
7
+ return total;}
8
+ void main() {vec2 p=vUV*8.0;float q=fbm(p-time*0.1);vec2 r=vec2(fbm(p+q+time*speed.x-p.x-p.y),fbm(p+q-time*speed.y));vec3 c=mix(c1,c2,fbm(p+r))+mix(c3,c4,r.x)-mix(c5,c6,r.y);vec3 color=c*cos(shift*vUV.y);float luminance=dot(color.rgb,vec3(0.3,0.59,0.11));gl_FragColor=vec4(color,luminance*alphaThreshold+(1.0-alphaThreshold));}`;
5
9
  // Sideeffect
6
10
  ShaderStore.ShadersStore[name] = shader;
7
11
  /** @hidden */
8
- export var fireProceduralTexturePixelShader = { name: name, shader: shader };
12
+ export const fireProceduralTexturePixelShader = { name, shader };
9
13
  //# sourceMappingURL=fireProceduralTexture.fragment.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fireProceduralTexture.fragment.js","sourceRoot":"","sources":["../../../../../lts/proceduralTextures/generated/fire/fireProceduralTexture.fragment.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,+CAAiC;AAEvD,IAAM,IAAI,GAAG,kCAAkC,CAAC;AAChD,IAAM,MAAM,GAAG,k8BAIyT,CAAC;AACzU,aAAa;AACb,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACxC,cAAc;AACd,MAAM,CAAC,IAAM,gCAAgC,GAAG,EAAE,IAAI,MAAA,EAAE,MAAM,QAAA,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"core/Engines/shaderStore\";\n\nconst name = \"fireProceduralTexturePixelShader\";\nconst shader = `precision highp float;uniform float time;uniform vec3 c1;uniform vec3 c2;uniform vec3 c3;uniform vec3 c4;uniform vec3 c5;uniform vec3 c6;uniform vec2 speed;uniform float shift;uniform float alphaThreshold;varying vec2 vUV;float rand(vec2 n) {return fract(cos(dot(n,vec2(12.9898,4.1414)))*43758.5453);}\nfloat noise(vec2 n) {const vec2 d=vec2(0.0,1.0);vec2 b=floor(n),f=smoothstep(vec2(0.0),vec2(1.0),fract(n));return mix(mix(rand(b),rand(b+d.yx),f.x),mix(rand(b+d.xy),rand(b+d.yy),f.x),f.y);}\nfloat fbm(vec2 n) {float total=0.0,amplitude=1.0;for (int i=0; i<4; i++) {total+=noise(n)*amplitude;n+=n;amplitude*=0.5;}\nreturn total;}\nvoid main() {vec2 p=vUV*8.0;float q=fbm(p-time*0.1);vec2 r=vec2(fbm(p+q+time*speed.x-p.x-p.y),fbm(p+q-time*speed.y));vec3 c=mix(c1,c2,fbm(p+r))+mix(c3,c4,r.x)-mix(c5,c6,r.y);vec3 color=c*cos(shift*vUV.y);float luminance=dot(color.rgb,vec3(0.3,0.59,0.11));gl_FragColor=vec4(color,luminance*alphaThreshold+(1.0-alphaThreshold));}`;\n// Sideeffect\nShaderStore.ShadersStore[name] = shader;\n/** @hidden */\nexport const fireProceduralTexturePixelShader = { name, shader };\n"]}
1
+ {"version":3,"file":"fireProceduralTexture.fragment.js","sourceRoot":"","sources":["../../../../../lts/proceduralTextures/generated/fire/fireProceduralTexture.fragment.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,+CAAiC;AAEvD,MAAM,IAAI,GAAG,kCAAkC,CAAC;AAChD,MAAM,MAAM,GAAG;;;;wUAIyT,CAAC;AACzU,aAAa;AACb,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACxC,cAAc;AACd,MAAM,CAAC,MAAM,gCAAgC,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"core/Engines/shaderStore\";\n\nconst name = \"fireProceduralTexturePixelShader\";\nconst shader = `precision highp float;uniform float time;uniform vec3 c1;uniform vec3 c2;uniform vec3 c3;uniform vec3 c4;uniform vec3 c5;uniform vec3 c6;uniform vec2 speed;uniform float shift;uniform float alphaThreshold;varying vec2 vUV;float rand(vec2 n) {return fract(cos(dot(n,vec2(12.9898,4.1414)))*43758.5453);}\nfloat noise(vec2 n) {const vec2 d=vec2(0.0,1.0);vec2 b=floor(n),f=smoothstep(vec2(0.0),vec2(1.0),fract(n));return mix(mix(rand(b),rand(b+d.yx),f.x),mix(rand(b+d.xy),rand(b+d.yy),f.x),f.y);}\nfloat fbm(vec2 n) {float total=0.0,amplitude=1.0;for (int i=0; i<4; i++) {total+=noise(n)*amplitude;n+=n;amplitude*=0.5;}\nreturn total;}\nvoid main() {vec2 p=vUV*8.0;float q=fbm(p-time*0.1);vec2 r=vec2(fbm(p+q+time*speed.x-p.x-p.y),fbm(p+q-time*speed.y));vec3 c=mix(c1,c2,fbm(p+r))+mix(c3,c4,r.x)-mix(c5,c6,r.y);vec3 color=c*cos(shift*vUV.y);float luminance=dot(color.rgb,vec3(0.3,0.59,0.11));gl_FragColor=vec4(color,luminance*alphaThreshold+(1.0-alphaThreshold));}`;\n// Sideeffect\nShaderStore.ShadersStore[name] = shader;\n/** @hidden */\nexport const fireProceduralTexturePixelShader = { name, shader };\n"]}