@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.
@@ -1,61 +1,72 @@
1
- import { __decorate } from "@babylonjs/core/tslib.es6.js";
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
- export class WoodProceduralTexture extends ProceduralTexture {
9
- constructor(name, size, scene = null, fallbackTexture, generateMipMaps) {
10
- super(name, size, "woodProceduralTexture", scene, fallbackTexture, generateMipMaps);
11
- this._ampScale = 100.0;
12
- this._woodColor = new Color3(0.32, 0.17, 0.09);
13
- this.updateShaderUniforms();
14
- }
15
- updateShaderUniforms() {
16
- this.setFloat("ampScale", this._ampScale);
17
- this.setColor3("woodColor", this._woodColor);
18
- }
19
- get ampScale() {
20
- return this._ampScale;
21
- }
22
- set ampScale(value) {
23
- this._ampScale = value;
24
- this.updateShaderUniforms();
25
- }
26
- get woodColor() {
27
- return this._woodColor;
28
- }
29
- set woodColor(value) {
30
- this._woodColor = value;
31
- this.updateShaderUniforms();
32
- }
33
- /**
34
- * Serializes this wood procedural texture
35
- * @returns a serialized wood procedural texture object
36
- */
37
- serialize() {
38
- const serializationObject = SerializationHelper.Serialize(this, super.serialize());
39
- serializationObject.customType = "BABYLON.WoodProceduralTexture";
40
- return serializationObject;
41
- }
42
- /**
43
- * Creates a Wood Procedural Texture from parsed wood procedural texture data
44
- * @param parsedTexture defines parsed texture data
45
- * @param scene defines the current scene
46
- * @param rootUrl defines the root URL containing wood procedural texture information
47
- * @returns a parsed Wood Procedural Texture
48
- */
49
- static Parse(parsedTexture, scene, rootUrl) {
50
- const texture = SerializationHelper.Parse(() => new WoodProceduralTexture(parsedTexture.name, parsedTexture._size, scene, undefined, parsedTexture._generateMipMaps), parsedTexture, scene, rootUrl);
51
- return texture;
52
- }
53
- }
54
- __decorate([
55
- serialize()
56
- ], WoodProceduralTexture.prototype, "ampScale", null);
57
- __decorate([
58
- serializeAsColor3()
59
- ], WoodProceduralTexture.prototype, "woodColor", null);
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,qBAA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AAkB,EAAE,KAAY,EAAE,OAAe;QAC1E,MAAM,OAAO,GAAG,mBAAmB,CAAC,KAAK,CACrC,GAAG,EAAE,CAAC,IAAI,qBAAqB,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;QAEF,OAAO,OAAO,CAAC;IACnB,CAAC;CACJ;AA/CG;IADC,SAAS,EAAE;qDAGX;AAQD;IADC,iBAAiB,EAAE;sDAGnB;AAqCL,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"]}
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;YAIxD,YAAY,IAAY,EAAE,IAAY,EAAE,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,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"]}