babylonjs-procedural-textures 9.22.2 → 9.23.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.
@@ -0,0 +1,445 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ !function (e, t) { "object" == typeof exports && "undefined" != typeof module ? t(exports, require("babylonjs")) : "function" == typeof define && define.amd ? define(["exports", "babylonjs"], t) : t((e = "undefined" != typeof globalThis ? globalThis : e || self).PROCEDURALTEXTURES = e.PROCEDURALTEXTURES || {}, e.BABYLON); }(this, function (e, t) {
18
+ "use strict";
19
+ function r(e, t, r, i, a, o) { function s(e) { if (void 0 !== e && "function" != typeof e)
20
+ throw new TypeError("Function expected"); return e; } for (var n, l = i.kind, d = "getter" === l ? "get" : "setter" === l ? "set" : "value", c = !t && e ? i.static ? e : e.prototype : null, u = t || (c ? Object.getOwnPropertyDescriptor(c, i.name) : {}), m = !1, h = r.length - 1; h >= 0; h--) {
21
+ var f = {};
22
+ for (var p in i)
23
+ f[p] = "access" === p ? {} : i[p];
24
+ for (var p in i.access)
25
+ f.access[p] = i.access[p];
26
+ f.addInitializer = function (e) { if (m)
27
+ throw new TypeError("Cannot add initializers after decoration has completed"); o.push(s(e || null)); };
28
+ var v = (0, r[h])("accessor" === l ? { get: u.get, set: u.set } : u[d], f);
29
+ if ("accessor" === l) {
30
+ if (void 0 === v)
31
+ continue;
32
+ if (null === v || "object" != typeof v)
33
+ throw new TypeError("Object expected");
34
+ (n = s(v.get)) && (u.get = n), (n = s(v.set)) && (u.set = n), (n = s(v.init)) && a.unshift(n);
35
+ }
36
+ else
37
+ (n = s(v)) && ("field" === l ? a.unshift(n) : u[d] = n);
38
+ } c && Object.defineProperty(c, i.name, u), m = !0; }
39
+ function i(e, t, r) { for (var i = arguments.length > 2, a = 0; a < t.length; a++)
40
+ r = i ? t[a].call(e, r) : t[a].call(e); return i ? r : void 0; }
41
+ Object.create, Object.create, "function" == typeof SuppressedError && SuppressedError;
42
+ var a = "brickProceduralTexturePixelShader";
43
+ t.ShaderStore.ShadersStore[a] || (t.ShaderStore.ShadersStore[a] = "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);}");
44
+ var o = (function () { var e; var a, o, s, n, l = t.ProceduralTexture, d = []; return e = /** @class */ (function (_super) {
45
+ __extends(e, _super);
46
+ function e(e, r, a, o, s) {
47
+ if (a === void 0) { a = null; }
48
+ var _this = this;
49
+ _this = _super.call(this, e, r, "brickProceduralTexture", a, o, s) || this, _this._numberOfBricksHeight = (i(_this, d), 15), _this._numberOfBricksWidth = 5, _this._jointColor = new t.Color3(.72, .72, .72), _this._brickColor = new t.Color3(.77, .47, .4), _this.updateShaderUniforms();
50
+ return _this;
51
+ }
52
+ e.prototype.updateShaderUniforms = function () { this.setFloat("numberOfBricksHeight", this._numberOfBricksHeight), this.setFloat("numberOfBricksWidth", this._numberOfBricksWidth), this.setColor3("brickColor", this._brickColor), this.setColor3("jointColor", this._jointColor); };
53
+ Object.defineProperty(e.prototype, "numberOfBricksHeight", {
54
+ get: function () { return this._numberOfBricksHeight; },
55
+ set: function (e) { this._numberOfBricksHeight = e, this.updateShaderUniforms(); },
56
+ enumerable: false,
57
+ configurable: true
58
+ });
59
+ Object.defineProperty(e.prototype, "numberOfBricksWidth", {
60
+ get: function () { return this._numberOfBricksWidth; },
61
+ set: function (e) { this._numberOfBricksWidth = e, this.updateShaderUniforms(); },
62
+ enumerable: false,
63
+ configurable: true
64
+ });
65
+ Object.defineProperty(e.prototype, "jointColor", {
66
+ get: function () { return this._jointColor; },
67
+ set: function (e) { this._jointColor = e, this.updateShaderUniforms(); },
68
+ enumerable: false,
69
+ configurable: true
70
+ });
71
+ Object.defineProperty(e.prototype, "brickColor", {
72
+ get: function () { return this._brickColor; },
73
+ set: function (e) { this._brickColor = e, this.updateShaderUniforms(); },
74
+ enumerable: false,
75
+ configurable: true
76
+ });
77
+ e.prototype.serialize = function () { var e = t.SerializationHelper.Serialize(this, _super.prototype.serialize.call(this)); return e.customType = "BABYLON.BrickProceduralTexture", e; };
78
+ e.Parse = function (r, i, a) { return t.SerializationHelper.Parse(function () { return new e(r.name, r._size, i, void 0, r._generateMipMaps); }, r, i, a); };
79
+ return e;
80
+ }(l)), (function () { var i; var c = "function" == typeof Symbol && Symbol.metadata ? Object.create(null !== (i = l[Symbol.metadata]) && void 0 !== i ? i : null) : void 0; a = [t.serialize()], o = [t.serialize()], s = [t.serializeAsColor3()], n = [t.serializeAsColor3()], r(e, null, a, { kind: "getter", name: "numberOfBricksHeight", static: !1, private: !1, access: { has: function (e) { return "numberOfBricksHeight" in e; }, get: function (e) { return e.numberOfBricksHeight; } }, metadata: c }, null, d), r(e, null, o, { kind: "getter", name: "numberOfBricksWidth", static: !1, private: !1, access: { has: function (e) { return "numberOfBricksWidth" in e; }, get: function (e) { return e.numberOfBricksWidth; } }, metadata: c }, null, d), r(e, null, s, { kind: "getter", name: "jointColor", static: !1, private: !1, access: { has: function (e) { return "jointColor" in e; }, get: function (e) { return e.jointColor; } }, metadata: c }, null, d), r(e, null, n, { kind: "getter", name: "brickColor", static: !1, private: !1, access: { has: function (e) { return "brickColor" in e; }, get: function (e) { return e.brickColor; } }, metadata: c }, null, d), c && Object.defineProperty(e, Symbol.metadata, { enumerable: !0, configurable: !0, writable: !0, value: c }); })(), e; })();
81
+ t.RegisterClass("BABYLON.BrickProceduralTexture", o);
82
+ var s = "cloudProceduralTexturePixelShader";
83
+ t.ShaderStore.ShadersStore[s] || (t.ShaderStore.ShadersStore[s] = "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");
84
+ var n = (function () { var e; var a, o, s, n, l = t.ProceduralTexture, d = []; return e = /** @class */ (function (_super) {
85
+ __extends(e, _super);
86
+ function e(e, r, a, o, s) {
87
+ if (a === void 0) { a = null; }
88
+ var _this = this;
89
+ _this = _super.call(this, e, r, "cloudProceduralTexture", a, o, s) || this, _this._skyColor = (i(_this, d), new t.Color4(.15, .68, 1, 1)), _this._cloudColor = new t.Color4(1, 1, 1, 1), _this._amplitude = 1, _this._numOctaves = 4, _this.updateShaderUniforms();
90
+ return _this;
91
+ }
92
+ e.prototype.updateShaderUniforms = function () { this.setColor4("skyColor", this._skyColor), this.setColor4("cloudColor", this._cloudColor), this.setFloat("amplitude", this._amplitude), this.setInt("numOctaves", this._numOctaves); };
93
+ Object.defineProperty(e.prototype, "skyColor", {
94
+ get: function () { return this._skyColor; },
95
+ set: function (e) { this._skyColor = e, this.updateShaderUniforms(); },
96
+ enumerable: false,
97
+ configurable: true
98
+ });
99
+ Object.defineProperty(e.prototype, "cloudColor", {
100
+ get: function () { return this._cloudColor; },
101
+ set: function (e) { this._cloudColor = e, this.updateShaderUniforms(); },
102
+ enumerable: false,
103
+ configurable: true
104
+ });
105
+ Object.defineProperty(e.prototype, "amplitude", {
106
+ get: function () { return this._amplitude; },
107
+ set: function (e) { this._amplitude = e, this.updateShaderUniforms(); },
108
+ enumerable: false,
109
+ configurable: true
110
+ });
111
+ Object.defineProperty(e.prototype, "numOctaves", {
112
+ get: function () { return this._numOctaves; },
113
+ set: function (e) { this._numOctaves = e, this.updateShaderUniforms(); },
114
+ enumerable: false,
115
+ configurable: true
116
+ });
117
+ e.prototype.serialize = function () { var e = t.SerializationHelper.Serialize(this, _super.prototype.serialize.call(this)); return e.customType = "BABYLON.CloudProceduralTexture", e; };
118
+ e.Parse = function (r, i, a) { return t.SerializationHelper.Parse(function () { return new e(r.name, r._size, i, void 0, r._generateMipMaps); }, r, i, a); };
119
+ return e;
120
+ }(l)), (function () { var i; var c = "function" == typeof Symbol && Symbol.metadata ? Object.create(null !== (i = l[Symbol.metadata]) && void 0 !== i ? i : null) : void 0; a = [t.serializeAsColor4()], o = [t.serializeAsColor4()], s = [t.serialize()], n = [t.serialize()], r(e, null, a, { kind: "getter", name: "skyColor", static: !1, private: !1, access: { has: function (e) { return "skyColor" in e; }, get: function (e) { return e.skyColor; } }, metadata: c }, null, d), r(e, null, o, { kind: "getter", name: "cloudColor", static: !1, private: !1, access: { has: function (e) { return "cloudColor" in e; }, get: function (e) { return e.cloudColor; } }, metadata: c }, null, d), r(e, null, s, { kind: "getter", name: "amplitude", static: !1, private: !1, access: { has: function (e) { return "amplitude" in e; }, get: function (e) { return e.amplitude; } }, metadata: c }, null, d), r(e, null, n, { kind: "getter", name: "numOctaves", static: !1, private: !1, access: { has: function (e) { return "numOctaves" in e; }, get: function (e) { return e.numOctaves; } }, metadata: c }, null, d), c && Object.defineProperty(e, Symbol.metadata, { enumerable: !0, configurable: !0, writable: !0, value: c }); })(), e; })();
121
+ t.RegisterClass("BABYLON.CloudProceduralTexture", n);
122
+ var l = "fireProceduralTexturePixelShader";
123
+ t.ShaderStore.ShadersStore[l] || (t.ShaderStore.ShadersStore[l] = "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));}");
124
+ var d = (function () { var e; var a, o, s, n, l = t.ProceduralTexture, d = []; return e = /** @class */ (function (_super) {
125
+ __extends(e, _super);
126
+ function e(r, a, o, s, n) {
127
+ if (o === void 0) { o = null; }
128
+ var _this = this;
129
+ _this = _super.call(this, r, a, "fireProceduralTexture", o, s, n) || this, _this._time = (i(_this, d), 0), _this._speed = new t.Vector2(.5, .3), _this._autoGenerateTime = !0, _this._alphaThreshold = .5, _this._fireColors = e.RedFireColors, _this.updateShaderUniforms();
130
+ return _this;
131
+ }
132
+ e.prototype.updateShaderUniforms = function () { this.setFloat("time", this._time), this.setVector2("speed", this._speed), this.setColor3("c1", this._fireColors[0]), this.setColor3("c2", this._fireColors[1]), this.setColor3("c3", this._fireColors[2]), this.setColor3("c4", this._fireColors[3]), this.setColor3("c5", this._fireColors[4]), this.setColor3("c6", this._fireColors[5]), this.setFloat("alphaThreshold", this._alphaThreshold); };
133
+ e.prototype.render = function (e) { var t = this.getScene(); this._autoGenerateTime && t && (this._time += .03 * t.getAnimationRatio(), this.updateShaderUniforms()), _super.prototype.render.call(this, e); };
134
+ Object.defineProperty(e, "PurpleFireColors", {
135
+ get: function () { return [new t.Color3(.5, 0, 1), new t.Color3(.9, 0, 1), new t.Color3(.2, 0, 1), new t.Color3(1, .9, 1), new t.Color3(.1, .1, 1), new t.Color3(.9, .9, 1)]; },
136
+ enumerable: false,
137
+ configurable: true
138
+ });
139
+ Object.defineProperty(e, "GreenFireColors", {
140
+ get: function () { return [new t.Color3(.5, 1, 0), new t.Color3(.5, 1, 0), new t.Color3(.3, .4, 0), new t.Color3(.5, 1, 0), new t.Color3(.2, 0, 0), new t.Color3(.5, 1, 0)]; },
141
+ enumerable: false,
142
+ configurable: true
143
+ });
144
+ Object.defineProperty(e, "RedFireColors", {
145
+ get: function () { return [new t.Color3(.5, 0, .1), new t.Color3(.9, 0, 0), new t.Color3(.2, 0, 0), new t.Color3(1, .9, 0), new t.Color3(.1, .1, .1), new t.Color3(.9, .9, .9)]; },
146
+ enumerable: false,
147
+ configurable: true
148
+ });
149
+ Object.defineProperty(e, "BlueFireColors", {
150
+ get: function () { return [new t.Color3(.1, 0, .5), new t.Color3(0, 0, .5), new t.Color3(.1, 0, .2), new t.Color3(0, 0, 1), new t.Color3(.1, .2, .3), new t.Color3(0, .2, .9)]; },
151
+ enumerable: false,
152
+ configurable: true
153
+ });
154
+ Object.defineProperty(e.prototype, "autoGenerateTime", {
155
+ get: function () { return this._autoGenerateTime; },
156
+ set: function (e) { this._autoGenerateTime = e; },
157
+ enumerable: false,
158
+ configurable: true
159
+ });
160
+ Object.defineProperty(e.prototype, "fireColors", {
161
+ get: function () { return this._fireColors; },
162
+ set: function (e) { this._fireColors = e, this.updateShaderUniforms(); },
163
+ enumerable: false,
164
+ configurable: true
165
+ });
166
+ Object.defineProperty(e.prototype, "time", {
167
+ get: function () { return this._time; },
168
+ set: function (e) { this._time = e, this.updateShaderUniforms(); },
169
+ enumerable: false,
170
+ configurable: true
171
+ });
172
+ Object.defineProperty(e.prototype, "speed", {
173
+ get: function () { return this._speed; },
174
+ set: function (e) { this._speed = e, this.updateShaderUniforms(); },
175
+ enumerable: false,
176
+ configurable: true
177
+ });
178
+ Object.defineProperty(e.prototype, "alphaThreshold", {
179
+ get: function () { return this._alphaThreshold; },
180
+ set: function (e) { this._alphaThreshold = e, this.updateShaderUniforms(); },
181
+ enumerable: false,
182
+ configurable: true
183
+ });
184
+ e.prototype.serialize = function () { var e = t.SerializationHelper.Serialize(this, _super.prototype.serialize.call(this)); e.customType = "BABYLON.FireProceduralTexture", e.fireColors = []; for (var t_1 = 0; t_1 < this._fireColors.length; t_1++)
185
+ e.fireColors.push(this._fireColors[t_1].asArray()); return e; };
186
+ e.Parse = function (r, i, a) { var o = t.SerializationHelper.Parse(function () { return new e(r.name, r._size, i, void 0, r._generateMipMaps); }, r, i, a), s = []; for (var e_1 = 0; e_1 < r.fireColors.length; e_1++)
187
+ s.push(t.Color3.FromArray(r.fireColors[e_1])); return o.fireColors = s, o; };
188
+ return e;
189
+ }(l)), (function () { var i; var c = "function" == typeof Symbol && Symbol.metadata ? Object.create(null !== (i = l[Symbol.metadata]) && void 0 !== i ? i : null) : void 0; a = [t.serialize()], o = [t.serialize()], s = [t.serializeAsVector2()], n = [t.serialize()], r(e, null, a, { kind: "getter", name: "autoGenerateTime", static: !1, private: !1, access: { has: function (e) { return "autoGenerateTime" in e; }, get: function (e) { return e.autoGenerateTime; } }, metadata: c }, null, d), r(e, null, o, { kind: "getter", name: "time", static: !1, private: !1, access: { has: function (e) { return "time" in e; }, get: function (e) { return e.time; } }, metadata: c }, null, d), r(e, null, s, { kind: "getter", name: "speed", static: !1, private: !1, access: { has: function (e) { return "speed" in e; }, get: function (e) { return e.speed; } }, metadata: c }, null, d), r(e, null, n, { kind: "getter", name: "alphaThreshold", static: !1, private: !1, access: { has: function (e) { return "alphaThreshold" in e; }, get: function (e) { return e.alphaThreshold; } }, metadata: c }, null, d), c && Object.defineProperty(e, Symbol.metadata, { enumerable: !0, configurable: !0, writable: !0, value: c }); })(), e; })();
190
+ t.RegisterClass("BABYLON.FireProceduralTexture", d);
191
+ var c = "grassProceduralTexturePixelShader";
192
+ t.ShaderStore.ShadersStore[c] || (t.ShaderStore.ShadersStore[c] = "precision highp float;varying vec2 vPosition;varying vec2 vUV;uniform vec3 herb1Color;uniform vec3 herb2Color;uniform vec3 herb3Color;uniform vec3 groundColor;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;}\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\nvec3 color=mix(groundColor,herb1Color,rand(gl_FragCoord.xy*4.0));color=mix(color,herb2Color,rand(gl_FragCoord.xy*8.0));color=mix(color,herb3Color,rand(gl_FragCoord.xy));color=mix(color,herb1Color,fbm(gl_FragCoord.xy*16.0));gl_FragColor=vec4(color,1.0);\n#define CUSTOM_FRAGMENT_MAIN_END\n}");
193
+ var u = (function () { var e; var a, o = t.ProceduralTexture, s = []; return e = /** @class */ (function (_super) {
194
+ __extends(e, _super);
195
+ function e(e, r, a, o, n) {
196
+ if (a === void 0) { a = null; }
197
+ var _this = this;
198
+ _this = _super.call(this, e, r, "grassProceduralTexture", a, o, n) || this, _this._grassColors = i(_this, s), _this._groundColor = new t.Color3(1, 1, 1), _this._grassColors = [new t.Color3(.29, .38, .02), new t.Color3(.36, .49, .09), new t.Color3(.51, .6, .28)], _this.updateShaderUniforms();
199
+ return _this;
200
+ }
201
+ e.prototype.updateShaderUniforms = function () { this.setColor3("herb1Color", this._grassColors[0]), this.setColor3("herb2Color", this._grassColors[1]), this.setColor3("herb3Color", this._grassColors[2]), this.setColor3("groundColor", this._groundColor); };
202
+ Object.defineProperty(e.prototype, "grassColors", {
203
+ get: function () { return this._grassColors; },
204
+ set: function (e) { this._grassColors = e, this.updateShaderUniforms(); },
205
+ enumerable: false,
206
+ configurable: true
207
+ });
208
+ Object.defineProperty(e.prototype, "groundColor", {
209
+ get: function () { return this._groundColor; },
210
+ set: function (e) { this._groundColor = e, this.updateShaderUniforms(); },
211
+ enumerable: false,
212
+ configurable: true
213
+ });
214
+ e.prototype.serialize = function () { var e = t.SerializationHelper.Serialize(this, _super.prototype.serialize.call(this)); e.customType = "BABYLON.GrassProceduralTexture", e.grassColors = []; for (var t_2 = 0; t_2 < this._grassColors.length; t_2++)
215
+ e.grassColors.push(this._grassColors[t_2].asArray()); return e; };
216
+ e.Parse = function (r, i, a) { var o = t.SerializationHelper.Parse(function () { return new e(r.name, r._size, i, void 0, r._generateMipMaps); }, r, i, a), s = []; for (var e_2 = 0; e_2 < r.grassColors.length; e_2++)
217
+ s.push(t.Color3.FromArray(r.grassColors[e_2])); return o.grassColors = s, o; };
218
+ return e;
219
+ }(o)), (function () { var i; var n = "function" == typeof Symbol && Symbol.metadata ? Object.create(null !== (i = o[Symbol.metadata]) && void 0 !== i ? i : null) : void 0; a = [t.serializeAsColor3()], r(e, null, a, { kind: "getter", name: "groundColor", static: !1, private: !1, access: { has: function (e) { return "groundColor" in e; }, get: function (e) { return e.groundColor; } }, metadata: n }, null, s), n && Object.defineProperty(e, Symbol.metadata, { enumerable: !0, configurable: !0, writable: !0, value: n }); })(), e; })();
220
+ t.RegisterClass("BABYLON.GrassProceduralTexture", u);
221
+ var m = "marbleProceduralTexturePixelShader";
222
+ t.ShaderStore.ShadersStore[m] || (t.ShaderStore.ShadersStore[m] = "precision highp float;varying vec2 vPosition;varying vec2 vUV;uniform float numberOfTilesHeight;uniform float numberOfTilesWidth;uniform float amplitude;uniform vec3 marbleColor;uniform vec3 jointColor;const vec3 tileSize=vec3(1.1,1.0,1.1);const vec3 tilePct=vec3(0.98,1.0,0.98);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 turbulence(vec2 P)\n{float val=0.0;float freq=1.0;for (int i=0; i<4; i++)\n{val+=abs(noise(P*freq)/freq);freq*=2.07;}\nreturn val;}\nfloat roundF(float number){return sign(number)*floor(abs(number)+0.5);}\nvec3 marble_color(float x)\n{vec3 col;x=0.5*(x+1.);x=sqrt(x); \nx=sqrt(x);x=sqrt(x);col=vec3(.2+.75*x); \ncol.b*=0.95; \nreturn col;}\nvoid main()\n{float brickW=1.0/numberOfTilesWidth;float brickH=1.0/numberOfTilesHeight;float jointWPercentage=0.01;float jointHPercentage=0.01;vec3 color=marbleColor;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 t=6.28*brickvUV.x/(tileSize.x+noise(vec2(vUV)*6.0));t+=amplitude*turbulence(brickvUV.xy);t=sin(t);color=marble_color(t);}\ngl_FragColor=vec4(color,0.0);}");
223
+ var h = (function () { var e; var a, o, s, n, l = t.ProceduralTexture, d = []; return e = /** @class */ (function (_super) {
224
+ __extends(e, _super);
225
+ function e(e, r, a, o, s) {
226
+ if (a === void 0) { a = null; }
227
+ var _this = this;
228
+ _this = _super.call(this, e, r, "marbleProceduralTexture", a, o, s) || this, _this._numberOfTilesHeight = (i(_this, d), 3), _this._numberOfTilesWidth = 3, _this._amplitude = 9, _this._jointColor = new t.Color3(.72, .72, .72), _this.updateShaderUniforms();
229
+ return _this;
230
+ }
231
+ e.prototype.updateShaderUniforms = function () { this.setFloat("numberOfTilesHeight", this._numberOfTilesHeight), this.setFloat("numberOfTilesWidth", this._numberOfTilesWidth), this.setFloat("amplitude", this._amplitude), this.setColor3("jointColor", this._jointColor); };
232
+ Object.defineProperty(e.prototype, "numberOfTilesHeight", {
233
+ get: function () { return this._numberOfTilesHeight; },
234
+ set: function (e) { this._numberOfTilesHeight = e, this.updateShaderUniforms(); },
235
+ enumerable: false,
236
+ configurable: true
237
+ });
238
+ Object.defineProperty(e.prototype, "amplitude", {
239
+ get: function () { return this._amplitude; },
240
+ set: function (e) { this._amplitude = e, this.updateShaderUniforms(); },
241
+ enumerable: false,
242
+ configurable: true
243
+ });
244
+ Object.defineProperty(e.prototype, "numberOfTilesWidth", {
245
+ get: function () { return this._numberOfTilesWidth; },
246
+ set: function (e) { this._numberOfTilesWidth = e, this.updateShaderUniforms(); },
247
+ enumerable: false,
248
+ configurable: true
249
+ });
250
+ Object.defineProperty(e.prototype, "jointColor", {
251
+ get: function () { return this._jointColor; },
252
+ set: function (e) { this._jointColor = e, this.updateShaderUniforms(); },
253
+ enumerable: false,
254
+ configurable: true
255
+ });
256
+ e.prototype.serialize = function () { var e = t.SerializationHelper.Serialize(this, _super.prototype.serialize.call(this)); return e.customType = "BABYLON.MarbleProceduralTexture", e; };
257
+ e.Parse = function (r, i, a) { return t.SerializationHelper.Parse(function () { return new e(r.name, r._size, i, void 0, r._generateMipMaps); }, r, i, a); };
258
+ return e;
259
+ }(l)), (function () { var i; var c = "function" == typeof Symbol && Symbol.metadata ? Object.create(null !== (i = l[Symbol.metadata]) && void 0 !== i ? i : null) : void 0; a = [t.serialize()], o = [t.serialize()], s = [t.serialize()], n = [t.serialize()], r(e, null, a, { kind: "getter", name: "numberOfTilesHeight", static: !1, private: !1, access: { has: function (e) { return "numberOfTilesHeight" in e; }, get: function (e) { return e.numberOfTilesHeight; } }, metadata: c }, null, d), r(e, null, o, { kind: "getter", name: "amplitude", static: !1, private: !1, access: { has: function (e) { return "amplitude" in e; }, get: function (e) { return e.amplitude; } }, metadata: c }, null, d), r(e, null, s, { kind: "getter", name: "numberOfTilesWidth", static: !1, private: !1, access: { has: function (e) { return "numberOfTilesWidth" in e; }, get: function (e) { return e.numberOfTilesWidth; } }, metadata: c }, null, d), r(e, null, n, { kind: "getter", name: "jointColor", static: !1, private: !1, access: { has: function (e) { return "jointColor" in e; }, get: function (e) { return e.jointColor; } }, metadata: c }, null, d), c && Object.defineProperty(e, Symbol.metadata, { enumerable: !0, configurable: !0, writable: !0, value: c }); })(), e; })();
260
+ t.RegisterClass("BABYLON.MarbleProceduralTexture", h);
261
+ var f = "normalMapProceduralTexturePixelShader";
262
+ t.ShaderStore.ShadersStore[f] || (t.ShaderStore.ShadersStore[f] = "precision highp float;uniform sampler2D baseSampler;uniform float size;varying vec2 vUV;const vec3 LUMA_COEFFICIENT=vec3(0.2126,0.7152,0.0722);float lumaAtCoord(vec2 coord)\n{vec3 pixel=texture2D(baseSampler,coord).rgb;float luma=dot(pixel,LUMA_COEFFICIENT);return luma;}\nvoid main()\n{float lumaU0=lumaAtCoord(vUV+vec2(-1.0, 0.0)/size);float lumaU1=lumaAtCoord(vUV+vec2( 1.0, 0.0)/size);float lumaV0=lumaAtCoord(vUV+vec2( 0.0,-1.0)/size);float lumaV1=lumaAtCoord(vUV+vec2( 0.0, 1.0)/size);vec2 slope=(vec2(lumaU0-lumaU1,lumaV0-lumaV1)+1.0)*0.5;gl_FragColor=vec4(slope,1.0,1.0);}\n");
263
+ var p = (function () { var e; var a, o = t.ProceduralTexture, s = []; return e = /** @class */ (function (_super) {
264
+ __extends(e, _super);
265
+ function e(e, t, r, a, o) {
266
+ if (r === void 0) { r = null; }
267
+ var _this = this;
268
+ _this = _super.call(this, e, t, "normalMapProceduralTexture", r, a, o) || this, _this._baseTexture = i(_this, s), _this.updateShaderUniforms();
269
+ return _this;
270
+ }
271
+ e.prototype.updateShaderUniforms = function () { this.setTexture("baseSampler", this._baseTexture), this.setFloat("size", this.getRenderSize()); };
272
+ e.prototype.render = function (e) { _super.prototype.render.call(this, e); };
273
+ e.prototype.resize = function (e, t) { _super.prototype.resize.call(this, e, t), this.updateShaderUniforms(); };
274
+ e.prototype.isReady = function () { return !(!this._baseTexture || !this._baseTexture.isReady()) && _super.prototype.isReady.call(this); };
275
+ Object.defineProperty(e.prototype, "baseTexture", {
276
+ get: function () { return this._baseTexture; },
277
+ set: function (e) { this._baseTexture = e, this.updateShaderUniforms(); },
278
+ enumerable: false,
279
+ configurable: true
280
+ });
281
+ e.prototype.serialize = function () { var e = t.SerializationHelper.Serialize(this, _super.prototype.serialize.call(this)); return e.customType = "BABYLON.NormalMapProceduralTexture", e; };
282
+ e.Parse = function (r, i, a) { return t.SerializationHelper.Parse(function () { return new e(r.name, r._size, i, void 0, r._generateMipMaps); }, r, i, a); };
283
+ return e;
284
+ }(o)), (function () { var i; var n = "function" == typeof Symbol && Symbol.metadata ? Object.create(null !== (i = o[Symbol.metadata]) && void 0 !== i ? i : null) : void 0; a = [t.serializeAsTexture()], r(e, null, a, { kind: "getter", name: "baseTexture", static: !1, private: !1, access: { has: function (e) { return "baseTexture" in e; }, get: function (e) { return e.baseTexture; } }, metadata: n }, null, s), n && Object.defineProperty(e, Symbol.metadata, { enumerable: !0, configurable: !0, writable: !0, value: n }); })(), e; })();
285
+ t.RegisterClass("BABYLON.NormalMapProceduralTexture", p);
286
+ var v = "perlinNoiseProceduralTexturePixelShader";
287
+ t.ShaderStore.ShadersStore[v] || (t.ShaderStore.ShadersStore[v] = "precision highp float;uniform float size;uniform float time;uniform float translationSpeed;varying vec2 vUV;float r(float n)\n{return fract(cos(n*89.42)*343.42);}\nvec2 r(vec2 n)\n{return vec2(r(n.x*23.62-300.0+n.y*34.35),r(n.x*45.13+256.0+n.y*38.89)); }\nfloat worley(vec2 n,float s)\n{float dis=1.0;for(int x=-1; x<=1; x++)\n{for(int y=-1; y<=1; y++)\n{vec2 p=floor(n/s)+vec2(x,y);float d=length(r(p)+vec2(x,y)-fract(n/s));if (dis>d)\ndis=d;}}\nreturn 1.0-dis;}\nvec3 hash33(vec3 p3)\n{p3=fract(p3*vec3(0.1031,0.11369,0.13787));p3+=dot(p3,p3.yxz+19.19);return -1.0+2.0*fract(vec3((p3.x+p3.y)*p3.z,(p3.x+p3.z)*p3.y,(p3.y+p3.z)*p3.x));}\nfloat perlinNoise(vec3 p)\n{vec3 pi=floor(p);vec3 pf=p-pi;vec3 w=pf*pf*(3.0-2.0*pf);return mix(\nmix(\nmix(\ndot(pf-vec3(0,0,0),hash33(pi+vec3(0,0,0))),\ndot(pf-vec3(1,0,0),hash33(pi+vec3(1,0,0))),\nw.x\n),\nmix(\ndot(pf-vec3(0,0,1),hash33(pi+vec3(0,0,1))),\ndot(pf-vec3(1,0,1),hash33(pi+vec3(1,0,1))),\nw.x\n),\nw.z\n),\nmix(\nmix(\ndot(pf-vec3(0,1,0),hash33(pi+vec3(0,1,0))),\ndot(pf-vec3(1,1,0),hash33(pi+vec3(1,1,0))),\nw.x\n),\nmix(\ndot(pf-vec3(0,1,1),hash33(pi+vec3(0,1,1))),\ndot(pf-vec3(1,1,1),hash33(pi+vec3(1,1,1))),\nw.x\n),\nw.z\n),\nw.y\n);}\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{vec2 uv=gl_FragCoord.xy+translationSpeed;float dis=(\n1.0+perlinNoise(vec3(uv/vec2(size,size),time*0.05)*8.0))\n* (1.0+(worley(uv,32.0)+ 0.5*worley(2.0*uv,32.0)+0.25*worley(4.0*uv,32.0))\n);gl_FragColor=vec4(vec3(dis/4.0),1.0);}\n");
288
+ var g = (function () { var e; var a, o, s, n = t.ProceduralTexture, l = [], d = [], c = [], u = [], m = [], h = []; return e = /** @class */ (function (_super) {
289
+ __extends(e, _super);
290
+ function e(e, t, r, a, o) {
291
+ if (r === void 0) { r = null; }
292
+ var _this = this;
293
+ _this = _super.call(this, e, t, "perlinNoiseProceduralTexture", r, a, o) || this, _this.time = i(_this, l, 0), _this.timeScale = (i(_this, d), i(_this, c, 1)), _this.translationSpeed = (i(_this, u), i(_this, m, 1)), _this._currentTranslation = (i(_this, h), 0), _this.updateShaderUniforms();
294
+ return _this;
295
+ }
296
+ e.prototype.updateShaderUniforms = function () { this.setFloat("size", this.getRenderSize()); var e = this.getScene(); if (!e)
297
+ return; var t = e.getEngine().getDeltaTime(); this.time += t, this.setFloat("time", this.time * this.timeScale / 1e3), this._currentTranslation += t * this.translationSpeed / 1e3, this.setFloat("translationSpeed", this._currentTranslation); };
298
+ e.prototype.render = function (e) { this.updateShaderUniforms(), _super.prototype.render.call(this, e); };
299
+ e.prototype.resize = function (e, t) { _super.prototype.resize.call(this, e, t); };
300
+ e.prototype.serialize = function () { var e = t.SerializationHelper.Serialize(this, _super.prototype.serialize.call(this)); return e.customType = "BABYLON.PerlinNoiseProceduralTexture", e; };
301
+ e.Parse = function (r, i, a) { return t.SerializationHelper.Parse(function () { return new e(r.name, r._size, i, void 0, r._generateMipMaps); }, r, i, a); };
302
+ return e;
303
+ }(n)), (function () { var i; var f = "function" == typeof Symbol && Symbol.metadata ? Object.create(null !== (i = n[Symbol.metadata]) && void 0 !== i ? i : null) : void 0; a = [t.serialize()], o = [t.serialize()], s = [t.serialize()], r(null, null, a, { kind: "field", name: "time", static: !1, private: !1, access: { has: function (e) { return "time" in e; }, get: function (e) { return e.time; }, set: function (e, t) { e.time = t; } }, metadata: f }, l, d), r(null, null, o, { kind: "field", name: "timeScale", static: !1, private: !1, access: { has: function (e) { return "timeScale" in e; }, get: function (e) { return e.timeScale; }, set: function (e, t) { e.timeScale = t; } }, metadata: f }, c, u), r(null, null, s, { kind: "field", name: "translationSpeed", static: !1, private: !1, access: { has: function (e) { return "translationSpeed" in e; }, get: function (e) { return e.translationSpeed; }, set: function (e, t) { e.translationSpeed = t; } }, metadata: f }, m, h), f && Object.defineProperty(e, Symbol.metadata, { enumerable: !0, configurable: !0, writable: !0, value: f }); })(), e; })();
304
+ t.RegisterClass("BABYLON.PerlinNoiseProceduralTexture", g);
305
+ var b = "roadProceduralTexturePixelShader";
306
+ t.ShaderStore.ShadersStore[b] || (t.ShaderStore.ShadersStore[b] = "precision highp float;varying vec2 vUV; \nuniform vec3 roadColor;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;}\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\nfloat ratioy=mod(gl_FragCoord.y*100.0 ,fbm(vUV*2.0));vec3 color=roadColor*ratioy;gl_FragColor=vec4(color,1.0);\n#define CUSTOM_FRAGMENT_MAIN_END\n}");
307
+ var S = (function () { var e; var a, o = t.ProceduralTexture, s = []; return e = /** @class */ (function (_super) {
308
+ __extends(e, _super);
309
+ function e(e, r, a, o, n) {
310
+ if (a === void 0) { a = null; }
311
+ var _this = this;
312
+ _this = _super.call(this, e, r, "roadProceduralTexture", a, o, n) || this, _this._roadColor = (i(_this, s), new t.Color3(.53, .53, .53)), _this.updateShaderUniforms();
313
+ return _this;
314
+ }
315
+ e.prototype.updateShaderUniforms = function () { this.setColor3("roadColor", this._roadColor); };
316
+ Object.defineProperty(e.prototype, "roadColor", {
317
+ get: function () { return this._roadColor; },
318
+ set: function (e) { this._roadColor = e, this.updateShaderUniforms(); },
319
+ enumerable: false,
320
+ configurable: true
321
+ });
322
+ e.prototype.serialize = function () { var e = t.SerializationHelper.Serialize(this, _super.prototype.serialize.call(this)); return e.customType = "BABYLON.RoadProceduralTexture", e; };
323
+ e.Parse = function (r, i, a) { return t.SerializationHelper.Parse(function () { return new e(r.name, r._size, i, void 0, r._generateMipMaps); }, r, i, a); };
324
+ return e;
325
+ }(o)), (function () { var i; var n = "function" == typeof Symbol && Symbol.metadata ? Object.create(null !== (i = o[Symbol.metadata]) && void 0 !== i ? i : null) : void 0; a = [t.serializeAsColor3()], r(e, null, a, { kind: "getter", name: "roadColor", static: !1, private: !1, access: { has: function (e) { return "roadColor" in e; }, get: function (e) { return e.roadColor; } }, metadata: n }, null, s), n && Object.defineProperty(e, Symbol.metadata, { enumerable: !0, configurable: !0, writable: !0, value: n }); })(), e; })();
326
+ t.RegisterClass("BABYLON.RoadProceduralTexture", S);
327
+ var C = "starfieldProceduralTexturePixelShader";
328
+ t.ShaderStore.ShadersStore[C] || (t.ShaderStore.ShadersStore[C] = "precision highp float;\n#define volsteps 20\n#define iterations 15\nvarying vec2 vPosition;varying vec2 vUV;uniform float time;uniform float alpha;uniform float beta;uniform float zoom;uniform float formuparam;uniform float stepsize;uniform float tile;uniform float brightness;uniform float darkmatter;uniform float distfading;uniform float saturation;void main()\n{vec3 dir=vec3(vUV*zoom,1.);float localTime=time*0.0001;mat2 rot1=mat2(cos(alpha),sin(alpha),-sin(alpha),cos(alpha));mat2 rot2=mat2(cos(beta),sin(beta),-sin(beta),cos(beta));dir.xz*=rot1;dir.xy*=rot2;vec3 from_=vec3(1.,.5,0.5);from_+=vec3(-2.,localTime*2.,localTime);from_.xz*=rot1;from_.xy*=rot2;float s=0.1,fade=1.;vec3 v=vec3(0.);for (int r=0; r<volsteps; r++) {vec3 p=from_+s*dir*.5;p=abs(vec3(tile)-mod(p,vec3(tile*2.))); \nfloat pa,a=pa=0.;for (int i=0; i<iterations; i++) {p=abs(p)/dot(p,p)-formuparam; \na+=abs(length(p)-pa); \npa=length(p);}\nfloat dm=max(0.,darkmatter-a*a*.001); \na*=a*a; \nif (r>6) fade*=1.-dm; \nv+=fade;v+=vec3(s,s*s,s*s*s*s)*a*brightness*fade; \nfade*=distfading; \ns+=stepsize;}\nv=mix(vec3(length(v)),v,saturation); \ngl_FragColor=vec4(v*.01,1.);}");
329
+ var x = (function () { var e; var a, o, s, n, l, d, c, u, m, h, f, p = t.ProceduralTexture, v = []; return e = /** @class */ (function (_super) {
330
+ __extends(e, _super);
331
+ function e(e, t, r, a, o) {
332
+ if (r === void 0) { r = null; }
333
+ var _this = this;
334
+ _this = _super.call(this, e, t, "starfieldProceduralTexture", r, a, o) || this, _this._time = (i(_this, v), 1), _this._alpha = .5, _this._beta = .8, _this._zoom = .8, _this._formuparam = .53, _this._stepsize = .1, _this._tile = .85, _this._brightness = .0015, _this._darkmatter = .4, _this._distfading = .73, _this._saturation = .85, _this.updateShaderUniforms();
335
+ return _this;
336
+ }
337
+ e.prototype.updateShaderUniforms = function () { this.setFloat("time", this._time), this.setFloat("alpha", this._alpha), this.setFloat("beta", this._beta), this.setFloat("zoom", this._zoom), this.setFloat("formuparam", this._formuparam), this.setFloat("stepsize", this._stepsize), this.setFloat("tile", this._tile), this.setFloat("brightness", this._brightness), this.setFloat("darkmatter", this._darkmatter), this.setFloat("distfading", this._distfading), this.setFloat("saturation", this._saturation); };
338
+ Object.defineProperty(e.prototype, "time", {
339
+ get: function () { return this._time; },
340
+ set: function (e) { this._time = e, this.updateShaderUniforms(); },
341
+ enumerable: false,
342
+ configurable: true
343
+ });
344
+ Object.defineProperty(e.prototype, "alpha", {
345
+ get: function () { return this._alpha; },
346
+ set: function (e) { this._alpha = e, this.updateShaderUniforms(); },
347
+ enumerable: false,
348
+ configurable: true
349
+ });
350
+ Object.defineProperty(e.prototype, "beta", {
351
+ get: function () { return this._beta; },
352
+ set: function (e) { this._beta = e, this.updateShaderUniforms(); },
353
+ enumerable: false,
354
+ configurable: true
355
+ });
356
+ Object.defineProperty(e.prototype, "formuparam", {
357
+ get: function () { return this._formuparam; },
358
+ set: function (e) { this._formuparam = e, this.updateShaderUniforms(); },
359
+ enumerable: false,
360
+ configurable: true
361
+ });
362
+ Object.defineProperty(e.prototype, "stepsize", {
363
+ get: function () { return this._stepsize; },
364
+ set: function (e) { this._stepsize = e, this.updateShaderUniforms(); },
365
+ enumerable: false,
366
+ configurable: true
367
+ });
368
+ Object.defineProperty(e.prototype, "zoom", {
369
+ get: function () { return this._zoom; },
370
+ set: function (e) { this._zoom = e, this.updateShaderUniforms(); },
371
+ enumerable: false,
372
+ configurable: true
373
+ });
374
+ Object.defineProperty(e.prototype, "tile", {
375
+ get: function () { return this._tile; },
376
+ set: function (e) { this._tile = e, this.updateShaderUniforms(); },
377
+ enumerable: false,
378
+ configurable: true
379
+ });
380
+ Object.defineProperty(e.prototype, "brightness", {
381
+ get: function () { return this._brightness; },
382
+ set: function (e) { this._brightness = e, this.updateShaderUniforms(); },
383
+ enumerable: false,
384
+ configurable: true
385
+ });
386
+ Object.defineProperty(e.prototype, "darkmatter", {
387
+ get: function () { return this._darkmatter; },
388
+ set: function (e) { this._darkmatter = e, this.updateShaderUniforms(); },
389
+ enumerable: false,
390
+ configurable: true
391
+ });
392
+ Object.defineProperty(e.prototype, "distfading", {
393
+ get: function () { return this._distfading; },
394
+ set: function (e) { this._distfading = e, this.updateShaderUniforms(); },
395
+ enumerable: false,
396
+ configurable: true
397
+ });
398
+ Object.defineProperty(e.prototype, "saturation", {
399
+ get: function () { return this._saturation; },
400
+ set: function (e) { this._saturation = e, this.updateShaderUniforms(); },
401
+ enumerable: false,
402
+ configurable: true
403
+ });
404
+ e.prototype.serialize = function () { var e = t.SerializationHelper.Serialize(this, _super.prototype.serialize.call(this)); return e.customType = "BABYLON.StarfieldProceduralTexture", e; };
405
+ e.Parse = function (r, i, a) { return t.SerializationHelper.Parse(function () { return new e(r.name, r._size, i, void 0, r._generateMipMaps); }, r, i, a); };
406
+ return e;
407
+ }(p)), (function () { var i; var g = "function" == typeof Symbol && Symbol.metadata ? Object.create(null !== (i = p[Symbol.metadata]) && void 0 !== i ? i : null) : void 0; a = [t.serialize()], o = [t.serialize()], s = [t.serialize()], n = [t.serialize()], l = [t.serialize()], d = [t.serialize()], c = [t.serialize()], u = [t.serialize()], m = [t.serialize()], h = [t.serialize()], f = [t.serialize()], r(e, null, a, { kind: "getter", name: "time", static: !1, private: !1, access: { has: function (e) { return "time" in e; }, get: function (e) { return e.time; } }, metadata: g }, null, v), r(e, null, o, { kind: "getter", name: "alpha", static: !1, private: !1, access: { has: function (e) { return "alpha" in e; }, get: function (e) { return e.alpha; } }, metadata: g }, null, v), r(e, null, s, { kind: "getter", name: "beta", static: !1, private: !1, access: { has: function (e) { return "beta" in e; }, get: function (e) { return e.beta; } }, metadata: g }, null, v), r(e, null, n, { kind: "getter", name: "formuparam", static: !1, private: !1, access: { has: function (e) { return "formuparam" in e; }, get: function (e) { return e.formuparam; } }, metadata: g }, null, v), r(e, null, l, { kind: "getter", name: "stepsize", static: !1, private: !1, access: { has: function (e) { return "stepsize" in e; }, get: function (e) { return e.stepsize; } }, metadata: g }, null, v), r(e, null, d, { kind: "getter", name: "zoom", static: !1, private: !1, access: { has: function (e) { return "zoom" in e; }, get: function (e) { return e.zoom; } }, metadata: g }, null, v), r(e, null, c, { kind: "getter", name: "tile", static: !1, private: !1, access: { has: function (e) { return "tile" in e; }, get: function (e) { return e.tile; } }, metadata: g }, null, v), r(e, null, u, { kind: "getter", name: "brightness", static: !1, private: !1, access: { has: function (e) { return "brightness" in e; }, get: function (e) { return e.brightness; } }, metadata: g }, null, v), r(e, null, m, { kind: "getter", name: "darkmatter", static: !1, private: !1, access: { has: function (e) { return "darkmatter" in e; }, get: function (e) { return e.darkmatter; } }, metadata: g }, null, v), r(e, null, h, { kind: "getter", name: "distfading", static: !1, private: !1, access: { has: function (e) { return "distfading" in e; }, get: function (e) { return e.distfading; } }, metadata: g }, null, v), r(e, null, f, { kind: "getter", name: "saturation", static: !1, private: !1, access: { has: function (e) { return "saturation" in e; }, get: function (e) { return e.saturation; } }, metadata: g }, null, v), g && Object.defineProperty(e, Symbol.metadata, { enumerable: !0, configurable: !0, writable: !0, value: g }); })(), e; })();
408
+ t.RegisterClass("BABYLON.StarfieldProceduralTexture", x);
409
+ var _ = "woodProceduralTexturePixelShader";
410
+ t.ShaderStore.ShadersStore[_] || (t.ShaderStore.ShadersStore[_] = "precision highp float;varying vec2 vPosition;varying vec2 vUV;uniform float ampScale;uniform vec3 woodColor;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;}\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\nfloat ratioy=mod(vUV.x*ampScale,2.0+fbm(vUV*0.8));vec3 wood=woodColor*ratioy;gl_FragColor=vec4(wood,1.0);\n#define CUSTOM_FRAGMENT_MAIN_END\n}");
411
+ var y = (function () { var e; var a, o, s = t.ProceduralTexture, n = []; return e = /** @class */ (function (_super) {
412
+ __extends(e, _super);
413
+ function e(e, r, a, o, s) {
414
+ if (a === void 0) { a = null; }
415
+ var _this = this;
416
+ _this = _super.call(this, e, r, "woodProceduralTexture", a, o, s) || this, _this._ampScale = (i(_this, n), 100), _this._woodColor = new t.Color3(.32, .17, .09), _this.updateShaderUniforms();
417
+ return _this;
418
+ }
419
+ e.prototype.updateShaderUniforms = function () { this.setFloat("ampScale", this._ampScale), this.setColor3("woodColor", this._woodColor); };
420
+ Object.defineProperty(e.prototype, "ampScale", {
421
+ get: function () { return this._ampScale; },
422
+ set: function (e) { this._ampScale = e, this.updateShaderUniforms(); },
423
+ enumerable: false,
424
+ configurable: true
425
+ });
426
+ Object.defineProperty(e.prototype, "woodColor", {
427
+ get: function () { return this._woodColor; },
428
+ set: function (e) { this._woodColor = e, this.updateShaderUniforms(); },
429
+ enumerable: false,
430
+ configurable: true
431
+ });
432
+ e.prototype.serialize = function () { var e = t.SerializationHelper.Serialize(this, _super.prototype.serialize.call(this)); return e.customType = "BABYLON.WoodProceduralTexture", e; };
433
+ e.Parse = function (r, i, a) { return t.SerializationHelper.Parse(function () { return new e(r.name, r._size, i, void 0, r._generateMipMaps); }, r, i, a); };
434
+ return e;
435
+ }(s)), (function () { var i; var l = "function" == typeof Symbol && Symbol.metadata ? Object.create(null !== (i = s[Symbol.metadata]) && void 0 !== i ? i : null) : void 0; a = [t.serialize()], o = [t.serializeAsColor3()], r(e, null, a, { kind: "getter", name: "ampScale", static: !1, private: !1, access: { has: function (e) { return "ampScale" in e; }, get: function (e) { return e.ampScale; } }, metadata: l }, null, n), r(e, null, o, { kind: "getter", name: "woodColor", static: !1, private: !1, access: { has: function (e) { return "woodColor" in e; }, get: function (e) { return e.woodColor; } }, metadata: l }, null, n), l && Object.defineProperty(e, Symbol.metadata, { enumerable: !0, configurable: !0, writable: !0, value: l }); })(), e; })();
436
+ t.RegisterClass("BABYLON.WoodProceduralTexture", y);
437
+ var T = { __proto__: null, BrickProceduralTexture: o, CloudProceduralTexture: n, FireProceduralTexture: d, GrassProceduralTexture: u, MarbleProceduralTexture: h, NormalMapProceduralTexture: p, PerlinNoiseProceduralTexture: g, RoadProceduralTexture: S, StarfieldProceduralTexture: x, WoodProceduralTexture: y };
438
+ var z = "undefined" != typeof global ? global : "undefined" != typeof window ? window : void 0;
439
+ if (void 0 !== z) {
440
+ z.BABYLON = z.BABYLON || {};
441
+ for (var e_3 in T)
442
+ z.BABYLON[e_3] = T[e_3];
443
+ }
444
+ e.BrickProceduralTexture = o, e.CloudProceduralTexture = n, e.FireProceduralTexture = d, e.GrassProceduralTexture = u, e.MarbleProceduralTexture = h, e.NormalMapProceduralTexture = p, e.PerlinNoiseProceduralTexture = g, e.RoadProceduralTexture = S, e.StarfieldProceduralTexture = x, e.WoodProceduralTexture = y;
445
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "babylonjs-procedural-textures",
3
- "version": "9.22.2",
3
+ "version": "9.23.0",
4
4
  "main": "babylonjs.proceduralTextures.min.js",
5
5
  "types": "babylonjs.proceduralTextures.module.d.ts",
6
6
  "files": [
@@ -16,7 +16,7 @@
16
16
  "test:escheck": "es-check es6 ./babylonjs.proceduralTextures.js"
17
17
  },
18
18
  "dependencies": {
19
- "babylonjs": "9.22.2"
19
+ "babylonjs": "9.23.0"
20
20
  },
21
21
  "devDependencies": {
22
22
  "@dev/build-tools": "1.0.0",
@@ -32,4 +32,5 @@ export default commonUMDRollupConfiguration({
32
32
  ? `babylonjs.proceduralTextures${production ? ".min" : ""}.js`
33
33
  : `babylon.${pathData.chunk.name}ProceduralTexture${production ? ".min" : ""}.js`,
34
34
  minToMax: true,
35
+ es5EntryPoint: "proceduralTextures",
35
36
  });