x_ite 10.4.1 → 10.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/README.md +4 -4
  2. package/dist/X3DUOM.xml +10 -0
  3. package/dist/assets/components/AnnotationComponent.js +2 -2
  4. package/dist/assets/components/AnnotationComponent.min.js +2 -2
  5. package/dist/assets/components/CADGeometryComponent.js +2 -2
  6. package/dist/assets/components/CADGeometryComponent.min.js +2 -2
  7. package/dist/assets/components/CubeMapTexturingComponent.js +7 -7
  8. package/dist/assets/components/CubeMapTexturingComponent.min.js +2 -2
  9. package/dist/assets/components/DISComponent.js +2 -2
  10. package/dist/assets/components/DISComponent.min.js +2 -2
  11. package/dist/assets/components/EventUtilitiesComponent.js +2 -2
  12. package/dist/assets/components/EventUtilitiesComponent.min.js +2 -2
  13. package/dist/assets/components/Geometry2DComponent.js +19 -23
  14. package/dist/assets/components/Geometry2DComponent.min.js +2 -2
  15. package/dist/assets/components/GeospatialComponent.js +2 -2
  16. package/dist/assets/components/GeospatialComponent.min.js +2 -2
  17. package/dist/assets/components/HAnimComponent.js +2 -2
  18. package/dist/assets/components/HAnimComponent.min.js +2 -2
  19. package/dist/assets/components/KeyDeviceSensorComponent.js +2 -2
  20. package/dist/assets/components/KeyDeviceSensorComponent.min.js +2 -2
  21. package/dist/assets/components/LayoutComponent.js +3 -7
  22. package/dist/assets/components/LayoutComponent.min.js +2 -2
  23. package/dist/assets/components/NURBSComponent.js +859 -812
  24. package/dist/assets/components/NURBSComponent.min.js +2 -2
  25. package/dist/assets/components/ParticleSystemsComponent.js +10 -13
  26. package/dist/assets/components/ParticleSystemsComponent.min.js +2 -2
  27. package/dist/assets/components/PickingComponent.js +2 -2
  28. package/dist/assets/components/PickingComponent.min.js +2 -2
  29. package/dist/assets/components/RigidBodyPhysicsComponent.js +2 -2
  30. package/dist/assets/components/RigidBodyPhysicsComponent.min.js +2 -2
  31. package/dist/assets/components/ScriptingComponent.js +2 -2
  32. package/dist/assets/components/ScriptingComponent.min.js +2 -2
  33. package/dist/assets/components/TextComponent.js +9 -17
  34. package/dist/assets/components/TextComponent.min.js +2 -2
  35. package/dist/assets/components/TextureProjectionComponent.js +14 -8
  36. package/dist/assets/components/TextureProjectionComponent.min.js +2 -2
  37. package/dist/assets/components/Texturing3DComponent.js +16 -16
  38. package/dist/assets/components/Texturing3DComponent.min.js +2 -2
  39. package/dist/assets/components/VolumeRenderingComponent.js +2 -2
  40. package/dist/assets/components/VolumeRenderingComponent.min.js +2 -2
  41. package/dist/assets/components/X_ITEComponent.js +87 -54
  42. package/dist/assets/components/X_ITEComponent.min.js +2 -2
  43. package/dist/example.html +1 -1
  44. package/dist/x_ite.css +1 -1
  45. package/dist/x_ite.d.ts +12 -0
  46. package/dist/x_ite.js +1166 -1125
  47. package/dist/x_ite.min.js +2 -2
  48. package/dist/x_ite.min.mjs +2 -2
  49. package/dist/x_ite.mjs +1166 -1125
  50. package/dist/x_ite.zip +0 -0
  51. package/package.json +5 -5
@@ -1,5 +1,5 @@
1
- /* X_ITE v10.4.1 */
2
- const __X_ITE_X3D__ = window [Symbol .for ("X_ITE.X3D-10.4.1")];
1
+ /* X_ITE v10.5.0 */
2
+ const __X_ITE_X3D__ = window [Symbol .for ("X_ITE.X3D-10.5.0")];
3
3
  /******/ (() => { // webpackBootstrap
4
4
  /******/ "use strict";
5
5
  /******/ // The require scope
@@ -1,2 +1,2 @@
1
- /* X_ITE v10.4.1 */
2
- const e=window[Symbol.for("X_ITE.X3D-10.4.1")];(()=>{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 r=e.PixelTexture;var i=t.n(r);const s=e.TextureProperties;var a=t.n(s);const l=e.Fields;var d=t.n(l);const u=e.X3DFieldDefinition;var h=t.n(u);const c=e.FieldDefinitionArray;var p=t.n(c);const g=e.X3DNode;var f=t.n(g);const _=e.X3DConstants;var m=t.n(_);const S=e.Namespace;var y=t.n(S);function x(e){f().call(this,e),this.addType(m().X3DVolumeRenderStyleNode),this.volumeDataNodes=new Set}Object.assign(Object.setPrototypeOf(x.prototype,f().prototype),{addShaderFields(e){},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(x,f().getStaticProperties("X3DVolumeRenderStyleNode","VolumeRendering",1));const N=x,v=y().add("X3DVolumeRenderStyleNode",N);function w(e){v.call(this,e),this.addType(m().X3DComposableVolumeRenderStyleNode)}Object.setPrototypeOf(w.prototype,v.prototype),Object.defineProperties(w,f().getStaticProperties("X3DComposableVolumeRenderStyleNode","VolumeRendering",1));const F=w,C=y().add("X3DComposableVolumeRenderStyleNode",F),b=e.X3DCast;var O=t.n(b);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.getBrowser().getContext().getVersion()<2||(this._transferFunction.addInterest("set_transferFunction__",this),this.set_transferFunction__())},set_transferFunction__(){this.transferFunctionNode=O()(m().X3DTexture2DNode,this._transferFunction),this.transferFunctionNode||(this.transferFunctionNode=O()(m().X3DTexture3DNode,this._transferFunction)),this.transferFunctionNode||(this.transferFunctionNode=this.getBrowser().getDefaultTransferFunction())},addShaderFields(e){this._enabled.getValue()&&e.addUserDefinedField(m().inputOutput,"transferFunction_"+this.getId(),new(d().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,{...f().getStaticProperties("OpacityMapVolumeStyle","VolumeRendering",1,"renderStyle","3.3"),fieldDefinitions:{value:new(p())([new(h())(m().inputOutput,"enabled",new(d().SFBool)(!0)),new(h())(m().inputOutput,"metadata",new(d().SFNode)),new(h())(m().inputOutput,"transferFunction",new(d().SFNode))]),enumerable:!0}});const V=I,D=y().add("OpacityMapVolumeStyle",V),T=Symbol(),P=Symbol(),M=Symbol(),U=Symbol();function E(){}Object.assign(E.prototype,{getDefaultVoxels(){return this[T]=this.getPrivateScene().createNode("PixelTexture3D",!1),this[T]._image=[1,1,1,1,255],this[T].repeatS=!0,this[T].repeatT=!0,this[T].repeatR=!0,this[T].setPrivate(!0),this[T].setup(),this.getDefaultVoxels=function(){return this[T]},Object.defineProperty(this,"getDefaultVoxels",{enumerable:!1}),this[T]},getDefaultVolumeStyle(){return this[P]=new D(this.getPrivateScene()),this[P].setPrivate(!0),this[P].setup(),this.getDefaultVolumeStyle=function(){return this[P]},Object.defineProperty(this,"getDefaultVolumeStyle",{enumerable:!1}),this[P]},getDefaultBlendedVolumeStyle(){return this[M]=new D(this.getPrivateScene()),this[M].setPrivate(!0),this[M].setup(),this.getDefaultBlendedVolumeStyle=function(){return this[M]},Object.defineProperty(this,"getDefaultBlendedVolumeStyle",{enumerable:!1}),this[M]},getDefaultTransferFunction(){const e=new(a())(this.getPrivateScene());return e._boundaryModeS="CLAMP_TO_EDGE",e._boundaryModeT="REPEAT",e._magnificationFilter="DEFAULT",e._minificationFilter="DEFAULT",e._generateMipMaps=!0,e._textureCompression="DEFAULT",e.setPrivate(!0),e.setup(),this[U]=new(i())(this.getPrivateScene()),this[U]._textureProperties=e,this[U]._image.width=256,this[U]._image.height=1,this[U]._image.comp=2,this[U]._image.array=Array.from({length:256},((e,t)=>t<<8|t)),this[U].setPrivate(!0),this[U].setup(),this.getDefaultTransferFunction=function(){return this[U]},Object.defineProperty(this,"getDefaultTransferFunction",{enumerable:!1}),this[U]}});const B=E,L=y().add("X3DVolumeRenderingContext",B);function j(e){C.call(this,e),this.addType(m().BlendedVolumeStyle)}Object.assign(Object.setPrototypeOf(j.prototype,C.prototype),{initialize(){C.prototype.initialize.call(this);this.getBrowser().getContext().getVersion()<2||(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=O()(m().X3DTexture2DNode,this._weightTransferFunction1)},set_weightTransferFunction2__(){this.weightTransferFunction2Node=O()(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=O()(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=O()(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(d().SFNode)(this.weightTransferFunction1Node)),this.weightTransferFunction2Node&&e.addUserDefinedField(m().inputOutput,"weightTransferFunction2_"+this.getId(),new(d().SFNode)(this.weightTransferFunction2Node)),this.voxelsNode&&e.addUserDefinedField(m().inputOutput,"voxels_"+this.getId(),new(d().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(j,{...f().getStaticProperties("BlendedVolumeStyle","VolumeRendering",3,"renderStyle","3.3"),fieldDefinitions:{value:new(p())([new(h())(m().inputOutput,"metadata",new(d().SFNode)),new(h())(m().inputOutput,"enabled",new(d().SFBool)(!0)),new(h())(m().inputOutput,"weightConstant1",new(d().SFFloat)(.5)),new(h())(m().inputOutput,"weightConstant2",new(d().SFFloat)(.5)),new(h())(m().inputOutput,"weightFunction1",new(d().SFString)("CONSTANT")),new(h())(m().inputOutput,"weightFunction2",new(d().SFString)("CONSTANT")),new(h())(m().inputOutput,"weightTransferFunction1",new(d().SFNode)),new(h())(m().inputOutput,"weightTransferFunction2",new(d().SFNode)),new(h())(m().inputOutput,"renderStyle",new(d().SFNode)),new(h())(m().inputOutput,"voxels",new(d().SFNode))]),enumerable:!0}});const A=j,z=y().add("BlendedVolumeStyle",A);function R(e){C.call(this,e),this.addType(m().BoundaryEnhancementVolumeStyle)}Object.assign(Object.setPrototypeOf(R.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(R,{...f().getStaticProperties("BoundaryEnhancementVolumeStyle","VolumeRendering",2,"renderStyle","3.3"),fieldDefinitions:{value:new(p())([new(h())(m().inputOutput,"metadata",new(d().SFNode)),new(h())(m().inputOutput,"enabled",new(d().SFBool)(!0)),new(h())(m().inputOutput,"retainedOpacity",new(d().SFFloat)(.2)),new(h())(m().inputOutput,"boundaryOpacity",new(d().SFFloat)(.9)),new(h())(m().inputOutput,"opacityFactor",new(d().SFFloat)(2))]),enumerable:!0}});const X=R,G=y().add("BoundaryEnhancementVolumeStyle",X);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.getBrowser().getContext().getVersion()<2||(this._surfaceNormals.addInterest("set_surfaceNormals__",this),this.set_surfaceNormals__())},set_surfaceNormals__(){this.surfaceNormalsNode=O()(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(d().SFNode)(this.surfaceNormalsNode)))},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+="vec3\n",e+="rgb2hsv_"+this.getId()+" (in vec3 color)\n",e+="{\n",e+=" float h = 0.0;\n",e+=" float s = 0.0;\n",e+=" float v = 0.0;\n",e+="\n",e+=" float min = min (min (color .r, color .g), color .b);\n",e+=" float max = max (max (color .r, color .g), color .b);\n",e+=" v = max; // value\n",e+="\n",e+=" float delta = max - min;\n",e+="\n",e+=" if (max != 0.0 && delta != 0.0)\n",e+=" {\n",e+=" s = delta / max; // s\n",e+="\n",e+=" if (color .r == max)\n",e+=" h = (color .g - color .b) / delta; // between yellow & magenta\n",e+=" else if (color .g == max)\n",e+=" h = 2.0 + (color .b - color .r) / delta; // between cyan & yellow\n",e+=" else\n",e+=" h = 4.0 + (color .r - color .g) / delta; // between magenta & cyan\n",e+="\n",e+=" h *= M_PI / 3.0; // radiants\n",e+=" if (h < 0.0)\n",e+=" h += M_PI * 2.0;\n",e+=" }\n",e+=" else\n",e+=" s = h = 0.0; // s = 0, h is undefined\n",e+="\n",e+=" return vec3 (h, s, v);\n",e+="}\n",e+="\n",e+="vec3\n",e+="hsv2rgb_"+this.getId()+" (in vec3 hsv)\n",e+="{\n",e+=" float h = hsv [0];\n",e+=" float s = clamp (hsv [1], 0.0, 1.0);\n",e+=" float v = clamp (hsv [2], 0.0, 1.0);\n",e+="\n",e+=" // H is given on [0, 2 * Pi]. S and V are given on [0, 1].\n",e+=" // RGB are each returned on [0, 1].\n",e+="\n",e+=" if (s == 0.0)\n",e+=" {\n",e+=" // achromatic (grey)\n",e+=" return vec3 (v, v, v);\n",e+=" }\n",e+=" else\n",e+=" {\n",e+=" float w = (h * (180.0 / M_PI)) / 60.0; // sector 0 to 5\n",e+="\n",e+=" float i = floor (w);\n",e+=" float f = w - i; // factorial part of h\n",e+=" float p = v * ( 1.0 - s );\n",e+=" float q = v * ( 1.0 - s * f );\n",e+=" float t = v * ( 1.0 - s * ( 1.0 - f ) );\n",e+="\n",e+=" switch (int (i) % 6)\n",e+=" {\n",e+=" case 0: return vec3 (v, t, p);\n",e+=" case 1: return vec3 (q, v, p);\n",e+=" case 2: return vec3 (p, v, t);\n",e+=" case 3: return vec3 (p, q, v);\n",e+=" case 4: return vec3 (t, p, v);\n",e+=" default: return vec3 (v, p, q);\n",e+=" }\n",e+=" }\n",e+="\n",e+=" return vec3 (0.0);\n",e+="}\n",e+="\n",e+="vec3\n",e+="mix_hsv_"+this.getId()+" (in vec3 a, in vec3 b, in float t)\n",e+="{\n",e+=" // Linearely interpolate in HSV space between source color @a a and destination color @a b by an amount of @a t.\n",e+=" // Source and destination color must be in HSV space.\n",e+="\n",e+=" float ha = a [0];\n",e+=" float sa = a [1];\n",e+=" float va = a [2];\n",e+="\n",e+=" float hb = b [0];\n",e+=" float sb = b [1];\n",e+=" float vb = b [2];\n",e+="\n",e+=" if (sa == 0.0)\n",e+=" ha = hb;\n",e+="\n",e+=" if (sb == 0.0)\n",e+=" hb = ha;\n",e+="\n",e+=" float range = abs (hb - ha);\n",e+="\n",e+=" if (range <= M_PI)\n",e+=" {\n",e+=" float h = ha + t * (hb - ha);\n",e+=" float s = sa + t * (sb - sa);\n",e+=" float v = va + t * (vb - va);\n",e+=" return vec3 (h, s, v);\n",e+=" }\n",e+="\n",e+=" float PI2 = M_PI * 2.0;\n",e+=" float step = (PI2 - range) * t;\n",e+=" float h = ha < hb ? ha - step : ha + step;\n",e+="\n",e+=" if (h < 0.0)\n",e+=" h += PI2;\n",e+="\n",e+=" else if (h > PI2)\n",e+=" h -= PI2;\n",e+="\n",e+=" float s = sa + t * (sb - sa);\n",e+=" float v = va + t * (vb - va);\n",e+=" return vec3 (h, s, v);\n",e+="}\n",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_"+this.getId()+" (orthogonalColor .rgb);\n",e+=" vec3 parallelHSV = rgb2hsv_"+this.getId()+" (parallelColor .rgb);\n",e+="\n",e+=" return vec4 (hsv2rgb_"+this.getId()+" (mix_hsv_"+this.getId()+" (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,{...f().getStaticProperties("CartoonVolumeStyle","VolumeRendering",3,"renderStyle","3.3"),fieldDefinitions:{value:new(p())([new(h())(m().inputOutput,"metadata",new(d().SFNode)),new(h())(m().inputOutput,"enabled",new(d().SFBool)(!0)),new(h())(m().inputOutput,"colorSteps",new(d().SFInt32)(4)),new(h())(m().inputOutput,"orthogonalColor",new(d().SFColorRGBA)(1,1,1,1)),new(h())(m().inputOutput,"parallelColor",new(d().SFColorRGBA)(0,0,0,1)),new(h())(m().inputOutput,"surfaceNormals",new(d().SFNode))]),enumerable:!0}});const k=H,Y=y().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.getBrowser().getContext().getVersion()<2||(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=O()(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)},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,{...f().getStaticProperties("ComposedVolumeStyle","VolumeRendering",3,"renderStyle","3.3"),fieldDefinitions:{value:new(p())([new(h())(m().inputOutput,"metadata",new(d().SFNode)),new(h())(m().inputOutput,"enabled",new(d().SFBool)(!0)),new(h())(m().inputOutput,"renderStyle",new(d().MFNode))]),enumerable:!0}});const Q=q,W=y().add("ComposedVolumeStyle",Q);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.getBrowser().getContext().getVersion()<2||(this._surfaceNormals.addInterest("set_surfaceNormals__",this),this.set_surfaceNormals__())},set_surfaceNormals__(){this.surfaceNormalsNode=O()(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(d().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,{...f().getStaticProperties("EdgeEnhancementVolumeStyle","VolumeRendering",2,"renderStyle","3.3"),fieldDefinitions:{value:new(p())([new(h())(m().inputOutput,"metadata",new(d().SFNode)),new(h())(m().inputOutput,"enabled",new(d().SFBool)(!0)),new(h())(m().inputOutput,"edgeColor",new(d().SFColorRGBA)(0,0,0,1)),new(h())(m().inputOutput,"gradientThreshold",new(d().SFFloat)(.4)),new(h())(m().inputOutput,"surfaceNormals",new(d().SFNode))]),enumerable:!0}});const $=K,Z=y().add("EdgeEnhancementVolumeStyle",$),J=e.X3DChildNode;var ee=t.n(J);const te=e.X3DBoundedObject;var ne=t.n(te);const oe=e.TextureQuality;var re=t.n(oe);const ie=e.UnlitMaterial;var se=t.n(ie);const ae=y().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];in vec4 x3d_TexCoord0;in vec4 x3d_Vertex;out vec3 vertex;out vec4 texCoord;void main(){vec4 position=x3d_ModelViewMatrix*x3d_Vertex;vertex=position.xyz;texCoord=x3d_TextureMatrix[0]*x3d_TexCoord0;gl_Position=x3d_ProjectionMatrix*position;}"),le=y().add("VolumeStyle.fs",'#version 300 es\nprecision highp float;precision highp int;precision highp sampler3D;in vec3 vertex;in vec4 texCoord;uniform sampler3D x3d_Texture3D[1];uniform mat3 x3d_TextureNormalMatrix;uniform x3d_LightSourceParameters x3d_LightSource[x3d_MaxLights];const float M_PI=3.14159265359;\n#pragma X3D include "includes/ClipPlanes.glsl"\n#pragma X3D include "includes/Fog.glsl"\n__VOLUME_STYLES_UNIFORMS__ out vec4 x3d_FragColor;vec4 getTextureColor(in vec3 texCoord){if(any(greaterThan(abs(texCoord-0.5),vec3(0.5))))discard;vec4 textureColor=texture(x3d_Texture3D[0],texCoord);__VOLUME_STYLES_FUNCTIONS__ return textureColor;}void 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\nx3d_FragColor=finalColor;}');function de(e,t){se().call(this,e),this.volumeDataNode=t,this.volumeShaderNodes=new Map}Object.assign(Object.setPrototypeOf(de.prototype,se().prototype),{getVolumeShaders(){return this.volumeShaderNodes},getShader(e,t){const{renderObject:n,fogNode:o,localObjectsKeys:r}=t;let i="";return i+=n.getRenderAndGlobalLightsKey(),i+=o?.getFogType()??0,i+=".",i+=r.sort().join(""),this.volumeShaderNodes.get(i)??this.createShader(i,e,t)},createShader(e,t,n){const o=this.getBrowser(),r=[],{renderObject:i,fogNode:s,localObjectsKeys:a}=n,l=a.concat(i.getGlobalLightsKeys());switch(s?.getFogType()){case 1:r.push("X3D_FOG","X3D_FOG_LINEAR");break;case 2:r.push("X3D_FOG","X3D_FOG_EXPONENTIAL")}const d=l.reduce(((e,t)=>e+(0===t)),0),u=l.reduce(((e,t)=>e+(1===t)),0);d&&(r.push("X3D_CLIP_PLANES"),r.push(`X3D_NUM_CLIP_PLANES ${Math.min(d,o.getMaxClipPlanes())}`)),u&&(r.push("X3D_LIGHTING"),r.push(`X3D_NUM_LIGHTS ${Math.min(u,o.getMaxLights())}`));const h=this.volumeDataNode.createShader(r,ae,le);return this.volumeShaderNodes.set(e,h),h},setShaderUniforms(e,t,n,o,r){this.volumeDataNode.setShaderUniforms(e,t)}}),Object.defineProperties(de,{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=de,he=y().add("VolumeMaterial",ue),ce=e.Vector3;var pe=t.n(ce);const ge=e.Matrix4;var fe=t.n(ge);function _e(e){ee().call(this,e),ne().call(this,e),this.addType(m().X3DVolumeDataNode);const t=this.getBrowser();this.proximitySensorNode=t.getPrivateScene().createNode("ProximitySensor",!1),this.transformNode=t.getPrivateScene().createNode("Transform",!1),this.shapeNode=t.getPrivateScene().createNode("Shape",!1),this.appearanceNode=t.getPrivateScene().createNode("Appearance",!1),this.textureTransformNode=t.getPrivateScene().createNode("TextureTransform3D",!1),this.geometryNode=t.getPrivateScene().createNode("QuadSet",!1),this.textureCoordinateNode=t.getPrivateScene().createNode("TextureCoordinate3D",!1),this.coordinateNode=t.getPrivateScene().createNode("Coordinate",!1),this.volumeMaterialNode=new he(t.getPrivateScene(),this),this.textureNormalMatrixArray=new Float32Array(9),this.setCameraObject(!0)}Object.assign(Object.setPrototypeOf(_e.prototype,ee().prototype),ne().prototype,{initialize(){ee().prototype.initialize.call(this),ne().prototype.initialize.call(this);const e=this.getBrowser().getContext();this._bboxDisplay.addFieldInterest(this.transformNode._bboxDisplay),this.proximitySensorNode._size=new(d().SFVec3f)(-1,-1,-1),this.transformNode._children=new(d().MFNode)(this.shapeNode),this.shapeNode._appearance=this.appearanceNode,this.shapeNode._geometry=this.geometryNode,this.appearanceNode._alphaMode="BLEND",this.appearanceNode._material=this.volumeMaterialNode,this.appearanceNode._textureTransform=this.textureTransformNode,this.textureTransformNode._translation=new(d().SFVec3f)(.5,.5,.5),this.textureTransformNode._center=new(d().SFVec3f)(-.5,-.5,-.5),this.geometryNode._texCoord=this.textureCoordinateNode,this.geometryNode._coord=this.coordinateNode,this.coordinateNode.setPrivate(!0),this.textureCoordinateNode.setPrivate(!0),this.geometryNode.setPrivate(!0),this.textureTransformNode.setPrivate(!0),this.volumeMaterialNode.setPrivate(!0),this.appearanceNode.setPrivate(!0),this.shapeNode.setPrivate(!0),this.transformNode.setPrivate(!0),this.proximitySensorNode.setPrivate(!0),this.coordinateNode.setup(),this.textureCoordinateNode.setup(),this.geometryNode.setup(),this.textureTransformNode.setup(),this.volumeMaterialNode.setup(),this.appearanceNode.setup(),this.shapeNode.setup(),this.transformNode.setup(),this.proximitySensorNode.setup(),this.proximitySensorNode._orientation_changed.addFieldInterest(this.transformNode._rotation),this.proximitySensorNode._orientation_changed.addFieldInterest(this.textureTransformNode._rotation),e.getVersion()<2||(this.getLive().addInterest("set_live__",this),this._dimensions.addInterest("set_dimensions__",this),this.textureTransformNode.addInterest("set_textureTransform__",this),this.set_live__(),this.set_dimensions__(),this.set_textureTransform__())},getBBox(e,t){return this._bboxSize.getValue().equals(this.getDefaultBBoxSize())?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(){switch(this.getBrowser().getBrowserOptions().getTextureQuality()){case re().LOW:return 200;case re().MEDIUM:return 400;case re().HIGH:return 600}return 200},set_live__(){const e=this.isLive()&&this.getBrowser().getBrowserOption("AlwaysUpdateGeometries");this.getLive().getValue()||e?this.getBrowser().getBrowserOptions()._TextureQuality.addInterest("set_dimensions__",this):this.getBrowser().getBrowserOptions()._TextureQuality.removeInterest("set_dimensions__",this)},set_dimensions__(){const e=this.getNumPlanes(),t=this._dimensions.getValue().magnitude(),n=t/2,o=[];this.coordinateNode._point.length=0;for(let r=0;r<e;++r){const i=r/(e-1)-.5;o.push(n,n,t*i,-n,n,t*i,-n,-n,t*i,n,-n,t*i)}this.coordinateNode._point=o,this.textureCoordinateNode._point=o,this.textureTransformNode._scale=new(d().SFVec3f)(1/this._dimensions.x,1/this._dimensions.y,1/this._dimensions.z)},set_textureTransform__(){this.textureNormalMatrixArray.set(new(fe())(...this.textureTransformNode.getMatrix()).submatrix.inverse())},traverse(e,t){this.proximitySensorNode.traverse(e,t),this.transformNode.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(_e,f().getStaticProperties("X3DVolumeDataNode","VolumeRendering",1));const me=_e,Se=y().add("X3DVolumeDataNode",me),ye=e.ComposedShader;var xe=t.n(ye);const Ne=e.ShaderPart;var ve=t.n(Ne);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.getBrowser().getContext().getVersion()<2||(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=O()(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=O()(m().X3DComposableVolumeRenderStyleNode,t);n&&e.push(n)}for(const t of e)t.addInterest("updateShader",this),t.addVolumeData(this)},set_voxels__(){this.voxelsNode=O()(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();let r=o.getUniformsText(),i=o.getFunctionsText();r+="\n",r+="uniform float surfaceValues ["+this._surfaceValues.length+"];\n",r+="uniform float surfaceTolerance;\n";for(const e of this.renderStyleNodes)r+=e.getUniformsText();if(i+="\n",i+=" // IsoSurfaceVolumeData\n",i+="\n",this.gradientsNode?(r+="\n",r+="uniform sampler3D gradients;\n",i+=" if (length (texture (gradients, texCoord) .xyz * 2.0 - 1.0) < surfaceTolerance)\n",i+=" 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",i+=" if (getNormal (texCoord) .w < surfaceTolerance)\n",i+=" discard;\n"),i+="\n",i+=" float intensity = textureColor .r;\n",i+="\n",1===this._surfaceValues.length){const e=Math.abs(this._contourStepSize.getValue());if(0===e)i+=" if (intensity > surfaceValues [0])\n",i+=" {\n",i+=" textureColor = vec4 (vec3 (surfaceValues [0]), 1.0);\n",this.renderStyleNodes.length&&(i+=this.renderStyleNodes[0].getFunctionsText()),i+=" }\n",i+=" else\n",i+=" {\n",i+=" discard;\n",i+=" }\n",i+="\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);i+=" if (false)\n",i+=" { }\n";for(let e=this._surfaceValues.length-1;e>=0;--e)i+=" else if (intensity > "+t[e]+")\n",i+=" {\n",i+=" textureColor = vec4 (vec3 ("+t[e]+"), 1.0);\n",this.renderStyleNodes.length&&(i+=this.renderStyleNodes[0].getFunctionsText()),i+=" }\n";i+=" else\n",i+=" {\n",i+=" discard;\n",i+=" }\n",i+="\n"}}else{i+=" if (false)\n",i+=" { }\n";for(let e=this._surfaceValues.length-1;e>=0;--e){if(i+=" else if (intensity > surfaceValues ["+e+"])\n",i+=" {\n",i+=" textureColor = vec4 (vec3 (surfaceValues ["+e+"]), 1.0);\n",this.renderStyleNodes.length){const t=Math.min(e,this.renderStyleNodes.length-1);i+=this.renderStyleNodes[t].getFunctionsText()}i+=" }\n"}i+=" else\n",i+=" {\n",i+=" discard;\n",i+=" }\n",i+="\n"}n=n.replace(/__VOLUME_STYLES_UNIFORMS__/,r).replace(/__VOLUME_STYLES_FUNCTIONS__/,i);const s=new(ve())(this.getExecutionContext());s._url.push(encodeURI("data:x-shader/x-vertex,"+t)),s.setPrivate(!0),s.setName("VolumeDataVertexShader"),s.setOptions(e),s.setup();const a=new(ve())(this.getExecutionContext());a._type="FRAGMENT",a._url.push(encodeURI("data:x-shader/x-fragment,"+n)),a.setPrivate(!0),a.setName("VolumeDataFragmentShader"),a.setOptions(e),a.setup();const l=new(xe())(this.getExecutionContext());l._language="GLSL",l._parts.push(s),l._parts.push(a),l.setPrivate(!0),l.setName("VolumeDataShader"),l.addUserDefinedField(m().inputOutput,"surfaceValues",this._surfaceValues.copy()),l.addUserDefinedField(m().inputOutput,"surfaceTolerance",this._surfaceTolerance.copy()),this.gradientsNode&&l.addUserDefinedField(m().inputOutput,"gradients",new(d().SFNode)(this.gradientsNode)),o.addShaderFields(l);for(const e of this.renderStyleNodes)e.addShaderFields(l);const u=[];return this.addShaderUniformNames(u),l.setUniformNames(u),l.setup(),l}}),Object.defineProperties(we,{...f().getStaticProperties("IsoSurfaceVolumeData","VolumeRendering",2,"children","3.3"),fieldDefinitions:{value:new(p())([new(h())(m().inputOutput,"metadata",new(d().SFNode)),new(h())(m().inputOutput,"dimensions",new(d().SFVec3f)(1,1,1)),new(h())(m().inputOutput,"contourStepSize",new(d().SFFloat)),new(h())(m().inputOutput,"surfaceValues",new(d().MFFloat)),new(h())(m().inputOutput,"surfaceTolerance",new(d().SFFloat)),new(h())(m().inputOutput,"visible",new(d().SFBool)(!0)),new(h())(m().inputOutput,"bboxDisplay",new(d().SFBool)),new(h())(m().initializeOnly,"bboxSize",new(d().SFVec3f)(-1,-1,-1)),new(h())(m().initializeOnly,"bboxCenter",new(d().SFVec3f)),new(h())(m().inputOutput,"renderStyle",new(d().MFNode)),new(h())(m().inputOutput,"gradients",new(d().SFNode)),new(h())(m().inputOutput,"voxels",new(d().SFNode))]),enumerable:!0}});const Fe=we,Ce=y().add("IsoSurfaceVolumeData",Fe);function be(e){v.call(this,e),this.addType(m().ProjectionVolumeStyle)}Object.assign(Object.setPrototypeOf(be.prototype,v.prototype),{addShaderFields(e){this._enabled.getValue()&&e.addUserDefinedField(m().inputOutput,"intensityThreshold_"+this.getId(),this._intensityThreshold.copy())},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 = 32;\n",e+=" vec3 step = normalize (x3d_TextureNormalMatrix * vec3 (0.0, 0.0, 1.0)) / float (samples);\n",e+=" vec3 ray = texCoord - step * float (samples) * 0.5;\n",e+=" bool first = false;\n",e+="\n",e+=" for (int i = 0; i < samples; ++ i, ray += step)\n",e+=" {\n",e+=" if (ray .s < 0.0 || ray .s > 1.0)\n",e+=" continue;\n",e+="\n",e+=" if (ray .t < 0.0 || ray .t > 1.0)\n",e+=" continue;\n",e+="\n",e+=" if (ray .p < 0.0 || ray .p > 1.0)\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 (intensityThreshold_"+this.getId()+" > 0.0 && first)\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 (intensityThreshold_"+this.getId()+" > 0.0 && first)\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(be,{...f().getStaticProperties("ProjectionVolumeStyle","VolumeRendering",2,"renderStyle","3.3"),fieldDefinitions:{value:new(p())([new(h())(m().inputOutput,"metadata",new(d().SFNode)),new(h())(m().inputOutput,"enabled",new(d().SFBool)(!0)),new(h())(m().inputOutput,"type",new(d().SFString)("MAX")),new(h())(m().inputOutput,"intensityThreshold",new(d().SFFloat))]),enumerable:!0}});const Oe=be,Ie=y().add("ProjectionVolumeStyle",Oe);function Ve(e){Se.call(this,e),this.addType(m().SegmentedVolumeData),this.segmentIdentifiersNode=null,this.renderStyleNodes=[]}Object.assign(Object.setPrototypeOf(Ve.prototype,Se.prototype),{initialize(){Se.prototype.initialize.call(this);this.getBrowser().getContext().getVersion()<2||(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=O()(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=O()(m().X3DComposableVolumeRenderStyleNode,t);n&&e.push(n)}for(const t of e)t.addInterest("updateShader",this),t.addVolumeData(this)},set_voxels__(){this.voxelsNode=O()(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();let r=o.getUniformsText(),i=o.getFunctionsText();if(this.segmentIdentifiersNode?(r+="\n",r+="uniform sampler3D segmentIdentifiers;\n",r+="\n",i+="\n",i+=" int segment = int (texture (segmentIdentifiers, texCoord) .r * 255.0);\n"):i+=" int segment = 0;\n",this.renderStyleNodes.length){i+="\n",i+=" switch (segment)\n",i+=" {\n";for(const[e,t]of this.renderStyleNodes.entries())i+=" case "+e+":\n",i+=" {\n",this.getSegmentEnabled(e)?(r+=t.getUniformsText(),i+=t.getFunctionsText(),i+=" break;\n"):i+=" discard;\n",i+=" }\n";i+=" }\n"}n=n.replace(/__VOLUME_STYLES_UNIFORMS__/,r).replace(/__VOLUME_STYLES_FUNCTIONS__/,i);const s=new(ve())(this.getExecutionContext());s._url.push(encodeURI("data:x-shader/x-vertex,"+t)),s.setPrivate(!0),s.setName("SegmentedVolumeDataVertexShader"),s.setOptions(e),s.setup();const a=new(ve())(this.getExecutionContext());a._type="FRAGMENT",a._url.push(encodeURI("data:x-shader/x-fragment,"+n)),a.setPrivate(!0),a.setName("SegmentedVolumeDataFragmentShader"),a.setOptions(e),a.setup();const l=new(xe())(this.getExecutionContext());l._language="GLSL",l._parts.push(s),l._parts.push(a),l.setPrivate(!0),l.setName("SegmentedVolumeDataShader"),this.segmentIdentifiersNode&&l.addUserDefinedField(m().inputOutput,"segmentIdentifiers",new(d().SFNode)(this.segmentIdentifiersNode)),o.addShaderFields(l);for(const[e,t]of this.renderStyleNodes.entries())this.getSegmentEnabled(e)&&t.addShaderFields(l);const u=[];return this.addShaderUniformNames(u),l.setUniformNames(u),l.setup(),l}}),Object.defineProperties(Ve,{...f().getStaticProperties("SegmentedVolumeData","VolumeRendering",2,"children","3.3"),fieldDefinitions:{value:new(p())([new(h())(m().inputOutput,"metadata",new(d().SFNode)),new(h())(m().inputOutput,"dimensions",new(d().SFVec3f)(1,1,1)),new(h())(m().inputOutput,"segmentEnabled",new(d().MFBool)),new(h())(m().inputOutput,"visible",new(d().SFBool)(!0)),new(h())(m().inputOutput,"bboxDisplay",new(d().SFBool)),new(h())(m().initializeOnly,"bboxSize",new(d().SFVec3f)(-1,-1,-1)),new(h())(m().initializeOnly,"bboxCenter",new(d().SFVec3f)),new(h())(m().inputOutput,"segmentIdentifiers",new(d().SFNode)),new(h())(m().inputOutput,"renderStyle",new(d().MFNode)),new(h())(m().inputOutput,"voxels",new(d().SFNode))]),enumerable:!0}});const De=Ve,Te=y().add("SegmentedVolumeData",De);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.getBrowser().getContext().getVersion()<2||(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=O()(m().X3DMaterialNode,this._material),this.materialNode&&this.materialNode.addInterest("addNodeEvent",this)},set_surfaceNormals__(){this.surfaceNormalsNode=O()(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(d().SFNode)(this.surfaceNormalsNode)))},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+="float\n",e+="getSpotFactor_"+this.getId()+" (const in float cutOffAngle, const in float beamWidth, const in vec3 L, const in vec3 d)\n",e+="{\n",e+=" float spotAngle = acos (clamp (dot (-L, d), -1.0, 1.0));\n",e+="\n",e+=" if (spotAngle >= cutOffAngle)\n",e+=" return 0.0;\n",e+=" else if (spotAngle <= beamWidth)\n",e+=" return 1.0;\n",e+="\n",e+=" return (spotAngle - cutOffAngle) / (beamWidth - cutOffAngle);\n",e+="}\n",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_"+this.getId()+" (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,{...f().getStaticProperties("ShadedVolumeStyle","VolumeRendering",3,"renderStyle","3.3"),fieldDefinitions:{value:new(p())([new(h())(m().inputOutput,"metadata",new(d().SFNode)),new(h())(m().inputOutput,"enabled",new(d().SFBool)(!0)),new(h())(m().inputOutput,"lighting",new(d().SFBool)),new(h())(m().inputOutput,"shadows",new(d().SFBool)),new(h())(m().initializeOnly,"phaseFunction",new(d().SFString)("Henyey-Greenstein")),new(h())(m().inputOutput,"material",new(d().SFNode)),new(h())(m().inputOutput,"surfaceNormals",new(d().SFNode))]),enumerable:!0}});const Me=Pe,Ue=y().add("ShadedVolumeStyle",Me);function Ee(e){C.call(this,e),this.addType(m().SilhouetteEnhancementVolumeStyle)}Object.assign(Object.setPrototypeOf(Ee.prototype,C.prototype),{initialize(){C.prototype.initialize.call(this);this.getBrowser().getContext().getVersion()<2||(this._surfaceNormals.addInterest("set_surfaceNormals__",this),this.set_surfaceNormals__())},set_surfaceNormals__(){this.surfaceNormalsNode=O()(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(d().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(Ee,{...f().getStaticProperties("SilhouetteEnhancementVolumeStyle","VolumeRendering",2,"renderStyle","3.3"),fieldDefinitions:{value:new(p())([new(h())(m().inputOutput,"metadata",new(d().SFNode)),new(h())(m().inputOutput,"enabled",new(d().SFBool)(!0)),new(h())(m().inputOutput,"silhouetteRetainedOpacity",new(d().SFFloat)(1)),new(h())(m().inputOutput,"silhouetteBoundaryOpacity",new(d().SFFloat)),new(h())(m().inputOutput,"silhouetteSharpness",new(d().SFFloat)(.5)),new(h())(m().inputOutput,"surfaceNormals",new(d().SFNode))]),enumerable:!0}});const Be=Ee,Le=y().add("SilhouetteEnhancementVolumeStyle",Be);function je(e){C.call(this,e),this.addType(m().ToneMappedVolumeStyle)}Object.assign(Object.setPrototypeOf(je.prototype,C.prototype),{initialize(){C.prototype.initialize.call(this);this.getBrowser().getContext().getVersion()<2||(this._surfaceNormals.addInterest("set_surfaceNormals__",this),this.set_surfaceNormals__())},set_surfaceNormals__(){this.surfaceNormalsNode=O()(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(d().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(je,{...f().getStaticProperties("ToneMappedVolumeStyle","VolumeRendering",2,"renderStyle","3.3"),fieldDefinitions:{value:new(p())([new(h())(m().inputOutput,"metadata",new(d().SFNode)),new(h())(m().inputOutput,"enabled",new(d().SFBool)(!0)),new(h())(m().inputOutput,"coolColor",new(d().SFColorRGBA)(0,0,1,0)),new(h())(m().inputOutput,"warmColor",new(d().SFColorRGBA)(1,1,0,0)),new(h())(m().inputOutput,"surfaceNormals",new(d().SFNode))]),enumerable:!0}});const Ae=je,ze=y().add("ToneMappedVolumeStyle",Ae);function Re(e){Se.call(this,e),this.addType(m().VolumeData),this.renderStyleNode=null}Object.assign(Object.setPrototypeOf(Re.prototype,Se.prototype),{initialize(){Se.prototype.initialize.call(this);this.getBrowser().getContext().getVersion()<2||(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=O()(m().X3DVolumeRenderStyleNode,this._renderStyle),this.renderStyleNode&&(this.renderStyleNode.addInterest("updateShader",this),this.renderStyleNode.addVolumeData(this))},set_voxels__(){this.voxelsNode=O()(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();let r=o.getUniformsText(),i=o.getFunctionsText();this.renderStyleNode&&(r+=this.renderStyleNode.getUniformsText(),i+=this.renderStyleNode.getFunctionsText()),n=n.replace(/__VOLUME_STYLES_UNIFORMS__/,r).replace(/__VOLUME_STYLES_FUNCTIONS__/,i);const s=new(ve())(this.getExecutionContext());s._url.push(encodeURI("data:x-shader/x-vertex,"+t)),s.setPrivate(!0),s.setName("VolumeDataVertexShader"),s.setOptions(e),s.setup();const a=new(ve())(this.getExecutionContext());a._type="FRAGMENT",a._url.push(encodeURI("data:x-shader/x-fragment,"+n)),a.setPrivate(!0),a.setName("VolumeDataFragmentShader"),a.setOptions(e),a.setup();const l=new(xe())(this.getExecutionContext());l._language="GLSL",l._parts.push(s),l._parts.push(a),l.setPrivate(!0),l.setName("VolumeDataShader"),o.addShaderFields(l),this.renderStyleNode&&this.renderStyleNode.addShaderFields(l);const d=[];return this.addShaderUniformNames(d),l.setUniformNames(d),l.setup(),l}}),Object.defineProperties(Re,{...f().getStaticProperties("VolumeData","VolumeRendering",1,"children","3.3"),fieldDefinitions:{value:new(p())([new(h())(m().inputOutput,"metadata",new(d().SFNode)),new(h())(m().inputOutput,"dimensions",new(d().SFVec3f)(1,1,1)),new(h())(m().inputOutput,"visible",new(d().SFBool)(!0)),new(h())(m().inputOutput,"bboxDisplay",new(d().SFBool)),new(h())(m().initializeOnly,"bboxSize",new(d().SFVec3f)(-1,-1,-1)),new(h())(m().initializeOnly,"bboxCenter",new(d().SFVec3f)),new(h())(m().inputOutput,"renderStyle",new(d().SFNode)),new(h())(m().inputOutput,"voxels",new(d().SFNode))]),enumerable:!0}});const Xe=Re,Ge=y().add("VolumeData",Xe);o().add({name:"VolumeRendering",concreteNodes:[z,G,Y,W,Z,Ce,D,Ie,Te,Ue,Le,ze,Ge],abstractNodes:[C,Se,v],browserContext:L});y().add("VolumeRenderingComponent",undefined)})();
1
+ /* X_ITE v10.5.0 */
2
+ const e=window[Symbol.for("X_ITE.X3D-10.5.0")];(()=>{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 r=e.PixelTexture;var i=t.n(r);const s=e.TextureProperties;var a=t.n(s);const l=e.Fields;var d=t.n(l);const u=e.X3DFieldDefinition;var h=t.n(u);const c=e.FieldDefinitionArray;var p=t.n(c);const g=e.X3DNode;var f=t.n(g);const _=e.X3DConstants;var m=t.n(_);const S=e.Namespace;var y=t.n(S);function x(e){f().call(this,e),this.addType(m().X3DVolumeRenderStyleNode),this.volumeDataNodes=new Set}Object.assign(Object.setPrototypeOf(x.prototype,f().prototype),{addShaderFields(e){},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(x,f().getStaticProperties("X3DVolumeRenderStyleNode","VolumeRendering",1));const N=x,v=y().add("X3DVolumeRenderStyleNode",N);function w(e){v.call(this,e),this.addType(m().X3DComposableVolumeRenderStyleNode)}Object.setPrototypeOf(w.prototype,v.prototype),Object.defineProperties(w,f().getStaticProperties("X3DComposableVolumeRenderStyleNode","VolumeRendering",1));const F=w,C=y().add("X3DComposableVolumeRenderStyleNode",F),b=e.X3DCast;var O=t.n(b);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.getBrowser().getContext().getVersion()<2||(this._transferFunction.addInterest("set_transferFunction__",this),this.set_transferFunction__())},set_transferFunction__(){this.transferFunctionNode=O()(m().X3DTexture2DNode,this._transferFunction),this.transferFunctionNode||(this.transferFunctionNode=O()(m().X3DTexture3DNode,this._transferFunction)),this.transferFunctionNode||(this.transferFunctionNode=this.getBrowser().getDefaultTransferFunction())},addShaderFields(e){this._enabled.getValue()&&e.addUserDefinedField(m().inputOutput,"transferFunction_"+this.getId(),new(d().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,{...f().getStaticProperties("OpacityMapVolumeStyle","VolumeRendering",1,"renderStyle","3.3"),fieldDefinitions:{value:new(p())([new(h())(m().inputOutput,"enabled",new(d().SFBool)(!0)),new(h())(m().inputOutput,"metadata",new(d().SFNode)),new(h())(m().inputOutput,"transferFunction",new(d().SFNode))]),enumerable:!0}});const V=I,D=y().add("OpacityMapVolumeStyle",V),T=Symbol(),P=Symbol(),M=Symbol(),U=Symbol();function E(){}Object.assign(E.prototype,{getDefaultVoxels(){return this[T]=this.getPrivateScene().createNode("PixelTexture3D",!1),this[T]._image=[1,1,1,1,255],this[T].repeatS=!0,this[T].repeatT=!0,this[T].repeatR=!0,this[T].setPrivate(!0),this[T].setup(),this.getDefaultVoxels=function(){return this[T]},Object.defineProperty(this,"getDefaultVoxels",{enumerable:!1}),this[T]},getDefaultVolumeStyle(){return this[P]=new D(this.getPrivateScene()),this[P].setPrivate(!0),this[P].setup(),this.getDefaultVolumeStyle=function(){return this[P]},Object.defineProperty(this,"getDefaultVolumeStyle",{enumerable:!1}),this[P]},getDefaultBlendedVolumeStyle(){return this[M]=new D(this.getPrivateScene()),this[M].setPrivate(!0),this[M].setup(),this.getDefaultBlendedVolumeStyle=function(){return this[M]},Object.defineProperty(this,"getDefaultBlendedVolumeStyle",{enumerable:!1}),this[M]},getDefaultTransferFunction(){const e=new(a())(this.getPrivateScene());return e._boundaryModeS="CLAMP_TO_EDGE",e._boundaryModeT="REPEAT",e._magnificationFilter="DEFAULT",e._minificationFilter="DEFAULT",e._generateMipMaps=!0,e._textureCompression="DEFAULT",e.setPrivate(!0),e.setup(),this[U]=new(i())(this.getPrivateScene()),this[U]._textureProperties=e,this[U]._image.width=256,this[U]._image.height=1,this[U]._image.comp=2,this[U]._image.array=Array.from({length:256},((e,t)=>t<<8|t)),this[U].setPrivate(!0),this[U].setup(),this.getDefaultTransferFunction=function(){return this[U]},Object.defineProperty(this,"getDefaultTransferFunction",{enumerable:!1}),this[U]}});const B=E,L=y().add("X3DVolumeRenderingContext",B);function j(e){C.call(this,e),this.addType(m().BlendedVolumeStyle)}Object.assign(Object.setPrototypeOf(j.prototype,C.prototype),{initialize(){C.prototype.initialize.call(this);this.getBrowser().getContext().getVersion()<2||(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=O()(m().X3DTexture2DNode,this._weightTransferFunction1)},set_weightTransferFunction2__(){this.weightTransferFunction2Node=O()(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=O()(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=O()(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(d().SFNode)(this.weightTransferFunction1Node)),this.weightTransferFunction2Node&&e.addUserDefinedField(m().inputOutput,"weightTransferFunction2_"+this.getId(),new(d().SFNode)(this.weightTransferFunction2Node)),this.voxelsNode&&e.addUserDefinedField(m().inputOutput,"voxels_"+this.getId(),new(d().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(j,{...f().getStaticProperties("BlendedVolumeStyle","VolumeRendering",3,"renderStyle","3.3"),fieldDefinitions:{value:new(p())([new(h())(m().inputOutput,"metadata",new(d().SFNode)),new(h())(m().inputOutput,"enabled",new(d().SFBool)(!0)),new(h())(m().inputOutput,"weightConstant1",new(d().SFFloat)(.5)),new(h())(m().inputOutput,"weightConstant2",new(d().SFFloat)(.5)),new(h())(m().inputOutput,"weightFunction1",new(d().SFString)("CONSTANT")),new(h())(m().inputOutput,"weightFunction2",new(d().SFString)("CONSTANT")),new(h())(m().inputOutput,"weightTransferFunction1",new(d().SFNode)),new(h())(m().inputOutput,"weightTransferFunction2",new(d().SFNode)),new(h())(m().inputOutput,"renderStyle",new(d().SFNode)),new(h())(m().inputOutput,"voxels",new(d().SFNode))]),enumerable:!0}});const A=j,z=y().add("BlendedVolumeStyle",A);function R(e){C.call(this,e),this.addType(m().BoundaryEnhancementVolumeStyle)}Object.assign(Object.setPrototypeOf(R.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(R,{...f().getStaticProperties("BoundaryEnhancementVolumeStyle","VolumeRendering",2,"renderStyle","3.3"),fieldDefinitions:{value:new(p())([new(h())(m().inputOutput,"metadata",new(d().SFNode)),new(h())(m().inputOutput,"enabled",new(d().SFBool)(!0)),new(h())(m().inputOutput,"retainedOpacity",new(d().SFFloat)(.2)),new(h())(m().inputOutput,"boundaryOpacity",new(d().SFFloat)(.9)),new(h())(m().inputOutput,"opacityFactor",new(d().SFFloat)(2))]),enumerable:!0}});const X=R,G=y().add("BoundaryEnhancementVolumeStyle",X);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.getBrowser().getContext().getVersion()<2||(this._surfaceNormals.addInterest("set_surfaceNormals__",this),this.set_surfaceNormals__())},set_surfaceNormals__(){this.surfaceNormalsNode=O()(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(d().SFNode)(this.surfaceNormalsNode)))},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+="vec3\n",e+="rgb2hsv_"+this.getId()+" (in vec3 color)\n",e+="{\n",e+=" float h = 0.0;\n",e+=" float s = 0.0;\n",e+=" float v = 0.0;\n",e+="\n",e+=" float min = min (min (color .r, color .g), color .b);\n",e+=" float max = max (max (color .r, color .g), color .b);\n",e+=" v = max; // value\n",e+="\n",e+=" float delta = max - min;\n",e+="\n",e+=" if (max != 0.0 && delta != 0.0)\n",e+=" {\n",e+=" s = delta / max; // s\n",e+="\n",e+=" if (color .r == max)\n",e+=" h = (color .g - color .b) / delta; // between yellow & magenta\n",e+=" else if (color .g == max)\n",e+=" h = 2.0 + (color .b - color .r) / delta; // between cyan & yellow\n",e+=" else\n",e+=" h = 4.0 + (color .r - color .g) / delta; // between magenta & cyan\n",e+="\n",e+=" h *= M_PI / 3.0; // radiants\n",e+=" if (h < 0.0)\n",e+=" h += M_PI * 2.0;\n",e+=" }\n",e+=" else\n",e+=" s = h = 0.0; // s = 0, h is undefined\n",e+="\n",e+=" return vec3 (h, s, v);\n",e+="}\n",e+="\n",e+="vec3\n",e+="hsv2rgb_"+this.getId()+" (in vec3 hsv)\n",e+="{\n",e+=" float h = hsv [0];\n",e+=" float s = clamp (hsv [1], 0.0, 1.0);\n",e+=" float v = clamp (hsv [2], 0.0, 1.0);\n",e+="\n",e+=" // H is given on [0, 2 * Pi]. S and V are given on [0, 1].\n",e+=" // RGB are each returned on [0, 1].\n",e+="\n",e+=" if (s == 0.0)\n",e+=" {\n",e+=" // achromatic (grey)\n",e+=" return vec3 (v, v, v);\n",e+=" }\n",e+=" else\n",e+=" {\n",e+=" float w = (h * (180.0 / M_PI)) / 60.0; // sector 0 to 5\n",e+="\n",e+=" float i = floor (w);\n",e+=" float f = w - i; // factorial part of h\n",e+=" float p = v * ( 1.0 - s );\n",e+=" float q = v * ( 1.0 - s * f );\n",e+=" float t = v * ( 1.0 - s * ( 1.0 - f ) );\n",e+="\n",e+=" switch (int (i) % 6)\n",e+=" {\n",e+=" case 0: return vec3 (v, t, p);\n",e+=" case 1: return vec3 (q, v, p);\n",e+=" case 2: return vec3 (p, v, t);\n",e+=" case 3: return vec3 (p, q, v);\n",e+=" case 4: return vec3 (t, p, v);\n",e+=" default: return vec3 (v, p, q);\n",e+=" }\n",e+=" }\n",e+="\n",e+=" return vec3 (0.0);\n",e+="}\n",e+="\n",e+="vec3\n",e+="mix_hsv_"+this.getId()+" (in vec3 a, in vec3 b, in float t)\n",e+="{\n",e+=" // Linearely interpolate in HSV space between source color @a a and destination color @a b by an amount of @a t.\n",e+=" // Source and destination color must be in HSV space.\n",e+="\n",e+=" float ha = a [0];\n",e+=" float sa = a [1];\n",e+=" float va = a [2];\n",e+="\n",e+=" float hb = b [0];\n",e+=" float sb = b [1];\n",e+=" float vb = b [2];\n",e+="\n",e+=" if (sa == 0.0)\n",e+=" ha = hb;\n",e+="\n",e+=" if (sb == 0.0)\n",e+=" hb = ha;\n",e+="\n",e+=" float range = abs (hb - ha);\n",e+="\n",e+=" if (range <= M_PI)\n",e+=" {\n",e+=" float h = ha + t * (hb - ha);\n",e+=" float s = sa + t * (sb - sa);\n",e+=" float v = va + t * (vb - va);\n",e+=" return vec3 (h, s, v);\n",e+=" }\n",e+="\n",e+=" float PI2 = M_PI * 2.0;\n",e+=" float step = (PI2 - range) * t;\n",e+=" float h = ha < hb ? ha - step : ha + step;\n",e+="\n",e+=" if (h < 0.0)\n",e+=" h += PI2;\n",e+="\n",e+=" else if (h > PI2)\n",e+=" h -= PI2;\n",e+="\n",e+=" float s = sa + t * (sb - sa);\n",e+=" float v = va + t * (vb - va);\n",e+=" return vec3 (h, s, v);\n",e+="}\n",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_"+this.getId()+" (orthogonalColor .rgb);\n",e+=" vec3 parallelHSV = rgb2hsv_"+this.getId()+" (parallelColor .rgb);\n",e+="\n",e+=" return vec4 (hsv2rgb_"+this.getId()+" (mix_hsv_"+this.getId()+" (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,{...f().getStaticProperties("CartoonVolumeStyle","VolumeRendering",3,"renderStyle","3.3"),fieldDefinitions:{value:new(p())([new(h())(m().inputOutput,"metadata",new(d().SFNode)),new(h())(m().inputOutput,"enabled",new(d().SFBool)(!0)),new(h())(m().inputOutput,"colorSteps",new(d().SFInt32)(4)),new(h())(m().inputOutput,"orthogonalColor",new(d().SFColorRGBA)(1,1,1,1)),new(h())(m().inputOutput,"parallelColor",new(d().SFColorRGBA)(0,0,0,1)),new(h())(m().inputOutput,"surfaceNormals",new(d().SFNode))]),enumerable:!0}});const k=H,Y=y().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.getBrowser().getContext().getVersion()<2||(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=O()(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)},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,{...f().getStaticProperties("ComposedVolumeStyle","VolumeRendering",3,"renderStyle","3.3"),fieldDefinitions:{value:new(p())([new(h())(m().inputOutput,"metadata",new(d().SFNode)),new(h())(m().inputOutput,"enabled",new(d().SFBool)(!0)),new(h())(m().inputOutput,"renderStyle",new(d().MFNode))]),enumerable:!0}});const Q=q,W=y().add("ComposedVolumeStyle",Q);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.getBrowser().getContext().getVersion()<2||(this._surfaceNormals.addInterest("set_surfaceNormals__",this),this.set_surfaceNormals__())},set_surfaceNormals__(){this.surfaceNormalsNode=O()(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(d().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,{...f().getStaticProperties("EdgeEnhancementVolumeStyle","VolumeRendering",2,"renderStyle","3.3"),fieldDefinitions:{value:new(p())([new(h())(m().inputOutput,"metadata",new(d().SFNode)),new(h())(m().inputOutput,"enabled",new(d().SFBool)(!0)),new(h())(m().inputOutput,"edgeColor",new(d().SFColorRGBA)(0,0,0,1)),new(h())(m().inputOutput,"gradientThreshold",new(d().SFFloat)(.4)),new(h())(m().inputOutput,"surfaceNormals",new(d().SFNode))]),enumerable:!0}});const $=K,Z=y().add("EdgeEnhancementVolumeStyle",$),J=e.X3DChildNode;var ee=t.n(J);const te=e.X3DBoundedObject;var ne=t.n(te);const oe=e.TextureQuality;var re=t.n(oe);const ie=e.UnlitMaterial;var se=t.n(ie);const ae=y().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];in vec4 x3d_TexCoord0;in vec4 x3d_Vertex;out vec3 vertex;out vec4 texCoord;void main(){vec4 position=x3d_ModelViewMatrix*x3d_Vertex;vertex=position.xyz;texCoord=x3d_TextureMatrix[0]*x3d_TexCoord0;gl_Position=x3d_ProjectionMatrix*position;}"),le=y().add("VolumeStyle.fs",'#version 300 es\nprecision highp float;precision highp int;precision highp sampler3D;in vec3 vertex;in vec4 texCoord;uniform sampler3D x3d_Texture3D[1];uniform mat3 x3d_TextureNormalMatrix;uniform x3d_LightSourceParameters x3d_LightSource[x3d_MaxLights];const float M_PI=3.14159265359;\n#pragma X3D include "includes/ClipPlanes.glsl"\n#pragma X3D include "includes/Fog.glsl"\n__VOLUME_STYLES_UNIFORMS__ out vec4 x3d_FragColor;vec4 getTextureColor(in vec3 texCoord){if(any(greaterThan(abs(texCoord-0.5),vec3(0.5))))discard;vec4 textureColor=texture(x3d_Texture3D[0],texCoord);__VOLUME_STYLES_FUNCTIONS__ return textureColor;}void 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\nx3d_FragColor=finalColor;}');function de(e,t){se().call(this,e),this.volumeDataNode=t,this.volumeShaderNodes=new Map}Object.assign(Object.setPrototypeOf(de.prototype,se().prototype),{getVolumeShaders(){return this.volumeShaderNodes},getShader(e,t){const{renderObject:n,fogNode:o,localObjectsKeys:r}=t;let i="";return i+=n.getRenderAndGlobalLightsKey(),i+=o?.getFogType()??0,i+=".",i+=r.sort().join(""),this.volumeShaderNodes.get(i)??this.createShader(i,e,t)},createShader(e,t,n){const o=this.getBrowser(),r=[],{renderObject:i,fogNode:s,localObjectsKeys:a}=n,l=a.concat(i.getGlobalLightsKeys());switch(s?.getFogType()){case 1:r.push("X3D_FOG","X3D_FOG_LINEAR");break;case 2:r.push("X3D_FOG","X3D_FOG_EXPONENTIAL")}const d=l.reduce(((e,t)=>e+(0===t)),0),u=l.reduce(((e,t)=>e+(1===t)),0);d&&(r.push("X3D_CLIP_PLANES"),r.push(`X3D_NUM_CLIP_PLANES ${Math.min(d,o.getMaxClipPlanes())}`)),u&&(r.push("X3D_LIGHTING"),r.push(`X3D_NUM_LIGHTS ${Math.min(u,o.getMaxLights())}`));const h=this.volumeDataNode.createShader(r,ae,le);return this.volumeShaderNodes.set(e,h),h},setShaderUniforms(e,t,n,o,r){this.volumeDataNode.setShaderUniforms(e,t)}}),Object.defineProperties(de,{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=de,he=y().add("VolumeMaterial",ue),ce=e.Vector3;var pe=t.n(ce);const ge=e.Matrix4;var fe=t.n(ge);function _e(e){ee().call(this,e),ne().call(this,e),this.addType(m().X3DVolumeDataNode);const t=this.getBrowser();this.proximitySensorNode=t.getPrivateScene().createNode("ProximitySensor",!1),this.transformNode=t.getPrivateScene().createNode("Transform",!1),this.shapeNode=t.getPrivateScene().createNode("Shape",!1),this.appearanceNode=t.getPrivateScene().createNode("Appearance",!1),this.textureTransformNode=t.getPrivateScene().createNode("TextureTransform3D",!1),this.geometryNode=t.getPrivateScene().createNode("QuadSet",!1),this.textureCoordinateNode=t.getPrivateScene().createNode("TextureCoordinate3D",!1),this.coordinateNode=t.getPrivateScene().createNode("Coordinate",!1),this.volumeMaterialNode=new he(t.getPrivateScene(),this),this.textureNormalMatrixArray=new Float32Array(9),this.setCameraObject(!0)}Object.assign(Object.setPrototypeOf(_e.prototype,ee().prototype),ne().prototype,{initialize(){ee().prototype.initialize.call(this),ne().prototype.initialize.call(this);const e=this.getBrowser().getContext();this._bboxDisplay.addFieldInterest(this.transformNode._bboxDisplay),this.proximitySensorNode._size=new(d().SFVec3f)(-1,-1,-1),this.transformNode._children=new(d().MFNode)(this.shapeNode),this.shapeNode._appearance=this.appearanceNode,this.shapeNode._geometry=this.geometryNode,this.appearanceNode._alphaMode="BLEND",this.appearanceNode._material=this.volumeMaterialNode,this.appearanceNode._textureTransform=this.textureTransformNode,this.textureTransformNode._translation=new(d().SFVec3f)(.5,.5,.5),this.textureTransformNode._center=new(d().SFVec3f)(-.5,-.5,-.5),this.geometryNode._texCoord=this.textureCoordinateNode,this.geometryNode._coord=this.coordinateNode,this.coordinateNode.setPrivate(!0),this.textureCoordinateNode.setPrivate(!0),this.geometryNode.setPrivate(!0),this.textureTransformNode.setPrivate(!0),this.volumeMaterialNode.setPrivate(!0),this.appearanceNode.setPrivate(!0),this.shapeNode.setPrivate(!0),this.transformNode.setPrivate(!0),this.proximitySensorNode.setPrivate(!0),this.coordinateNode.setup(),this.textureCoordinateNode.setup(),this.geometryNode.setup(),this.textureTransformNode.setup(),this.volumeMaterialNode.setup(),this.appearanceNode.setup(),this.shapeNode.setup(),this.transformNode.setup(),this.proximitySensorNode.setup(),this.proximitySensorNode._orientation_changed.addFieldInterest(this.transformNode._rotation),this.proximitySensorNode._orientation_changed.addFieldInterest(this.textureTransformNode._rotation),e.getVersion()<2||(this.getLive().addInterest("set_live__",this),this._dimensions.addInterest("set_dimensions__",this),this.textureTransformNode.addInterest("set_textureTransform__",this),this.set_live__(),this.set_dimensions__(),this.set_textureTransform__())},getBBox(e,t){return this._bboxSize.getValue().equals(this.getDefaultBBoxSize())?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(){switch(this.getBrowser().getBrowserOptions().getTextureQuality()){case re().LOW:return 200;case re().MEDIUM:return 400;case re().HIGH:return 600}return 200},set_live__(){const e=this.isLive()&&this.getBrowser().getBrowserOption("AlwaysUpdateGeometries");this.getLive().getValue()||e?this.getBrowser().getBrowserOptions()._TextureQuality.addInterest("set_dimensions__",this):this.getBrowser().getBrowserOptions()._TextureQuality.removeInterest("set_dimensions__",this)},set_dimensions__(){const e=this.getNumPlanes(),t=this._dimensions.getValue().magnitude(),n=t/2,o=[];this.coordinateNode._point.length=0;for(let r=0;r<e;++r){const i=r/(e-1)-.5;o.push(n,n,t*i,-n,n,t*i,-n,-n,t*i,n,-n,t*i)}this.coordinateNode._point=o,this.textureCoordinateNode._point=o,this.textureTransformNode._scale=new(d().SFVec3f)(1/this._dimensions.x,1/this._dimensions.y,1/this._dimensions.z)},set_textureTransform__(){this.textureNormalMatrixArray.set(new(fe())(...this.textureTransformNode.getMatrix()).submatrix.inverse())},traverse(e,t){this.proximitySensorNode.traverse(e,t),this.transformNode.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(_e,f().getStaticProperties("X3DVolumeDataNode","VolumeRendering",1));const me=_e,Se=y().add("X3DVolumeDataNode",me),ye=e.ComposedShader;var xe=t.n(ye);const Ne=e.ShaderPart;var ve=t.n(Ne);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.getBrowser().getContext().getVersion()<2||(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=O()(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=O()(m().X3DComposableVolumeRenderStyleNode,t);n&&e.push(n)}for(const t of e)t.addInterest("updateShader",this),t.addVolumeData(this)},set_voxels__(){this.voxelsNode=O()(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();let r=o.getUniformsText(),i=o.getFunctionsText();r+="\n",r+="uniform float surfaceValues ["+this._surfaceValues.length+"];\n",r+="uniform float surfaceTolerance;\n";for(const e of this.renderStyleNodes)r+=e.getUniformsText();if(i+="\n",i+=" // IsoSurfaceVolumeData\n",i+="\n",this.gradientsNode?(r+="\n",r+="uniform sampler3D gradients;\n",i+=" if (length (texture (gradients, texCoord) .xyz * 2.0 - 1.0) < surfaceTolerance)\n",i+=" 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",i+=" if (getNormal (texCoord) .w < surfaceTolerance)\n",i+=" discard;\n"),i+="\n",i+=" float intensity = textureColor .r;\n",i+="\n",1===this._surfaceValues.length){const e=Math.abs(this._contourStepSize.getValue());if(0===e)i+=" if (intensity > surfaceValues [0])\n",i+=" {\n",i+=" textureColor = vec4 (vec3 (surfaceValues [0]), 1.0);\n",this.renderStyleNodes.length&&(i+=this.renderStyleNodes[0].getFunctionsText()),i+=" }\n",i+=" else\n",i+=" {\n",i+=" discard;\n",i+=" }\n",i+="\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);i+=" if (false)\n",i+=" { }\n";for(let e=this._surfaceValues.length-1;e>=0;--e)i+=" else if (intensity > "+t[e]+")\n",i+=" {\n",i+=" textureColor = vec4 (vec3 ("+t[e]+"), 1.0);\n",this.renderStyleNodes.length&&(i+=this.renderStyleNodes[0].getFunctionsText()),i+=" }\n";i+=" else\n",i+=" {\n",i+=" discard;\n",i+=" }\n",i+="\n"}}else{i+=" if (false)\n",i+=" { }\n";for(let e=this._surfaceValues.length-1;e>=0;--e){if(i+=" else if (intensity > surfaceValues ["+e+"])\n",i+=" {\n",i+=" textureColor = vec4 (vec3 (surfaceValues ["+e+"]), 1.0);\n",this.renderStyleNodes.length){const t=Math.min(e,this.renderStyleNodes.length-1);i+=this.renderStyleNodes[t].getFunctionsText()}i+=" }\n"}i+=" else\n",i+=" {\n",i+=" discard;\n",i+=" }\n",i+="\n"}n=n.replace(/__VOLUME_STYLES_UNIFORMS__/,r).replace(/__VOLUME_STYLES_FUNCTIONS__/,i);const s=new(ve())(this.getExecutionContext());s._url.push(encodeURI("data:x-shader/x-vertex,"+t)),s.setPrivate(!0),s.setName("VolumeDataVertexShader"),s.setOptions(e),s.setup();const a=new(ve())(this.getExecutionContext());a._type="FRAGMENT",a._url.push(encodeURI("data:x-shader/x-fragment,"+n)),a.setPrivate(!0),a.setName("VolumeDataFragmentShader"),a.setOptions(e),a.setup();const l=new(xe())(this.getExecutionContext());l._language="GLSL",l._parts.push(s),l._parts.push(a),l.setPrivate(!0),l.setName("VolumeDataShader"),l.addUserDefinedField(m().inputOutput,"surfaceValues",this._surfaceValues.copy()),l.addUserDefinedField(m().inputOutput,"surfaceTolerance",this._surfaceTolerance.copy()),this.gradientsNode&&l.addUserDefinedField(m().inputOutput,"gradients",new(d().SFNode)(this.gradientsNode)),o.addShaderFields(l);for(const e of this.renderStyleNodes)e.addShaderFields(l);const u=[];return this.addShaderUniformNames(u),l.setUniformNames(u),l.setup(),l}}),Object.defineProperties(we,{...f().getStaticProperties("IsoSurfaceVolumeData","VolumeRendering",2,"children","3.3"),fieldDefinitions:{value:new(p())([new(h())(m().inputOutput,"metadata",new(d().SFNode)),new(h())(m().inputOutput,"dimensions",new(d().SFVec3f)(1,1,1)),new(h())(m().inputOutput,"contourStepSize",new(d().SFFloat)),new(h())(m().inputOutput,"surfaceValues",new(d().MFFloat)),new(h())(m().inputOutput,"surfaceTolerance",new(d().SFFloat)),new(h())(m().inputOutput,"visible",new(d().SFBool)(!0)),new(h())(m().inputOutput,"bboxDisplay",new(d().SFBool)),new(h())(m().initializeOnly,"bboxSize",new(d().SFVec3f)(-1,-1,-1)),new(h())(m().initializeOnly,"bboxCenter",new(d().SFVec3f)),new(h())(m().inputOutput,"renderStyle",new(d().MFNode)),new(h())(m().inputOutput,"gradients",new(d().SFNode)),new(h())(m().inputOutput,"voxels",new(d().SFNode))]),enumerable:!0}});const Fe=we,Ce=y().add("IsoSurfaceVolumeData",Fe);function be(e){v.call(this,e),this.addType(m().ProjectionVolumeStyle)}Object.assign(Object.setPrototypeOf(be.prototype,v.prototype),{addShaderFields(e){this._enabled.getValue()&&e.addUserDefinedField(m().inputOutput,"intensityThreshold_"+this.getId(),this._intensityThreshold.copy())},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 = 32;\n",e+=" vec3 step = normalize (x3d_TextureNormalMatrix * vec3 (0.0, 0.0, 1.0)) / float (samples);\n",e+=" vec3 ray = texCoord - step * float (samples) * 0.5;\n",e+=" bool first = false;\n",e+="\n",e+=" for (int i = 0; i < samples; ++ i, ray += step)\n",e+=" {\n",e+=" if (ray .s < 0.0 || ray .s > 1.0)\n",e+=" continue;\n",e+="\n",e+=" if (ray .t < 0.0 || ray .t > 1.0)\n",e+=" continue;\n",e+="\n",e+=" if (ray .p < 0.0 || ray .p > 1.0)\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 (intensityThreshold_"+this.getId()+" > 0.0 && first)\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 (intensityThreshold_"+this.getId()+" > 0.0 && first)\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(be,{...f().getStaticProperties("ProjectionVolumeStyle","VolumeRendering",2,"renderStyle","3.3"),fieldDefinitions:{value:new(p())([new(h())(m().inputOutput,"metadata",new(d().SFNode)),new(h())(m().inputOutput,"enabled",new(d().SFBool)(!0)),new(h())(m().inputOutput,"type",new(d().SFString)("MAX")),new(h())(m().inputOutput,"intensityThreshold",new(d().SFFloat))]),enumerable:!0}});const Oe=be,Ie=y().add("ProjectionVolumeStyle",Oe);function Ve(e){Se.call(this,e),this.addType(m().SegmentedVolumeData),this.segmentIdentifiersNode=null,this.renderStyleNodes=[]}Object.assign(Object.setPrototypeOf(Ve.prototype,Se.prototype),{initialize(){Se.prototype.initialize.call(this);this.getBrowser().getContext().getVersion()<2||(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=O()(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=O()(m().X3DComposableVolumeRenderStyleNode,t);n&&e.push(n)}for(const t of e)t.addInterest("updateShader",this),t.addVolumeData(this)},set_voxels__(){this.voxelsNode=O()(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();let r=o.getUniformsText(),i=o.getFunctionsText();if(this.segmentIdentifiersNode?(r+="\n",r+="uniform sampler3D segmentIdentifiers;\n",r+="\n",i+="\n",i+=" int segment = int (texture (segmentIdentifiers, texCoord) .r * 255.0);\n"):i+=" int segment = 0;\n",this.renderStyleNodes.length){i+="\n",i+=" switch (segment)\n",i+=" {\n";for(const[e,t]of this.renderStyleNodes.entries())i+=" case "+e+":\n",i+=" {\n",this.getSegmentEnabled(e)?(r+=t.getUniformsText(),i+=t.getFunctionsText(),i+=" break;\n"):i+=" discard;\n",i+=" }\n";i+=" }\n"}n=n.replace(/__VOLUME_STYLES_UNIFORMS__/,r).replace(/__VOLUME_STYLES_FUNCTIONS__/,i);const s=new(ve())(this.getExecutionContext());s._url.push(encodeURI("data:x-shader/x-vertex,"+t)),s.setPrivate(!0),s.setName("SegmentedVolumeDataVertexShader"),s.setOptions(e),s.setup();const a=new(ve())(this.getExecutionContext());a._type="FRAGMENT",a._url.push(encodeURI("data:x-shader/x-fragment,"+n)),a.setPrivate(!0),a.setName("SegmentedVolumeDataFragmentShader"),a.setOptions(e),a.setup();const l=new(xe())(this.getExecutionContext());l._language="GLSL",l._parts.push(s),l._parts.push(a),l.setPrivate(!0),l.setName("SegmentedVolumeDataShader"),this.segmentIdentifiersNode&&l.addUserDefinedField(m().inputOutput,"segmentIdentifiers",new(d().SFNode)(this.segmentIdentifiersNode)),o.addShaderFields(l);for(const[e,t]of this.renderStyleNodes.entries())this.getSegmentEnabled(e)&&t.addShaderFields(l);const u=[];return this.addShaderUniformNames(u),l.setUniformNames(u),l.setup(),l}}),Object.defineProperties(Ve,{...f().getStaticProperties("SegmentedVolumeData","VolumeRendering",2,"children","3.3"),fieldDefinitions:{value:new(p())([new(h())(m().inputOutput,"metadata",new(d().SFNode)),new(h())(m().inputOutput,"dimensions",new(d().SFVec3f)(1,1,1)),new(h())(m().inputOutput,"segmentEnabled",new(d().MFBool)),new(h())(m().inputOutput,"visible",new(d().SFBool)(!0)),new(h())(m().inputOutput,"bboxDisplay",new(d().SFBool)),new(h())(m().initializeOnly,"bboxSize",new(d().SFVec3f)(-1,-1,-1)),new(h())(m().initializeOnly,"bboxCenter",new(d().SFVec3f)),new(h())(m().inputOutput,"segmentIdentifiers",new(d().SFNode)),new(h())(m().inputOutput,"renderStyle",new(d().MFNode)),new(h())(m().inputOutput,"voxels",new(d().SFNode))]),enumerable:!0}});const De=Ve,Te=y().add("SegmentedVolumeData",De);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.getBrowser().getContext().getVersion()<2||(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=O()(m().X3DMaterialNode,this._material),this.materialNode&&this.materialNode.addInterest("addNodeEvent",this)},set_surfaceNormals__(){this.surfaceNormalsNode=O()(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(d().SFNode)(this.surfaceNormalsNode)))},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+="float\n",e+="getSpotFactor_"+this.getId()+" (const in float cutOffAngle, const in float beamWidth, const in vec3 L, const in vec3 d)\n",e+="{\n",e+=" float spotAngle = acos (clamp (dot (-L, d), -1.0, 1.0));\n",e+="\n",e+=" if (spotAngle >= cutOffAngle)\n",e+=" return 0.0;\n",e+=" else if (spotAngle <= beamWidth)\n",e+=" return 1.0;\n",e+="\n",e+=" return (spotAngle - cutOffAngle) / (beamWidth - cutOffAngle);\n",e+="}\n",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_"+this.getId()+" (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,{...f().getStaticProperties("ShadedVolumeStyle","VolumeRendering",3,"renderStyle","3.3"),fieldDefinitions:{value:new(p())([new(h())(m().inputOutput,"metadata",new(d().SFNode)),new(h())(m().inputOutput,"enabled",new(d().SFBool)(!0)),new(h())(m().inputOutput,"lighting",new(d().SFBool)),new(h())(m().inputOutput,"shadows",new(d().SFBool)),new(h())(m().initializeOnly,"phaseFunction",new(d().SFString)("Henyey-Greenstein")),new(h())(m().inputOutput,"material",new(d().SFNode)),new(h())(m().inputOutput,"surfaceNormals",new(d().SFNode))]),enumerable:!0}});const Me=Pe,Ue=y().add("ShadedVolumeStyle",Me);function Ee(e){C.call(this,e),this.addType(m().SilhouetteEnhancementVolumeStyle)}Object.assign(Object.setPrototypeOf(Ee.prototype,C.prototype),{initialize(){C.prototype.initialize.call(this);this.getBrowser().getContext().getVersion()<2||(this._surfaceNormals.addInterest("set_surfaceNormals__",this),this.set_surfaceNormals__())},set_surfaceNormals__(){this.surfaceNormalsNode=O()(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(d().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(Ee,{...f().getStaticProperties("SilhouetteEnhancementVolumeStyle","VolumeRendering",2,"renderStyle","3.3"),fieldDefinitions:{value:new(p())([new(h())(m().inputOutput,"metadata",new(d().SFNode)),new(h())(m().inputOutput,"enabled",new(d().SFBool)(!0)),new(h())(m().inputOutput,"silhouetteRetainedOpacity",new(d().SFFloat)(1)),new(h())(m().inputOutput,"silhouetteBoundaryOpacity",new(d().SFFloat)),new(h())(m().inputOutput,"silhouetteSharpness",new(d().SFFloat)(.5)),new(h())(m().inputOutput,"surfaceNormals",new(d().SFNode))]),enumerable:!0}});const Be=Ee,Le=y().add("SilhouetteEnhancementVolumeStyle",Be);function je(e){C.call(this,e),this.addType(m().ToneMappedVolumeStyle)}Object.assign(Object.setPrototypeOf(je.prototype,C.prototype),{initialize(){C.prototype.initialize.call(this);this.getBrowser().getContext().getVersion()<2||(this._surfaceNormals.addInterest("set_surfaceNormals__",this),this.set_surfaceNormals__())},set_surfaceNormals__(){this.surfaceNormalsNode=O()(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(d().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(je,{...f().getStaticProperties("ToneMappedVolumeStyle","VolumeRendering",2,"renderStyle","3.3"),fieldDefinitions:{value:new(p())([new(h())(m().inputOutput,"metadata",new(d().SFNode)),new(h())(m().inputOutput,"enabled",new(d().SFBool)(!0)),new(h())(m().inputOutput,"coolColor",new(d().SFColorRGBA)(0,0,1,0)),new(h())(m().inputOutput,"warmColor",new(d().SFColorRGBA)(1,1,0,0)),new(h())(m().inputOutput,"surfaceNormals",new(d().SFNode))]),enumerable:!0}});const Ae=je,ze=y().add("ToneMappedVolumeStyle",Ae);function Re(e){Se.call(this,e),this.addType(m().VolumeData),this.renderStyleNode=null}Object.assign(Object.setPrototypeOf(Re.prototype,Se.prototype),{initialize(){Se.prototype.initialize.call(this);this.getBrowser().getContext().getVersion()<2||(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=O()(m().X3DVolumeRenderStyleNode,this._renderStyle),this.renderStyleNode&&(this.renderStyleNode.addInterest("updateShader",this),this.renderStyleNode.addVolumeData(this))},set_voxels__(){this.voxelsNode=O()(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();let r=o.getUniformsText(),i=o.getFunctionsText();this.renderStyleNode&&(r+=this.renderStyleNode.getUniformsText(),i+=this.renderStyleNode.getFunctionsText()),n=n.replace(/__VOLUME_STYLES_UNIFORMS__/,r).replace(/__VOLUME_STYLES_FUNCTIONS__/,i);const s=new(ve())(this.getExecutionContext());s._url.push(encodeURI("data:x-shader/x-vertex,"+t)),s.setPrivate(!0),s.setName("VolumeDataVertexShader"),s.setOptions(e),s.setup();const a=new(ve())(this.getExecutionContext());a._type="FRAGMENT",a._url.push(encodeURI("data:x-shader/x-fragment,"+n)),a.setPrivate(!0),a.setName("VolumeDataFragmentShader"),a.setOptions(e),a.setup();const l=new(xe())(this.getExecutionContext());l._language="GLSL",l._parts.push(s),l._parts.push(a),l.setPrivate(!0),l.setName("VolumeDataShader"),o.addShaderFields(l),this.renderStyleNode&&this.renderStyleNode.addShaderFields(l);const d=[];return this.addShaderUniformNames(d),l.setUniformNames(d),l.setup(),l}}),Object.defineProperties(Re,{...f().getStaticProperties("VolumeData","VolumeRendering",1,"children","3.3"),fieldDefinitions:{value:new(p())([new(h())(m().inputOutput,"metadata",new(d().SFNode)),new(h())(m().inputOutput,"dimensions",new(d().SFVec3f)(1,1,1)),new(h())(m().inputOutput,"visible",new(d().SFBool)(!0)),new(h())(m().inputOutput,"bboxDisplay",new(d().SFBool)),new(h())(m().initializeOnly,"bboxSize",new(d().SFVec3f)(-1,-1,-1)),new(h())(m().initializeOnly,"bboxCenter",new(d().SFVec3f)),new(h())(m().inputOutput,"renderStyle",new(d().SFNode)),new(h())(m().inputOutput,"voxels",new(d().SFNode))]),enumerable:!0}});const Xe=Re,Ge=y().add("VolumeData",Xe);o().add({name:"VolumeRendering",concreteNodes:[z,G,Y,W,Z,Ce,D,Ie,Te,Ue,Le,ze,Ge],abstractNodes:[C,Se,v],browserContext:L});y().add("VolumeRenderingComponent",undefined)})();
@@ -1,5 +1,5 @@
1
- /* X_ITE v10.4.1 */
2
- const __X_ITE_X3D__ = window [Symbol .for ("X_ITE.X3D-10.4.1")];
1
+ /* X_ITE v10.5.0 */
2
+ const __X_ITE_X3D__ = window [Symbol .for ("X_ITE.X3D-10.5.0")];
3
3
  /******/ (() => { // webpackBootstrap
4
4
  /******/ "use strict";
5
5
  /******/ // The require scope
@@ -1422,10 +1422,12 @@ Object .assign (Object .setPrototypeOf (InstancedShape .prototype, (external_X_I
1422
1422
  numLines: 0,
1423
1423
  });
1424
1424
 
1425
- this ._translations .addInterest ("set_transform__", this);
1426
- this ._rotations .addInterest ("set_transform__", this);
1427
- this ._scales .addInterest ("set_transform__", this);
1428
- this ._matrices .addInterest ("set_matrices__", this);
1425
+ this ._translations .addInterest ("set_transform__", this);
1426
+ this ._rotations .addInterest ("set_transform__", this);
1427
+ this ._scales .addInterest ("set_transform__", this);
1428
+ this ._scaleOrientations .addInterest ("set_transform__", this);
1429
+ this ._centers .addInterest ("set_transform__", this);
1430
+ this ._matrices .addInterest ("set_matrices__", this);
1429
1431
 
1430
1432
  this .set_transform__ ();
1431
1433
  },
@@ -1489,19 +1491,23 @@ Object .assign (Object .setPrototypeOf (InstancedShape .prototype, (external_X_I
1489
1491
  set_matrices__ ()
1490
1492
  {
1491
1493
  const
1492
- browser = this .getBrowser (),
1493
- gl = browser .getContext (),
1494
- translations = this ._translations,
1495
- rotations = this ._rotations,
1496
- scales = this ._scales,
1497
- numTranslations = translations .length,
1498
- numRotations = rotations .length,
1499
- numScales = scales .length,
1500
- numInstances = Math .max (numTranslations, numRotations, numScales),
1501
- stride = this .instancesStride / Float32Array .BYTES_PER_ELEMENT,
1502
- length = this .instancesStride * numInstances,
1503
- data = new Float32Array (length),
1504
- matrix = new (external_X_ITE_X3D_Matrix4_default()) ();
1494
+ browser = this .getBrowser (),
1495
+ gl = browser .getContext (),
1496
+ translations = this ._translations,
1497
+ rotations = this ._rotations,
1498
+ scales = this ._scales,
1499
+ scaleOrientations = this ._scaleOrientations,
1500
+ centers = this ._centers,
1501
+ numTranslations = translations .length,
1502
+ numRotations = rotations .length,
1503
+ numScales = scales .length,
1504
+ numScaleOrientations = scaleOrientations .length,
1505
+ numCenters = centers .length,
1506
+ numInstances = Math .max (numTranslations, numRotations, numScales, numScaleOrientations, numCenters),
1507
+ stride = this .instancesStride / Float32Array .BYTES_PER_ELEMENT,
1508
+ length = this .instancesStride * numInstances,
1509
+ data = new Float32Array (length),
1510
+ matrix = new (external_X_ITE_X3D_Matrix4_default()) ();
1505
1511
 
1506
1512
  this .numInstances = numInstances;
1507
1513
 
@@ -1512,9 +1518,11 @@ Object .assign (Object .setPrototypeOf (InstancedShape .prototype, (external_X_I
1512
1518
 
1513
1519
  for (let i = 0, o = 0; i < numInstances; ++ i, o += stride)
1514
1520
  {
1515
- matrix .set (numTranslations ? translations [Math .min (i, numTranslations - 1)] .getValue () : null,
1516
- numRotations ? rotations [Math .min (i, numRotations - 1)] .getValue () : null,
1517
- numScales ? scales [Math .min (i, numScales - 1)] .getValue () : null);
1521
+ matrix .set (numTranslations ? translations [Math .min (i, numTranslations - 1)] .getValue () : null,
1522
+ numRotations ? rotations [Math .min (i, numRotations - 1)] .getValue () : null,
1523
+ numScales ? scales [Math .min (i, numScales - 1)] .getValue () : null,
1524
+ numScaleOrientations ? scaleOrientations [Math .min (i, numScaleOrientations - 1)] .getValue () : null,
1525
+ numCenters ? centers [Math .min (i, numCenters - 1)] .getValue () : null);
1518
1526
 
1519
1527
  if (numScales)
1520
1528
  scale .max (scales [Math .min (i, numScales - 1)] .getValue ());
@@ -1607,18 +1615,20 @@ Object .defineProperties (InstancedShape,
1607
1615
  fieldDefinitions:
1608
1616
  {
1609
1617
  value: new (external_X_ITE_X3D_FieldDefinitionArray_default()) ([
1610
- new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).inputOutput, "metadata", new (external_X_ITE_X3D_Fields_default()).SFNode ()),
1611
- new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).inputOutput, "translations", new (external_X_ITE_X3D_Fields_default()).MFVec3f ()),
1612
- new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).inputOutput, "rotations", new (external_X_ITE_X3D_Fields_default()).MFRotation ()),
1613
- new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).inputOutput, "scales", new (external_X_ITE_X3D_Fields_default()).MFVec3f ()),
1614
- new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).inputOutput, "pointerEvents", new (external_X_ITE_X3D_Fields_default()).SFBool (true)),
1615
- new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).inputOutput, "castShadow", new (external_X_ITE_X3D_Fields_default()).SFBool (true)),
1616
- new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).inputOutput, "visible", new (external_X_ITE_X3D_Fields_default()).SFBool (true)),
1617
- new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).inputOutput, "bboxDisplay", new (external_X_ITE_X3D_Fields_default()).SFBool ()),
1618
- new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).initializeOnly, "bboxSize", new (external_X_ITE_X3D_Fields_default()).SFVec3f (-1, -1, -1)),
1619
- new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).initializeOnly, "bboxCenter", new (external_X_ITE_X3D_Fields_default()).SFVec3f ()),
1620
- new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).inputOutput, "appearance", new (external_X_ITE_X3D_Fields_default()).SFNode ()),
1621
- new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).inputOutput, "geometry", new (external_X_ITE_X3D_Fields_default()).SFNode ()),
1618
+ new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).inputOutput, "metadata", new (external_X_ITE_X3D_Fields_default()).SFNode ()),
1619
+ new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).inputOutput, "translations", new (external_X_ITE_X3D_Fields_default()).MFVec3f ()),
1620
+ new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).inputOutput, "rotations", new (external_X_ITE_X3D_Fields_default()).MFRotation ()),
1621
+ new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).inputOutput, "scales", new (external_X_ITE_X3D_Fields_default()).MFVec3f ()),
1622
+ new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).inputOutput, "scaleOrientations", new (external_X_ITE_X3D_Fields_default()).MFRotation ()),
1623
+ new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).inputOutput, "centers", new (external_X_ITE_X3D_Fields_default()).MFVec3f ()),
1624
+ new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).inputOutput, "pointerEvents", new (external_X_ITE_X3D_Fields_default()).SFBool (true)),
1625
+ new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).inputOutput, "castShadow", new (external_X_ITE_X3D_Fields_default()).SFBool (true)),
1626
+ new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).inputOutput, "visible", new (external_X_ITE_X3D_Fields_default()).SFBool (true)),
1627
+ new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).inputOutput, "bboxDisplay", new (external_X_ITE_X3D_Fields_default()).SFBool ()),
1628
+ new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).initializeOnly, "bboxSize", new (external_X_ITE_X3D_Fields_default()).SFVec3f (-1, -1, -1)),
1629
+ new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).initializeOnly, "bboxCenter", new (external_X_ITE_X3D_Fields_default()).SFVec3f ()),
1630
+ new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).inputOutput, "appearance", new (external_X_ITE_X3D_Fields_default()).SFNode ()),
1631
+ new (external_X_ITE_X3D_X3DFieldDefinition_default()) ((external_X_ITE_X3D_X3DConstants_default()).inputOutput, "geometry", new (external_X_ITE_X3D_Fields_default()).SFNode ()),
1622
1632
  ]),
1623
1633
  enumerable: true,
1624
1634
  },
@@ -2740,31 +2750,54 @@ Object .assign (Object .setPrototypeOf (TransmissionMaterialExtension .prototype
2740
2750
 
2741
2751
  this .transmissionTextureNode ?.getShaderOptions (options, "TRANSMISSION", true);
2742
2752
  },
2743
- setShaderUniforms (gl, shaderObject, renderObject, textureTransformMapping, textureCoordinateMapping)
2753
+ setShaderUniforms: (function ()
2744
2754
  {
2745
- const
2746
- browser = this .getBrowser (),
2747
- transmissionBuffer = browser .getTransmissionBuffer (),
2748
- transmissionUnit = browser .getTexture2DUnit ();
2755
+ const zeros = new Float32Array (16);
2749
2756
 
2750
- gl .uniform1f (shaderObject .x3d_TransmissionEXT, this .transmission);
2757
+ return function (gl, shaderObject, renderObject, textureTransformMapping, textureCoordinateMapping)
2758
+ {
2759
+ const browser = this .getBrowser ();
2751
2760
 
2752
- gl .activeTexture (gl .TEXTURE0 + transmissionUnit);
2753
- gl .bindTexture (gl .TEXTURE_2D, transmissionBuffer .getColorTexture ());
2754
- gl .uniform1i (shaderObject .x3d_TransmissionFramebufferSamplerEXT, transmissionUnit);
2755
- gl .uniform2i (shaderObject .x3d_TransmissionFramebufferSizeEXT, transmissionBuffer .getWidth (), transmissionBuffer .getHeight ());
2761
+ gl .uniform1f (shaderObject .x3d_TransmissionEXT, this .transmission);
2756
2762
 
2757
- if (!+this .getTextureBits ())
2758
- return;
2763
+ // Transmission framebuffer texture
2759
2764
 
2760
- this .transmissionTextureNode ?.setNamedShaderUniforms (gl,
2761
- shaderObject,
2762
- renderObject,
2763
- shaderObject .x3d_TransmissionTextureEXT,
2764
- this ._transmissionTextureMapping .getValue (),
2765
- textureTransformMapping,
2766
- textureCoordinateMapping);
2767
- },
2765
+ if (renderObject .isTransmission ())
2766
+ {
2767
+ var
2768
+ transmissionBufferTexture = browser .getDefaultTexture2D (),
2769
+ transmissionUnit = browser .getDefaultTexture2DUnit ();
2770
+
2771
+ // Hide object by using a model view matrix with zeros.
2772
+ gl .uniformMatrix4fv (shaderObject .x3d_ModelViewMatrix, false, zeros);
2773
+ gl .uniform2i (shaderObject .x3d_TransmissionFramebufferSizeEXT, 1, 1);
2774
+ }
2775
+ else
2776
+ {
2777
+ var
2778
+ transmissionBuffer = browser .getTransmissionBuffer (),
2779
+ transmissionBufferTexture = transmissionBuffer .getColorTexture (),
2780
+ transmissionUnit = browser .getTexture2DUnit ();
2781
+
2782
+ gl .uniform2i (shaderObject .x3d_TransmissionFramebufferSizeEXT, transmissionBuffer .getWidth (), transmissionBuffer .getHeight ());
2783
+ }
2784
+
2785
+ gl .activeTexture (gl .TEXTURE0 + transmissionUnit);
2786
+ gl .bindTexture (gl .TEXTURE_2D, transmissionBufferTexture);
2787
+ gl .uniform1i (shaderObject .x3d_TransmissionFramebufferSamplerEXT, transmissionUnit);
2788
+
2789
+ if (!+this .getTextureBits ())
2790
+ return;
2791
+
2792
+ this .transmissionTextureNode ?.setNamedShaderUniforms (gl,
2793
+ shaderObject,
2794
+ renderObject,
2795
+ shaderObject .x3d_TransmissionTextureEXT,
2796
+ this ._transmissionTextureMapping .getValue (),
2797
+ textureTransformMapping,
2798
+ textureCoordinateMapping);
2799
+ };
2800
+ })(),
2768
2801
  });
2769
2802
 
2770
2803
  Object .defineProperties (TransmissionMaterialExtension,