@babylonjs/procedural-textures 9.15.0 → 9.16.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.js +88 -77
- package/brick/brickProceduralTexture.js.map +1 -1
- package/cloud/cloudProceduralTexture.js +88 -77
- package/cloud/cloudProceduralTexture.js.map +1 -1
- package/fire/fireProceduralTexture.js +129 -118
- package/fire/fireProceduralTexture.js.map +1 -1
- package/grass/grassProceduralTexture.js +73 -61
- package/grass/grassProceduralTexture.js.map +1 -1
- package/marble/marbleProceduralTexture.js +88 -77
- package/marble/marbleProceduralTexture.js.map +1 -1
- package/normalMap/normalMapProceduralTexture.js +67 -55
- package/normalMap/normalMapProceduralTexture.js.map +1 -1
- package/package.json +2 -2
- package/perlinNoise/perlinNoiseProceduralTexture.js +75 -59
- package/perlinNoise/perlinNoiseProceduralTexture.js.map +1 -1
- package/road/roadProceduralTexture.js +52 -41
- package/road/roadProceduralTexture.js.map +1 -1
- package/starfield/starfieldProceduralTexture.js +172 -161
- package/starfield/starfieldProceduralTexture.js.map +1 -1
- package/wood/woodProceduralTexture.js +64 -53
- package/wood/woodProceduralTexture.js.map +1 -1
|
@@ -1,85 +1,96 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { __esDecorate, __runInitializers } from "@babylonjs/core/tslib.es6.js";
|
|
2
2
|
import { serialize, serializeAsColor3 } from "@babylonjs/core/Misc/decorators.js";
|
|
3
3
|
import { SerializationHelper } from "@babylonjs/core/Misc/decorators.serialization.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 "./brickProceduralTexture.fragment.js";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
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
|
-
|
|
8
|
+
let BrickProceduralTexture = (() => {
|
|
9
|
+
var _a;
|
|
10
|
+
let _classSuper = ProceduralTexture;
|
|
11
|
+
let _instanceExtraInitializers = [];
|
|
12
|
+
let _get_numberOfBricksHeight_decorators;
|
|
13
|
+
let _get_numberOfBricksWidth_decorators;
|
|
14
|
+
let _get_jointColor_decorators;
|
|
15
|
+
let _get_brickColor_decorators;
|
|
16
|
+
return _a = class BrickProceduralTexture extends _classSuper {
|
|
17
|
+
constructor(name, size, scene = null, fallbackTexture, generateMipMaps) {
|
|
18
|
+
super(name, size, "brickProceduralTexture", scene, fallbackTexture, generateMipMaps);
|
|
19
|
+
this._numberOfBricksHeight = (__runInitializers(this, _instanceExtraInitializers), 15);
|
|
20
|
+
this._numberOfBricksWidth = 5;
|
|
21
|
+
this._jointColor = new Color3(0.72, 0.72, 0.72);
|
|
22
|
+
this._brickColor = new Color3(0.77, 0.47, 0.4);
|
|
23
|
+
this.updateShaderUniforms();
|
|
24
|
+
}
|
|
25
|
+
updateShaderUniforms() {
|
|
26
|
+
this.setFloat("numberOfBricksHeight", this._numberOfBricksHeight);
|
|
27
|
+
this.setFloat("numberOfBricksWidth", this._numberOfBricksWidth);
|
|
28
|
+
this.setColor3("brickColor", this._brickColor);
|
|
29
|
+
this.setColor3("jointColor", this._jointColor);
|
|
30
|
+
}
|
|
31
|
+
get numberOfBricksHeight() {
|
|
32
|
+
return this._numberOfBricksHeight;
|
|
33
|
+
}
|
|
34
|
+
set numberOfBricksHeight(value) {
|
|
35
|
+
this._numberOfBricksHeight = value;
|
|
36
|
+
this.updateShaderUniforms();
|
|
37
|
+
}
|
|
38
|
+
get numberOfBricksWidth() {
|
|
39
|
+
return this._numberOfBricksWidth;
|
|
40
|
+
}
|
|
41
|
+
set numberOfBricksWidth(value) {
|
|
42
|
+
this._numberOfBricksWidth = value;
|
|
43
|
+
this.updateShaderUniforms();
|
|
44
|
+
}
|
|
45
|
+
get jointColor() {
|
|
46
|
+
return this._jointColor;
|
|
47
|
+
}
|
|
48
|
+
set jointColor(value) {
|
|
49
|
+
this._jointColor = value;
|
|
50
|
+
this.updateShaderUniforms();
|
|
51
|
+
}
|
|
52
|
+
get brickColor() {
|
|
53
|
+
return this._brickColor;
|
|
54
|
+
}
|
|
55
|
+
set brickColor(value) {
|
|
56
|
+
this._brickColor = value;
|
|
57
|
+
this.updateShaderUniforms();
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Serializes this brick procedural texture
|
|
61
|
+
* @returns a serialized brick procedural texture object
|
|
62
|
+
*/
|
|
63
|
+
serialize() {
|
|
64
|
+
const serializationObject = SerializationHelper.Serialize(this, super.serialize());
|
|
65
|
+
serializationObject.customType = "BABYLON.BrickProceduralTexture";
|
|
66
|
+
return serializationObject;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Creates a Brick Procedural Texture from parsed brick procedural texture data
|
|
70
|
+
* @param parsedTexture defines parsed texture data
|
|
71
|
+
* @param scene defines the current scene
|
|
72
|
+
* @param rootUrl defines the root URL containing brick procedural texture information
|
|
73
|
+
* @returns a parsed Brick Procedural Texture
|
|
74
|
+
*/
|
|
75
|
+
static Parse(parsedTexture, scene, rootUrl) {
|
|
76
|
+
const texture = SerializationHelper.Parse(() => new _a(parsedTexture.name, parsedTexture._size, scene, undefined, parsedTexture._generateMipMaps), parsedTexture, scene, rootUrl);
|
|
77
|
+
return texture;
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
(() => {
|
|
81
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
82
|
+
_get_numberOfBricksHeight_decorators = [serialize()];
|
|
83
|
+
_get_numberOfBricksWidth_decorators = [serialize()];
|
|
84
|
+
_get_jointColor_decorators = [serializeAsColor3()];
|
|
85
|
+
_get_brickColor_decorators = [serializeAsColor3()];
|
|
86
|
+
__esDecorate(_a, null, _get_numberOfBricksHeight_decorators, { kind: "getter", name: "numberOfBricksHeight", static: false, private: false, access: { has: obj => "numberOfBricksHeight" in obj, get: obj => obj.numberOfBricksHeight }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
87
|
+
__esDecorate(_a, null, _get_numberOfBricksWidth_decorators, { kind: "getter", name: "numberOfBricksWidth", static: false, private: false, access: { has: obj => "numberOfBricksWidth" in obj, get: obj => obj.numberOfBricksWidth }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
88
|
+
__esDecorate(_a, null, _get_jointColor_decorators, { kind: "getter", name: "jointColor", static: false, private: false, access: { has: obj => "jointColor" in obj, get: obj => obj.jointColor }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
89
|
+
__esDecorate(_a, null, _get_brickColor_decorators, { kind: "getter", name: "brickColor", static: false, private: false, access: { has: obj => "brickColor" in obj, get: obj => obj.brickColor }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
90
|
+
if (_metadata) Object.defineProperty(_a, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
91
|
+
})(),
|
|
92
|
+
_a;
|
|
93
|
+
})();
|
|
94
|
+
export { BrickProceduralTexture };
|
|
84
95
|
RegisterClass("BABYLON.BrickProceduralTexture", BrickProceduralTexture);
|
|
85
96
|
//# sourceMappingURL=brickProceduralTexture.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"brickProceduralTexture.js","sourceRoot":"","sources":["../../../../dev/proceduralTextures/src/brick/brickProceduralTexture.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,uDAAuD,CAAC;AAE1F,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGpD,OAAO,mCAAmC,CAAC;
|
|
1
|
+
{"version":3,"file":"brickProceduralTexture.js","sourceRoot":"","sources":["../../../../dev/proceduralTextures/src/brick/brickProceduralTexture.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,uDAAuD,CAAC;AAE1F,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAG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;;SAnDQ,sBAAsB;AAwFnC,aAAa,CAAC,gCAAgC,EAAE,sBAAsB,CAAC,CAAC","sourcesContent":["import { serialize, serializeAsColor3 } from \"core/Misc/decorators\";\r\nimport { SerializationHelper } from \"core/Misc/decorators.serialization\";\r\nimport { Color3 } from \"core/Maths/math.color\";\r\nimport { type Texture } from \"core/Materials/Textures/texture\";\r\nimport { ProceduralTexture } from \"core/Materials/Textures/Procedurals/proceduralTexture\";\r\nimport { type Scene } from \"core/scene\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport { type Nullable } from \"core/types\";\r\n\r\nimport \"./brickProceduralTexture.fragment\";\r\n\r\nexport class BrickProceduralTexture extends ProceduralTexture {\r\n private _numberOfBricksHeight: number = 15;\r\n private _numberOfBricksWidth: number = 5;\r\n private _jointColor = new Color3(0.72, 0.72, 0.72);\r\n private _brickColor = new Color3(0.77, 0.47, 0.4);\r\n\r\n constructor(name: string, size: number, scene: Nullable<Scene> = null, fallbackTexture?: Texture, generateMipMaps?: boolean) {\r\n super(name, size, \"brickProceduralTexture\", scene, fallbackTexture, generateMipMaps);\r\n this.updateShaderUniforms();\r\n }\r\n\r\n public updateShaderUniforms() {\r\n this.setFloat(\"numberOfBricksHeight\", this._numberOfBricksHeight);\r\n this.setFloat(\"numberOfBricksWidth\", this._numberOfBricksWidth);\r\n this.setColor3(\"brickColor\", this._brickColor);\r\n this.setColor3(\"jointColor\", this._jointColor);\r\n }\r\n\r\n @serialize()\r\n public get numberOfBricksHeight(): number {\r\n return this._numberOfBricksHeight;\r\n }\r\n\r\n public set numberOfBricksHeight(value: number) {\r\n this._numberOfBricksHeight = value;\r\n this.updateShaderUniforms();\r\n }\r\n\r\n @serialize()\r\n public get numberOfBricksWidth(): number {\r\n return this._numberOfBricksWidth;\r\n }\r\n\r\n public set numberOfBricksWidth(value: number) {\r\n this._numberOfBricksWidth = value;\r\n this.updateShaderUniforms();\r\n }\r\n\r\n @serializeAsColor3()\r\n public get jointColor(): Color3 {\r\n return this._jointColor;\r\n }\r\n\r\n public set jointColor(value: Color3) {\r\n this._jointColor = value;\r\n this.updateShaderUniforms();\r\n }\r\n\r\n @serializeAsColor3()\r\n public get brickColor(): Color3 {\r\n return this._brickColor;\r\n }\r\n\r\n public set brickColor(value: Color3) {\r\n this._brickColor = value;\r\n this.updateShaderUniforms();\r\n }\r\n\r\n /**\r\n * Serializes this brick procedural texture\r\n * @returns a serialized brick procedural texture object\r\n */\r\n public override serialize(): any {\r\n const serializationObject = SerializationHelper.Serialize(this, super.serialize());\r\n serializationObject.customType = \"BABYLON.BrickProceduralTexture\";\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Creates a Brick Procedural Texture from parsed brick procedural texture data\r\n * @param parsedTexture defines parsed texture data\r\n * @param scene defines the current scene\r\n * @param rootUrl defines the root URL containing brick procedural texture information\r\n * @returns a parsed Brick Procedural Texture\r\n */\r\n public static override Parse(parsedTexture: any, scene: Scene, rootUrl: string): BrickProceduralTexture {\r\n const texture = SerializationHelper.Parse(\r\n () => new BrickProceduralTexture(parsedTexture.name, parsedTexture._size, scene, undefined, parsedTexture._generateMipMaps),\r\n parsedTexture,\r\n scene,\r\n rootUrl\r\n );\r\n\r\n return texture;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.BrickProceduralTexture\", BrickProceduralTexture);\r\n"]}
|
|
@@ -1,85 +1,96 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { __esDecorate, __runInitializers } from "@babylonjs/core/tslib.es6.js";
|
|
2
2
|
import { serialize, serializeAsColor4 } from "@babylonjs/core/Misc/decorators.js";
|
|
3
3
|
import { SerializationHelper } from "@babylonjs/core/Misc/decorators.serialization.js";
|
|
4
4
|
import { Color4 } 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 "./cloudProceduralTexture.fragment.js";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
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
|
-
|
|
8
|
+
let CloudProceduralTexture = (() => {
|
|
9
|
+
var _a;
|
|
10
|
+
let _classSuper = ProceduralTexture;
|
|
11
|
+
let _instanceExtraInitializers = [];
|
|
12
|
+
let _get_skyColor_decorators;
|
|
13
|
+
let _get_cloudColor_decorators;
|
|
14
|
+
let _get_amplitude_decorators;
|
|
15
|
+
let _get_numOctaves_decorators;
|
|
16
|
+
return _a = class CloudProceduralTexture extends _classSuper {
|
|
17
|
+
constructor(name, size, scene = null, fallbackTexture, generateMipMaps) {
|
|
18
|
+
super(name, size, "cloudProceduralTexture", scene, fallbackTexture, generateMipMaps);
|
|
19
|
+
this._skyColor = (__runInitializers(this, _instanceExtraInitializers), new Color4(0.15, 0.68, 1.0, 1.0));
|
|
20
|
+
this._cloudColor = new Color4(1, 1, 1, 1.0);
|
|
21
|
+
this._amplitude = 1;
|
|
22
|
+
this._numOctaves = 4;
|
|
23
|
+
this.updateShaderUniforms();
|
|
24
|
+
}
|
|
25
|
+
updateShaderUniforms() {
|
|
26
|
+
this.setColor4("skyColor", this._skyColor);
|
|
27
|
+
this.setColor4("cloudColor", this._cloudColor);
|
|
28
|
+
this.setFloat("amplitude", this._amplitude);
|
|
29
|
+
this.setInt("numOctaves", this._numOctaves);
|
|
30
|
+
}
|
|
31
|
+
get skyColor() {
|
|
32
|
+
return this._skyColor;
|
|
33
|
+
}
|
|
34
|
+
set skyColor(value) {
|
|
35
|
+
this._skyColor = value;
|
|
36
|
+
this.updateShaderUniforms();
|
|
37
|
+
}
|
|
38
|
+
get cloudColor() {
|
|
39
|
+
return this._cloudColor;
|
|
40
|
+
}
|
|
41
|
+
set cloudColor(value) {
|
|
42
|
+
this._cloudColor = value;
|
|
43
|
+
this.updateShaderUniforms();
|
|
44
|
+
}
|
|
45
|
+
get amplitude() {
|
|
46
|
+
return this._amplitude;
|
|
47
|
+
}
|
|
48
|
+
set amplitude(value) {
|
|
49
|
+
this._amplitude = value;
|
|
50
|
+
this.updateShaderUniforms();
|
|
51
|
+
}
|
|
52
|
+
get numOctaves() {
|
|
53
|
+
return this._numOctaves;
|
|
54
|
+
}
|
|
55
|
+
set numOctaves(value) {
|
|
56
|
+
this._numOctaves = value;
|
|
57
|
+
this.updateShaderUniforms();
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Serializes this cloud procedural texture
|
|
61
|
+
* @returns a serialized cloud procedural texture object
|
|
62
|
+
*/
|
|
63
|
+
serialize() {
|
|
64
|
+
const serializationObject = SerializationHelper.Serialize(this, super.serialize());
|
|
65
|
+
serializationObject.customType = "BABYLON.CloudProceduralTexture";
|
|
66
|
+
return serializationObject;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Creates a Cloud Procedural Texture from parsed cloud procedural texture data
|
|
70
|
+
* @param parsedTexture defines parsed texture data
|
|
71
|
+
* @param scene defines the current scene
|
|
72
|
+
* @param rootUrl defines the root URL containing cloud procedural texture information
|
|
73
|
+
* @returns a parsed Cloud Procedural Texture
|
|
74
|
+
*/
|
|
75
|
+
static Parse(parsedTexture, scene, rootUrl) {
|
|
76
|
+
const texture = SerializationHelper.Parse(() => new _a(parsedTexture.name, parsedTexture._size, scene, undefined, parsedTexture._generateMipMaps), parsedTexture, scene, rootUrl);
|
|
77
|
+
return texture;
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
(() => {
|
|
81
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
82
|
+
_get_skyColor_decorators = [serializeAsColor4()];
|
|
83
|
+
_get_cloudColor_decorators = [serializeAsColor4()];
|
|
84
|
+
_get_amplitude_decorators = [serialize()];
|
|
85
|
+
_get_numOctaves_decorators = [serialize()];
|
|
86
|
+
__esDecorate(_a, null, _get_skyColor_decorators, { kind: "getter", name: "skyColor", static: false, private: false, access: { has: obj => "skyColor" in obj, get: obj => obj.skyColor }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
87
|
+
__esDecorate(_a, null, _get_cloudColor_decorators, { kind: "getter", name: "cloudColor", static: false, private: false, access: { has: obj => "cloudColor" in obj, get: obj => obj.cloudColor }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
88
|
+
__esDecorate(_a, null, _get_amplitude_decorators, { kind: "getter", name: "amplitude", static: false, private: false, access: { has: obj => "amplitude" in obj, get: obj => obj.amplitude }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
89
|
+
__esDecorate(_a, null, _get_numOctaves_decorators, { kind: "getter", name: "numOctaves", static: false, private: false, access: { has: obj => "numOctaves" in obj, get: obj => obj.numOctaves }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
90
|
+
if (_metadata) Object.defineProperty(_a, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
91
|
+
})(),
|
|
92
|
+
_a;
|
|
93
|
+
})();
|
|
94
|
+
export { CloudProceduralTexture };
|
|
84
95
|
RegisterClass("BABYLON.CloudProceduralTexture", CloudProceduralTexture);
|
|
85
96
|
//# sourceMappingURL=cloudProceduralTexture.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cloudProceduralTexture.js","sourceRoot":"","sources":["../../../../dev/proceduralTextures/src/cloud/cloudProceduralTexture.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,uDAAuD,CAAC;AAE1F,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGpD,OAAO,mCAAmC,CAAC;
|
|
1
|
+
{"version":3,"file":"cloudProceduralTexture.js","sourceRoot":"","sources":["../../../../dev/proceduralTextures/src/cloud/cloudProceduralTexture.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,uDAAuD,CAAC;AAE1F,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGpD,OAAO,mCAAmC,CAAC;IAE9B,sBAAsB;;sBAAS,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sB,CAAC,CAAC","sourcesContent":["import { serialize, serializeAsColor4 } from \"core/Misc/decorators\";\r\nimport { SerializationHelper } from \"core/Misc/decorators.serialization\";\r\nimport { Color4 } from \"core/Maths/math.color\";\r\nimport { type Texture } from \"core/Materials/Textures/texture\";\r\nimport { ProceduralTexture } from \"core/Materials/Textures/Procedurals/proceduralTexture\";\r\nimport { type Scene } from \"core/scene\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport { type Nullable } from \"core/types\";\r\n\r\nimport \"./cloudProceduralTexture.fragment\";\r\n\r\nexport class CloudProceduralTexture extends ProceduralTexture {\r\n private _skyColor = new Color4(0.15, 0.68, 1.0, 1.0);\r\n private _cloudColor = new Color4(1, 1, 1, 1.0);\r\n private _amplitude = 1;\r\n private _numOctaves = 4;\r\n\r\n constructor(name: string, size: number, scene: Nullable<Scene> = null, fallbackTexture?: Texture, generateMipMaps?: boolean) {\r\n super(name, size, \"cloudProceduralTexture\", scene, fallbackTexture, generateMipMaps);\r\n this.updateShaderUniforms();\r\n }\r\n\r\n public updateShaderUniforms() {\r\n this.setColor4(\"skyColor\", this._skyColor);\r\n this.setColor4(\"cloudColor\", this._cloudColor);\r\n this.setFloat(\"amplitude\", this._amplitude);\r\n this.setInt(\"numOctaves\", this._numOctaves);\r\n }\r\n\r\n @serializeAsColor4()\r\n public get skyColor(): Color4 {\r\n return this._skyColor;\r\n }\r\n\r\n public set skyColor(value: Color4) {\r\n this._skyColor = value;\r\n this.updateShaderUniforms();\r\n }\r\n\r\n @serializeAsColor4()\r\n public get cloudColor(): Color4 {\r\n return this._cloudColor;\r\n }\r\n\r\n public set cloudColor(value: Color4) {\r\n this._cloudColor = value;\r\n this.updateShaderUniforms();\r\n }\r\n\r\n @serialize()\r\n public get amplitude(): number {\r\n return this._amplitude;\r\n }\r\n\r\n public set amplitude(value: number) {\r\n this._amplitude = value;\r\n this.updateShaderUniforms();\r\n }\r\n\r\n @serialize()\r\n public get numOctaves(): number {\r\n return this._numOctaves;\r\n }\r\n\r\n public set numOctaves(value: number) {\r\n this._numOctaves = value;\r\n this.updateShaderUniforms();\r\n }\r\n\r\n /**\r\n * Serializes this cloud procedural texture\r\n * @returns a serialized cloud procedural texture object\r\n */\r\n public override serialize(): any {\r\n const serializationObject = SerializationHelper.Serialize(this, super.serialize());\r\n serializationObject.customType = \"BABYLON.CloudProceduralTexture\";\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Creates a Cloud Procedural Texture from parsed cloud procedural texture data\r\n * @param parsedTexture defines parsed texture data\r\n * @param scene defines the current scene\r\n * @param rootUrl defines the root URL containing cloud procedural texture information\r\n * @returns a parsed Cloud Procedural Texture\r\n */\r\n public static override Parse(parsedTexture: any, scene: Scene, rootUrl: string): CloudProceduralTexture {\r\n const texture = SerializationHelper.Parse(\r\n () => new CloudProceduralTexture(parsedTexture.name, parsedTexture._size, scene, undefined, parsedTexture._generateMipMaps),\r\n parsedTexture,\r\n scene,\r\n rootUrl\r\n );\r\n\r\n return texture;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.CloudProceduralTexture\", CloudProceduralTexture);\r\n"]}
|