@babylonjs/procedural-textures 5.20.0 → 5.22.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.
- package/brick/brickProceduralTexture.fragment.js +16 -3
- package/brick/brickProceduralTexture.fragment.js.map +1 -1
- package/brick/brickProceduralTexture.js +58 -79
- package/brick/brickProceduralTexture.js.map +1 -1
- package/cloud/cloudProceduralTexture.fragment.js +14 -3
- package/cloud/cloudProceduralTexture.fragment.js.map +1 -1
- package/cloud/cloudProceduralTexture.js +58 -79
- package/cloud/cloudProceduralTexture.js.map +1 -1
- package/fire/fireProceduralTexture.fragment.js +7 -3
- package/fire/fireProceduralTexture.fragment.js.map +1 -1
- package/fire/fireProceduralTexture.js +85 -126
- package/fire/fireProceduralTexture.js.map +1 -1
- package/grass/grassProceduralTexture.fragment.js +12 -3
- package/grass/grassProceduralTexture.fragment.js.map +1 -1
- package/grass/grassProceduralTexture.js +36 -49
- package/grass/grassProceduralTexture.js.map +1 -1
- package/legacy/legacy-brick.js +2 -2
- package/legacy/legacy-brick.js.map +1 -1
- package/legacy/legacy-cloud.js +2 -2
- package/legacy/legacy-cloud.js.map +1 -1
- package/legacy/legacy-fire.js +2 -2
- package/legacy/legacy-fire.js.map +1 -1
- package/legacy/legacy-grass.js +2 -2
- package/legacy/legacy-grass.js.map +1 -1
- package/legacy/legacy-marble.js +2 -2
- package/legacy/legacy-marble.js.map +1 -1
- package/legacy/legacy-normalMap.js +2 -2
- package/legacy/legacy-normalMap.js.map +1 -1
- package/legacy/legacy-perlinNoise.js +2 -2
- package/legacy/legacy-perlinNoise.js.map +1 -1
- package/legacy/legacy-road.js +2 -2
- package/legacy/legacy-road.js.map +1 -1
- package/legacy/legacy-starfield.js +2 -2
- package/legacy/legacy-starfield.js.map +1 -1
- package/legacy/legacy-wood.js +2 -2
- package/legacy/legacy-wood.js.map +1 -1
- package/legacy/legacy.js +2 -2
- package/legacy/legacy.js.map +1 -1
- package/marble/marbleProceduralTexture.fragment.js +3 -3
- package/marble/marbleProceduralTexture.fragment.js.map +1 -1
- package/marble/marbleProceduralTexture.js +58 -79
- package/marble/marbleProceduralTexture.js.map +1 -1
- package/normalMap/normalMapProceduralTexture.fragment.js +7 -3
- package/normalMap/normalMapProceduralTexture.fragment.js.map +1 -1
- package/normalMap/normalMapProceduralTexture.js +33 -42
- package/normalMap/normalMapProceduralTexture.js.map +1 -1
- package/package.json +3 -6
- package/perlinNoise/perlinNoiseProceduralTexture.fragment.js +41 -3
- package/perlinNoise/perlinNoiseProceduralTexture.fragment.js.map +1 -1
- package/perlinNoise/perlinNoiseProceduralTexture.js +35 -40
- package/perlinNoise/perlinNoiseProceduralTexture.js.map +1 -1
- package/road/roadProceduralTexture.fragment.js +13 -3
- package/road/roadProceduralTexture.fragment.js.map +1 -1
- package/road/roadProceduralTexture.js +25 -34
- package/road/roadProceduralTexture.js.map +1 -1
- package/starfield/starfieldProceduralTexture.fragment.js +18 -3
- package/starfield/starfieldProceduralTexture.fragment.js.map +1 -1
- package/starfield/starfieldProceduralTexture.js +136 -185
- package/starfield/starfieldProceduralTexture.js.map +1 -1
- package/wood/woodProceduralTexture.fragment.js +12 -3
- package/wood/woodProceduralTexture.fragment.js.map +1 -1
- package/wood/woodProceduralTexture.js +36 -49
- package/wood/woodProceduralTexture.js.map +1 -1
|
@@ -1,24 +1,21 @@
|
|
|
1
|
-
import { __decorate
|
|
1
|
+
import { __decorate } from "@babylonjs/core/tslib.es6.js";
|
|
2
2
|
import { serialize, serializeAsVector2, SerializationHelper } from "@babylonjs/core/Misc/decorators.js";
|
|
3
3
|
import { Vector2 } from "@babylonjs/core/Maths/math.vector.js";
|
|
4
4
|
import { Color3 } from "@babylonjs/core/Maths/math.color.js";
|
|
5
5
|
import { ProceduralTexture } from "@babylonjs/core/Materials/Textures/Procedurals/proceduralTexture.js";
|
|
6
6
|
import { RegisterClass } from "@babylonjs/core/Misc/typeStore.js";
|
|
7
7
|
import "./fireProceduralTexture.fragment.js";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
return _this;
|
|
20
|
-
}
|
|
21
|
-
FireProceduralTexture.prototype.updateShaderUniforms = function () {
|
|
8
|
+
export class FireProceduralTexture extends ProceduralTexture {
|
|
9
|
+
constructor(name, size, scene = null, fallbackTexture, generateMipMaps) {
|
|
10
|
+
super(name, size, "fireProceduralTexture", scene, fallbackTexture, generateMipMaps);
|
|
11
|
+
this._time = 0.0;
|
|
12
|
+
this._speed = new Vector2(0.5, 0.3);
|
|
13
|
+
this._autoGenerateTime = true;
|
|
14
|
+
this._alphaThreshold = 0.5;
|
|
15
|
+
this._fireColors = FireProceduralTexture.RedFireColors;
|
|
16
|
+
this.updateShaderUniforms();
|
|
17
|
+
}
|
|
18
|
+
updateShaderUniforms() {
|
|
22
19
|
this.setFloat("time", this._time);
|
|
23
20
|
this.setVector2("speed", this._speed);
|
|
24
21
|
this.setColor3("c1", this._fireColors[0]);
|
|
@@ -28,110 +25,74 @@ var FireProceduralTexture = /** @class */ (function (_super) {
|
|
|
28
25
|
this.setColor3("c5", this._fireColors[4]);
|
|
29
26
|
this.setColor3("c6", this._fireColors[5]);
|
|
30
27
|
this.setFloat("alphaThreshold", this._alphaThreshold);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
|
|
28
|
+
}
|
|
29
|
+
render(useCameraPostProcess) {
|
|
30
|
+
const scene = this.getScene();
|
|
34
31
|
if (this._autoGenerateTime && scene) {
|
|
35
32
|
this._time += scene.getAnimationRatio() * 0.03;
|
|
36
33
|
this.updateShaderUniforms();
|
|
37
34
|
}
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
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
|
-
});
|
|
35
|
+
super.render(useCameraPostProcess);
|
|
36
|
+
}
|
|
37
|
+
static get PurpleFireColors() {
|
|
38
|
+
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)];
|
|
39
|
+
}
|
|
40
|
+
static get GreenFireColors() {
|
|
41
|
+
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)];
|
|
42
|
+
}
|
|
43
|
+
static get RedFireColors() {
|
|
44
|
+
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)];
|
|
45
|
+
}
|
|
46
|
+
static get BlueFireColors() {
|
|
47
|
+
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)];
|
|
48
|
+
}
|
|
49
|
+
get autoGenerateTime() {
|
|
50
|
+
return this._autoGenerateTime;
|
|
51
|
+
}
|
|
52
|
+
set autoGenerateTime(value) {
|
|
53
|
+
this._autoGenerateTime = value;
|
|
54
|
+
}
|
|
55
|
+
get fireColors() {
|
|
56
|
+
return this._fireColors;
|
|
57
|
+
}
|
|
58
|
+
set fireColors(value) {
|
|
59
|
+
this._fireColors = value;
|
|
60
|
+
this.updateShaderUniforms();
|
|
61
|
+
}
|
|
62
|
+
get time() {
|
|
63
|
+
return this._time;
|
|
64
|
+
}
|
|
65
|
+
set time(value) {
|
|
66
|
+
this._time = value;
|
|
67
|
+
this.updateShaderUniforms();
|
|
68
|
+
}
|
|
69
|
+
get speed() {
|
|
70
|
+
return this._speed;
|
|
71
|
+
}
|
|
72
|
+
set speed(value) {
|
|
73
|
+
this._speed = value;
|
|
74
|
+
this.updateShaderUniforms();
|
|
75
|
+
}
|
|
76
|
+
get alphaThreshold() {
|
|
77
|
+
return this._alphaThreshold;
|
|
78
|
+
}
|
|
79
|
+
set alphaThreshold(value) {
|
|
80
|
+
this._alphaThreshold = value;
|
|
81
|
+
this.updateShaderUniforms();
|
|
82
|
+
}
|
|
122
83
|
/**
|
|
123
84
|
* Serializes this fire procedural texture
|
|
124
85
|
* @returns a serialized fire procedural texture object
|
|
125
86
|
*/
|
|
126
|
-
|
|
127
|
-
|
|
87
|
+
serialize() {
|
|
88
|
+
const serializationObject = SerializationHelper.Serialize(this, super.serialize());
|
|
128
89
|
serializationObject.customType = "BABYLON.FireProceduralTexture";
|
|
129
90
|
serializationObject.fireColors = [];
|
|
130
|
-
for (
|
|
91
|
+
for (let i = 0; i < this._fireColors.length; i++) {
|
|
131
92
|
serializationObject.fireColors.push(this._fireColors[i].asArray());
|
|
132
93
|
}
|
|
133
94
|
return serializationObject;
|
|
134
|
-
}
|
|
95
|
+
}
|
|
135
96
|
/**
|
|
136
97
|
* Creates a Fire Procedural Texture from parsed fire procedural texture data
|
|
137
98
|
* @param parsedTexture defines parsed texture data
|
|
@@ -139,29 +100,27 @@ var FireProceduralTexture = /** @class */ (function (_super) {
|
|
|
139
100
|
* @param rootUrl defines the root URL containing fire procedural texture information
|
|
140
101
|
* @returns a parsed Fire Procedural Texture
|
|
141
102
|
*/
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
for (
|
|
103
|
+
static Parse(parsedTexture, scene, rootUrl) {
|
|
104
|
+
const texture = SerializationHelper.Parse(() => new FireProceduralTexture(parsedTexture.name, parsedTexture._size, scene, undefined, parsedTexture._generateMipMaps), parsedTexture, scene, rootUrl);
|
|
105
|
+
const colors = [];
|
|
106
|
+
for (let i = 0; i < parsedTexture.fireColors.length; i++) {
|
|
146
107
|
colors.push(Color3.FromArray(parsedTexture.fireColors[i]));
|
|
147
108
|
}
|
|
148
109
|
texture.fireColors = colors;
|
|
149
110
|
return texture;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
}(ProceduralTexture));
|
|
165
|
-
export { FireProceduralTexture };
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
__decorate([
|
|
114
|
+
serialize()
|
|
115
|
+
], FireProceduralTexture.prototype, "autoGenerateTime", null);
|
|
116
|
+
__decorate([
|
|
117
|
+
serialize()
|
|
118
|
+
], FireProceduralTexture.prototype, "time", null);
|
|
119
|
+
__decorate([
|
|
120
|
+
serializeAsVector2()
|
|
121
|
+
], FireProceduralTexture.prototype, "speed", null);
|
|
122
|
+
__decorate([
|
|
123
|
+
serialize()
|
|
124
|
+
], FireProceduralTexture.prototype, "alphaThreshold", null);
|
|
166
125
|
RegisterClass("BABYLON.FireProceduralTexture", FireProceduralTexture);
|
|
167
126
|
//# 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,+BAA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AAK,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"]}
|
|
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,MAAM,OAAO,qBAAsB,SAAQ,iBAAiB;IAOxD,YAAY,IAAY,EAAE,IAAY,EAAE,QAAyB,IAAI,EAAE,eAAyB,EAAE,eAAyB;QACvH,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,uBAAuB,EAAE,KAAK,EAAE,eAAe,EAAE,eAAe,CAAC,CAAC;QAPhF,UAAK,GAAW,GAAG,CAAC;QACpB,WAAM,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;QAC/B,sBAAiB,GAAY,IAAI,CAAC;QAElC,oBAAe,GAAW,GAAG,CAAC;QAIlC,IAAI,CAAC,WAAW,GAAG,qBAAqB,CAAC,aAAa,CAAC;QACvD,IAAI,CAAC,oBAAoB,EAAE,CAAC;IAChC,CAAC;IAEM,oBAAoB;QACvB,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE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;AAiDL,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"]}
|
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
// Do not edit.
|
|
2
2
|
import { ShaderStore } from "@babylonjs/core/Engines/shaderStore.js";
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
const name = "grassProceduralTexturePixelShader";
|
|
4
|
+
const 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);}
|
|
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
|
+
#define CUSTOM_FRAGMENT_DEFINITIONS
|
|
9
|
+
void main(void) {
|
|
10
|
+
#define CUSTOM_FRAGMENT_MAIN_BEGIN
|
|
11
|
+
vec3 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);
|
|
12
|
+
#define CUSTOM_FRAGMENT_MAIN_END
|
|
13
|
+
}`;
|
|
5
14
|
// Sideeffect
|
|
6
15
|
ShaderStore.ShadersStore[name] = shader;
|
|
7
16
|
/** @hidden */
|
|
8
|
-
export
|
|
17
|
+
export const grassProceduralTexturePixelShader = { name, shader };
|
|
9
18
|
//# sourceMappingURL=grassProceduralTexture.fragment.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grassProceduralTexture.fragment.js","sourceRoot":"","sources":["../../../../../lts/proceduralTextures/generated/grass/grassProceduralTexture.fragment.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,+CAAiC;AAEvD,
|
|
1
|
+
{"version":3,"file":"grassProceduralTexture.fragment.js","sourceRoot":"","sources":["../../../../../lts/proceduralTextures/generated/grass/grassProceduralTexture.fragment.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,+CAAiC;AAEvD,MAAM,IAAI,GAAG,mCAAmC,CAAC;AACjD,MAAM,MAAM,GAAG;;;;;;;;;EASb,CAAC;AACH,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 = \"grassProceduralTexturePixelShader\";\nconst 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}`;\n// Sideeffect\nShaderStore.ShadersStore[name] = shader;\n/** @hidden */\nexport const grassProceduralTexturePixelShader = { name, shader };\n"]}
|
|
@@ -1,60 +1,49 @@
|
|
|
1
|
-
import { __decorate
|
|
1
|
+
import { __decorate } from "@babylonjs/core/tslib.es6.js";
|
|
2
2
|
import { 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 "./grassProceduralTexture.fragment.js";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
_this._grassColors = [new Color3(0.29, 0.38, 0.02), new Color3(0.36, 0.49, 0.09), new Color3(0.51, 0.6, 0.28)];
|
|
14
|
-
_this.updateShaderUniforms();
|
|
15
|
-
return _this;
|
|
7
|
+
export class GrassProceduralTexture extends ProceduralTexture {
|
|
8
|
+
constructor(name, size, scene = null, fallbackTexture, generateMipMaps) {
|
|
9
|
+
super(name, size, "grassProceduralTexture", scene, fallbackTexture, generateMipMaps);
|
|
10
|
+
this._groundColor = new Color3(1, 1, 1);
|
|
11
|
+
this._grassColors = [new Color3(0.29, 0.38, 0.02), new Color3(0.36, 0.49, 0.09), new Color3(0.51, 0.6, 0.28)];
|
|
12
|
+
this.updateShaderUniforms();
|
|
16
13
|
}
|
|
17
|
-
|
|
14
|
+
updateShaderUniforms() {
|
|
18
15
|
this.setColor3("herb1Color", this._grassColors[0]);
|
|
19
16
|
this.setColor3("herb2Color", this._grassColors[1]);
|
|
20
17
|
this.setColor3("herb3Color", this._grassColors[2]);
|
|
21
18
|
this.setColor3("groundColor", this._groundColor);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
},
|
|
38
|
-
set: function (value) {
|
|
39
|
-
this._groundColor = value;
|
|
40
|
-
this.updateShaderUniforms();
|
|
41
|
-
},
|
|
42
|
-
enumerable: false,
|
|
43
|
-
configurable: true
|
|
44
|
-
});
|
|
19
|
+
}
|
|
20
|
+
get grassColors() {
|
|
21
|
+
return this._grassColors;
|
|
22
|
+
}
|
|
23
|
+
set grassColors(value) {
|
|
24
|
+
this._grassColors = value;
|
|
25
|
+
this.updateShaderUniforms();
|
|
26
|
+
}
|
|
27
|
+
get groundColor() {
|
|
28
|
+
return this._groundColor;
|
|
29
|
+
}
|
|
30
|
+
set groundColor(value) {
|
|
31
|
+
this._groundColor = value;
|
|
32
|
+
this.updateShaderUniforms();
|
|
33
|
+
}
|
|
45
34
|
/**
|
|
46
35
|
* Serializes this grass procedural texture
|
|
47
36
|
* @returns a serialized grass procedural texture object
|
|
48
37
|
*/
|
|
49
|
-
|
|
50
|
-
|
|
38
|
+
serialize() {
|
|
39
|
+
const serializationObject = SerializationHelper.Serialize(this, super.serialize());
|
|
51
40
|
serializationObject.customType = "BABYLON.GrassProceduralTexture";
|
|
52
41
|
serializationObject.grassColors = [];
|
|
53
|
-
for (
|
|
42
|
+
for (let i = 0; i < this._grassColors.length; i++) {
|
|
54
43
|
serializationObject.grassColors.push(this._grassColors[i].asArray());
|
|
55
44
|
}
|
|
56
45
|
return serializationObject;
|
|
57
|
-
}
|
|
46
|
+
}
|
|
58
47
|
/**
|
|
59
48
|
* Creates a Grass Procedural Texture from parsed grass procedural texture data
|
|
60
49
|
* @param parsedTexture defines parsed texture data
|
|
@@ -62,20 +51,18 @@ var GrassProceduralTexture = /** @class */ (function (_super) {
|
|
|
62
51
|
* @param rootUrl defines the root URL containing grass procedural texture information
|
|
63
52
|
* @returns a parsed Grass Procedural Texture
|
|
64
53
|
*/
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
for (
|
|
54
|
+
static Parse(parsedTexture, scene, rootUrl) {
|
|
55
|
+
const texture = SerializationHelper.Parse(() => new GrassProceduralTexture(parsedTexture.name, parsedTexture._size, scene, undefined, parsedTexture._generateMipMaps), parsedTexture, scene, rootUrl);
|
|
56
|
+
const colors = [];
|
|
57
|
+
for (let i = 0; i < parsedTexture.grassColors.length; i++) {
|
|
69
58
|
colors.push(Color3.FromArray(parsedTexture.grassColors[i]));
|
|
70
59
|
}
|
|
71
60
|
texture.grassColors = colors;
|
|
72
61
|
return texture;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}(ProceduralTexture));
|
|
79
|
-
export { GrassProceduralTexture };
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
__decorate([
|
|
65
|
+
serializeAsColor3()
|
|
66
|
+
], GrassProceduralTexture.prototype, "groundColor", null);
|
|
80
67
|
RegisterClass("BABYLON.GrassProceduralTexture", GrassProceduralTexture);
|
|
81
68
|
//# sourceMappingURL=grassProceduralTexture.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grassProceduralTexture.js","sourceRoot":"","sources":["../../../../../lts/proceduralTextures/generated/grass/grassProceduralTexture.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,2CAA6B;AAC9E,OAAO,EAAE,MAAM,EAAE,4CAA8B;AAE/C,OAAO,EAAE,iBAAiB,EAAE,4EAA8D;AAE1F,OAAO,EAAE,aAAa,EAAE,0CAA4B;AAGpD,OAAO,mCAAmC,CAAC;AAE3C
|
|
1
|
+
{"version":3,"file":"grassProceduralTexture.js","sourceRoot":"","sources":["../../../../../lts/proceduralTextures/generated/grass/grassProceduralTexture.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,2CAA6B;AAC9E,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;IAIzD,YAAY,IAA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AAE,sBAAsB,CAAC,CAAC","sourcesContent":["import { 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 \"./grassProceduralTexture.fragment\";\r\n\r\nexport class GrassProceduralTexture extends ProceduralTexture {\r\n private _grassColors: Color3[];\r\n private _groundColor = new Color3(1, 1, 1);\r\n\r\n constructor(name: string, size: number, scene: Nullable<Scene> = null, fallbackTexture?: Texture, generateMipMaps?: boolean) {\r\n super(name, size, \"grassProceduralTexture\", scene, fallbackTexture, generateMipMaps);\r\n\r\n this._grassColors = [new Color3(0.29, 0.38, 0.02), new Color3(0.36, 0.49, 0.09), new Color3(0.51, 0.6, 0.28)];\r\n\r\n this.updateShaderUniforms();\r\n }\r\n\r\n public updateShaderUniforms() {\r\n this.setColor3(\"herb1Color\", this._grassColors[0]);\r\n this.setColor3(\"herb2Color\", this._grassColors[1]);\r\n this.setColor3(\"herb3Color\", this._grassColors[2]);\r\n this.setColor3(\"groundColor\", this._groundColor);\r\n }\r\n\r\n public get grassColors(): Color3[] {\r\n return this._grassColors;\r\n }\r\n\r\n public set grassColors(value: Color3[]) {\r\n this._grassColors = value;\r\n this.updateShaderUniforms();\r\n }\r\n\r\n @serializeAsColor3()\r\n public get groundColor(): Color3 {\r\n return this._groundColor;\r\n }\r\n\r\n public set groundColor(value: Color3) {\r\n this._groundColor = value;\r\n this.updateShaderUniforms();\r\n }\r\n\r\n /**\r\n * Serializes this grass procedural texture\r\n * @returns a serialized grass procedural texture object\r\n */\r\n public serialize(): any {\r\n const serializationObject = SerializationHelper.Serialize(this, super.serialize());\r\n serializationObject.customType = \"BABYLON.GrassProceduralTexture\";\r\n\r\n serializationObject.grassColors = [];\r\n for (let i = 0; i < this._grassColors.length; i++) {\r\n serializationObject.grassColors.push(this._grassColors[i].asArray());\r\n }\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Creates a Grass Procedural Texture from parsed grass 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 grass procedural texture information\r\n * @returns a parsed Grass Procedural Texture\r\n */\r\n public static Parse(parsedTexture: any, scene: Scene, rootUrl: string): GrassProceduralTexture {\r\n const texture = SerializationHelper.Parse(\r\n () => new GrassProceduralTexture(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.grassColors.length; i++) {\r\n colors.push(Color3.FromArray(parsedTexture.grassColors[i]));\r\n }\r\n\r\n texture.grassColors = colors;\r\n\r\n return texture;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.GrassProceduralTexture\", GrassProceduralTexture);\r\n"]}
|
package/legacy/legacy-brick.js
CHANGED
|
@@ -4,9 +4,9 @@ import * as proceduralTexture from "../brick/index.js";
|
|
|
4
4
|
* This is the entry point for the UMD module.
|
|
5
5
|
* The entry point for a future ESM package should be index.ts
|
|
6
6
|
*/
|
|
7
|
-
|
|
7
|
+
const globalObject = typeof global !== "undefined" ? global : typeof window !== "undefined" ? window : undefined;
|
|
8
8
|
if (typeof globalObject !== "undefined") {
|
|
9
|
-
for (
|
|
9
|
+
for (const key in proceduralTexture) {
|
|
10
10
|
globalObject.BABYLON[key] = proceduralTexture[key];
|
|
11
11
|
}
|
|
12
12
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"legacy-brick.js","sourceRoot":"","sources":["../../../../../lts/proceduralTextures/generated/legacy/legacy-brick.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,OAAO,KAAK,iBAAiB,MAAM,gBAAgB,CAAC;AACpD;;;GAGG;AACH,
|
|
1
|
+
{"version":3,"file":"legacy-brick.js","sourceRoot":"","sources":["../../../../../lts/proceduralTextures/generated/legacy/legacy-brick.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,OAAO,KAAK,iBAAiB,MAAM,gBAAgB,CAAC;AACpD;;;GAGG;AACH,MAAM,YAAY,GAAG,OAAO,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;AACjH,IAAI,OAAO,YAAY,KAAK,WAAW,EAAE;IACrC,KAAK,MAAM,GAAG,IAAI,iBAAiB,EAAE;QAC3B,YAAa,CAAC,OAAO,CAAC,GAAG,CAAC,GAAS,iBAAkB,CAAC,GAAG,CAAC,CAAC;KACpE;CACJ;AACD,cAAc,gBAAgB,CAAC","sourcesContent":["/* eslint-disable import/no-internal-modules */\nimport * as proceduralTexture from \"../brick/index\";\n/**\n * This is the entry point for the UMD module.\n * The entry point for a future ESM package should be index.ts\n */\nconst globalObject = typeof global !== \"undefined\" ? global : typeof window !== \"undefined\" ? window : undefined;\nif (typeof globalObject !== \"undefined\") {\n for (const key in proceduralTexture) {\n (<any>globalObject).BABYLON[key] = (<any>proceduralTexture)[key];\n }\n}\nexport * from \"../brick/index\";\n"]}
|
package/legacy/legacy-cloud.js
CHANGED
|
@@ -4,9 +4,9 @@ import * as proceduralTexture from "../cloud/index.js";
|
|
|
4
4
|
* This is the entry point for the UMD module.
|
|
5
5
|
* The entry point for a future ESM package should be index.ts
|
|
6
6
|
*/
|
|
7
|
-
|
|
7
|
+
const globalObject = typeof global !== "undefined" ? global : typeof window !== "undefined" ? window : undefined;
|
|
8
8
|
if (typeof globalObject !== "undefined") {
|
|
9
|
-
for (
|
|
9
|
+
for (const key in proceduralTexture) {
|
|
10
10
|
globalObject.BABYLON[key] = proceduralTexture[key];
|
|
11
11
|
}
|
|
12
12
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"legacy-cloud.js","sourceRoot":"","sources":["../../../../../lts/proceduralTextures/generated/legacy/legacy-cloud.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,OAAO,KAAK,iBAAiB,MAAM,gBAAgB,CAAC;AACpD;;;GAGG;AACH,
|
|
1
|
+
{"version":3,"file":"legacy-cloud.js","sourceRoot":"","sources":["../../../../../lts/proceduralTextures/generated/legacy/legacy-cloud.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,OAAO,KAAK,iBAAiB,MAAM,gBAAgB,CAAC;AACpD;;;GAGG;AACH,MAAM,YAAY,GAAG,OAAO,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;AACjH,IAAI,OAAO,YAAY,KAAK,WAAW,EAAE;IACrC,KAAK,MAAM,GAAG,IAAI,iBAAiB,EAAE;QAC3B,YAAa,CAAC,OAAO,CAAC,GAAG,CAAC,GAAS,iBAAkB,CAAC,GAAG,CAAC,CAAC;KACpE;CACJ;AACD,cAAc,gBAAgB,CAAC","sourcesContent":["/* eslint-disable import/no-internal-modules */\nimport * as proceduralTexture from \"../cloud/index\";\n/**\n * This is the entry point for the UMD module.\n * The entry point for a future ESM package should be index.ts\n */\nconst globalObject = typeof global !== \"undefined\" ? global : typeof window !== \"undefined\" ? window : undefined;\nif (typeof globalObject !== \"undefined\") {\n for (const key in proceduralTexture) {\n (<any>globalObject).BABYLON[key] = (<any>proceduralTexture)[key];\n }\n}\nexport * from \"../cloud/index\";\n"]}
|
package/legacy/legacy-fire.js
CHANGED
|
@@ -4,9 +4,9 @@ import * as proceduralTexture from "../fire/index.js";
|
|
|
4
4
|
* This is the entry point for the UMD module.
|
|
5
5
|
* The entry point for a future ESM package should be index.ts
|
|
6
6
|
*/
|
|
7
|
-
|
|
7
|
+
const globalObject = typeof global !== "undefined" ? global : typeof window !== "undefined" ? window : undefined;
|
|
8
8
|
if (typeof globalObject !== "undefined") {
|
|
9
|
-
for (
|
|
9
|
+
for (const key in proceduralTexture) {
|
|
10
10
|
globalObject.BABYLON[key] = proceduralTexture[key];
|
|
11
11
|
}
|
|
12
12
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"legacy-fire.js","sourceRoot":"","sources":["../../../../../lts/proceduralTextures/generated/legacy/legacy-fire.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,OAAO,KAAK,iBAAiB,MAAM,eAAe,CAAC;AACnD;;;GAGG;AACH,
|
|
1
|
+
{"version":3,"file":"legacy-fire.js","sourceRoot":"","sources":["../../../../../lts/proceduralTextures/generated/legacy/legacy-fire.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,OAAO,KAAK,iBAAiB,MAAM,eAAe,CAAC;AACnD;;;GAGG;AACH,MAAM,YAAY,GAAG,OAAO,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;AACjH,IAAI,OAAO,YAAY,KAAK,WAAW,EAAE;IACrC,KAAK,MAAM,GAAG,IAAI,iBAAiB,EAAE;QAC3B,YAAa,CAAC,OAAO,CAAC,GAAG,CAAC,GAAS,iBAAkB,CAAC,GAAG,CAAC,CAAC;KACpE;CACJ;AACD,cAAc,eAAe,CAAC","sourcesContent":["/* eslint-disable import/no-internal-modules */\nimport * as proceduralTexture from \"../fire/index\";\n/**\n * This is the entry point for the UMD module.\n * The entry point for a future ESM package should be index.ts\n */\nconst globalObject = typeof global !== \"undefined\" ? global : typeof window !== \"undefined\" ? window : undefined;\nif (typeof globalObject !== \"undefined\") {\n for (const key in proceduralTexture) {\n (<any>globalObject).BABYLON[key] = (<any>proceduralTexture)[key];\n }\n}\nexport * from \"../fire/index\";\n"]}
|
package/legacy/legacy-grass.js
CHANGED
|
@@ -4,9 +4,9 @@ import * as proceduralTexture from "../grass/index.js";
|
|
|
4
4
|
* This is the entry point for the UMD module.
|
|
5
5
|
* The entry point for a future ESM package should be index.ts
|
|
6
6
|
*/
|
|
7
|
-
|
|
7
|
+
const globalObject = typeof global !== "undefined" ? global : typeof window !== "undefined" ? window : undefined;
|
|
8
8
|
if (typeof globalObject !== "undefined") {
|
|
9
|
-
for (
|
|
9
|
+
for (const key in proceduralTexture) {
|
|
10
10
|
globalObject.BABYLON[key] = proceduralTexture[key];
|
|
11
11
|
}
|
|
12
12
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"legacy-grass.js","sourceRoot":"","sources":["../../../../../lts/proceduralTextures/generated/legacy/legacy-grass.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,OAAO,KAAK,iBAAiB,MAAM,gBAAgB,CAAC;AACpD;;;GAGG;AACH,
|
|
1
|
+
{"version":3,"file":"legacy-grass.js","sourceRoot":"","sources":["../../../../../lts/proceduralTextures/generated/legacy/legacy-grass.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,OAAO,KAAK,iBAAiB,MAAM,gBAAgB,CAAC;AACpD;;;GAGG;AACH,MAAM,YAAY,GAAG,OAAO,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;AACjH,IAAI,OAAO,YAAY,KAAK,WAAW,EAAE;IACrC,KAAK,MAAM,GAAG,IAAI,iBAAiB,EAAE;QAC3B,YAAa,CAAC,OAAO,CAAC,GAAG,CAAC,GAAS,iBAAkB,CAAC,GAAG,CAAC,CAAC;KACpE;CACJ;AACD,cAAc,gBAAgB,CAAC","sourcesContent":["/* eslint-disable import/no-internal-modules */\nimport * as proceduralTexture from \"../grass/index\";\n/**\n * This is the entry point for the UMD module.\n * The entry point for a future ESM package should be index.ts\n */\nconst globalObject = typeof global !== \"undefined\" ? global : typeof window !== \"undefined\" ? window : undefined;\nif (typeof globalObject !== \"undefined\") {\n for (const key in proceduralTexture) {\n (<any>globalObject).BABYLON[key] = (<any>proceduralTexture)[key];\n }\n}\nexport * from \"../grass/index\";\n"]}
|
package/legacy/legacy-marble.js
CHANGED
|
@@ -4,9 +4,9 @@ import * as proceduralTexture from "../marble/index.js";
|
|
|
4
4
|
* This is the entry point for the UMD module.
|
|
5
5
|
* The entry point for a future ESM package should be index.ts
|
|
6
6
|
*/
|
|
7
|
-
|
|
7
|
+
const globalObject = typeof global !== "undefined" ? global : typeof window !== "undefined" ? window : undefined;
|
|
8
8
|
if (typeof globalObject !== "undefined") {
|
|
9
|
-
for (
|
|
9
|
+
for (const key in proceduralTexture) {
|
|
10
10
|
globalObject.BABYLON[key] = proceduralTexture[key];
|
|
11
11
|
}
|
|
12
12
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"legacy-marble.js","sourceRoot":"","sources":["../../../../../lts/proceduralTextures/generated/legacy/legacy-marble.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,OAAO,KAAK,iBAAiB,MAAM,iBAAiB,CAAC;AACrD;;;GAGG;AACH,
|
|
1
|
+
{"version":3,"file":"legacy-marble.js","sourceRoot":"","sources":["../../../../../lts/proceduralTextures/generated/legacy/legacy-marble.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,OAAO,KAAK,iBAAiB,MAAM,iBAAiB,CAAC;AACrD;;;GAGG;AACH,MAAM,YAAY,GAAG,OAAO,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;AACjH,IAAI,OAAO,YAAY,KAAK,WAAW,EAAE;IACrC,KAAK,MAAM,GAAG,IAAI,iBAAiB,EAAE;QAC3B,YAAa,CAAC,OAAO,CAAC,GAAG,CAAC,GAAS,iBAAkB,CAAC,GAAG,CAAC,CAAC;KACpE;CACJ;AACD,cAAc,iBAAiB,CAAC","sourcesContent":["/* eslint-disable import/no-internal-modules */\nimport * as proceduralTexture from \"../marble/index\";\n/**\n * This is the entry point for the UMD module.\n * The entry point for a future ESM package should be index.ts\n */\nconst globalObject = typeof global !== \"undefined\" ? global : typeof window !== \"undefined\" ? window : undefined;\nif (typeof globalObject !== \"undefined\") {\n for (const key in proceduralTexture) {\n (<any>globalObject).BABYLON[key] = (<any>proceduralTexture)[key];\n }\n}\nexport * from \"../marble/index\";\n"]}
|