@babylonjs/procedural-textures 5.21.0 → 5.23.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.fragment.js +16 -3
- package/brick/brickProceduralTexture.fragment.js.map +1 -1
- package/brick/brickProceduralTexture.js +58 -79
- package/brick/brickProceduralTexture.js.map +1 -1
- package/cloud/cloudProceduralTexture.fragment.js +14 -3
- package/cloud/cloudProceduralTexture.fragment.js.map +1 -1
- package/cloud/cloudProceduralTexture.js +58 -79
- package/cloud/cloudProceduralTexture.js.map +1 -1
- package/fire/fireProceduralTexture.fragment.js +7 -3
- package/fire/fireProceduralTexture.fragment.js.map +1 -1
- package/fire/fireProceduralTexture.js +85 -126
- package/fire/fireProceduralTexture.js.map +1 -1
- package/grass/grassProceduralTexture.fragment.js +12 -3
- package/grass/grassProceduralTexture.fragment.js.map +1 -1
- package/grass/grassProceduralTexture.js +36 -49
- package/grass/grassProceduralTexture.js.map +1 -1
- package/legacy/legacy-brick.js +2 -2
- package/legacy/legacy-brick.js.map +1 -1
- package/legacy/legacy-cloud.js +2 -2
- package/legacy/legacy-cloud.js.map +1 -1
- package/legacy/legacy-fire.js +2 -2
- package/legacy/legacy-fire.js.map +1 -1
- package/legacy/legacy-grass.js +2 -2
- package/legacy/legacy-grass.js.map +1 -1
- package/legacy/legacy-marble.js +2 -2
- package/legacy/legacy-marble.js.map +1 -1
- package/legacy/legacy-normalMap.js +2 -2
- package/legacy/legacy-normalMap.js.map +1 -1
- package/legacy/legacy-perlinNoise.js +2 -2
- package/legacy/legacy-perlinNoise.js.map +1 -1
- package/legacy/legacy-road.js +2 -2
- package/legacy/legacy-road.js.map +1 -1
- package/legacy/legacy-starfield.js +2 -2
- package/legacy/legacy-starfield.js.map +1 -1
- package/legacy/legacy-wood.js +2 -2
- package/legacy/legacy-wood.js.map +1 -1
- package/legacy/legacy.js +2 -2
- package/legacy/legacy.js.map +1 -1
- package/marble/marbleProceduralTexture.fragment.js +3 -3
- package/marble/marbleProceduralTexture.fragment.js.map +1 -1
- package/marble/marbleProceduralTexture.js +58 -79
- package/marble/marbleProceduralTexture.js.map +1 -1
- package/normalMap/normalMapProceduralTexture.fragment.js +7 -3
- package/normalMap/normalMapProceduralTexture.fragment.js.map +1 -1
- package/normalMap/normalMapProceduralTexture.js +33 -42
- package/normalMap/normalMapProceduralTexture.js.map +1 -1
- package/package.json +3 -6
- package/perlinNoise/perlinNoiseProceduralTexture.fragment.js +41 -3
- package/perlinNoise/perlinNoiseProceduralTexture.fragment.js.map +1 -1
- package/perlinNoise/perlinNoiseProceduralTexture.js +35 -40
- package/perlinNoise/perlinNoiseProceduralTexture.js.map +1 -1
- package/road/roadProceduralTexture.fragment.js +13 -3
- package/road/roadProceduralTexture.fragment.js.map +1 -1
- package/road/roadProceduralTexture.js +25 -34
- package/road/roadProceduralTexture.js.map +1 -1
- package/starfield/starfieldProceduralTexture.fragment.js +18 -3
- package/starfield/starfieldProceduralTexture.fragment.js.map +1 -1
- package/starfield/starfieldProceduralTexture.js +136 -185
- package/starfield/starfieldProceduralTexture.js.map +1 -1
- package/wood/woodProceduralTexture.fragment.js +12 -3
- package/wood/woodProceduralTexture.fragment.js.map +1 -1
- package/wood/woodProceduralTexture.js +36 -49
- package/wood/woodProceduralTexture.js.map +1 -1
|
@@ -4,9 +4,9 @@ import * as proceduralTexture from "../normalMap/index.js";
|
|
|
4
4
|
* This is the entry point for the UMD module.
|
|
5
5
|
* The entry point for a future ESM package should be index.ts
|
|
6
6
|
*/
|
|
7
|
-
|
|
7
|
+
const globalObject = typeof global !== "undefined" ? global : typeof window !== "undefined" ? window : undefined;
|
|
8
8
|
if (typeof globalObject !== "undefined") {
|
|
9
|
-
for (
|
|
9
|
+
for (const key in proceduralTexture) {
|
|
10
10
|
globalObject.BABYLON[key] = proceduralTexture[key];
|
|
11
11
|
}
|
|
12
12
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"legacy-normalMap.js","sourceRoot":"","sources":["../../../../../lts/proceduralTextures/generated/legacy/legacy-normalMap.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,OAAO,KAAK,iBAAiB,MAAM,oBAAoB,CAAC;AACxD;;;GAGG;AACH,
|
|
1
|
+
{"version":3,"file":"legacy-normalMap.js","sourceRoot":"","sources":["../../../../../lts/proceduralTextures/generated/legacy/legacy-normalMap.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,OAAO,KAAK,iBAAiB,MAAM,oBAAoB,CAAC;AACxD;;;GAGG;AACH,MAAM,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,MAAM,GAAG,IAAI,iBAAiB,EAAE;QAC3B,YAAa,CAAC,OAAO,CAAC,GAAG,CAAC,GAAS,iBAAkB,CAAC,GAAG,CAAC,CAAC;KACpE;CACJ;AACD,cAAc,oBAAoB,CAAC","sourcesContent":["/* eslint-disable import/no-internal-modules */\nimport * as proceduralTexture from \"../normalMap/index\";\n/**\n * This is the entry point for the UMD module.\n * The entry point for a future ESM package should be index.ts\n */\nconst globalObject = typeof global !== \"undefined\" ? global : typeof window !== \"undefined\" ? window : undefined;\nif (typeof globalObject !== \"undefined\") {\n for (const key in proceduralTexture) {\n (<any>globalObject).BABYLON[key] = (<any>proceduralTexture)[key];\n }\n}\nexport * from \"../normalMap/index\";\n"]}
|
|
@@ -4,9 +4,9 @@ import * as proceduralTexture from "../perlinNoise/index.js";
|
|
|
4
4
|
* This is the entry point for the UMD module.
|
|
5
5
|
* The entry point for a future ESM package should be index.ts
|
|
6
6
|
*/
|
|
7
|
-
|
|
7
|
+
const globalObject = typeof global !== "undefined" ? global : typeof window !== "undefined" ? window : undefined;
|
|
8
8
|
if (typeof globalObject !== "undefined") {
|
|
9
|
-
for (
|
|
9
|
+
for (const key in proceduralTexture) {
|
|
10
10
|
globalObject.BABYLON[key] = proceduralTexture[key];
|
|
11
11
|
}
|
|
12
12
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"legacy-perlinNoise.js","sourceRoot":"","sources":["../../../../../lts/proceduralTextures/generated/legacy/legacy-perlinNoise.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,OAAO,KAAK,iBAAiB,MAAM,sBAAsB,CAAC;AAC1D;;;GAGG;AACH,
|
|
1
|
+
{"version":3,"file":"legacy-perlinNoise.js","sourceRoot":"","sources":["../../../../../lts/proceduralTextures/generated/legacy/legacy-perlinNoise.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,OAAO,KAAK,iBAAiB,MAAM,sBAAsB,CAAC;AAC1D;;;GAGG;AACH,MAAM,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,MAAM,GAAG,IAAI,iBAAiB,EAAE;QAC3B,YAAa,CAAC,OAAO,CAAC,GAAG,CAAC,GAAS,iBAAkB,CAAC,GAAG,CAAC,CAAC;KACpE;CACJ;AACD,cAAc,sBAAsB,CAAC","sourcesContent":["/* eslint-disable import/no-internal-modules */\nimport * as proceduralTexture from \"../perlinNoise/index\";\n/**\n * This is the entry point for the UMD module.\n * The entry point for a future ESM package should be index.ts\n */\nconst globalObject = typeof global !== \"undefined\" ? global : typeof window !== \"undefined\" ? window : undefined;\nif (typeof globalObject !== \"undefined\") {\n for (const key in proceduralTexture) {\n (<any>globalObject).BABYLON[key] = (<any>proceduralTexture)[key];\n }\n}\nexport * from \"../perlinNoise/index\";\n"]}
|
package/legacy/legacy-road.js
CHANGED
|
@@ -4,9 +4,9 @@ import * as proceduralTexture from "../road/index.js";
|
|
|
4
4
|
* This is the entry point for the UMD module.
|
|
5
5
|
* The entry point for a future ESM package should be index.ts
|
|
6
6
|
*/
|
|
7
|
-
|
|
7
|
+
const globalObject = typeof global !== "undefined" ? global : typeof window !== "undefined" ? window : undefined;
|
|
8
8
|
if (typeof globalObject !== "undefined") {
|
|
9
|
-
for (
|
|
9
|
+
for (const key in proceduralTexture) {
|
|
10
10
|
globalObject.BABYLON[key] = proceduralTexture[key];
|
|
11
11
|
}
|
|
12
12
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"legacy-road.js","sourceRoot":"","sources":["../../../../../lts/proceduralTextures/generated/legacy/legacy-road.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,OAAO,KAAK,iBAAiB,MAAM,eAAe,CAAC;AACnD;;;GAGG;AACH,
|
|
1
|
+
{"version":3,"file":"legacy-road.js","sourceRoot":"","sources":["../../../../../lts/proceduralTextures/generated/legacy/legacy-road.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,OAAO,KAAK,iBAAiB,MAAM,eAAe,CAAC;AACnD;;;GAGG;AACH,MAAM,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,MAAM,GAAG,IAAI,iBAAiB,EAAE;QAC3B,YAAa,CAAC,OAAO,CAAC,GAAG,CAAC,GAAS,iBAAkB,CAAC,GAAG,CAAC,CAAC;KACpE;CACJ;AACD,cAAc,eAAe,CAAC","sourcesContent":["/* eslint-disable import/no-internal-modules */\nimport * as proceduralTexture from \"../road/index\";\n/**\n * This is the entry point for the UMD module.\n * The entry point for a future ESM package should be index.ts\n */\nconst globalObject = typeof global !== \"undefined\" ? global : typeof window !== \"undefined\" ? window : undefined;\nif (typeof globalObject !== \"undefined\") {\n for (const key in proceduralTexture) {\n (<any>globalObject).BABYLON[key] = (<any>proceduralTexture)[key];\n }\n}\nexport * from \"../road/index\";\n"]}
|
|
@@ -4,9 +4,9 @@ import * as proceduralTexture from "../starfield/index.js";
|
|
|
4
4
|
* This is the entry point for the UMD module.
|
|
5
5
|
* The entry point for a future ESM package should be index.ts
|
|
6
6
|
*/
|
|
7
|
-
|
|
7
|
+
const globalObject = typeof global !== "undefined" ? global : typeof window !== "undefined" ? window : undefined;
|
|
8
8
|
if (typeof globalObject !== "undefined") {
|
|
9
|
-
for (
|
|
9
|
+
for (const key in proceduralTexture) {
|
|
10
10
|
globalObject.BABYLON[key] = proceduralTexture[key];
|
|
11
11
|
}
|
|
12
12
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"legacy-starfield.js","sourceRoot":"","sources":["../../../../../lts/proceduralTextures/generated/legacy/legacy-starfield.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,OAAO,KAAK,iBAAiB,MAAM,oBAAoB,CAAC;AACxD;;;GAGG;AACH,
|
|
1
|
+
{"version":3,"file":"legacy-starfield.js","sourceRoot":"","sources":["../../../../../lts/proceduralTextures/generated/legacy/legacy-starfield.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,OAAO,KAAK,iBAAiB,MAAM,oBAAoB,CAAC;AACxD;;;GAGG;AACH,MAAM,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,MAAM,GAAG,IAAI,iBAAiB,EAAE;QAC3B,YAAa,CAAC,OAAO,CAAC,GAAG,CAAC,GAAS,iBAAkB,CAAC,GAAG,CAAC,CAAC;KACpE;CACJ;AACD,cAAc,oBAAoB,CAAC","sourcesContent":["/* eslint-disable import/no-internal-modules */\nimport * as proceduralTexture from \"../starfield/index\";\n/**\n * This is the entry point for the UMD module.\n * The entry point for a future ESM package should be index.ts\n */\nconst globalObject = typeof global !== \"undefined\" ? global : typeof window !== \"undefined\" ? window : undefined;\nif (typeof globalObject !== \"undefined\") {\n for (const key in proceduralTexture) {\n (<any>globalObject).BABYLON[key] = (<any>proceduralTexture)[key];\n }\n}\nexport * from \"../starfield/index\";\n"]}
|
package/legacy/legacy-wood.js
CHANGED
|
@@ -4,9 +4,9 @@ import * as proceduralTexture from "../wood/index.js";
|
|
|
4
4
|
* This is the entry point for the UMD module.
|
|
5
5
|
* The entry point for a future ESM package should be index.ts
|
|
6
6
|
*/
|
|
7
|
-
|
|
7
|
+
const globalObject = typeof global !== "undefined" ? global : typeof window !== "undefined" ? window : undefined;
|
|
8
8
|
if (typeof globalObject !== "undefined") {
|
|
9
|
-
for (
|
|
9
|
+
for (const key in proceduralTexture) {
|
|
10
10
|
globalObject.BABYLON[key] = proceduralTexture[key];
|
|
11
11
|
}
|
|
12
12
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"legacy-wood.js","sourceRoot":"","sources":["../../../../../lts/proceduralTextures/generated/legacy/legacy-wood.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,OAAO,KAAK,iBAAiB,MAAM,eAAe,CAAC;AACnD;;;GAGG;AACH,
|
|
1
|
+
{"version":3,"file":"legacy-wood.js","sourceRoot":"","sources":["../../../../../lts/proceduralTextures/generated/legacy/legacy-wood.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,OAAO,KAAK,iBAAiB,MAAM,eAAe,CAAC;AACnD;;;GAGG;AACH,MAAM,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,MAAM,GAAG,IAAI,iBAAiB,EAAE;QAC3B,YAAa,CAAC,OAAO,CAAC,GAAG,CAAC,GAAS,iBAAkB,CAAC,GAAG,CAAC,CAAC;KACpE;CACJ;AACD,cAAc,eAAe,CAAC","sourcesContent":["/* eslint-disable import/no-internal-modules */\nimport * as proceduralTexture from \"../wood/index\";\n/**\n * This is the entry point for the UMD module.\n * The entry point for a future ESM package should be index.ts\n */\nconst globalObject = typeof global !== \"undefined\" ? global : typeof window !== \"undefined\" ? window : undefined;\nif (typeof globalObject !== \"undefined\") {\n for (const key in proceduralTexture) {\n (<any>globalObject).BABYLON[key] = (<any>proceduralTexture)[key];\n }\n}\nexport * from \"../wood/index\";\n"]}
|
package/legacy/legacy.js
CHANGED
|
@@ -6,10 +6,10 @@ import * as ProceduralTexturesLib from "../index.js";
|
|
|
6
6
|
* This is the entry point for the UMD module.
|
|
7
7
|
* The entry point for a future ESM package should be index.ts
|
|
8
8
|
*/
|
|
9
|
-
|
|
9
|
+
const globalObject = typeof global !== "undefined" ? global : typeof window !== "undefined" ? window : undefined;
|
|
10
10
|
if (typeof globalObject !== "undefined") {
|
|
11
11
|
globalObject.BABYLON = globalObject.BABYLON || {};
|
|
12
|
-
for (
|
|
12
|
+
for (const mat in ProceduralTexturesLib) {
|
|
13
13
|
globalObject.BABYLON[mat] = ProceduralTexturesLib[mat];
|
|
14
14
|
}
|
|
15
15
|
}
|
package/legacy/legacy.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"legacy.js","sourceRoot":"","sources":["../../../../../lts/proceduralTextures/generated/legacy/legacy.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,OAAO,KAAK,qBAAqB,MAAM,UAAU,CAAC;AAClD;;;;;GAKG;AACH,
|
|
1
|
+
{"version":3,"file":"legacy.js","sourceRoot":"","sources":["../../../../../lts/proceduralTextures/generated/legacy/legacy.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,OAAO,KAAK,qBAAqB,MAAM,UAAU,CAAC;AAClD;;;;;GAKG;AACH,MAAM,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;IAC/B,YAAa,CAAC,OAAO,GAAS,YAAa,CAAC,OAAO,IAAI,EAAE,CAAC;IAChE,KAAK,MAAM,GAAG,IAAI,qBAAqB,EAAE;QAC/B,YAAa,CAAC,OAAO,CAAC,GAAG,CAAC,GAAS,qBAAsB,CAAC,GAAG,CAAC,CAAC;KACxE;CACJ;AACD,cAAc,UAAU,CAAC","sourcesContent":["/* eslint-disable import/no-internal-modules */\nimport * as ProceduralTexturesLib from \"../index\";\n/**\n * Legacy support, defining window.BABYLON.GridMaterial... (global variable).\n *\n * This is the entry point for the UMD module.\n * The entry point for a future ESM package should be index.ts\n */\nconst globalObject = typeof global !== \"undefined\" ? global : typeof window !== \"undefined\" ? window : undefined;\nif (typeof globalObject !== \"undefined\") {\n (<any>globalObject).BABYLON = (<any>globalObject).BABYLON || {};\n for (const mat in ProceduralTexturesLib) {\n (<any>globalObject).BABYLON[mat] = (<any>ProceduralTexturesLib)[mat];\n }\n}\nexport * from \"../index\";\n"]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// Do not edit.
|
|
2
2
|
import { ShaderStore } from "@babylonjs/core/Engines/shaderStore.js";
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
const name = "marbleProceduralTexturePixelShader";
|
|
4
|
+
const shader = `precision highp float;
|
|
5
5
|
// Sideeffect
|
|
6
6
|
ShaderStore.ShadersStore[name] = shader;
|
|
7
7
|
/** @hidden */
|
|
8
|
-
export
|
|
8
|
+
export const marbleProceduralTexturePixelShader = { name, shader };
|
|
9
9
|
//# sourceMappingURL=marbleProceduralTexture.fragment.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"marbleProceduralTexture.fragment.js","sourceRoot":"","sources":["../../../../../lts/proceduralTextures/generated/marble/marbleProceduralTexture.fragment.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,+CAAiC;AAEvD,
|
|
1
|
+
{"version":3,"file":"marbleProceduralTexture.fragment.js","sourceRoot":"","sources":["../../../../../lts/proceduralTextures/generated/marble/marbleProceduralTexture.fragment.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,+CAAiC;AAEvD,MAAM,IAAI,GAAG,oCAAoC,CAAC;AAClD,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuEb,CAAC;AACH,aAAa;AACb,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACxC,cAAc;AACd,MAAM,CAAC,MAAM,kCAAkC,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"core/Engines/shaderStore\";\n\nconst name = \"marbleProceduralTexturePixelShader\";\nconst shader = `precision highp float;\rvarying vec2 vPosition;\rvarying vec2 vUV;\runiform float numberOfTilesHeight;\runiform float numberOfTilesWidth;\runiform float amplitude;\runiform vec3 marbleColor;\runiform vec3 jointColor;\rconst vec3 tileSize=vec3(1.1,1.0,1.1);\rconst vec3 tilePct=vec3(0.98,1.0,0.98);\rfloat rand(vec2 n) {\rreturn fract(cos(dot(n,vec2(12.9898,4.1414)))*43758.5453);\r}\rfloat noise(vec2 n) {\rconst vec2 d=vec2(0.0,1.0);\rvec2 b=floor(n),f=smoothstep(vec2(0.0),vec2(1.0),fract(n));\rreturn mix(mix(rand(b),rand(b+d.yx),f.x),mix(rand(b+d.xy),rand(b+d.yy),f.x),f.y);\r}\rfloat turbulence(vec2 P)\r{\rfloat val=0.0;\rfloat freq=1.0;\rfor (int i=0; i<4; i++)\r{\rval+=abs(noise(P*freq)/freq);\rfreq*=2.07;\r}\rreturn val;\r}\rfloat roundF(float number){\rreturn sign(number)*floor(abs(number)+0.5);\r}\rvec3 marble_color(float x)\r{\rvec3 col;\rx=0.5*(x+1.);\rx=sqrt(x); \rx=sqrt(x);\rx=sqrt(x);\rcol=vec3(.2+.75*x); \rcol.b*=0.95; \rreturn col;\r}\rvoid main()\r{\rfloat brickW=1.0/numberOfTilesWidth;\rfloat brickH=1.0/numberOfTilesHeight;\rfloat jointWPercentage=0.01;\rfloat jointHPercentage=0.01;\rvec3 color=marbleColor;\rfloat yi=vUV.y/brickH;\rfloat nyi=roundF(yi);\rfloat xi=vUV.x/brickW;\rif (mod(floor(yi),2.0)==0.0){\rxi=xi-0.5;\r}\rfloat nxi=roundF(xi);\rvec2 brickvUV=vec2((xi-floor(xi))/brickH,(yi-floor(yi))/brickW);\rif (yi<nyi+jointHPercentage && yi>nyi-jointHPercentage){\rcolor=mix(jointColor,vec3(0.37,0.25,0.25),(yi-nyi)/jointHPercentage+0.2);\r}\relse if (xi<nxi+jointWPercentage && xi>nxi-jointWPercentage){\rcolor=mix(jointColor,vec3(0.44,0.44,0.44),(xi-nxi)/jointWPercentage+0.2);\r}\relse {\rfloat t=6.28*brickvUV.x/(tileSize.x+noise(vec2(vUV)*6.0));\rt+=amplitude*turbulence(brickvUV.xy);\rt=sin(t);\rcolor=marble_color(t);\r}\rgl_FragColor=vec4(color,0.0);\r}`;\n// Sideeffect\nShaderStore.ShadersStore[name] = shader;\n/** @hidden */\nexport const marbleProceduralTexturePixelShader = { name, shader };\n"]}
|
|
@@ -1,80 +1,61 @@
|
|
|
1
|
-
import { __decorate
|
|
1
|
+
import { __decorate } from "@babylonjs/core/tslib.es6.js";
|
|
2
2
|
import { serialize, 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
5
|
import { RegisterClass } from "@babylonjs/core/Misc/typeStore.js";
|
|
6
6
|
import "./marbleProceduralTexture.fragment.js";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
_this._jointColor = new Color3(0.72, 0.72, 0.72);
|
|
16
|
-
_this.updateShaderUniforms();
|
|
17
|
-
return _this;
|
|
7
|
+
export class MarbleProceduralTexture extends ProceduralTexture {
|
|
8
|
+
constructor(name, size, scene = null, fallbackTexture, generateMipMaps) {
|
|
9
|
+
super(name, size, "marbleProceduralTexture", scene, fallbackTexture, generateMipMaps);
|
|
10
|
+
this._numberOfTilesHeight = 3;
|
|
11
|
+
this._numberOfTilesWidth = 3;
|
|
12
|
+
this._amplitude = 9.0;
|
|
13
|
+
this._jointColor = new Color3(0.72, 0.72, 0.72);
|
|
14
|
+
this.updateShaderUniforms();
|
|
18
15
|
}
|
|
19
|
-
|
|
16
|
+
updateShaderUniforms() {
|
|
20
17
|
this.setFloat("numberOfTilesHeight", this._numberOfTilesHeight);
|
|
21
18
|
this.setFloat("numberOfTilesWidth", this._numberOfTilesWidth);
|
|
22
19
|
this.setFloat("amplitude", this._amplitude);
|
|
23
20
|
this.setColor3("jointColor", this._jointColor);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
this.updateShaderUniforms();
|
|
54
|
-
},
|
|
55
|
-
enumerable: false,
|
|
56
|
-
configurable: true
|
|
57
|
-
});
|
|
58
|
-
Object.defineProperty(MarbleProceduralTexture.prototype, "jointColor", {
|
|
59
|
-
get: function () {
|
|
60
|
-
return this._jointColor;
|
|
61
|
-
},
|
|
62
|
-
set: function (value) {
|
|
63
|
-
this._jointColor = value;
|
|
64
|
-
this.updateShaderUniforms();
|
|
65
|
-
},
|
|
66
|
-
enumerable: false,
|
|
67
|
-
configurable: true
|
|
68
|
-
});
|
|
21
|
+
}
|
|
22
|
+
get numberOfTilesHeight() {
|
|
23
|
+
return this._numberOfTilesHeight;
|
|
24
|
+
}
|
|
25
|
+
set numberOfTilesHeight(value) {
|
|
26
|
+
this._numberOfTilesHeight = value;
|
|
27
|
+
this.updateShaderUniforms();
|
|
28
|
+
}
|
|
29
|
+
get amplitude() {
|
|
30
|
+
return this._amplitude;
|
|
31
|
+
}
|
|
32
|
+
set amplitude(value) {
|
|
33
|
+
this._amplitude = value;
|
|
34
|
+
this.updateShaderUniforms();
|
|
35
|
+
}
|
|
36
|
+
get numberOfTilesWidth() {
|
|
37
|
+
return this._numberOfTilesWidth;
|
|
38
|
+
}
|
|
39
|
+
set numberOfTilesWidth(value) {
|
|
40
|
+
this._numberOfTilesWidth = value;
|
|
41
|
+
this.updateShaderUniforms();
|
|
42
|
+
}
|
|
43
|
+
get jointColor() {
|
|
44
|
+
return this._jointColor;
|
|
45
|
+
}
|
|
46
|
+
set jointColor(value) {
|
|
47
|
+
this._jointColor = value;
|
|
48
|
+
this.updateShaderUniforms();
|
|
49
|
+
}
|
|
69
50
|
/**
|
|
70
51
|
* Serializes this marble procedural texture
|
|
71
52
|
* @returns a serialized marble procedural texture object
|
|
72
53
|
*/
|
|
73
|
-
|
|
74
|
-
|
|
54
|
+
serialize() {
|
|
55
|
+
const serializationObject = SerializationHelper.Serialize(this, super.serialize());
|
|
75
56
|
serializationObject.customType = "BABYLON.MarbleProceduralTexture";
|
|
76
57
|
return serializationObject;
|
|
77
|
-
}
|
|
58
|
+
}
|
|
78
59
|
/**
|
|
79
60
|
* Creates a Marble Procedural Texture from parsed marble procedural texture data
|
|
80
61
|
* @param parsedTexture defines parsed texture data
|
|
@@ -82,24 +63,22 @@ var MarbleProceduralTexture = /** @class */ (function (_super) {
|
|
|
82
63
|
* @param rootUrl defines the root URL containing marble procedural texture information
|
|
83
64
|
* @returns a parsed Marble Procedural Texture
|
|
84
65
|
*/
|
|
85
|
-
|
|
86
|
-
|
|
66
|
+
static Parse(parsedTexture, scene, rootUrl) {
|
|
67
|
+
const texture = SerializationHelper.Parse(() => new MarbleProceduralTexture(parsedTexture.name, parsedTexture._size, scene, undefined, parsedTexture._generateMipMaps), parsedTexture, scene, rootUrl);
|
|
87
68
|
return texture;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
}(ProceduralTexture));
|
|
103
|
-
export { MarbleProceduralTexture };
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
__decorate([
|
|
72
|
+
serialize()
|
|
73
|
+
], MarbleProceduralTexture.prototype, "numberOfTilesHeight", null);
|
|
74
|
+
__decorate([
|
|
75
|
+
serialize()
|
|
76
|
+
], MarbleProceduralTexture.prototype, "amplitude", null);
|
|
77
|
+
__decorate([
|
|
78
|
+
serialize()
|
|
79
|
+
], MarbleProceduralTexture.prototype, "numberOfTilesWidth", null);
|
|
80
|
+
__decorate([
|
|
81
|
+
serialize()
|
|
82
|
+
], MarbleProceduralTexture.prototype, "jointColor", null);
|
|
104
83
|
RegisterClass("BABYLON.MarbleProceduralTexture", MarbleProceduralTexture);
|
|
105
84
|
//# sourceMappingURL=marbleProceduralTexture.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"marbleProceduralTexture.js","sourceRoot":"","sources":["../../../../../lts/proceduralTextures/generated/marble/marbleProceduralTexture.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,2CAA6B;AACtE,OAAO,EAAE,MAAM,EAAE,4CAA8B;AAE/C,OAAO,EAAE,iBAAiB,EAAE,4EAA8D;AAE1F,OAAO,EAAE,aAAa,EAAE,0CAA4B;AAGpD,OAAO,oCAAoC,CAAC;AAE5C
|
|
1
|
+
{"version":3,"file":"marbleProceduralTexture.js","sourceRoot":"","sources":["../../../../../lts/proceduralTextures/generated/marble/marbleProceduralTexture.ts"],"names":[],"mappings":"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","sourcesContent":["import { serialize, SerializationHelper } from \"core/Misc/decorators\";\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,9 +1,13 @@
|
|
|
1
1
|
// Do not edit.
|
|
2
2
|
import { ShaderStore } from "@babylonjs/core/Engines/shaderStore.js";
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
const name = "normalMapProceduralTexturePixelShader";
|
|
4
|
+
const shader = `precision highp float;uniform sampler2D baseSampler;uniform float size;varying vec2 vUV;const vec3 LUMA_COEFFICIENT=vec3(0.2126,0.7152,0.0722);float lumaAtCoord(vec2 coord)
|
|
5
|
+
{vec3 pixel=texture2D(baseSampler,coord).rgb;float luma=dot(pixel,LUMA_COEFFICIENT);return luma;}
|
|
6
|
+
void main()
|
|
7
|
+
{float lumaU0=lumaAtCoord(vUV+vec2(-1.0, 0.0)/size);float lumaU1=lumaAtCoord(vUV+vec2( 1.0, 0.0)/size);float lumaV0=lumaAtCoord(vUV+vec2( 0.0,-1.0)/size);float lumaV1=lumaAtCoord(vUV+vec2( 0.0, 1.0)/size);vec2 slope=(vec2(lumaU0-lumaU1,lumaV0-lumaV1)+1.0)*0.5;gl_FragColor=vec4(slope,1.0,1.0);}
|
|
8
|
+
`;
|
|
5
9
|
// Sideeffect
|
|
6
10
|
ShaderStore.ShadersStore[name] = shader;
|
|
7
11
|
/** @hidden */
|
|
8
|
-
export
|
|
12
|
+
export const normalMapProceduralTexturePixelShader = { name, shader };
|
|
9
13
|
//# sourceMappingURL=normalMapProceduralTexture.fragment.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalMapProceduralTexture.fragment.js","sourceRoot":"","sources":["../../../../../lts/proceduralTextures/generated/normalMap/normalMapProceduralTexture.fragment.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,+CAAiC;AAEvD,
|
|
1
|
+
{"version":3,"file":"normalMapProceduralTexture.fragment.js","sourceRoot":"","sources":["../../../../../lts/proceduralTextures/generated/normalMap/normalMapProceduralTexture.fragment.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,+CAAiC;AAEvD,MAAM,IAAI,GAAG,uCAAuC,CAAC;AACrD,MAAM,MAAM,GAAG;;;;CAId,CAAC;AACF,aAAa;AACb,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACxC,cAAc;AACd,MAAM,CAAC,MAAM,qCAAqC,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"core/Engines/shaderStore\";\n\nconst name = \"normalMapProceduralTexturePixelShader\";\nconst shader = `precision highp float;uniform sampler2D baseSampler;uniform float size;varying vec2 vUV;const vec3 LUMA_COEFFICIENT=vec3(0.2126,0.7152,0.0722);float lumaAtCoord(vec2 coord)\n{vec3 pixel=texture2D(baseSampler,coord).rgb;float luma=dot(pixel,LUMA_COEFFICIENT);return luma;}\nvoid main()\n{float lumaU0=lumaAtCoord(vUV+vec2(-1.0, 0.0)/size);float lumaU1=lumaAtCoord(vUV+vec2( 1.0, 0.0)/size);float lumaV0=lumaAtCoord(vUV+vec2( 0.0,-1.0)/size);float lumaV1=lumaAtCoord(vUV+vec2( 0.0, 1.0)/size);vec2 slope=(vec2(lumaU0-lumaU1,lumaV0-lumaV1)+1.0)*0.5;gl_FragColor=vec4(slope,1.0,1.0);}\n`;\n// Sideeffect\nShaderStore.ShadersStore[name] = shader;\n/** @hidden */\nexport const normalMapProceduralTexturePixelShader = { name, shader };\n"]}
|
|
@@ -1,54 +1,47 @@
|
|
|
1
|
-
import { __decorate
|
|
1
|
+
import { __decorate } from "@babylonjs/core/tslib.es6.js";
|
|
2
2
|
import { serializeAsTexture, SerializationHelper } from "@babylonjs/core/Misc/decorators.js";
|
|
3
3
|
import { ProceduralTexture } from "@babylonjs/core/Materials/Textures/Procedurals/proceduralTexture.js";
|
|
4
4
|
import { RegisterClass } from "@babylonjs/core/Misc/typeStore.js";
|
|
5
5
|
import "./normalMapProceduralTexture.fragment.js";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var _this = _super.call(this, name, size, "normalMapProceduralTexture", scene, fallbackTexture, generateMipMaps) || this;
|
|
11
|
-
_this.updateShaderUniforms();
|
|
12
|
-
return _this;
|
|
6
|
+
export class NormalMapProceduralTexture extends ProceduralTexture {
|
|
7
|
+
constructor(name, size, scene = null, fallbackTexture, generateMipMaps) {
|
|
8
|
+
super(name, size, "normalMapProceduralTexture", scene, fallbackTexture, generateMipMaps);
|
|
9
|
+
this.updateShaderUniforms();
|
|
13
10
|
}
|
|
14
|
-
|
|
11
|
+
updateShaderUniforms() {
|
|
15
12
|
this.setTexture("baseSampler", this._baseTexture);
|
|
16
13
|
this.setFloat("size", this.getRenderSize());
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
|
|
14
|
+
}
|
|
15
|
+
render(useCameraPostProcess) {
|
|
16
|
+
super.render(useCameraPostProcess);
|
|
17
|
+
}
|
|
18
|
+
resize(size, generateMipMaps) {
|
|
19
|
+
super.resize(size, generateMipMaps);
|
|
23
20
|
// We need to update the "size" uniform
|
|
24
21
|
this.updateShaderUniforms();
|
|
25
|
-
}
|
|
26
|
-
|
|
22
|
+
}
|
|
23
|
+
isReady() {
|
|
27
24
|
if (!this._baseTexture || !this._baseTexture.isReady()) {
|
|
28
25
|
return false;
|
|
29
26
|
}
|
|
30
|
-
return
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
},
|
|
40
|
-
enumerable: false,
|
|
41
|
-
configurable: true
|
|
42
|
-
});
|
|
27
|
+
return super.isReady();
|
|
28
|
+
}
|
|
29
|
+
get baseTexture() {
|
|
30
|
+
return this._baseTexture;
|
|
31
|
+
}
|
|
32
|
+
set baseTexture(texture) {
|
|
33
|
+
this._baseTexture = texture;
|
|
34
|
+
this.updateShaderUniforms();
|
|
35
|
+
}
|
|
43
36
|
/**
|
|
44
37
|
* Serializes this normal map procedural texture
|
|
45
38
|
* @returns a serialized normal map procedural texture object
|
|
46
39
|
*/
|
|
47
|
-
|
|
48
|
-
|
|
40
|
+
serialize() {
|
|
41
|
+
const serializationObject = SerializationHelper.Serialize(this, super.serialize());
|
|
49
42
|
serializationObject.customType = "BABYLON.NormalMapProceduralTexture";
|
|
50
43
|
return serializationObject;
|
|
51
|
-
}
|
|
44
|
+
}
|
|
52
45
|
/**
|
|
53
46
|
* Creates a Normal Map Procedural Texture from parsed normal map procedural texture data
|
|
54
47
|
* @param parsedTexture defines parsed texture data
|
|
@@ -56,15 +49,13 @@ var NormalMapProceduralTexture = /** @class */ (function (_super) {
|
|
|
56
49
|
* @param rootUrl defines the root URL containing normal map procedural texture information
|
|
57
50
|
* @returns a parsed Normal Map Procedural Texture
|
|
58
51
|
*/
|
|
59
|
-
|
|
60
|
-
|
|
52
|
+
static Parse(parsedTexture, scene, rootUrl) {
|
|
53
|
+
const texture = SerializationHelper.Parse(() => new NormalMapProceduralTexture(parsedTexture.name, parsedTexture._size, scene, undefined, parsedTexture._generateMipMaps), parsedTexture, scene, rootUrl);
|
|
61
54
|
return texture;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
}(ProceduralTexture));
|
|
68
|
-
export { NormalMapProceduralTexture };
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
__decorate([
|
|
58
|
+
serializeAsTexture()
|
|
59
|
+
], NormalMapProceduralTexture.prototype, "baseTexture", null);
|
|
69
60
|
RegisterClass("BABYLON.NormalMapProceduralTexture", NormalMapProceduralTexture);
|
|
70
61
|
//# sourceMappingURL=normalMapProceduralTexture.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalMapProceduralTexture.js","sourceRoot":"","sources":["../../../../../lts/proceduralTextures/generated/normalMap/normalMapProceduralTexture.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,2CAA6B;AAE/E,OAAO,EAAE,iBAAiB,EAAE,4EAA8D;AAE1F,OAAO,EAAE,aAAa,EAAE,0CAA4B;AAEpD,OAAO,uCAAuC,CAAC;AAE/C
|
|
1
|
+
{"version":3,"file":"normalMapProceduralTexture.js","sourceRoot":"","sources":["../../../../../lts/proceduralTextures/generated/normalMap/normalMapProceduralTexture.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,2CAA6B;AAE/E,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,CAAC,oBAAoB,CAAC,CAAC;IACvC,CAAC;IAEM,MAAM,CAAC,IAAS,EAAE,eAAoB;QACzC,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC;QAEpC,uCAAuC;QACvC,IAAI,CAAC,oBAAoB,EAAE,CAAC;IAChC,CAAC;IAEM,OAAO;QACV,IAAI,CAAC,IAAI,CAAC,YAAY,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,EAAE;YACpD,OAAO,KAAK,CAAC;SAChB;QAED,OAAO,KAAK,CAAC,OAAO,EAAE,CAAC;IAC3B,CAAC;IAGD,IAAW,WAAW;QAClB,OAAO,IAAI,CAAC,YAAY,CAAC;IAC7B,CAAC;IAED,IAAW,WAAW,CAAC,OAAgB;QACnC,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC;QAC5B,IAAI,CAAC,oBAAoB,EAAE,CAAC;IAChC,CAAC;IAED;;;OAGG;IACI,SAAS;QACZ,MAAM,mBAAmB,GAAG,mBAAmB,CAAC,SAAS,CAAC,IAAI,EAAE,KAAK,CAAC,SAAS,EAAE,CAAC,CAAC;QACnF,mBAAmB,CAAC,UAAU,GAAG,oCAAoC,CAAC;QAEtE,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,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;AArCG;IADC,kBAAkB,EAAE;6DAGpB;AAqCL,aAAa,CAAC,oCAAoC,EAAE,0BAA0B,CAAC,CAAC","sourcesContent":["import { serializeAsTexture, SerializationHelper } from \"core/Misc/decorators\";\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": "5.
|
|
3
|
+
"version": "5.23.0",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"module": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -18,18 +18,15 @@
|
|
|
18
18
|
"postcompile": "build-tools -c add-js-to-es6",
|
|
19
19
|
"prepublishOnly": "build-tools -c prepare-es6-build"
|
|
20
20
|
},
|
|
21
|
-
"dependencies": {
|
|
22
|
-
"tslib": "^2.4.0"
|
|
23
|
-
},
|
|
24
21
|
"devDependencies": {
|
|
25
|
-
"@babylonjs/core": "^5.
|
|
22
|
+
"@babylonjs/core": "^5.23.0",
|
|
26
23
|
"@dev/build-tools": "^1.0.0",
|
|
27
24
|
"@lts/procedural-textures": "^1.0.0",
|
|
28
25
|
"rimraf": "^3.0.2",
|
|
29
26
|
"typescript": "^4.4.4"
|
|
30
27
|
},
|
|
31
28
|
"peerDependencies": {
|
|
32
|
-
"@babylonjs/core": "^5.
|
|
29
|
+
"@babylonjs/core": "^5.22.0"
|
|
33
30
|
},
|
|
34
31
|
"keywords": [
|
|
35
32
|
"3D",
|