@babylonjs/procedural-textures 5.0.0-rc.7 → 5.0.1

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 (108) hide show
  1. package/brick/brickProceduralTexture.d.ts +35 -35
  2. package/brick/brickProceduralTexture.fragment.d.ts +5 -5
  3. package/brick/brickProceduralTexture.fragment.js +8 -8
  4. package/brick/brickProceduralTexture.js +104 -104
  5. package/brick/brickProceduralTexture.js.map +1 -1
  6. package/brick/index.d.ts +1 -1
  7. package/brick/index.js +1 -1
  8. package/cloud/cloudProceduralTexture.d.ts +35 -35
  9. package/cloud/cloudProceduralTexture.fragment.d.ts +5 -5
  10. package/cloud/cloudProceduralTexture.fragment.js +8 -8
  11. package/cloud/cloudProceduralTexture.js +104 -104
  12. package/cloud/cloudProceduralTexture.js.map +1 -1
  13. package/cloud/index.d.ts +1 -1
  14. package/cloud/index.js +1 -1
  15. package/fire/fireProceduralTexture.d.ts +44 -44
  16. package/fire/fireProceduralTexture.fragment.d.ts +5 -5
  17. package/fire/fireProceduralTexture.fragment.js +8 -8
  18. package/fire/fireProceduralTexture.js +166 -166
  19. package/fire/fireProceduralTexture.js.map +1 -1
  20. package/fire/index.d.ts +1 -1
  21. package/fire/index.js +1 -1
  22. package/grass/grassProceduralTexture.d.ts +29 -29
  23. package/grass/grassProceduralTexture.fragment.d.ts +5 -5
  24. package/grass/grassProceduralTexture.fragment.js +8 -8
  25. package/grass/grassProceduralTexture.js +80 -80
  26. package/grass/grassProceduralTexture.js.map +1 -1
  27. package/grass/index.d.ts +1 -1
  28. package/grass/index.js +1 -1
  29. package/index.d.ts +10 -10
  30. package/index.js +11 -10
  31. package/index.js.map +1 -1
  32. package/legacy/legacy-brick.d.ts +1 -1
  33. package/legacy/legacy-brick.js +13 -12
  34. package/legacy/legacy-brick.js.map +1 -1
  35. package/legacy/legacy-cloud.d.ts +1 -1
  36. package/legacy/legacy-cloud.js +13 -12
  37. package/legacy/legacy-cloud.js.map +1 -1
  38. package/legacy/legacy-fire.d.ts +1 -1
  39. package/legacy/legacy-fire.js +13 -12
  40. package/legacy/legacy-fire.js.map +1 -1
  41. package/legacy/legacy-grass.d.ts +1 -1
  42. package/legacy/legacy-grass.js +13 -12
  43. package/legacy/legacy-grass.js.map +1 -1
  44. package/legacy/legacy-marble.d.ts +1 -1
  45. package/legacy/legacy-marble.js +13 -12
  46. package/legacy/legacy-marble.js.map +1 -1
  47. package/legacy/legacy-normalMap.d.ts +1 -1
  48. package/legacy/legacy-normalMap.js +13 -12
  49. package/legacy/legacy-normalMap.js.map +1 -1
  50. package/legacy/legacy-perlinNoise.d.ts +1 -1
  51. package/legacy/legacy-perlinNoise.js +13 -12
  52. package/legacy/legacy-perlinNoise.js.map +1 -1
  53. package/legacy/legacy-road.d.ts +1 -1
  54. package/legacy/legacy-road.js +13 -12
  55. package/legacy/legacy-road.js.map +1 -1
  56. package/legacy/legacy-starfield.d.ts +1 -1
  57. package/legacy/legacy-starfield.js +13 -12
  58. package/legacy/legacy-starfield.js.map +1 -1
  59. package/legacy/legacy-wood.d.ts +1 -1
  60. package/legacy/legacy-wood.js +13 -12
  61. package/legacy/legacy-wood.js.map +1 -1
  62. package/legacy/legacy.d.ts +1 -1
  63. package/legacy/legacy.js +16 -15
  64. package/legacy/legacy.js.map +1 -1
  65. package/license.md +71 -0
  66. package/marble/index.d.ts +1 -1
  67. package/marble/index.js +1 -1
  68. package/marble/marbleProceduralTexture.d.ts +35 -35
  69. package/marble/marbleProceduralTexture.fragment.d.ts +5 -5
  70. package/marble/marbleProceduralTexture.fragment.js +8 -8
  71. package/marble/marbleProceduralTexture.js +104 -104
  72. package/marble/marbleProceduralTexture.js.map +1 -1
  73. package/normalMap/index.d.ts +1 -1
  74. package/normalMap/index.js +1 -1
  75. package/normalMap/normalMapProceduralTexture.d.ts +28 -28
  76. package/normalMap/normalMapProceduralTexture.fragment.d.ts +5 -5
  77. package/normalMap/normalMapProceduralTexture.fragment.js +8 -8
  78. package/normalMap/normalMapProceduralTexture.js +69 -69
  79. package/normalMap/normalMapProceduralTexture.js.map +1 -1
  80. package/package.json +24 -5
  81. package/perlinNoise/index.d.ts +1 -1
  82. package/perlinNoise/index.js +1 -1
  83. package/perlinNoise/perlinNoiseProceduralTexture.d.ts +28 -28
  84. package/perlinNoise/perlinNoiseProceduralTexture.fragment.d.ts +5 -5
  85. package/perlinNoise/perlinNoiseProceduralTexture.fragment.js +8 -8
  86. package/perlinNoise/perlinNoiseProceduralTexture.js +69 -69
  87. package/perlinNoise/perlinNoiseProceduralTexture.js.map +1 -1
  88. package/road/index.d.ts +1 -1
  89. package/road/index.js +1 -1
  90. package/road/roadProceduralTexture.d.ts +26 -26
  91. package/road/roadProceduralTexture.fragment.d.ts +5 -5
  92. package/road/roadProceduralTexture.fragment.js +8 -8
  93. package/road/roadProceduralTexture.js +56 -56
  94. package/road/roadProceduralTexture.js.map +1 -1
  95. package/starfield/index.d.ts +1 -1
  96. package/starfield/index.js +1 -1
  97. package/starfield/starfieldProceduralTexture.d.ts +55 -55
  98. package/starfield/starfieldProceduralTexture.fragment.d.ts +5 -5
  99. package/starfield/starfieldProceduralTexture.fragment.js +8 -8
  100. package/starfield/starfieldProceduralTexture.js +215 -215
  101. package/starfield/starfieldProceduralTexture.js.map +1 -1
  102. package/wood/index.d.ts +1 -1
  103. package/wood/index.js +1 -1
  104. package/wood/woodProceduralTexture.d.ts +29 -29
  105. package/wood/woodProceduralTexture.fragment.d.ts +5 -5
  106. package/wood/woodProceduralTexture.fragment.js +8 -8
  107. package/wood/woodProceduralTexture.js +72 -72
  108. package/wood/woodProceduralTexture.js.map +1 -1
@@ -1,167 +1,167 @@
1
- import { __decorate, __extends } from "tslib";
2
- import { serialize, serializeAsVector2, SerializationHelper } from "@babylonjs/core/Misc/decorators.js";
3
- import { Vector2 } from "@babylonjs/core/Maths/math.vector.js";
4
- import { Color3 } from "@babylonjs/core/Maths/math.color.js";
5
- import { ProceduralTexture } from "@babylonjs/core/Materials/Textures/Procedurals/proceduralTexture.js";
6
- import { RegisterClass } from "@babylonjs/core/Misc/typeStore.js";
7
- import "./fireProceduralTexture.fragment.js";
8
- var FireProceduralTexture = /** @class */ (function (_super) {
9
- __extends(FireProceduralTexture, _super);
10
- function FireProceduralTexture(name, size, scene, fallbackTexture, generateMipMaps) {
11
- if (scene === void 0) { scene = null; }
12
- var _this = _super.call(this, name, size, "fireProceduralTexture", scene, fallbackTexture, generateMipMaps) || this;
13
- _this._time = 0.0;
14
- _this._speed = new Vector2(0.5, 0.3);
15
- _this._autoGenerateTime = true;
16
- _this._alphaThreshold = 0.5;
17
- _this._fireColors = FireProceduralTexture.RedFireColors;
18
- _this.updateShaderUniforms();
19
- return _this;
20
- }
21
- FireProceduralTexture.prototype.updateShaderUniforms = function () {
22
- this.setFloat("time", this._time);
23
- this.setVector2("speed", this._speed);
24
- this.setColor3("c1", this._fireColors[0]);
25
- this.setColor3("c2", this._fireColors[1]);
26
- this.setColor3("c3", this._fireColors[2]);
27
- this.setColor3("c4", this._fireColors[3]);
28
- this.setColor3("c5", this._fireColors[4]);
29
- this.setColor3("c6", this._fireColors[5]);
30
- this.setFloat("alphaThreshold", this._alphaThreshold);
31
- };
32
- FireProceduralTexture.prototype.render = function (useCameraPostProcess) {
33
- var scene = this.getScene();
34
- if (this._autoGenerateTime && scene) {
35
- this._time += scene.getAnimationRatio() * 0.03;
36
- this.updateShaderUniforms();
37
- }
38
- _super.prototype.render.call(this, useCameraPostProcess);
39
- };
40
- Object.defineProperty(FireProceduralTexture, "PurpleFireColors", {
41
- get: function () {
42
- return [new Color3(0.5, 0.0, 1.0), new Color3(0.9, 0.0, 1.0), new Color3(0.2, 0.0, 1.0), new Color3(1.0, 0.9, 1.0), new Color3(0.1, 0.1, 1.0), new Color3(0.9, 0.9, 1.0)];
43
- },
44
- enumerable: false,
45
- configurable: true
46
- });
47
- Object.defineProperty(FireProceduralTexture, "GreenFireColors", {
48
- get: function () {
49
- return [new Color3(0.5, 1.0, 0.0), new Color3(0.5, 1.0, 0.0), new Color3(0.3, 0.4, 0.0), new Color3(0.5, 1.0, 0.0), new Color3(0.2, 0.0, 0.0), new Color3(0.5, 1.0, 0.0)];
50
- },
51
- enumerable: false,
52
- configurable: true
53
- });
54
- Object.defineProperty(FireProceduralTexture, "RedFireColors", {
55
- get: function () {
56
- return [new Color3(0.5, 0.0, 0.1), new Color3(0.9, 0.0, 0.0), new Color3(0.2, 0.0, 0.0), new Color3(1.0, 0.9, 0.0), new Color3(0.1, 0.1, 0.1), new Color3(0.9, 0.9, 0.9)];
57
- },
58
- enumerable: false,
59
- configurable: true
60
- });
61
- Object.defineProperty(FireProceduralTexture, "BlueFireColors", {
62
- get: function () {
63
- return [new Color3(0.1, 0.0, 0.5), new Color3(0.0, 0.0, 0.5), new Color3(0.1, 0.0, 0.2), new Color3(0.0, 0.0, 1.0), new Color3(0.1, 0.2, 0.3), new Color3(0.0, 0.2, 0.9)];
64
- },
65
- enumerable: false,
66
- configurable: true
67
- });
68
- Object.defineProperty(FireProceduralTexture.prototype, "autoGenerateTime", {
69
- get: function () {
70
- return this._autoGenerateTime;
71
- },
72
- set: function (value) {
73
- this._autoGenerateTime = value;
74
- },
75
- enumerable: false,
76
- configurable: true
77
- });
78
- Object.defineProperty(FireProceduralTexture.prototype, "fireColors", {
79
- get: function () {
80
- return this._fireColors;
81
- },
82
- set: function (value) {
83
- this._fireColors = value;
84
- this.updateShaderUniforms();
85
- },
86
- enumerable: false,
87
- configurable: true
88
- });
89
- Object.defineProperty(FireProceduralTexture.prototype, "time", {
90
- get: function () {
91
- return this._time;
92
- },
93
- set: function (value) {
94
- this._time = value;
95
- this.updateShaderUniforms();
96
- },
97
- enumerable: false,
98
- configurable: true
99
- });
100
- Object.defineProperty(FireProceduralTexture.prototype, "speed", {
101
- get: function () {
102
- return this._speed;
103
- },
104
- set: function (value) {
105
- this._speed = value;
106
- this.updateShaderUniforms();
107
- },
108
- enumerable: false,
109
- configurable: true
110
- });
111
- Object.defineProperty(FireProceduralTexture.prototype, "alphaThreshold", {
112
- get: function () {
113
- return this._alphaThreshold;
114
- },
115
- set: function (value) {
116
- this._alphaThreshold = value;
117
- this.updateShaderUniforms();
118
- },
119
- enumerable: false,
120
- configurable: true
121
- });
122
- /**
123
- * Serializes this fire procedural texture
124
- * @returns a serialized fire procedural texture object
125
- */
126
- FireProceduralTexture.prototype.serialize = function () {
127
- var serializationObject = SerializationHelper.Serialize(this, _super.prototype.serialize.call(this));
128
- serializationObject.customType = "BABYLON.FireProceduralTexture";
129
- serializationObject.fireColors = [];
130
- for (var i = 0; i < this._fireColors.length; i++) {
131
- serializationObject.fireColors.push(this._fireColors[i].asArray());
132
- }
133
- return serializationObject;
134
- };
135
- /**
136
- * Creates a Fire Procedural Texture from parsed fire procedural texture data
137
- * @param parsedTexture defines parsed texture data
138
- * @param scene defines the current scene
139
- * @param rootUrl defines the root URL containing fire procedural texture information
140
- * @returns a parsed Fire Procedural Texture
141
- */
142
- FireProceduralTexture.Parse = function (parsedTexture, scene, rootUrl) {
143
- var texture = SerializationHelper.Parse(function () { return new FireProceduralTexture(parsedTexture.name, parsedTexture._size, scene, undefined, parsedTexture._generateMipMaps); }, parsedTexture, scene, rootUrl);
144
- var colors = [];
145
- for (var i = 0; i < parsedTexture.fireColors.length; i++) {
146
- colors.push(Color3.FromArray(parsedTexture.fireColors[i]));
147
- }
148
- texture.fireColors = colors;
149
- return texture;
150
- };
151
- __decorate([
152
- serialize()
153
- ], FireProceduralTexture.prototype, "autoGenerateTime", null);
154
- __decorate([
155
- serialize()
156
- ], FireProceduralTexture.prototype, "time", null);
157
- __decorate([
158
- serializeAsVector2()
159
- ], FireProceduralTexture.prototype, "speed", null);
160
- __decorate([
161
- serialize()
162
- ], FireProceduralTexture.prototype, "alphaThreshold", null);
163
- return FireProceduralTexture;
164
- }(ProceduralTexture));
165
- export { FireProceduralTexture };
166
- RegisterClass("BABYLON.FireProceduralTexture", FireProceduralTexture);
1
+ import { __decorate, __extends } from "tslib";
2
+ import { serialize, serializeAsVector2, SerializationHelper } from "@babylonjs/core/Misc/decorators.js";
3
+ import { Vector2 } from "@babylonjs/core/Maths/math.vector.js";
4
+ import { Color3 } from "@babylonjs/core/Maths/math.color.js";
5
+ import { ProceduralTexture } from "@babylonjs/core/Materials/Textures/Procedurals/proceduralTexture.js";
6
+ import { RegisterClass } from "@babylonjs/core/Misc/typeStore.js";
7
+ import "./fireProceduralTexture.fragment.js";
8
+ var FireProceduralTexture = /** @class */ (function (_super) {
9
+ __extends(FireProceduralTexture, _super);
10
+ function FireProceduralTexture(name, size, scene, fallbackTexture, generateMipMaps) {
11
+ if (scene === void 0) { scene = null; }
12
+ var _this = _super.call(this, name, size, "fireProceduralTexture", scene, fallbackTexture, generateMipMaps) || this;
13
+ _this._time = 0.0;
14
+ _this._speed = new Vector2(0.5, 0.3);
15
+ _this._autoGenerateTime = true;
16
+ _this._alphaThreshold = 0.5;
17
+ _this._fireColors = FireProceduralTexture.RedFireColors;
18
+ _this.updateShaderUniforms();
19
+ return _this;
20
+ }
21
+ FireProceduralTexture.prototype.updateShaderUniforms = function () {
22
+ this.setFloat("time", this._time);
23
+ this.setVector2("speed", this._speed);
24
+ this.setColor3("c1", this._fireColors[0]);
25
+ this.setColor3("c2", this._fireColors[1]);
26
+ this.setColor3("c3", this._fireColors[2]);
27
+ this.setColor3("c4", this._fireColors[3]);
28
+ this.setColor3("c5", this._fireColors[4]);
29
+ this.setColor3("c6", this._fireColors[5]);
30
+ this.setFloat("alphaThreshold", this._alphaThreshold);
31
+ };
32
+ FireProceduralTexture.prototype.render = function (useCameraPostProcess) {
33
+ var scene = this.getScene();
34
+ if (this._autoGenerateTime && scene) {
35
+ this._time += scene.getAnimationRatio() * 0.03;
36
+ this.updateShaderUniforms();
37
+ }
38
+ _super.prototype.render.call(this, useCameraPostProcess);
39
+ };
40
+ Object.defineProperty(FireProceduralTexture, "PurpleFireColors", {
41
+ get: function () {
42
+ return [new Color3(0.5, 0.0, 1.0), new Color3(0.9, 0.0, 1.0), new Color3(0.2, 0.0, 1.0), new Color3(1.0, 0.9, 1.0), new Color3(0.1, 0.1, 1.0), new Color3(0.9, 0.9, 1.0)];
43
+ },
44
+ enumerable: false,
45
+ configurable: true
46
+ });
47
+ Object.defineProperty(FireProceduralTexture, "GreenFireColors", {
48
+ get: function () {
49
+ return [new Color3(0.5, 1.0, 0.0), new Color3(0.5, 1.0, 0.0), new Color3(0.3, 0.4, 0.0), new Color3(0.5, 1.0, 0.0), new Color3(0.2, 0.0, 0.0), new Color3(0.5, 1.0, 0.0)];
50
+ },
51
+ enumerable: false,
52
+ configurable: true
53
+ });
54
+ Object.defineProperty(FireProceduralTexture, "RedFireColors", {
55
+ get: function () {
56
+ return [new Color3(0.5, 0.0, 0.1), new Color3(0.9, 0.0, 0.0), new Color3(0.2, 0.0, 0.0), new Color3(1.0, 0.9, 0.0), new Color3(0.1, 0.1, 0.1), new Color3(0.9, 0.9, 0.9)];
57
+ },
58
+ enumerable: false,
59
+ configurable: true
60
+ });
61
+ Object.defineProperty(FireProceduralTexture, "BlueFireColors", {
62
+ get: function () {
63
+ return [new Color3(0.1, 0.0, 0.5), new Color3(0.0, 0.0, 0.5), new Color3(0.1, 0.0, 0.2), new Color3(0.0, 0.0, 1.0), new Color3(0.1, 0.2, 0.3), new Color3(0.0, 0.2, 0.9)];
64
+ },
65
+ enumerable: false,
66
+ configurable: true
67
+ });
68
+ Object.defineProperty(FireProceduralTexture.prototype, "autoGenerateTime", {
69
+ get: function () {
70
+ return this._autoGenerateTime;
71
+ },
72
+ set: function (value) {
73
+ this._autoGenerateTime = value;
74
+ },
75
+ enumerable: false,
76
+ configurable: true
77
+ });
78
+ Object.defineProperty(FireProceduralTexture.prototype, "fireColors", {
79
+ get: function () {
80
+ return this._fireColors;
81
+ },
82
+ set: function (value) {
83
+ this._fireColors = value;
84
+ this.updateShaderUniforms();
85
+ },
86
+ enumerable: false,
87
+ configurable: true
88
+ });
89
+ Object.defineProperty(FireProceduralTexture.prototype, "time", {
90
+ get: function () {
91
+ return this._time;
92
+ },
93
+ set: function (value) {
94
+ this._time = value;
95
+ this.updateShaderUniforms();
96
+ },
97
+ enumerable: false,
98
+ configurable: true
99
+ });
100
+ Object.defineProperty(FireProceduralTexture.prototype, "speed", {
101
+ get: function () {
102
+ return this._speed;
103
+ },
104
+ set: function (value) {
105
+ this._speed = value;
106
+ this.updateShaderUniforms();
107
+ },
108
+ enumerable: false,
109
+ configurable: true
110
+ });
111
+ Object.defineProperty(FireProceduralTexture.prototype, "alphaThreshold", {
112
+ get: function () {
113
+ return this._alphaThreshold;
114
+ },
115
+ set: function (value) {
116
+ this._alphaThreshold = value;
117
+ this.updateShaderUniforms();
118
+ },
119
+ enumerable: false,
120
+ configurable: true
121
+ });
122
+ /**
123
+ * Serializes this fire procedural texture
124
+ * @returns a serialized fire procedural texture object
125
+ */
126
+ FireProceduralTexture.prototype.serialize = function () {
127
+ var serializationObject = SerializationHelper.Serialize(this, _super.prototype.serialize.call(this));
128
+ serializationObject.customType = "BABYLON.FireProceduralTexture";
129
+ serializationObject.fireColors = [];
130
+ for (var i = 0; i < this._fireColors.length; i++) {
131
+ serializationObject.fireColors.push(this._fireColors[i].asArray());
132
+ }
133
+ return serializationObject;
134
+ };
135
+ /**
136
+ * Creates a Fire Procedural Texture from parsed fire procedural texture data
137
+ * @param parsedTexture defines parsed texture data
138
+ * @param scene defines the current scene
139
+ * @param rootUrl defines the root URL containing fire procedural texture information
140
+ * @returns a parsed Fire Procedural Texture
141
+ */
142
+ FireProceduralTexture.Parse = function (parsedTexture, scene, rootUrl) {
143
+ var texture = SerializationHelper.Parse(function () { return new FireProceduralTexture(parsedTexture.name, parsedTexture._size, scene, undefined, parsedTexture._generateMipMaps); }, parsedTexture, scene, rootUrl);
144
+ var colors = [];
145
+ for (var i = 0; i < parsedTexture.fireColors.length; i++) {
146
+ colors.push(Color3.FromArray(parsedTexture.fireColors[i]));
147
+ }
148
+ texture.fireColors = colors;
149
+ return texture;
150
+ };
151
+ __decorate([
152
+ serialize()
153
+ ], FireProceduralTexture.prototype, "autoGenerateTime", null);
154
+ __decorate([
155
+ serialize()
156
+ ], FireProceduralTexture.prototype, "time", null);
157
+ __decorate([
158
+ serializeAsVector2()
159
+ ], FireProceduralTexture.prototype, "speed", null);
160
+ __decorate([
161
+ serialize()
162
+ ], FireProceduralTexture.prototype, "alphaThreshold", null);
163
+ return FireProceduralTexture;
164
+ }(ProceduralTexture));
165
+ export { FireProceduralTexture };
166
+ RegisterClass("BABYLON.FireProceduralTexture", FireProceduralTexture);
167
167
  //# sourceMappingURL=fireProceduralTexture.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fireProceduralTexture.js","sourceRoot":"","sources":["../../../../../lts/proceduralTextures/generated/fire/fireProceduralTexture.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,2CAA6B;AAC1F,OAAO,EAAE,OAAO,EAAE,6CAA+B;AACjD,OAAO,EAAE,MAAM,EAAE,4CAA8B;AAE/C,OAAO,EAAE,iBAAiB,EAAE,4EAA8D;AAE1F,OAAO,EAAE,aAAa,EAAE,0CAA4B;AAGpD,OAAO,kCAAkC,CAAC;AAE1C;IAA2C,yCAAiB;IAOxD,+BAAY,IAAY,EAAE,IAAY,EAAE,KAA6B,EAAE,eAAyB,EAAE,eAAyB;QAAnF,sBAAA,EAAA,YAA6B;QAArE,YACI,kBAAM,IAAI,EAAE,IAAI,EAAE,uBAAuB,EAAE,KAAK,EAAE,eAAe,EAAE,eAAe,CAAC,SAGtF;QAVO,WAAK,GAAW,GAAG,CAAC;QACpB,YAAM,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;QAC/B,uBAAiB,GAAY,IAAI,CAAC;QAElC,qBAAe,GAAW,GAAG,CAAC;QAIlC,KAAI,CAAC,WAAW,GAAG,qBAAqB,CAAC,aAAa,CAAC;QACvD,KAAI,CAAC,oBA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,OAAO,OAAO,CAAC;IACnB,CAAC;IAtFD;QADC,SAAS,EAAE;iEAGX;IAgBD;QADC,SAAS,EAAE;qDAGX;IAQD;QADC,kBAAkB,EAAE;sDAGpB;IAQD;QADC,SAAS,EAAE;+DAGX;IA+CL,4BAAC;CAAA,AA1ID,CAA2C,iBAAiB,GA0I3D;SA1IY,qBAAqB;AA4IlC,aAAa,CAAC,+BAA+B,EAAE,qBAAqB,CAAC,CAAC","sourcesContent":["import { serialize, serializeAsVector2, SerializationHelper } from \"core/Misc/decorators\";\r\nimport { Vector2 } from \"core/Maths/math.vector\";\r\nimport { Color3 } from \"core/Maths/math.color\";\r\nimport { Texture } from \"core/Materials/Textures/texture\";\r\nimport { ProceduralTexture } from \"core/Materials/Textures/Procedurals/proceduralTexture\";\r\nimport { Scene } from \"core/scene\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport { Nullable } from \"core/types\";\r\n\r\nimport \"./fireProceduralTexture.fragment\";\r\n\r\nexport class FireProceduralTexture extends ProceduralTexture {\r\n private _time: number = 0.0;\r\n private _speed = new Vector2(0.5, 0.3);\r\n private _autoGenerateTime: boolean = true;\r\n private _fireColors: Color3[];\r\n private _alphaThreshold: number = 0.5;\r\n\r\n constructor(name: string, size: number, scene: Nullable<Scene> = null, fallbackTexture?: Texture, generateMipMaps?: boolean) {\r\n super(name, size, \"fireProceduralTexture\", scene, fallbackTexture, generateMipMaps);\r\n this._fireColors = FireProceduralTexture.RedFireColors;\r\n this.updateShaderUniforms();\r\n }\r\n\r\n public updateShaderUniforms() {\r\n this.setFloat(\"time\", this._time);\r\n this.setVector2(\"speed\", this._speed);\r\n this.setColor3(\"c1\", this._fireColors[0]);\r\n this.setColor3(\"c2\", this._fireColors[1]);\r\n this.setColor3(\"c3\", this._fireColors[2]);\r\n this.setColor3(\"c4\", this._fireColors[3]);\r\n this.setColor3(\"c5\", this._fireColors[4]);\r\n this.setColor3(\"c6\", this._fireColors[5]);\r\n this.setFloat(\"alphaThreshold\", this._alphaThreshold);\r\n }\r\n\r\n public render(useCameraPostProcess?: boolean) {\r\n const scene = this.getScene();\r\n if (this._autoGenerateTime && scene) {\r\n this._time += scene.getAnimationRatio() * 0.03;\r\n this.updateShaderUniforms();\r\n }\r\n super.render(useCameraPostProcess);\r\n }\r\n\r\n public static get PurpleFireColors(): Color3[] {\r\n return [new Color3(0.5, 0.0, 1.0), new Color3(0.9, 0.0, 1.0), new Color3(0.2, 0.0, 1.0), new Color3(1.0, 0.9, 1.0), new Color3(0.1, 0.1, 1.0), new Color3(0.9, 0.9, 1.0)];\r\n }\r\n\r\n public static get GreenFireColors(): Color3[] {\r\n return [new Color3(0.5, 1.0, 0.0), new Color3(0.5, 1.0, 0.0), new Color3(0.3, 0.4, 0.0), new Color3(0.5, 1.0, 0.0), new Color3(0.2, 0.0, 0.0), new Color3(0.5, 1.0, 0.0)];\r\n }\r\n\r\n public static get RedFireColors(): Color3[] {\r\n return [new Color3(0.5, 0.0, 0.1), new Color3(0.9, 0.0, 0.0), new Color3(0.2, 0.0, 0.0), new Color3(1.0, 0.9, 0.0), new Color3(0.1, 0.1, 0.1), new Color3(0.9, 0.9, 0.9)];\r\n }\r\n\r\n public static get BlueFireColors(): Color3[] {\r\n return [new Color3(0.1, 0.0, 0.5), new Color3(0.0, 0.0, 0.5), new Color3(0.1, 0.0, 0.2), new Color3(0.0, 0.0, 1.0), new Color3(0.1, 0.2, 0.3), new Color3(0.0, 0.2, 0.9)];\r\n }\r\n\r\n @serialize()\r\n public get autoGenerateTime(): boolean {\r\n return this._autoGenerateTime;\r\n }\r\n\r\n public set autoGenerateTime(value: boolean) {\r\n this._autoGenerateTime = value;\r\n }\r\n\r\n public get fireColors(): Color3[] {\r\n return this._fireColors;\r\n }\r\n\r\n public set fireColors(value: Color3[]) {\r\n this._fireColors = value;\r\n this.updateShaderUniforms();\r\n }\r\n\r\n @serialize()\r\n public get time(): number {\r\n return this._time;\r\n }\r\n\r\n public set time(value: number) {\r\n this._time = value;\r\n this.updateShaderUniforms();\r\n }\r\n\r\n @serializeAsVector2()\r\n public get speed(): Vector2 {\r\n return this._speed;\r\n }\r\n\r\n public set speed(value: Vector2) {\r\n this._speed = value;\r\n this.updateShaderUniforms();\r\n }\r\n\r\n @serialize()\r\n public get alphaThreshold(): number {\r\n return this._alphaThreshold;\r\n }\r\n\r\n public set alphaThreshold(value: number) {\r\n this._alphaThreshold = value;\r\n this.updateShaderUniforms();\r\n }\r\n\r\n /**\r\n * Serializes this fire procedural texture\r\n * @returns a serialized fire procedural texture object\r\n */\r\n public serialize(): any {\r\n const serializationObject = SerializationHelper.Serialize(this, super.serialize());\r\n serializationObject.customType = \"BABYLON.FireProceduralTexture\";\r\n\r\n serializationObject.fireColors = [];\r\n for (let i = 0; i < this._fireColors.length; i++) {\r\n serializationObject.fireColors.push(this._fireColors[i].asArray());\r\n }\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Creates a Fire Procedural Texture from parsed fire 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 fire procedural texture information\r\n * @returns a parsed Fire Procedural Texture\r\n */\r\n public static Parse(parsedTexture: any, scene: Scene, rootUrl: string): FireProceduralTexture {\r\n const texture = SerializationHelper.Parse(\r\n () => new FireProceduralTexture(parsedTexture.name, parsedTexture._size, scene, undefined, parsedTexture._generateMipMaps),\r\n parsedTexture,\r\n scene,\r\n rootUrl\r\n );\r\n\r\n const colors: Color3[] = [];\r\n for (let i = 0; i < parsedTexture.fireColors.length; i++) {\r\n colors.push(Color3.FromArray(parsedTexture.fireColors[i]));\r\n }\r\n\r\n texture.fireColors = colors;\r\n\r\n return texture;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.FireProceduralTexture\", FireProceduralTexture);\r\n"]}
1
+ {"version":3,"file":"fireProceduralTexture.js","sourceRoot":"","sources":["../../../../../lts/proceduralTextures/generated/fire/fireProceduralTexture.ts"],"names":[],"mappings":";AAAA,OA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CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;SACtE;QAED,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAED;;;;;;OAMG;IACW,2BAAK,GAAnB,UAAoB,aAAkB,EAAE,KAAY,EAAE,OAAe;QACjE,IAAM,OAAO,GAAG,mBAAmB,CAAC,KAAK,CACrC,cAAM,OAAA,IAAI,qBAAqB,CAAC,aAAa,CAAC,IAAI,EAAE,aAAa,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,aAAa,CAAC,gBAAgB,CAAC,EAApH,CAAoH,EAC1H,aAAa,EACb,KAAK,EACL,OAAO,CACV,CAAC;QAEF,IAAM,MAAM,GAAa,EAAE,CAAC;QAC5B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,aAAa,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACtD,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;SAC9D;QAED,OAAO,CAAC,UAAU,GAAG,MAAM,CAAC;QAE5B,OAAO,OAAO,CAAC;IACnB,CAAC;IAtFD;QADC,SAAS,EAAE;iEAGX;IAgBD;QADC,SAAS,EAAE;qDAGX;IAQD;QADC,kBAAkB,EAAE;sDAGpB;IAQD;QADC,SAAS,EAAE;+DAGX;IA+CL,4BAAC;CAAA,AA1ID,CAA2C,iBAAiB,GA0I3D;SA1IY,qBAAqB;AA4IlC,aAAa,CAAC,+BAA+B,EAAE,qBAAqB,CAAC,CAAC","sourcesContent":["import { serialize, serializeAsVector2, SerializationHelper } from \"core/Misc/decorators\";\r\nimport { Vector2 } from \"core/Maths/math.vector\";\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 \"./fireProceduralTexture.fragment\";\r\n\r\nexport class FireProceduralTexture extends ProceduralTexture {\r\n private _time: number = 0.0;\r\n private _speed = new Vector2(0.5, 0.3);\r\n private _autoGenerateTime: boolean = true;\r\n private _fireColors: Color3[];\r\n private _alphaThreshold: number = 0.5;\r\n\r\n constructor(name: string, size: number, scene: Nullable<Scene> = null, fallbackTexture?: Texture, generateMipMaps?: boolean) {\r\n super(name, size, \"fireProceduralTexture\", scene, fallbackTexture, generateMipMaps);\r\n this._fireColors = FireProceduralTexture.RedFireColors;\r\n this.updateShaderUniforms();\r\n }\r\n\r\n public updateShaderUniforms() {\r\n this.setFloat(\"time\", this._time);\r\n this.setVector2(\"speed\", this._speed);\r\n this.setColor3(\"c1\", this._fireColors[0]);\r\n this.setColor3(\"c2\", this._fireColors[1]);\r\n this.setColor3(\"c3\", this._fireColors[2]);\r\n this.setColor3(\"c4\", this._fireColors[3]);\r\n this.setColor3(\"c5\", this._fireColors[4]);\r\n this.setColor3(\"c6\", this._fireColors[5]);\r\n this.setFloat(\"alphaThreshold\", this._alphaThreshold);\r\n }\r\n\r\n public render(useCameraPostProcess?: boolean) {\r\n const scene = this.getScene();\r\n if (this._autoGenerateTime && scene) {\r\n this._time += scene.getAnimationRatio() * 0.03;\r\n this.updateShaderUniforms();\r\n }\r\n super.render(useCameraPostProcess);\r\n }\r\n\r\n public static get PurpleFireColors(): Color3[] {\r\n return [new Color3(0.5, 0.0, 1.0), new Color3(0.9, 0.0, 1.0), new Color3(0.2, 0.0, 1.0), new Color3(1.0, 0.9, 1.0), new Color3(0.1, 0.1, 1.0), new Color3(0.9, 0.9, 1.0)];\r\n }\r\n\r\n public static get GreenFireColors(): Color3[] {\r\n return [new Color3(0.5, 1.0, 0.0), new Color3(0.5, 1.0, 0.0), new Color3(0.3, 0.4, 0.0), new Color3(0.5, 1.0, 0.0), new Color3(0.2, 0.0, 0.0), new Color3(0.5, 1.0, 0.0)];\r\n }\r\n\r\n public static get RedFireColors(): Color3[] {\r\n return [new Color3(0.5, 0.0, 0.1), new Color3(0.9, 0.0, 0.0), new Color3(0.2, 0.0, 0.0), new Color3(1.0, 0.9, 0.0), new Color3(0.1, 0.1, 0.1), new Color3(0.9, 0.9, 0.9)];\r\n }\r\n\r\n public static get BlueFireColors(): Color3[] {\r\n return [new Color3(0.1, 0.0, 0.5), new Color3(0.0, 0.0, 0.5), new Color3(0.1, 0.0, 0.2), new Color3(0.0, 0.0, 1.0), new Color3(0.1, 0.2, 0.3), new Color3(0.0, 0.2, 0.9)];\r\n }\r\n\r\n @serialize()\r\n public get autoGenerateTime(): boolean {\r\n return this._autoGenerateTime;\r\n }\r\n\r\n public set autoGenerateTime(value: boolean) {\r\n this._autoGenerateTime = value;\r\n }\r\n\r\n public get fireColors(): Color3[] {\r\n return this._fireColors;\r\n }\r\n\r\n public set fireColors(value: Color3[]) {\r\n this._fireColors = value;\r\n this.updateShaderUniforms();\r\n }\r\n\r\n @serialize()\r\n public get time(): number {\r\n return this._time;\r\n }\r\n\r\n public set time(value: number) {\r\n this._time = value;\r\n this.updateShaderUniforms();\r\n }\r\n\r\n @serializeAsVector2()\r\n public get speed(): Vector2 {\r\n return this._speed;\r\n }\r\n\r\n public set speed(value: Vector2) {\r\n this._speed = value;\r\n this.updateShaderUniforms();\r\n }\r\n\r\n @serialize()\r\n public get alphaThreshold(): number {\r\n return this._alphaThreshold;\r\n }\r\n\r\n public set alphaThreshold(value: number) {\r\n this._alphaThreshold = value;\r\n this.updateShaderUniforms();\r\n }\r\n\r\n /**\r\n * Serializes this fire procedural texture\r\n * @returns a serialized fire procedural texture object\r\n */\r\n public serialize(): any {\r\n const serializationObject = SerializationHelper.Serialize(this, super.serialize());\r\n serializationObject.customType = \"BABYLON.FireProceduralTexture\";\r\n\r\n serializationObject.fireColors = [];\r\n for (let i = 0; i < this._fireColors.length; i++) {\r\n serializationObject.fireColors.push(this._fireColors[i].asArray());\r\n }\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Creates a Fire Procedural Texture from parsed fire 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 fire procedural texture information\r\n * @returns a parsed Fire Procedural Texture\r\n */\r\n public static Parse(parsedTexture: any, scene: Scene, rootUrl: string): FireProceduralTexture {\r\n const texture = SerializationHelper.Parse(\r\n () => new FireProceduralTexture(parsedTexture.name, parsedTexture._size, scene, undefined, parsedTexture._generateMipMaps),\r\n parsedTexture,\r\n scene,\r\n rootUrl\r\n );\r\n\r\n const colors: Color3[] = [];\r\n for (let i = 0; i < parsedTexture.fireColors.length; i++) {\r\n colors.push(Color3.FromArray(parsedTexture.fireColors[i]));\r\n }\r\n\r\n texture.fireColors = colors;\r\n\r\n return texture;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.FireProceduralTexture\", FireProceduralTexture);\r\n"]}
package/fire/index.d.ts CHANGED
@@ -1 +1 @@
1
- export * from "./fireProceduralTexture";
1
+ export * from "./fireProceduralTexture";
package/fire/index.js CHANGED
@@ -1,2 +1,2 @@
1
- export * from "./fireProceduralTexture.js";
1
+ export * from "./fireProceduralTexture.js";
2
2
  //# sourceMappingURL=index.js.map
@@ -1,29 +1,29 @@
1
- import { Color3 } from "@babylonjs/core/Maths/math.color.js";
2
- import { Texture } from "@babylonjs/core/Materials/Textures/texture.js";
3
- import { ProceduralTexture } from "@babylonjs/core/Materials/Textures/Procedurals/proceduralTexture.js";
4
- import { Scene } from "@babylonjs/core/scene.js";
5
- import { Nullable } from "@babylonjs/core/types.js";
6
- import "./grassProceduralTexture.fragment";
7
- export declare class GrassProceduralTexture extends ProceduralTexture {
8
- private _grassColors;
9
- private _groundColor;
10
- constructor(name: string, size: number, scene?: Nullable<Scene>, fallbackTexture?: Texture, generateMipMaps?: boolean);
11
- updateShaderUniforms(): void;
12
- get grassColors(): Color3[];
13
- set grassColors(value: Color3[]);
14
- get groundColor(): Color3;
15
- set groundColor(value: Color3);
16
- /**
17
- * Serializes this grass procedural texture
18
- * @returns a serialized grass procedural texture object
19
- */
20
- serialize(): any;
21
- /**
22
- * Creates a Grass Procedural Texture from parsed grass procedural texture data
23
- * @param parsedTexture defines parsed texture data
24
- * @param scene defines the current scene
25
- * @param rootUrl defines the root URL containing grass procedural texture information
26
- * @returns a parsed Grass Procedural Texture
27
- */
28
- static Parse(parsedTexture: any, scene: Scene, rootUrl: string): GrassProceduralTexture;
29
- }
1
+ import { Color3 } from "@babylonjs/core/Maths/math.color.js";
2
+ import type { Texture } from "@babylonjs/core/Materials/Textures/texture.js";
3
+ import { ProceduralTexture } from "@babylonjs/core/Materials/Textures/Procedurals/proceduralTexture.js";
4
+ import type { Scene } from "@babylonjs/core/scene.js";
5
+ import type { Nullable } from "@babylonjs/core/types.js";
6
+ import "./grassProceduralTexture.fragment";
7
+ export declare class GrassProceduralTexture extends ProceduralTexture {
8
+ private _grassColors;
9
+ private _groundColor;
10
+ constructor(name: string, size: number, scene?: Nullable<Scene>, fallbackTexture?: Texture, generateMipMaps?: boolean);
11
+ updateShaderUniforms(): void;
12
+ get grassColors(): Color3[];
13
+ set grassColors(value: Color3[]);
14
+ get groundColor(): Color3;
15
+ set groundColor(value: Color3);
16
+ /**
17
+ * Serializes this grass procedural texture
18
+ * @returns a serialized grass procedural texture object
19
+ */
20
+ serialize(): any;
21
+ /**
22
+ * Creates a Grass Procedural Texture from parsed grass procedural texture data
23
+ * @param parsedTexture defines parsed texture data
24
+ * @param scene defines the current scene
25
+ * @param rootUrl defines the root URL containing grass procedural texture information
26
+ * @returns a parsed Grass Procedural Texture
27
+ */
28
+ static Parse(parsedTexture: any, scene: Scene, rootUrl: string): GrassProceduralTexture;
29
+ }
@@ -1,5 +1,5 @@
1
- /** @hidden */
2
- export declare const grassProceduralTexturePixelShader: {
3
- name: string;
4
- shader: string;
5
- };
1
+ /** @hidden */
2
+ export declare const grassProceduralTexturePixelShader: {
3
+ name: string;
4
+ shader: string;
5
+ };
@@ -1,9 +1,9 @@
1
- // Do not edit.
2
- import { ShaderStore } from "@babylonjs/core/Engines/shaderStore.js";
3
- var name = "grassProceduralTexturePixelShader";
4
- var shader = "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}";
5
- // Sideeffect
6
- ShaderStore.ShadersStore[name] = shader;
7
- /** @hidden */
8
- export var grassProceduralTexturePixelShader = { name: name, shader: shader };
1
+ // Do not edit.
2
+ import { ShaderStore } from "@babylonjs/core/Engines/shaderStore.js";
3
+ var name = "grassProceduralTexturePixelShader";
4
+ var shader = "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}";
5
+ // Sideeffect
6
+ ShaderStore.ShadersStore[name] = shader;
7
+ /** @hidden */
8
+ export var grassProceduralTexturePixelShader = { name: name, shader: shader };
9
9
  //# sourceMappingURL=grassProceduralTexture.fragment.js.map