x_ite 12.1.3 → 12.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- 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 +2 -2
- 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 +144 -80
- 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 +2 -10
- 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 +2 -2
- package/dist/assets/components/RigidBodyPhysicsComponent.min.js +2 -2
- package/dist/assets/components/ScriptingComponent.js +5 -3
- 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 +6 -5
- package/dist/assets/components/TextureProjectionComponent.min.js +2 -2
- package/dist/assets/components/Texturing3DComponent.js +3571 -3571
- package/dist/assets/components/Texturing3DComponent.min.js +2 -2
- package/dist/assets/components/VolumeRenderingComponent.js +6 -2
- 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 +6 -6
- 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 +52 -8
- package/dist/x_ite.js +50444 -50363
- package/dist/x_ite.min.js +2 -2
- package/dist/x_ite.min.mjs +2 -2
- package/dist/x_ite.mjs +50194 -50113
- package/dist/x_ite.zip +0 -0
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/* X_ITE v12.1.
|
|
2
|
-
const __X_ITE_X3D__ = window [Symbol .for ("X_ITE.X3D-12.1.
|
|
1
|
+
/* X_ITE v12.1.5 */
|
|
2
|
+
const __X_ITE_X3D__ = window [Symbol .for ("X_ITE.X3D-12.1.5")];
|
|
3
3
|
/******/ (() => { // webpackBootstrap
|
|
4
4
|
/******/ "use strict";
|
|
5
5
|
/******/ // The require scope
|
|
@@ -1366,6 +1366,10 @@ function X3DVolumeDataNode (executionContext)
|
|
|
1366
1366
|
|
|
1367
1367
|
this .setCameraObject (true);
|
|
1368
1368
|
|
|
1369
|
+
// Units
|
|
1370
|
+
|
|
1371
|
+
this ._dimensions .setUnit ("length");
|
|
1372
|
+
|
|
1369
1373
|
// Private properties
|
|
1370
1374
|
|
|
1371
1375
|
const
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* X_ITE v12.1.
|
|
2
|
-
const e=window[Symbol.for("X_ITE.X3D-12.1.3")];(()=>{var t={n:e=>{var n=e&&e.__esModule?()=>e.default:()=>e;return t.d(n,{a:n}),n},d:(e,n)=>{for(var o in n)t.o(n,o)&&!t.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:n[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const n=e.Components;var o=t.n(n);const i=e.PixelTexture;var r=t.n(i);const s=e.TextureProperties;var a=t.n(s);const d=e.Fields;var l=t.n(d);const u=e.X3DFieldDefinition;var h=t.n(u);const c=e.FieldDefinitionArray;var p=t.n(c);const f=e.X3DNode;var _=t.n(f);const g=e.X3DConstants;var m=t.n(g);const S=e.Namespace;var N=t.n(S);function y(e){_().call(this,e),this.addType(m().X3DVolumeRenderStyleNode),this.volumeDataNodes=new Set}Object.assign(Object.setPrototypeOf(y.prototype,_().prototype),{addShaderFields(e){},getDefines(){},getUniformsText:()=>"",getFunctionsText:()=>"",getVolumeData(){return this.volumeDataNodes},addVolumeData(e){this.volumeDataNodes.add(e)},removeVolumeData(e){this.volumeDataNodes.delete(e)},getNormalText(e){let t="";return e?(t+="uniform sampler3D surfaceNormals_"+this.getId()+";\n",t+="\n",t+="vec4\n",t+="getNormal_"+this.getId()+" (in vec3 texCoord)\n",t+="{\n",t+=" vec3 n = texture (surfaceNormals_"+this.getId()+", texCoord) .xyz * 2.0 - 1.0;\n",t+="\n",t+=" return vec4 (normalize (x3d_TextureNormalMatrix * n), length (n));\n",t+="}\n"):(t+="\n",t+="vec4\n",t+="getNormal_"+this.getId()+" (in vec3 texCoord)\n",t+="{\n",t+=" vec4 offset = vec4 (1.0 / vec3 (textureSize (x3d_Texture3D [0], 0)), 0.0);\n",t+=" float i0 = texture (x3d_Texture3D [0], texCoord + offset .xww) .r;\n",t+=" float i1 = texture (x3d_Texture3D [0], texCoord - offset .xww) .r;\n",t+=" float i2 = texture (x3d_Texture3D [0], texCoord + offset .wyw) .r;\n",t+=" float i3 = texture (x3d_Texture3D [0], texCoord - offset .wyw) .r;\n",t+=" float i4 = texture (x3d_Texture3D [0], texCoord + offset .wwz) .r;\n",t+=" float i5 = texture (x3d_Texture3D [0], texCoord - offset .wwz) .r;\n",t+=" vec3 n = vec3 (i1 - i0, i3 - i2, i5 - i4);\n",t+="\n",t+=" return vec4 (normalize (x3d_TextureNormalMatrix * n), length (n));\n",t+="}\n"),t}}),Object.defineProperties(y,_().getStaticProperties("X3DVolumeRenderStyleNode","VolumeRendering",1));const x=y,v=N().add("X3DVolumeRenderStyleNode",x);function w(e){v.call(this,e),this.addType(m().X3DComposableVolumeRenderStyleNode)}Object.setPrototypeOf(w.prototype,v.prototype),Object.defineProperties(w,_().getStaticProperties("X3DComposableVolumeRenderStyleNode","VolumeRendering",1));const F=w,C=N().add("X3DComposableVolumeRenderStyleNode",F),O=e.X3DCast;var D=t.n(O);function I(e){C.call(this,e),this.addType(m().OpacityMapVolumeStyle)}Object.assign(Object.setPrototypeOf(I.prototype,C.prototype),{initialize(){C.prototype.initialize.call(this),this._transferFunction.addInterest("set_transferFunction__",this),this.set_transferFunction__()},set_transferFunction__(){this.transferFunctionNode=D()(m().X3DTexture2DNode,this._transferFunction),this.transferFunctionNode||(this.transferFunctionNode=D()(m().X3DTexture3DNode,this._transferFunction)),this.transferFunctionNode||(this.transferFunctionNode=this.getBrowser().getDefaultTransferFunction())},addShaderFields(e){this._enabled.getValue()&&e.addUserDefinedField(m().inputOutput,"transferFunction_"+this.getId(),new(l().SFNode)(this.transferFunctionNode))},getUniformsText(){if(!this._enabled.getValue())return"";let e="";return e+="\n",e+="// OpacityMapVolumeStyle\n",e+="\n",this.transferFunctionNode.getType().includes(m().X3DTexture2DNode)?(e+="uniform sampler2D transferFunction_"+this.getId()+";\n",e+="\n",e+="vec4\n",e+="getOpacityMapStyle_"+this.getId()+" (in vec4 originalColor)\n",e+="{\n",e+=" return texture (transferFunction_"+this.getId()+", originalColor .rg);\n",e+="}\n"):(e+="uniform sampler3D transferFunction_"+this.getId()+";\n",e+="\n",e+="vec4\n",e+="getOpacityMapStyle_"+this.getId()+" (in vec4 originalColor)\n",e+="{\n",e+=" return texture (transferFunction_"+this.getId()+", originalColor .rgb);\n",e+="}\n"),e},getFunctionsText(){if(!this._enabled.getValue())return"";let e="";return e+="\n",e+=" // OpacityMapVolumeStyle\n",e+="\n",e+=" textureColor = getOpacityMapStyle_"+this.getId()+" (textureColor);\n",e}}),Object.defineProperties(I,{..._().getStaticProperties("OpacityMapVolumeStyle","VolumeRendering",1,"renderStyle","3.3"),fieldDefinitions:{value:new(p())([new(h())(m().inputOutput,"enabled",new(l().SFBool)(!0)),new(h())(m().inputOutput,"metadata",new(l().SFNode)),new(h())(m().inputOutput,"transferFunction",new(l().SFNode))]),enumerable:!0}});const T=I,b=N().add("OpacityMapVolumeStyle",T),V=Symbol(),P=Symbol(),E=Symbol(),M=Symbol();function U(){}Object.assign(U.prototype,{getDefaultVoxels(){return this[V]??=(()=>{const e=this.getPrivateScene().createNode("PixelTexture3D",!1);return e._image=[1,1,1,1,255],e.repeatS=!0,e.repeatT=!0,e.repeatR=!0,e.setup(),e})()},getDefaultVolumeStyle(){return this[P]??=(()=>{const e=new b(this.getPrivateScene());return e.setup(),e})()},getDefaultBlendedVolumeStyle(){return this[E]??=(()=>{const e=new b(this.getPrivateScene());return e.setup(),e})()},getDefaultTransferFunction(){return this[M]??=(()=>{const e=new(a())(this.getPrivateScene());e._boundaryModeS="CLAMP_TO_EDGE",e._boundaryModeT="REPEAT",e._magnificationFilter="DEFAULT",e._minificationFilter="DEFAULT",e._generateMipMaps=!0,e._textureCompression="DEFAULT",e.setup();const t=new(r())(this.getPrivateScene());return t._textureProperties=e,t._image.width=256,t._image.height=1,t._image.comp=2,t._image.array=Array.from({length:256},(e,t)=>t<<8|t),t.setup(),t})()}});const L=U,R=N().add("X3DVolumeRenderingContext",L);function A(e){C.call(this,e),this.addType(m().BlendedVolumeStyle)}Object.assign(Object.setPrototypeOf(A.prototype,C.prototype),{initialize(){C.prototype.initialize.call(this),this._weightTransferFunction1.addInterest("set_weightTransferFunction1__",this),this._weightTransferFunction2.addInterest("set_weightTransferFunction2__",this),this._renderStyle.addInterest("set_renderStyle__",this),this._voxels.addInterest("set_voxels__",this),this.set_weightTransferFunction1__(),this.set_weightTransferFunction2__(),this.set_renderStyle__(),this.set_voxels__()},addVolumeData(e){C.prototype.addVolumeData.call(this,e),this.renderStyleNode&&this.renderStyleNode.addVolumeData(e)},removeVolumeData(e){C.prototype.removeVolumeData.call(this,e),this.renderStyleNode&&this.renderStyleNode.removeVolumeData(e)},set_weightTransferFunction1__(){this.weightTransferFunction1Node=D()(m().X3DTexture2DNode,this._weightTransferFunction1)},set_weightTransferFunction2__(){this.weightTransferFunction2Node=D()(m().X3DTexture2DNode,this._weightTransferFunction2)},set_renderStyle__(){if(this.renderStyleNode){this.renderStyleNode.removeInterest("addNodeEvent",this);for(const e of this.getVolumeData())this.renderStyleNode.removeVolumeData(e)}if(this.renderStyleNode=D()(m().X3DComposableVolumeRenderStyleNode,this._renderStyle),this.renderStyleNode){this.renderStyleNode.addInterest("addNodeEvent",this);for(const e of this.getVolumeData())this.renderStyleNode.addVolumeData(e)}},set_voxels__(){this.voxelsNode=D()(m().X3DTexture3DNode,this._voxels)},addShaderFields(e){this._enabled.getValue()&&(e.addUserDefinedField(m().inputOutput,"weightConstant1_"+this.getId(),this._weightConstant1.copy()),e.addUserDefinedField(m().inputOutput,"weightConstant2_"+this.getId(),this._weightConstant2.copy()),this.weightTransferFunction1Node&&e.addUserDefinedField(m().inputOutput,"weightTransferFunction1_"+this.getId(),new(l().SFNode)(this.weightTransferFunction1Node)),this.weightTransferFunction2Node&&e.addUserDefinedField(m().inputOutput,"weightTransferFunction2_"+this.getId(),new(l().SFNode)(this.weightTransferFunction2Node)),this.voxelsNode&&e.addUserDefinedField(m().inputOutput,"voxels_"+this.getId(),new(l().SFNode)(this.voxelsNode)),this.getBrowser().getDefaultBlendedVolumeStyle().addShaderFields(e),this.renderStyleNode&&this.renderStyleNode.addShaderFields(e))},getUniformsText(){if(!this._enabled.getValue())return"";if(!this.voxelsNode)return"";let e="";e+="\n",e+="// BlendedVolumeStyle\n",e+="\n",e+="uniform float weightConstant1_"+this.getId()+";\n",e+="uniform float weightConstant2_"+this.getId()+";\n",this.weightTransferFunction1Node&&(e+="uniform sampler2D weightTransferFunction1_"+this.getId()+";\n"),this.weightTransferFunction2Node&&(e+="uniform sampler2D weightTransferFunction2_"+this.getId()+";\n"),e+="uniform sampler3D voxels_"+this.getId()+";\n";let t=this.getBrowser().getDefaultBlendedVolumeStyle().getUniformsText();this.renderStyleNode&&(t+=this.renderStyleNode.getUniformsText()),t=t.replace(/x3d_Texture3D\s*\[0\]/g,"voxels_"+this.getId()),e+="\n",e+=t,e+="\n",e+="vec4\n",e+="getBlendedStyle_"+this.getId()+" (in vec4 originalColor, in vec3 texCoord)\n",e+="{\n",e+=" vec4 blendColor_"+this.getId()+" = texture (voxels_"+this.getId()+", texCoord);";let n=this.getBrowser().getDefaultBlendedVolumeStyle().getFunctionsText();switch(this.renderStyleNode&&(n+=this.renderStyleNode.getFunctionsText()),n=n.replace(/textureColor/g,"blendColor_"+this.getId()),e+="\n",e+=n,this._weightFunction1.getValue()){default:e+=" float w1_"+this.getId()+" = weightConstant1_"+this.getId()+";\n";break;case"ALPHA0":e+=" float w1_"+this.getId()+" = originalColor .a;\n";break;case"ALPHA1":e+=" float w1_"+this.getId()+" = blendColor_ "+this.getId()+" .a;\n";break;case"ONE_MINUS_ALPHA0":e+=" float w1_"+this.getId()+" = 1.0 - originalColor .a;\n";break;case"ONE_MINUS_ALPHA1":e+=" float w1_"+this.getId()+" = 1.0 - blendColor_ "+this.getId()+" .a;\n";break;case"TABLE":this.weightTransferFunction1Node?e+=" float w1_"+this.getId()+" = texture (weightTransferFunction1_"+this.getId()+", vec2 (originalColor .a, blendColor_"+this.getId()+" .a)) .r;\n":e+=" float w1_"+this.getId()+" = weightConstant1_"+this.getId()+";\n"}switch(this._weightFunction2.getValue()){default:e+=" float w2_"+this.getId()+" = weightConstant2_"+this.getId()+";\n";break;case"ALPHA0":e+=" float w2_"+this.getId()+" = originalColor .a;\n";break;case"ALPHA1":e+=" float w2_"+this.getId()+" = blendColor_ "+this.getId()+" .a;\n";break;case"ONE_MINUS_ALPHA0":e+=" float w2_"+this.getId()+" = 1.0 - originalColor .a;\n";break;case"ONE_MINUS_ALPHA1":e+=" float w2_"+this.getId()+" = 1.0 - blendColor_ "+this.getId()+" .a;\n";break;case"TABLE":this.weightTransferFunction2Node?e+=" float w2_"+this.getId()+" = texture (weightTransferFunction2_"+this.getId()+", vec2 (originalColor .a, blendColor_"+this.getId()+" .a)) .r;\n":e+=" float w2_"+this.getId()+" = weightConstant2_"+this.getId()+";\n"}return e+="\n",e+=" return clamp (originalColor * w1_"+this.getId()+" + blendColor_"+this.getId()+" * w2_"+this.getId()+", 0.0, 1.0);\n",e+="}\n",e},getFunctionsText(){if(!this._enabled.getValue())return"";if(!this.voxelsNode)return"";let e="";return e+="\n",e+=" // BlendedVolumeStyle\n",e+="\n",e+=" textureColor = getBlendedStyle_"+this.getId()+" (textureColor, texCoord);\n",e}}),Object.defineProperties(A,{..._().getStaticProperties("BlendedVolumeStyle","VolumeRendering",3,"renderStyle","3.3"),fieldDefinitions:{value:new(p())([new(h())(m().inputOutput,"metadata",new(l().SFNode)),new(h())(m().inputOutput,"enabled",new(l().SFBool)(!0)),new(h())(m().inputOutput,"weightConstant1",new(l().SFFloat)(.5)),new(h())(m().inputOutput,"weightConstant2",new(l().SFFloat)(.5)),new(h())(m().inputOutput,"weightFunction1",new(l().SFString)("CONSTANT")),new(h())(m().inputOutput,"weightFunction2",new(l().SFString)("CONSTANT")),new(h())(m().inputOutput,"weightTransferFunction1",new(l().SFNode)),new(h())(m().inputOutput,"weightTransferFunction2",new(l().SFNode)),new(h())(m().inputOutput,"renderStyle",new(l().SFNode)),new(h())(m().inputOutput,"voxels",new(l().SFNode))]),enumerable:!0}});const B=A,j=N().add("BlendedVolumeStyle",B);function X(e){C.call(this,e),this.addType(m().BoundaryEnhancementVolumeStyle)}Object.assign(Object.setPrototypeOf(X.prototype,C.prototype),{addShaderFields(e){this._enabled.getValue()&&(e.addUserDefinedField(m().inputOutput,"retainedOpacity_"+this.getId(),this._retainedOpacity.copy()),e.addUserDefinedField(m().inputOutput,"boundaryOpacity_"+this.getId(),this._boundaryOpacity.copy()),e.addUserDefinedField(m().inputOutput,"opacityFactor_"+this.getId(),this._opacityFactor.copy()))},getUniformsText(){if(!this._enabled.getValue())return"";let e="";return e+="\n",e+="// BoundaryEnhancementVolumeStyle\n",e+="\n",e+="uniform float retainedOpacity_"+this.getId()+";\n",e+="uniform float boundaryOpacity_"+this.getId()+";\n",e+="uniform float opacityFactor_"+this.getId()+";\n",e+="\n",e+="vec4\n",e+="getBoundaryEnhancementStyle_"+this.getId()+" (in vec4 originalColor, in vec3 texCoord)\n",e+="{\n",e+=" float f0 = texture (x3d_Texture3D [0], texCoord) .r;\n",e+=" float f1 = texture (x3d_Texture3D [0], texCoord + vec3 (0.0, 0.0, 1.0 / float (textureSize (x3d_Texture3D [0], 0) .z))) .r;\n",e+=" float f = abs (f0 - f1);\n",e+="\n",e+=" float retainedOpacity = retainedOpacity_"+this.getId()+";\n",e+=" float boundaryOpacity = boundaryOpacity_"+this.getId()+";\n",e+=" float opacityFactor = opacityFactor_"+this.getId()+";\n",e+="\n",e+=" return vec4 (originalColor .rgb, originalColor .a * (retainedOpacity + boundaryOpacity * pow (f, opacityFactor)));\n",e+="}\n",e},getFunctionsText(){if(!this._enabled.getValue())return"";let e="";return e+="\n",e+=" // BoundaryEnhancementVolumeStyle\n",e+="\n",e+=" textureColor = getBoundaryEnhancementStyle_"+this.getId()+" (textureColor, texCoord);\n",e}}),Object.defineProperties(X,{..._().getStaticProperties("BoundaryEnhancementVolumeStyle","VolumeRendering",2,"renderStyle","3.3"),fieldDefinitions:{value:new(p())([new(h())(m().inputOutput,"metadata",new(l().SFNode)),new(h())(m().inputOutput,"enabled",new(l().SFBool)(!0)),new(h())(m().inputOutput,"retainedOpacity",new(l().SFFloat)(.2)),new(h())(m().inputOutput,"boundaryOpacity",new(l().SFFloat)(.9)),new(h())(m().inputOutput,"opacityFactor",new(l().SFFloat)(2))]),enumerable:!0}});const z=X,G=N().add("BoundaryEnhancementVolumeStyle",z);function H(e){C.call(this,e),this.addType(m().CartoonVolumeStyle)}Object.assign(Object.setPrototypeOf(H.prototype,C.prototype),{initialize(){C.prototype.initialize.call(this),this._surfaceNormals.addInterest("set_surfaceNormals__",this),this.set_surfaceNormals__()},set_surfaceNormals__(){this.surfaceNormalsNode=D()(m().X3DTexture3DNode,this._surfaceNormals)},addShaderFields(e){this._enabled.getValue()&&(e.addUserDefinedField(m().inputOutput,"colorSteps_"+this.getId(),this._colorSteps.copy()),e.addUserDefinedField(m().inputOutput,"orthogonalColor_"+this.getId(),this._orthogonalColor.copy()),e.addUserDefinedField(m().inputOutput,"parallelColor_"+this.getId(),this._parallelColor.copy()),this.surfaceNormalsNode&&e.addUserDefinedField(m().inputOutput,"surfaceNormals_"+this.getId(),new(l().SFNode)(this.surfaceNormalsNode)))},getDefines(e){e.add("#define X3D_HSV")},getUniformsText(){if(!this._enabled.getValue())return"";let e="";return e+="\n",e+="// CartoonVolumeStyle\n",e+="\n",e+="uniform int colorSteps_"+this.getId()+";\n",e+="uniform vec4 orthogonalColor_"+this.getId()+";\n",e+="uniform vec4 parallelColor_"+this.getId()+";\n",e+=this.getNormalText(this.surfaceNormalsNode),e+="\n",e+="vec4\n",e+="getCartoonStyle_"+this.getId()+" (in vec4 originalColor, vec3 texCoord)\n",e+="{\n",e+=" vec4 surfaceNormal = getNormal_"+this.getId()+" (texCoord);\n",e+="\n",e+=" if (surfaceNormal .w == 0.0)\n",e+=" return vec4 (0.0);\n",e+="\n",e+=" vec4 orthogonalColor = orthogonalColor_"+this.getId()+";\n",e+=" vec4 parallelColor = parallelColor_"+this.getId()+";\n",e+=" int colorSteps = colorSteps_"+this.getId()+";\n",e+="\n",e+=" float steps = clamp (float (colorSteps), 1.0, 64.0);\n",e+=" float step = M_PI / 2.0 / steps;\n",e+=" float cosTheta = min (dot (surfaceNormal .xyz, normalize (vertex)), 1.0);\n",e+="\n",e+=" if (cosTheta < 0.0)\n",e+=" return vec4 (0.0);\n",e+="\n",e+=" float t = cos (min (floor (acos (cosTheta) / step) * (steps > 1.0 ? steps / (steps - 1.0) : 1.0), steps) * step);\n",e+=" vec3 orthogonalHSV = rgb2hsv (orthogonalColor .rgb);\n",e+=" vec3 parallelHSV = rgb2hsv (parallelColor .rgb);\n",e+="\n",e+=" return vec4 (hsv2rgb (mix_hsv (orthogonalHSV, parallelHSV, t)), originalColor .a);\n",e+="}\n",e},getFunctionsText(){if(!this._enabled.getValue())return"";let e="";return e+="\n",e+=" // CartoonVolumeStyle\n",e+="\n",e+=" textureColor = getCartoonStyle_"+this.getId()+" (textureColor, texCoord);\n",e}}),Object.defineProperties(H,{..._().getStaticProperties("CartoonVolumeStyle","VolumeRendering",3,"renderStyle","3.3"),fieldDefinitions:{value:new(p())([new(h())(m().inputOutput,"metadata",new(l().SFNode)),new(h())(m().inputOutput,"enabled",new(l().SFBool)(!0)),new(h())(m().inputOutput,"colorSteps",new(l().SFInt32)(4)),new(h())(m().inputOutput,"orthogonalColor",new(l().SFColorRGBA)(1,1,1,1)),new(h())(m().inputOutput,"parallelColor",new(l().SFColorRGBA)(0,0,0,1)),new(h())(m().inputOutput,"surfaceNormals",new(l().SFNode))]),enumerable:!0}});const k=H,Y=N().add("CartoonVolumeStyle",k);function Q(e){C.call(this,e),this.addType(m().ComposedVolumeStyle),this.renderStyleNodes=[]}Object.assign(Object.setPrototypeOf(Q.prototype,C.prototype),{initialize(){C.prototype.initialize.call(this),this._renderStyle.addInterest("set_renderStyle__",this),this.set_renderStyle__()},addVolumeData(e){C.prototype.addVolumeData.call(this,e);for(const t of this.renderStyleNodes)t.addVolumeData(e)},removeVolumeData(e){C.prototype.removeVolumeData.call(this,e);for(const t of this.renderStyleNodes)t.removeVolumeData(e)},set_renderStyle__(){const e=this.renderStyleNodes;for(const t of e){t.removeInterest("addNodeEvent",this);for(const e of this.getVolumeData())t.removeVolumeData(e)}e.length=0;for(const t of this._renderStyle){const n=D()(m().X3DComposableVolumeRenderStyleNode,t);n&&e.push(n)}for(const t of e){t.addInterest("addNodeEvent",this);for(const e of this.getVolumeData())t.addVolumeData(e)}},addShaderFields(e){if(this._enabled.getValue())for(const t of this.renderStyleNodes)t.addShaderFields(e)},getDefines(e){for(const t of this.renderStyleNodes)t.getDefines(e)},getUniformsText(){if(!this._enabled.getValue())return"";let e="";for(const t of this.renderStyleNodes)e+=t.getUniformsText();e+="\n",e+="vec4\n",e+="getComposedStyle_"+this.getId()+" (in vec4 textureColor, in vec3 texCoord)\n",e+="{\n";for(const t of this.renderStyleNodes)e+=t.getFunctionsText();return e+="\n",e+=" return textureColor;\n",e+="}\n",e},getFunctionsText(){if(!this._enabled.getValue())return"";let e="";return e+="\n",e+=" // ComposedVolumeStyle\n",e+="\n",e+=" textureColor = getComposedStyle_"+this.getId()+" (textureColor, texCoord);\n",e}}),Object.defineProperties(Q,{..._().getStaticProperties("ComposedVolumeStyle","VolumeRendering",3,"renderStyle","3.3"),fieldDefinitions:{value:new(p())([new(h())(m().inputOutput,"metadata",new(l().SFNode)),new(h())(m().inputOutput,"enabled",new(l().SFBool)(!0)),new(h())(m().inputOutput,"renderStyle",new(l().MFNode))]),enumerable:!0}});const W=Q,q=N().add("ComposedVolumeStyle",W);function K(e){C.call(this,e),this.addType(m().EdgeEnhancementVolumeStyle)}Object.assign(Object.setPrototypeOf(K.prototype,C.prototype),{initialize(){C.prototype.initialize.call(this),this._surfaceNormals.addInterest("set_surfaceNormals__",this),this.set_surfaceNormals__()},set_surfaceNormals__(){this.surfaceNormalsNode=D()(m().X3DTexture3DNode,this._surfaceNormals)},addShaderFields(e){this._enabled.getValue()&&(e.addUserDefinedField(m().inputOutput,"edgeColor_"+this.getId(),this._edgeColor.copy()),e.addUserDefinedField(m().inputOutput,"gradientThreshold_"+this.getId(),this._gradientThreshold.copy()),this.surfaceNormalsNode&&e.addUserDefinedField(m().inputOutput,"surfaceNormals_"+this.getId(),new(l().SFNode)(this.surfaceNormalsNode)))},getUniformsText(){if(!this._enabled.getValue())return"";let e="";return e+="\n",e+="// EdgeEnhancementVolumeStyle\n",e+="\n",e+="uniform vec4 edgeColor_"+this.getId()+";\n",e+="uniform float gradientThreshold_"+this.getId()+";\n",e+=this.getNormalText(this.surfaceNormalsNode),e+="\n",e+="vec4\n",e+="getEdgeEnhacementStyle_"+this.getId()+" (in vec4 originalColor, in vec3 texCoord)\n",e+="{\n",e+=" vec4 surfaceNormal = getNormal_"+this.getId()+" (texCoord);\n",e+="\n",e+=" if (surfaceNormal .w == 0.0)\n",e+=" return vec4 (0.0);\n",e+="\n",e+=" vec4 edgeColor = edgeColor_"+this.getId()+";\n",e+=" float gradientThreshold = gradientThreshold_"+this.getId()+";\n",e+="\n",e+=" float angle = abs (dot (surfaceNormal .xyz, normalize (vertex)));\n",e+="\n",e+=" if (angle >= cos (gradientThreshold))\n",e+=" return originalColor;\n",e+=" else\n",e+=" return vec4 (mix (edgeColor .rgb, originalColor.rgb, angle), originalColor .a);\n",e+="}\n",e},getFunctionsText(){if(!this._enabled.getValue())return"";let e="";return e+="\n",e+=" // EdgeEnhancementVolumeStyle\n",e+="\n",e+=" textureColor = getEdgeEnhacementStyle_"+this.getId()+" (textureColor, texCoord);\n",e}}),Object.defineProperties(K,{..._().getStaticProperties("EdgeEnhancementVolumeStyle","VolumeRendering",2,"renderStyle","3.3"),fieldDefinitions:{value:new(p())([new(h())(m().inputOutput,"metadata",new(l().SFNode)),new(h())(m().inputOutput,"enabled",new(l().SFBool)(!0)),new(h())(m().inputOutput,"edgeColor",new(l().SFColorRGBA)(0,0,0,1)),new(h())(m().inputOutput,"gradientThreshold",new(l().SFFloat)(.4)),new(h())(m().inputOutput,"surfaceNormals",new(l().SFNode))]),enumerable:!0}});const $=K,Z=N().add("EdgeEnhancementVolumeStyle",$),J=e.X3DChildNode;var ee=t.n(J);const te=e.X3DBoundedObject;var ne=t.n(te);const oe=e.TextureQuality;var ie=t.n(oe);const re=e.UnlitMaterial;var se=t.n(re);const ae=N().add("VolumeStyle.vs","#version 300 es\nprecision highp float;precision highp int;uniform mat4 x3d_ProjectionMatrix;uniform mat4 x3d_ModelViewMatrix;uniform mat4 x3d_TextureMatrix[1];\n#if defined(X3D_XR_SESSION)\nuniform mat4 x3d_EyeMatrix;\n#endif\nin vec4 x3d_TexCoord0;in vec4 x3d_Vertex;out vec3 vertex;out vec4 texCoord;\n#if defined(X3D_LOGARITHMIC_DEPTH_BUFFER)\nout float depth;\n#endif\nvoid main(){vec4 position=x3d_ModelViewMatrix*x3d_Vertex;\n#if defined(X3D_XR_SESSION)\nposition=x3d_EyeMatrix*position;\n#endif\nvertex=position.xyz;texCoord=x3d_TextureMatrix[0]*x3d_TexCoord0;gl_Position=x3d_ProjectionMatrix*position;\n#if defined(X3D_LOGARITHMIC_DEPTH_BUFFER)\ndepth=1.+gl_Position.w;\n#endif\n}"),de=N().add("VolumeStyle.fs",'#version 300 es\nprecision highp float;precision highp int;precision highp sampler3D;in vec3 vertex;in vec4 texCoord;\n#if defined(X3D_LOGARITHMIC_DEPTH_BUFFER)\nuniform float x3d_LogarithmicFarFactor1_2;in float depth;\n#endif\nuniform sampler3D x3d_Texture3D[1];uniform mat3 x3d_TextureNormalMatrix;uniform x3d_LightSourceParameters x3d_LightSource[x3d_MaxLights];const float M_PI=3.141592653589793;const float M_SQRT2=1.4142135623730951;const float M_SQRT1_2=.7071067811865476;\n#if defined(X3D_ORDER_INDEPENDENT_TRANSPARENCY)\nlayout(location=0)out vec4 x3d_FragData0;layout(location=1)out vec4 x3d_FragData1;\n#else\nout vec4 x3d_FragColor;\n#endif\n#pragma X3D include "includes/ClipPlanes.glsl"\n#pragma X3D include "includes/Fog.glsl"\n__VOLUME_STYLES_DEFINES__\n#if defined(X3D_HSV)\nvec3 rgb2hsv(in vec3 color){float h=0.;float s=0.;float v=0.;float min=min(min(color.r,color.g),color.b);float max=max(max(color.r,color.g),color.b);v=max;float delta=max-min;if(max!=0.&&delta!=0.){s=delta/max;if(color.r==max)h=(color.g-color.b)/delta;else if(color.g==max)h=2.+(color.b-color.r)/delta;else h=4.+(color.r-color.g)/delta;h*=M_PI/3.;if(h<0.)h+=M_PI*2.;}else s=h=0.;return vec3(h,s,v);}vec3 hsv2rgb(in vec3 hsv){float h=hsv[0];float s=clamp(hsv[1],0.,1.);float v=clamp(hsv[2],0.,1.);if(s==0.){return vec3(v,v,v);}else{float w=(h*(180./M_PI))/60.;float i=floor(w);float f=w-i;float p=v*(1.-s);float q=v*(1.-s*f);float t=v*(1.-s*(1.-f));switch(int(i)% 6){case 0:return vec3(v,t,p);case 1:return vec3(q,v,p);case 2:return vec3(p,v,t);case 3:return vec3(p,q,v);case 4:return vec3(t,p,v);default:return vec3(v,p,q);}}return vec3(0);}vec3 mix_hsv(in vec3 a,in vec3 b,in float t){float ha=a[0];float sa=a[1];float va=a[2];float hb=b[0];float sb=b[1];float vb=b[2];if(sa==0.)ha=hb;if(sb==0.)hb=ha;float range=abs(hb-ha);if(range<=M_PI){float h=ha+t*(hb-ha);float s=sa+t*(sb-sa);float v=va+t*(vb-va);return vec3(h,s,v);}float PI2=M_PI*2.;float step=(PI2-range)*t;float h=ha<hb?ha-step:ha+step;if(h<0.)h+=PI2;else if(h>PI2)h-=PI2;float s=sa+t*(sb-sa);float v=va+t*(vb-va);return vec3(h,s,v);}\n#endif\n#if defined(X3D_PLANE)\nstruct Plane3{vec3 normal;float distanceFromOrigin;};Plane3 plane3(const in vec3 point,const in vec3 normal){return Plane3(normal,dot(normal,point));}vec3 plane3_perpendicular_vector(const in Plane3 plane,const in vec3 point){return plane.normal*(dot(point,plane.normal)-plane.distanceFromOrigin);}\n#endif\n#if defined(X3D_SHADING)\nfloat getSpotFactor(const in float cutOffAngle,const in float beamWidth,const in vec3 L,const in vec3 d){float spotAngle=acos(clamp(dot(-L,d),-1.,1.));if(spotAngle>=cutOffAngle)return 0.;else if(spotAngle<=beamWidth)return 1.;return(spotAngle-cutOffAngle)/(beamWidth-cutOffAngle);}\n#endif\n__VOLUME_STYLES_UNIFORMS__ vec4 getTextureColor(in vec3 texCoord){if(any(greaterThan(abs(texCoord-.5),vec3(.5))))discard;vec4 textureColor=texture(x3d_Texture3D[0],texCoord);__VOLUME_STYLES_FUNCTIONS__ return textureColor;}\n#if defined(X3D_ORDER_INDEPENDENT_TRANSPARENCY)\nfloat weight(const in float z,const in float a){return clamp(pow(min(1.,a*10.)+.01,3.)*1e8*pow(1.-z*.9,3.),1e-2,3e3);}\n#endif\nvoid main(){\n#if defined(X3D_CLIP_PLANES)\nclip();\n#endif\nvec4 finalColor=getTextureColor(texCoord.stp/texCoord.q);\n#if defined(X3D_FOG)\nfinalColor.rgb=getFogColor(finalColor.rgb);\n#endif\n#if defined(X3D_ORDER_INDEPENDENT_TRANSPARENCY)\nfloat a=finalColor.a;float w=weight(gl_FragCoord.z,a);finalColor.rgb*=a;finalColor*=w;x3d_FragData0=vec4(finalColor.rgb,a);x3d_FragData1=vec4(finalColor.a);\n#else\nx3d_FragColor=finalColor;\n#endif\n#if defined(X3D_LOGARITHMIC_DEPTH_BUFFER)\ngl_FragDepth=log2(depth)*x3d_LogarithmicFarFactor1_2;\n#endif\n}');function le(e,t){se().call(this,e),this.volumeDataNode=t,this.volumeShaderNodes=new Map}Object.assign(Object.setPrototypeOf(le.prototype,se().prototype),{getVolumeShaders(){return this.volumeShaderNodes},getShader(e,t){const{renderObject:n,fogNode:o,localObjectsKeys:i}=t;let r="";return r+=n.getRenderKey(),r+=o?.getFogType()??0,r+=".",r+=i.sort().join(""),this.volumeShaderNodes.get(r)??this.createShader(r,e,t)},createShader(e,t,n){const o=this.getBrowser(),i=[],{renderObject:r,fogNode:s,localObjectsKeys:a}=n,d=a.concat(r.getGlobalLightsKeys());switch(o.getRenderingProperty("XRSession")&&i.push("X3D_XR_SESSION"),r.getLogarithmicDepthBuffer()&&i.push("X3D_LOGARITHMIC_DEPTH_BUFFER"),r.getOrderIndependentTransparency()&&i.push("X3D_ORDER_INDEPENDENT_TRANSPARENCY"),s?.getFogType()){case 1:i.push("X3D_FOG","X3D_FOG_LINEAR");break;case 2:i.push("X3D_FOG","X3D_FOG_EXPONENTIAL")}const l=d.reduce((e,t)=>e+(0===t),0),u=d.reduce((e,t)=>e+(1===t),0);l&&(i.push("X3D_CLIP_PLANES"),i.push(`X3D_NUM_CLIP_PLANES ${Math.min(l,o.getMaxClipPlanes())}`)),u&&(i.push("X3D_LIGHTING"),i.push(`X3D_NUM_LIGHTS ${Math.min(u,o.getMaxLights())}`));const h=this.volumeDataNode.createShader(i,ae,de);return this.volumeShaderNodes.set(e,h),h},setShaderUniforms(e,t,n,o){this.volumeDataNode.setShaderUniforms(e,t)}}),Object.defineProperties(le,{typeName:{value:"VolumeMaterial",enumerable:!0},componentInfo:{value:Object.freeze({name:"Shape",level:1}),enumerable:!0},containerField:{value:"material",enumerable:!0},fieldDefinitions:{value:se().fieldDefinitions}});const ue=le,he=N().add("VolumeMaterial",ue),ce=e.Vector3;var pe=t.n(ce);const fe=e.Matrix4;var _e=t.n(fe);function ge(e){ee().call(this,e),ne().call(this,e),this.addType(m().X3DVolumeDataNode),this.setCameraObject(!0);const t=this.getBrowser().getPrivateScene();this.groupNode=t.createNode("Group",!1),this.proximitySensorNode=t.createNode("ProximitySensor",!1),this.transformNode=t.createNode("Transform",!1),this.volumeMaterialNode=new he(t,this),this.textureTransformNode=t.createNode("TextureTransform3D",!1),this.appearanceNode=t.createNode("Appearance",!1),this.lowShapeNode=t.createNode("Shape",!1),this.lowGeometryNode=t.createNode("QuadSet",!1),this.lowTextureCoordinateNode=t.createNode("TextureCoordinate3D",!1),this.lowCoordinateNode=t.createNode("Coordinate",!1),this.hiShapeNode=t.createNode("Shape",!1),this.hiGeometryNode=t.createNode("QuadSet",!1),this.hiTextureCoordinateNode=t.createNode("TextureCoordinate3D",!1),this.hiCoordinateNode=t.createNode("Coordinate",!1),this.textureNormalMatrixArray=new Float32Array(9)}Object.assign(Object.setPrototypeOf(ge.prototype,ee().prototype),ne().prototype,{initialize(){ee().prototype.initialize.call(this),ne().prototype.initialize.call(this),this._bboxDisplay.addFieldInterest(this.groupNode._bboxDisplay),this.proximitySensorNode._orientation_changed.addFieldInterest(this.transformNode._rotation),this.proximitySensorNode._orientation_changed.addFieldInterest(this.textureTransformNode._rotation),this.proximitySensorNode._isActive.addInterest("set_active__",this),this.groupNode._children=[this.proximitySensorNode,this.transformNode],this.transformNode._children=[this.lowShapeNode,this.hiShapeNode],this.textureTransformNode._translation=new(l().SFVec3f)(.5,.5,.5),this.textureTransformNode._center=new(l().SFVec3f)(-.5,-.5,-.5),this.appearanceNode._alphaMode="BLEND",this.appearanceNode._material=this.volumeMaterialNode,this.appearanceNode._textureTransform=this.textureTransformNode,this.lowShapeNode._pointerEvents=!1,this.lowShapeNode._castShadow=!1,this.lowShapeNode._visible=!1,this.lowShapeNode._appearance=this.appearanceNode,this.lowShapeNode._geometry=this.lowGeometryNode,this.lowGeometryNode._texCoord=this.lowTextureCoordinateNode,this.lowGeometryNode._coord=this.lowCoordinateNode,this.hiShapeNode._pointerEvents=!1,this.hiShapeNode._castShadow=!1,this.hiShapeNode._visible=!1,this.hiShapeNode._appearance=this.appearanceNode,this.hiShapeNode._geometry=this.hiGeometryNode,this.hiGeometryNode._texCoord=this.hiTextureCoordinateNode,this.hiGeometryNode._coord=this.hiCoordinateNode,this.volumeMaterialNode.setPrivate(!0),this.textureTransformNode.setPrivate(!0),this.appearanceNode.setPrivate(!0),this.lowCoordinateNode.setPrivate(!0),this.lowTextureCoordinateNode.setPrivate(!0),this.lowGeometryNode.setPrivate(!0),this.lowShapeNode.setPrivate(!0),this.hiCoordinateNode.setPrivate(!0),this.hiTextureCoordinateNode.setPrivate(!0),this.hiGeometryNode.setPrivate(!0),this.hiShapeNode.setPrivate(!0),this.transformNode.setPrivate(!0),this.proximitySensorNode.setPrivate(!0),this.groupNode.setPrivate(!0),this.volumeMaterialNode.setup(),this.textureTransformNode.setup(),this.appearanceNode.setup(),this.lowCoordinateNode.setup(),this.lowTextureCoordinateNode.setup(),this.lowGeometryNode.setup(),this.lowShapeNode.setup(),this.hiCoordinateNode.setup(),this.hiTextureCoordinateNode.setup(),this.hiGeometryNode.setup(),this.hiShapeNode.setup(),this.transformNode.setup(),this.proximitySensorNode.setup(),this.groupNode.setup(),this.connectChildNode(this.groupNode),this.getLive().addInterest("set_live__",this,!0),this._dimensions.addInterest("set_dimensions__",this),this.textureTransformNode.addInterest("set_textureTransform__",this),this.set_live__(!1),this.set_dimensions__(),this.set_textureTransform__(),this.set_active__()},getBBox(e,t){return this.isDefaultBBoxSize()?e.set(this._dimensions.getValue(),pe().ZERO):e.set(this._bboxSize.getValue(),this._bboxCenter.getValue())},getAppearance(){return this.appearanceNode},updateShader(){this.volumeMaterialNode.getVolumeShaders().clear()},addShaderUniformNames(e){e.push("x3d_TextureNormalMatrix")},getNumPlanes(e){switch(e){case ie().LOW:return 200;case ie().MEDIUM:return 400;case ie().HIGH:return 600}},getPoints(e){const t=this.getNumPlanes(e),n=this._dimensions.getValue().norm(),o=n/2,i=[];for(let e=0;e<t;++e){const r=e/(t-1)-.5;i.push(o,o,n*r,-o,o,n*r,-o,-o,n*r,o,-o,n*r)}return i},set_live__(e){const t=this.getBrowser(),n=this.isLive()&&t.getBrowserOption("AlwaysUpdateGeometries");this.getLive().getValue()||n?(t.getBrowserOptions()._TextureQuality.addInterest("set_dimensions__",this),t.getBrowserOptions()._QualityWhenMoving.addInterest("set_dimensions__",this),e&&this.set_dimensions__()):(t.getBrowserOptions()._TextureQuality.removeInterest("set_dimensions__",this),t.getBrowserOptions()._QualityWhenMoving.removeInterest("set_dimensions__",this))},set_dimensions__(){const e=this.getBrowser(),t=e.getBrowserOptions().getTextureQuality(),n=e.getBrowserOptions().getQualityWhenMoving()??t;this.proximitySensorNode._size=new(pe())(200*this._dimensions.length()),this.textureTransformNode._scale=this._dimensions.inverse();const o=this.getPoints(t);if(this.hiCoordinateNode._point=o,this.hiTextureCoordinateNode._point=o,n===t)this.lowShapeNode._geometry=this.hiGeometryNode;else{const e=this.getPoints(n);this.lowCoordinateNode._point=e,this.lowTextureCoordinateNode._point=e,this.lowShapeNode._geometry=this.lowGeometryNode}this.set_active__()},set_textureTransform__(){this.textureNormalMatrixArray.set(new(_e())(...this.textureTransformNode.getMatrix()).submatrix.inverse())},set_active__(){const e=this.getBrowser(),t=e.getBrowserOptions().getTextureQuality(),n=e.getBrowserOptions().getQualityWhenMoving()??t,o=this.proximitySensorNode._isActive.getValue()&&t!==n;o?e.sensorEvents().addInterest("update",this):e.sensorEvents().removeInterest("update",this),this.lowShapeNode._visible=!o,this.hiShapeNode._visible=o},update(){const e=this.getBrowser(),t=e.getCurrentSpeed()>0||e.getViewer().isActive();this.lowShapeNode._visible.getValue()!==t&&(this.lowShapeNode._visible=t),this.hiShapeNode._visible.getValue()!==!t&&(this.hiShapeNode._visible=!t)},traverse(e,t){this.groupNode.traverse(e,t)},setShaderUniforms(e,t){e.uniformMatrix3fv(t.x3d_TextureNormalMatrix,!0,this.textureNormalMatrixArray)},dispose(){ne().prototype.dispose.call(this),ee().prototype.dispose.call(this)}}),Object.defineProperties(ge,_().getStaticProperties("X3DVolumeDataNode","VolumeRendering",1));const me=ge,Se=N().add("X3DVolumeDataNode",me),Ne=e.ComposedShader;var ye=t.n(Ne);const xe=e.ShaderPart;var ve=t.n(xe);function we(e){Se.call(this,e),this.addType(m().IsoSurfaceVolumeData),this.renderStyleNodes=[]}Object.assign(Object.setPrototypeOf(we.prototype,Se.prototype),{initialize(){Se.prototype.initialize.call(this),this._gradients.addInterest("set_gradients__",this),this._renderStyle.addInterest("set_renderStyle__",this),this._contourStepSize.addInterest("updateShader",this),this._surfaceValues.addInterest("updateShader",this),this._surfaceTolerance.addInterest("updateShader",this),this._renderStyle.addInterest("updateShader",this),this.set_gradients__(),this.set_renderStyle__(),this.set_voxels__(),this.updateShader()},set_gradients__(){this.gradientsNode=D()(m().X3DTexture3DNode,this._gradients)},set_renderStyle__(){const e=this.renderStyleNodes;for(const t of e)t.removeInterest("updateShader",this),t.removeVolumeData(this);e.length=0;for(const t of this._renderStyle){const n=D()(m().X3DComposableVolumeRenderStyleNode,t);n&&e.push(n)}for(const t of e)t.addInterest("updateShader",this),t.addVolumeData(this)},set_voxels__(){this.voxelsNode=D()(m().X3DTexture3DNode,this._voxels),this.voxelsNode?this.getAppearance()._texture=this._voxels:this.getAppearance()._texture=this.getBrowser().getDefaultVoxels()},createShader(e,t,n){const o=this.getBrowser().getDefaultVolumeStyle(),i=new Set;o.getDefines(i);let r=o.getUniformsText(),s=o.getFunctionsText();r+="\n",r+="uniform float surfaceValues ["+Math.max(this._surfaceValues.length,1)+"];\n",r+="uniform float surfaceTolerance;\n";for(const e of this.renderStyleNodes)e.getDefines(i),r+=e.getUniformsText();if(s+="\n",s+=" // IsoSurfaceVolumeData\n",s+="\n",this.gradientsNode?(r+="\n",r+="uniform sampler3D gradients;\n",s+=" if (length (texture (gradients, texCoord) .xyz * 2.0 - 1.0) < surfaceTolerance)\n",s+=" discard;\n"):(r+="\n",r+="vec4\n",r+="getNormal (in vec3 texCoord)\n",r+="{\n",r+=" vec4 offset = vec4 (1.0 / vec3 (textureSize (x3d_Texture3D [0], 0)), 0.0);\n",r+=" float i0 = texture (x3d_Texture3D [0], texCoord + offset .xww) .r;\n",r+=" float i1 = texture (x3d_Texture3D [0], texCoord - offset .xww) .r;\n",r+=" float i2 = texture (x3d_Texture3D [0], texCoord + offset .wyw) .r;\n",r+=" float i3 = texture (x3d_Texture3D [0], texCoord - offset .wyw) .r;\n",r+=" float i4 = texture (x3d_Texture3D [0], texCoord + offset .wwz) .r;\n",r+=" float i5 = texture (x3d_Texture3D [0], texCoord - offset .wwz) .r;\n",r+=" vec3 n = vec3 (i1 - i0, i3 - i2, i5 - i4);\n",r+="\n",r+=" return vec4 (normalize (x3d_TextureNormalMatrix * n), length (n));\n",r+="}\n",s+=" if (getNormal (texCoord) .w < surfaceTolerance)\n",s+=" discard;\n"),s+="\n",s+=" float intensity = textureColor .r;\n",s+="\n",1===this._surfaceValues.length){const e=Math.abs(this._contourStepSize.getValue());if(0===e)s+=" if (intensity > surfaceValues [0])\n",s+=" {\n",s+=" textureColor = vec4 (vec3 (surfaceValues [0]), 1.0);\n",this.renderStyleNodes.length&&(s+=this.renderStyleNodes[0].getFunctionsText()),s+=" }\n",s+=" else\n",s+=" {\n",s+=" discard;\n",s+=" }\n",s+="\n";else{const t=[];for(let n=this._surfaceValues[0]-e;n>0;n-=e)t.unshift(n);t.push(this._surfaceValues[0]);for(let n=this._surfaceValues[0]+e;n<1;n+=e)t.push(n);s+=" if (false)\n",s+=" { }\n";for(let e=this._surfaceValues.length-1;e>=0;--e)s+=" else if (intensity > "+t[e]+")\n",s+=" {\n",s+=" textureColor = vec4 (vec3 ("+t[e]+"), 1.0);\n",this.renderStyleNodes.length&&(s+=this.renderStyleNodes[0].getFunctionsText()),s+=" }\n";s+=" else\n",s+=" {\n",s+=" discard;\n",s+=" }\n",s+="\n"}}else{s+=" if (false)\n",s+=" { }\n";for(let e=this._surfaceValues.length-1;e>=0;--e){if(s+=" else if (intensity > surfaceValues ["+e+"])\n",s+=" {\n",s+=" textureColor = vec4 (vec3 (surfaceValues ["+e+"]), 1.0);\n",this.renderStyleNodes.length){const t=Math.min(e,this.renderStyleNodes.length-1);s+=this.renderStyleNodes[t].getFunctionsText()}s+=" }\n"}s+=" else\n",s+=" {\n",s+=" discard;\n",s+=" }\n",s+="\n"}n=n.replace("__VOLUME_STYLES_DEFINES__",Array.from(i).join("\n")).replace("__VOLUME_STYLES_UNIFORMS__",r).replace("__VOLUME_STYLES_FUNCTIONS__",s);const a=new(ve())(this.getExecutionContext());a._url.push(encodeURI("data:x-shader/x-vertex,"+t)),a.setPrivate(!0),a.setName("VolumeDataVertexShader"),a.setOptions(e),a.setup();const d=new(ve())(this.getExecutionContext());d._type="FRAGMENT",d._url.push(encodeURI("data:x-shader/x-fragment,"+n)),d.setPrivate(!0),d.setName("VolumeDataFragmentShader"),d.setOptions(e),d.setup();const u=new(ye())(this.getExecutionContext());u._language="GLSL",u._parts.push(a),u._parts.push(d),u.setPrivate(!0),u.setName("VolumeDataShader"),u.addUserDefinedField(m().inputOutput,"surfaceValues",this._surfaceValues.copy()),u.addUserDefinedField(m().inputOutput,"surfaceTolerance",this._surfaceTolerance.copy()),this.gradientsNode&&u.addUserDefinedField(m().inputOutput,"gradients",new(l().SFNode)(this.gradientsNode)),o.addShaderFields(u);for(const e of this.renderStyleNodes)e.addShaderFields(u);const h=[];return this.addShaderUniformNames(h),u.setUniformNames(h),u.setup(),u}}),Object.defineProperties(we,{..._().getStaticProperties("IsoSurfaceVolumeData","VolumeRendering",2,"children","3.3"),fieldDefinitions:{value:new(p())([new(h())(m().inputOutput,"metadata",new(l().SFNode)),new(h())(m().inputOutput,"dimensions",new(l().SFVec3f)(1,1,1)),new(h())(m().inputOutput,"contourStepSize",new(l().SFFloat)),new(h())(m().inputOutput,"surfaceValues",new(l().MFFloat)),new(h())(m().inputOutput,"surfaceTolerance",new(l().SFFloat)),new(h())(m().inputOutput,"visible",new(l().SFBool)(!0)),new(h())(m().inputOutput,"bboxDisplay",new(l().SFBool)),new(h())(m().initializeOnly,"bboxSize",new(l().SFVec3f)(-1,-1,-1)),new(h())(m().initializeOnly,"bboxCenter",new(l().SFVec3f)),new(h())(m().inputOutput,"renderStyle",new(l().MFNode)),new(h())(m().inputOutput,"gradients",new(l().SFNode)),new(h())(m().inputOutput,"voxels",new(l().SFNode))]),enumerable:!0}});const Fe=we,Ce=N().add("IsoSurfaceVolumeData",Fe);function Oe(e){v.call(this,e),this.addType(m().ProjectionVolumeStyle)}Object.assign(Object.setPrototypeOf(Oe.prototype,v.prototype),{addShaderFields(e){this._enabled.getValue()&&e.addUserDefinedField(m().inputOutput,"intensityThreshold_"+this.getId(),this._intensityThreshold.copy())},getDefines(e){e.add("#define X3D_PLANE")},getUniformsText(){if(!this._enabled.getValue())return"";let e="";switch(e+="\n",e+="// ProjectionVolumeStyle\n",e+="\n",e+="uniform float intensityThreshold_"+this.getId()+";\n",e+="\n",e+="vec4\n",e+="getProjectionStyle_"+this.getId()+"(in vec4 originalColor, in vec3 texCoord)\n",e+="{\n",this._type.getValue()){default:case"MAX":case"AVERAGE":e+=" float projectionColor = 0.0;\n";break;case"MIN":e+=" float projectionColor = 1.0;\n"}switch(e+=" const int samples = 16;\n",e+=" vec3 normal = normalize (x3d_TextureNormalMatrix * vec3 (0.0, 0.0, 1.0));\n",e+=" Plane3 plane = plane3 (vec3 (0.5), normal);\n",e+=" vec3 point = texCoord + plane3_perpendicular_vector (plane, texCoord);\n",e+=" vec3 ray = point - normal * M_SQRT1_2;\n",e+=" vec3 step = normal * (M_SQRT2 / float (samples));\n",e+=" bool first = false;\n",e+="\n",e+=" for (int i = 0; i < samples; ++ i, ray += step)\n",e+=" {\n",e+=" if (any (greaterThan (abs (ray - 0.5), vec3 (0.5))))\n",e+=" continue;\n",e+="\n",e+=" float intensity = texture (x3d_Texture3D [0], ray) .r;\n",e+="\n",this._type.getValue()){default:case"MAX":e+=" if (intensity < intensityThreshold_"+this.getId()+")\n",e+=" continue;\n",e+="\n",e+=" if (first && intensityThreshold_"+this.getId()+" > 0.0)\n",e+=" break;\n",e+="\n",e+=" if (intensity <= projectionColor)\n",e+=" {\n",e+=" first = true;\n",e+=" continue;\n",e+=" }\n",e+="\n",e+=" projectionColor = intensity;\n";break;case"MIN":e+=" if (intensity < intensityThreshold_"+this.getId()+")\n",e+=" continue;\n",e+="\n",e+=" if (first && intensityThreshold_"+this.getId()+" > 0.0)\n",e+=" break;\n",e+="\n",e+=" if (intensity >= projectionColor)\n",e+=" {\n",e+=" first = true;\n",e+=" continue;\n",e+=" }\n",e+="\n",e+=" projectionColor = intensity;\n";break;case"AVERAGE":e+=" projectionColor += intensity;\n"}return e+=" }\n",e+="\n","AVERAGE"===this._type.getValue()&&(e+=" projectionColor /= float (samples);\n"),e+=" return vec4 (vec3 (projectionColor), originalColor .a);\n",e+="}\n",e},getFunctionsText(){if(!this._enabled.getValue())return"";let e="";return e+="\n",e+=" // ProjectionVolumeStyle\n",e+="\n",e+=" textureColor = getProjectionStyle_"+this.getId()+" (textureColor, texCoord);\n",e}}),Object.defineProperties(Oe,{..._().getStaticProperties("ProjectionVolumeStyle","VolumeRendering",2,"renderStyle","3.3"),fieldDefinitions:{value:new(p())([new(h())(m().inputOutput,"metadata",new(l().SFNode)),new(h())(m().inputOutput,"enabled",new(l().SFBool)(!0)),new(h())(m().inputOutput,"type",new(l().SFString)("MAX")),new(h())(m().inputOutput,"intensityThreshold",new(l().SFFloat))]),enumerable:!0}});const De=Oe,Ie=N().add("ProjectionVolumeStyle",De);function Te(e){Se.call(this,e),this.addType(m().SegmentedVolumeData),this.renderStyleNodes=[]}Object.assign(Object.setPrototypeOf(Te.prototype,Se.prototype),{initialize(){Se.prototype.initialize.call(this),this._segmentIdentifiers.addInterest("set_segmentIdentifiers__",this),this._renderStyle.addInterest("set_renderStyle__",this),this._segmentEnabled.addInterest("updateShader",this),this._segmentIdentifiers.addInterest("updateShader",this),this._renderStyle.addInterest("updateShader",this),this.set_segmentIdentifiers__(),this.set_renderStyle__(),this.set_voxels__(),this.updateShader()},getSegmentEnabled(e){return!(e<this._segmentEnabled.length)||this._segmentEnabled[e]},set_segmentIdentifiers__(){this.segmentIdentifiersNode=D()(m().X3DTexture3DNode,this._segmentIdentifiers)},set_renderStyle__(){const e=this.renderStyleNodes;for(const t of e)t.removeInterest("updateShader",this),t.removeVolumeData(this);e.length=0;for(const t of this._renderStyle){const n=D()(m().X3DComposableVolumeRenderStyleNode,t);n&&e.push(n)}for(const t of e)t.addInterest("updateShader",this),t.addVolumeData(this)},set_voxels__(){this.voxelsNode=D()(m().X3DTexture3DNode,this._voxels),this.voxelsNode?this.getAppearance()._texture=this._voxels:this.getAppearance()._texture=this.getBrowser().getDefaultVoxels()},createShader(e,t,n){const o=this.getBrowser().getDefaultVolumeStyle(),i=new Set;let r=o.getUniformsText(),s=o.getFunctionsText();if(this.segmentIdentifiersNode?(r+="\n",r+="uniform sampler3D segmentIdentifiers;\n",r+="\n",s+="\n",s+=" int segment = int (texture (segmentIdentifiers, texCoord) .r * 255.0);\n"):s+=" int segment = 0;\n",this.renderStyleNodes.length){s+="\n",s+=" switch (segment)\n",s+=" {\n";for(const[e,t]of this.renderStyleNodes.entries())t.getDefines(i),s+=" case "+e+":\n",s+=" {\n",this.getSegmentEnabled(e)?(r+=t.getUniformsText(),s+=t.getFunctionsText(),s+=" break;\n"):s+=" discard;\n",s+=" }\n";s+=" }\n"}n=n.replace("__VOLUME_STYLES_DEFINES__",Array.from(i).join("\n")).replace("__VOLUME_STYLES_UNIFORMS__",r).replace("__VOLUME_STYLES_FUNCTIONS__",s);const a=new(ve())(this.getExecutionContext());a._url.push(encodeURI("data:x-shader/x-vertex,"+t)),a.setPrivate(!0),a.setName("SegmentedVolumeDataVertexShader"),a.setOptions(e),a.setup();const d=new(ve())(this.getExecutionContext());d._type="FRAGMENT",d._url.push(encodeURI("data:x-shader/x-fragment,"+n)),d.setPrivate(!0),d.setName("SegmentedVolumeDataFragmentShader"),d.setOptions(e),d.setup();const u=new(ye())(this.getExecutionContext());u._language="GLSL",u._parts.push(a),u._parts.push(d),u.setPrivate(!0),u.setName("SegmentedVolumeDataShader"),this.segmentIdentifiersNode&&u.addUserDefinedField(m().inputOutput,"segmentIdentifiers",new(l().SFNode)(this.segmentIdentifiersNode)),o.addShaderFields(u);for(const[e,t]of this.renderStyleNodes.entries())this.getSegmentEnabled(e)&&t.addShaderFields(u);const h=[];return this.addShaderUniformNames(h),u.setUniformNames(h),u.setup(),u}}),Object.defineProperties(Te,{..._().getStaticProperties("SegmentedVolumeData","VolumeRendering",2,"children","3.3"),fieldDefinitions:{value:new(p())([new(h())(m().inputOutput,"metadata",new(l().SFNode)),new(h())(m().inputOutput,"dimensions",new(l().SFVec3f)(1,1,1)),new(h())(m().inputOutput,"segmentEnabled",new(l().MFBool)),new(h())(m().inputOutput,"visible",new(l().SFBool)(!0)),new(h())(m().inputOutput,"bboxDisplay",new(l().SFBool)),new(h())(m().initializeOnly,"bboxSize",new(l().SFVec3f)(-1,-1,-1)),new(h())(m().initializeOnly,"bboxCenter",new(l().SFVec3f)),new(h())(m().inputOutput,"segmentIdentifiers",new(l().SFNode)),new(h())(m().inputOutput,"renderStyle",new(l().MFNode)),new(h())(m().inputOutput,"voxels",new(l().SFNode))]),enumerable:!0}});const be=Te,Ve=N().add("SegmentedVolumeData",be);function Pe(e){C.call(this,e),this.addType(m().ShadedVolumeStyle)}Object.assign(Object.setPrototypeOf(Pe.prototype,C.prototype),{initialize(){C.prototype.initialize.call(this),this._material.addInterest("set_material__",this),this._surfaceNormals.addInterest("set_surfaceNormals__",this),this.set_material__(),this.set_surfaceNormals__()},set_material__(){this.materialNode&&this.materialNode.removeInterest("addNodeEvent",this),this.materialNode=D()(m().X3DMaterialNode,this._material),this.materialNode&&this.materialNode.addInterest("addNodeEvent",this)},set_surfaceNormals__(){this.surfaceNormalsNode=D()(m().X3DTexture3DNode,this._surfaceNormals)},addShaderFields(e){this._enabled.getValue()&&(this.materialNode&&(e.addUserDefinedField(m().inputOutput,"ambientIntensity_"+this.getId(),this.materialNode._ambientIntensity.copy()),e.addUserDefinedField(m().inputOutput,"diffuseColor_"+this.getId(),this.materialNode._diffuseColor.copy()),e.addUserDefinedField(m().inputOutput,"specularColor_"+this.getId(),this.materialNode._specularColor.copy()),e.addUserDefinedField(m().inputOutput,"emissiveColor_"+this.getId(),this.materialNode._emissiveColor.copy()),e.addUserDefinedField(m().inputOutput,"shininess_"+this.getId(),this.materialNode._shininess.copy()),e.addUserDefinedField(m().inputOutput,"transparency_"+this.getId(),this.materialNode._transparency.copy())),this.surfaceNormalsNode&&e.addUserDefinedField(m().inputOutput,"surfaceNormals_"+this.getId(),new(l().SFNode)(this.surfaceNormalsNode)))},getDefines(e){e.add("#define X3D_SHADING")},getUniformsText(){if(!this._enabled.getValue())return"";let e="";return e+="\n",e+="// ShadedVolumeStyle\n",e+="\n",e+="uniform float ambientIntensity_"+this.getId()+";\n",e+="uniform vec3 diffuseColor_"+this.getId()+";\n",e+="uniform vec3 specularColor_"+this.getId()+";\n",e+="uniform vec3 emissiveColor_"+this.getId()+";\n",e+="uniform float shininess_"+this.getId()+";\n",e+="uniform float transparency_"+this.getId()+";\n",e+=this.getNormalText(this.surfaceNormalsNode),e+="\n",e+="vec4\n",e+="getShadedStyle_"+this.getId()+" (in vec4 originalColor, in vec3 texCoord)\n",e+="{\n",e+=" vec4 surfaceNormal = getNormal_"+this.getId()+" (texCoord);\n",e+="\n",e+=" if (surfaceNormal .w == 0.0)\n",e+=" return vec4 (0.0);\n",e+="\n",e+=" vec4 shadedColor = vec4 (0.0);\n",this._lighting.getValue()?(this.materialNode?(e+=" vec3 diffuseFactor = diffuseColor_"+this.getId()+";\n",e+=" vec3 ambientTerm = diffuseFactor * ambientIntensity_"+this.getId()+";\n",e+="\n",e+=" shadedColor .a = originalColor .a * (1.0 - transparency_"+this.getId()+");\n"):(e+=" vec3 diffuseFactor = originalColor .rgb;\n",e+=" vec3 ambientTerm = vec3 (0.0);\n",e+="\n",e+=" shadedColor .a = originalColor .a;\n"),e+="\n",e+=" vec3 N = surfaceNormal .xyz;\n",e+=" vec3 V = normalize (-vertex); // normalized vector from point on geometry to viewer's position\n",e+="\n",e+=" for (int i = 0; i < X3D_NUM_LIGHTS; ++ i)\n",e+=" {\n",e+=" x3d_LightSourceParameters light = x3d_LightSource [i];\n",e+="\n",e+=" vec3 vL = light .location - vertex; // Light to fragment\n",e+=" float dL = length (light .matrix * vL);\n",e+=" bool di = light .type == x3d_DirectionalLight;\n",e+="\n",e+=" if (di || dL <= light .radius)\n",e+=" {\n",e+=" vec3 d = light .direction;\n",e+=" vec3 c = light .attenuation;\n",e+=" vec3 L = di ? -d : normalize (vL); // Normalized vector from point on geometry to light source i position.\n",e+=" vec3 H = normalize (L + V); // Specular term\n",e+="\n",e+=" float lightAngle = max (dot (N, L), 0.0); // Angle between normal and light ray.\n",e+=" vec3 diffuseTerm = diffuseFactor * lightAngle;\n",e+=" float specularFactor = shininess_"+this.getId()+" > 0.0 ? pow (max (dot (N, H), 0.0), shininess_"+this.getId()+" * 128.0) : 1.0;\n",e+=" vec3 specularTerm = light .intensity * specularColor_"+this.getId()+" * specularFactor;\n",e+="\n",e+=" float attenuationFactor = di ? 1.0 : 1.0 / max (dot (c, vec3 (1.0, dL, dL * dL)), 1.0);\n",e+=" float spotFactor = light .type == x3d_SpotLight ? getSpotFactor (light .cutOffAngle, light .beamWidth, L, d) : 1.0;\n",e+=" float attenuationSpotFactor = attenuationFactor * spotFactor;\n",e+=" vec3 ambientColor = light .ambientIntensity * ambientTerm;\n",e+=" vec3 diffuseSpecularColor = light .intensity * (diffuseTerm + specularTerm);\n",e+="\n",e+=" shadedColor .rgb += attenuationSpotFactor * light .color * (ambientColor + diffuseSpecularColor);\n",e+=" }\n",e+="\n",e+=" shadedColor .rgb += emissiveColor_"+this.getId()+";\n",e+=" }\n"):this.materialNode?(e+=" shadedColor .rgb = diffuseColor_"+this.getId()+";\n",e+=" shadedColor .a = originalColor .a * (1.0 - transparency_"+this.getId()+");\n"):e+=" shadedColor = originalColor;\n",e+="\n",e+=" return shadedColor;\n",e+="}\n",e},getFunctionsText(){if(!this._enabled.getValue())return"";let e="";return e+="\n",e+=" // ShadedVolumeStyle\n",e+="\n",e+=" textureColor = getShadedStyle_"+this.getId()+" (textureColor, texCoord);\n",e}}),Object.defineProperties(Pe,{..._().getStaticProperties("ShadedVolumeStyle","VolumeRendering",3,"renderStyle","3.3"),fieldDefinitions:{value:new(p())([new(h())(m().inputOutput,"metadata",new(l().SFNode)),new(h())(m().inputOutput,"enabled",new(l().SFBool)(!0)),new(h())(m().inputOutput,"lighting",new(l().SFBool)),new(h())(m().inputOutput,"shadows",new(l().SFBool)),new(h())(m().initializeOnly,"phaseFunction",new(l().SFString)("Henyey-Greenstein")),new(h())(m().inputOutput,"material",new(l().SFNode)),new(h())(m().inputOutput,"surfaceNormals",new(l().SFNode))]),enumerable:!0}});const Ee=Pe,Me=N().add("ShadedVolumeStyle",Ee);function Ue(e){C.call(this,e),this.addType(m().SilhouetteEnhancementVolumeStyle)}Object.assign(Object.setPrototypeOf(Ue.prototype,C.prototype),{initialize(){C.prototype.initialize.call(this),this._surfaceNormals.addInterest("set_surfaceNormals__",this),this.set_surfaceNormals__()},set_surfaceNormals__(){this.surfaceNormalsNode=D()(m().X3DTexture3DNode,this._surfaceNormals)},addShaderFields(e){this._enabled.getValue()&&(e.addUserDefinedField(m().inputOutput,"silhouetteRetainedOpacity_"+this.getId(),this._silhouetteRetainedOpacity.copy()),e.addUserDefinedField(m().inputOutput,"silhouetteBoundaryOpacity_"+this.getId(),this._silhouetteBoundaryOpacity.copy()),e.addUserDefinedField(m().inputOutput,"silhouetteSharpness_"+this.getId(),this._silhouetteSharpness.copy()),this.surfaceNormalsNode&&e.addUserDefinedField(m().inputOutput,"surfaceNormals_"+this.getId(),new(l().SFNode)(this.surfaceNormalsNode)))},getUniformsText(){if(!this._enabled.getValue())return"";let e="";return e+="\n",e+="// SilhouetteEnhancementVolumeStyle\n",e+="\n",e+="uniform float silhouetteRetainedOpacity_"+this.getId()+";\n",e+="uniform float silhouetteBoundaryOpacity_"+this.getId()+";\n",e+="uniform float silhouetteSharpness_"+this.getId()+";\n",e+=this.getNormalText(this.surfaceNormalsNode),e+="\n",e+="vec4\n",e+="getSilhouetteEnhancementStyle_"+this.getId()+" (in vec4 originalColor, in vec3 texCoord)\n",e+="{\n",e+=" vec4 surfaceNormal = getNormal_"+this.getId()+" (texCoord);\n",e+="\n",e+=" if (surfaceNormal .w == 0.0)\n",e+=" return vec4 (0.0);\n",e+=" \n",e+=" float silhouetteRetainedOpacity = silhouetteRetainedOpacity_"+this.getId()+";\n",e+=" float silhouetteBoundaryOpacity = silhouetteBoundaryOpacity_"+this.getId()+";\n",e+=" float silhouetteSharpness = silhouetteSharpness_"+this.getId()+";\n",e+="\n",e+=" return vec4 (originalColor .rgb, originalColor .a * (silhouetteRetainedOpacity + silhouetteBoundaryOpacity * pow (1.0 - abs (dot (surfaceNormal .xyz, normalize (vertex))), silhouetteSharpness)));\n",e+="}\n",e},getFunctionsText(){if(!this._enabled.getValue())return"";let e="";return e+="\n",e+=" // SilhouetteEnhancementVolumeStyle\n",e+="\n",e+=" textureColor = getSilhouetteEnhancementStyle_"+this.getId()+" (textureColor, texCoord);\n",e}}),Object.defineProperties(Ue,{..._().getStaticProperties("SilhouetteEnhancementVolumeStyle","VolumeRendering",2,"renderStyle","3.3"),fieldDefinitions:{value:new(p())([new(h())(m().inputOutput,"metadata",new(l().SFNode)),new(h())(m().inputOutput,"enabled",new(l().SFBool)(!0)),new(h())(m().inputOutput,"silhouetteRetainedOpacity",new(l().SFFloat)(1)),new(h())(m().inputOutput,"silhouetteBoundaryOpacity",new(l().SFFloat)),new(h())(m().inputOutput,"silhouetteSharpness",new(l().SFFloat)(.5)),new(h())(m().inputOutput,"surfaceNormals",new(l().SFNode))]),enumerable:!0}});const Le=Ue,Re=N().add("SilhouetteEnhancementVolumeStyle",Le);function Ae(e){C.call(this,e),this.addType(m().ToneMappedVolumeStyle)}Object.assign(Object.setPrototypeOf(Ae.prototype,C.prototype),{initialize(){C.prototype.initialize.call(this),this._surfaceNormals.addInterest("set_surfaceNormals__",this),this.set_surfaceNormals__()},set_surfaceNormals__(){this.surfaceNormalsNode=D()(m().X3DTexture3DNode,this._surfaceNormals)},addShaderFields(e){this._enabled.getValue()&&(e.addUserDefinedField(m().inputOutput,"coolColor_"+this.getId(),this._coolColor.copy()),e.addUserDefinedField(m().inputOutput,"warmColor_"+this.getId(),this._warmColor.copy()),this.surfaceNormalsNode&&e.addUserDefinedField(m().inputOutput,"surfaceNormals_"+this.getId(),new(l().SFNode)(this.surfaceNormalsNode)))},getUniformsText(){if(!this._enabled.getValue())return"";let e="";return e+="\n",e+="// ToneMappedVolumeStyle\n",e+="\n",e+="uniform vec4 coolColor_"+this.getId()+";\n",e+="uniform vec4 warmColor_"+this.getId()+";\n",e+=this.getNormalText(this.surfaceNormalsNode),e+="\n",e+="vec4\n",e+="getToneMappedStyle_"+this.getId()+" (in vec4 originalColor, in vec3 texCoord)\n",e+="{\n",e+=" vec4 surfaceNormal = getNormal_"+this.getId()+" (texCoord);\n",e+="\n",e+=" if (surfaceNormal .w == 0.0)\n",e+=" return vec4 (0.0);\n",e+="\n",e+=" vec3 toneColor = vec3 (0.0);\n",e+=" vec3 coolColor = coolColor_"+this.getId()+" .rgb;\n",e+=" vec3 warmColor = warmColor_"+this.getId()+" .rgb;\n",e+="\n",e+=" for (int i = 0; i < X3D_NUM_LIGHTS; ++ i)\n",e+=" {\n",e+=" x3d_LightSourceParameters light = x3d_LightSource [i];\n",e+="\n",e+=" vec3 L = light .type == x3d_DirectionalLight ? -light .direction : normalize (light .location - vertex);\n",e+=" float colorFactor = dot (L, surfaceNormal .xyz) * 0.5 + 0.5;\n",e+="\n",e+=" toneColor += mix (warmColor .rgb, coolColor .rgb, colorFactor);\n",e+=" }\n",e+="\n",e+=" return vec4 (toneColor, originalColor .a);\n",e+="}\n",e},getFunctionsText(){if(!this._enabled.getValue())return"";let e="";return e+="\n",e+=" // ToneMappedVolumeStyle\n",e+="\n",e+=" textureColor = getToneMappedStyle_"+this.getId()+" (textureColor, texCoord);\n",e}}),Object.defineProperties(Ae,{..._().getStaticProperties("ToneMappedVolumeStyle","VolumeRendering",2,"renderStyle","3.3"),fieldDefinitions:{value:new(p())([new(h())(m().inputOutput,"metadata",new(l().SFNode)),new(h())(m().inputOutput,"enabled",new(l().SFBool)(!0)),new(h())(m().inputOutput,"coolColor",new(l().SFColorRGBA)(0,0,1,0)),new(h())(m().inputOutput,"warmColor",new(l().SFColorRGBA)(1,1,0,0)),new(h())(m().inputOutput,"surfaceNormals",new(l().SFNode))]),enumerable:!0}});const Be=Ae,je=N().add("ToneMappedVolumeStyle",Be);function Xe(e){Se.call(this,e),this.addType(m().VolumeData)}Object.assign(Object.setPrototypeOf(Xe.prototype,Se.prototype),{initialize(){Se.prototype.initialize.call(this),this._renderStyle.addInterest("set_renderStyle__",this),this._voxels.addInterest("set_voxels__",this),this._renderStyle.addInterest("updateShader",this),this.set_renderStyle__(),this.set_voxels__(),this.updateShader()},set_renderStyle__(){this.renderStyleNode&&(this.renderStyleNode.removeInterest("updateShader",this),this.renderStyleNode.removeVolumeData(this)),this.renderStyleNode=D()(m().X3DVolumeRenderStyleNode,this._renderStyle),this.renderStyleNode&&(this.renderStyleNode.addInterest("updateShader",this),this.renderStyleNode.addVolumeData(this))},set_voxels__(){this.voxelsNode=D()(m().X3DTexture3DNode,this._voxels),this.voxelsNode?this.getAppearance()._texture=this._voxels:this.getAppearance()._texture=this.getBrowser().getDefaultVoxels()},createShader(e,t,n){const o=this.getBrowser().getDefaultVolumeStyle(),i=new Set;o.getDefines(i);let r=o.getUniformsText(),s=o.getFunctionsText();this.renderStyleNode&&(this.renderStyleNode.getDefines(i),r+=this.renderStyleNode.getUniformsText(),s+=this.renderStyleNode.getFunctionsText()),n=n.replace("__VOLUME_STYLES_DEFINES__",Array.from(i).join("\n")).replace("__VOLUME_STYLES_UNIFORMS__",r).replace("__VOLUME_STYLES_FUNCTIONS__",s);const a=new(ve())(this.getExecutionContext());a._url.push(encodeURI("data:x-shader/x-vertex,"+t)),a.setPrivate(!0),a.setName("VolumeDataVertexShader"),a.setOptions(e),a.setup();const d=new(ve())(this.getExecutionContext());d._type="FRAGMENT",d._url.push(encodeURI("data:x-shader/x-fragment,"+n)),d.setPrivate(!0),d.setName("VolumeDataFragmentShader"),d.setOptions(e),d.setup();const l=new(ye())(this.getExecutionContext());l._language="GLSL",l._parts.push(a),l._parts.push(d),l.setPrivate(!0),l.setName("VolumeDataShader"),o.addShaderFields(l),this.renderStyleNode?.addShaderFields(l);const u=[];return this.addShaderUniformNames(u),l.setUniformNames(u),l.setup(),l}}),Object.defineProperties(Xe,{..._().getStaticProperties("VolumeData","VolumeRendering",1,"children","3.3"),fieldDefinitions:{value:new(p())([new(h())(m().inputOutput,"metadata",new(l().SFNode)),new(h())(m().inputOutput,"dimensions",new(l().SFVec3f)(1,1,1)),new(h())(m().inputOutput,"visible",new(l().SFBool)(!0)),new(h())(m().inputOutput,"bboxDisplay",new(l().SFBool)),new(h())(m().initializeOnly,"bboxSize",new(l().SFVec3f)(-1,-1,-1)),new(h())(m().initializeOnly,"bboxCenter",new(l().SFVec3f)),new(h())(m().inputOutput,"renderStyle",new(l().SFNode)),new(h())(m().inputOutput,"voxels",new(l().SFNode))]),enumerable:!0}});const ze=Xe,Ge=N().add("VolumeData",ze);o().add({name:"VolumeRendering",concreteNodes:[j,G,Y,q,Z,Ce,b,Ie,Ve,Me,Re,je,Ge],abstractNodes:[C,Se,v],browserContext:R});N().add("VolumeRenderingComponent",undefined)})();
|
|
1
|
+
/* X_ITE v12.1.5 */
|
|
2
|
+
const e=window[Symbol.for("X_ITE.X3D-12.1.5")];(()=>{var t={n:e=>{var n=e&&e.__esModule?()=>e.default:()=>e;return t.d(n,{a:n}),n},d:(e,n)=>{for(var o in n)t.o(n,o)&&!t.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:n[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const n=e.Components;var o=t.n(n);const i=e.PixelTexture;var r=t.n(i);const s=e.TextureProperties;var a=t.n(s);const d=e.Fields;var l=t.n(d);const u=e.X3DFieldDefinition;var h=t.n(u);const c=e.FieldDefinitionArray;var p=t.n(c);const f=e.X3DNode;var _=t.n(f);const g=e.X3DConstants;var m=t.n(g);const S=e.Namespace;var N=t.n(S);function y(e){_().call(this,e),this.addType(m().X3DVolumeRenderStyleNode),this.volumeDataNodes=new Set}Object.assign(Object.setPrototypeOf(y.prototype,_().prototype),{addShaderFields(e){},getDefines(){},getUniformsText:()=>"",getFunctionsText:()=>"",getVolumeData(){return this.volumeDataNodes},addVolumeData(e){this.volumeDataNodes.add(e)},removeVolumeData(e){this.volumeDataNodes.delete(e)},getNormalText(e){let t="";return e?(t+="uniform sampler3D surfaceNormals_"+this.getId()+";\n",t+="\n",t+="vec4\n",t+="getNormal_"+this.getId()+" (in vec3 texCoord)\n",t+="{\n",t+=" vec3 n = texture (surfaceNormals_"+this.getId()+", texCoord) .xyz * 2.0 - 1.0;\n",t+="\n",t+=" return vec4 (normalize (x3d_TextureNormalMatrix * n), length (n));\n",t+="}\n"):(t+="\n",t+="vec4\n",t+="getNormal_"+this.getId()+" (in vec3 texCoord)\n",t+="{\n",t+=" vec4 offset = vec4 (1.0 / vec3 (textureSize (x3d_Texture3D [0], 0)), 0.0);\n",t+=" float i0 = texture (x3d_Texture3D [0], texCoord + offset .xww) .r;\n",t+=" float i1 = texture (x3d_Texture3D [0], texCoord - offset .xww) .r;\n",t+=" float i2 = texture (x3d_Texture3D [0], texCoord + offset .wyw) .r;\n",t+=" float i3 = texture (x3d_Texture3D [0], texCoord - offset .wyw) .r;\n",t+=" float i4 = texture (x3d_Texture3D [0], texCoord + offset .wwz) .r;\n",t+=" float i5 = texture (x3d_Texture3D [0], texCoord - offset .wwz) .r;\n",t+=" vec3 n = vec3 (i1 - i0, i3 - i2, i5 - i4);\n",t+="\n",t+=" return vec4 (normalize (x3d_TextureNormalMatrix * n), length (n));\n",t+="}\n"),t}}),Object.defineProperties(y,_().getStaticProperties("X3DVolumeRenderStyleNode","VolumeRendering",1));const x=y,v=N().add("X3DVolumeRenderStyleNode",x);function w(e){v.call(this,e),this.addType(m().X3DComposableVolumeRenderStyleNode)}Object.setPrototypeOf(w.prototype,v.prototype),Object.defineProperties(w,_().getStaticProperties("X3DComposableVolumeRenderStyleNode","VolumeRendering",1));const F=w,C=N().add("X3DComposableVolumeRenderStyleNode",F),O=e.X3DCast;var D=t.n(O);function I(e){C.call(this,e),this.addType(m().OpacityMapVolumeStyle)}Object.assign(Object.setPrototypeOf(I.prototype,C.prototype),{initialize(){C.prototype.initialize.call(this),this._transferFunction.addInterest("set_transferFunction__",this),this.set_transferFunction__()},set_transferFunction__(){this.transferFunctionNode=D()(m().X3DTexture2DNode,this._transferFunction),this.transferFunctionNode||(this.transferFunctionNode=D()(m().X3DTexture3DNode,this._transferFunction)),this.transferFunctionNode||(this.transferFunctionNode=this.getBrowser().getDefaultTransferFunction())},addShaderFields(e){this._enabled.getValue()&&e.addUserDefinedField(m().inputOutput,"transferFunction_"+this.getId(),new(l().SFNode)(this.transferFunctionNode))},getUniformsText(){if(!this._enabled.getValue())return"";let e="";return e+="\n",e+="// OpacityMapVolumeStyle\n",e+="\n",this.transferFunctionNode.getType().includes(m().X3DTexture2DNode)?(e+="uniform sampler2D transferFunction_"+this.getId()+";\n",e+="\n",e+="vec4\n",e+="getOpacityMapStyle_"+this.getId()+" (in vec4 originalColor)\n",e+="{\n",e+=" return texture (transferFunction_"+this.getId()+", originalColor .rg);\n",e+="}\n"):(e+="uniform sampler3D transferFunction_"+this.getId()+";\n",e+="\n",e+="vec4\n",e+="getOpacityMapStyle_"+this.getId()+" (in vec4 originalColor)\n",e+="{\n",e+=" return texture (transferFunction_"+this.getId()+", originalColor .rgb);\n",e+="}\n"),e},getFunctionsText(){if(!this._enabled.getValue())return"";let e="";return e+="\n",e+=" // OpacityMapVolumeStyle\n",e+="\n",e+=" textureColor = getOpacityMapStyle_"+this.getId()+" (textureColor);\n",e}}),Object.defineProperties(I,{..._().getStaticProperties("OpacityMapVolumeStyle","VolumeRendering",1,"renderStyle","3.3"),fieldDefinitions:{value:new(p())([new(h())(m().inputOutput,"enabled",new(l().SFBool)(!0)),new(h())(m().inputOutput,"metadata",new(l().SFNode)),new(h())(m().inputOutput,"transferFunction",new(l().SFNode))]),enumerable:!0}});const T=I,b=N().add("OpacityMapVolumeStyle",T),V=Symbol(),P=Symbol(),E=Symbol(),M=Symbol();function U(){}Object.assign(U.prototype,{getDefaultVoxels(){return this[V]??=(()=>{const e=this.getPrivateScene().createNode("PixelTexture3D",!1);return e._image=[1,1,1,1,255],e.repeatS=!0,e.repeatT=!0,e.repeatR=!0,e.setup(),e})()},getDefaultVolumeStyle(){return this[P]??=(()=>{const e=new b(this.getPrivateScene());return e.setup(),e})()},getDefaultBlendedVolumeStyle(){return this[E]??=(()=>{const e=new b(this.getPrivateScene());return e.setup(),e})()},getDefaultTransferFunction(){return this[M]??=(()=>{const e=new(a())(this.getPrivateScene());e._boundaryModeS="CLAMP_TO_EDGE",e._boundaryModeT="REPEAT",e._magnificationFilter="DEFAULT",e._minificationFilter="DEFAULT",e._generateMipMaps=!0,e._textureCompression="DEFAULT",e.setup();const t=new(r())(this.getPrivateScene());return t._textureProperties=e,t._image.width=256,t._image.height=1,t._image.comp=2,t._image.array=Array.from({length:256},(e,t)=>t<<8|t),t.setup(),t})()}});const L=U,R=N().add("X3DVolumeRenderingContext",L);function A(e){C.call(this,e),this.addType(m().BlendedVolumeStyle)}Object.assign(Object.setPrototypeOf(A.prototype,C.prototype),{initialize(){C.prototype.initialize.call(this),this._weightTransferFunction1.addInterest("set_weightTransferFunction1__",this),this._weightTransferFunction2.addInterest("set_weightTransferFunction2__",this),this._renderStyle.addInterest("set_renderStyle__",this),this._voxels.addInterest("set_voxels__",this),this.set_weightTransferFunction1__(),this.set_weightTransferFunction2__(),this.set_renderStyle__(),this.set_voxels__()},addVolumeData(e){C.prototype.addVolumeData.call(this,e),this.renderStyleNode&&this.renderStyleNode.addVolumeData(e)},removeVolumeData(e){C.prototype.removeVolumeData.call(this,e),this.renderStyleNode&&this.renderStyleNode.removeVolumeData(e)},set_weightTransferFunction1__(){this.weightTransferFunction1Node=D()(m().X3DTexture2DNode,this._weightTransferFunction1)},set_weightTransferFunction2__(){this.weightTransferFunction2Node=D()(m().X3DTexture2DNode,this._weightTransferFunction2)},set_renderStyle__(){if(this.renderStyleNode){this.renderStyleNode.removeInterest("addNodeEvent",this);for(const e of this.getVolumeData())this.renderStyleNode.removeVolumeData(e)}if(this.renderStyleNode=D()(m().X3DComposableVolumeRenderStyleNode,this._renderStyle),this.renderStyleNode){this.renderStyleNode.addInterest("addNodeEvent",this);for(const e of this.getVolumeData())this.renderStyleNode.addVolumeData(e)}},set_voxels__(){this.voxelsNode=D()(m().X3DTexture3DNode,this._voxels)},addShaderFields(e){this._enabled.getValue()&&(e.addUserDefinedField(m().inputOutput,"weightConstant1_"+this.getId(),this._weightConstant1.copy()),e.addUserDefinedField(m().inputOutput,"weightConstant2_"+this.getId(),this._weightConstant2.copy()),this.weightTransferFunction1Node&&e.addUserDefinedField(m().inputOutput,"weightTransferFunction1_"+this.getId(),new(l().SFNode)(this.weightTransferFunction1Node)),this.weightTransferFunction2Node&&e.addUserDefinedField(m().inputOutput,"weightTransferFunction2_"+this.getId(),new(l().SFNode)(this.weightTransferFunction2Node)),this.voxelsNode&&e.addUserDefinedField(m().inputOutput,"voxels_"+this.getId(),new(l().SFNode)(this.voxelsNode)),this.getBrowser().getDefaultBlendedVolumeStyle().addShaderFields(e),this.renderStyleNode&&this.renderStyleNode.addShaderFields(e))},getUniformsText(){if(!this._enabled.getValue())return"";if(!this.voxelsNode)return"";let e="";e+="\n",e+="// BlendedVolumeStyle\n",e+="\n",e+="uniform float weightConstant1_"+this.getId()+";\n",e+="uniform float weightConstant2_"+this.getId()+";\n",this.weightTransferFunction1Node&&(e+="uniform sampler2D weightTransferFunction1_"+this.getId()+";\n"),this.weightTransferFunction2Node&&(e+="uniform sampler2D weightTransferFunction2_"+this.getId()+";\n"),e+="uniform sampler3D voxels_"+this.getId()+";\n";let t=this.getBrowser().getDefaultBlendedVolumeStyle().getUniformsText();this.renderStyleNode&&(t+=this.renderStyleNode.getUniformsText()),t=t.replace(/x3d_Texture3D\s*\[0\]/g,"voxels_"+this.getId()),e+="\n",e+=t,e+="\n",e+="vec4\n",e+="getBlendedStyle_"+this.getId()+" (in vec4 originalColor, in vec3 texCoord)\n",e+="{\n",e+=" vec4 blendColor_"+this.getId()+" = texture (voxels_"+this.getId()+", texCoord);";let n=this.getBrowser().getDefaultBlendedVolumeStyle().getFunctionsText();switch(this.renderStyleNode&&(n+=this.renderStyleNode.getFunctionsText()),n=n.replace(/textureColor/g,"blendColor_"+this.getId()),e+="\n",e+=n,this._weightFunction1.getValue()){default:e+=" float w1_"+this.getId()+" = weightConstant1_"+this.getId()+";\n";break;case"ALPHA0":e+=" float w1_"+this.getId()+" = originalColor .a;\n";break;case"ALPHA1":e+=" float w1_"+this.getId()+" = blendColor_ "+this.getId()+" .a;\n";break;case"ONE_MINUS_ALPHA0":e+=" float w1_"+this.getId()+" = 1.0 - originalColor .a;\n";break;case"ONE_MINUS_ALPHA1":e+=" float w1_"+this.getId()+" = 1.0 - blendColor_ "+this.getId()+" .a;\n";break;case"TABLE":this.weightTransferFunction1Node?e+=" float w1_"+this.getId()+" = texture (weightTransferFunction1_"+this.getId()+", vec2 (originalColor .a, blendColor_"+this.getId()+" .a)) .r;\n":e+=" float w1_"+this.getId()+" = weightConstant1_"+this.getId()+";\n"}switch(this._weightFunction2.getValue()){default:e+=" float w2_"+this.getId()+" = weightConstant2_"+this.getId()+";\n";break;case"ALPHA0":e+=" float w2_"+this.getId()+" = originalColor .a;\n";break;case"ALPHA1":e+=" float w2_"+this.getId()+" = blendColor_ "+this.getId()+" .a;\n";break;case"ONE_MINUS_ALPHA0":e+=" float w2_"+this.getId()+" = 1.0 - originalColor .a;\n";break;case"ONE_MINUS_ALPHA1":e+=" float w2_"+this.getId()+" = 1.0 - blendColor_ "+this.getId()+" .a;\n";break;case"TABLE":this.weightTransferFunction2Node?e+=" float w2_"+this.getId()+" = texture (weightTransferFunction2_"+this.getId()+", vec2 (originalColor .a, blendColor_"+this.getId()+" .a)) .r;\n":e+=" float w2_"+this.getId()+" = weightConstant2_"+this.getId()+";\n"}return e+="\n",e+=" return clamp (originalColor * w1_"+this.getId()+" + blendColor_"+this.getId()+" * w2_"+this.getId()+", 0.0, 1.0);\n",e+="}\n",e},getFunctionsText(){if(!this._enabled.getValue())return"";if(!this.voxelsNode)return"";let e="";return e+="\n",e+=" // BlendedVolumeStyle\n",e+="\n",e+=" textureColor = getBlendedStyle_"+this.getId()+" (textureColor, texCoord);\n",e}}),Object.defineProperties(A,{..._().getStaticProperties("BlendedVolumeStyle","VolumeRendering",3,"renderStyle","3.3"),fieldDefinitions:{value:new(p())([new(h())(m().inputOutput,"metadata",new(l().SFNode)),new(h())(m().inputOutput,"enabled",new(l().SFBool)(!0)),new(h())(m().inputOutput,"weightConstant1",new(l().SFFloat)(.5)),new(h())(m().inputOutput,"weightConstant2",new(l().SFFloat)(.5)),new(h())(m().inputOutput,"weightFunction1",new(l().SFString)("CONSTANT")),new(h())(m().inputOutput,"weightFunction2",new(l().SFString)("CONSTANT")),new(h())(m().inputOutput,"weightTransferFunction1",new(l().SFNode)),new(h())(m().inputOutput,"weightTransferFunction2",new(l().SFNode)),new(h())(m().inputOutput,"renderStyle",new(l().SFNode)),new(h())(m().inputOutput,"voxels",new(l().SFNode))]),enumerable:!0}});const B=A,j=N().add("BlendedVolumeStyle",B);function X(e){C.call(this,e),this.addType(m().BoundaryEnhancementVolumeStyle)}Object.assign(Object.setPrototypeOf(X.prototype,C.prototype),{addShaderFields(e){this._enabled.getValue()&&(e.addUserDefinedField(m().inputOutput,"retainedOpacity_"+this.getId(),this._retainedOpacity.copy()),e.addUserDefinedField(m().inputOutput,"boundaryOpacity_"+this.getId(),this._boundaryOpacity.copy()),e.addUserDefinedField(m().inputOutput,"opacityFactor_"+this.getId(),this._opacityFactor.copy()))},getUniformsText(){if(!this._enabled.getValue())return"";let e="";return e+="\n",e+="// BoundaryEnhancementVolumeStyle\n",e+="\n",e+="uniform float retainedOpacity_"+this.getId()+";\n",e+="uniform float boundaryOpacity_"+this.getId()+";\n",e+="uniform float opacityFactor_"+this.getId()+";\n",e+="\n",e+="vec4\n",e+="getBoundaryEnhancementStyle_"+this.getId()+" (in vec4 originalColor, in vec3 texCoord)\n",e+="{\n",e+=" float f0 = texture (x3d_Texture3D [0], texCoord) .r;\n",e+=" float f1 = texture (x3d_Texture3D [0], texCoord + vec3 (0.0, 0.0, 1.0 / float (textureSize (x3d_Texture3D [0], 0) .z))) .r;\n",e+=" float f = abs (f0 - f1);\n",e+="\n",e+=" float retainedOpacity = retainedOpacity_"+this.getId()+";\n",e+=" float boundaryOpacity = boundaryOpacity_"+this.getId()+";\n",e+=" float opacityFactor = opacityFactor_"+this.getId()+";\n",e+="\n",e+=" return vec4 (originalColor .rgb, originalColor .a * (retainedOpacity + boundaryOpacity * pow (f, opacityFactor)));\n",e+="}\n",e},getFunctionsText(){if(!this._enabled.getValue())return"";let e="";return e+="\n",e+=" // BoundaryEnhancementVolumeStyle\n",e+="\n",e+=" textureColor = getBoundaryEnhancementStyle_"+this.getId()+" (textureColor, texCoord);\n",e}}),Object.defineProperties(X,{..._().getStaticProperties("BoundaryEnhancementVolumeStyle","VolumeRendering",2,"renderStyle","3.3"),fieldDefinitions:{value:new(p())([new(h())(m().inputOutput,"metadata",new(l().SFNode)),new(h())(m().inputOutput,"enabled",new(l().SFBool)(!0)),new(h())(m().inputOutput,"retainedOpacity",new(l().SFFloat)(.2)),new(h())(m().inputOutput,"boundaryOpacity",new(l().SFFloat)(.9)),new(h())(m().inputOutput,"opacityFactor",new(l().SFFloat)(2))]),enumerable:!0}});const z=X,G=N().add("BoundaryEnhancementVolumeStyle",z);function H(e){C.call(this,e),this.addType(m().CartoonVolumeStyle)}Object.assign(Object.setPrototypeOf(H.prototype,C.prototype),{initialize(){C.prototype.initialize.call(this),this._surfaceNormals.addInterest("set_surfaceNormals__",this),this.set_surfaceNormals__()},set_surfaceNormals__(){this.surfaceNormalsNode=D()(m().X3DTexture3DNode,this._surfaceNormals)},addShaderFields(e){this._enabled.getValue()&&(e.addUserDefinedField(m().inputOutput,"colorSteps_"+this.getId(),this._colorSteps.copy()),e.addUserDefinedField(m().inputOutput,"orthogonalColor_"+this.getId(),this._orthogonalColor.copy()),e.addUserDefinedField(m().inputOutput,"parallelColor_"+this.getId(),this._parallelColor.copy()),this.surfaceNormalsNode&&e.addUserDefinedField(m().inputOutput,"surfaceNormals_"+this.getId(),new(l().SFNode)(this.surfaceNormalsNode)))},getDefines(e){e.add("#define X3D_HSV")},getUniformsText(){if(!this._enabled.getValue())return"";let e="";return e+="\n",e+="// CartoonVolumeStyle\n",e+="\n",e+="uniform int colorSteps_"+this.getId()+";\n",e+="uniform vec4 orthogonalColor_"+this.getId()+";\n",e+="uniform vec4 parallelColor_"+this.getId()+";\n",e+=this.getNormalText(this.surfaceNormalsNode),e+="\n",e+="vec4\n",e+="getCartoonStyle_"+this.getId()+" (in vec4 originalColor, vec3 texCoord)\n",e+="{\n",e+=" vec4 surfaceNormal = getNormal_"+this.getId()+" (texCoord);\n",e+="\n",e+=" if (surfaceNormal .w == 0.0)\n",e+=" return vec4 (0.0);\n",e+="\n",e+=" vec4 orthogonalColor = orthogonalColor_"+this.getId()+";\n",e+=" vec4 parallelColor = parallelColor_"+this.getId()+";\n",e+=" int colorSteps = colorSteps_"+this.getId()+";\n",e+="\n",e+=" float steps = clamp (float (colorSteps), 1.0, 64.0);\n",e+=" float step = M_PI / 2.0 / steps;\n",e+=" float cosTheta = min (dot (surfaceNormal .xyz, normalize (vertex)), 1.0);\n",e+="\n",e+=" if (cosTheta < 0.0)\n",e+=" return vec4 (0.0);\n",e+="\n",e+=" float t = cos (min (floor (acos (cosTheta) / step) * (steps > 1.0 ? steps / (steps - 1.0) : 1.0), steps) * step);\n",e+=" vec3 orthogonalHSV = rgb2hsv (orthogonalColor .rgb);\n",e+=" vec3 parallelHSV = rgb2hsv (parallelColor .rgb);\n",e+="\n",e+=" return vec4 (hsv2rgb (mix_hsv (orthogonalHSV, parallelHSV, t)), originalColor .a);\n",e+="}\n",e},getFunctionsText(){if(!this._enabled.getValue())return"";let e="";return e+="\n",e+=" // CartoonVolumeStyle\n",e+="\n",e+=" textureColor = getCartoonStyle_"+this.getId()+" (textureColor, texCoord);\n",e}}),Object.defineProperties(H,{..._().getStaticProperties("CartoonVolumeStyle","VolumeRendering",3,"renderStyle","3.3"),fieldDefinitions:{value:new(p())([new(h())(m().inputOutput,"metadata",new(l().SFNode)),new(h())(m().inputOutput,"enabled",new(l().SFBool)(!0)),new(h())(m().inputOutput,"colorSteps",new(l().SFInt32)(4)),new(h())(m().inputOutput,"orthogonalColor",new(l().SFColorRGBA)(1,1,1,1)),new(h())(m().inputOutput,"parallelColor",new(l().SFColorRGBA)(0,0,0,1)),new(h())(m().inputOutput,"surfaceNormals",new(l().SFNode))]),enumerable:!0}});const k=H,Y=N().add("CartoonVolumeStyle",k);function Q(e){C.call(this,e),this.addType(m().ComposedVolumeStyle),this.renderStyleNodes=[]}Object.assign(Object.setPrototypeOf(Q.prototype,C.prototype),{initialize(){C.prototype.initialize.call(this),this._renderStyle.addInterest("set_renderStyle__",this),this.set_renderStyle__()},addVolumeData(e){C.prototype.addVolumeData.call(this,e);for(const t of this.renderStyleNodes)t.addVolumeData(e)},removeVolumeData(e){C.prototype.removeVolumeData.call(this,e);for(const t of this.renderStyleNodes)t.removeVolumeData(e)},set_renderStyle__(){const e=this.renderStyleNodes;for(const t of e){t.removeInterest("addNodeEvent",this);for(const e of this.getVolumeData())t.removeVolumeData(e)}e.length=0;for(const t of this._renderStyle){const n=D()(m().X3DComposableVolumeRenderStyleNode,t);n&&e.push(n)}for(const t of e){t.addInterest("addNodeEvent",this);for(const e of this.getVolumeData())t.addVolumeData(e)}},addShaderFields(e){if(this._enabled.getValue())for(const t of this.renderStyleNodes)t.addShaderFields(e)},getDefines(e){for(const t of this.renderStyleNodes)t.getDefines(e)},getUniformsText(){if(!this._enabled.getValue())return"";let e="";for(const t of this.renderStyleNodes)e+=t.getUniformsText();e+="\n",e+="vec4\n",e+="getComposedStyle_"+this.getId()+" (in vec4 textureColor, in vec3 texCoord)\n",e+="{\n";for(const t of this.renderStyleNodes)e+=t.getFunctionsText();return e+="\n",e+=" return textureColor;\n",e+="}\n",e},getFunctionsText(){if(!this._enabled.getValue())return"";let e="";return e+="\n",e+=" // ComposedVolumeStyle\n",e+="\n",e+=" textureColor = getComposedStyle_"+this.getId()+" (textureColor, texCoord);\n",e}}),Object.defineProperties(Q,{..._().getStaticProperties("ComposedVolumeStyle","VolumeRendering",3,"renderStyle","3.3"),fieldDefinitions:{value:new(p())([new(h())(m().inputOutput,"metadata",new(l().SFNode)),new(h())(m().inputOutput,"enabled",new(l().SFBool)(!0)),new(h())(m().inputOutput,"renderStyle",new(l().MFNode))]),enumerable:!0}});const W=Q,q=N().add("ComposedVolumeStyle",W);function K(e){C.call(this,e),this.addType(m().EdgeEnhancementVolumeStyle)}Object.assign(Object.setPrototypeOf(K.prototype,C.prototype),{initialize(){C.prototype.initialize.call(this),this._surfaceNormals.addInterest("set_surfaceNormals__",this),this.set_surfaceNormals__()},set_surfaceNormals__(){this.surfaceNormalsNode=D()(m().X3DTexture3DNode,this._surfaceNormals)},addShaderFields(e){this._enabled.getValue()&&(e.addUserDefinedField(m().inputOutput,"edgeColor_"+this.getId(),this._edgeColor.copy()),e.addUserDefinedField(m().inputOutput,"gradientThreshold_"+this.getId(),this._gradientThreshold.copy()),this.surfaceNormalsNode&&e.addUserDefinedField(m().inputOutput,"surfaceNormals_"+this.getId(),new(l().SFNode)(this.surfaceNormalsNode)))},getUniformsText(){if(!this._enabled.getValue())return"";let e="";return e+="\n",e+="// EdgeEnhancementVolumeStyle\n",e+="\n",e+="uniform vec4 edgeColor_"+this.getId()+";\n",e+="uniform float gradientThreshold_"+this.getId()+";\n",e+=this.getNormalText(this.surfaceNormalsNode),e+="\n",e+="vec4\n",e+="getEdgeEnhacementStyle_"+this.getId()+" (in vec4 originalColor, in vec3 texCoord)\n",e+="{\n",e+=" vec4 surfaceNormal = getNormal_"+this.getId()+" (texCoord);\n",e+="\n",e+=" if (surfaceNormal .w == 0.0)\n",e+=" return vec4 (0.0);\n",e+="\n",e+=" vec4 edgeColor = edgeColor_"+this.getId()+";\n",e+=" float gradientThreshold = gradientThreshold_"+this.getId()+";\n",e+="\n",e+=" float angle = abs (dot (surfaceNormal .xyz, normalize (vertex)));\n",e+="\n",e+=" if (angle >= cos (gradientThreshold))\n",e+=" return originalColor;\n",e+=" else\n",e+=" return vec4 (mix (edgeColor .rgb, originalColor.rgb, angle), originalColor .a);\n",e+="}\n",e},getFunctionsText(){if(!this._enabled.getValue())return"";let e="";return e+="\n",e+=" // EdgeEnhancementVolumeStyle\n",e+="\n",e+=" textureColor = getEdgeEnhacementStyle_"+this.getId()+" (textureColor, texCoord);\n",e}}),Object.defineProperties(K,{..._().getStaticProperties("EdgeEnhancementVolumeStyle","VolumeRendering",2,"renderStyle","3.3"),fieldDefinitions:{value:new(p())([new(h())(m().inputOutput,"metadata",new(l().SFNode)),new(h())(m().inputOutput,"enabled",new(l().SFBool)(!0)),new(h())(m().inputOutput,"edgeColor",new(l().SFColorRGBA)(0,0,0,1)),new(h())(m().inputOutput,"gradientThreshold",new(l().SFFloat)(.4)),new(h())(m().inputOutput,"surfaceNormals",new(l().SFNode))]),enumerable:!0}});const $=K,Z=N().add("EdgeEnhancementVolumeStyle",$),J=e.X3DChildNode;var ee=t.n(J);const te=e.X3DBoundedObject;var ne=t.n(te);const oe=e.TextureQuality;var ie=t.n(oe);const re=e.UnlitMaterial;var se=t.n(re);const ae=N().add("VolumeStyle.vs","#version 300 es\nprecision highp float;precision highp int;uniform mat4 x3d_ProjectionMatrix;uniform mat4 x3d_ModelViewMatrix;uniform mat4 x3d_TextureMatrix[1];\n#if defined(X3D_XR_SESSION)\nuniform mat4 x3d_EyeMatrix;\n#endif\nin vec4 x3d_TexCoord0;in vec4 x3d_Vertex;out vec3 vertex;out vec4 texCoord;\n#if defined(X3D_LOGARITHMIC_DEPTH_BUFFER)\nout float depth;\n#endif\nvoid main(){vec4 position=x3d_ModelViewMatrix*x3d_Vertex;\n#if defined(X3D_XR_SESSION)\nposition=x3d_EyeMatrix*position;\n#endif\nvertex=position.xyz;texCoord=x3d_TextureMatrix[0]*x3d_TexCoord0;gl_Position=x3d_ProjectionMatrix*position;\n#if defined(X3D_LOGARITHMIC_DEPTH_BUFFER)\ndepth=1.+gl_Position.w;\n#endif\n}"),de=N().add("VolumeStyle.fs",'#version 300 es\nprecision highp float;precision highp int;precision highp sampler3D;in vec3 vertex;in vec4 texCoord;\n#if defined(X3D_LOGARITHMIC_DEPTH_BUFFER)\nuniform float x3d_LogarithmicFarFactor1_2;in float depth;\n#endif\nuniform sampler3D x3d_Texture3D[1];uniform mat3 x3d_TextureNormalMatrix;uniform x3d_LightSourceParameters x3d_LightSource[x3d_MaxLights];const float M_PI=3.141592653589793;const float M_SQRT2=1.4142135623730951;const float M_SQRT1_2=.7071067811865476;\n#if defined(X3D_ORDER_INDEPENDENT_TRANSPARENCY)\nlayout(location=0)out vec4 x3d_FragData0;layout(location=1)out vec4 x3d_FragData1;\n#else\nout vec4 x3d_FragColor;\n#endif\n#pragma X3D include "includes/ClipPlanes.glsl"\n#pragma X3D include "includes/Fog.glsl"\n__VOLUME_STYLES_DEFINES__\n#if defined(X3D_HSV)\nvec3 rgb2hsv(in vec3 color){float h=0.;float s=0.;float v=0.;float min=min(min(color.r,color.g),color.b);float max=max(max(color.r,color.g),color.b);v=max;float delta=max-min;if(max!=0.&&delta!=0.){s=delta/max;if(color.r==max)h=(color.g-color.b)/delta;else if(color.g==max)h=2.+(color.b-color.r)/delta;else h=4.+(color.r-color.g)/delta;h*=M_PI/3.;if(h<0.)h+=M_PI*2.;}else s=h=0.;return vec3(h,s,v);}vec3 hsv2rgb(in vec3 hsv){float h=hsv[0];float s=clamp(hsv[1],0.,1.);float v=clamp(hsv[2],0.,1.);if(s==0.){return vec3(v,v,v);}else{float w=(h*(180./M_PI))/60.;float i=floor(w);float f=w-i;float p=v*(1.-s);float q=v*(1.-s*f);float t=v*(1.-s*(1.-f));switch(int(i)% 6){case 0:return vec3(v,t,p);case 1:return vec3(q,v,p);case 2:return vec3(p,v,t);case 3:return vec3(p,q,v);case 4:return vec3(t,p,v);default:return vec3(v,p,q);}}return vec3(0);}vec3 mix_hsv(in vec3 a,in vec3 b,in float t){float ha=a[0];float sa=a[1];float va=a[2];float hb=b[0];float sb=b[1];float vb=b[2];if(sa==0.)ha=hb;if(sb==0.)hb=ha;float range=abs(hb-ha);if(range<=M_PI){float h=ha+t*(hb-ha);float s=sa+t*(sb-sa);float v=va+t*(vb-va);return vec3(h,s,v);}float PI2=M_PI*2.;float step=(PI2-range)*t;float h=ha<hb?ha-step:ha+step;if(h<0.)h+=PI2;else if(h>PI2)h-=PI2;float s=sa+t*(sb-sa);float v=va+t*(vb-va);return vec3(h,s,v);}\n#endif\n#if defined(X3D_PLANE)\nstruct Plane3{vec3 normal;float distanceFromOrigin;};Plane3 plane3(const in vec3 point,const in vec3 normal){return Plane3(normal,dot(normal,point));}vec3 plane3_perpendicular_vector(const in Plane3 plane,const in vec3 point){return plane.normal*(dot(point,plane.normal)-plane.distanceFromOrigin);}\n#endif\n#if defined(X3D_SHADING)\nfloat getSpotFactor(const in float cutOffAngle,const in float beamWidth,const in vec3 L,const in vec3 d){float spotAngle=acos(clamp(dot(-L,d),-1.,1.));if(spotAngle>=cutOffAngle)return 0.;else if(spotAngle<=beamWidth)return 1.;return(spotAngle-cutOffAngle)/(beamWidth-cutOffAngle);}\n#endif\n__VOLUME_STYLES_UNIFORMS__ vec4 getTextureColor(in vec3 texCoord){if(any(greaterThan(abs(texCoord-.5),vec3(.5))))discard;vec4 textureColor=texture(x3d_Texture3D[0],texCoord);__VOLUME_STYLES_FUNCTIONS__ return textureColor;}\n#if defined(X3D_ORDER_INDEPENDENT_TRANSPARENCY)\nfloat weight(const in float z,const in float a){return clamp(pow(min(1.,a*10.)+.01,3.)*1e8*pow(1.-z*.9,3.),1e-2,3e3);}\n#endif\nvoid main(){\n#if defined(X3D_CLIP_PLANES)\nclip();\n#endif\nvec4 finalColor=getTextureColor(texCoord.stp/texCoord.q);\n#if defined(X3D_FOG)\nfinalColor.rgb=getFogColor(finalColor.rgb);\n#endif\n#if defined(X3D_ORDER_INDEPENDENT_TRANSPARENCY)\nfloat a=finalColor.a;float w=weight(gl_FragCoord.z,a);finalColor.rgb*=a;finalColor*=w;x3d_FragData0=vec4(finalColor.rgb,a);x3d_FragData1=vec4(finalColor.a);\n#else\nx3d_FragColor=finalColor;\n#endif\n#if defined(X3D_LOGARITHMIC_DEPTH_BUFFER)\ngl_FragDepth=log2(depth)*x3d_LogarithmicFarFactor1_2;\n#endif\n}');function le(e,t){se().call(this,e),this.volumeDataNode=t,this.volumeShaderNodes=new Map}Object.assign(Object.setPrototypeOf(le.prototype,se().prototype),{getVolumeShaders(){return this.volumeShaderNodes},getShader(e,t){const{renderObject:n,fogNode:o,localObjectsKeys:i}=t;let r="";return r+=n.getRenderKey(),r+=o?.getFogType()??0,r+=".",r+=i.sort().join(""),this.volumeShaderNodes.get(r)??this.createShader(r,e,t)},createShader(e,t,n){const o=this.getBrowser(),i=[],{renderObject:r,fogNode:s,localObjectsKeys:a}=n,d=a.concat(r.getGlobalLightsKeys());switch(o.getRenderingProperty("XRSession")&&i.push("X3D_XR_SESSION"),r.getLogarithmicDepthBuffer()&&i.push("X3D_LOGARITHMIC_DEPTH_BUFFER"),r.getOrderIndependentTransparency()&&i.push("X3D_ORDER_INDEPENDENT_TRANSPARENCY"),s?.getFogType()){case 1:i.push("X3D_FOG","X3D_FOG_LINEAR");break;case 2:i.push("X3D_FOG","X3D_FOG_EXPONENTIAL")}const l=d.reduce((e,t)=>e+(0===t),0),u=d.reduce((e,t)=>e+(1===t),0);l&&(i.push("X3D_CLIP_PLANES"),i.push(`X3D_NUM_CLIP_PLANES ${Math.min(l,o.getMaxClipPlanes())}`)),u&&(i.push("X3D_LIGHTING"),i.push(`X3D_NUM_LIGHTS ${Math.min(u,o.getMaxLights())}`));const h=this.volumeDataNode.createShader(i,ae,de);return this.volumeShaderNodes.set(e,h),h},setShaderUniforms(e,t,n,o){this.volumeDataNode.setShaderUniforms(e,t)}}),Object.defineProperties(le,{typeName:{value:"VolumeMaterial",enumerable:!0},componentInfo:{value:Object.freeze({name:"Shape",level:1}),enumerable:!0},containerField:{value:"material",enumerable:!0},fieldDefinitions:{value:se().fieldDefinitions}});const ue=le,he=N().add("VolumeMaterial",ue),ce=e.Vector3;var pe=t.n(ce);const fe=e.Matrix4;var _e=t.n(fe);function ge(e){ee().call(this,e),ne().call(this,e),this.addType(m().X3DVolumeDataNode),this.setCameraObject(!0),this._dimensions.setUnit("length");const t=this.getBrowser().getPrivateScene();this.groupNode=t.createNode("Group",!1),this.proximitySensorNode=t.createNode("ProximitySensor",!1),this.transformNode=t.createNode("Transform",!1),this.volumeMaterialNode=new he(t,this),this.textureTransformNode=t.createNode("TextureTransform3D",!1),this.appearanceNode=t.createNode("Appearance",!1),this.lowShapeNode=t.createNode("Shape",!1),this.lowGeometryNode=t.createNode("QuadSet",!1),this.lowTextureCoordinateNode=t.createNode("TextureCoordinate3D",!1),this.lowCoordinateNode=t.createNode("Coordinate",!1),this.hiShapeNode=t.createNode("Shape",!1),this.hiGeometryNode=t.createNode("QuadSet",!1),this.hiTextureCoordinateNode=t.createNode("TextureCoordinate3D",!1),this.hiCoordinateNode=t.createNode("Coordinate",!1),this.textureNormalMatrixArray=new Float32Array(9)}Object.assign(Object.setPrototypeOf(ge.prototype,ee().prototype),ne().prototype,{initialize(){ee().prototype.initialize.call(this),ne().prototype.initialize.call(this),this._bboxDisplay.addFieldInterest(this.groupNode._bboxDisplay),this.proximitySensorNode._orientation_changed.addFieldInterest(this.transformNode._rotation),this.proximitySensorNode._orientation_changed.addFieldInterest(this.textureTransformNode._rotation),this.proximitySensorNode._isActive.addInterest("set_active__",this),this.groupNode._children=[this.proximitySensorNode,this.transformNode],this.transformNode._children=[this.lowShapeNode,this.hiShapeNode],this.textureTransformNode._translation=new(l().SFVec3f)(.5,.5,.5),this.textureTransformNode._center=new(l().SFVec3f)(-.5,-.5,-.5),this.appearanceNode._alphaMode="BLEND",this.appearanceNode._material=this.volumeMaterialNode,this.appearanceNode._textureTransform=this.textureTransformNode,this.lowShapeNode._pointerEvents=!1,this.lowShapeNode._castShadow=!1,this.lowShapeNode._visible=!1,this.lowShapeNode._appearance=this.appearanceNode,this.lowShapeNode._geometry=this.lowGeometryNode,this.lowGeometryNode._texCoord=this.lowTextureCoordinateNode,this.lowGeometryNode._coord=this.lowCoordinateNode,this.hiShapeNode._pointerEvents=!1,this.hiShapeNode._castShadow=!1,this.hiShapeNode._visible=!1,this.hiShapeNode._appearance=this.appearanceNode,this.hiShapeNode._geometry=this.hiGeometryNode,this.hiGeometryNode._texCoord=this.hiTextureCoordinateNode,this.hiGeometryNode._coord=this.hiCoordinateNode,this.volumeMaterialNode.setPrivate(!0),this.textureTransformNode.setPrivate(!0),this.appearanceNode.setPrivate(!0),this.lowCoordinateNode.setPrivate(!0),this.lowTextureCoordinateNode.setPrivate(!0),this.lowGeometryNode.setPrivate(!0),this.lowShapeNode.setPrivate(!0),this.hiCoordinateNode.setPrivate(!0),this.hiTextureCoordinateNode.setPrivate(!0),this.hiGeometryNode.setPrivate(!0),this.hiShapeNode.setPrivate(!0),this.transformNode.setPrivate(!0),this.proximitySensorNode.setPrivate(!0),this.groupNode.setPrivate(!0),this.volumeMaterialNode.setup(),this.textureTransformNode.setup(),this.appearanceNode.setup(),this.lowCoordinateNode.setup(),this.lowTextureCoordinateNode.setup(),this.lowGeometryNode.setup(),this.lowShapeNode.setup(),this.hiCoordinateNode.setup(),this.hiTextureCoordinateNode.setup(),this.hiGeometryNode.setup(),this.hiShapeNode.setup(),this.transformNode.setup(),this.proximitySensorNode.setup(),this.groupNode.setup(),this.connectChildNode(this.groupNode),this.getLive().addInterest("set_live__",this,!0),this._dimensions.addInterest("set_dimensions__",this),this.textureTransformNode.addInterest("set_textureTransform__",this),this.set_live__(!1),this.set_dimensions__(),this.set_textureTransform__(),this.set_active__()},getBBox(e,t){return this.isDefaultBBoxSize()?e.set(this._dimensions.getValue(),pe().ZERO):e.set(this._bboxSize.getValue(),this._bboxCenter.getValue())},getAppearance(){return this.appearanceNode},updateShader(){this.volumeMaterialNode.getVolumeShaders().clear()},addShaderUniformNames(e){e.push("x3d_TextureNormalMatrix")},getNumPlanes(e){switch(e){case ie().LOW:return 200;case ie().MEDIUM:return 400;case ie().HIGH:return 600}},getPoints(e){const t=this.getNumPlanes(e),n=this._dimensions.getValue().norm(),o=n/2,i=[];for(let e=0;e<t;++e){const r=e/(t-1)-.5;i.push(o,o,n*r,-o,o,n*r,-o,-o,n*r,o,-o,n*r)}return i},set_live__(e){const t=this.getBrowser(),n=this.isLive()&&t.getBrowserOption("AlwaysUpdateGeometries");this.getLive().getValue()||n?(t.getBrowserOptions()._TextureQuality.addInterest("set_dimensions__",this),t.getBrowserOptions()._QualityWhenMoving.addInterest("set_dimensions__",this),e&&this.set_dimensions__()):(t.getBrowserOptions()._TextureQuality.removeInterest("set_dimensions__",this),t.getBrowserOptions()._QualityWhenMoving.removeInterest("set_dimensions__",this))},set_dimensions__(){const e=this.getBrowser(),t=e.getBrowserOptions().getTextureQuality(),n=e.getBrowserOptions().getQualityWhenMoving()??t;this.proximitySensorNode._size=new(pe())(200*this._dimensions.length()),this.textureTransformNode._scale=this._dimensions.inverse();const o=this.getPoints(t);if(this.hiCoordinateNode._point=o,this.hiTextureCoordinateNode._point=o,n===t)this.lowShapeNode._geometry=this.hiGeometryNode;else{const e=this.getPoints(n);this.lowCoordinateNode._point=e,this.lowTextureCoordinateNode._point=e,this.lowShapeNode._geometry=this.lowGeometryNode}this.set_active__()},set_textureTransform__(){this.textureNormalMatrixArray.set(new(_e())(...this.textureTransformNode.getMatrix()).submatrix.inverse())},set_active__(){const e=this.getBrowser(),t=e.getBrowserOptions().getTextureQuality(),n=e.getBrowserOptions().getQualityWhenMoving()??t,o=this.proximitySensorNode._isActive.getValue()&&t!==n;o?e.sensorEvents().addInterest("update",this):e.sensorEvents().removeInterest("update",this),this.lowShapeNode._visible=!o,this.hiShapeNode._visible=o},update(){const e=this.getBrowser(),t=e.getCurrentSpeed()>0||e.getViewer().isActive();this.lowShapeNode._visible.getValue()!==t&&(this.lowShapeNode._visible=t),this.hiShapeNode._visible.getValue()!==!t&&(this.hiShapeNode._visible=!t)},traverse(e,t){this.groupNode.traverse(e,t)},setShaderUniforms(e,t){e.uniformMatrix3fv(t.x3d_TextureNormalMatrix,!0,this.textureNormalMatrixArray)},dispose(){ne().prototype.dispose.call(this),ee().prototype.dispose.call(this)}}),Object.defineProperties(ge,_().getStaticProperties("X3DVolumeDataNode","VolumeRendering",1));const me=ge,Se=N().add("X3DVolumeDataNode",me),Ne=e.ComposedShader;var ye=t.n(Ne);const xe=e.ShaderPart;var ve=t.n(xe);function we(e){Se.call(this,e),this.addType(m().IsoSurfaceVolumeData),this.renderStyleNodes=[]}Object.assign(Object.setPrototypeOf(we.prototype,Se.prototype),{initialize(){Se.prototype.initialize.call(this),this._gradients.addInterest("set_gradients__",this),this._renderStyle.addInterest("set_renderStyle__",this),this._contourStepSize.addInterest("updateShader",this),this._surfaceValues.addInterest("updateShader",this),this._surfaceTolerance.addInterest("updateShader",this),this._renderStyle.addInterest("updateShader",this),this.set_gradients__(),this.set_renderStyle__(),this.set_voxels__(),this.updateShader()},set_gradients__(){this.gradientsNode=D()(m().X3DTexture3DNode,this._gradients)},set_renderStyle__(){const e=this.renderStyleNodes;for(const t of e)t.removeInterest("updateShader",this),t.removeVolumeData(this);e.length=0;for(const t of this._renderStyle){const n=D()(m().X3DComposableVolumeRenderStyleNode,t);n&&e.push(n)}for(const t of e)t.addInterest("updateShader",this),t.addVolumeData(this)},set_voxels__(){this.voxelsNode=D()(m().X3DTexture3DNode,this._voxels),this.voxelsNode?this.getAppearance()._texture=this._voxels:this.getAppearance()._texture=this.getBrowser().getDefaultVoxels()},createShader(e,t,n){const o=this.getBrowser().getDefaultVolumeStyle(),i=new Set;o.getDefines(i);let r=o.getUniformsText(),s=o.getFunctionsText();r+="\n",r+="uniform float surfaceValues ["+Math.max(this._surfaceValues.length,1)+"];\n",r+="uniform float surfaceTolerance;\n";for(const e of this.renderStyleNodes)e.getDefines(i),r+=e.getUniformsText();if(s+="\n",s+=" // IsoSurfaceVolumeData\n",s+="\n",this.gradientsNode?(r+="\n",r+="uniform sampler3D gradients;\n",s+=" if (length (texture (gradients, texCoord) .xyz * 2.0 - 1.0) < surfaceTolerance)\n",s+=" discard;\n"):(r+="\n",r+="vec4\n",r+="getNormal (in vec3 texCoord)\n",r+="{\n",r+=" vec4 offset = vec4 (1.0 / vec3 (textureSize (x3d_Texture3D [0], 0)), 0.0);\n",r+=" float i0 = texture (x3d_Texture3D [0], texCoord + offset .xww) .r;\n",r+=" float i1 = texture (x3d_Texture3D [0], texCoord - offset .xww) .r;\n",r+=" float i2 = texture (x3d_Texture3D [0], texCoord + offset .wyw) .r;\n",r+=" float i3 = texture (x3d_Texture3D [0], texCoord - offset .wyw) .r;\n",r+=" float i4 = texture (x3d_Texture3D [0], texCoord + offset .wwz) .r;\n",r+=" float i5 = texture (x3d_Texture3D [0], texCoord - offset .wwz) .r;\n",r+=" vec3 n = vec3 (i1 - i0, i3 - i2, i5 - i4);\n",r+="\n",r+=" return vec4 (normalize (x3d_TextureNormalMatrix * n), length (n));\n",r+="}\n",s+=" if (getNormal (texCoord) .w < surfaceTolerance)\n",s+=" discard;\n"),s+="\n",s+=" float intensity = textureColor .r;\n",s+="\n",1===this._surfaceValues.length){const e=Math.abs(this._contourStepSize.getValue());if(0===e)s+=" if (intensity > surfaceValues [0])\n",s+=" {\n",s+=" textureColor = vec4 (vec3 (surfaceValues [0]), 1.0);\n",this.renderStyleNodes.length&&(s+=this.renderStyleNodes[0].getFunctionsText()),s+=" }\n",s+=" else\n",s+=" {\n",s+=" discard;\n",s+=" }\n",s+="\n";else{const t=[];for(let n=this._surfaceValues[0]-e;n>0;n-=e)t.unshift(n);t.push(this._surfaceValues[0]);for(let n=this._surfaceValues[0]+e;n<1;n+=e)t.push(n);s+=" if (false)\n",s+=" { }\n";for(let e=this._surfaceValues.length-1;e>=0;--e)s+=" else if (intensity > "+t[e]+")\n",s+=" {\n",s+=" textureColor = vec4 (vec3 ("+t[e]+"), 1.0);\n",this.renderStyleNodes.length&&(s+=this.renderStyleNodes[0].getFunctionsText()),s+=" }\n";s+=" else\n",s+=" {\n",s+=" discard;\n",s+=" }\n",s+="\n"}}else{s+=" if (false)\n",s+=" { }\n";for(let e=this._surfaceValues.length-1;e>=0;--e){if(s+=" else if (intensity > surfaceValues ["+e+"])\n",s+=" {\n",s+=" textureColor = vec4 (vec3 (surfaceValues ["+e+"]), 1.0);\n",this.renderStyleNodes.length){const t=Math.min(e,this.renderStyleNodes.length-1);s+=this.renderStyleNodes[t].getFunctionsText()}s+=" }\n"}s+=" else\n",s+=" {\n",s+=" discard;\n",s+=" }\n",s+="\n"}n=n.replace("__VOLUME_STYLES_DEFINES__",Array.from(i).join("\n")).replace("__VOLUME_STYLES_UNIFORMS__",r).replace("__VOLUME_STYLES_FUNCTIONS__",s);const a=new(ve())(this.getExecutionContext());a._url.push(encodeURI("data:x-shader/x-vertex,"+t)),a.setPrivate(!0),a.setName("VolumeDataVertexShader"),a.setOptions(e),a.setup();const d=new(ve())(this.getExecutionContext());d._type="FRAGMENT",d._url.push(encodeURI("data:x-shader/x-fragment,"+n)),d.setPrivate(!0),d.setName("VolumeDataFragmentShader"),d.setOptions(e),d.setup();const u=new(ye())(this.getExecutionContext());u._language="GLSL",u._parts.push(a),u._parts.push(d),u.setPrivate(!0),u.setName("VolumeDataShader"),u.addUserDefinedField(m().inputOutput,"surfaceValues",this._surfaceValues.copy()),u.addUserDefinedField(m().inputOutput,"surfaceTolerance",this._surfaceTolerance.copy()),this.gradientsNode&&u.addUserDefinedField(m().inputOutput,"gradients",new(l().SFNode)(this.gradientsNode)),o.addShaderFields(u);for(const e of this.renderStyleNodes)e.addShaderFields(u);const h=[];return this.addShaderUniformNames(h),u.setUniformNames(h),u.setup(),u}}),Object.defineProperties(we,{..._().getStaticProperties("IsoSurfaceVolumeData","VolumeRendering",2,"children","3.3"),fieldDefinitions:{value:new(p())([new(h())(m().inputOutput,"metadata",new(l().SFNode)),new(h())(m().inputOutput,"dimensions",new(l().SFVec3f)(1,1,1)),new(h())(m().inputOutput,"contourStepSize",new(l().SFFloat)),new(h())(m().inputOutput,"surfaceValues",new(l().MFFloat)),new(h())(m().inputOutput,"surfaceTolerance",new(l().SFFloat)),new(h())(m().inputOutput,"visible",new(l().SFBool)(!0)),new(h())(m().inputOutput,"bboxDisplay",new(l().SFBool)),new(h())(m().initializeOnly,"bboxSize",new(l().SFVec3f)(-1,-1,-1)),new(h())(m().initializeOnly,"bboxCenter",new(l().SFVec3f)),new(h())(m().inputOutput,"renderStyle",new(l().MFNode)),new(h())(m().inputOutput,"gradients",new(l().SFNode)),new(h())(m().inputOutput,"voxels",new(l().SFNode))]),enumerable:!0}});const Fe=we,Ce=N().add("IsoSurfaceVolumeData",Fe);function Oe(e){v.call(this,e),this.addType(m().ProjectionVolumeStyle)}Object.assign(Object.setPrototypeOf(Oe.prototype,v.prototype),{addShaderFields(e){this._enabled.getValue()&&e.addUserDefinedField(m().inputOutput,"intensityThreshold_"+this.getId(),this._intensityThreshold.copy())},getDefines(e){e.add("#define X3D_PLANE")},getUniformsText(){if(!this._enabled.getValue())return"";let e="";switch(e+="\n",e+="// ProjectionVolumeStyle\n",e+="\n",e+="uniform float intensityThreshold_"+this.getId()+";\n",e+="\n",e+="vec4\n",e+="getProjectionStyle_"+this.getId()+"(in vec4 originalColor, in vec3 texCoord)\n",e+="{\n",this._type.getValue()){default:case"MAX":case"AVERAGE":e+=" float projectionColor = 0.0;\n";break;case"MIN":e+=" float projectionColor = 1.0;\n"}switch(e+=" const int samples = 16;\n",e+=" vec3 normal = normalize (x3d_TextureNormalMatrix * vec3 (0.0, 0.0, 1.0));\n",e+=" Plane3 plane = plane3 (vec3 (0.5), normal);\n",e+=" vec3 point = texCoord + plane3_perpendicular_vector (plane, texCoord);\n",e+=" vec3 ray = point - normal * M_SQRT1_2;\n",e+=" vec3 step = normal * (M_SQRT2 / float (samples));\n",e+=" bool first = false;\n",e+="\n",e+=" for (int i = 0; i < samples; ++ i, ray += step)\n",e+=" {\n",e+=" if (any (greaterThan (abs (ray - 0.5), vec3 (0.5))))\n",e+=" continue;\n",e+="\n",e+=" float intensity = texture (x3d_Texture3D [0], ray) .r;\n",e+="\n",this._type.getValue()){default:case"MAX":e+=" if (intensity < intensityThreshold_"+this.getId()+")\n",e+=" continue;\n",e+="\n",e+=" if (first && intensityThreshold_"+this.getId()+" > 0.0)\n",e+=" break;\n",e+="\n",e+=" if (intensity <= projectionColor)\n",e+=" {\n",e+=" first = true;\n",e+=" continue;\n",e+=" }\n",e+="\n",e+=" projectionColor = intensity;\n";break;case"MIN":e+=" if (intensity < intensityThreshold_"+this.getId()+")\n",e+=" continue;\n",e+="\n",e+=" if (first && intensityThreshold_"+this.getId()+" > 0.0)\n",e+=" break;\n",e+="\n",e+=" if (intensity >= projectionColor)\n",e+=" {\n",e+=" first = true;\n",e+=" continue;\n",e+=" }\n",e+="\n",e+=" projectionColor = intensity;\n";break;case"AVERAGE":e+=" projectionColor += intensity;\n"}return e+=" }\n",e+="\n","AVERAGE"===this._type.getValue()&&(e+=" projectionColor /= float (samples);\n"),e+=" return vec4 (vec3 (projectionColor), originalColor .a);\n",e+="}\n",e},getFunctionsText(){if(!this._enabled.getValue())return"";let e="";return e+="\n",e+=" // ProjectionVolumeStyle\n",e+="\n",e+=" textureColor = getProjectionStyle_"+this.getId()+" (textureColor, texCoord);\n",e}}),Object.defineProperties(Oe,{..._().getStaticProperties("ProjectionVolumeStyle","VolumeRendering",2,"renderStyle","3.3"),fieldDefinitions:{value:new(p())([new(h())(m().inputOutput,"metadata",new(l().SFNode)),new(h())(m().inputOutput,"enabled",new(l().SFBool)(!0)),new(h())(m().inputOutput,"type",new(l().SFString)("MAX")),new(h())(m().inputOutput,"intensityThreshold",new(l().SFFloat))]),enumerable:!0}});const De=Oe,Ie=N().add("ProjectionVolumeStyle",De);function Te(e){Se.call(this,e),this.addType(m().SegmentedVolumeData),this.renderStyleNodes=[]}Object.assign(Object.setPrototypeOf(Te.prototype,Se.prototype),{initialize(){Se.prototype.initialize.call(this),this._segmentIdentifiers.addInterest("set_segmentIdentifiers__",this),this._renderStyle.addInterest("set_renderStyle__",this),this._segmentEnabled.addInterest("updateShader",this),this._segmentIdentifiers.addInterest("updateShader",this),this._renderStyle.addInterest("updateShader",this),this.set_segmentIdentifiers__(),this.set_renderStyle__(),this.set_voxels__(),this.updateShader()},getSegmentEnabled(e){return!(e<this._segmentEnabled.length)||this._segmentEnabled[e]},set_segmentIdentifiers__(){this.segmentIdentifiersNode=D()(m().X3DTexture3DNode,this._segmentIdentifiers)},set_renderStyle__(){const e=this.renderStyleNodes;for(const t of e)t.removeInterest("updateShader",this),t.removeVolumeData(this);e.length=0;for(const t of this._renderStyle){const n=D()(m().X3DComposableVolumeRenderStyleNode,t);n&&e.push(n)}for(const t of e)t.addInterest("updateShader",this),t.addVolumeData(this)},set_voxels__(){this.voxelsNode=D()(m().X3DTexture3DNode,this._voxels),this.voxelsNode?this.getAppearance()._texture=this._voxels:this.getAppearance()._texture=this.getBrowser().getDefaultVoxels()},createShader(e,t,n){const o=this.getBrowser().getDefaultVolumeStyle(),i=new Set;let r=o.getUniformsText(),s=o.getFunctionsText();if(this.segmentIdentifiersNode?(r+="\n",r+="uniform sampler3D segmentIdentifiers;\n",r+="\n",s+="\n",s+=" int segment = int (texture (segmentIdentifiers, texCoord) .r * 255.0);\n"):s+=" int segment = 0;\n",this.renderStyleNodes.length){s+="\n",s+=" switch (segment)\n",s+=" {\n";for(const[e,t]of this.renderStyleNodes.entries())t.getDefines(i),s+=" case "+e+":\n",s+=" {\n",this.getSegmentEnabled(e)?(r+=t.getUniformsText(),s+=t.getFunctionsText(),s+=" break;\n"):s+=" discard;\n",s+=" }\n";s+=" }\n"}n=n.replace("__VOLUME_STYLES_DEFINES__",Array.from(i).join("\n")).replace("__VOLUME_STYLES_UNIFORMS__",r).replace("__VOLUME_STYLES_FUNCTIONS__",s);const a=new(ve())(this.getExecutionContext());a._url.push(encodeURI("data:x-shader/x-vertex,"+t)),a.setPrivate(!0),a.setName("SegmentedVolumeDataVertexShader"),a.setOptions(e),a.setup();const d=new(ve())(this.getExecutionContext());d._type="FRAGMENT",d._url.push(encodeURI("data:x-shader/x-fragment,"+n)),d.setPrivate(!0),d.setName("SegmentedVolumeDataFragmentShader"),d.setOptions(e),d.setup();const u=new(ye())(this.getExecutionContext());u._language="GLSL",u._parts.push(a),u._parts.push(d),u.setPrivate(!0),u.setName("SegmentedVolumeDataShader"),this.segmentIdentifiersNode&&u.addUserDefinedField(m().inputOutput,"segmentIdentifiers",new(l().SFNode)(this.segmentIdentifiersNode)),o.addShaderFields(u);for(const[e,t]of this.renderStyleNodes.entries())this.getSegmentEnabled(e)&&t.addShaderFields(u);const h=[];return this.addShaderUniformNames(h),u.setUniformNames(h),u.setup(),u}}),Object.defineProperties(Te,{..._().getStaticProperties("SegmentedVolumeData","VolumeRendering",2,"children","3.3"),fieldDefinitions:{value:new(p())([new(h())(m().inputOutput,"metadata",new(l().SFNode)),new(h())(m().inputOutput,"dimensions",new(l().SFVec3f)(1,1,1)),new(h())(m().inputOutput,"segmentEnabled",new(l().MFBool)),new(h())(m().inputOutput,"visible",new(l().SFBool)(!0)),new(h())(m().inputOutput,"bboxDisplay",new(l().SFBool)),new(h())(m().initializeOnly,"bboxSize",new(l().SFVec3f)(-1,-1,-1)),new(h())(m().initializeOnly,"bboxCenter",new(l().SFVec3f)),new(h())(m().inputOutput,"segmentIdentifiers",new(l().SFNode)),new(h())(m().inputOutput,"renderStyle",new(l().MFNode)),new(h())(m().inputOutput,"voxels",new(l().SFNode))]),enumerable:!0}});const be=Te,Ve=N().add("SegmentedVolumeData",be);function Pe(e){C.call(this,e),this.addType(m().ShadedVolumeStyle)}Object.assign(Object.setPrototypeOf(Pe.prototype,C.prototype),{initialize(){C.prototype.initialize.call(this),this._material.addInterest("set_material__",this),this._surfaceNormals.addInterest("set_surfaceNormals__",this),this.set_material__(),this.set_surfaceNormals__()},set_material__(){this.materialNode&&this.materialNode.removeInterest("addNodeEvent",this),this.materialNode=D()(m().X3DMaterialNode,this._material),this.materialNode&&this.materialNode.addInterest("addNodeEvent",this)},set_surfaceNormals__(){this.surfaceNormalsNode=D()(m().X3DTexture3DNode,this._surfaceNormals)},addShaderFields(e){this._enabled.getValue()&&(this.materialNode&&(e.addUserDefinedField(m().inputOutput,"ambientIntensity_"+this.getId(),this.materialNode._ambientIntensity.copy()),e.addUserDefinedField(m().inputOutput,"diffuseColor_"+this.getId(),this.materialNode._diffuseColor.copy()),e.addUserDefinedField(m().inputOutput,"specularColor_"+this.getId(),this.materialNode._specularColor.copy()),e.addUserDefinedField(m().inputOutput,"emissiveColor_"+this.getId(),this.materialNode._emissiveColor.copy()),e.addUserDefinedField(m().inputOutput,"shininess_"+this.getId(),this.materialNode._shininess.copy()),e.addUserDefinedField(m().inputOutput,"transparency_"+this.getId(),this.materialNode._transparency.copy())),this.surfaceNormalsNode&&e.addUserDefinedField(m().inputOutput,"surfaceNormals_"+this.getId(),new(l().SFNode)(this.surfaceNormalsNode)))},getDefines(e){e.add("#define X3D_SHADING")},getUniformsText(){if(!this._enabled.getValue())return"";let e="";return e+="\n",e+="// ShadedVolumeStyle\n",e+="\n",e+="uniform float ambientIntensity_"+this.getId()+";\n",e+="uniform vec3 diffuseColor_"+this.getId()+";\n",e+="uniform vec3 specularColor_"+this.getId()+";\n",e+="uniform vec3 emissiveColor_"+this.getId()+";\n",e+="uniform float shininess_"+this.getId()+";\n",e+="uniform float transparency_"+this.getId()+";\n",e+=this.getNormalText(this.surfaceNormalsNode),e+="\n",e+="vec4\n",e+="getShadedStyle_"+this.getId()+" (in vec4 originalColor, in vec3 texCoord)\n",e+="{\n",e+=" vec4 surfaceNormal = getNormal_"+this.getId()+" (texCoord);\n",e+="\n",e+=" if (surfaceNormal .w == 0.0)\n",e+=" return vec4 (0.0);\n",e+="\n",e+=" vec4 shadedColor = vec4 (0.0);\n",this._lighting.getValue()?(this.materialNode?(e+=" vec3 diffuseFactor = diffuseColor_"+this.getId()+";\n",e+=" vec3 ambientTerm = diffuseFactor * ambientIntensity_"+this.getId()+";\n",e+="\n",e+=" shadedColor .a = originalColor .a * (1.0 - transparency_"+this.getId()+");\n"):(e+=" vec3 diffuseFactor = originalColor .rgb;\n",e+=" vec3 ambientTerm = vec3 (0.0);\n",e+="\n",e+=" shadedColor .a = originalColor .a;\n"),e+="\n",e+=" vec3 N = surfaceNormal .xyz;\n",e+=" vec3 V = normalize (-vertex); // normalized vector from point on geometry to viewer's position\n",e+="\n",e+=" for (int i = 0; i < X3D_NUM_LIGHTS; ++ i)\n",e+=" {\n",e+=" x3d_LightSourceParameters light = x3d_LightSource [i];\n",e+="\n",e+=" vec3 vL = light .location - vertex; // Light to fragment\n",e+=" float dL = length (light .matrix * vL);\n",e+=" bool di = light .type == x3d_DirectionalLight;\n",e+="\n",e+=" if (di || dL <= light .radius)\n",e+=" {\n",e+=" vec3 d = light .direction;\n",e+=" vec3 c = light .attenuation;\n",e+=" vec3 L = di ? -d : normalize (vL); // Normalized vector from point on geometry to light source i position.\n",e+=" vec3 H = normalize (L + V); // Specular term\n",e+="\n",e+=" float lightAngle = max (dot (N, L), 0.0); // Angle between normal and light ray.\n",e+=" vec3 diffuseTerm = diffuseFactor * lightAngle;\n",e+=" float specularFactor = shininess_"+this.getId()+" > 0.0 ? pow (max (dot (N, H), 0.0), shininess_"+this.getId()+" * 128.0) : 1.0;\n",e+=" vec3 specularTerm = light .intensity * specularColor_"+this.getId()+" * specularFactor;\n",e+="\n",e+=" float attenuationFactor = di ? 1.0 : 1.0 / max (dot (c, vec3 (1.0, dL, dL * dL)), 1.0);\n",e+=" float spotFactor = light .type == x3d_SpotLight ? getSpotFactor (light .cutOffAngle, light .beamWidth, L, d) : 1.0;\n",e+=" float attenuationSpotFactor = attenuationFactor * spotFactor;\n",e+=" vec3 ambientColor = light .ambientIntensity * ambientTerm;\n",e+=" vec3 diffuseSpecularColor = light .intensity * (diffuseTerm + specularTerm);\n",e+="\n",e+=" shadedColor .rgb += attenuationSpotFactor * light .color * (ambientColor + diffuseSpecularColor);\n",e+=" }\n",e+="\n",e+=" shadedColor .rgb += emissiveColor_"+this.getId()+";\n",e+=" }\n"):this.materialNode?(e+=" shadedColor .rgb = diffuseColor_"+this.getId()+";\n",e+=" shadedColor .a = originalColor .a * (1.0 - transparency_"+this.getId()+");\n"):e+=" shadedColor = originalColor;\n",e+="\n",e+=" return shadedColor;\n",e+="}\n",e},getFunctionsText(){if(!this._enabled.getValue())return"";let e="";return e+="\n",e+=" // ShadedVolumeStyle\n",e+="\n",e+=" textureColor = getShadedStyle_"+this.getId()+" (textureColor, texCoord);\n",e}}),Object.defineProperties(Pe,{..._().getStaticProperties("ShadedVolumeStyle","VolumeRendering",3,"renderStyle","3.3"),fieldDefinitions:{value:new(p())([new(h())(m().inputOutput,"metadata",new(l().SFNode)),new(h())(m().inputOutput,"enabled",new(l().SFBool)(!0)),new(h())(m().inputOutput,"lighting",new(l().SFBool)),new(h())(m().inputOutput,"shadows",new(l().SFBool)),new(h())(m().initializeOnly,"phaseFunction",new(l().SFString)("Henyey-Greenstein")),new(h())(m().inputOutput,"material",new(l().SFNode)),new(h())(m().inputOutput,"surfaceNormals",new(l().SFNode))]),enumerable:!0}});const Ee=Pe,Me=N().add("ShadedVolumeStyle",Ee);function Ue(e){C.call(this,e),this.addType(m().SilhouetteEnhancementVolumeStyle)}Object.assign(Object.setPrototypeOf(Ue.prototype,C.prototype),{initialize(){C.prototype.initialize.call(this),this._surfaceNormals.addInterest("set_surfaceNormals__",this),this.set_surfaceNormals__()},set_surfaceNormals__(){this.surfaceNormalsNode=D()(m().X3DTexture3DNode,this._surfaceNormals)},addShaderFields(e){this._enabled.getValue()&&(e.addUserDefinedField(m().inputOutput,"silhouetteRetainedOpacity_"+this.getId(),this._silhouetteRetainedOpacity.copy()),e.addUserDefinedField(m().inputOutput,"silhouetteBoundaryOpacity_"+this.getId(),this._silhouetteBoundaryOpacity.copy()),e.addUserDefinedField(m().inputOutput,"silhouetteSharpness_"+this.getId(),this._silhouetteSharpness.copy()),this.surfaceNormalsNode&&e.addUserDefinedField(m().inputOutput,"surfaceNormals_"+this.getId(),new(l().SFNode)(this.surfaceNormalsNode)))},getUniformsText(){if(!this._enabled.getValue())return"";let e="";return e+="\n",e+="// SilhouetteEnhancementVolumeStyle\n",e+="\n",e+="uniform float silhouetteRetainedOpacity_"+this.getId()+";\n",e+="uniform float silhouetteBoundaryOpacity_"+this.getId()+";\n",e+="uniform float silhouetteSharpness_"+this.getId()+";\n",e+=this.getNormalText(this.surfaceNormalsNode),e+="\n",e+="vec4\n",e+="getSilhouetteEnhancementStyle_"+this.getId()+" (in vec4 originalColor, in vec3 texCoord)\n",e+="{\n",e+=" vec4 surfaceNormal = getNormal_"+this.getId()+" (texCoord);\n",e+="\n",e+=" if (surfaceNormal .w == 0.0)\n",e+=" return vec4 (0.0);\n",e+=" \n",e+=" float silhouetteRetainedOpacity = silhouetteRetainedOpacity_"+this.getId()+";\n",e+=" float silhouetteBoundaryOpacity = silhouetteBoundaryOpacity_"+this.getId()+";\n",e+=" float silhouetteSharpness = silhouetteSharpness_"+this.getId()+";\n",e+="\n",e+=" return vec4 (originalColor .rgb, originalColor .a * (silhouetteRetainedOpacity + silhouetteBoundaryOpacity * pow (1.0 - abs (dot (surfaceNormal .xyz, normalize (vertex))), silhouetteSharpness)));\n",e+="}\n",e},getFunctionsText(){if(!this._enabled.getValue())return"";let e="";return e+="\n",e+=" // SilhouetteEnhancementVolumeStyle\n",e+="\n",e+=" textureColor = getSilhouetteEnhancementStyle_"+this.getId()+" (textureColor, texCoord);\n",e}}),Object.defineProperties(Ue,{..._().getStaticProperties("SilhouetteEnhancementVolumeStyle","VolumeRendering",2,"renderStyle","3.3"),fieldDefinitions:{value:new(p())([new(h())(m().inputOutput,"metadata",new(l().SFNode)),new(h())(m().inputOutput,"enabled",new(l().SFBool)(!0)),new(h())(m().inputOutput,"silhouetteRetainedOpacity",new(l().SFFloat)(1)),new(h())(m().inputOutput,"silhouetteBoundaryOpacity",new(l().SFFloat)),new(h())(m().inputOutput,"silhouetteSharpness",new(l().SFFloat)(.5)),new(h())(m().inputOutput,"surfaceNormals",new(l().SFNode))]),enumerable:!0}});const Le=Ue,Re=N().add("SilhouetteEnhancementVolumeStyle",Le);function Ae(e){C.call(this,e),this.addType(m().ToneMappedVolumeStyle)}Object.assign(Object.setPrototypeOf(Ae.prototype,C.prototype),{initialize(){C.prototype.initialize.call(this),this._surfaceNormals.addInterest("set_surfaceNormals__",this),this.set_surfaceNormals__()},set_surfaceNormals__(){this.surfaceNormalsNode=D()(m().X3DTexture3DNode,this._surfaceNormals)},addShaderFields(e){this._enabled.getValue()&&(e.addUserDefinedField(m().inputOutput,"coolColor_"+this.getId(),this._coolColor.copy()),e.addUserDefinedField(m().inputOutput,"warmColor_"+this.getId(),this._warmColor.copy()),this.surfaceNormalsNode&&e.addUserDefinedField(m().inputOutput,"surfaceNormals_"+this.getId(),new(l().SFNode)(this.surfaceNormalsNode)))},getUniformsText(){if(!this._enabled.getValue())return"";let e="";return e+="\n",e+="// ToneMappedVolumeStyle\n",e+="\n",e+="uniform vec4 coolColor_"+this.getId()+";\n",e+="uniform vec4 warmColor_"+this.getId()+";\n",e+=this.getNormalText(this.surfaceNormalsNode),e+="\n",e+="vec4\n",e+="getToneMappedStyle_"+this.getId()+" (in vec4 originalColor, in vec3 texCoord)\n",e+="{\n",e+=" vec4 surfaceNormal = getNormal_"+this.getId()+" (texCoord);\n",e+="\n",e+=" if (surfaceNormal .w == 0.0)\n",e+=" return vec4 (0.0);\n",e+="\n",e+=" vec3 toneColor = vec3 (0.0);\n",e+=" vec3 coolColor = coolColor_"+this.getId()+" .rgb;\n",e+=" vec3 warmColor = warmColor_"+this.getId()+" .rgb;\n",e+="\n",e+=" for (int i = 0; i < X3D_NUM_LIGHTS; ++ i)\n",e+=" {\n",e+=" x3d_LightSourceParameters light = x3d_LightSource [i];\n",e+="\n",e+=" vec3 L = light .type == x3d_DirectionalLight ? -light .direction : normalize (light .location - vertex);\n",e+=" float colorFactor = dot (L, surfaceNormal .xyz) * 0.5 + 0.5;\n",e+="\n",e+=" toneColor += mix (warmColor .rgb, coolColor .rgb, colorFactor);\n",e+=" }\n",e+="\n",e+=" return vec4 (toneColor, originalColor .a);\n",e+="}\n",e},getFunctionsText(){if(!this._enabled.getValue())return"";let e="";return e+="\n",e+=" // ToneMappedVolumeStyle\n",e+="\n",e+=" textureColor = getToneMappedStyle_"+this.getId()+" (textureColor, texCoord);\n",e}}),Object.defineProperties(Ae,{..._().getStaticProperties("ToneMappedVolumeStyle","VolumeRendering",2,"renderStyle","3.3"),fieldDefinitions:{value:new(p())([new(h())(m().inputOutput,"metadata",new(l().SFNode)),new(h())(m().inputOutput,"enabled",new(l().SFBool)(!0)),new(h())(m().inputOutput,"coolColor",new(l().SFColorRGBA)(0,0,1,0)),new(h())(m().inputOutput,"warmColor",new(l().SFColorRGBA)(1,1,0,0)),new(h())(m().inputOutput,"surfaceNormals",new(l().SFNode))]),enumerable:!0}});const Be=Ae,je=N().add("ToneMappedVolumeStyle",Be);function Xe(e){Se.call(this,e),this.addType(m().VolumeData)}Object.assign(Object.setPrototypeOf(Xe.prototype,Se.prototype),{initialize(){Se.prototype.initialize.call(this),this._renderStyle.addInterest("set_renderStyle__",this),this._voxels.addInterest("set_voxels__",this),this._renderStyle.addInterest("updateShader",this),this.set_renderStyle__(),this.set_voxels__(),this.updateShader()},set_renderStyle__(){this.renderStyleNode&&(this.renderStyleNode.removeInterest("updateShader",this),this.renderStyleNode.removeVolumeData(this)),this.renderStyleNode=D()(m().X3DVolumeRenderStyleNode,this._renderStyle),this.renderStyleNode&&(this.renderStyleNode.addInterest("updateShader",this),this.renderStyleNode.addVolumeData(this))},set_voxels__(){this.voxelsNode=D()(m().X3DTexture3DNode,this._voxels),this.voxelsNode?this.getAppearance()._texture=this._voxels:this.getAppearance()._texture=this.getBrowser().getDefaultVoxels()},createShader(e,t,n){const o=this.getBrowser().getDefaultVolumeStyle(),i=new Set;o.getDefines(i);let r=o.getUniformsText(),s=o.getFunctionsText();this.renderStyleNode&&(this.renderStyleNode.getDefines(i),r+=this.renderStyleNode.getUniformsText(),s+=this.renderStyleNode.getFunctionsText()),n=n.replace("__VOLUME_STYLES_DEFINES__",Array.from(i).join("\n")).replace("__VOLUME_STYLES_UNIFORMS__",r).replace("__VOLUME_STYLES_FUNCTIONS__",s);const a=new(ve())(this.getExecutionContext());a._url.push(encodeURI("data:x-shader/x-vertex,"+t)),a.setPrivate(!0),a.setName("VolumeDataVertexShader"),a.setOptions(e),a.setup();const d=new(ve())(this.getExecutionContext());d._type="FRAGMENT",d._url.push(encodeURI("data:x-shader/x-fragment,"+n)),d.setPrivate(!0),d.setName("VolumeDataFragmentShader"),d.setOptions(e),d.setup();const l=new(ye())(this.getExecutionContext());l._language="GLSL",l._parts.push(a),l._parts.push(d),l.setPrivate(!0),l.setName("VolumeDataShader"),o.addShaderFields(l),this.renderStyleNode?.addShaderFields(l);const u=[];return this.addShaderUniformNames(u),l.setUniformNames(u),l.setup(),l}}),Object.defineProperties(Xe,{..._().getStaticProperties("VolumeData","VolumeRendering",1,"children","3.3"),fieldDefinitions:{value:new(p())([new(h())(m().inputOutput,"metadata",new(l().SFNode)),new(h())(m().inputOutput,"dimensions",new(l().SFVec3f)(1,1,1)),new(h())(m().inputOutput,"visible",new(l().SFBool)(!0)),new(h())(m().inputOutput,"bboxDisplay",new(l().SFBool)),new(h())(m().initializeOnly,"bboxSize",new(l().SFVec3f)(-1,-1,-1)),new(h())(m().initializeOnly,"bboxCenter",new(l().SFVec3f)),new(h())(m().inputOutput,"renderStyle",new(l().SFNode)),new(h())(m().inputOutput,"voxels",new(l().SFNode))]),enumerable:!0}});const ze=Xe,Ge=N().add("VolumeData",ze);o().add({name:"VolumeRendering",concreteNodes:[j,G,Y,q,Z,Ce,b,Ie,Ve,Me,Re,je,Ge],abstractNodes:[C,Se,v],browserContext:R});N().add("VolumeRenderingComponent",undefined)})();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/* X_ITE v12.1.
|
|
2
|
-
const __X_ITE_X3D__ = window [Symbol .for ("X_ITE.X3D-12.1.
|
|
1
|
+
/* X_ITE v12.1.5 */
|
|
2
|
+
const __X_ITE_X3D__ = window [Symbol .for ("X_ITE.X3D-12.1.5")];
|
|
3
3
|
/******/ (() => { // webpackBootstrap
|
|
4
4
|
/******/ "use strict";
|
|
5
5
|
/******/ var __webpack_modules__ = ({
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* X_ITE v12.1.
|
|
2
|
-
const t=window[Symbol.for("X_ITE.X3D-12.1.3")];(()=>{var e={254:e=>{e.exports=t.jquery}},i={};function s(t){var r=i[t];if(void 0!==r)return r.exports;var n=i[t]={exports:{}};return e[t](n,n.exports,s),n.exports}s.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return s.d(e,{a:e}),e},s.d=(t,e)=>{for(var i in e)s.o(e,i)&&!s.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},s.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);const r=t.Components;var n=s.n(r);const a=t.ScreenLine;var o=s.n(a);const c=t.GeometryContext;var h=s.n(c);const d=t.AlphaMode;var l=s.n(d);const p=t.VertexArray;var u=s.n(p);const x=t.Layer;var m=s.n(x);const f=t.Matrix4;var g=s.n(f);const w=t.Namespace;var b=s.n(w);function v(t){const e=t.getContext();this.browser=t,this.vertexArrayObject=new(u())(e),this.circleVertexBuffer=e.createBuffer(),this.circleGeometryContext=new(h())({renderObject:new(m())(t.getPrivateScene()),alphaMode:l().BLEND,geometryType:1}),this.circleGeometryContext.renderObject.setup();const i=t.getCircle2DOptions().getGeometry().getVertices();this.circleNumVertices=i.length/4,e.bindBuffer(e.ARRAY_BUFFER,this.circleVertexBuffer),e.bufferData(e.ARRAY_BUFFER,i.getValue(),e.STATIC_DRAW),this.diskVertexBuffer=e.createBuffer(),this.diskGeometryContext=new(h())({renderObject:this.circleGeometryContext.renderObject,alphaMode:l().BLEND,geometryType:3});const s=t.getDisk2DOptions().getDiskVertices();this.diskNumVertices=s.length/4,e.bindBuffer(e.ARRAY_BUFFER,this.diskVertexBuffer),e.bufferData(e.ARRAY_BUFFER,s.getValue(),e.STATIC_DRAW)}Object.assign(v.prototype,{display:(()=>{const t=new Float32Array(g().IDENTITY),e=new Float32Array(g().IDENTITY),i=new Float32Array(g().IDENTITY),s=new(g()),r=[];return function(n,a,o,c,h,d,l){const p=this.browser,u=p.getContext(),x=p.getViewport();l.bind(),u.viewport(...x),u.scissor(...x),u.blendFuncSeparate(u.SRC_ALPHA,u.ONE_MINUS_SRC_ALPHA,u.ONE,u.ONE_MINUS_SRC_ALPHA);const m=n*Math.abs(h.origin.z),f=h.X_AXIS.normalize().multiply(m),g=h.Y_AXIS.normalize().multiply(m),w=h.Z_AXIS.normalize().multiply(m);s.set(...f,0,...g,0,...w,0,...h.origin,1),t.set(d),e.set(s),u.depthMask(!1),u.disable(u.DEPTH_TEST),u.enable(u.BLEND),u.disable(u.CULL_FACE);{const s=p.getDefaultMaterial().getShader(this.circleGeometryContext);s.enable(u),s.setClipPlanes(u,r),u.uniformMatrix4fv(s.x3d_ProjectionMatrix,!1,t),u.uniformMatrix4fv(s.x3d_ModelViewMatrix,!1,e),u.uniformMatrix4fv(s.x3d_EyeMatrix,!1,i),u.uniform3f(s.x3d_EmissiveColor,0,0,0),u.uniform1f(s.x3d_Transparency,c),this.vertexArrayObject.enable(s.getProgram())&&s.enableVertexAttribute(u,this.circleVertexBuffer,0,0),u.drawArrays(u.LINES,0,this.circleNumVertices)}{const s=p.getDefaultMaterial().getShader(this.diskGeometryContext);s.enable(u),s.setClipPlanes(u,r),u.uniformMatrix4fv(s.x3d_ProjectionMatrix,!1,t),u.uniformMatrix4fv(s.x3d_ModelViewMatrix,!1,e),u.uniformMatrix4fv(s.x3d_EyeMatrix,!1,i),u.uniform3f(s.x3d_EmissiveColor,...a),u.uniform1f(s.x3d_Transparency,o),this.vertexArrayObject.enable(s.getProgram())&&s.enableVertexAttribute(u,this.diskVertexBuffer,0,0),u.drawArrays(u.TRIANGLES,0,this.diskNumVertices)}u.depthMask(!0),u.enable(u.DEPTH_TEST),u.disable(u.BLEND)}})(),dispose(){const t=this.browser.getContext();t.deleteBuffer(this.diskVertexBuffer),this.diskVertexArrayObject.dispose(t)}});const S=v,y=b().add("ScreenPoint",S),M=t.ViewVolume;var V=s.n(M);const R=t.Color3;var A=s.n(R);const P=t.Vector3;var C=s.n(P);const E=t.Rotation4;var _=s.n(E);const j=t.Lock;var N=s.n(j);const D=t.ExamineViewer;var B=s.n(D);Object.assign(B().prototype,{gamepads(t){const e=t.find(({axes:t})=>t[2]||t[3]);if(!e)return void(t.action&&(t.action=!1,this.disconnect()));const i=e.buttons[0].pressed,s=e.buttons[1].pressed;t.button0===i&&t.button1===s||(t.button0=i,t.button1=s,this.disconnect());const r=60/this.getBrowser().currentFrameRate;t.action=!0,i?this.zoom(.005*e.axes[3]*r,Math.sign(-e.axes[3])):s?(this.startPan(0,0),this.pan(5*-e.axes[2]*r,5*e.axes[3]*r)):(this.startRotate(0,0,1),this.rotate(10*-e.axes[2]*r,10*e.axes[3]*r))}});const F=t.X3DFlyViewer;var O=s.n(F);const I=new(C())(300);Object.assign(O().prototype,{gamepads:(()=>{const t=new(C());return function(e){const i=e.find(({axes:t})=>t[2]||t[3]);if(!i)return void(this.startTime=Date.now());const s=i.buttons[0].pressed;i.buttons[1].pressed?(t.set(i.axes[2],-i.axes[3],0).multVec(I),this.direction.add(t).divide(2),this.pan()):(t.set(i.axes[2],0,i.axes[3]).multVec(I).multiply(s?2:1),this.direction.add(t).divide(2),this.fly())}})()});const T=t.X3DViewer;var L=s.n(T);Object.assign(L().prototype,{gamepads(){}});var U=s(254);const X=Symbol(),k=Symbol(),H=Symbol(),G=Symbol(),z=Symbol(),W=Symbol(),Y=Symbol(),q=Symbol(),Z=Symbol(),J=Symbol();function K(){this[Z]=[]}Object.assign(K.prototype,{getPose(){return this[G]},xrAddButton(){U("<div></div>").attr("part","xr-button").attr("title","Start WebXR session.").addClass("x_ite-private-xr-button").on("mousedown touchstart",!1).on("mouseup touchend",t=>{t.preventDefault(),t.stopImmediatePropagation(),t.stopPropagation(),this.startAudioElements(),this.getSession()===window?this.xrStartSession():this.xrStopSession()}).appendTo(this.getSurface())},async xrStartSession(){return N().acquire(X,async()=>{if(this.getSession()!==window)return;const t=this.getContext(),e=this.getBrowserOption("XRSessionMode").toLowerCase().replaceAll("_","-"),i=await navigator.xr.requestSession(e),s=await i.requestReferenceSpace("local");await t.makeXRCompatible(),this.finishedEvents().addInterest("xrUpdatePointers",this),i.addEventListener("visibilitychange",()=>this.xrUpdateVisibility()),i.addEventListener("inputsourceschange",t=>this.xrUpdateInputSources(t)),i.addEventListener("end",()=>this.xrStopSession()),this[k]=s,this[z]=!0,this[W]=new Set,this[Y]=new(o())(this,4,2,.9),this[q]=new y(this),Object.assign(this[Z],{action:!0}),this[G]={cameraSpaceMatrix:new(g()),viewMatrix:new(g()),views:[]},this.xrUpdateBaseLayer({},i),this.setSession(i),this.removeHit(this.getHit()),this.getBrowserOptions().checkUpdate(),this.getRenderingProperties()._ContentScale.addInterest("xrContentScale",this),this.getRenderingProperties()._XRSession=!0})},xrStopSession(){return N().acquire(X,async()=>{if(this.getSession()!==window){await this.getSession().end().catch(Function.prototype),this.finishedEvents().removeInterest("xrUpdatePointers",this),this.setSession(window),this.setDefaultFramebuffer(null);for(const{hit:t}of this[W])this.removeHit(t);this[k]=null,this[H]=null,this[G]=null,this[z]=!1,this[W]=null,this[Y]=null,this[q]=null,this[J]=null,this.getBrowserOptions().checkUpdate(),this.getRenderingProperties()._ContentScale.removeInterest("xrContentScale",this),this.getRenderingProperties()._XRSession=!1}})},xrContentScale(){this.xrUpdateBaseLayer()},xrUpdateBaseLayer(t={},e=this.getSession()){if(e===window)return;const i=new XRWebGLLayer(e,this.getContext(),Object.assign({antialias:!1,alpha:!0,depth:!1,ignoreDepthValues:!0,framebufferScaleFactor:this.getRenderingProperty("ContentScale")},t));this[H]=i,e.updateRenderState({baseLayer:i}),this.setDefaultFramebuffer(i.framebuffer)},xrUpdateNearFarPlanes:(()=>{const t={};return function(){const e=this.getActiveNavigationInfo(),i=this.getActiveViewpoint();i?(t.depthNear=i.getNearDistance(e),t.depthFar=i.getFarDistance(e)):(t.depthNear=.1,t.depthFar=1e4),this.getSession().updateRenderState(t)}})(),xrUpdateVisibility(t){switch(this.getSession().visibilityState){case"visible-blurred":case"hidden":this[z]=!1;break;default:this[z]=!0}},xrUpdateInputSources(t){for(const e of t.added)this[W].add(Object.assign(e,{active:!1,matrix:new(g()),inverse:new(g()),hit:Object.assign(this.getHit().copy(),{button:!1,pressed:!1,pulse:!0,poseViewMatrix:new(g()),originalPoint:new(C()),originalNormal:new(C())})})),e.gamepad&&(e.gamepad.hit=e.hit);for(const e of t.removed)this.removeHit(e.hit),this[W].delete(e);this.xrUpdateGamepads()},xrUpdateGamepads(){this[Z].length=0;for(const{gamepad:t}of this[W])t&&(t.axes.length<4||this[Z].push(t))},xrFrame(t){t&&(this[J]=t,this.xrUpdateNearFarPlanes(),this.getViewer().gamepads(this[Z]),this.xrUpdatePose(),this.addBrowserEvent())},xrUpdatePose(){const t=this[J].getViewerPose(this[k]),e=this[G];e.cameraSpaceMatrix.assign(t.transform.matrix),e.viewMatrix.assign(t.transform.inverse.matrix);let i=0;for(const s of t.views){const{x:t,y:r,width:n,height:a}=this[H].getViewport(s);if(!n)continue;this.reshapeFramebuffer(i,t,r,n,a);const o=e.views[i]??={projectionMatrix:new(g()),cameraSpaceMatrix:new(g()),viewMatrix:new(g()),matrix:new(g()),inverse:new(g())};o.projectionMatrix.assign(s.projectionMatrix),o.cameraSpaceMatrix.assign(s.transform.matrix),o.viewMatrix.assign(s.transform.inverse.matrix),o.matrix.assign(e.cameraSpaceMatrix).multRight(o.viewMatrix),o.inverse.assign(o.cameraSpaceMatrix).multRight(e.viewMatrix),++i}this.getFramebuffers().length=i,e.views.length=i},xrUpdatePointers:(()=>{const t=new(A())(.5,.75,1),e=new(g()),i=new(C())(0,0,-.5),s=new(C()),r=new(C()),n=new(C()),a=new(_());return function(){const o=this.getViewport().getValue(),c=this[G];for(const t of this[W]){const{targetRaySpace:e,matrix:i,inverse:s}=t,r=this[J].getPose(e,this[k]);t.active=!!r,r&&(i.assign(r.transform.matrix),s.assign(r.transform.inverse.matrix))}for(const t of this[W]){const{active:i,gamepad:s,matrix:r,hit:n}=t;if(!i)continue;if(this.touch(o[2]/2,o[3]/2,n,t),this.xrSensorHitPulse(n,s),!n.id)continue;const a=c.views[0].projectionMatrix;n.pressed||n.poseViewMatrix.assign(c.viewMatrix),e.assign(r).multRight(n.poseViewMatrix);for(const t of n.sensors.values())t.projectionMatrix.assign(a),t.modelViewMatrix.multRight(e);V().projectPoint(n.point,e,a,o,n.pointer),n.originalPoint.assign(n.point),n.originalNormal.assign(n.normal),n.ray.multLineMatrix(e),e.multVecMatrix(n.point),e.submatrix.inverse().multMatrixVec(n.normal)}for(const{active:t,gamepad:e,hit:i}of this[W]){if(!t)continue;const s=e?.buttons[0];s?.pressed?i.button||(i.button=!0,i.pressed||=this.buttonPressEvent(0,0,i)):(i.button=!1,i.pressed&&(i.pressed=!1,this.buttonReleaseEvent(i))),this.motionNotifyEvent(0,0,i)}if(this[z])for(const[h,{viewMatrix:d,projectionMatrix:l}]of c.views.entries()){const c=this.getFramebuffers()[h];for(const{active:h,gamepad:p,matrix:u,hit:x}of this[W]){if(!h)continue;const m=p?.buttons.some(t=>t.pressed),f=m?t:A().WHITE;if(e.assign(u).multRight(d),e.multVecMatrix(s.assign(C().ZERO)),e.multVecMatrix(r.assign(i)),e.multVecMatrix(n.assign(x.originalPoint)),x.id&&n.distance(s)<r.distance(s)&&r.assign(n),s.z>0||r.z>0)continue;if(V().projectPointMatrix(s,l,o,s),V().projectPointMatrix(r,l,o,r),s.z=0,r.z=0,this[Y].setColor(f).display(s,r,c),!x.id)continue;const g=m?.005:.007;e.assign(u).multRight(d).translate(x.originalPoint).rotate(a.setFromToVec(C().Z_AXIS,x.originalNormal)),this[q].display(g,f,.3,.8,e,l,c)}}}})(),xrSensorHitPulse(t,e){t.sensors.size?t.pulse&&(e?.hapticActuators?.[0]?.pulse(.25,10),t.pulse=!1):t.pulse=!0}});const Q=K,$=b().add("X3DWebXRContext",Q);n().add({name:"WebXR",concreteNodes:[],abstractNodes:[],browserContext:$});b().add("WebXRComponent",undefined)})();
|
|
1
|
+
/* X_ITE v12.1.5 */
|
|
2
|
+
const t=window[Symbol.for("X_ITE.X3D-12.1.5")];(()=>{var e={254:e=>{e.exports=t.jquery}},i={};function s(t){var r=i[t];if(void 0!==r)return r.exports;var n=i[t]={exports:{}};return e[t](n,n.exports,s),n.exports}s.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return s.d(e,{a:e}),e},s.d=(t,e)=>{for(var i in e)s.o(e,i)&&!s.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},s.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);const r=t.Components;var n=s.n(r);const a=t.ScreenLine;var o=s.n(a);const c=t.GeometryContext;var h=s.n(c);const d=t.AlphaMode;var l=s.n(d);const p=t.VertexArray;var u=s.n(p);const x=t.Layer;var m=s.n(x);const f=t.Matrix4;var g=s.n(f);const w=t.Namespace;var b=s.n(w);function v(t){const e=t.getContext();this.browser=t,this.vertexArrayObject=new(u())(e),this.circleVertexBuffer=e.createBuffer(),this.circleGeometryContext=new(h())({renderObject:new(m())(t.getPrivateScene()),alphaMode:l().BLEND,geometryType:1}),this.circleGeometryContext.renderObject.setup();const i=t.getCircle2DOptions().getGeometry().getVertices();this.circleNumVertices=i.length/4,e.bindBuffer(e.ARRAY_BUFFER,this.circleVertexBuffer),e.bufferData(e.ARRAY_BUFFER,i.getValue(),e.STATIC_DRAW),this.diskVertexBuffer=e.createBuffer(),this.diskGeometryContext=new(h())({renderObject:this.circleGeometryContext.renderObject,alphaMode:l().BLEND,geometryType:3});const s=t.getDisk2DOptions().getDiskVertices();this.diskNumVertices=s.length/4,e.bindBuffer(e.ARRAY_BUFFER,this.diskVertexBuffer),e.bufferData(e.ARRAY_BUFFER,s.getValue(),e.STATIC_DRAW)}Object.assign(v.prototype,{display:(()=>{const t=new Float32Array(g().IDENTITY),e=new Float32Array(g().IDENTITY),i=new Float32Array(g().IDENTITY),s=new(g()),r=[];return function(n,a,o,c,h,d,l){const p=this.browser,u=p.getContext(),x=p.getViewport();l.bind(),u.viewport(...x),u.scissor(...x),u.blendFuncSeparate(u.SRC_ALPHA,u.ONE_MINUS_SRC_ALPHA,u.ONE,u.ONE_MINUS_SRC_ALPHA);const m=n*Math.abs(h.origin.z),f=h.X_AXIS.normalize().multiply(m),g=h.Y_AXIS.normalize().multiply(m),w=h.Z_AXIS.normalize().multiply(m);s.set(...f,0,...g,0,...w,0,...h.origin,1),t.set(d),e.set(s),u.depthMask(!1),u.disable(u.DEPTH_TEST),u.enable(u.BLEND),u.disable(u.CULL_FACE);{const s=p.getDefaultMaterial().getShader(this.circleGeometryContext);s.enable(u),s.setClipPlanes(u,r),u.uniformMatrix4fv(s.x3d_ProjectionMatrix,!1,t),u.uniformMatrix4fv(s.x3d_ModelViewMatrix,!1,e),u.uniformMatrix4fv(s.x3d_EyeMatrix,!1,i),u.uniform3f(s.x3d_EmissiveColor,0,0,0),u.uniform1f(s.x3d_Transparency,c),this.vertexArrayObject.enable(s.getProgram())&&s.enableVertexAttribute(u,this.circleVertexBuffer,0,0),u.drawArrays(u.LINES,0,this.circleNumVertices)}{const s=p.getDefaultMaterial().getShader(this.diskGeometryContext);s.enable(u),s.setClipPlanes(u,r),u.uniformMatrix4fv(s.x3d_ProjectionMatrix,!1,t),u.uniformMatrix4fv(s.x3d_ModelViewMatrix,!1,e),u.uniformMatrix4fv(s.x3d_EyeMatrix,!1,i),u.uniform3f(s.x3d_EmissiveColor,...a),u.uniform1f(s.x3d_Transparency,o),this.vertexArrayObject.enable(s.getProgram())&&s.enableVertexAttribute(u,this.diskVertexBuffer,0,0),u.drawArrays(u.TRIANGLES,0,this.diskNumVertices)}u.depthMask(!0),u.enable(u.DEPTH_TEST),u.disable(u.BLEND)}})(),dispose(){const t=this.browser.getContext();t.deleteBuffer(this.diskVertexBuffer),this.diskVertexArrayObject.dispose(t)}});const S=v,y=b().add("ScreenPoint",S),M=t.ViewVolume;var V=s.n(M);const R=t.Color3;var A=s.n(R);const P=t.Vector3;var C=s.n(P);const E=t.Rotation4;var _=s.n(E);const j=t.Lock;var N=s.n(j);const D=t.ExamineViewer;var B=s.n(D);Object.assign(B().prototype,{gamepads(t){const e=t.find(({axes:t})=>t[2]||t[3]);if(!e)return void(t.action&&(t.action=!1,this.disconnect()));const i=e.buttons[0].pressed,s=e.buttons[1].pressed;t.button0===i&&t.button1===s||(t.button0=i,t.button1=s,this.disconnect());const r=60/this.getBrowser().currentFrameRate;t.action=!0,i?this.zoom(.005*e.axes[3]*r,Math.sign(-e.axes[3])):s?(this.startPan(0,0),this.pan(5*-e.axes[2]*r,5*e.axes[3]*r)):(this.startRotate(0,0,1),this.rotate(10*-e.axes[2]*r,10*e.axes[3]*r))}});const F=t.X3DFlyViewer;var O=s.n(F);const I=new(C())(300);Object.assign(O().prototype,{gamepads:(()=>{const t=new(C());return function(e){const i=e.find(({axes:t})=>t[2]||t[3]);if(!i)return void(this.startTime=Date.now());const s=i.buttons[0].pressed;i.buttons[1].pressed?(t.set(i.axes[2],-i.axes[3],0).multVec(I),this.direction.add(t).divide(2),this.pan()):(t.set(i.axes[2],0,i.axes[3]).multVec(I).multiply(s?2:1),this.direction.add(t).divide(2),this.fly())}})()});const T=t.X3DViewer;var L=s.n(T);Object.assign(L().prototype,{gamepads(){}});var U=s(254);const X=Symbol(),k=Symbol(),H=Symbol(),G=Symbol(),z=Symbol(),W=Symbol(),Y=Symbol(),q=Symbol(),Z=Symbol(),J=Symbol();function K(){this[Z]=[]}Object.assign(K.prototype,{getPose(){return this[G]},xrAddButton(){U("<div></div>").attr("part","xr-button").attr("title","Start WebXR session.").addClass("x_ite-private-xr-button").on("mousedown touchstart",!1).on("mouseup touchend",t=>{t.preventDefault(),t.stopImmediatePropagation(),t.stopPropagation(),this.startAudioElements(),this.getSession()===window?this.xrStartSession():this.xrStopSession()}).appendTo(this.getSurface())},async xrStartSession(){return N().acquire(X,async()=>{if(this.getSession()!==window)return;const t=this.getContext(),e=this.getBrowserOption("XRSessionMode").toLowerCase().replaceAll("_","-"),i=await navigator.xr.requestSession(e),s=await i.requestReferenceSpace("local");await t.makeXRCompatible(),this.finishedEvents().addInterest("xrUpdatePointers",this),i.addEventListener("visibilitychange",()=>this.xrUpdateVisibility()),i.addEventListener("inputsourceschange",t=>this.xrUpdateInputSources(t)),i.addEventListener("end",()=>this.xrStopSession()),this[k]=s,this[z]=!0,this[W]=new Set,this[Y]=new(o())(this,4,2,.9),this[q]=new y(this),Object.assign(this[Z],{action:!0}),this[G]={cameraSpaceMatrix:new(g()),viewMatrix:new(g()),views:[]},this.xrUpdateBaseLayer({},i),this.setSession(i),this.removeHit(this.getHit()),this.getBrowserOptions().checkUpdate(),this.getRenderingProperties()._ContentScale.addInterest("xrContentScale",this),this.getRenderingProperties()._XRSession=!0})},xrStopSession(){return N().acquire(X,async()=>{if(this.getSession()!==window){await this.getSession().end().catch(Function.prototype),this.finishedEvents().removeInterest("xrUpdatePointers",this),this.setSession(window),this.setDefaultFramebuffer(null);for(const{hit:t}of this[W])this.removeHit(t);this[k]=null,this[H]=null,this[G]=null,this[z]=!1,this[W]=null,this[Y]=null,this[q]=null,this[J]=null,this.getBrowserOptions().checkUpdate(),this.getRenderingProperties()._ContentScale.removeInterest("xrContentScale",this),this.getRenderingProperties()._XRSession=!1}})},xrContentScale(){this.xrUpdateBaseLayer()},xrUpdateBaseLayer(t={},e=this.getSession()){if(e===window)return;const i=new XRWebGLLayer(e,this.getContext(),Object.assign({antialias:!1,alpha:!0,depth:!1,ignoreDepthValues:!0,framebufferScaleFactor:this.getRenderingProperty("ContentScale")},t));this[H]=i,e.updateRenderState({baseLayer:i}),this.setDefaultFramebuffer(i.framebuffer)},xrUpdateNearFarPlanes:(()=>{const t={};return function(){const e=this.getActiveNavigationInfo(),i=this.getActiveViewpoint();i?(t.depthNear=i.getNearDistance(e),t.depthFar=i.getFarDistance(e)):(t.depthNear=.1,t.depthFar=1e4),this.getSession().updateRenderState(t)}})(),xrUpdateVisibility(t){switch(this.getSession().visibilityState){case"visible-blurred":case"hidden":this[z]=!1;break;default:this[z]=!0}},xrUpdateInputSources(t){for(const e of t.added)this[W].add(Object.assign(e,{active:!1,matrix:new(g()),inverse:new(g()),hit:Object.assign(this.getHit().copy(),{button:!1,pressed:!1,pulse:!0,poseViewMatrix:new(g()),originalPoint:new(C()),originalNormal:new(C())})})),e.gamepad&&(e.gamepad.hit=e.hit);for(const e of t.removed)this.removeHit(e.hit),this[W].delete(e);this.xrUpdateGamepads()},xrUpdateGamepads(){this[Z].length=0;for(const{gamepad:t}of this[W])t&&(t.axes.length<4||this[Z].push(t))},xrFrame(t){t&&(this[J]=t,this.xrUpdateNearFarPlanes(),this.getViewer().gamepads(this[Z]),this.xrUpdatePose(),this.addBrowserEvent())},xrUpdatePose(){const t=this[J].getViewerPose(this[k]),e=this[G];e.cameraSpaceMatrix.assign(t.transform.matrix),e.viewMatrix.assign(t.transform.inverse.matrix);let i=0;for(const s of t.views){const{x:t,y:r,width:n,height:a}=this[H].getViewport(s);if(!n)continue;this.reshapeFramebuffer(i,t,r,n,a);const o=e.views[i]??={projectionMatrix:new(g()),cameraSpaceMatrix:new(g()),viewMatrix:new(g()),matrix:new(g()),inverse:new(g())};o.projectionMatrix.assign(s.projectionMatrix),o.cameraSpaceMatrix.assign(s.transform.matrix),o.viewMatrix.assign(s.transform.inverse.matrix),o.matrix.assign(e.cameraSpaceMatrix).multRight(o.viewMatrix),o.inverse.assign(o.cameraSpaceMatrix).multRight(e.viewMatrix),++i}this.getFramebuffers().length=i,e.views.length=i},xrUpdatePointers:(()=>{const t=new(A())(.5,.75,1),e=new(g()),i=new(C())(0,0,-.5),s=new(C()),r=new(C()),n=new(C()),a=new(_());return function(){const o=this.getViewport().getValue(),c=this[G];for(const t of this[W]){const{targetRaySpace:e,matrix:i,inverse:s}=t,r=this[J].getPose(e,this[k]);t.active=!!r,r&&(i.assign(r.transform.matrix),s.assign(r.transform.inverse.matrix))}for(const t of this[W]){const{active:i,gamepad:s,matrix:r,hit:n}=t;if(!i)continue;if(this.touch(o[2]/2,o[3]/2,n,t),this.xrSensorHitPulse(n,s),!n.id)continue;const a=c.views[0].projectionMatrix;n.pressed||n.poseViewMatrix.assign(c.viewMatrix),e.assign(r).multRight(n.poseViewMatrix);for(const t of n.sensors.values())t.projectionMatrix.assign(a),t.modelViewMatrix.multRight(e);V().projectPoint(n.point,e,a,o,n.pointer),n.originalPoint.assign(n.point),n.originalNormal.assign(n.normal),n.ray.multLineMatrix(e),e.multVecMatrix(n.point),e.submatrix.inverse().multMatrixVec(n.normal)}for(const{active:t,gamepad:e,hit:i}of this[W]){if(!t)continue;const s=e?.buttons[0];s?.pressed?i.button||(i.button=!0,i.pressed||=this.buttonPressEvent(0,0,i)):(i.button=!1,i.pressed&&(i.pressed=!1,this.buttonReleaseEvent(i))),this.motionNotifyEvent(0,0,i)}if(this[z])for(const[h,{viewMatrix:d,projectionMatrix:l}]of c.views.entries()){const c=this.getFramebuffers()[h];for(const{active:h,gamepad:p,matrix:u,hit:x}of this[W]){if(!h)continue;const m=p?.buttons.some(t=>t.pressed),f=m?t:A().WHITE;if(e.assign(u).multRight(d),e.multVecMatrix(s.assign(C().ZERO)),e.multVecMatrix(r.assign(i)),e.multVecMatrix(n.assign(x.originalPoint)),x.id&&n.distance(s)<r.distance(s)&&r.assign(n),s.z>0||r.z>0)continue;if(V().projectPointMatrix(s,l,o,s),V().projectPointMatrix(r,l,o,r),s.z=0,r.z=0,this[Y].setColor(f).display(s,r,c),!x.id)continue;const g=m?.005:.007;e.assign(u).multRight(d).translate(x.originalPoint).rotate(a.setFromToVec(C().Z_AXIS,x.originalNormal)),this[q].display(g,f,.3,.8,e,l,c)}}}})(),xrSensorHitPulse(t,e){t.sensors.size?t.pulse&&(e?.hapticActuators?.[0]?.pulse(.25,10),t.pulse=!1):t.pulse=!0}});const Q=K,$=b().add("X3DWebXRContext",Q);n().add({name:"WebXR",concreteNodes:[],abstractNodes:[],browserContext:$});b().add("WebXRComponent",undefined)})();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/* X_ITE v12.1.
|
|
2
|
-
const __X_ITE_X3D__ = window [Symbol .for ("X_ITE.X3D-12.1.
|
|
1
|
+
/* X_ITE v12.1.5 */
|
|
2
|
+
const __X_ITE_X3D__ = window [Symbol .for ("X_ITE.X3D-12.1.5")];
|
|
3
3
|
/******/ (() => { // webpackBootstrap
|
|
4
4
|
/******/ "use strict";
|
|
5
5
|
/******/ // The require scope
|
|
@@ -1246,7 +1246,7 @@ var external_X_ITE_X3D_ShaderRegistry_default = /*#__PURE__*/__webpack_require__
|
|
|
1246
1246
|
;// ./src/assets/shaders/webgl2/pbr/Iridescence2.glsl.js
|
|
1247
1247
|
const Iridescence2_glsl_default_ = () => /* glsl */ `
|
|
1248
1248
|
#if defined(X3D_IRIDESCENCE_MATERIAL_EXT)
|
|
1249
|
-
const mat3 XYZ_TO_REC709=mat3(3.2404542,-.9692660,.0556434,-1.5371385,1.8760108,-.2040259,-.4985314,.0415560,1.0572252);float sq(const in float v){return v*v;}vec3 sq(const in vec3 v){return v*v;}vec3 Fresnel0ToIor(const in vec3 fresnel0){vec3 sqrtF0=sqrt(fresnel0);return(vec3(1)+sqrtF0)/(vec3(1)-sqrtF0);}vec3 IorToFresnel0(const in vec3 transmittedIor,const in float incidentIor){return sq((transmittedIor-vec3(incidentIor))/(transmittedIor+vec3(incidentIor)));}float IorToFresnel0(const in float transmittedIor,const in float incidentIor){return sq((transmittedIor-incidentIor)/(transmittedIor+incidentIor));}vec3 evalSensitivity(const in float OPD,const in vec3 shift){
|
|
1249
|
+
const mat3 XYZ_TO_REC709=mat3(3.2404542,-.9692660,.0556434,-1.5371385,1.8760108,-.2040259,-.4985314,.0415560,1.0572252);float sq(const in float v){return v*v;}vec3 sq(const in vec3 v){return v*v;}vec3 Fresnel0ToIor(const in vec3 fresnel0){vec3 sqrtF0=sqrt(fresnel0);return(vec3(1)+sqrtF0)/(vec3(1)-sqrtF0);}vec3 IorToFresnel0(const in vec3 transmittedIor,const in float incidentIor){return sq((transmittedIor-vec3(incidentIor))/(transmittedIor+vec3(incidentIor)));}float IorToFresnel0(const in float transmittedIor,const in float incidentIor){return sq((transmittedIor-incidentIor)/(transmittedIor+incidentIor));}vec3 evalSensitivity(const in float OPD,const in vec3 shift){const vec3 val=vec3(5.4856e-13,4.4201e-13,5.2481e-13);const vec3 pos=vec3(1.6810e+06,1.7953e+06,2.2084e+06);const vec3 var=vec3(4.3278e+09,9.3046e+09,6.6121e+09);float phase=2.*M_PI*OPD*1.0e-9;vec3 xyz=val*sqrt(2.*M_PI*var)*cos(pos*phase+shift)*exp(-sq(phase)*var);xyz.x+=9.7470e-14*sqrt(2.*M_PI*4.5282e+09)*cos(2.2399e+06*phase+shift[0])*exp(-4.5282e+09*sq(phase));xyz/=1.0685e-7;vec3 srgb=XYZ_TO_REC709*xyz;return srgb;}vec3 evalIridescence(const in float outsideIOR,const in float eta2,const in float cosTheta1,const in float thinFilmThickness,const in vec3 baseF0){vec3 I;float iridescenceIor=mix(outsideIOR,eta2,smoothstep(0.,.03,thinFilmThickness));float sinTheta2Sq=sq(outsideIOR/iridescenceIor)*(1.-sq(cosTheta1));float cosTheta2Sq=1.-sinTheta2Sq;if(cosTheta2Sq<0.)return vec3(1);float cosTheta2=sqrt(cosTheta2Sq);float R0=IorToFresnel0(iridescenceIor,outsideIOR);float R12=F_Schlick(R0,cosTheta1);float R21=R12;float T121=1.-R12;float phi12=0.;if(iridescenceIor<outsideIOR)phi12=M_PI;float phi21=M_PI-phi12;vec3 baseIOR=Fresnel0ToIor(clamp(baseF0,0.,.9999));vec3 R1=IorToFresnel0(baseIOR,iridescenceIor);vec3 R23=F_Schlick(R1,cosTheta2);vec3 phi23=vec3(0);if(baseIOR[0]<iridescenceIor)phi23[0]=M_PI;if(baseIOR[1]<iridescenceIor)phi23[1]=M_PI;if(baseIOR[2]<iridescenceIor)phi23[2]=M_PI;float OPD=2.*iridescenceIor*thinFilmThickness*cosTheta2;vec3 phi=vec3(phi21)+phi23;vec3 R123=clamp(R12*R23,1e-5,.9999);vec3 r123=sqrt(R123);vec3 Rs=sq(T121)*R23/(vec3(1)-R123);vec3 C0=R12+Rs;I=C0;vec3 Cm=Rs-T121;for(int m=1;m<=2;++m){Cm*=r123;vec3 Sm=2.*evalSensitivity(float(m)*OPD,float(m)*phi);I+=Cm*Sm;}return max(I,vec3(0));}
|
|
1250
1250
|
#endif
|
|
1251
1251
|
`
|
|
1252
1252
|
;
|
|
@@ -1593,7 +1593,7 @@ MaterialInfo getSpecularGlossinessInfo(in MaterialInfo info){vec3 specular=x3d_M
|
|
|
1593
1593
|
#if defined(X3D_SPECULAR_GLOSSINESS_TEXTURE)
|
|
1594
1594
|
vec4 sgSample=getSpecularGlossinessTexture();glossiness*=sgSample.a;specular*=sgSample.rgb;
|
|
1595
1595
|
#endif
|
|
1596
|
-
info.perceptualRoughness=1.-glossiness;info.f0_dielectric=min(specular,vec3(1));return info;}vec4 getMaterialColor(){vec4 baseColor=getBaseColor();
|
|
1596
|
+
info.perceptualRoughness=1.-glossiness;info.f0_dielectric=min(specular,vec3(1));return info;}vec4 getMaterialColor(const in vec4 fragCoord){vec4 baseColor=getBaseColor();
|
|
1597
1597
|
#if defined(X3D_TEXTURE_PROJECTION)
|
|
1598
1598
|
baseColor.rgb*=getTextureProjectorColor();
|
|
1599
1599
|
#endif
|
|
@@ -2370,7 +2370,7 @@ const ScatterSamples_default_ = ScatterSamples;
|
|
|
2370
2370
|
/* harmony default export */ const X_ITE_ScatterSamples = (external_X_ITE_X3D_Namespace_default().add ("ScatterSamples", ScatterSamples_default_));
|
|
2371
2371
|
;// ./src/assets/shaders/webgl2/pbr/Scatter2.glsl.js
|
|
2372
2372
|
const Scatter2_glsl_default_ = () => /* glsl */ `
|
|
2373
|
-
uniform float x3d_ScatterMaterialIdEXT;vec4 getMaterialColor(){vec3 singleScatter=multiToSingleScatter();vec4 baseColor=getBaseColor();
|
|
2373
|
+
uniform float x3d_ScatterMaterialIdEXT;vec4 getMaterialColor(const in vec4 fragCoord){vec3 singleScatter=multiToSingleScatter();vec4 baseColor=getBaseColor();
|
|
2374
2374
|
#if defined(X3D_TEXTURE_PROJECTION)
|
|
2375
2375
|
baseColor.rgb*=getTextureProjectorColor();
|
|
2376
2376
|
#endif
|
|
@@ -2442,7 +2442,7 @@ const SubsurfaceScattering2_glsl_default_ = () => /* glsl */ `
|
|
|
2442
2442
|
#if defined(X3D_VOLUME_SCATTER_MATERIAL_EXT)
|
|
2443
2443
|
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;}
|
|
2444
2444
|
#if!defined(X3D_VOLUME_SCATTER_PASS)
|
|
2445
|
-
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=
|
|
2445
|
+
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,const in vec4 fragCoord){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=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;}
|
|
2446
2446
|
#endif
|
|
2447
2447
|
#endif
|
|
2448
2448
|
`
|