@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,61 +1,72 @@
|
|
|
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 "./woodProceduralTexture.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
|
-
|
|
8
|
+
let WoodProceduralTexture = (() => {
|
|
9
|
+
var _a;
|
|
10
|
+
let _classSuper = ProceduralTexture;
|
|
11
|
+
let _instanceExtraInitializers = [];
|
|
12
|
+
let _get_ampScale_decorators;
|
|
13
|
+
let _get_woodColor_decorators;
|
|
14
|
+
return _a = class WoodProceduralTexture extends _classSuper {
|
|
15
|
+
constructor(name, size, scene = null, fallbackTexture, generateMipMaps) {
|
|
16
|
+
super(name, size, "woodProceduralTexture", scene, fallbackTexture, generateMipMaps);
|
|
17
|
+
this._ampScale = (__runInitializers(this, _instanceExtraInitializers), 100.0);
|
|
18
|
+
this._woodColor = new Color3(0.32, 0.17, 0.09);
|
|
19
|
+
this.updateShaderUniforms();
|
|
20
|
+
}
|
|
21
|
+
updateShaderUniforms() {
|
|
22
|
+
this.setFloat("ampScale", this._ampScale);
|
|
23
|
+
this.setColor3("woodColor", this._woodColor);
|
|
24
|
+
}
|
|
25
|
+
get ampScale() {
|
|
26
|
+
return this._ampScale;
|
|
27
|
+
}
|
|
28
|
+
set ampScale(value) {
|
|
29
|
+
this._ampScale = value;
|
|
30
|
+
this.updateShaderUniforms();
|
|
31
|
+
}
|
|
32
|
+
get woodColor() {
|
|
33
|
+
return this._woodColor;
|
|
34
|
+
}
|
|
35
|
+
set woodColor(value) {
|
|
36
|
+
this._woodColor = value;
|
|
37
|
+
this.updateShaderUniforms();
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Serializes this wood procedural texture
|
|
41
|
+
* @returns a serialized wood procedural texture object
|
|
42
|
+
*/
|
|
43
|
+
serialize() {
|
|
44
|
+
const serializationObject = SerializationHelper.Serialize(this, super.serialize());
|
|
45
|
+
serializationObject.customType = "BABYLON.WoodProceduralTexture";
|
|
46
|
+
return serializationObject;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Creates a Wood Procedural Texture from parsed wood procedural texture data
|
|
50
|
+
* @param parsedTexture defines parsed texture data
|
|
51
|
+
* @param scene defines the current scene
|
|
52
|
+
* @param rootUrl defines the root URL containing wood procedural texture information
|
|
53
|
+
* @returns a parsed Wood Procedural Texture
|
|
54
|
+
*/
|
|
55
|
+
static Parse(parsedTexture, scene, rootUrl) {
|
|
56
|
+
const texture = SerializationHelper.Parse(() => new _a(parsedTexture.name, parsedTexture._size, scene, undefined, parsedTexture._generateMipMaps), parsedTexture, scene, rootUrl);
|
|
57
|
+
return texture;
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
(() => {
|
|
61
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
62
|
+
_get_ampScale_decorators = [serialize()];
|
|
63
|
+
_get_woodColor_decorators = [serializeAsColor3()];
|
|
64
|
+
__esDecorate(_a, null, _get_ampScale_decorators, { kind: "getter", name: "ampScale", static: false, private: false, access: { has: obj => "ampScale" in obj, get: obj => obj.ampScale }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
65
|
+
__esDecorate(_a, null, _get_woodColor_decorators, { kind: "getter", name: "woodColor", static: false, private: false, access: { has: obj => "woodColor" in obj, get: obj => obj.woodColor }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
66
|
+
if (_metadata) Object.defineProperty(_a, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
67
|
+
})(),
|
|
68
|
+
_a;
|
|
69
|
+
})();
|
|
70
|
+
export { WoodProceduralTexture };
|
|
60
71
|
RegisterClass("BABYLON.WoodProceduralTexture", WoodProceduralTexture);
|
|
61
72
|
//# sourceMappingURL=woodProceduralTexture.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"woodProceduralTexture.js","sourceRoot":"","sources":["../../../../dev/proceduralTextures/src/wood/woodProceduralTexture.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;AAEpD,OAAO,kCAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"woodProceduralTexture.js","sourceRoot":"","sources":["../../../../dev/proceduralTextures/src/wood/woodProceduralTexture.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;AAEpD,OAAO,kCAAkC,CAAC;IAE7B,qBAAqB;;sBAAS,iBAAiB;;;;sBAA/C,qBAAsB,SAAQ,WAAiB;Y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AAG,mBAAmB,CAAC,KAAK,CACrC,GAAG,EAAE,CAAC,IAAI,EAAqB,CAAC,aAAa,CAAC,IAAI,EAAE,aAAa,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,aAAa,CAAC,gBAAgB,CAAC,EAC1H,aAAa,EACb,KAAK,EACL,OAAO,CACV,CAAC;gBAEF,OAAO,OAAO,CAAC;YACnB,CAAC;;;;wCA/CA,SAAS,EAAE;yCAUX,iBAAiB,EAAE;YATpB,6KAAW,QAAQ,6DAElB;YAQD,gLAAW,SAAS,6DAEnB;;;;;SA3BQ,qBAAqB;AAgElC,aAAa,CAAC,+BAA+B,EAAE,qBAAqB,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\nimport \"./woodProceduralTexture.fragment\";\r\n\r\nexport class WoodProceduralTexture extends ProceduralTexture {\r\n private _ampScale: number = 100.0;\r\n private _woodColor: Color3 = new Color3(0.32, 0.17, 0.09);\r\n\r\n constructor(name: string, size: number, scene: Nullable<Scene> = null, fallbackTexture?: Texture, generateMipMaps?: boolean) {\r\n super(name, size, \"woodProceduralTexture\", scene, fallbackTexture, generateMipMaps);\r\n this.updateShaderUniforms();\r\n }\r\n\r\n public updateShaderUniforms() {\r\n this.setFloat(\"ampScale\", this._ampScale);\r\n this.setColor3(\"woodColor\", this._woodColor);\r\n }\r\n\r\n @serialize()\r\n public get ampScale(): number {\r\n return this._ampScale;\r\n }\r\n\r\n public set ampScale(value: number) {\r\n this._ampScale = value;\r\n this.updateShaderUniforms();\r\n }\r\n\r\n @serializeAsColor3()\r\n public get woodColor(): Color3 {\r\n return this._woodColor;\r\n }\r\n\r\n public set woodColor(value: Color3) {\r\n this._woodColor = value;\r\n this.updateShaderUniforms();\r\n }\r\n\r\n /**\r\n * Serializes this wood procedural texture\r\n * @returns a serialized wood 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.WoodProceduralTexture\";\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Creates a Wood Procedural Texture from parsed wood 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 wood procedural texture information\r\n * @returns a parsed Wood Procedural Texture\r\n */\r\n public static override Parse(parsedTexture: any, scene: Scene, rootUrl: string): WoodProceduralTexture {\r\n const texture = SerializationHelper.Parse(\r\n () => new WoodProceduralTexture(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.WoodProceduralTexture\", WoodProceduralTexture);\r\n"]}
|