@babylonjs/procedural-textures 5.0.0-rc.2 → 5.0.0-rc.5
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.d.ts +5 -5
- package/brick/brickProceduralTexture.fragment.d.ts +1 -1
- package/brick/brickProceduralTexture.fragment.js +4 -2
- package/brick/brickProceduralTexture.fragment.js.map +1 -1
- package/brick/brickProceduralTexture.js +2 -2
- package/brick/brickProceduralTexture.js.map +1 -1
- package/brick/index.js.map +1 -1
- package/cloud/cloudProceduralTexture.d.ts +5 -5
- package/cloud/cloudProceduralTexture.fragment.d.ts +1 -1
- package/cloud/cloudProceduralTexture.fragment.js +4 -2
- package/cloud/cloudProceduralTexture.fragment.js.map +1 -1
- package/cloud/cloudProceduralTexture.js +1 -1
- package/cloud/cloudProceduralTexture.js.map +1 -1
- package/cloud/index.js.map +1 -1
- package/fire/fireProceduralTexture.d.ts +6 -6
- package/fire/fireProceduralTexture.fragment.d.ts +1 -1
- package/fire/fireProceduralTexture.fragment.js +4 -2
- package/fire/fireProceduralTexture.fragment.js.map +1 -1
- package/fire/fireProceduralTexture.js +6 -34
- package/fire/fireProceduralTexture.js.map +1 -1
- package/fire/index.js.map +1 -1
- package/grass/grassProceduralTexture.d.ts +5 -5
- package/grass/grassProceduralTexture.fragment.d.ts +1 -1
- package/grass/grassProceduralTexture.fragment.js +4 -2
- package/grass/grassProceduralTexture.fragment.js.map +1 -1
- package/grass/grassProceduralTexture.js +2 -6
- package/grass/grassProceduralTexture.js.map +1 -1
- package/grass/index.js.map +1 -1
- package/index.js.map +1 -1
- package/legacy/legacy-brick.d.ts +1 -1
- package/legacy/legacy-brick.js +3 -3
- package/legacy/legacy-brick.js.map +1 -1
- package/legacy/legacy-cloud.d.ts +1 -1
- package/legacy/legacy-cloud.js +3 -3
- package/legacy/legacy-cloud.js.map +1 -1
- package/legacy/legacy-fire.d.ts +1 -1
- package/legacy/legacy-fire.js +3 -3
- package/legacy/legacy-fire.js.map +1 -1
- package/legacy/legacy-grass.d.ts +1 -1
- package/legacy/legacy-grass.js +3 -3
- package/legacy/legacy-grass.js.map +1 -1
- package/legacy/legacy-marble.d.ts +1 -1
- package/legacy/legacy-marble.js +3 -3
- package/legacy/legacy-marble.js.map +1 -1
- package/legacy/legacy-normalMap.d.ts +1 -1
- package/legacy/legacy-normalMap.js +3 -3
- package/legacy/legacy-normalMap.js.map +1 -1
- package/legacy/legacy-perlinNoise.d.ts +1 -1
- package/legacy/legacy-perlinNoise.js +3 -3
- package/legacy/legacy-perlinNoise.js.map +1 -1
- package/legacy/legacy-road.d.ts +1 -1
- package/legacy/legacy-road.js +3 -3
- package/legacy/legacy-road.js.map +1 -1
- package/legacy/legacy-starfield.d.ts +1 -1
- package/legacy/legacy-starfield.js +3 -3
- package/legacy/legacy-starfield.js.map +1 -1
- package/legacy/legacy-wood.d.ts +1 -1
- package/legacy/legacy-wood.js +3 -3
- package/legacy/legacy-wood.js.map +1 -1
- package/legacy/legacy.d.ts +1 -1
- package/legacy/legacy.js +3 -3
- package/legacy/legacy.js.map +1 -1
- package/marble/index.js.map +1 -1
- package/marble/marbleProceduralTexture.d.ts +5 -5
- package/marble/marbleProceduralTexture.fragment.d.ts +1 -1
- package/marble/marbleProceduralTexture.fragment.js +4 -2
- package/marble/marbleProceduralTexture.fragment.js.map +1 -1
- package/marble/marbleProceduralTexture.js +1 -1
- package/marble/marbleProceduralTexture.js.map +1 -1
- package/normalMap/index.js.map +1 -1
- package/normalMap/normalMapProceduralTexture.d.ts +4 -4
- package/normalMap/normalMapProceduralTexture.fragment.d.ts +1 -1
- package/normalMap/normalMapProceduralTexture.fragment.js +4 -2
- package/normalMap/normalMapProceduralTexture.fragment.js.map +1 -1
- package/normalMap/normalMapProceduralTexture.js +1 -1
- package/normalMap/normalMapProceduralTexture.js.map +1 -1
- package/package.json +22 -152
- package/perlinNoise/index.js.map +1 -1
- package/perlinNoise/perlinNoiseProceduralTexture.d.ts +4 -4
- package/perlinNoise/perlinNoiseProceduralTexture.fragment.d.ts +1 -1
- package/perlinNoise/perlinNoiseProceduralTexture.fragment.js +4 -2
- package/perlinNoise/perlinNoiseProceduralTexture.fragment.js.map +1 -1
- package/perlinNoise/perlinNoiseProceduralTexture.js +3 -3
- package/perlinNoise/perlinNoiseProceduralTexture.js.map +1 -1
- package/readme.md +2 -2
- package/road/index.js.map +1 -1
- package/road/roadProceduralTexture.d.ts +5 -5
- package/road/roadProceduralTexture.fragment.d.ts +1 -1
- package/road/roadProceduralTexture.fragment.js +4 -2
- package/road/roadProceduralTexture.fragment.js.map +1 -1
- package/road/roadProceduralTexture.js +1 -1
- package/road/roadProceduralTexture.js.map +1 -1
- package/starfield/index.js.map +1 -1
- package/starfield/starfieldProceduralTexture.d.ts +4 -4
- package/starfield/starfieldProceduralTexture.fragment.d.ts +1 -1
- package/starfield/starfieldProceduralTexture.fragment.js +4 -2
- package/starfield/starfieldProceduralTexture.fragment.js.map +1 -1
- package/starfield/starfieldProceduralTexture.js +5 -5
- package/starfield/starfieldProceduralTexture.js.map +1 -1
- package/wood/index.js.map +1 -1
- package/wood/woodProceduralTexture.d.ts +5 -5
- package/wood/woodProceduralTexture.fragment.d.ts +1 -1
- package/wood/woodProceduralTexture.fragment.js +4 -2
- package/wood/woodProceduralTexture.fragment.js.map +1 -1
- package/wood/woodProceduralTexture.js +1 -1
- package/wood/woodProceduralTexture.js.map +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Color3 } from "@babylonjs/core/Maths/math.color";
|
|
2
|
-
import { Texture } from "@babylonjs/core/Materials/Textures/texture";
|
|
3
|
-
import { ProceduralTexture } from "@babylonjs/core/Materials/Textures/Procedurals/proceduralTexture";
|
|
4
|
-
import { Scene } from "@babylonjs/core/scene";
|
|
5
|
-
import { Nullable } from "@babylonjs/core/types";
|
|
1
|
+
import { Color3 } from "@babylonjs/core/Maths/math.color.js";
|
|
2
|
+
import { Texture } from "@babylonjs/core/Materials/Textures/texture.js";
|
|
3
|
+
import { ProceduralTexture } from "@babylonjs/core/Materials/Textures/Procedurals/proceduralTexture.js";
|
|
4
|
+
import { Scene } from "@babylonjs/core/scene.js";
|
|
5
|
+
import { Nullable } from "@babylonjs/core/types.js";
|
|
6
6
|
import "./brickProceduralTexture.fragment";
|
|
7
7
|
export declare class BrickProceduralTexture extends ProceduralTexture {
|
|
8
8
|
private _numberOfBricksHeight;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
// Do not edit.
|
|
1
2
|
import { ShaderStore } from "@babylonjs/core/Engines/shaderStore.js";
|
|
2
|
-
var name =
|
|
3
|
-
var shader = "precision highp float
|
|
3
|
+
var name = "brickProceduralTexturePixelShader";
|
|
4
|
+
var shader = "precision highp float;varying vec2 vPosition;varying vec2 vUV;uniform float numberOfBricksHeight;uniform float numberOfBricksWidth;uniform vec3 brickColor;uniform vec3 jointColor;float rand(vec2 n) {return fract(cos(dot(n,vec2(12.9898,4.1414)))*43758.5453);}\nfloat noise(vec2 n) {const vec2 d=vec2(0.0,1.0);vec2 b=floor(n),f=smoothstep(vec2(0.0),vec2(1.0),fract(n));return mix(mix(rand(b),rand(b+d.yx),f.x),mix(rand(b+d.xy),rand(b+d.yy),f.x),f.y);}\nfloat fbm(vec2 n) {float total=0.0,amplitude=1.0;for (int i=0; i<4; i++) {total+=noise(n)*amplitude;n+=n;amplitude*=0.5;}\nreturn total;}\nfloat roundF(float number){return sign(number)*floor(abs(number)+0.5);}\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{float brickW=1.0/numberOfBricksWidth;float brickH=1.0/numberOfBricksHeight;float jointWPercentage=0.01;float jointHPercentage=0.05;vec3 color=brickColor;float yi=vUV.y/brickH;float nyi=roundF(yi);float xi=vUV.x/brickW;if (mod(floor(yi),2.0)==0.0){xi=xi-0.5;}\nfloat nxi=roundF(xi);vec2 brickvUV=vec2((xi-floor(xi))/brickH,(yi-floor(yi))/ brickW);if (yi<nyi+jointHPercentage && yi>nyi-jointHPercentage){color=mix(jointColor,vec3(0.37,0.25,0.25),(yi-nyi)/jointHPercentage+0.2);}\nelse if (xi<nxi+jointWPercentage && xi>nxi-jointWPercentage){color=mix(jointColor,vec3(0.44,0.44,0.44),(xi-nxi)/jointWPercentage+0.2);}\nelse {float brickColorSwitch=mod(floor(yi)+floor(xi),3.0);if (brickColorSwitch==0.0)\ncolor=mix(color,vec3(0.33,0.33,0.33),0.3);else if (brickColorSwitch==2.0)\ncolor=mix(color,vec3(0.11,0.11,0.11),0.3);}\ngl_FragColor=vec4(color,1.0);}";
|
|
5
|
+
// Sideeffect
|
|
4
6
|
ShaderStore.ShadersStore[name] = shader;
|
|
5
7
|
/** @hidden */
|
|
6
8
|
export var brickProceduralTexturePixelShader = { name: name, shader: shader };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"brickProceduralTexture.fragment.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"brickProceduralTexture.fragment.js","sourceRoot":"","sources":["../../../../../lts/proceduralTextures/generated/brick/brickProceduralTexture.fragment.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,+CAAiC;AAEvD,IAAM,IAAI,GAAG,mCAAmC,CAAC;AACjD,IAAM,MAAM,GAAG,miDAagB,CAAC;AAChC,aAAa;AACb,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACxC,cAAc;AACd,MAAM,CAAC,IAAM,iCAAiC,GAAG,EAAE,IAAI,MAAA,EAAE,MAAM,QAAA,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"core/Engines/shaderStore\";\n\nconst name = \"brickProceduralTexturePixelShader\";\nconst shader = `precision highp float;varying vec2 vPosition;varying vec2 vUV;uniform float numberOfBricksHeight;uniform float numberOfBricksWidth;uniform vec3 brickColor;uniform vec3 jointColor;float rand(vec2 n) {return fract(cos(dot(n,vec2(12.9898,4.1414)))*43758.5453);}\nfloat noise(vec2 n) {const vec2 d=vec2(0.0,1.0);vec2 b=floor(n),f=smoothstep(vec2(0.0),vec2(1.0),fract(n));return mix(mix(rand(b),rand(b+d.yx),f.x),mix(rand(b+d.xy),rand(b+d.yy),f.x),f.y);}\nfloat fbm(vec2 n) {float total=0.0,amplitude=1.0;for (int i=0; i<4; i++) {total+=noise(n)*amplitude;n+=n;amplitude*=0.5;}\nreturn total;}\nfloat roundF(float number){return sign(number)*floor(abs(number)+0.5);}\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{float brickW=1.0/numberOfBricksWidth;float brickH=1.0/numberOfBricksHeight;float jointWPercentage=0.01;float jointHPercentage=0.05;vec3 color=brickColor;float yi=vUV.y/brickH;float nyi=roundF(yi);float xi=vUV.x/brickW;if (mod(floor(yi),2.0)==0.0){xi=xi-0.5;}\nfloat nxi=roundF(xi);vec2 brickvUV=vec2((xi-floor(xi))/brickH,(yi-floor(yi))/ brickW);if (yi<nyi+jointHPercentage && yi>nyi-jointHPercentage){color=mix(jointColor,vec3(0.37,0.25,0.25),(yi-nyi)/jointHPercentage+0.2);}\nelse if (xi<nxi+jointWPercentage && xi>nxi-jointWPercentage){color=mix(jointColor,vec3(0.44,0.44,0.44),(xi-nxi)/jointWPercentage+0.2);}\nelse {float brickColorSwitch=mod(floor(yi)+floor(xi),3.0);if (brickColorSwitch==0.0)\ncolor=mix(color,vec3(0.33,0.33,0.33),0.3);else if (brickColorSwitch==2.0)\ncolor=mix(color,vec3(0.11,0.11,0.11),0.3);}\ngl_FragColor=vec4(color,1.0);}`;\n// Sideeffect\nShaderStore.ShadersStore[name] = shader;\n/** @hidden */\nexport const brickProceduralTexturePixelShader = { name, shader };\n"]}
|
|
@@ -2,7 +2,7 @@ import { __decorate, __extends } from "tslib";
|
|
|
2
2
|
import { serialize, serializeAsColor3, SerializationHelper } from "@babylonjs/core/Misc/decorators.js";
|
|
3
3
|
import { Color3 } from "@babylonjs/core/Maths/math.color.js";
|
|
4
4
|
import { ProceduralTexture } from "@babylonjs/core/Materials/Textures/Procedurals/proceduralTexture.js";
|
|
5
|
-
import { RegisterClass } from
|
|
5
|
+
import { RegisterClass } from "@babylonjs/core/Misc/typeStore.js";
|
|
6
6
|
import "./brickProceduralTexture.fragment.js";
|
|
7
7
|
var BrickProceduralTexture = /** @class */ (function (_super) {
|
|
8
8
|
__extends(BrickProceduralTexture, _super);
|
|
@@ -12,7 +12,7 @@ var BrickProceduralTexture = /** @class */ (function (_super) {
|
|
|
12
12
|
_this._numberOfBricksHeight = 15;
|
|
13
13
|
_this._numberOfBricksWidth = 5;
|
|
14
14
|
_this._jointColor = new Color3(0.72, 0.72, 0.72);
|
|
15
|
-
_this._brickColor = new Color3(0.77, 0.47, 0.
|
|
15
|
+
_this._brickColor = new Color3(0.77, 0.47, 0.4);
|
|
16
16
|
_this.updateShaderUniforms();
|
|
17
17
|
return _this;
|
|
18
18
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"brickProceduralTexture.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"brickProceduralTexture.js","sourceRoot":"","sources":["../../../../../lts/proceduralTextures/generated/brick/brickProceduralTexture.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,2CAA6B;AACzF,OAAO,EAAE,MAAM,EAAE,4CAA8B;AAE/C,OAAO,EAAE,iBAAiB,EAAE,4EAA8D;AAE1F,OAAO,EAAE,aAAa,EAAE,0CAA4B;AAGpD,OAAO,mCAAmC,CAAC;AAE3C;IAA4C,0CAAiB;IAMzD,gCAAY,IAAY,EAAE,IAAY,EAAE,KAA6B,EAAE,eAAyB,EAAE,eAAyB;QAAnF,sBAAA,EAAA,YAA6B;QAArE,YACI,kBAAM,IAAI,EAAE,IAAI,EAAE,wBAAwB,EAAE,KAAK,EAAE,eAAe,EAAE,eAAe,CAAC,SAEvF;QARO,2BAAqB,GAAW,EAAE,CAAC;Q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AC5B,CAAC;aAED,UAAsB,KAAa;YAC/B,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;YACzB,IAAI,CAAC,oBAAoB,EAAE,CAAC;QAChC,CAAC;;;OALA;IAOD;;;OAGG;IACI,0CAAS,GAAhB;QACI,IAAM,mBAAmB,GAAG,mBAAmB,CAAC,SAAS,CAAC,IAAI,EAAE,iBAAM,SAAS,WAAE,CAAC,CAAC;QACnF,mBAAmB,CAAC,UAAU,GAAG,gCAAgC,CAAC;QAElE,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAED;;;;;;OAMG;IACW,4BAAK,GAAnB,UAAoB,aAAkB,EAAE,KAAY,EAAE,OAAe;QACjE,IAAM,OAAO,GAAG,mBAAmB,CAAC,KAAK,CACrC,cAAM,OAAA,IAAI,sBAAsB,CAAC,aAAa,CAAC,IAAI,EAAE,aAAa,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,aAAa,CAAC,gBAAgB,CAAC,EAArH,CAAqH,EAC3H,aAAa,EACb,KAAK,EACL,OAAO,CACV,CAAC;QAEF,OAAO,OAAO,CAAC;IACnB,CAAC;IAlED;QADC,SAAS,EAAE;sEAGX;IAQD;QADC,SAAS,EAAE;qEAGX;IAQD;QADC,iBAAiB,EAAE;4DAGnB;IAQD;QADC,iBAAiB,EAAE;4DAGnB;IAmCL,6BAAC;CAAA,AAtFD,CAA4C,iBAAiB,GAsF5D;SAtFY,sBAAsB;AAwFnC,aAAa,CAAC,gCAAgC,EAAE,sBAAsB,CAAC,CAAC","sourcesContent":["import { serialize, serializeAsColor3, SerializationHelper } from \"core/Misc/decorators\";\r\nimport { Color3 } from \"core/Maths/math.color\";\r\nimport { Texture } from \"core/Materials/Textures/texture\";\r\nimport { ProceduralTexture } from \"core/Materials/Textures/Procedurals/proceduralTexture\";\r\nimport { Scene } from \"core/scene\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport { 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"]}
|
package/brick/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../lts/proceduralTextures/generated/brick/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC","sourcesContent":["export * from \"./brickProceduralTexture\";\r\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Color4 } from "@babylonjs/core/Maths/math.color";
|
|
2
|
-
import { Texture } from "@babylonjs/core/Materials/Textures/texture";
|
|
3
|
-
import { ProceduralTexture } from "@babylonjs/core/Materials/Textures/Procedurals/proceduralTexture";
|
|
4
|
-
import { Scene } from "@babylonjs/core/scene";
|
|
5
|
-
import { Nullable } from "@babylonjs/core/types";
|
|
1
|
+
import { Color4 } from "@babylonjs/core/Maths/math.color.js";
|
|
2
|
+
import { Texture } from "@babylonjs/core/Materials/Textures/texture.js";
|
|
3
|
+
import { ProceduralTexture } from "@babylonjs/core/Materials/Textures/Procedurals/proceduralTexture.js";
|
|
4
|
+
import { Scene } from "@babylonjs/core/scene.js";
|
|
5
|
+
import { Nullable } from "@babylonjs/core/types.js";
|
|
6
6
|
import "./cloudProceduralTexture.fragment";
|
|
7
7
|
export declare class CloudProceduralTexture extends ProceduralTexture {
|
|
8
8
|
private _skyColor;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
// Do not edit.
|
|
1
2
|
import { ShaderStore } from "@babylonjs/core/Engines/shaderStore.js";
|
|
2
|
-
var name =
|
|
3
|
-
var shader = "precision highp float
|
|
3
|
+
var name = "cloudProceduralTexturePixelShader";
|
|
4
|
+
var shader = "precision highp float;varying vec2 vUV;uniform vec4 skyColor;uniform vec4 cloudColor;uniform float amplitude;uniform int numOctaves;float rand(vec2 n) {return fract(cos(dot(n,vec2(12.9898,4.1414)))*43758.5453);}\nfloat noise(vec2 n) {const vec2 d=vec2(0.0,1.0);vec2 b=floor(n),f=smoothstep(vec2(0.0),vec2(1.0),fract(n));return mix(mix(rand(b),rand(b+d.yx),f.x),mix(rand(b+d.xy),rand(b+d.yy),f.x),f.y);}\nfloat fbm(vec2 n) {float total=0.0,ampl=amplitude;\n#ifdef WEBGL2\nfor (int i=0; i<numOctaves; i++) {\n#else\nfor (int i=0; i<4; i++) {\n#endif\ntotal+=noise(n)*ampl;n+=n;ampl*=0.5;}\nreturn total;}\nvoid main() {vec2 p=vUV*12.0;vec4 c=mix(skyColor,cloudColor,fbm(p));gl_FragColor=c;}\n";
|
|
5
|
+
// Sideeffect
|
|
4
6
|
ShaderStore.ShadersStore[name] = shader;
|
|
5
7
|
/** @hidden */
|
|
6
8
|
export var cloudProceduralTexturePixelShader = { name: name, shader: shader };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cloudProceduralTexture.fragment.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"cloudProceduralTexture.fragment.js","sourceRoot":"","sources":["../../../../../lts/proceduralTextures/generated/cloud/cloudProceduralTexture.fragment.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,+CAAiC;AAEvD,IAAM,IAAI,GAAG,mCAAmC,CAAC;AACjD,IAAM,MAAM,GAAG,orBAWd,CAAC;AACF,aAAa;AACb,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACxC,cAAc;AACd,MAAM,CAAC,IAAM,iCAAiC,GAAG,EAAE,IAAI,MAAA,EAAE,MAAM,QAAA,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"core/Engines/shaderStore\";\n\nconst name = \"cloudProceduralTexturePixelShader\";\nconst shader = `precision highp float;varying vec2 vUV;uniform vec4 skyColor;uniform vec4 cloudColor;uniform float amplitude;uniform int numOctaves;float rand(vec2 n) {return fract(cos(dot(n,vec2(12.9898,4.1414)))*43758.5453);}\nfloat noise(vec2 n) {const vec2 d=vec2(0.0,1.0);vec2 b=floor(n),f=smoothstep(vec2(0.0),vec2(1.0),fract(n));return mix(mix(rand(b),rand(b+d.yx),f.x),mix(rand(b+d.xy),rand(b+d.yy),f.x),f.y);}\nfloat fbm(vec2 n) {float total=0.0,ampl=amplitude;\n#ifdef WEBGL2\nfor (int i=0; i<numOctaves; i++) {\n#else\nfor (int i=0; i<4; i++) {\n#endif\ntotal+=noise(n)*ampl;n+=n;ampl*=0.5;}\nreturn total;}\nvoid main() {vec2 p=vUV*12.0;vec4 c=mix(skyColor,cloudColor,fbm(p));gl_FragColor=c;}\n`;\n// Sideeffect\nShaderStore.ShadersStore[name] = shader;\n/** @hidden */\nexport const cloudProceduralTexturePixelShader = { name, shader };\n"]}
|
|
@@ -2,7 +2,7 @@ import { __decorate, __extends } from "tslib";
|
|
|
2
2
|
import { serialize, serializeAsColor4, SerializationHelper } from "@babylonjs/core/Misc/decorators.js";
|
|
3
3
|
import { Color4 } from "@babylonjs/core/Maths/math.color.js";
|
|
4
4
|
import { ProceduralTexture } from "@babylonjs/core/Materials/Textures/Procedurals/proceduralTexture.js";
|
|
5
|
-
import { RegisterClass } from
|
|
5
|
+
import { RegisterClass } from "@babylonjs/core/Misc/typeStore.js";
|
|
6
6
|
import "./cloudProceduralTexture.fragment.js";
|
|
7
7
|
var CloudProceduralTexture = /** @class */ (function (_super) {
|
|
8
8
|
__extends(CloudProceduralTexture, _super);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cloudProceduralTexture.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"cloudProceduralTexture.js","sourceRoot":"","sources":["../../../../../lts/proceduralTextures/generated/cloud/cloudProceduralTexture.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,2CAA6B;AACzF,OAAO,EAAE,MAAM,EAAE,4CAA8B;AAE/C,OAAO,EAAE,iBAAiB,EAAE,4EAA8D;AAE1F,OAAO,EAAE,aAAa,EAAE,0CAA4B;AAGpD,OAAO,mCAAmC,CAAC;AAE3C;IAA4C,0CAAiB;IAMzD,gCAAY,IAAY,EAAE,IAAY,EAAE,KAA6B,EAAE,eAAyB,EAAE,eAAyB;QAAnF,sBAAA,EAAA,YAA6B;QAArE,YACI,kBAAM,IAAI,EAAE,IAAI,EAAE,wBAAwB,EAAE,KAAK,EAAE,eAAe,EAAE,eAAe,CAAC,SAEvF;QARO,eAAS,GAAG,IAAI,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;QAC7C,iBAAW,GAAG,IAAI,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC;QACvC,gBAAU,GAAG,CAAC,CAAC;QACf,iBAAW,GAAG,CAAC,CAAC;QAIpB,KAAI,CAAC,oBAAoB,EAAE,CAAC;;IAChC,CAAC;IAEM,qDAAoB,GAA3B;QACI,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;QAC3C,IAAI,CAAC,SAAS,CAAC,YAAY,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;QAC/C,IAAI,CAAC,QAAQ,CAAC,WAAW,EAAE,IAAI,CAAC,UAAU,CAAC,CAA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CAAC,aAAa,CAAC,IAAI,EAAE,aAAa,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,aAAa,CAAC,gBAAgB,CAAC,EAArH,CAAqH,EAC3H,aAAa,EACb,KAAK,EACL,OAAO,CACV,CAAC;QAEF,OAAO,OAAO,CAAC;IACnB,CAAC;IAlED;QADC,iBAAiB,EAAE;0DAGnB;IAQD;QADC,iBAAiB,EAAE;4DAGnB;IAQD;QADC,SAAS,EAAE;2DAGX;IAQD;QADC,SAAS,EAAE;4DAGX;IAmCL,6BAAC;CAAA,AAtFD,CAA4C,iBAAiB,GAsF5D;SAtFY,sBAAsB;AAwFnC,aAAa,CAAC,gCAAgC,EAAE,sBAAsB,CAAC,CAAC","sourcesContent":["import { serialize, serializeAsColor4, SerializationHelper } from \"core/Misc/decorators\";\r\nimport { Color4 } from \"core/Maths/math.color\";\r\nimport { Texture } from \"core/Materials/Textures/texture\";\r\nimport { ProceduralTexture } from \"core/Materials/Textures/Procedurals/proceduralTexture\";\r\nimport { Scene } from \"core/scene\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport { 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"]}
|
package/cloud/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../lts/proceduralTextures/generated/cloud/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC","sourcesContent":["export * from \"./cloudProceduralTexture\";\r\n"]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Vector2 } from "@babylonjs/core/Maths/math.vector";
|
|
2
|
-
import { Color3 } from
|
|
3
|
-
import { Texture } from "@babylonjs/core/Materials/Textures/texture";
|
|
4
|
-
import { ProceduralTexture } from "@babylonjs/core/Materials/Textures/Procedurals/proceduralTexture";
|
|
5
|
-
import { Scene } from "@babylonjs/core/scene";
|
|
6
|
-
import { Nullable } from "@babylonjs/core/types";
|
|
1
|
+
import { Vector2 } from "@babylonjs/core/Maths/math.vector.js";
|
|
2
|
+
import { Color3 } from "@babylonjs/core/Maths/math.color.js";
|
|
3
|
+
import { Texture } from "@babylonjs/core/Materials/Textures/texture.js";
|
|
4
|
+
import { ProceduralTexture } from "@babylonjs/core/Materials/Textures/Procedurals/proceduralTexture.js";
|
|
5
|
+
import { Scene } from "@babylonjs/core/scene.js";
|
|
6
|
+
import { Nullable } from "@babylonjs/core/types.js";
|
|
7
7
|
import "./fireProceduralTexture.fragment";
|
|
8
8
|
export declare class FireProceduralTexture extends ProceduralTexture {
|
|
9
9
|
private _time;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
// Do not edit.
|
|
1
2
|
import { ShaderStore } from "@babylonjs/core/Engines/shaderStore.js";
|
|
2
|
-
var name =
|
|
3
|
-
var shader = "precision highp float
|
|
3
|
+
var name = "fireProceduralTexturePixelShader";
|
|
4
|
+
var shader = "precision highp float;uniform float time;uniform vec3 c1;uniform vec3 c2;uniform vec3 c3;uniform vec3 c4;uniform vec3 c5;uniform vec3 c6;uniform vec2 speed;uniform float shift;uniform float alphaThreshold;varying vec2 vUV;float rand(vec2 n) {return fract(cos(dot(n,vec2(12.9898,4.1414)))*43758.5453);}\nfloat noise(vec2 n) {const vec2 d=vec2(0.0,1.0);vec2 b=floor(n),f=smoothstep(vec2(0.0),vec2(1.0),fract(n));return mix(mix(rand(b),rand(b+d.yx),f.x),mix(rand(b+d.xy),rand(b+d.yy),f.x),f.y);}\nfloat fbm(vec2 n) {float total=0.0,amplitude=1.0;for (int i=0; i<4; i++) {total+=noise(n)*amplitude;n+=n;amplitude*=0.5;}\nreturn total;}\nvoid main() {vec2 p=vUV*8.0;float q=fbm(p-time*0.1);vec2 r=vec2(fbm(p+q+time*speed.x-p.x-p.y),fbm(p+q-time*speed.y));vec3 c=mix(c1,c2,fbm(p+r))+mix(c3,c4,r.x)-mix(c5,c6,r.y);vec3 color=c*cos(shift*vUV.y);float luminance=dot(color.rgb,vec3(0.3,0.59,0.11));gl_FragColor=vec4(color,luminance*alphaThreshold+(1.0-alphaThreshold));}";
|
|
5
|
+
// Sideeffect
|
|
4
6
|
ShaderStore.ShadersStore[name] = shader;
|
|
5
7
|
/** @hidden */
|
|
6
8
|
export var fireProceduralTexturePixelShader = { name: name, shader: shader };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fireProceduralTexture.fragment.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"fireProceduralTexture.fragment.js","sourceRoot":"","sources":["../../../../../lts/proceduralTextures/generated/fire/fireProceduralTexture.fragment.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,+CAAiC;AAEvD,IAAM,IAAI,GAAG,kCAAkC,CAAC;AAChD,IAAM,MAAM,GAAG,k8BAIyT,CAAC;AACzU,aAAa;AACb,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACxC,cAAc;AACd,MAAM,CAAC,IAAM,gCAAgC,GAAG,EAAE,IAAI,MAAA,EAAE,MAAM,QAAA,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"core/Engines/shaderStore\";\n\nconst name = \"fireProceduralTexturePixelShader\";\nconst shader = `precision highp float;uniform float time;uniform vec3 c1;uniform vec3 c2;uniform vec3 c3;uniform vec3 c4;uniform vec3 c5;uniform vec3 c6;uniform vec2 speed;uniform float shift;uniform float alphaThreshold;varying vec2 vUV;float rand(vec2 n) {return fract(cos(dot(n,vec2(12.9898,4.1414)))*43758.5453);}\nfloat noise(vec2 n) {const vec2 d=vec2(0.0,1.0);vec2 b=floor(n),f=smoothstep(vec2(0.0),vec2(1.0),fract(n));return mix(mix(rand(b),rand(b+d.yx),f.x),mix(rand(b+d.xy),rand(b+d.yy),f.x),f.y);}\nfloat fbm(vec2 n) {float total=0.0,amplitude=1.0;for (int i=0; i<4; i++) {total+=noise(n)*amplitude;n+=n;amplitude*=0.5;}\nreturn total;}\nvoid main() {vec2 p=vUV*8.0;float q=fbm(p-time*0.1);vec2 r=vec2(fbm(p+q+time*speed.x-p.x-p.y),fbm(p+q-time*speed.y));vec3 c=mix(c1,c2,fbm(p+r))+mix(c3,c4,r.x)-mix(c5,c6,r.y);vec3 color=c*cos(shift*vUV.y);float luminance=dot(color.rgb,vec3(0.3,0.59,0.11));gl_FragColor=vec4(color,luminance*alphaThreshold+(1.0-alphaThreshold));}`;\n// Sideeffect\nShaderStore.ShadersStore[name] = shader;\n/** @hidden */\nexport const fireProceduralTexturePixelShader = { name, shader };\n"]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { __decorate, __extends } from "tslib";
|
|
2
2
|
import { serialize, serializeAsVector2, SerializationHelper } from "@babylonjs/core/Misc/decorators.js";
|
|
3
3
|
import { Vector2 } from "@babylonjs/core/Maths/math.vector.js";
|
|
4
|
-
import { Color3 } from
|
|
4
|
+
import { Color3 } from "@babylonjs/core/Maths/math.color.js";
|
|
5
5
|
import { ProceduralTexture } from "@babylonjs/core/Materials/Textures/Procedurals/proceduralTexture.js";
|
|
6
|
-
import { RegisterClass } from
|
|
6
|
+
import { RegisterClass } from "@babylonjs/core/Misc/typeStore.js";
|
|
7
7
|
import "./fireProceduralTexture.fragment.js";
|
|
8
8
|
var FireProceduralTexture = /** @class */ (function (_super) {
|
|
9
9
|
__extends(FireProceduralTexture, _super);
|
|
@@ -39,56 +39,28 @@ var FireProceduralTexture = /** @class */ (function (_super) {
|
|
|
39
39
|
};
|
|
40
40
|
Object.defineProperty(FireProceduralTexture, "PurpleFireColors", {
|
|
41
41
|
get: function () {
|
|
42
|
-
return [
|
|
43
|
-
new Color3(0.5, 0.0, 1.0),
|
|
44
|
-
new Color3(0.9, 0.0, 1.0),
|
|
45
|
-
new Color3(0.2, 0.0, 1.0),
|
|
46
|
-
new Color3(1.0, 0.9, 1.0),
|
|
47
|
-
new Color3(0.1, 0.1, 1.0),
|
|
48
|
-
new Color3(0.9, 0.9, 1.0)
|
|
49
|
-
];
|
|
42
|
+
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)];
|
|
50
43
|
},
|
|
51
44
|
enumerable: false,
|
|
52
45
|
configurable: true
|
|
53
46
|
});
|
|
54
47
|
Object.defineProperty(FireProceduralTexture, "GreenFireColors", {
|
|
55
48
|
get: function () {
|
|
56
|
-
return [
|
|
57
|
-
new Color3(0.5, 1.0, 0.0),
|
|
58
|
-
new Color3(0.5, 1.0, 0.0),
|
|
59
|
-
new Color3(0.3, 0.4, 0.0),
|
|
60
|
-
new Color3(0.5, 1.0, 0.0),
|
|
61
|
-
new Color3(0.2, 0.0, 0.0),
|
|
62
|
-
new Color3(0.5, 1.0, 0.0)
|
|
63
|
-
];
|
|
49
|
+
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)];
|
|
64
50
|
},
|
|
65
51
|
enumerable: false,
|
|
66
52
|
configurable: true
|
|
67
53
|
});
|
|
68
54
|
Object.defineProperty(FireProceduralTexture, "RedFireColors", {
|
|
69
55
|
get: function () {
|
|
70
|
-
return [
|
|
71
|
-
new Color3(0.5, 0.0, 0.1),
|
|
72
|
-
new Color3(0.9, 0.0, 0.0),
|
|
73
|
-
new Color3(0.2, 0.0, 0.0),
|
|
74
|
-
new Color3(1.0, 0.9, 0.0),
|
|
75
|
-
new Color3(0.1, 0.1, 0.1),
|
|
76
|
-
new Color3(0.9, 0.9, 0.9)
|
|
77
|
-
];
|
|
56
|
+
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)];
|
|
78
57
|
},
|
|
79
58
|
enumerable: false,
|
|
80
59
|
configurable: true
|
|
81
60
|
});
|
|
82
61
|
Object.defineProperty(FireProceduralTexture, "BlueFireColors", {
|
|
83
62
|
get: function () {
|
|
84
|
-
return [
|
|
85
|
-
new Color3(0.1, 0.0, 0.5),
|
|
86
|
-
new Color3(0.0, 0.0, 0.5),
|
|
87
|
-
new Color3(0.1, 0.0, 0.2),
|
|
88
|
-
new Color3(0.0, 0.0, 1.0),
|
|
89
|
-
new Color3(0.1, 0.2, 0.3),
|
|
90
|
-
new Color3(0.0, 0.2, 0.9)
|
|
91
|
-
];
|
|
63
|
+
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)];
|
|
92
64
|
},
|
|
93
65
|
enumerable: false,
|
|
94
66
|
configurable: true
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fireProceduralTexture.js","sourceRoot":"","sources":["../../../sourceES6/proceduralTexturesLibrary/src/fire/fireProceduralTexture.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CA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AAW,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;SACtE;QAED,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAED;;;;;;OAMG;IACW,2BAAK,GAAnB,UAAoB,aAAkB,EAAE,KAAY,EAAE,OAAe;QACjE,IAAI,OAAO,GAAG,mBAAmB,CAAC,KAAK,CAAC,cAAM,OAAA,IAAI,qBAAqB,CAAC,aAAa,CAAC,IAAI,EAAE,aAAa,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,aAAa,CAAC,gBAAgB,CAAC,EAApH,CAAoH,EAAE,aAAa,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;QAEnM,IAAI,MAAM,GAAa,EAAE,CAAC;QAC1B,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;IAjFD;QADC,SAAS,EAAE;iEAGX;IAgBD;QADC,SAAS,EAAE;qDAGX;IAQD;QADC,kBAAkB,EAAE;sDAGpB;IAQD;QADC,SAAS,EAAE;+DAGX;IA0CL,4BAAC;CAAA,AAjKD,CAA2C,iBAAiB,GAiK3D;SAjKY,qBAAqB;AAmKlC,aAAa,CAAC,+BAA+B,EAAE,qBAAqB,CAAC,CAAC","sourcesContent":["import { serialize, serializeAsVector2, SerializationHelper } from \"@babylonjs/core/Misc/decorators\";\r\nimport { Vector2 } from \"@babylonjs/core/Maths/math.vector\";\r\nimport { Color3 } from '@babylonjs/core/Maths/math.color';\r\nimport { Texture } from \"@babylonjs/core/Materials/Textures/texture\";\r\nimport { ProceduralTexture } from \"@babylonjs/core/Materials/Textures/Procedurals/proceduralTexture\";\r\nimport { Scene } from \"@babylonjs/core/scene\";\r\nimport { RegisterClass } from '@babylonjs/core/Misc/typeStore';\r\nimport { Nullable } from \"@babylonjs/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 let 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 [\r\n new Color3(0.5, 0.0, 1.0),\r\n new Color3(0.9, 0.0, 1.0),\r\n new Color3(0.2, 0.0, 1.0),\r\n new Color3(1.0, 0.9, 1.0),\r\n new Color3(0.1, 0.1, 1.0),\r\n new Color3(0.9, 0.9, 1.0)\r\n ];\r\n }\r\n\r\n public static get GreenFireColors(): Color3[] {\r\n return [\r\n new Color3(0.5, 1.0, 0.0),\r\n new Color3(0.5, 1.0, 0.0),\r\n new Color3(0.3, 0.4, 0.0),\r\n new Color3(0.5, 1.0, 0.0),\r\n new Color3(0.2, 0.0, 0.0),\r\n new Color3(0.5, 1.0, 0.0)\r\n ];\r\n }\r\n\r\n public static get RedFireColors(): Color3[] {\r\n return [\r\n new Color3(0.5, 0.0, 0.1),\r\n new Color3(0.9, 0.0, 0.0),\r\n new Color3(0.2, 0.0, 0.0),\r\n new Color3(1.0, 0.9, 0.0),\r\n new Color3(0.1, 0.1, 0.1),\r\n new Color3(0.9, 0.9, 0.9)\r\n ];\r\n }\r\n\r\n public static get BlueFireColors(): Color3[] {\r\n return [\r\n new Color3(0.1, 0.0, 0.5),\r\n new Color3(0.0, 0.0, 0.5),\r\n new Color3(0.1, 0.0, 0.2),\r\n new Color3(0.0, 0.0, 1.0),\r\n new Color3(0.1, 0.2, 0.3),\r\n new Color3(0.0, 0.2, 0.9)\r\n ];\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 var serializationObject = SerializationHelper.Serialize(this, super.serialize());\r\n serializationObject.customType = \"BABYLON.FireProceduralTexture\";\r\n\r\n serializationObject.fireColors = [];\r\n for (var 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 var texture = SerializationHelper.Parse(() => new FireProceduralTexture(parsedTexture.name, parsedTexture._size, scene, undefined, parsedTexture._generateMipMaps), parsedTexture, scene, rootUrl);\r\n\r\n var colors: Color3[] = [];\r\n for (var 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);"]}
|
|
1
|
+
{"version":3,"file":"fireProceduralTexture.js","sourceRoot":"","sources":["../../../../../lts/proceduralTextures/generated/fire/fireProceduralTexture.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,2CAA6B;AAC1F,OAAO,EAAE,OAAO,EAAE,6CAA+B;AACjD,OAAO,EAAE,MAAM,EAAE,4CAA8B;AAE/C,OAAO,EAAE,iBAAiB,EAAE,4EAA8D;AAE1F,OAAO,EAAE,aAAa,EAAE,0CAA4B;AAGpD,OAAO,kCAAkC,CAAC;AAE1C;IAA2C,yCAAiB;IAOxD,+BAAY,IAAY,EAAE,IAAY,EAAE,KAA6B,EAAE,eAAyB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,gBAAgB,CAAC,EAApH,CAAoH,EAC1H,aAAa,EACb,KAAK,EACL,OAAO,CACV,CAAC;QAEF,IAAM,MAAM,GAAa,EAAE,CAAC;QAC5B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,aAAa,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACtD,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;SAC9D;QAED,OAAO,CAAC,UAAU,GAAG,MAAM,CAAC;QAE5B,OAAO,OAAO,CAAC;IACnB,CAAC;IAtFD;QADC,SAAS,EAAE;iEAGX;IAgBD;QADC,SAAS,EAAE;qDAGX;IAQD;QADC,kBAAkB,EAAE;sDAGpB;IAQD;QADC,SAAS,EAAE;+DAGX;IA+CL,4BAAC;CAAA,AA1ID,CAA2C,iBAAiB,GA0I3D;SA1IY,qBAAqB;AA4IlC,aAAa,CAAC,+BAA+B,EAAE,qBAAqB,CAAC,CAAC","sourcesContent":["import { serialize, serializeAsVector2, SerializationHelper } from \"core/Misc/decorators\";\r\nimport { Vector2 } from \"core/Maths/math.vector\";\r\nimport { Color3 } from \"core/Maths/math.color\";\r\nimport { Texture } from \"core/Materials/Textures/texture\";\r\nimport { ProceduralTexture } from \"core/Materials/Textures/Procedurals/proceduralTexture\";\r\nimport { Scene } from \"core/scene\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport { 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"]}
|
package/fire/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../lts/proceduralTextures/generated/fire/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC","sourcesContent":["export * from \"./fireProceduralTexture\";\r\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Color3 } from "@babylonjs/core/Maths/math.color";
|
|
2
|
-
import { Texture } from "@babylonjs/core/Materials/Textures/texture";
|
|
3
|
-
import { ProceduralTexture } from "@babylonjs/core/Materials/Textures/Procedurals/proceduralTexture";
|
|
4
|
-
import { Scene } from "@babylonjs/core/scene";
|
|
5
|
-
import { Nullable } from "@babylonjs/core/types";
|
|
1
|
+
import { Color3 } from "@babylonjs/core/Maths/math.color.js";
|
|
2
|
+
import { Texture } from "@babylonjs/core/Materials/Textures/texture.js";
|
|
3
|
+
import { ProceduralTexture } from "@babylonjs/core/Materials/Textures/Procedurals/proceduralTexture.js";
|
|
4
|
+
import { Scene } from "@babylonjs/core/scene.js";
|
|
5
|
+
import { Nullable } from "@babylonjs/core/types.js";
|
|
6
6
|
import "./grassProceduralTexture.fragment";
|
|
7
7
|
export declare class GrassProceduralTexture extends ProceduralTexture {
|
|
8
8
|
private _grassColors;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
// Do not edit.
|
|
1
2
|
import { ShaderStore } from "@babylonjs/core/Engines/shaderStore.js";
|
|
2
|
-
var name =
|
|
3
|
-
var shader = "precision highp float
|
|
3
|
+
var name = "grassProceduralTexturePixelShader";
|
|
4
|
+
var shader = "precision highp float;varying vec2 vPosition;varying vec2 vUV;uniform vec3 herb1Color;uniform vec3 herb2Color;uniform vec3 herb3Color;uniform vec3 groundColor;float rand(vec2 n) {return fract(cos(dot(n,vec2(12.9898,4.1414)))*43758.5453);}\nfloat noise(vec2 n) {const vec2 d=vec2(0.0,1.0);vec2 b=floor(n),f=smoothstep(vec2(0.0),vec2(1.0),fract(n));return mix(mix(rand(b),rand(b+d.yx),f.x),mix(rand(b+d.xy),rand(b+d.yy),f.x),f.y);}\nfloat fbm(vec2 n) {float total=0.0,amplitude=1.0;for (int i=0; i<4; i++) {total+=noise(n)*amplitude;n+=n;amplitude*=0.5;}\nreturn total;}\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\nvec3 color=mix(groundColor,herb1Color,rand(gl_FragCoord.xy*4.0));color=mix(color,herb2Color,rand(gl_FragCoord.xy*8.0));color=mix(color,herb3Color,rand(gl_FragCoord.xy));color=mix(color,herb1Color,fbm(gl_FragCoord.xy*16.0));gl_FragColor=vec4(color,1.0);\n#define CUSTOM_FRAGMENT_MAIN_END\n}";
|
|
5
|
+
// Sideeffect
|
|
4
6
|
ShaderStore.ShadersStore[name] = shader;
|
|
5
7
|
/** @hidden */
|
|
6
8
|
export var grassProceduralTexturePixelShader = { name: name, shader: shader };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grassProceduralTexture.fragment.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"grassProceduralTexture.fragment.js","sourceRoot":"","sources":["../../../../../lts/proceduralTextures/generated/grass/grassProceduralTexture.fragment.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,+CAAiC;AAEvD,IAAM,IAAI,GAAG,mCAAmC,CAAC;AACjD,IAAM,MAAM,GAAG,y7BASb,CAAC;AACH,aAAa;AACb,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACxC,cAAc;AACd,MAAM,CAAC,IAAM,iCAAiC,GAAG,EAAE,IAAI,MAAA,EAAE,MAAM,QAAA,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"core/Engines/shaderStore\";\n\nconst name = \"grassProceduralTexturePixelShader\";\nconst shader = `precision highp float;varying vec2 vPosition;varying vec2 vUV;uniform vec3 herb1Color;uniform vec3 herb2Color;uniform vec3 herb3Color;uniform vec3 groundColor;float rand(vec2 n) {return fract(cos(dot(n,vec2(12.9898,4.1414)))*43758.5453);}\nfloat noise(vec2 n) {const vec2 d=vec2(0.0,1.0);vec2 b=floor(n),f=smoothstep(vec2(0.0),vec2(1.0),fract(n));return mix(mix(rand(b),rand(b+d.yx),f.x),mix(rand(b+d.xy),rand(b+d.yy),f.x),f.y);}\nfloat fbm(vec2 n) {float total=0.0,amplitude=1.0;for (int i=0; i<4; i++) {total+=noise(n)*amplitude;n+=n;amplitude*=0.5;}\nreturn total;}\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\nvec3 color=mix(groundColor,herb1Color,rand(gl_FragCoord.xy*4.0));color=mix(color,herb2Color,rand(gl_FragCoord.xy*8.0));color=mix(color,herb3Color,rand(gl_FragCoord.xy));color=mix(color,herb1Color,fbm(gl_FragCoord.xy*16.0));gl_FragColor=vec4(color,1.0);\n#define CUSTOM_FRAGMENT_MAIN_END\n}`;\n// Sideeffect\nShaderStore.ShadersStore[name] = shader;\n/** @hidden */\nexport const grassProceduralTexturePixelShader = { name, shader };\n"]}
|
|
@@ -2,7 +2,7 @@ import { __decorate, __extends } from "tslib";
|
|
|
2
2
|
import { serializeAsColor3, SerializationHelper } from "@babylonjs/core/Misc/decorators.js";
|
|
3
3
|
import { Color3 } from "@babylonjs/core/Maths/math.color.js";
|
|
4
4
|
import { ProceduralTexture } from "@babylonjs/core/Materials/Textures/Procedurals/proceduralTexture.js";
|
|
5
|
-
import { RegisterClass } from
|
|
5
|
+
import { RegisterClass } from "@babylonjs/core/Misc/typeStore.js";
|
|
6
6
|
import "./grassProceduralTexture.fragment.js";
|
|
7
7
|
var GrassProceduralTexture = /** @class */ (function (_super) {
|
|
8
8
|
__extends(GrassProceduralTexture, _super);
|
|
@@ -10,11 +10,7 @@ var GrassProceduralTexture = /** @class */ (function (_super) {
|
|
|
10
10
|
if (scene === void 0) { scene = null; }
|
|
11
11
|
var _this = _super.call(this, name, size, "grassProceduralTexture", scene, fallbackTexture, generateMipMaps) || this;
|
|
12
12
|
_this._groundColor = new Color3(1, 1, 1);
|
|
13
|
-
_this._grassColors = [
|
|
14
|
-
new Color3(0.29, 0.38, 0.02),
|
|
15
|
-
new Color3(0.36, 0.49, 0.09),
|
|
16
|
-
new Color3(0.51, 0.6, 0.28)
|
|
17
|
-
];
|
|
13
|
+
_this._grassColors = [new Color3(0.29, 0.38, 0.02), new Color3(0.36, 0.49, 0.09), new Color3(0.51, 0.6, 0.28)];
|
|
18
14
|
_this.updateShaderUniforms();
|
|
19
15
|
return _this;
|
|
20
16
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grassProceduralTexture.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"grassProceduralTexture.js","sourceRoot":"","sources":["../../../../../lts/proceduralTextures/generated/grass/grassProceduralTexture.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,2CAA6B;AAC9E,OAAO,EAAE,MAAM,EAAE,4CAA8B;AAE/C,OAAO,EAAE,iBAAiB,EAAE,4EAA8D;AAE1F,OAAO,EAAE,aAAa,EAAE,0CAA4B;AAGpD,OAAO,mCAAmC,CAAC;AAE3C;IAA4C,0CAAiB;IAIzD,gCAAY,IAAY,EAAE,IAAY,EAAE,KAA6B,EAAE,eAAyB,EAAE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iBAAiB,GA8E5D;SA9EY,sBAAsB;AAgFnC,aAAa,CAAC,gCAAgC,EAAE,sBAAsB,CAAC,CAAC","sourcesContent":["import { serializeAsColor3, SerializationHelper } from \"core/Misc/decorators\";\r\nimport { Color3 } from \"core/Maths/math.color\";\r\nimport { Texture } from \"core/Materials/Textures/texture\";\r\nimport { ProceduralTexture } from \"core/Materials/Textures/Procedurals/proceduralTexture\";\r\nimport { Scene } from \"core/scene\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport { Nullable } from \"core/types\";\r\n\r\nimport \"./grassProceduralTexture.fragment\";\r\n\r\nexport class GrassProceduralTexture extends ProceduralTexture {\r\n private _grassColors: Color3[];\r\n private _groundColor = new Color3(1, 1, 1);\r\n\r\n constructor(name: string, size: number, scene: Nullable<Scene> = null, fallbackTexture?: Texture, generateMipMaps?: boolean) {\r\n super(name, size, \"grassProceduralTexture\", scene, fallbackTexture, generateMipMaps);\r\n\r\n this._grassColors = [new Color3(0.29, 0.38, 0.02), new Color3(0.36, 0.49, 0.09), new Color3(0.51, 0.6, 0.28)];\r\n\r\n this.updateShaderUniforms();\r\n }\r\n\r\n public updateShaderUniforms() {\r\n this.setColor3(\"herb1Color\", this._grassColors[0]);\r\n this.setColor3(\"herb2Color\", this._grassColors[1]);\r\n this.setColor3(\"herb3Color\", this._grassColors[2]);\r\n this.setColor3(\"groundColor\", this._groundColor);\r\n }\r\n\r\n public get grassColors(): Color3[] {\r\n return this._grassColors;\r\n }\r\n\r\n public set grassColors(value: Color3[]) {\r\n this._grassColors = value;\r\n this.updateShaderUniforms();\r\n }\r\n\r\n @serializeAsColor3()\r\n public get groundColor(): Color3 {\r\n return this._groundColor;\r\n }\r\n\r\n public set groundColor(value: Color3) {\r\n this._groundColor = value;\r\n this.updateShaderUniforms();\r\n }\r\n\r\n /**\r\n * Serializes this grass procedural texture\r\n * @returns a serialized grass procedural texture object\r\n */\r\n public serialize(): any {\r\n const serializationObject = SerializationHelper.Serialize(this, super.serialize());\r\n serializationObject.customType = \"BABYLON.GrassProceduralTexture\";\r\n\r\n serializationObject.grassColors = [];\r\n for (let i = 0; i < this._grassColors.length; i++) {\r\n serializationObject.grassColors.push(this._grassColors[i].asArray());\r\n }\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Creates a Grass Procedural Texture from parsed grass procedural texture data\r\n * @param parsedTexture defines parsed texture data\r\n * @param scene defines the current scene\r\n * @param rootUrl defines the root URL containing grass procedural texture information\r\n * @returns a parsed Grass Procedural Texture\r\n */\r\n public static Parse(parsedTexture: any, scene: Scene, rootUrl: string): GrassProceduralTexture {\r\n const texture = SerializationHelper.Parse(\r\n () => new GrassProceduralTexture(parsedTexture.name, parsedTexture._size, scene, undefined, parsedTexture._generateMipMaps),\r\n parsedTexture,\r\n scene,\r\n rootUrl\r\n );\r\n\r\n const colors: Color3[] = [];\r\n for (let i = 0; i < parsedTexture.grassColors.length; i++) {\r\n colors.push(Color3.FromArray(parsedTexture.grassColors[i]));\r\n }\r\n\r\n texture.grassColors = colors;\r\n\r\n return texture;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.GrassProceduralTexture\", GrassProceduralTexture);\r\n"]}
|
package/grass/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../lts/proceduralTextures/generated/grass/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC","sourcesContent":["export * from \"./grassProceduralTexture\";\r\n"]}
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../lts/proceduralTextures/generated/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC","sourcesContent":["export * from \"./brick/index\";\r\nexport * from \"./cloud/index\";\r\nexport * from \"./fire/index\";\r\nexport * from \"./grass/index\";\r\nexport * from \"./marble/index\";\r\nexport * from \"./normalMap/index\";\r\nexport * from \"./perlinNoise/index\";\r\nexport * from \"./road/index\";\r\nexport * from \"./starfield/index\";\r\nexport * from \"./wood/index\";\r\n"]}
|
package/legacy/legacy-brick.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "
|
|
1
|
+
export * from "./brick/index.js";
|
package/legacy/legacy-brick.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import * as proceduralTexture from "
|
|
1
|
+
import * as proceduralTexture from "./brick/index.js";
|
|
2
2
|
/**
|
|
3
3
|
* This is the entry point for the UMD module.
|
|
4
4
|
* The entry point for a future ESM package should be index.ts
|
|
5
5
|
*/
|
|
6
|
-
var globalObject =
|
|
6
|
+
var globalObject = typeof global !== "undefined" ? global : typeof window !== "undefined" ? window : undefined;
|
|
7
7
|
if (typeof globalObject !== "undefined") {
|
|
8
8
|
for (var key in proceduralTexture) {
|
|
9
9
|
globalObject.BABYLON[key] = proceduralTexture[key];
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
|
-
export * from "
|
|
12
|
+
export * from "./brick/index.js";
|
|
13
13
|
//# sourceMappingURL=legacy-brick.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"legacy-brick.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"legacy-brick.js","sourceRoot":"","sources":["../../../../../lts/proceduralTextures/generated/legacy/legacy-brick.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,iBAAiB,yBAAwC;AAErE;;;GAGG;AACH,IAAM,YAAY,GAAG,OAAO,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;AACjH,IAAI,OAAO,YAAY,KAAK,WAAW,EAAE;IACrC,KAAK,IAAM,GAAG,IAAI,iBAAiB,EAAE;QAC3B,YAAa,CAAC,OAAO,CAAC,GAAG,CAAC,GAAS,iBAAkB,CAAC,GAAG,CAAC,CAAC;KACpE;CACJ;AAED,iCAAgD","sourcesContent":["import * as proceduralTexture from \"procedural-textures/brick/index\";\r\n\r\n/**\r\n * This is the entry point for the UMD module.\r\n * The entry point for a future ESM package should be index.ts\r\n */\r\nconst globalObject = typeof global !== \"undefined\" ? global : typeof window !== \"undefined\" ? window : undefined;\r\nif (typeof globalObject !== \"undefined\") {\r\n for (const key in proceduralTexture) {\r\n (<any>globalObject).BABYLON[key] = (<any>proceduralTexture)[key];\r\n }\r\n}\r\n\r\nexport * from \"procedural-textures/brick/index\";\r\n"]}
|
package/legacy/legacy-cloud.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "
|
|
1
|
+
export * from "./cloud/index.js";
|