x_ite 12.0.7 → 12.0.9
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/README.md +4 -4
- package/dist/X3DUOM.xml +33 -0
- package/dist/assets/components/AnnotationComponent.js +2 -2
- package/dist/assets/components/AnnotationComponent.min.js +2 -2
- package/dist/assets/components/CADGeometryComponent.js +2 -2
- package/dist/assets/components/CADGeometryComponent.min.js +2 -2
- package/dist/assets/components/CubeMapTexturingComponent.js +14 -20
- package/dist/assets/components/CubeMapTexturingComponent.min.js +2 -2
- package/dist/assets/components/DISComponent.js +2 -2
- package/dist/assets/components/DISComponent.min.js +2 -2
- package/dist/assets/components/EventUtilitiesComponent.js +2 -2
- package/dist/assets/components/EventUtilitiesComponent.min.js +2 -2
- package/dist/assets/components/Geometry2DComponent.js +2 -2
- package/dist/assets/components/Geometry2DComponent.min.js +2 -2
- package/dist/assets/components/GeospatialComponent.js +2 -2
- package/dist/assets/components/GeospatialComponent.min.js +2 -2
- package/dist/assets/components/HAnimComponent.js +2 -2
- package/dist/assets/components/HAnimComponent.min.js +2 -2
- package/dist/assets/components/KeyDeviceSensorComponent.js +2 -2
- package/dist/assets/components/KeyDeviceSensorComponent.min.js +2 -2
- package/dist/assets/components/LayoutComponent.js +2 -2
- package/dist/assets/components/LayoutComponent.min.js +2 -2
- package/dist/assets/components/NURBSComponent.js +2 -2
- package/dist/assets/components/NURBSComponent.min.js +2 -2
- package/dist/assets/components/ParticleSystemsComponent.js +14 -2
- package/dist/assets/components/ParticleSystemsComponent.min.js +2 -2
- package/dist/assets/components/PickingComponent.js +2 -2
- package/dist/assets/components/PickingComponent.min.js +2 -2
- package/dist/assets/components/RigidBodyPhysicsComponent.js +12 -12
- package/dist/assets/components/RigidBodyPhysicsComponent.min.js +2 -2
- package/dist/assets/components/ScriptingComponent.js +2 -2
- package/dist/assets/components/ScriptingComponent.min.js +2 -2
- package/dist/assets/components/TextComponent.js +2 -2
- package/dist/assets/components/TextComponent.min.js +2 -2
- package/dist/assets/components/TextureProjectionComponent.js +2 -2
- package/dist/assets/components/TextureProjectionComponent.min.js +2 -2
- package/dist/assets/components/Texturing3DComponent.js +3567 -3567
- package/dist/assets/components/Texturing3DComponent.min.js +2 -2
- package/dist/assets/components/VolumeRenderingComponent.js +4 -4
- package/dist/assets/components/VolumeRenderingComponent.min.js +2 -2
- package/dist/assets/components/WebXRComponent.js +2 -2
- package/dist/assets/components/WebXRComponent.min.js +2 -2
- package/dist/assets/components/X_ITEComponent.js +414 -93
- package/dist/assets/components/X_ITEComponent.min.js +2 -2
- package/dist/example.html +1 -1
- package/dist/x_ite.css +1 -1
- package/dist/x_ite.d.ts +30 -0
- package/dist/x_ite.js +51453 -51137
- package/dist/x_ite.min.js +2 -2
- package/dist/x_ite.min.mjs +2 -2
- package/dist/x_ite.mjs +51281 -50966
- package/dist/x_ite.zip +0 -0
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/* X_ITE v12.0.
|
|
2
|
-
const __X_ITE_X3D__ = window [Symbol .for ("X_ITE.X3D-12.0.
|
|
1
|
+
/* X_ITE v12.0.9 */
|
|
2
|
+
const __X_ITE_X3D__ = window [Symbol .for ("X_ITE.X3D-12.0.9")];
|
|
3
3
|
/******/ (() => { // webpackBootstrap
|
|
4
4
|
/******/ "use strict";
|
|
5
5
|
/******/ // The require scope
|
|
@@ -42,6 +42,52 @@ const __X_ITE_X3D__ = window [Symbol .for ("X_ITE.X3D-12.0.7")];
|
|
|
42
42
|
;// external "__X_ITE_X3D__ .Components"
|
|
43
43
|
const external_X_ITE_X3D_Components_namespaceObject = __X_ITE_X3D__ .Components;
|
|
44
44
|
var external_X_ITE_X3D_Components_default = /*#__PURE__*/__webpack_require__.n(external_X_ITE_X3D_Components_namespaceObject);
|
|
45
|
+
;// external "__X_ITE_X3D__ .TextureBuffer"
|
|
46
|
+
const external_X_ITE_X3D_TextureBuffer_namespaceObject = __X_ITE_X3D__ .TextureBuffer;
|
|
47
|
+
var external_X_ITE_X3D_TextureBuffer_default = /*#__PURE__*/__webpack_require__.n(external_X_ITE_X3D_TextureBuffer_namespaceObject);
|
|
48
|
+
;// external "__X_ITE_X3D__ .Namespace"
|
|
49
|
+
const external_X_ITE_X3D_Namespace_namespaceObject = __X_ITE_X3D__ .Namespace;
|
|
50
|
+
var external_X_ITE_X3D_Namespace_default = /*#__PURE__*/__webpack_require__.n(external_X_ITE_X3D_Namespace_namespaceObject);
|
|
51
|
+
;// ./src/x_ite/Browser/X_ITE/X3DX_ITEContext.js
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
const
|
|
55
|
+
_transmissionBuffer = Symbol (),
|
|
56
|
+
_volumeScatterBuffer = Symbol ();
|
|
57
|
+
|
|
58
|
+
function X3DX_ITEContext () { }
|
|
59
|
+
|
|
60
|
+
Object .assign (X3DX_ITEContext .prototype,
|
|
61
|
+
{
|
|
62
|
+
initialize ()
|
|
63
|
+
{
|
|
64
|
+
this .addTextureBuffer (_transmissionBuffer);
|
|
65
|
+
this .addTextureBuffer (_volumeScatterBuffer);
|
|
66
|
+
},
|
|
67
|
+
getTransmissionBuffer ()
|
|
68
|
+
{
|
|
69
|
+
return this [_transmissionBuffer] ??= new (external_X_ITE_X3D_TextureBuffer_default()) ({
|
|
70
|
+
browser: this,
|
|
71
|
+
width: this ._viewport [2],
|
|
72
|
+
height: this ._viewport [3],
|
|
73
|
+
mipMaps: true,
|
|
74
|
+
});
|
|
75
|
+
},
|
|
76
|
+
getVolumeScatterBuffer ()
|
|
77
|
+
{
|
|
78
|
+
return this [_volumeScatterBuffer] ??= new (external_X_ITE_X3D_TextureBuffer_default()) ({
|
|
79
|
+
browser: this,
|
|
80
|
+
width: this ._viewport [2],
|
|
81
|
+
height: this ._viewport [3],
|
|
82
|
+
float: true,
|
|
83
|
+
});
|
|
84
|
+
},
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
const __default__ = X3DX_ITEContext;
|
|
88
|
+
;
|
|
89
|
+
|
|
90
|
+
/* harmony default export */ const X_ITE_X3DX_ITEContext = (external_X_ITE_X3D_Namespace_default().add ("X3DX_ITEContext", __default__));
|
|
45
91
|
;// external "__X_ITE_X3D__ .Fields"
|
|
46
92
|
const external_X_ITE_X3D_Fields_namespaceObject = __X_ITE_X3D__ .Fields;
|
|
47
93
|
var external_X_ITE_X3D_Fields_default = /*#__PURE__*/__webpack_require__.n(external_X_ITE_X3D_Fields_namespaceObject);
|
|
@@ -60,9 +106,6 @@ var external_X_ITE_X3D_X3DConstants_default = /*#__PURE__*/__webpack_require__.n
|
|
|
60
106
|
;// external "__X_ITE_X3D__ .BitSet"
|
|
61
107
|
const external_X_ITE_X3D_BitSet_namespaceObject = __X_ITE_X3D__ .BitSet;
|
|
62
108
|
var external_X_ITE_X3D_BitSet_default = /*#__PURE__*/__webpack_require__.n(external_X_ITE_X3D_BitSet_namespaceObject);
|
|
63
|
-
;// external "__X_ITE_X3D__ .Namespace"
|
|
64
|
-
const external_X_ITE_X3D_Namespace_namespaceObject = __X_ITE_X3D__ .Namespace;
|
|
65
|
-
var external_X_ITE_X3D_Namespace_default = /*#__PURE__*/__webpack_require__.n(external_X_ITE_X3D_Namespace_namespaceObject);
|
|
66
109
|
;// ./src/x_ite/Components/X_ITE/X3DMaterialExtensionNode.js
|
|
67
110
|
|
|
68
111
|
|
|
@@ -94,10 +137,10 @@ Object .assign (Object .setPrototypeOf (X3DMaterialExtensionNode .prototype, (ex
|
|
|
94
137
|
|
|
95
138
|
Object .defineProperties (X3DMaterialExtensionNode, external_X_ITE_X3D_X3DNode_default().getStaticProperties ("X3DMaterialExtensionNode", "X_ITE", 1));
|
|
96
139
|
|
|
97
|
-
const
|
|
140
|
+
const X3DMaterialExtensionNode_default_ = X3DMaterialExtensionNode;
|
|
98
141
|
;
|
|
99
142
|
|
|
100
|
-
/* harmony default export */ const X_ITE_X3DMaterialExtensionNode = (external_X_ITE_X3D_Namespace_default().add ("X3DMaterialExtensionNode",
|
|
143
|
+
/* harmony default export */ const X_ITE_X3DMaterialExtensionNode = (external_X_ITE_X3D_Namespace_default().add ("X3DMaterialExtensionNode", X3DMaterialExtensionNode_default_));
|
|
101
144
|
;// external "__X_ITE_X3D__ .X3DCast"
|
|
102
145
|
const external_X_ITE_X3D_X3DCast_namespaceObject = __X_ITE_X3D__ .X3DCast;
|
|
103
146
|
var external_X_ITE_X3D_X3DCast_default = /*#__PURE__*/__webpack_require__.n(external_X_ITE_X3D_X3DCast_namespaceObject);
|
|
@@ -208,13 +251,11 @@ Object .assign (Object .setPrototypeOf (AnisotropyMaterialExtension .prototype,
|
|
|
208
251
|
{
|
|
209
252
|
uniforms .push ("x3d_AnisotropyEXT");
|
|
210
253
|
},
|
|
211
|
-
setShaderUniforms (gl, shaderObject,
|
|
254
|
+
setShaderUniforms (gl, shaderObject, textureTransformMapping, textureCoordinateMapping)
|
|
212
255
|
{
|
|
213
256
|
gl .uniform3fv (shaderObject .x3d_AnisotropyEXT, this .anisotropyArray);
|
|
214
257
|
|
|
215
258
|
this .anisotropyTextureNode ?.setNamedShaderUniforms (gl,
|
|
216
|
-
shaderObject,
|
|
217
|
-
renderObject,
|
|
218
259
|
shaderObject .x3d_AnisotropyTextureEXT,
|
|
219
260
|
this ._anisotropyTextureMapping .getValue (),
|
|
220
261
|
textureTransformMapping,
|
|
@@ -484,7 +525,7 @@ Object .assign (Object .setPrototypeOf (ClearcoatMaterialExtension .prototype, X
|
|
|
484
525
|
uniforms .push ("x3d_ClearcoatEXT");
|
|
485
526
|
uniforms .push ("x3d_ClearcoatRoughnessEXT");
|
|
486
527
|
},
|
|
487
|
-
setShaderUniforms (gl, shaderObject,
|
|
528
|
+
setShaderUniforms (gl, shaderObject, textureTransformMapping, textureCoordinateMapping)
|
|
488
529
|
{
|
|
489
530
|
gl .uniform1f (shaderObject .x3d_ClearcoatEXT, this .clearcoat);
|
|
490
531
|
gl .uniform1f (shaderObject .x3d_ClearcoatRoughnessEXT, this .clearcoatRoughness);
|
|
@@ -493,24 +534,18 @@ Object .assign (Object .setPrototypeOf (ClearcoatMaterialExtension .prototype, X
|
|
|
493
534
|
return;
|
|
494
535
|
|
|
495
536
|
this .clearcoatTextureNode ?.setNamedShaderUniforms (gl,
|
|
496
|
-
shaderObject,
|
|
497
|
-
renderObject,
|
|
498
537
|
shaderObject .x3d_ClearcoatTextureEXT,
|
|
499
538
|
this ._clearcoatTextureMapping .getValue (),
|
|
500
539
|
textureTransformMapping,
|
|
501
540
|
textureCoordinateMapping);
|
|
502
541
|
|
|
503
542
|
this .clearcoatRoughnessTextureNode ?.setNamedShaderUniforms (gl,
|
|
504
|
-
shaderObject,
|
|
505
|
-
renderObject,
|
|
506
543
|
shaderObject .x3d_ClearcoatRoughnessTextureEXT,
|
|
507
544
|
this ._clearcoatRoughnessTextureMapping .getValue (),
|
|
508
545
|
textureTransformMapping,
|
|
509
546
|
textureCoordinateMapping);
|
|
510
547
|
|
|
511
548
|
this .clearcoatNormalTextureNode ?.setNamedShaderUniforms (gl,
|
|
512
|
-
shaderObject,
|
|
513
|
-
renderObject,
|
|
514
549
|
shaderObject .x3d_ClearcoatNormalTextureEXT,
|
|
515
550
|
this ._clearcoatNormalTextureMapping .getValue (),
|
|
516
551
|
textureTransformMapping,
|
|
@@ -738,7 +773,7 @@ Object .assign (Object .setPrototypeOf (DiffuseTransmissionMaterialExtension .pr
|
|
|
738
773
|
uniforms .push ("x3d_DiffuseTransmissionEXT");
|
|
739
774
|
uniforms .push ("x3d_DiffuseTransmissionColorEXT");
|
|
740
775
|
},
|
|
741
|
-
setShaderUniforms (gl, shaderObject,
|
|
776
|
+
setShaderUniforms (gl, shaderObject, textureTransformMapping, textureCoordinateMapping)
|
|
742
777
|
{
|
|
743
778
|
gl .uniform1f (shaderObject .x3d_DiffuseTransmissionEXT, this .diffuseTransmission);
|
|
744
779
|
gl .uniform3fv (shaderObject .x3d_DiffuseTransmissionColorEXT, this .diffuseTransmissionColorArray);
|
|
@@ -747,16 +782,12 @@ Object .assign (Object .setPrototypeOf (DiffuseTransmissionMaterialExtension .pr
|
|
|
747
782
|
return;
|
|
748
783
|
|
|
749
784
|
this .diffuseTransmissionTextureNode ?.setNamedShaderUniforms (gl,
|
|
750
|
-
shaderObject,
|
|
751
|
-
renderObject,
|
|
752
785
|
shaderObject .x3d_DiffuseTransmissionTextureEXT,
|
|
753
786
|
this ._diffuseTransmissionTextureMapping .getValue (),
|
|
754
787
|
textureTransformMapping,
|
|
755
788
|
textureCoordinateMapping);
|
|
756
789
|
|
|
757
790
|
this .diffuseTransmissionColorTextureNode ?.setNamedShaderUniforms (gl,
|
|
758
|
-
shaderObject,
|
|
759
|
-
renderObject,
|
|
760
791
|
shaderObject .x3d_DiffuseTransmissionColorTextureEXT,
|
|
761
792
|
this ._diffuseTransmissionColorTextureMapping .getValue (),
|
|
762
793
|
textureTransformMapping,
|
|
@@ -836,7 +867,7 @@ Object .assign (Object .setPrototypeOf (DispersionMaterialExtension .prototype,
|
|
|
836
867
|
{
|
|
837
868
|
uniforms .push ("x3d_DispersionEXT");
|
|
838
869
|
},
|
|
839
|
-
setShaderUniforms (gl, shaderObject,
|
|
870
|
+
setShaderUniforms (gl, shaderObject, textureTransformMapping, textureCoordinateMapping)
|
|
840
871
|
{
|
|
841
872
|
gl .uniform1f (shaderObject .x3d_DispersionEXT, this .dispersion);
|
|
842
873
|
},
|
|
@@ -909,7 +940,7 @@ Object .assign (Object .setPrototypeOf (EmissiveStrengthMaterialExtension .proto
|
|
|
909
940
|
{
|
|
910
941
|
uniforms .push ("x3d_EmissiveStrengthEXT");
|
|
911
942
|
},
|
|
912
|
-
setShaderUniforms (gl, shaderObject,
|
|
943
|
+
setShaderUniforms (gl, shaderObject, textureTransformMapping, textureCoordinateMapping)
|
|
913
944
|
{
|
|
914
945
|
gl .uniform1f (shaderObject .x3d_EmissiveStrengthEXT, this .emissiveStrength);
|
|
915
946
|
},
|
|
@@ -1186,7 +1217,7 @@ Object .assign (Object .setPrototypeOf (IORMaterialExtension .prototype, X_ITE_X
|
|
|
1186
1217
|
{
|
|
1187
1218
|
uniforms .push ("x3d_IorEXT");
|
|
1188
1219
|
},
|
|
1189
|
-
setShaderUniforms (gl, shaderObject,
|
|
1220
|
+
setShaderUniforms (gl, shaderObject, textureTransformMapping, textureCoordinateMapping)
|
|
1190
1221
|
{
|
|
1191
1222
|
gl .uniform1f (shaderObject .x3d_IorEXT, this .indexOfRefraction);
|
|
1192
1223
|
},
|
|
@@ -1331,7 +1362,7 @@ Object .assign (Object .setPrototypeOf (IridescenceMaterialExtension .prototype,
|
|
|
1331
1362
|
uniforms .push ("x3d_IridescenceThicknessMinimumEXT");
|
|
1332
1363
|
uniforms .push ("x3d_IridescenceThicknessMaximumEXT");
|
|
1333
1364
|
},
|
|
1334
|
-
setShaderUniforms (gl, shaderObject,
|
|
1365
|
+
setShaderUniforms (gl, shaderObject, textureTransformMapping, textureCoordinateMapping)
|
|
1335
1366
|
{
|
|
1336
1367
|
gl .uniform1f (shaderObject .x3d_IridescenceEXT, this .iridescence);
|
|
1337
1368
|
gl .uniform1f (shaderObject .x3d_IridescenceIndexOfRefractionEXT, this .iridescenceIndexOfRefraction);
|
|
@@ -1342,16 +1373,12 @@ Object .assign (Object .setPrototypeOf (IridescenceMaterialExtension .prototype,
|
|
|
1342
1373
|
return;
|
|
1343
1374
|
|
|
1344
1375
|
this .iridescenceTextureNode ?.setNamedShaderUniforms (gl,
|
|
1345
|
-
shaderObject,
|
|
1346
|
-
renderObject,
|
|
1347
1376
|
shaderObject .x3d_IridescenceTextureEXT,
|
|
1348
1377
|
this ._iridescenceTextureMapping .getValue (),
|
|
1349
1378
|
textureTransformMapping,
|
|
1350
1379
|
textureCoordinateMapping);
|
|
1351
1380
|
|
|
1352
1381
|
this .iridescenceThicknessTextureNode ?.setNamedShaderUniforms (gl,
|
|
1353
|
-
shaderObject,
|
|
1354
|
-
renderObject,
|
|
1355
1382
|
shaderObject .x3d_IridescenceThicknessTextureEXT,
|
|
1356
1383
|
this ._iridescenceThicknessTextureMapping .getValue (),
|
|
1357
1384
|
textureTransformMapping,
|
|
@@ -1480,7 +1507,7 @@ Object .assign (Object .setPrototypeOf (SheenMaterialExtension .prototype, X_ITE
|
|
|
1480
1507
|
uniforms .push ("x3d_SheenRoughnessEXT");
|
|
1481
1508
|
uniforms .push ("x3d_SheenELUTTextureEXT");
|
|
1482
1509
|
},
|
|
1483
|
-
setShaderUniforms (gl, shaderObject,
|
|
1510
|
+
setShaderUniforms (gl, shaderObject, textureTransformMapping, textureCoordinateMapping)
|
|
1484
1511
|
{
|
|
1485
1512
|
gl .uniform3fv (shaderObject .x3d_SheenColorEXT, this .sheenColorArray);
|
|
1486
1513
|
gl .uniform1f (shaderObject .x3d_SheenRoughnessEXT, this .sheenRoughness);
|
|
@@ -1498,16 +1525,12 @@ Object .assign (Object .setPrototypeOf (SheenMaterialExtension .prototype, X_ITE
|
|
|
1498
1525
|
return;
|
|
1499
1526
|
|
|
1500
1527
|
this .sheenColorTextureNode ?.setNamedShaderUniforms (gl,
|
|
1501
|
-
shaderObject,
|
|
1502
|
-
renderObject,
|
|
1503
1528
|
shaderObject .x3d_SheenColorTextureEXT,
|
|
1504
1529
|
this ._sheenColorTextureMapping .getValue (),
|
|
1505
1530
|
textureTransformMapping,
|
|
1506
1531
|
textureCoordinateMapping);
|
|
1507
1532
|
|
|
1508
1533
|
this .sheenRoughnessTextureNode ?.setNamedShaderUniforms (gl,
|
|
1509
|
-
shaderObject,
|
|
1510
|
-
renderObject,
|
|
1511
1534
|
shaderObject .x3d_SheenRoughnessTextureEXT,
|
|
1512
1535
|
this ._sheenRoughnessTextureMapping .getValue (),
|
|
1513
1536
|
textureTransformMapping,
|
|
@@ -1771,9 +1794,9 @@ Object .assign (Object .setPrototypeOf (SpecularGlossinessMaterial .prototype, (
|
|
|
1771
1794
|
|
|
1772
1795
|
return shaderNode;
|
|
1773
1796
|
},
|
|
1774
|
-
setShaderUniforms (gl, shaderObject,
|
|
1797
|
+
setShaderUniforms (gl, shaderObject, textureTransformMapping, textureCoordinateMapping)
|
|
1775
1798
|
{
|
|
1776
|
-
external_X_ITE_X3D_X3DOneSidedMaterialNode_default().prototype .setShaderUniforms .call (this, gl, shaderObject,
|
|
1799
|
+
external_X_ITE_X3D_X3DOneSidedMaterialNode_default().prototype .setShaderUniforms .call (this, gl, shaderObject, textureTransformMapping, textureCoordinateMapping);
|
|
1777
1800
|
|
|
1778
1801
|
gl .uniform3fv (shaderObject .x3d_DiffuseColor, this .diffuseColorArray);
|
|
1779
1802
|
gl .uniform3fv (shaderObject .x3d_SpecularColor, this .specularColorArray);
|
|
@@ -1783,16 +1806,12 @@ Object .assign (Object .setPrototypeOf (SpecularGlossinessMaterial .prototype, (
|
|
|
1783
1806
|
return;
|
|
1784
1807
|
|
|
1785
1808
|
this .diffuseTextureNode ?.setNamedShaderUniforms (gl,
|
|
1786
|
-
shaderObject,
|
|
1787
|
-
renderObject,
|
|
1788
1809
|
shaderObject .x3d_DiffuseTexture,
|
|
1789
1810
|
this ._diffuseTextureMapping .getValue (),
|
|
1790
1811
|
textureTransformMapping,
|
|
1791
1812
|
textureCoordinateMapping);
|
|
1792
1813
|
|
|
1793
1814
|
this .specularGlossinessTextureNode ?.setNamedShaderUniforms (gl,
|
|
1794
|
-
shaderObject,
|
|
1795
|
-
renderObject,
|
|
1796
1815
|
shaderObject .x3d_SpecularGlossinessTexture,
|
|
1797
1816
|
this ._specularGlossinessTextureMapping .getValue (),
|
|
1798
1817
|
textureTransformMapping,
|
|
@@ -1803,8 +1822,6 @@ Object .assign (Object .setPrototypeOf (SpecularGlossinessMaterial .prototype, (
|
|
|
1803
1822
|
gl .uniform1f (shaderObject .x3d_OcclusionStrength, this .occlusionStrength);
|
|
1804
1823
|
|
|
1805
1824
|
this .occlusionTextureNode .setNamedShaderUniforms (gl,
|
|
1806
|
-
shaderObject,
|
|
1807
|
-
renderObject,
|
|
1808
1825
|
shaderObject .x3d_OcclusionTexture,
|
|
1809
1826
|
this ._occlusionTextureMapping .getValue (),
|
|
1810
1827
|
textureTransformMapping,
|
|
@@ -1945,7 +1962,7 @@ Object .assign (Object .setPrototypeOf (SpecularMaterialExtension .prototype, X_
|
|
|
1945
1962
|
uniforms .push ("x3d_SpecularEXT");
|
|
1946
1963
|
uniforms .push ("x3d_SpecularColorEXT");
|
|
1947
1964
|
},
|
|
1948
|
-
setShaderUniforms (gl, shaderObject,
|
|
1965
|
+
setShaderUniforms (gl, shaderObject, textureTransformMapping, textureCoordinateMapping)
|
|
1949
1966
|
{
|
|
1950
1967
|
gl .uniform1f (shaderObject .x3d_SpecularEXT, this .specular);
|
|
1951
1968
|
gl .uniform3fv (shaderObject .x3d_SpecularColorEXT, this .specularColorArray);
|
|
@@ -1954,16 +1971,12 @@ Object .assign (Object .setPrototypeOf (SpecularMaterialExtension .prototype, X_
|
|
|
1954
1971
|
return;
|
|
1955
1972
|
|
|
1956
1973
|
this .specularTextureNode ?.setNamedShaderUniforms (gl,
|
|
1957
|
-
shaderObject,
|
|
1958
|
-
renderObject,
|
|
1959
1974
|
shaderObject .x3d_SpecularTextureEXT,
|
|
1960
1975
|
this ._specularTextureMapping .getValue (),
|
|
1961
1976
|
textureTransformMapping,
|
|
1962
1977
|
textureCoordinateMapping);
|
|
1963
1978
|
|
|
1964
1979
|
this .specularColorTextureNode ?.setNamedShaderUniforms (gl,
|
|
1965
|
-
shaderObject,
|
|
1966
|
-
renderObject,
|
|
1967
1980
|
shaderObject .x3d_SpecularColorTextureEXT,
|
|
1968
1981
|
this ._specularColorTextureMapping .getValue (),
|
|
1969
1982
|
textureTransformMapping,
|
|
@@ -1993,6 +2006,8 @@ const SpecularMaterialExtension_default_ = SpecularMaterialExtension;
|
|
|
1993
2006
|
;
|
|
1994
2007
|
|
|
1995
2008
|
/* harmony default export */ const X_ITE_SpecularMaterialExtension = (external_X_ITE_X3D_Namespace_default().add ("SpecularMaterialExtension", SpecularMaterialExtension_default_));
|
|
2009
|
+
;// external "__X_ITE_X3D__ .RenderPass"
|
|
2010
|
+
const external_X_ITE_X3D_RenderPass_namespaceObject = __X_ITE_X3D__ .RenderPass;
|
|
1996
2011
|
;// ./src/x_ite/Components/X_ITE/TransmissionMaterialExtension.js
|
|
1997
2012
|
|
|
1998
2013
|
|
|
@@ -2004,6 +2019,7 @@ const SpecularMaterialExtension_default_ = SpecularMaterialExtension;
|
|
|
2004
2019
|
|
|
2005
2020
|
|
|
2006
2021
|
|
|
2022
|
+
|
|
2007
2023
|
// Register key.
|
|
2008
2024
|
|
|
2009
2025
|
X_ITE_ExtensionKeys .add ("TRANSMISSION_MATERIAL_EXTENSION");
|
|
@@ -2067,54 +2083,31 @@ Object .assign (Object .setPrototypeOf (TransmissionMaterialExtension .prototype
|
|
|
2067
2083
|
uniforms .push ("x3d_TransmissionEXT");
|
|
2068
2084
|
uniforms .push ("x3d_TransmissionSamplerEXT");
|
|
2069
2085
|
},
|
|
2070
|
-
setShaderUniforms
|
|
2086
|
+
setShaderUniforms (gl, shaderObject, textureTransformMapping, textureCoordinateMapping)
|
|
2071
2087
|
{
|
|
2072
|
-
|
|
2088
|
+
// These shapes must not be rendered during transmission pass!
|
|
2073
2089
|
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
// Transmission framebuffer texture
|
|
2090
|
+
const
|
|
2091
|
+
browser = this .getBrowser (),
|
|
2092
|
+
transmissionBuffer = browser .getTransmissionBuffer (),
|
|
2093
|
+
transmissionUnit = browser .getTextureUnit (),
|
|
2094
|
+
transmissionBufferTexture = transmissionBuffer .getColorTexture ();
|
|
2081
2095
|
|
|
2082
|
-
|
|
2083
|
-
transmissionBuffer,
|
|
2084
|
-
transmissionUnit,
|
|
2085
|
-
transmissionBufferTexture;
|
|
2096
|
+
gl .uniform1f (shaderObject .x3d_TransmissionEXT, this .transmission);
|
|
2086
2097
|
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
transmissionBufferTexture = browser .getDefaultTexture2D ();
|
|
2098
|
+
gl .activeTexture (gl .TEXTURE0 + transmissionUnit);
|
|
2099
|
+
gl .bindTexture (gl .TEXTURE_2D, transmissionBufferTexture);
|
|
2100
|
+
gl .uniform1i (shaderObject .x3d_TransmissionSamplerEXT, transmissionUnit);
|
|
2091
2101
|
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
}
|
|
2095
|
-
else
|
|
2096
|
-
{
|
|
2097
|
-
transmissionBuffer = browser .getTransmissionBuffer ();
|
|
2098
|
-
transmissionUnit = browser .getTextureUnit ();
|
|
2099
|
-
transmissionBufferTexture = transmissionBuffer .getColorTexture ();
|
|
2100
|
-
}
|
|
2101
|
-
|
|
2102
|
-
gl .activeTexture (gl .TEXTURE0 + transmissionUnit);
|
|
2103
|
-
gl .bindTexture (gl .TEXTURE_2D, transmissionBufferTexture);
|
|
2104
|
-
gl .uniform1i (shaderObject .x3d_TransmissionSamplerEXT, transmissionUnit);
|
|
2105
|
-
|
|
2106
|
-
if (!+this .getTextureBits ())
|
|
2107
|
-
return;
|
|
2102
|
+
if (!+this .getTextureBits ())
|
|
2103
|
+
return;
|
|
2108
2104
|
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
textureCoordinateMapping);
|
|
2116
|
-
};
|
|
2117
|
-
})(),
|
|
2105
|
+
this .transmissionTextureNode ?.setNamedShaderUniforms (gl,
|
|
2106
|
+
shaderObject .x3d_TransmissionTextureEXT,
|
|
2107
|
+
this ._transmissionTextureMapping .getValue (),
|
|
2108
|
+
textureTransformMapping,
|
|
2109
|
+
textureCoordinateMapping);
|
|
2110
|
+
},
|
|
2118
2111
|
});
|
|
2119
2112
|
|
|
2120
2113
|
Object .defineProperties (TransmissionMaterialExtension,
|
|
@@ -2231,7 +2224,7 @@ Object .assign (Object .setPrototypeOf (VolumeMaterialExtension .prototype, X_IT
|
|
|
2231
2224
|
uniforms .push ("x3d_AttenuationDistanceEXT");
|
|
2232
2225
|
uniforms .push ("x3d_AttenuationColorEXT");
|
|
2233
2226
|
},
|
|
2234
|
-
setShaderUniforms (gl, shaderObject,
|
|
2227
|
+
setShaderUniforms (gl, shaderObject, textureTransformMapping, textureCoordinateMapping)
|
|
2235
2228
|
{
|
|
2236
2229
|
gl .uniform1f (shaderObject .x3d_ThicknessEXT, this .thickness);
|
|
2237
2230
|
gl .uniform1f (shaderObject .x3d_AttenuationDistanceEXT, this .attenuationDistance);
|
|
@@ -2241,8 +2234,6 @@ Object .assign (Object .setPrototypeOf (VolumeMaterialExtension .prototype, X_IT
|
|
|
2241
2234
|
return;
|
|
2242
2235
|
|
|
2243
2236
|
this .thicknessTextureNode ?.setNamedShaderUniforms (gl,
|
|
2244
|
-
shaderObject,
|
|
2245
|
-
renderObject,
|
|
2246
2237
|
shaderObject .x3d_ThicknessTextureEXT,
|
|
2247
2238
|
this ._thicknessTextureMapping .getValue (),
|
|
2248
2239
|
textureTransformMapping,
|
|
@@ -2271,6 +2262,332 @@ const VolumeMaterialExtension_default_ = VolumeMaterialExtension;
|
|
|
2271
2262
|
;
|
|
2272
2263
|
|
|
2273
2264
|
/* harmony default export */ const X_ITE_VolumeMaterialExtension = (external_X_ITE_X3D_Namespace_default().add ("VolumeMaterialExtension", VolumeMaterialExtension_default_));
|
|
2265
|
+
;// ./src/x_ite/Browser/X_ITE/ScatterSamples.js
|
|
2266
|
+
class ScatterSamples
|
|
2267
|
+
{
|
|
2268
|
+
static SCATTER_SAMPLES_COUNT = 55; // Number of samples for the Burley diffusion profile.
|
|
2269
|
+
|
|
2270
|
+
static
|
|
2271
|
+
{
|
|
2272
|
+
const [scatterSamples, minRadius] = this .#computeScatterSamples ();
|
|
2273
|
+
|
|
2274
|
+
this .SCATTER_SAMPLES = scatterSamples;
|
|
2275
|
+
this .SCATTER_MIN_RADIUS = minRadius;
|
|
2276
|
+
}
|
|
2277
|
+
|
|
2278
|
+
/**
|
|
2279
|
+
* Using blender implementation of Burley diffusion profile.
|
|
2280
|
+
*/
|
|
2281
|
+
static #computeScatterSamples ()
|
|
2282
|
+
{
|
|
2283
|
+
// Precompute sample position with white albedo.
|
|
2284
|
+
const d = this .#burleySetup (1, 1);
|
|
2285
|
+
|
|
2286
|
+
const randU = 0.5; // Random value between 0 and 1, fixed here for determinism.
|
|
2287
|
+
const randV = 0.5;
|
|
2288
|
+
|
|
2289
|
+
// Find minimum radius that we can represent because we are only sampling the largest radius.
|
|
2290
|
+
let min_radius = 1;
|
|
2291
|
+
|
|
2292
|
+
const goldenAngle = Math .PI * (3 - Math .sqrt (5));
|
|
2293
|
+
const uniformArray = [ ];
|
|
2294
|
+
|
|
2295
|
+
for (let i = 0; i < this .SCATTER_SAMPLES_COUNT; ++ i)
|
|
2296
|
+
{
|
|
2297
|
+
const theta = goldenAngle * i + Math .PI * 2 * randU;
|
|
2298
|
+
const x = (randV + i) / this .SCATTER_SAMPLES_COUNT;
|
|
2299
|
+
const r = this .#burleySample (d, x);
|
|
2300
|
+
|
|
2301
|
+
min_radius = Math .min (min_radius, r);
|
|
2302
|
+
|
|
2303
|
+
uniformArray .push (theta, r, 1 / this .#burleyPdf (d, r));
|
|
2304
|
+
}
|
|
2305
|
+
|
|
2306
|
+
// Avoid float imprecision.
|
|
2307
|
+
min_radius = Math .max (min_radius, 0.00001);
|
|
2308
|
+
|
|
2309
|
+
return [new Float32Array (uniformArray), min_radius];
|
|
2310
|
+
}
|
|
2311
|
+
|
|
2312
|
+
static #burleySample (d, xRand)
|
|
2313
|
+
{
|
|
2314
|
+
xRand *= 0.9963790093708328;
|
|
2315
|
+
|
|
2316
|
+
const tolerance = 1e-6;
|
|
2317
|
+
const maxIterationCount = 10;
|
|
2318
|
+
|
|
2319
|
+
let r;
|
|
2320
|
+
|
|
2321
|
+
if (xRand <= 0.9)
|
|
2322
|
+
r = Math .exp (xRand * xRand * 2.4) - 1;
|
|
2323
|
+
else
|
|
2324
|
+
r = 15;
|
|
2325
|
+
|
|
2326
|
+
// Solve against scaled radius.
|
|
2327
|
+
for (let i = 0; i < maxIterationCount; ++ i)
|
|
2328
|
+
{
|
|
2329
|
+
const exp_r_3 = Math .exp (-r / 3);
|
|
2330
|
+
const exp_r = exp_r_3 * exp_r_3 * exp_r_3;
|
|
2331
|
+
const f = 1 - 0.25 * exp_r - 0.75 * exp_r_3 - xRand;
|
|
2332
|
+
const f_ = 0.25 * exp_r + 0.25 * exp_r_3;
|
|
2333
|
+
|
|
2334
|
+
if (Math .abs (f) < tolerance || f_ === 0)
|
|
2335
|
+
break;
|
|
2336
|
+
|
|
2337
|
+
r = r - f / f_;
|
|
2338
|
+
r = Math .max (r, 0);
|
|
2339
|
+
}
|
|
2340
|
+
|
|
2341
|
+
return r * d;
|
|
2342
|
+
}
|
|
2343
|
+
|
|
2344
|
+
static #burleyEval (d, r)
|
|
2345
|
+
{
|
|
2346
|
+
if (r >= 16 * d)
|
|
2347
|
+
return 0;
|
|
2348
|
+
|
|
2349
|
+
const exp_r_3_d = Math .exp (-r / (3 * d));
|
|
2350
|
+
const exp_r_d = exp_r_3_d * exp_r_3_d * exp_r_3_d;
|
|
2351
|
+
|
|
2352
|
+
return (exp_r_d + exp_r_3_d) / (8 * Math .PI * d);
|
|
2353
|
+
}
|
|
2354
|
+
|
|
2355
|
+
static #burleyPdf (d, r)
|
|
2356
|
+
{
|
|
2357
|
+
return this .#burleyEval (d, r) / 0.9963790093708328;
|
|
2358
|
+
}
|
|
2359
|
+
|
|
2360
|
+
static #burleySetup (radius, albedo)
|
|
2361
|
+
{
|
|
2362
|
+
const m_1_pi = 0.318309886183790671538;
|
|
2363
|
+
const s = 1.9 - albedo + 3.5 * ((albedo - 0.8) * (albedo - 0.8));
|
|
2364
|
+
const l = 0.25 * m_1_pi * radius;
|
|
2365
|
+
|
|
2366
|
+
return l / s;
|
|
2367
|
+
}
|
|
2368
|
+
}
|
|
2369
|
+
|
|
2370
|
+
const ScatterSamples_default_ = ScatterSamples;
|
|
2371
|
+
;
|
|
2372
|
+
|
|
2373
|
+
/* harmony default export */ const X_ITE_ScatterSamples = (external_X_ITE_X3D_Namespace_default().add ("ScatterSamples", ScatterSamples_default_));
|
|
2374
|
+
;// ./src/assets/shaders/webgl2/pbr/Scatter2.glsl.js
|
|
2375
|
+
const Scatter2_glsl_default_ = () => /* glsl */ `
|
|
2376
|
+
uniform float x3d_ScatterMaterialIdEXT;vec4 getMaterialColor(){vec3 singleScatter=multiToSingleScatter();vec4 baseColor=getBaseColor();
|
|
2377
|
+
#if defined(X3D_TEXTURE_PROJECTION)
|
|
2378
|
+
baseColor.rgb*=getTextureProjectorColor();
|
|
2379
|
+
#endif
|
|
2380
|
+
vec3 frontColor=vec3(0);vec3 v=normalize(-vertex);
|
|
2381
|
+
#if defined(X3D_USE_IBL)||defined(X3D_LIGHTING)
|
|
2382
|
+
NormalInfo normalInfo=getNormalInfo(x3d_Material.normalScale);vec3 n=normalInfo.n;float NdotV=clamp(dot(n,v),0.,1.);
|
|
2383
|
+
#endif
|
|
2384
|
+
MaterialInfo materialInfo;materialInfo.baseColor=baseColor.rgb;materialInfo.ior=1.5;materialInfo.f0_dielectric=vec3(.04);materialInfo.specularWeight=1.;materialInfo.f90=vec3(1);materialInfo.f90_dielectric=materialInfo.f90;
|
|
2385
|
+
#if defined(X3D_IOR_MATERIAL_EXT)
|
|
2386
|
+
materialInfo=getIorInfo(materialInfo);
|
|
2387
|
+
#endif
|
|
2388
|
+
#if defined(X3D_MATERIAL_METALLIC_ROUGHNESS)
|
|
2389
|
+
materialInfo=getMetallicRoughnessInfo(materialInfo);
|
|
2390
|
+
#endif
|
|
2391
|
+
#if defined(X3D_SHEEN_MATERIAL_EXT)
|
|
2392
|
+
materialInfo=getSheenInfo(materialInfo);
|
|
2393
|
+
#endif
|
|
2394
|
+
#if defined(X3D_SPECULAR_MATERIAL_EXT)
|
|
2395
|
+
materialInfo=getSpecularInfo(materialInfo);
|
|
2396
|
+
#endif
|
|
2397
|
+
#if defined(X3D_TRANSMISSION_MATERIAL_EXT)
|
|
2398
|
+
materialInfo=getTransmissionInfo(materialInfo);
|
|
2399
|
+
#endif
|
|
2400
|
+
#if defined(X3D_VOLUME_MATERIAL_EXT)
|
|
2401
|
+
materialInfo=getVolumeInfo(materialInfo);
|
|
2402
|
+
#endif
|
|
2403
|
+
#if defined(X3D_DIFFUSE_TRANSMISSION_MATERIAL_EXT)
|
|
2404
|
+
materialInfo=getDiffuseTransmissionInfo(materialInfo);
|
|
2405
|
+
#endif
|
|
2406
|
+
materialInfo.perceptualRoughness=clamp(materialInfo.perceptualRoughness,0.,1.);materialInfo.alphaRoughness=materialInfo.perceptualRoughness*materialInfo.perceptualRoughness;vec3 f_specular_dielectric=vec3(0);vec3 f_diffuse=vec3(0);vec3 f_dielectric_brdf_ibl=vec3(0);float albedoSheenScaling=1.;float diffuseTransmissionThickness=1.;
|
|
2407
|
+
#if defined(X3D_DIFFUSE_TRANSMISSION_MATERIAL_EXT)
|
|
2408
|
+
#if defined(X3D_VOLUME_MATERIAL_EXT)
|
|
2409
|
+
diffuseTransmissionThickness=materialInfo.thickness*(length(x3d_ModelViewMatrix[0].xyz)+length(x3d_ModelViewMatrix[1].xyz)+length(x3d_ModelViewMatrix[2].xyz))/3.;
|
|
2410
|
+
#endif
|
|
2411
|
+
#endif
|
|
2412
|
+
#if defined(X3D_USE_IBL)
|
|
2413
|
+
#if defined(X3D_DIFFUSE_TRANSMISSION_MATERIAL_EXT)
|
|
2414
|
+
f_diffuse=getDiffuseLight(n)*materialInfo.diffuseTransmissionColorFactor*singleScatter;vec3 diffuseTransmissionIBL=getDiffuseLight(-n)*materialInfo.diffuseTransmissionColorFactor;
|
|
2415
|
+
#if defined(X3D_VOLUME_MATERIAL_EXT)
|
|
2416
|
+
diffuseTransmissionIBL=applyVolumeAttenuation(diffuseTransmissionIBL,diffuseTransmissionThickness,materialInfo.attenuationColor,materialInfo.attenuationDistance);
|
|
2417
|
+
#endif
|
|
2418
|
+
f_diffuse+=diffuseTransmissionIBL*(1.-singleScatter)*singleScatter;f_diffuse*=materialInfo.diffuseTransmissionFactor;
|
|
2419
|
+
#endif
|
|
2420
|
+
#if defined(X3D_SHEEN_MATERIAL_EXT)
|
|
2421
|
+
albedoSheenScaling=1.-max3(materialInfo.sheenColorFactor)*albedoSheenScalingLUT(NdotV,materialInfo.sheenRoughnessFactor);
|
|
2422
|
+
#endif
|
|
2423
|
+
vec3 f_dielectric_fresnel_ibl=getIBLGGXFresnel(n,v,materialInfo.perceptualRoughness,materialInfo.f0_dielectric,materialInfo.specularWeight);frontColor+=mix(f_diffuse,f_specular_dielectric,f_dielectric_fresnel_ibl)*albedoSheenScaling;
|
|
2424
|
+
#endif
|
|
2425
|
+
#if defined(X3D_LIGHTING)
|
|
2426
|
+
for(int i=0;i<X3D_NUM_LIGHTS;++i){x3d_LightSourceParameters light=x3d_LightSource[i];vec3 pointToLight;float distanceToLight;if(light.type!=x3d_DirectionalLight){pointToLight=light.location-vertex;distanceToLight=length(light.matrix*pointToLight);}else{pointToLight=-light.direction;distanceToLight=-1.;}if(distanceToLight<=light.radius||light.radius<0.){vec3 l=normalize(pointToLight);vec3 h=normalize(l+v);float NdotL=clamp(dot(n,l),0.,1.);float VdotH=clamp(dot(v,h),0.,1.);vec3 dielectric_fresnel=F_Schlick(materialInfo.f0_dielectric*materialInfo.specularWeight,materialInfo.f90_dielectric,abs(VdotH));vec3 l_diffuse=vec3(0);vec3 l_specular_dielectric=vec3(0);vec3 l_dielectric_brdf=vec3(0);
|
|
2427
|
+
#if defined(X3D_DIFFUSE_TRANSMISSION_MATERIAL_EXT)
|
|
2428
|
+
vec3 lightIntensity=getLightIntensity(light,l,distanceToLight);l_diffuse=lightIntensity*NdotL*BRDF_lambertian(materialInfo.diffuseTransmissionColorFactor)*singleScatter;if(dot(n,l)<0.){float diffuseNdotL=clamp(dot(-n,l),0.,1.);vec3 diffuse_btdf=lightIntensity*diffuseNdotL*BRDF_lambertian(materialInfo.diffuseTransmissionColorFactor);vec3 l_mirror=normalize(reflect(l,n));float diffuseVdotH=clamp(dot(v,normalize(l_mirror+v)),0.,1.);dielectric_fresnel=F_Schlick(materialInfo.f0_dielectric*materialInfo.specularWeight,materialInfo.f90_dielectric,abs(diffuseVdotH));
|
|
2429
|
+
#if defined(X3D_VOLUME_MATERIAL_EXT)
|
|
2430
|
+
diffuse_btdf=applyVolumeAttenuation(diffuse_btdf,diffuseTransmissionThickness,materialInfo.attenuationColor,materialInfo.attenuationDistance);
|
|
2431
|
+
#endif
|
|
2432
|
+
l_diffuse+=diffuse_btdf*(1.-singleScatter)*singleScatter;}l_diffuse*=materialInfo.diffuseTransmissionFactor;
|
|
2433
|
+
#endif
|
|
2434
|
+
#if defined(X3D_SHEEN_MATERIAL_EXT)
|
|
2435
|
+
albedoSheenScaling=min(1.-max3(materialInfo.sheenColorFactor)*albedoSheenScalingLUT(NdotV,materialInfo.sheenRoughnessFactor),1.-max3(materialInfo.sheenColorFactor)*albedoSheenScalingLUT(NdotL,materialInfo.sheenRoughnessFactor));
|
|
2436
|
+
#endif
|
|
2437
|
+
l_dielectric_brdf=mix(l_diffuse,l_specular_dielectric,dielectric_fresnel);frontColor+=l_dielectric_brdf*albedoSheenScaling;}}
|
|
2438
|
+
#endif
|
|
2439
|
+
return vec4(frontColor,x3d_ScatterMaterialIdEXT);}`
|
|
2440
|
+
;
|
|
2441
|
+
|
|
2442
|
+
/* harmony default export */ const Scatter2_glsl = (external_X_ITE_X3D_Namespace_default().add ("Scatter2.glsl", Scatter2_glsl_default_));
|
|
2443
|
+
;// ./src/assets/shaders/webgl2/pbr/SubsurfaceScattering2.glsl.js
|
|
2444
|
+
const SubsurfaceScattering2_glsl_default_ = () => /* glsl */ `
|
|
2445
|
+
#if defined(X3D_VOLUME_SCATTER_MATERIAL_EXT)
|
|
2446
|
+
uniform vec3 x3d_MultiscatterColorEXT;vec3 multiToSingleScatter(){vec3 s=4.09712+4.20863*x3d_MultiscatterColorEXT-sqrt(9.59217+(41.6808+17.7126*x3d_MultiscatterColorEXT)*x3d_MultiscatterColorEXT);return 1.-s*s;}
|
|
2447
|
+
#if!defined(X3D_VOLUME_SCATTER_PASS)
|
|
2448
|
+
uniform float x3d_ScatterAnisotropyEXT;uniform vec3 x3d_ScatterSamplesEXT[X3D_SCATTER_SAMPLES_COUNT_EXT];uniform float x3d_ScatterMinRadiusEXT;uniform sampler2D x3d_ScatterSamplerEXT;uniform sampler2D x3d_ScatterDepthSamplerEXT;const float M_1_PI=1./M_PI;vec3 burley_setup(const in vec3 radius,const in vec3 albedo){vec3 a=albedo-.8;vec3 s=1.9-albedo+3.5*(a*a);vec3 l=.25*M_1_PI*radius;return l/s;}vec3 burley_eval(const in vec3 d,const in float r){vec3 exp_r_3_d=exp(-r/(3.*d));vec3 exp_r_d=exp_r_3_d*exp_r_3_d*exp_r_3_d;return(exp_r_d+exp_r_3_d)/(4.*d);}vec3 getSubsurfaceScattering(const in vec3 vertex,const in mat4 projectionMatrix,const in float attenuationDistance,const in vec3 diffuseColor){vec3 scatterDistance=attenuationDistance*x3d_MultiscatterColorEXT;float maxColor=max3(scatterDistance);vec3 vMaxColor=max(vec3(maxColor),vec3(.00001));vec2 texelSize=1./vec2(x3d_Viewport.zw);mat4 invProjectionMatrix=inverse(projectionMatrix);vec2 uv=gl_FragCoord.xy*texelSize;vec4 centerSample=textureLod(x3d_ScatterSamplerEXT,uv,0.);float centerDepth=textureLod(x3d_ScatterDepthSamplerEXT,uv,0.).r;centerDepth=centerDepth*2.-1.;vec2 clipUV=uv*2.-1.;vec4 clipSpacePosition=vec4(clipUV.xy,centerDepth,1.);vec4 upos=invProjectionMatrix*clipSpacePosition;vec3 fragViewPosition=upos.xyz/upos.w;upos=invProjectionMatrix*vec4(clipUV.x+texelSize.x,clipUV.y,centerDepth,1.);vec3 offsetViewPosition=upos.xyz/upos.w;float mPerPixel=distance(fragViewPosition,offsetViewPosition);float maxRadiusPixels=maxColor/mPerPixel;if(maxRadiusPixels<=1.)return centerSample.rgb;centerDepth=fragViewPosition.z;vec3 totalWeight=vec3(0);vec3 totalDiffuse=vec3(0);vec3 clampedScatterDistance=max(vec3(x3d_ScatterMinRadiusEXT),scatterDistance/maxColor)*maxColor;vec3 d=burley_setup(clampedScatterDistance,vec3(1));for(int i=0;i<X3D_SCATTER_SAMPLES_COUNT_EXT;++i){vec3 scatterSample=x3d_ScatterSamplesEXT[i];float fabAngle=scatterSample.x;float r=scatterSample.y*maxRadiusPixels*texelSize.x;float rcpPdf=scatterSample.z;vec2 sampleCoords=vec2(cos(fabAngle),sin(fabAngle))*r;vec2 sampleUV=uv+sampleCoords;vec4 textureSample=textureLod(x3d_ScatterSamplerEXT,sampleUV,0.);if(centerSample.w!=textureSample.w)continue;float sampleDepth=textureLod(x3d_ScatterDepthSamplerEXT,sampleUV,0.).r;sampleDepth=sampleDepth*2.-1.;vec2 sampleClipUV=sampleUV*2.-1.;vec4 sampleUpos=invProjectionMatrix*vec4(sampleClipUV.xy,sampleDepth,1.);vec3 sampleViewPosition=sampleUpos.xyz/sampleUpos.w;float sampleDistance=distance(sampleViewPosition,fragViewPosition);vec3 weight=burley_eval(d,sampleDistance)*rcpPdf;totalWeight+=weight;totalDiffuse+=weight*textureSample.rgb;}totalWeight=max(totalWeight,vec3(.0001));return totalDiffuse/totalWeight*diffuseColor;}
|
|
2449
|
+
#endif
|
|
2450
|
+
#endif
|
|
2451
|
+
`
|
|
2452
|
+
;
|
|
2453
|
+
|
|
2454
|
+
/* harmony default export */ const SubsurfaceScattering2_glsl = (external_X_ITE_X3D_Namespace_default().add ("SubsurfaceScattering2.glsl", SubsurfaceScattering2_glsl_default_));
|
|
2455
|
+
;// ./src/x_ite/Components/X_ITE/VolumeScatterMaterialExtension.js
|
|
2456
|
+
|
|
2457
|
+
|
|
2458
|
+
|
|
2459
|
+
|
|
2460
|
+
|
|
2461
|
+
|
|
2462
|
+
|
|
2463
|
+
|
|
2464
|
+
|
|
2465
|
+
|
|
2466
|
+
// Register key.
|
|
2467
|
+
|
|
2468
|
+
X_ITE_ExtensionKeys .add ("VOLUME_SCATTER_MATERIAL_EXTENSION");
|
|
2469
|
+
|
|
2470
|
+
// Register shaders.
|
|
2471
|
+
|
|
2472
|
+
|
|
2473
|
+
|
|
2474
|
+
|
|
2475
|
+
|
|
2476
|
+
external_X_ITE_X3D_ShaderRegistry_default().addInclude ("Scatter", Scatter2_glsl);
|
|
2477
|
+
external_X_ITE_X3D_ShaderRegistry_default().addInclude ("SubsurfaceScattering", SubsurfaceScattering2_glsl);
|
|
2478
|
+
|
|
2479
|
+
/**
|
|
2480
|
+
* THIS NODE IS STILL EXPERIMENTAL.
|
|
2481
|
+
*/
|
|
2482
|
+
|
|
2483
|
+
function VolumeScatterMaterialExtension (executionContext)
|
|
2484
|
+
{
|
|
2485
|
+
X_ITE_X3DMaterialExtensionNode .call (this, executionContext);
|
|
2486
|
+
|
|
2487
|
+
this .addType ((external_X_ITE_X3D_X3DConstants_default()).VolumeScatterMaterialExtension);
|
|
2488
|
+
|
|
2489
|
+
// Private properties
|
|
2490
|
+
|
|
2491
|
+
this .multiscatterColorArray = new Float32Array (3);
|
|
2492
|
+
}
|
|
2493
|
+
|
|
2494
|
+
Object .assign (Object .setPrototypeOf (VolumeScatterMaterialExtension .prototype, X_ITE_X3DMaterialExtensionNode .prototype),
|
|
2495
|
+
{
|
|
2496
|
+
initialize ()
|
|
2497
|
+
{
|
|
2498
|
+
X_ITE_X3DMaterialExtensionNode .prototype .initialize .call (this);
|
|
2499
|
+
|
|
2500
|
+
this ._multiscatterColor .addInterest ("set_multiscatterColor__", this);
|
|
2501
|
+
this ._scatterAnisotropy .addInterest ("set_scatterAnisotropy__", this);
|
|
2502
|
+
|
|
2503
|
+
this .set_multiscatterColor__ ();
|
|
2504
|
+
this .set_scatterAnisotropy__ ();
|
|
2505
|
+
},
|
|
2506
|
+
set_multiscatterColor__ ()
|
|
2507
|
+
{
|
|
2508
|
+
this .multiscatterColorArray .set (this ._multiscatterColor .getValue ());
|
|
2509
|
+
},
|
|
2510
|
+
set_scatterAnisotropy__ ()
|
|
2511
|
+
{
|
|
2512
|
+
this .scatterAnisotropy = external_X_ITE_X3D_Algorithm_default().clamp (this ._scatterAnisotropy .getValue (), -1, 1);
|
|
2513
|
+
},
|
|
2514
|
+
getExtensionKey ()
|
|
2515
|
+
{
|
|
2516
|
+
return X_ITE_ExtensionKeys .VOLUME_SCATTER_MATERIAL_EXTENSION;
|
|
2517
|
+
},
|
|
2518
|
+
getShaderOptions (options)
|
|
2519
|
+
{
|
|
2520
|
+
const gl = this .getBrowser () .getContext ();
|
|
2521
|
+
|
|
2522
|
+
if (gl .getVersion () < 2)
|
|
2523
|
+
return;
|
|
2524
|
+
|
|
2525
|
+
options .push ("X3D_VOLUME_SCATTER_MATERIAL_EXT");
|
|
2526
|
+
options .push (`X3D_SCATTER_SAMPLES_COUNT_EXT ${X_ITE_ScatterSamples .SCATTER_SAMPLES_COUNT}`);
|
|
2527
|
+
},
|
|
2528
|
+
getShaderUniforms (uniforms)
|
|
2529
|
+
{
|
|
2530
|
+
uniforms .push ("x3d_ScatterMaterialIdEXT");
|
|
2531
|
+
uniforms .push ("x3d_MultiscatterColorEXT");
|
|
2532
|
+
uniforms .push ("x3d_ScatterAnisotropyEXT");
|
|
2533
|
+
uniforms .push ("x3d_ScatterSamplesEXT");
|
|
2534
|
+
uniforms .push ("x3d_ScatterMinRadiusEXT");
|
|
2535
|
+
uniforms .push ("x3d_ScatterSamplerEXT");
|
|
2536
|
+
uniforms .push ("x3d_ScatterDepthSamplerEXT");
|
|
2537
|
+
},
|
|
2538
|
+
setShaderUniforms (gl, shaderObject, textureTransformMapping, textureCoordinateMapping)
|
|
2539
|
+
{
|
|
2540
|
+
const browser = this .getBrowser ();
|
|
2541
|
+
|
|
2542
|
+
if (shaderObject .volumeScatterPass)
|
|
2543
|
+
{
|
|
2544
|
+
gl .uniform1f (shaderObject .x3d_ScatterMaterialIdEXT, browser .getShapeId ());
|
|
2545
|
+
gl .uniform3fv (shaderObject .x3d_MultiscatterColorEXT, this .multiscatterColorArray);
|
|
2546
|
+
return;
|
|
2547
|
+
}
|
|
2548
|
+
|
|
2549
|
+
gl .uniform3fv (shaderObject .x3d_MultiscatterColorEXT, this .multiscatterColorArray);
|
|
2550
|
+
gl .uniform1f (shaderObject .x3d_ScatterAnisotropyEXT, this .scatterAnisotropy);
|
|
2551
|
+
gl .uniform3fv (shaderObject .x3d_ScatterSamplesEXT, X_ITE_ScatterSamples .SCATTER_SAMPLES);
|
|
2552
|
+
gl .uniform1f (shaderObject .x3d_ScatterMinRadiusEXT, X_ITE_ScatterSamples .SCATTER_MIN_RADIUS);
|
|
2553
|
+
|
|
2554
|
+
// Set scatter framebuffer textures.
|
|
2555
|
+
|
|
2556
|
+
const
|
|
2557
|
+
scatterSampleBuffer = browser .getVolumeScatterBuffer (),
|
|
2558
|
+
scatterSampleUnit = browser .getTextureUnit (),
|
|
2559
|
+
scatterDepthSampleUnit = browser .getTextureUnit (),
|
|
2560
|
+
scatterSampleTexture = scatterSampleBuffer .getColorTexture (),
|
|
2561
|
+
scatterDepthSampleTexture = scatterSampleBuffer .getDepthTexture ();
|
|
2562
|
+
|
|
2563
|
+
gl .activeTexture (gl .TEXTURE0 + scatterSampleUnit);
|
|
2564
|
+
gl .bindTexture (gl .TEXTURE_2D, scatterSampleTexture);
|
|
2565
|
+
gl .uniform1i (shaderObject .x3d_ScatterSamplerEXT, scatterSampleUnit);
|
|
2566
|
+
|
|
2567
|
+
gl .activeTexture (gl .TEXTURE0 + scatterDepthSampleUnit);
|
|
2568
|
+
gl .bindTexture (gl .TEXTURE_2D, scatterDepthSampleTexture);
|
|
2569
|
+
gl .uniform1i (shaderObject .x3d_ScatterDepthSamplerEXT, scatterDepthSampleUnit);
|
|
2570
|
+
},
|
|
2571
|
+
});
|
|
2572
|
+
|
|
2573
|
+
Object .defineProperties (VolumeScatterMaterialExtension,
|
|
2574
|
+
{
|
|
2575
|
+
... external_X_ITE_X3D_X3DNode_default().getStaticProperties ("VolumeScatterMaterialExtension", "X_ITE", 1, "extensions", "4.0"),
|
|
2576
|
+
fieldDefinitions:
|
|
2577
|
+
{
|
|
2578
|
+
value: new (external_X_ITE_X3D_FieldDefinitionArray_default()) ([
|
|
2579
|
+
new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).inputOutput, "metadata", new (external_X_ITE_X3D_Fields_default()).SFNode ()),
|
|
2580
|
+
new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).inputOutput, "multiscatterColor", new (external_X_ITE_X3D_Fields_default()).SFColor ()),
|
|
2581
|
+
new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).inputOutput, "scatterAnisotropy", new (external_X_ITE_X3D_Fields_default()).SFFloat ()),
|
|
2582
|
+
]),
|
|
2583
|
+
enumerable: true,
|
|
2584
|
+
},
|
|
2585
|
+
});
|
|
2586
|
+
|
|
2587
|
+
const VolumeScatterMaterialExtension_default_ = VolumeScatterMaterialExtension;
|
|
2588
|
+
;
|
|
2589
|
+
|
|
2590
|
+
/* harmony default export */ const X_ITE_VolumeScatterMaterialExtension = (external_X_ITE_X3D_Namespace_default().add ("VolumeScatterMaterialExtension", VolumeScatterMaterialExtension_default_));
|
|
2274
2591
|
;// ./src/assets/components/X_ITEComponent.js
|
|
2275
2592
|
|
|
2276
2593
|
|
|
@@ -2290,6 +2607,8 @@ const VolumeMaterialExtension_default_ = VolumeMaterialExtension;
|
|
|
2290
2607
|
|
|
2291
2608
|
|
|
2292
2609
|
|
|
2610
|
+
|
|
2611
|
+
|
|
2293
2612
|
external_X_ITE_X3D_Components_default().add ({
|
|
2294
2613
|
name: "X_ITE",
|
|
2295
2614
|
concreteNodes:
|
|
@@ -2309,11 +2628,13 @@ external_X_ITE_X3D_Components_default().add ({
|
|
|
2309
2628
|
X_ITE_SpecularMaterialExtension,
|
|
2310
2629
|
X_ITE_TransmissionMaterialExtension,
|
|
2311
2630
|
X_ITE_VolumeMaterialExtension,
|
|
2631
|
+
X_ITE_VolumeScatterMaterialExtension,
|
|
2312
2632
|
],
|
|
2313
2633
|
abstractNodes:
|
|
2314
2634
|
[
|
|
2315
2635
|
X_ITE_X3DMaterialExtensionNode,
|
|
2316
2636
|
],
|
|
2637
|
+
browserContext: X_ITE_X3DX_ITEContext,
|
|
2317
2638
|
});
|
|
2318
2639
|
|
|
2319
2640
|
const X_ITEComponent_default_ = undefined;
|