@babylonjs/procedural-textures 6.45.1 → 6.46.0
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 +2 -1
- package/brick/brickProceduralTexture.js.map +1 -1
- package/cloud/cloudProceduralTexture.js +2 -1
- package/cloud/cloudProceduralTexture.js.map +1 -1
- package/fire/fireProceduralTexture.js +2 -1
- package/fire/fireProceduralTexture.js.map +1 -1
- package/grass/grassProceduralTexture.js +2 -1
- package/grass/grassProceduralTexture.js.map +1 -1
- package/marble/marbleProceduralTexture.js +2 -1
- package/marble/marbleProceduralTexture.js.map +1 -1
- package/normalMap/normalMapProceduralTexture.js +2 -1
- package/normalMap/normalMapProceduralTexture.js.map +1 -1
- package/package.json +2 -2
- package/perlinNoise/perlinNoiseProceduralTexture.js +2 -1
- package/perlinNoise/perlinNoiseProceduralTexture.js.map +1 -1
- package/road/roadProceduralTexture.js +2 -1
- package/road/roadProceduralTexture.js.map +1 -1
- package/starfield/starfieldProceduralTexture.js +2 -1
- package/starfield/starfieldProceduralTexture.js.map +1 -1
- package/wood/woodProceduralTexture.js +2 -1
- package/wood/woodProceduralTexture.js.map +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { __decorate } from "@babylonjs/core/tslib.es6.js";
|
|
2
|
-
import { serialize, serializeAsColor3
|
|
2
|
+
import { serialize, serializeAsColor3 } from "@babylonjs/core/Misc/decorators.js";
|
|
3
|
+
import { SerializationHelper } from "@babylonjs/core/Misc/decorators.serialization.js";
|
|
3
4
|
import { Color3 } from "@babylonjs/core/Maths/math.color.js";
|
|
4
5
|
import { ProceduralTexture } from "@babylonjs/core/Materials/Textures/Procedurals/proceduralTexture.js";
|
|
5
6
|
import { RegisterClass } from "@babylonjs/core/Misc/typeStore.js";
|
|
@@ -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,mBAAmB,EAAE,
|
|
1
|
+
{"version":3,"file":"brickProceduralTexture.js","sourceRoot":"","sources":["../../../../dev/proceduralTextures/src/brick/brickProceduralTexture.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,2CAA6B;AACpE,OAAO,EAAE,mBAAmB,EAAE,yDAA2C;AACzE,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;IAMzD,YAAY,IAAY,EAAE,IAAY,EAAE,QAAyB,IAAI,EAAE,eAAyB,EAAE,eAAyB;QACvH,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,wBAAwB,EAAE,KAAK,EAAE,eAAe,EAAE,eAAe,CAAC,CAAC;QANjF,0BAAqB,GAAW,EAAE,CAAC;QACnC,yBAAoB,GAAW,CAAC,CAAC;QACjC,gBAAW,GAAG,IAAI,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QAC3C,gBAAW,GAAG,IAAI,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC;QAI9C,IAAI,CAAC,oBAAoB,EAAE,CAAC;IAChC,CAAC;IAEM,oBAAoB;QACvB,IAAI,CAAC,QAAQ,CAAC,sBAAsB,EAAE,IAAI,CAAC,qBAAqB,CAAC,CAAC;QAClE,IAAI,CAAC,QAAQ,CAAC,qBAAqB,EAAE,IAAI,CAAC,oBAAoB,CAAC,CAAC;QAChE,IAAI,CAAC,SAAS,CAAC,YAAY,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;QAC/C,IAAI,CAAC,SAAS,CAAC,YAAY,EAAE,IAAI,CAAC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E,KAAK,EAAE,SAAS,EAAE,aAAa,CAAC,gBAAgB,CAAC,EAC3H,aAAa,EACb,KAAK,EACL,OAAO,CACV,CAAC;QAEF,OAAO,OAAO,CAAC;IACnB,CAAC;CACJ;AAnEG;IADC,SAAS,EAAE;kEAGX;AAQD;IADC,SAAS,EAAE;iEAGX;AAQD;IADC,iBAAiB,EAAE;wDAGnB;AAQD;IADC,iBAAiB,EAAE;wDAGnB;AAqCL,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 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 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,5 +1,6 @@
|
|
|
1
1
|
import { __decorate } from "@babylonjs/core/tslib.es6.js";
|
|
2
|
-
import { serialize, serializeAsColor4
|
|
2
|
+
import { serialize, serializeAsColor4 } from "@babylonjs/core/Misc/decorators.js";
|
|
3
|
+
import { SerializationHelper } from "@babylonjs/core/Misc/decorators.serialization.js";
|
|
3
4
|
import { Color4 } from "@babylonjs/core/Maths/math.color.js";
|
|
4
5
|
import { ProceduralTexture } from "@babylonjs/core/Materials/Textures/Procedurals/proceduralTexture.js";
|
|
5
6
|
import { RegisterClass } from "@babylonjs/core/Misc/typeStore.js";
|
|
@@ -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,mBAAmB,EAAE,
|
|
1
|
+
{"version":3,"file":"cloudProceduralTexture.js","sourceRoot":"","sources":["../../../../dev/proceduralTextures/src/cloud/cloudProceduralTexture.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,2CAA6B;AACpE,OAAO,EAAE,mBAAmB,EAAE,yDAA2C;AACzE,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;IAMzD,YAAY,IAAY,EAAE,IAAY,EAAE,QAAyB,IAAI,EAAE,eAAyB,EAAE,eAAyB;QACvH,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,wBAAwB,EAAE,KAAK,EAAE,eAAe,EAAE,eAAe,CAAC,CAAC;QANjF,cAAS,GAAG,IAAI,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;QAC7C,gBAAW,GAAG,IAAI,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC;QACvC,eAAU,GAAG,CAAC,CAAC;QACf,gBAAW,GAAG,CA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KAAK,CAAC,SAAS,EAAE,CAAC,CAAC;QACnF,mBAAmB,CAAC,UAAU,GAAG,gCAAgC,CAAC;QAElE,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAED;;;;;;OAMG;IACI,MAAM,CAAC,KAAK,CAAC,aAAkB,EAAE,KAAY,EAAE,OAAe;QACjE,MAAM,OAAO,GAAG,mBAAmB,CAAC,KAAK,CACrC,GAAG,EAAE,CAAC,IAAI,sBAAsB,CAAC,aAAa,CAAC,IAAI,EAAE,aAAa,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,aAAa,CAAC,gBAAgB,CAAC,EAC3H,aAAa,EACb,KAAK,EACL,OAAO,CACV,CAAC;QAEF,OAAO,OAAO,CAAC;IACnB,CAAC;CACJ;AAnEG;IADC,iBAAiB,EAAE;sDAGnB;AAQD;IADC,iBAAiB,EAAE;wDAGnB;AAQD;IADC,SAAS,EAAE;uDAGX;AAQD;IADC,SAAS,EAAE;wDAGX;AAqCL,aAAa,CAAC,gCAAgC,EAAE,sBAAsB,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 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 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"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { __decorate } from "@babylonjs/core/tslib.es6.js";
|
|
2
|
-
import { serialize, serializeAsVector2
|
|
2
|
+
import { serialize, serializeAsVector2 } from "@babylonjs/core/Misc/decorators.js";
|
|
3
|
+
import { SerializationHelper } from "@babylonjs/core/Misc/decorators.serialization.js";
|
|
3
4
|
import { Vector2 } from "@babylonjs/core/Maths/math.vector.js";
|
|
4
5
|
import { Color3 } from "@babylonjs/core/Maths/math.color.js";
|
|
5
6
|
import { ProceduralTexture } from "@babylonjs/core/Materials/Textures/Procedurals/proceduralTexture.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fireProceduralTexture.js","sourceRoot":"","sources":["../../../../dev/proceduralTextures/src/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,o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U,GAAG,MAAM,CAAC;QAE5B,OAAO,OAAO,CAAC;IACnB,CAAC;CACJ;AAvFG;IADC,SAAS,EAAE;6DAGX;AAgBD;IADC,SAAS,EAAE;iDAGX;AAQD;IADC,kBAAkB,EAAE;kDAGpB;AAQD;IADC,SAAS,EAAE;2DAGX;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
|
+
{"version":3,"file":"fireProceduralTexture.js","sourceRoot":"","sources":["../../../../dev/proceduralTextures/src/fire/fireProceduralTexture.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,kBAAk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/B,CAAC;IAED;;;;;;OAMG;IACI,MAAM,CAAC,KAAK,CAAC,aAAkB,EAAE,KAAY,EAAE,OAAe;QACjE,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,MAAM,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;CACJ;AAvFG;IADC,SAAS,EAAE;6DAGX;AAgBD;IADC,SAAS,EAAE;iDAGX;AAQD;IADC,kBAAkB,EAAE;kDAGpB;AAQD;IADC,SAAS,EAAE;2DAGX;AAiDL,aAAa,CAAC,+BAA+B,EAAE,qBAAqB,CAAC,CAAC","sourcesContent":["import { serialize, serializeAsVector2 } from \"core/Misc/decorators\";\r\nimport { SerializationHelper } from \"core/Misc/decorators.serialization\";\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,5 +1,6 @@
|
|
|
1
1
|
import { __decorate } from "@babylonjs/core/tslib.es6.js";
|
|
2
|
-
import { serializeAsColor3
|
|
2
|
+
import { serializeAsColor3 } from "@babylonjs/core/Misc/decorators.js";
|
|
3
|
+
import { SerializationHelper } from "@babylonjs/core/Misc/decorators.serialization.js";
|
|
3
4
|
import { Color3 } from "@babylonjs/core/Maths/math.color.js";
|
|
4
5
|
import { ProceduralTexture } from "@babylonjs/core/Materials/Textures/Procedurals/proceduralTexture.js";
|
|
5
6
|
import { RegisterClass } from "@babylonjs/core/Misc/typeStore.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grassProceduralTexture.js","sourceRoot":"","sources":["../../../../dev/proceduralTextures/src/grass/grassProceduralTexture.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,
|
|
1
|
+
{"version":3,"file":"grassProceduralTexture.js","sourceRoot":"","sources":["../../../../dev/proceduralTextures/src/grass/grassProceduralTexture.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,2CAA6B;AACzD,OAAO,EAAE,mBAAmB,EAAE,yDAA2C;AACz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,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;SAC/D;QAED,OAAO,CAAC,WAAW,GAAG,MAAM,CAAC;QAE7B,OAAO,OAAO,CAAC;IACnB,CAAC;CACJ;AAjDG;IADC,iBAAiB,EAAE;yDAGnB;AAiDL,aAAa,CAAC,gCAAgC,EAAE,sBAAsB,CAAC,CAAC","sourcesContent":["import { 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 \"./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"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { __decorate } from "@babylonjs/core/tslib.es6.js";
|
|
2
|
-
import { serialize
|
|
2
|
+
import { serialize } from "@babylonjs/core/Misc/decorators.js";
|
|
3
|
+
import { SerializationHelper } from "@babylonjs/core/Misc/decorators.serialization.js";
|
|
3
4
|
import { Color3 } from "@babylonjs/core/Maths/math.color.js";
|
|
4
5
|
import { ProceduralTexture } from "@babylonjs/core/Materials/Textures/Procedurals/proceduralTexture.js";
|
|
5
6
|
import { RegisterClass } from "@babylonjs/core/Misc/typeStore.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"marbleProceduralTexture.js","sourceRoot":"","sources":["../../../../dev/proceduralTextures/src/marble/marbleProceduralTexture.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,
|
|
1
|
+
{"version":3,"file":"marbleProceduralTexture.js","sourceRoot":"","sources":["../../../../dev/proceduralTextures/src/marble/marbleProceduralTexture.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,2CAA6B;AACjD,OAAO,EAAE,mBAAmB,EAAE,yDAA2C;AACzE,OAAO,EAAE,MAAM,EAAE,4CAA8B;AAE/C,OAAO,EAAE,iBAAiB,EAAE,4EAA8D;AAE1F,OAAO,EAAE,aAAa,EAAE,0CAA4B;AAGpD,OAAO,oCAAoC,CAAC;AAE5C,MAAM,OAAO,uBAAwB,SAAQ,iBAAiB;IAM1D,YAAY,IAAY,EAAE,IAAY,EAAE,QAAyB,IAAI,EAAE,eAAyB,EAAE,eAAyB;QACvH,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,yBAAyB,EAAE,KAAK,EAAE,eAAe,EAAE,eAAe,CAAC,CAAC;QANlF,yBAAoB,GAAW,CAAC,CAAC;QACjC,wBAAmB,GAAW,CAAC,CAAC;QAChC,eAAU,GAAW,GAAG,CAAC;QACzB,gBAAW,GAAG,IAAI,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QAI/C,IAAI,CAAC,oBAAoB,EAAE,CAAC;IAChC,CAAC;IAEM,oBAAoB;QACvB,IAAI,CAAC,QAAQ,CAAC,qBAAqB,EAAE,IAAI,CAAC,oBAAoB,CAAC,CAAC;QAChE,IAAI,CAAC,QAAQ,CAAC,oBAAoB,EAAE,IAAI,CAAC,mBAAmB,CAAC,CAAC;QAC9D,IAAI,CAAC,QAAQ,CAAC,WAAW,EAAE,IAAI,CAAC,UAAU,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IAAI,uBAAuB,CAAC,aAAa,CAAC,IAAI,EAAE,aAAa,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,aAAa,CAAC,gBAAgB,CAAC,EAC5H,aAAa,EACb,KAAK,EACL,OAAO,CACV,CAAC;QAEF,OAAO,OAAO,CAAC;IACnB,CAAC;CACJ;AAnEG;IADC,SAAS,EAAE;kEAGX;AAQD;IADC,SAAS,EAAE;wDAGX;AAQD;IADC,SAAS,EAAE;iEAGX;AAQD;IADC,SAAS,EAAE;yDAGX;AAqCL,aAAa,CAAC,iCAAiC,EAAE,uBAAuB,CAAC,CAAC","sourcesContent":["import { serialize } 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 \"./marbleProceduralTexture.fragment\";\r\n\r\nexport class MarbleProceduralTexture extends ProceduralTexture {\r\n private _numberOfTilesHeight: number = 3;\r\n private _numberOfTilesWidth: number = 3;\r\n private _amplitude: number = 9.0;\r\n private _jointColor = new Color3(0.72, 0.72, 0.72);\r\n\r\n constructor(name: string, size: number, scene: Nullable<Scene> = null, fallbackTexture?: Texture, generateMipMaps?: boolean) {\r\n super(name, size, \"marbleProceduralTexture\", scene, fallbackTexture, generateMipMaps);\r\n this.updateShaderUniforms();\r\n }\r\n\r\n public updateShaderUniforms() {\r\n this.setFloat(\"numberOfTilesHeight\", this._numberOfTilesHeight);\r\n this.setFloat(\"numberOfTilesWidth\", this._numberOfTilesWidth);\r\n this.setFloat(\"amplitude\", this._amplitude);\r\n this.setColor3(\"jointColor\", this._jointColor);\r\n }\r\n\r\n @serialize()\r\n public get numberOfTilesHeight(): number {\r\n return this._numberOfTilesHeight;\r\n }\r\n\r\n public set numberOfTilesHeight(value: number) {\r\n this._numberOfTilesHeight = 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 numberOfTilesWidth(): number {\r\n return this._numberOfTilesWidth;\r\n }\r\n\r\n public set numberOfTilesWidth(value: number) {\r\n this._numberOfTilesWidth = value;\r\n this.updateShaderUniforms();\r\n }\r\n\r\n @serialize()\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 /**\r\n * Serializes this marble procedural texture\r\n * @returns a serialized marble procedural texture object\r\n */\r\n public serialize(): any {\r\n const serializationObject = SerializationHelper.Serialize(this, super.serialize());\r\n serializationObject.customType = \"BABYLON.MarbleProceduralTexture\";\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Creates a Marble Procedural Texture from parsed marble 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 marble procedural texture information\r\n * @returns a parsed Marble Procedural Texture\r\n */\r\n public static Parse(parsedTexture: any, scene: Scene, rootUrl: string): MarbleProceduralTexture {\r\n const texture = SerializationHelper.Parse(\r\n () => new MarbleProceduralTexture(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.MarbleProceduralTexture\", MarbleProceduralTexture);\r\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { __decorate } from "@babylonjs/core/tslib.es6.js";
|
|
2
|
-
import { serializeAsTexture
|
|
2
|
+
import { serializeAsTexture } from "@babylonjs/core/Misc/decorators.js";
|
|
3
|
+
import { SerializationHelper } from "@babylonjs/core/Misc/decorators.serialization.js";
|
|
3
4
|
import { ProceduralTexture } from "@babylonjs/core/Materials/Textures/Procedurals/proceduralTexture.js";
|
|
4
5
|
import { RegisterClass } from "@babylonjs/core/Misc/typeStore.js";
|
|
5
6
|
import "./normalMapProceduralTexture.fragment.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalMapProceduralTexture.js","sourceRoot":"","sources":["../../../../dev/proceduralTextures/src/normalMap/normalMapProceduralTexture.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,
|
|
1
|
+
{"version":3,"file":"normalMapProceduralTexture.js","sourceRoot":"","sources":["../../../../dev/proceduralTextures/src/normalMap/normalMapProceduralTexture.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,kBAAkB,EAAE,2CAA6B;AAC1D,OAAO,EAAE,mBAAmB,EAAE,yDAA2C;AAEzE,OAAO,EAAE,iBAAiB,EAAE,4EAA8D;AAE1F,OAAO,EAAE,aAAa,EAAE,0CAA4B;AAEpD,OAAO,uCAAuC,CAAC;AAE/C,MAAM,OAAO,0BAA2B,SAAQ,iBAAiB;IAG7D,YAAY,IAAY,EAAE,IAAY,EAAE,QAAyB,IAAI,EAAE,eAAyB,EAAE,eAAyB;QACvH,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,4BAA4B,EAAE,KAAK,EAAE,eAAe,EAAE,eAAe,CAAC,CAAC;QACzF,IAAI,CAAC,oBAAoB,EAAE,CAAC;IAChC,CAAC;IAEM,oBAAoB;QACvB,IAAI,CAAC,UAAU,CAAC,aAAa,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;QAClD,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,aAAa,EAAY,CAAC,CAAC;IAC1D,CAAC;IAEM,MAAM,CAAC,oBAA8B;QACxC,KAAK,CAAC,MAAM,CA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cesContent":["import { serializeAsTexture } from \"core/Misc/decorators\";\r\nimport { SerializationHelper } from \"core/Misc/decorators.serialization\";\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 \"./normalMapProceduralTexture.fragment\";\r\n\r\nexport class NormalMapProceduralTexture extends ProceduralTexture {\r\n private _baseTexture: Texture;\r\n\r\n constructor(name: string, size: number, scene: Nullable<Scene> = null, fallbackTexture?: Texture, generateMipMaps?: boolean) {\r\n super(name, size, \"normalMapProceduralTexture\", scene, fallbackTexture, generateMipMaps);\r\n this.updateShaderUniforms();\r\n }\r\n\r\n public updateShaderUniforms() {\r\n this.setTexture(\"baseSampler\", this._baseTexture);\r\n this.setFloat(\"size\", this.getRenderSize() as number);\r\n }\r\n\r\n public render(useCameraPostProcess?: boolean) {\r\n super.render(useCameraPostProcess);\r\n }\r\n\r\n public resize(size: any, generateMipMaps: any): void {\r\n super.resize(size, generateMipMaps);\r\n\r\n // We need to update the \"size\" uniform\r\n this.updateShaderUniforms();\r\n }\r\n\r\n public isReady(): boolean {\r\n if (!this._baseTexture || !this._baseTexture.isReady()) {\r\n return false;\r\n }\r\n\r\n return super.isReady();\r\n }\r\n\r\n @serializeAsTexture()\r\n public get baseTexture(): Texture {\r\n return this._baseTexture;\r\n }\r\n\r\n public set baseTexture(texture: Texture) {\r\n this._baseTexture = texture;\r\n this.updateShaderUniforms();\r\n }\r\n\r\n /**\r\n * Serializes this normal map procedural texture\r\n * @returns a serialized normal map procedural texture object\r\n */\r\n public serialize(): any {\r\n const serializationObject = SerializationHelper.Serialize(this, super.serialize());\r\n serializationObject.customType = \"BABYLON.NormalMapProceduralTexture\";\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Creates a Normal Map Procedural Texture from parsed normal map 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 normal map procedural texture information\r\n * @returns a parsed Normal Map Procedural Texture\r\n */\r\n public static Parse(parsedTexture: any, scene: Scene, rootUrl: string): NormalMapProceduralTexture {\r\n const texture = SerializationHelper.Parse(\r\n () => new NormalMapProceduralTexture(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.NormalMapProceduralTexture\", NormalMapProceduralTexture);\r\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@babylonjs/procedural-textures",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.46.0",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"module": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"postcompile": "build-tools -c add-js-to-es6"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"@babylonjs/core": "^6.
|
|
21
|
+
"@babylonjs/core": "^6.46.0",
|
|
22
22
|
"@dev/build-tools": "^1.0.0",
|
|
23
23
|
"@lts/procedural-textures": "^1.0.0"
|
|
24
24
|
},
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { __decorate } from "@babylonjs/core/tslib.es6.js";
|
|
2
|
-
import { serialize
|
|
2
|
+
import { serialize } from "@babylonjs/core/Misc/decorators.js";
|
|
3
|
+
import { SerializationHelper } from "@babylonjs/core/Misc/decorators.serialization.js";
|
|
3
4
|
import { ProceduralTexture } from "@babylonjs/core/Materials/Textures/Procedurals/proceduralTexture.js";
|
|
4
5
|
import { RegisterClass } from "@babylonjs/core/Misc/typeStore.js";
|
|
5
6
|
import "./perlinNoiseProceduralTexture.fragment.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"perlinNoiseProceduralTexture.js","sourceRoot":"","sources":["../../../../dev/proceduralTextures/src/perlinNoise/perlinNoiseProceduralTexture.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,
|
|
1
|
+
{"version":3,"file":"perlinNoiseProceduralTexture.js","sourceRoot":"","sources":["../../../../dev/proceduralTextures/src/perlinNoise/perlinNoiseProceduralTexture.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,2CAA6B;AACjD,OAAO,EAAE,mBAAmB,EAAE,yDAA2C;AAEzE,OAAO,EAAE,iBAAiB,EAAE,4EAA8D;AAE1F,OAAO,EAAE,aAAa,EAAE,0CAA4B;AAEpD,OAAO,yCAAyC,CAAC;AAEjD,MAAM,OAAO,4BAA6B,SAAQ,iBAAiB;IAY/D,YAAY,IAAY,EAAE,IAAY,EAAE,QAAyB,IAAI,EAAE,eAAyB,EAAE,eAAyB;QACvH,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,8BAA8B,EAAE,KAAK,EAAE,eAAe,EAAE,eAAe,CAAC,CAAC;QAXxF,SAAI,GAAW,GAAG,CAAC;QAGnB,cAAS,GAAW,GAAG,CAAC;QAGxB,qBAAgB,GAAW,GAAG,CAAC;QAE9B,wBAAmB,GAAW,CAAC,CAAC;QAIpC,IAAI,CAAC,oBAAoB,EAAE,CAAC;IAChC,CAAC;IAEM,oBAAoB;QACvB,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,aAAa,EAAY,CAAC,CAAC;QAEtD,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;QAE9B,IAAI,CAAC,KAAK,EAAE;YACR,OAAO;SACV;QACD,MAAM,SAAS,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC,YAAY,EAAE,CAAC;QAEnD,IAAI,CAAC,IAAI,IAAI,SAAS,CAAC;QACvB,IAAI,CAAC,QAAQ,CAAC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Content":["import { serialize } from \"core/Misc/decorators\";\r\nimport { SerializationHelper } from \"core/Misc/decorators.serialization\";\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 \"./perlinNoiseProceduralTexture.fragment\";\r\n\r\nexport class PerlinNoiseProceduralTexture extends ProceduralTexture {\r\n @serialize()\r\n public time: number = 0.0;\r\n\r\n @serialize()\r\n public timeScale: number = 1.0;\r\n\r\n @serialize()\r\n public translationSpeed: number = 1.0;\r\n\r\n private _currentTranslation: number = 0;\r\n\r\n constructor(name: string, size: number, scene: Nullable<Scene> = null, fallbackTexture?: Texture, generateMipMaps?: boolean) {\r\n super(name, size, \"perlinNoiseProceduralTexture\", scene, fallbackTexture, generateMipMaps);\r\n this.updateShaderUniforms();\r\n }\r\n\r\n public updateShaderUniforms() {\r\n this.setFloat(\"size\", this.getRenderSize() as number);\r\n\r\n const scene = this.getScene();\r\n\r\n if (!scene) {\r\n return;\r\n }\r\n const deltaTime = scene.getEngine().getDeltaTime();\r\n\r\n this.time += deltaTime;\r\n this.setFloat(\"time\", (this.time * this.timeScale) / 1000);\r\n\r\n this._currentTranslation += (deltaTime * this.translationSpeed) / 1000.0;\r\n this.setFloat(\"translationSpeed\", this._currentTranslation);\r\n }\r\n\r\n public render(useCameraPostProcess?: boolean) {\r\n this.updateShaderUniforms();\r\n super.render(useCameraPostProcess);\r\n }\r\n\r\n public resize(size: any, generateMipMaps: any): void {\r\n super.resize(size, generateMipMaps);\r\n }\r\n\r\n /**\r\n * Serializes this perlin noise procedural texture\r\n * @returns a serialized perlin noise procedural texture object\r\n */\r\n public serialize(): any {\r\n const serializationObject = SerializationHelper.Serialize(this, super.serialize());\r\n serializationObject.customType = \"BABYLON.PerlinNoiseProceduralTexture\";\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Creates a Perlin Noise Procedural Texture from parsed perlin noise 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 perlin noise procedural texture information\r\n * @returns a parsed Perlin Noise Procedural Texture\r\n */\r\n public static Parse(parsedTexture: any, scene: Scene, rootUrl: string): PerlinNoiseProceduralTexture {\r\n const texture = SerializationHelper.Parse(\r\n () => new PerlinNoiseProceduralTexture(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.PerlinNoiseProceduralTexture\", PerlinNoiseProceduralTexture);\r\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { __decorate } from "@babylonjs/core/tslib.es6.js";
|
|
2
|
-
import { serializeAsColor3
|
|
2
|
+
import { serializeAsColor3 } from "@babylonjs/core/Misc/decorators.js";
|
|
3
|
+
import { SerializationHelper } from "@babylonjs/core/Misc/decorators.serialization.js";
|
|
3
4
|
import { Color3 } from "@babylonjs/core/Maths/math.color.js";
|
|
4
5
|
import { ProceduralTexture } from "@babylonjs/core/Materials/Textures/Procedurals/proceduralTexture.js";
|
|
5
6
|
import { RegisterClass } from "@babylonjs/core/Misc/typeStore.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"roadProceduralTexture.js","sourceRoot":"","sources":["../../../../dev/proceduralTextures/src/road/roadProceduralTexture.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,
|
|
1
|
+
{"version":3,"file":"roadProceduralTexture.js","sourceRoot":"","sources":["../../../../dev/proceduralTextures/src/road/roadProceduralTexture.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,2CAA6B;AACzD,OAAO,EAAE,mBAAmB,EAAE,yDAA2C;AACzE,OAAO,E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AAC,gBAAgB,CAAC,EAC1H,aAAa,EACb,KAAK,EACL,OAAO,CACV,CAAC;QAEF,OAAO,OAAO,CAAC;IACnB,CAAC;CACJ;AArCG;IADC,iBAAiB,EAAE;sDAGnB;AAqCL,aAAa,CAAC,+BAA+B,EAAE,qBAAqB,CAAC,CAAC","sourcesContent":["import { 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 \"./roadProceduralTexture.fragment\";\r\n\r\nexport class RoadProceduralTexture extends ProceduralTexture {\r\n private _roadColor = new Color3(0.53, 0.53, 0.53);\r\n\r\n constructor(name: string, size: number, scene: Nullable<Scene> = null, fallbackTexture?: Texture, generateMipMaps?: boolean) {\r\n super(name, size, \"roadProceduralTexture\", scene, fallbackTexture, generateMipMaps);\r\n this.updateShaderUniforms();\r\n }\r\n\r\n public updateShaderUniforms() {\r\n this.setColor3(\"roadColor\", this._roadColor);\r\n }\r\n\r\n @serializeAsColor3()\r\n public get roadColor(): Color3 {\r\n return this._roadColor;\r\n }\r\n\r\n public set roadColor(value: Color3) {\r\n this._roadColor = value;\r\n this.updateShaderUniforms();\r\n }\r\n\r\n /**\r\n * Serializes this road procedural texture\r\n * @returns a serialized road procedural texture object\r\n */\r\n public serialize(): any {\r\n const serializationObject = SerializationHelper.Serialize(this, super.serialize());\r\n serializationObject.customType = \"BABYLON.RoadProceduralTexture\";\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Creates a Road Procedural Texture from parsed road 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 road procedural texture information\r\n * @returns a parsed Road Procedural Texture\r\n */\r\n public static Parse(parsedTexture: any, scene: Scene, rootUrl: string): RoadProceduralTexture {\r\n const texture = SerializationHelper.Parse(\r\n () => new RoadProceduralTexture(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.RoadProceduralTexture\", RoadProceduralTexture);\r\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { __decorate } from "@babylonjs/core/tslib.es6.js";
|
|
2
|
-
import { serialize
|
|
2
|
+
import { serialize } from "@babylonjs/core/Misc/decorators.js";
|
|
3
|
+
import { SerializationHelper } from "@babylonjs/core/Misc/decorators.serialization.js";
|
|
3
4
|
import { ProceduralTexture } from "@babylonjs/core/Materials/Textures/Procedurals/proceduralTexture.js";
|
|
4
5
|
import { RegisterClass } from "@babylonjs/core/Misc/typeStore.js";
|
|
5
6
|
import "./starfieldProceduralTexture.fragment.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"starfieldProceduralTexture.js","sourceRoot":"","sources":["../../../../dev/proceduralTextures/src/starfield/starfieldProceduralTexture.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,
|
|
1
|
+
{"version":3,"file":"starfieldProceduralTexture.js","sourceRoot":"","sources":["../../../../dev/proceduralTextures/src/starfield/starfieldProceduralTexture.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,2CAA6B;AACjD,OAAO,EAAE,mBAAmB,EAAE,yDAA2C;AAEzE,OAAO,EAAE,iBAAiB,EAAE,4EAA8D;AAE1F,OAAO,EAAE,aAAa,EAAE,0CAA4B;AAEpD,OAAO,uCAAuC,CAAC;AAE/C,MAAM,OAAO,0BAA2B,SAAQ,iBAAiB;IAa7D,YAAY,IAAY,EAAE,IAAY,EAAE,QAAyB,IAAI,E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E,KAAY,EAAE,OAAe;QACjE,MAAM,OAAO,GAAG,mBAAmB,CAAC,KAAK,CACrC,GAAG,EAAE,CAAC,IAAI,0BAA0B,CAAC,aAAa,CAAC,IAAI,EAAE,aAAa,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,aAAa,CAAC,gBAAgB,CAAC,EAC/H,aAAa,EACb,KAAK,EACL,OAAO,CACV,CAAC;QAEF,OAAO,OAAO,CAAC;IACnB,CAAC;CACJ;AAzIG;IADC,SAAS,EAAE;sDAGX;AAQD;IADC,SAAS,EAAE;uDAGX;AAQD;IADC,SAAS,EAAE;sDAGX;AAQD;IADC,SAAS,EAAE;4DAGX;AAQD;IADC,SAAS,EAAE;0DAGX;AAQD;IADC,SAAS,EAAE;sDAGX;AAQD;IADC,SAAS,EAAE;sDAGX;AAQD;IADC,SAAS,EAAE;4DAGX;AAQD;IADC,SAAS,EAAE;4DAGX;AAQD;IADC,SAAS,EAAE;4DAGX;AAQD;IADC,SAAS,EAAE;4DAGX;AAqCL,aAAa,CAAC,oCAAoC,EAAE,0BAA0B,CAAC,CAAC","sourcesContent":["import { serialize } from \"core/Misc/decorators\";\r\nimport { SerializationHelper } from \"core/Misc/decorators.serialization\";\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 \"./starfieldProceduralTexture.fragment\";\r\n\r\nexport class StarfieldProceduralTexture extends ProceduralTexture {\r\n private _time = 1;\r\n private _alpha = 0.5;\r\n private _beta = 0.8;\r\n private _zoom = 0.8;\r\n private _formuparam = 0.53;\r\n private _stepsize = 0.1;\r\n private _tile = 0.85;\r\n private _brightness = 0.0015;\r\n private _darkmatter = 0.4;\r\n private _distfading = 0.73;\r\n private _saturation = 0.85;\r\n\r\n constructor(name: string, size: number, scene: Nullable<Scene> = null, fallbackTexture?: Texture, generateMipMaps?: boolean) {\r\n super(name, size, \"starfieldProceduralTexture\", scene, fallbackTexture, generateMipMaps);\r\n this.updateShaderUniforms();\r\n }\r\n\r\n public updateShaderUniforms() {\r\n this.setFloat(\"time\", this._time);\r\n this.setFloat(\"alpha\", this._alpha);\r\n this.setFloat(\"beta\", this._beta);\r\n this.setFloat(\"zoom\", this._zoom);\r\n this.setFloat(\"formuparam\", this._formuparam);\r\n this.setFloat(\"stepsize\", this._stepsize);\r\n this.setFloat(\"tile\", this._tile);\r\n this.setFloat(\"brightness\", this._brightness);\r\n this.setFloat(\"darkmatter\", this._darkmatter);\r\n this.setFloat(\"distfading\", this._distfading);\r\n this.setFloat(\"saturation\", this._saturation);\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 @serialize()\r\n public get alpha(): number {\r\n return this._alpha;\r\n }\r\n\r\n public set alpha(value: number) {\r\n this._alpha = value;\r\n this.updateShaderUniforms();\r\n }\r\n\r\n @serialize()\r\n public get beta(): number {\r\n return this._beta;\r\n }\r\n\r\n public set beta(value: number) {\r\n this._beta = value;\r\n this.updateShaderUniforms();\r\n }\r\n\r\n @serialize()\r\n public get formuparam(): number {\r\n return this._formuparam;\r\n }\r\n\r\n public set formuparam(value: number) {\r\n this._formuparam = value;\r\n this.updateShaderUniforms();\r\n }\r\n\r\n @serialize()\r\n public get stepsize(): number {\r\n return this._stepsize;\r\n }\r\n\r\n public set stepsize(value: number) {\r\n this._stepsize = value;\r\n this.updateShaderUniforms();\r\n }\r\n\r\n @serialize()\r\n public get zoom(): number {\r\n return this._zoom;\r\n }\r\n\r\n public set zoom(value: number) {\r\n this._zoom = value;\r\n this.updateShaderUniforms();\r\n }\r\n\r\n @serialize()\r\n public get tile(): number {\r\n return this._tile;\r\n }\r\n\r\n public set tile(value: number) {\r\n this._tile = value;\r\n this.updateShaderUniforms();\r\n }\r\n\r\n @serialize()\r\n public get brightness(): number {\r\n return this._brightness;\r\n }\r\n\r\n public set brightness(value: number) {\r\n this._brightness = value;\r\n this.updateShaderUniforms();\r\n }\r\n\r\n @serialize()\r\n public get darkmatter(): number {\r\n return this._darkmatter;\r\n }\r\n\r\n public set darkmatter(value: number) {\r\n this._darkmatter = value;\r\n this.updateShaderUniforms();\r\n }\r\n\r\n @serialize()\r\n public get distfading(): number {\r\n return this._distfading;\r\n }\r\n\r\n public set distfading(value: number) {\r\n this._distfading = value;\r\n this.updateShaderUniforms();\r\n }\r\n\r\n @serialize()\r\n public get saturation(): number {\r\n return this._saturation;\r\n }\r\n\r\n public set saturation(value: number) {\r\n this._saturation = value;\r\n this.updateShaderUniforms();\r\n }\r\n\r\n /**\r\n * Serializes this starfield procedural texture\r\n * @returns a serialized starfield procedural texture object\r\n */\r\n public serialize(): any {\r\n const serializationObject = SerializationHelper.Serialize(this, super.serialize());\r\n serializationObject.customType = \"BABYLON.StarfieldProceduralTexture\";\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Creates a Starfield Procedural Texture from parsed startfield 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 startfield procedural texture information\r\n * @returns a parsed Starfield Procedural Texture\r\n */\r\n public static Parse(parsedTexture: any, scene: Scene, rootUrl: string): StarfieldProceduralTexture {\r\n const texture = SerializationHelper.Parse(\r\n () => new StarfieldProceduralTexture(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.StarfieldProceduralTexture\", StarfieldProceduralTexture);\r\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { __decorate } from "@babylonjs/core/tslib.es6.js";
|
|
2
|
-
import { serialize, serializeAsColor3
|
|
2
|
+
import { serialize, serializeAsColor3 } from "@babylonjs/core/Misc/decorators.js";
|
|
3
|
+
import { SerializationHelper } from "@babylonjs/core/Misc/decorators.serialization.js";
|
|
3
4
|
import { Color3 } from "@babylonjs/core/Maths/math.color.js";
|
|
4
5
|
import { ProceduralTexture } from "@babylonjs/core/Materials/Textures/Procedurals/proceduralTexture.js";
|
|
5
6
|
import { RegisterClass } from "@babylonjs/core/Misc/typeStore.js";
|
|
@@ -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,mBAAmB,EAAE,
|
|
1
|
+
{"version":3,"file":"woodProceduralTexture.js","sourceRoot":"","sources":["../../../../dev/proceduralTextures/src/wood/woodProceduralTexture.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,2CAA6B;AACpE,OAAO,EAAE,mBAAmB,EAAE,yDAA2C;AACzE,OAAO,EAAE,MAAM,EAAE,4CAA8B;AAE/C,OAAO,EAAE,iBAAiB,EAAE,4EAA8D;AAE1F,OAAO,EAAE,aAAa,EAAE,0CAA4B;AAEpD,OAAO,kCAAkC,CAAC;AAE1C,MAAM,OAAO,qBAAsB,SAAQ,iBAAiB;IAIxD,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;QAJhF,cAAS,GAAW,KAAK,CAAC;QAC1B,eAAU,GAAW,IAAI,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QAItD,IAAI,CAAC,oBAAoB,EAAE,CAAC;IAChC,CAAC;IAEM,oBAAoB;QACvB,IAAI,CAAC,QAAQ,CAAC,UA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orators\";\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 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 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"]}
|