@babylonjs/core 5.56.0 → 5.57.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/Compute/computeShader.d.ts +3 -3
- package/Compute/computeShader.js +22 -12
- package/Compute/computeShader.js.map +1 -1
- package/Culling/boundingInfo.d.ts +1 -1
- package/Culling/boundingInfo.js +9 -3
- package/Culling/boundingInfo.js.map +1 -1
- package/Engines/thinEngine.js +2 -2
- package/Engines/thinEngine.js.map +1 -1
- package/Layers/effectLayer.js +2 -2
- package/Layers/effectLayer.js.map +1 -1
- package/Lights/Shadows/shadowGenerator.js +2 -2
- package/Lights/Shadows/shadowGenerator.js.map +1 -1
- package/Materials/clipPlaneMaterialHelper.d.ts +3 -1
- package/Materials/clipPlaneMaterialHelper.js +53 -32
- package/Materials/clipPlaneMaterialHelper.js.map +1 -1
- package/Materials/shaderMaterial.js +2 -2
- package/Materials/shaderMaterial.js.map +1 -1
- package/Meshes/instancedMesh.d.ts +9 -0
- package/Meshes/instancedMesh.js +30 -0
- package/Meshes/instancedMesh.js.map +1 -1
- package/Particles/gpuParticleSystem.js +2 -2
- package/Particles/gpuParticleSystem.js.map +1 -1
- package/Particles/particleSystem.js +2 -2
- package/Particles/particleSystem.js.map +1 -1
- package/Rendering/depthRenderer.js +2 -2
- package/Rendering/depthRenderer.js.map +1 -1
- package/Rendering/geometryBufferRenderer.js +2 -2
- package/Rendering/geometryBufferRenderer.js.map +1 -1
- package/Rendering/outlineRenderer.js +2 -2
- package/Rendering/outlineRenderer.js.map +1 -1
- package/package.json +1 -1
|
@@ -3,6 +3,8 @@ import type { IClipPlanesHolder } from "../Misc/interfaces/iClipPlanesHolder";
|
|
|
3
3
|
/** @internal */
|
|
4
4
|
export declare function addClipPlaneUniforms(uniforms: string[]): void;
|
|
5
5
|
/** @internal */
|
|
6
|
-
export declare function
|
|
6
|
+
export declare function prepareStringDefinesForClipPlanes(primaryHolder: IClipPlanesHolder, secondaryHolder: IClipPlanesHolder, defines: string[]): void;
|
|
7
|
+
/** @internal */
|
|
8
|
+
export declare function prepareDefinesForClipPlanes(primaryHolder: IClipPlanesHolder, secondaryHolder: IClipPlanesHolder, defines: Record<string, any>): boolean;
|
|
7
9
|
/** @internal */
|
|
8
10
|
export declare function bindClipPlane(effect: Effect, primaryHolder: IClipPlanesHolder, secondaryHolder: IClipPlanesHolder): void;
|
|
@@ -20,21 +20,62 @@ export function addClipPlaneUniforms(uniforms) {
|
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
/** @internal */
|
|
23
|
+
export function prepareStringDefinesForClipPlanes(primaryHolder, secondaryHolder, defines) {
|
|
24
|
+
var _a, _b, _c, _d, _e, _f;
|
|
25
|
+
const clipPlane = !!((_a = primaryHolder.clipPlane) !== null && _a !== void 0 ? _a : secondaryHolder.clipPlane);
|
|
26
|
+
const clipPlane2 = !!((_b = primaryHolder.clipPlane2) !== null && _b !== void 0 ? _b : secondaryHolder.clipPlane2);
|
|
27
|
+
const clipPlane3 = !!((_c = primaryHolder.clipPlane3) !== null && _c !== void 0 ? _c : secondaryHolder.clipPlane3);
|
|
28
|
+
const clipPlane4 = !!((_d = primaryHolder.clipPlane4) !== null && _d !== void 0 ? _d : secondaryHolder.clipPlane4);
|
|
29
|
+
const clipPlane5 = !!((_e = primaryHolder.clipPlane5) !== null && _e !== void 0 ? _e : secondaryHolder.clipPlane5);
|
|
30
|
+
const clipPlane6 = !!((_f = primaryHolder.clipPlane6) !== null && _f !== void 0 ? _f : secondaryHolder.clipPlane6);
|
|
31
|
+
if (clipPlane)
|
|
32
|
+
defines.push("#define CLIPPLANE");
|
|
33
|
+
if (clipPlane2)
|
|
34
|
+
defines.push("#define CLIPPLANE2");
|
|
35
|
+
if (clipPlane3)
|
|
36
|
+
defines.push("#define CLIPPLANE3");
|
|
37
|
+
if (clipPlane4)
|
|
38
|
+
defines.push("#define CLIPPLANE4");
|
|
39
|
+
if (clipPlane5)
|
|
40
|
+
defines.push("#define CLIPPLANE5");
|
|
41
|
+
if (clipPlane6)
|
|
42
|
+
defines.push("#define CLIPPLANE6");
|
|
43
|
+
}
|
|
44
|
+
/** @internal */
|
|
23
45
|
export function prepareDefinesForClipPlanes(primaryHolder, secondaryHolder, defines) {
|
|
24
46
|
var _a, _b, _c, _d, _e, _f;
|
|
25
47
|
let changed = false;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
48
|
+
const clipPlane = !!((_a = primaryHolder.clipPlane) !== null && _a !== void 0 ? _a : secondaryHolder.clipPlane);
|
|
49
|
+
const clipPlane2 = !!((_b = primaryHolder.clipPlane2) !== null && _b !== void 0 ? _b : secondaryHolder.clipPlane2);
|
|
50
|
+
const clipPlane3 = !!((_c = primaryHolder.clipPlane3) !== null && _c !== void 0 ? _c : secondaryHolder.clipPlane3);
|
|
51
|
+
const clipPlane4 = !!((_d = primaryHolder.clipPlane4) !== null && _d !== void 0 ? _d : secondaryHolder.clipPlane4);
|
|
52
|
+
const clipPlane5 = !!((_e = primaryHolder.clipPlane5) !== null && _e !== void 0 ? _e : secondaryHolder.clipPlane5);
|
|
53
|
+
const clipPlane6 = !!((_f = primaryHolder.clipPlane6) !== null && _f !== void 0 ? _f : secondaryHolder.clipPlane6);
|
|
54
|
+
// Do not factorize this code, it breaks browsers optimizations.
|
|
55
|
+
if (defines["CLIPPLANE"] !== clipPlane) {
|
|
56
|
+
defines["CLIPPLANE"] = clipPlane;
|
|
57
|
+
changed = true;
|
|
58
|
+
}
|
|
59
|
+
if (defines["CLIPPLANE2"] !== clipPlane2) {
|
|
60
|
+
defines["CLIPPLANE2"] = clipPlane2;
|
|
61
|
+
changed = true;
|
|
62
|
+
}
|
|
63
|
+
if (defines["CLIPPLANE3"] !== clipPlane3) {
|
|
64
|
+
defines["CLIPPLANE3"] = clipPlane3;
|
|
65
|
+
changed = true;
|
|
66
|
+
}
|
|
67
|
+
if (defines["CLIPPLANE4"] !== clipPlane4) {
|
|
68
|
+
defines["CLIPPLANE4"] = clipPlane4;
|
|
69
|
+
changed = true;
|
|
70
|
+
}
|
|
71
|
+
if (defines["CLIPPLANE5"] !== clipPlane5) {
|
|
72
|
+
defines["CLIPPLANE5"] = clipPlane5;
|
|
73
|
+
changed = true;
|
|
74
|
+
}
|
|
75
|
+
if (defines["CLIPPLANE6"] !== clipPlane6) {
|
|
76
|
+
defines["CLIPPLANE6"] = clipPlane6;
|
|
77
|
+
changed = true;
|
|
78
|
+
}
|
|
38
79
|
return changed;
|
|
39
80
|
}
|
|
40
81
|
/** @internal */
|
|
@@ -58,24 +99,4 @@ function setClipPlane(effect, uniformName, clipPlane) {
|
|
|
58
99
|
effect.setFloat4(uniformName, clipPlane.normal.x, clipPlane.normal.y, clipPlane.normal.z, clipPlane.d);
|
|
59
100
|
}
|
|
60
101
|
}
|
|
61
|
-
function addDefine(clipPlane, defines, defineName, defineString) {
|
|
62
|
-
const defineClipPlane = clipPlane ? true : false;
|
|
63
|
-
let alreadySet;
|
|
64
|
-
if (Array.isArray(defines)) {
|
|
65
|
-
const defineIndex = defines.indexOf(defineString);
|
|
66
|
-
alreadySet = defineIndex !== -1;
|
|
67
|
-
if (!alreadySet && clipPlane) {
|
|
68
|
-
defines.push(defineString);
|
|
69
|
-
}
|
|
70
|
-
else if (alreadySet && !clipPlane) {
|
|
71
|
-
defines.splice(defineIndex, 1);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
else {
|
|
75
|
-
alreadySet = defines[defineName];
|
|
76
|
-
defines[defineName] = defineClipPlane;
|
|
77
|
-
}
|
|
78
|
-
const changed = alreadySet !== defineClipPlane;
|
|
79
|
-
return changed;
|
|
80
|
-
}
|
|
81
102
|
//# sourceMappingURL=clipPlaneMaterialHelper.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clipPlaneMaterialHelper.js","sourceRoot":"","sources":["../../../../lts/core/generated/Materials/clipPlaneMaterialHelper.ts"],"names":[],"mappings":"AAKA,gBAAgB;AAChB,MAAM,UAAU,oBAAoB,CAAC,QAAkB;IACnD,IAAI,QAAQ,CAAC,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,EAAE;QACvC,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;KAC/B;IACD,IAAI,QAAQ,CAAC,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,EAAE;QACxC,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;KAChC;IACD,IAAI,QAAQ,CAAC,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,EAAE;QACxC,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;KAChC;IACD,IAAI,QAAQ,CAAC,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,EAAE;QACxC,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;KAChC;IACD,IAAI,QAAQ,CAAC,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,EAAE;QACxC,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;KAChC;IACD,IAAI,QAAQ,CAAC,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,EAAE;QACxC,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;KAChC;AACL,CAAC;AAED,gBAAgB;AAChB,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"clipPlaneMaterialHelper.js","sourceRoot":"","sources":["../../../../lts/core/generated/Materials/clipPlaneMaterialHelper.ts"],"names":[],"mappings":"AAKA,gBAAgB;AAChB,MAAM,UAAU,oBAAoB,CAAC,QAAkB;IACnD,IAAI,QAAQ,CAAC,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,EAAE;QACvC,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;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AAC;IACnE,YAAY,CAAC,MAAM,EAAE,aAAa,EAAE,SAAS,CAAC,CAAC;IAC/C,SAAS,GAAG,MAAA,aAAa,CAAC,UAAU,mCAAI,eAAe,CAAC,UAAU,CAAC;IACnE,YAAY,CAAC,MAAM,EAAE,aAAa,EAAE,SAAS,CAAC,CAAC;IAC/C,SAAS,GAAG,MAAA,aAAa,CAAC,UAAU,mCAAI,eAAe,CAAC,UAAU,CAAC;IACnE,YAAY,CAAC,MAAM,EAAE,aAAa,EAAE,SAAS,CAAC,CAAC;IAC/C,SAAS,GAAG,MAAA,aAAa,CAAC,UAAU,mCAAI,eAAe,CAAC,UAAU,CAAC;IACnE,YAAY,CAAC,MAAM,EAAE,aAAa,EAAE,SAAS,CAAC,CAAC;IAC/C,SAAS,GAAG,MAAA,aAAa,CAAC,UAAU,mCAAI,eAAe,CAAC,UAAU,CAAC;IACnE,YAAY,CAAC,MAAM,EAAE,aAAa,EAAE,SAAS,CAAC,CAAC;AACnD,CAAC;AAED,SAAS,YAAY,CAAC,MAAc,EAAE,WAAmB,EAAE,SAA0B;IACjF,IAAI,SAAS,EAAE;QACX,MAAM,CAAC,SAAS,CAAC,WAAW,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;KAC1G;AACL,CAAC","sourcesContent":["import type { Effect } from \"./effect\";\r\nimport type { IClipPlanesHolder } from \"../Misc/interfaces/iClipPlanesHolder\";\r\nimport type { Nullable } from \"../types\";\r\nimport type { Plane } from \"../Maths/math.plane\";\r\n\r\n/** @internal */\r\nexport function addClipPlaneUniforms(uniforms: string[]): void {\r\n if (uniforms.indexOf(\"vClipPlane\") === -1) {\r\n uniforms.push(\"vClipPlane\");\r\n }\r\n if (uniforms.indexOf(\"vClipPlane2\") === -1) {\r\n uniforms.push(\"vClipPlane2\");\r\n }\r\n if (uniforms.indexOf(\"vClipPlane3\") === -1) {\r\n uniforms.push(\"vClipPlane3\");\r\n }\r\n if (uniforms.indexOf(\"vClipPlane4\") === -1) {\r\n uniforms.push(\"vClipPlane4\");\r\n }\r\n if (uniforms.indexOf(\"vClipPlane5\") === -1) {\r\n uniforms.push(\"vClipPlane5\");\r\n }\r\n if (uniforms.indexOf(\"vClipPlane6\") === -1) {\r\n uniforms.push(\"vClipPlane6\");\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport function prepareStringDefinesForClipPlanes(primaryHolder: IClipPlanesHolder, secondaryHolder: IClipPlanesHolder, defines: string[]): void {\r\n const clipPlane = !!(primaryHolder.clipPlane ?? secondaryHolder.clipPlane);\r\n const clipPlane2 = !!(primaryHolder.clipPlane2 ?? secondaryHolder.clipPlane2);\r\n const clipPlane3 = !!(primaryHolder.clipPlane3 ?? secondaryHolder.clipPlane3);\r\n const clipPlane4 = !!(primaryHolder.clipPlane4 ?? secondaryHolder.clipPlane4);\r\n const clipPlane5 = !!(primaryHolder.clipPlane5 ?? secondaryHolder.clipPlane5);\r\n const clipPlane6 = !!(primaryHolder.clipPlane6 ?? secondaryHolder.clipPlane6);\r\n\r\n if (clipPlane) defines.push(\"#define CLIPPLANE\");\r\n if (clipPlane2) defines.push(\"#define CLIPPLANE2\");\r\n if (clipPlane3) defines.push(\"#define CLIPPLANE3\");\r\n if (clipPlane4) defines.push(\"#define CLIPPLANE4\");\r\n if (clipPlane5) defines.push(\"#define CLIPPLANE5\");\r\n if (clipPlane6) defines.push(\"#define CLIPPLANE6\");\r\n}\r\n\r\n/** @internal */\r\nexport function prepareDefinesForClipPlanes(primaryHolder: IClipPlanesHolder, secondaryHolder: IClipPlanesHolder, defines: Record<string, any>): boolean {\r\n let changed = false;\r\n\r\n const clipPlane = !!(primaryHolder.clipPlane ?? secondaryHolder.clipPlane);\r\n const clipPlane2 = !!(primaryHolder.clipPlane2 ?? secondaryHolder.clipPlane2);\r\n const clipPlane3 = !!(primaryHolder.clipPlane3 ?? secondaryHolder.clipPlane3);\r\n const clipPlane4 = !!(primaryHolder.clipPlane4 ?? secondaryHolder.clipPlane4);\r\n const clipPlane5 = !!(primaryHolder.clipPlane5 ?? secondaryHolder.clipPlane5);\r\n const clipPlane6 = !!(primaryHolder.clipPlane6 ?? secondaryHolder.clipPlane6);\r\n\r\n // Do not factorize this code, it breaks browsers optimizations.\r\n if (defines[\"CLIPPLANE\"] !== clipPlane) {\r\n defines[\"CLIPPLANE\"] = clipPlane;\r\n changed = true;\r\n }\r\n if (defines[\"CLIPPLANE2\"] !== clipPlane2) {\r\n defines[\"CLIPPLANE2\"] = clipPlane2;\r\n changed = true;\r\n }\r\n if (defines[\"CLIPPLANE3\"] !== clipPlane3) {\r\n defines[\"CLIPPLANE3\"] = clipPlane3;\r\n changed = true;\r\n }\r\n if (defines[\"CLIPPLANE4\"] !== clipPlane4) {\r\n defines[\"CLIPPLANE4\"] = clipPlane4;\r\n changed = true;\r\n }\r\n if (defines[\"CLIPPLANE5\"] !== clipPlane5) {\r\n defines[\"CLIPPLANE5\"] = clipPlane5;\r\n changed = true;\r\n }\r\n if (defines[\"CLIPPLANE6\"] !== clipPlane6) {\r\n defines[\"CLIPPLANE6\"] = clipPlane6;\r\n changed = true;\r\n }\r\n\r\n return changed;\r\n}\r\n\r\n/** @internal */\r\nexport function bindClipPlane(effect: Effect, primaryHolder: IClipPlanesHolder, secondaryHolder: IClipPlanesHolder): void {\r\n let clipPlane = primaryHolder.clipPlane ?? secondaryHolder.clipPlane;\r\n setClipPlane(effect, \"vClipPlane\", clipPlane);\r\n clipPlane = primaryHolder.clipPlane2 ?? secondaryHolder.clipPlane2;\r\n setClipPlane(effect, \"vClipPlane2\", clipPlane);\r\n clipPlane = primaryHolder.clipPlane3 ?? secondaryHolder.clipPlane3;\r\n setClipPlane(effect, \"vClipPlane3\", clipPlane);\r\n clipPlane = primaryHolder.clipPlane4 ?? secondaryHolder.clipPlane4;\r\n setClipPlane(effect, \"vClipPlane4\", clipPlane);\r\n clipPlane = primaryHolder.clipPlane5 ?? secondaryHolder.clipPlane5;\r\n setClipPlane(effect, \"vClipPlane5\", clipPlane);\r\n clipPlane = primaryHolder.clipPlane6 ?? secondaryHolder.clipPlane6;\r\n setClipPlane(effect, \"vClipPlane6\", clipPlane);\r\n}\r\n\r\nfunction setClipPlane(effect: Effect, uniformName: string, clipPlane: Nullable<Plane>): void {\r\n if (clipPlane) {\r\n effect.setFloat4(uniformName, clipPlane.normal.x, clipPlane.normal.y, clipPlane.normal.z, clipPlane.d);\r\n }\r\n}\r\n"]}
|
|
@@ -10,7 +10,7 @@ import { WebRequest } from "../Misc/webRequest.js";
|
|
|
10
10
|
import { PushMaterial } from "./pushMaterial.js";
|
|
11
11
|
import { EngineStore } from "../Engines/engineStore.js";
|
|
12
12
|
|
|
13
|
-
import { addClipPlaneUniforms, bindClipPlane,
|
|
13
|
+
import { addClipPlaneUniforms, bindClipPlane, prepareStringDefinesForClipPlanes } from "./clipPlaneMaterialHelper.js";
|
|
14
14
|
const onCreatedEffectParameters = { effect: null, subMesh: null };
|
|
15
15
|
/**
|
|
16
16
|
* The ShaderMaterial object has the necessary methods to pass data from your scene to the Vertex and Fragment Shaders and returns a material that can be applied to any mesh.
|
|
@@ -628,7 +628,7 @@ export class ShaderMaterial extends PushMaterial {
|
|
|
628
628
|
// Clip planes
|
|
629
629
|
if (this._options.useClipPlane !== false) {
|
|
630
630
|
addClipPlaneUniforms(uniforms);
|
|
631
|
-
|
|
631
|
+
prepareStringDefinesForClipPlanes(this, scene, defines);
|
|
632
632
|
}
|
|
633
633
|
if (this.customShaderNameResolve) {
|
|
634
634
|
uniforms = uniforms.slice();
|