x_ite 10.4.2 → 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.
- package/README.md +4 -4
- package/dist/assets/components/AnnotationComponent.js +2 -2
- package/dist/assets/components/AnnotationComponent.min.js +2 -2
- package/dist/assets/components/CADGeometryComponent.js +2 -2
- package/dist/assets/components/CADGeometryComponent.min.js +2 -2
- package/dist/assets/components/CubeMapTexturingComponent.js +2 -2
- package/dist/assets/components/CubeMapTexturingComponent.min.js +2 -2
- package/dist/assets/components/DISComponent.js +2 -2
- package/dist/assets/components/DISComponent.min.js +2 -2
- package/dist/assets/components/EventUtilitiesComponent.js +2 -2
- package/dist/assets/components/EventUtilitiesComponent.min.js +2 -2
- package/dist/assets/components/Geometry2DComponent.js +19 -23
- package/dist/assets/components/Geometry2DComponent.min.js +2 -2
- package/dist/assets/components/GeospatialComponent.js +2 -2
- package/dist/assets/components/GeospatialComponent.min.js +2 -2
- package/dist/assets/components/HAnimComponent.js +2 -2
- package/dist/assets/components/HAnimComponent.min.js +2 -2
- package/dist/assets/components/KeyDeviceSensorComponent.js +2 -2
- package/dist/assets/components/KeyDeviceSensorComponent.min.js +2 -2
- package/dist/assets/components/LayoutComponent.js +2 -6
- package/dist/assets/components/LayoutComponent.min.js +2 -2
- package/dist/assets/components/NURBSComponent.js +805 -770
- package/dist/assets/components/NURBSComponent.min.js +2 -2
- package/dist/assets/components/ParticleSystemsComponent.js +10 -13
- package/dist/assets/components/ParticleSystemsComponent.min.js +2 -2
- package/dist/assets/components/PickingComponent.js +2 -2
- package/dist/assets/components/PickingComponent.min.js +2 -2
- package/dist/assets/components/RigidBodyPhysicsComponent.js +2 -2
- package/dist/assets/components/RigidBodyPhysicsComponent.min.js +2 -2
- package/dist/assets/components/ScriptingComponent.js +2 -2
- package/dist/assets/components/ScriptingComponent.min.js +2 -2
- package/dist/assets/components/TextComponent.js +7 -13
- package/dist/assets/components/TextComponent.min.js +2 -2
- package/dist/assets/components/TextureProjectionComponent.js +2 -2
- package/dist/assets/components/TextureProjectionComponent.min.js +2 -2
- package/dist/assets/components/Texturing3DComponent.js +10 -10
- package/dist/assets/components/Texturing3DComponent.min.js +2 -2
- package/dist/assets/components/VolumeRenderingComponent.js +2 -2
- package/dist/assets/components/VolumeRenderingComponent.min.js +2 -2
- package/dist/assets/components/X_ITEComponent.js +2 -2
- package/dist/assets/components/X_ITEComponent.min.js +2 -2
- package/dist/example.html +1 -1
- package/dist/x_ite.css +1 -1
- package/dist/x_ite.js +483 -308
- package/dist/x_ite.min.js +2 -2
- package/dist/x_ite.min.mjs +2 -2
- package/dist/x_ite.mjs +483 -308
- package/dist/x_ite.zip +0 -0
- package/package.json +3 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/* X_ITE v10.
|
|
2
|
-
const __X_ITE_X3D__ = window [Symbol .for ("X_ITE.X3D-10.
|
|
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.
|
|
2
|
-
const e=window[Symbol.for("X_ITE.X3D-10.4.2")];(()=>{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.
|
|
2
|
-
const __X_ITE_X3D__ = window [Symbol .for ("X_ITE.X3D-10.
|
|
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.
|
|
2
|
-
const e=window[Symbol.for("X_ITE.X3D-10.4.2")];(()=>{var t={n:e=>{var s=e&&e.__esModule?()=>e.default:()=>e;return t.d(s,{a:s}),s},d:(e,s)=>{for(var i in s)t.o(s,i)&&!t.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:s[i]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const s=e.Components;var i=t.n(s);const n=e.Fields;var r=t.n(n);const o=e.X3DFieldDefinition;var a=t.n(o);const u=e.FieldDefinitionArray;var _=t.n(u);const h=e.X3DNode;var c=t.n(h);const d=e.X3DConstants;var l=t.n(d);const p=e.BitSet;var T=t.n(p);const S=e.Namespace;var x=t.n(S);function f(e){c().call(this,e),this.addType(l().X3DMaterialExtensionNode),this.textureBits=new(T())}Object.assign(Object.setPrototypeOf(f.prototype,c().prototype),{setTexture(e,t){e*=4,this.textureBits.remove(e,15),this.textureBits.add(e,t?.getTextureBits()??0)},getTextureBits(){return this.textureBits}}),Object.defineProperties(f,c().getStaticProperties("X3DMaterialExtensionNode","X_ITE",1));const E=f,g=x().add("X3DMaterialExtensionNode",E),O=e.X3DCast;var N=t.n(O);let m=0;const I={ANISOTROPY_MATERIAL_EXTENSION:m++,CLEARCOAT_MATERIAL_EXTENSION:m++,DIFFUSE_TRANSMISSION_EXTENSION:m++,DISPERSION_MATERIAL_EXTENSION:m++,EMISSIVE_STRENGTH_MATERIAL_EXTENSION:m++,IOR_MATERIAL_EXTENSION:m++,IRIDESCENCE_MATERIAL_EXTENSION:m++,SHEEN_MATERIAL_EXTENSION:m++,SPECULAR_MATERIAL_EXTENSION:m++,TRANSMISSION_MATERIAL_EXTENSION:m++,UNLIT_MATERIAL_EXTENSION:m++,VOLUME_MATERIAL_EXTENSION:m++},A=x().add("ExtensionKeys",I);function w(e){g.call(this,e),this.addType(l().AnisotropyMaterialExtension),this.anisotropyArray=new Float32Array(3)}Object.assign(Object.setPrototypeOf(w.prototype,g.prototype),{initialize(){g.prototype.initialize.call(this),this._anisotropyStrength.addInterest("set_anisotropyStrength__",this),this._anisotropyRotation.addInterest("set_anisotropyRotation__",this),this._anisotropyTexture.addInterest("set_anisotropyTexture__",this),this.set_anisotropyStrength__(),this.set_anisotropyRotation__(),this.set_anisotropyTexture__()},set_anisotropyStrength__(){this.anisotropyArray[2]=Math.max(this._anisotropyStrength.getValue(),0)},set_anisotropyRotation__(){const e=this._anisotropyRotation.getValue();this.anisotropyArray[0]=Math.cos(e),this.anisotropyArray[1]=Math.sin(e)},set_anisotropyTexture__(){this.anisotropyTextureNode=N()(l().X3DSingleTextureNode,this._anisotropyTexture),this.setTexture(0,this.anisotropyTextureNode)},getExtensionKey:()=>A.ANISOTROPY_MATERIAL_EXTENSION,getShaderOptions(e){e.push("X3D_ANISOTROPY_MATERIAL_EXT"),+this.getTextureBits()&&(e.push("X3D_MATERIAL_TEXTURES"),this.anisotropyTextureNode?.getShaderOptions(e,"ANISOTROPY",!0))},setShaderUniforms(e,t,s,i,n){e.uniform3fv(t.x3d_AnisotropyEXT,this.anisotropyArray),this.anisotropyTextureNode?.setNamedShaderUniforms(e,t,s,t.x3d_AnisotropyTextureEXT,this._anisotropyTextureMapping.getValue(),i,n)}}),Object.defineProperties(w,{...c().getStaticProperties("AnisotropyMaterialExtension","X_ITE",1,"extensions","4.0"),fieldDefinitions:{value:new(_())([new(a())(l().inputOutput,"metadata",new(r().SFNode)),new(a())(l().inputOutput,"anisotropyStrength",new(r().SFFloat)),new(a())(l().inputOutput,"anisotropyRotation",new(r().SFFloat)),new(a())(l().inputOutput,"anisotropyTextureMapping",new(r().SFString)),new(a())(l().inputOutput,"anisotropyTexture",new(r().SFNode))]),enumerable:!0}});const y=w,C=x().add("AnisotropyMaterialExtension",y),R=e.X3DAppearanceChildNode;var M=t.n(R);function F(e){M().call(this,e),this.addType(l().BlendMode),this.factorTypes=new Map,this.equationTypes=new Map}Object.assign(Object.setPrototypeOf(F.prototype,M().prototype),{initialize(){M().prototype.initialize.call(this);const e=this.getBrowser().getContext(),t=e.getExtension("EXT_blend_minmax");this.factorTypes.set("ZERO",e.ZERO),this.factorTypes.set("ONE",e.ONE),this.factorTypes.set("SRC_COLOR",e.SRC_COLOR),this.factorTypes.set("ONE_MINUS_SRC_COLOR",e.ONE_MINUS_SRC_COLOR),this.factorTypes.set("DST_COLOR",e.DST_COLOR),this.factorTypes.set("ONE_MINUS_DST_COLOR",e.ONE_MINUS_DST_COLOR),this.factorTypes.set("SRC_ALPHA",e.SRC_ALPHA),this.factorTypes.set("ONE_MINUS_SRC_ALPHA",e.ONE_MINUS_SRC_ALPHA),this.factorTypes.set("DST_ALPHA",e.DST_ALPHA),this.factorTypes.set("ONE_MINUS_DST_ALPHA",e.ONE_MINUS_DST_ALPHA),this.factorTypes.set("SRC_ALPHA_SATURATE",e.SRC_ALPHA_SATURATE),this.factorTypes.set("CONSTANT_COLOR",e.CONSTANT_COLOR),this.factorTypes.set("ONE_MINUS_CONSTANT_COLOR",e.ONE_MINUS_CONSTANT_COLOR),this.factorTypes.set("CONSTANT_ALPHA",e.CONSTANT_ALPHA),this.factorTypes.set("ONE_MINUS_CONSTANT_ALPHA",e.ONE_MINUS_CONSTANT_ALPHA),this.equationTypes.set("FUNC_ADD",e.FUNC_ADD),this.equationTypes.set("FUNC_SUBTRACT",e.FUNC_SUBTRACT),this.equationTypes.set("FUNC_REVERSE_SUBTRACT",e.FUNC_REVERSE_SUBTRACT),this.equationTypes.set("MIN",e.MIN||t&&t.MIN_EXT),this.equationTypes.set("MAX",e.MAX||t&&t.MAX_EXT),this._sourceColorFactor.addInterest("set_sourceColorFactor__",this),this._sourceAlphaFactor.addInterest("set_sourceAlphaFactor__",this),this._destinationColorFactor.addInterest("set_destinationColorFactor__",this),this._destinationAlphaFactor.addInterest("set_destinationAlphaFactor__",this),this._colorEquation.addInterest("set_colorEquation__",this),this._alphaEquation.addInterest("set_alphaEquation__",this),this.set_sourceColorFactor__(),this.set_sourceAlphaFactor__(),this.set_destinationColorFactor__(),this.set_destinationAlphaFactor__(),this.set_colorEquation__(),this.set_alphaEquation__()},set_sourceColorFactor__(){this.sourceColorFactorType=this.factorTypes.get(this._sourceColorFactor.getValue())??this.factorTypes.get("SRC_ALPHA")},set_sourceAlphaFactor__(){this.sourceAlphaFactorType=this.factorTypes.get(this._sourceAlphaFactor.getValue())??this.factorTypes.get("ONE")},set_destinationColorFactor__(){this.destinationColorFactorType=this.factorTypes.get(this._destinationColorFactor.getValue())??this.factorTypes.get("ONE_MINUS_SRC_ALPHA")},set_destinationAlphaFactor__(){this.destinationAlphaFactorType=this.factorTypes.get(this._destinationAlphaFactor.getValue())??this.factorTypes.get("ONE_MINUS_SRC_ALPHA")},set_colorEquation__(){this.colorEquationType=this.equationTypes.get(this._colorEquation.getValue())??this.equationTypes.get("FUNC_ADD")},set_alphaEquation__(){this.alphaEquationType=this.equationTypes.get(this._alphaEquation.getValue())??this.equationTypes.get("FUNC_ADD")},enable(e){const t=this._blendColor.getValue();e.blendColor(t.r,t.g,t.b,t.a),e.blendFuncSeparate(this.sourceColorFactorType,this.destinationColorFactorType,this.sourceAlphaFactorType,this.destinationAlphaFactorType),e.blendEquationSeparate(this.colorEquationType,this.alphaEquationType)},disable(e){e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA),e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD)}}),Object.defineProperties(F,{...c().getStaticProperties("BlendMode","X_ITE",1,"blendMode","3.3"),fieldDefinitions:{value:new(_())([new(a())(l().inputOutput,"metadata",new(r().SFNode)),new(a())(l().inputOutput,"blendColor",new(r().SFColorRGBA)),new(a())(l().inputOutput,"sourceColorFactor",new(r().SFString)("SRC_ALPHA")),new(a())(l().inputOutput,"sourceAlphaFactor",new(r().SFString)("ONE")),new(a())(l().inputOutput,"destinationColorFactor",new(r().SFString)("ONE_MINUS_SRC_ALPHA")),new(a())(l().inputOutput,"destinationAlphaFactor",new(r().SFString)("ONE_MINUS_SRC_ALPHA")),new(a())(l().inputOutput,"colorEquation",new(r().SFString)("FUNC_ADD")),new(a())(l().inputOutput,"alphaEquation",new(r().SFString)("FUNC_ADD"))]),enumerable:!0}});const X=F,D=x().add("BlendMode",X),b=e.Algorithm;var L=t.n(b);function U(e){g.call(this,e),this.addType(l().ClearcoatMaterialExtension)}Object.assign(Object.setPrototypeOf(U.prototype,g.prototype),{initialize(){g.prototype.initialize.call(this),this._clearcoat.addInterest("set_clearcoat__",this),this._clearcoatTexture.addInterest("set_clearcoatTexture__",this),this._clearcoatRoughness.addInterest("set_clearcoatRoughness__",this),this._clearcoatRoughnessTexture.addInterest("set_clearcoatRoughnessTexture__",this),this._clearcoatNormalTexture.addInterest("set_clearcoatNormalTexture__",this),this.set_clearcoat__(),this.set_clearcoatTexture__(),this.set_clearcoatRoughness__(),this.set_clearcoatRoughnessTexture__(),this.set_clearcoatNormalTexture__()},set_clearcoat__(){this.clearcoat=Math.max(this._clearcoat.getValue(),0)},set_clearcoatTexture__(){this.clearcoatTextureNode=N()(l().X3DSingleTextureNode,this._clearcoatTexture),this.setTexture(0,this.clearcoatTextureNode)},set_clearcoatRoughness__(){this.clearcoatRoughness=L().clamp(this._clearcoatRoughness.getValue(),0,1)},set_clearcoatRoughnessTexture__(){this.clearcoatRoughnessTextureNode=N()(l().X3DSingleTextureNode,this._clearcoatRoughnessTexture),this.setTexture(1,this.clearcoatRoughnessTextureNode)},set_clearcoatNormalTexture__(){this.clearcoatNormalTextureNode=N()(l().X3DSingleTextureNode,this._clearcoatNormalTexture),this.setTexture(2,this.clearcoatNormalTextureNode)},getExtensionKey:()=>A.CLEARCOAT_MATERIAL_EXTENSION,getShaderOptions(e){e.push("X3D_CLEARCOAT_MATERIAL_EXT"),+this.getTextureBits()&&(e.push("X3D_MATERIAL_TEXTURES"),this.clearcoatTextureNode?.getShaderOptions(e,"CLEARCOAT",!0),this.clearcoatRoughnessTextureNode?.getShaderOptions(e,"CLEARCOAT_ROUGHNESS",!0),this.clearcoatNormalTextureNode?.getShaderOptions(e,"CLEARCOAT_NORMAL",!0))},setShaderUniforms(e,t,s,i,n){e.uniform1f(t.x3d_ClearcoatEXT,this.clearcoat),e.uniform1f(t.x3d_ClearcoatRoughnessEXT,this.clearcoatRoughness),+this.getTextureBits()&&(this.clearcoatTextureNode?.setNamedShaderUniforms(e,t,s,t.x3d_ClearcoatTextureEXT,this._clearcoatTextureMapping.getValue(),i,n),this.clearcoatRoughnessTextureNode?.setNamedShaderUniforms(e,t,s,t.x3d_ClearcoatRoughnessTextureEXT,this._clearcoatRoughnessTextureMapping.getValue(),i,n),this.clearcoatNormalTextureNode?.setNamedShaderUniforms(e,t,s,t.x3d_ClearcoatNormalTextureEXT,this._clearcoatNormalTextureMapping.getValue(),i,n))}}),Object.defineProperties(U,{...c().getStaticProperties("ClearcoatMaterialExtension","X_ITE",1,"extensions","4.0"),fieldDefinitions:{value:new(_())([new(a())(l().inputOutput,"metadata",new(r().SFNode)),new(a())(l().inputOutput,"clearcoat",new(r().SFFloat)),new(a())(l().inputOutput,"clearcoatTextureMapping",new(r().SFString)),new(a())(l().inputOutput,"clearcoatTexture",new(r().SFNode)),new(a())(l().inputOutput,"clearcoatRoughness",new(r().SFFloat)),new(a())(l().inputOutput,"clearcoatRoughnessTextureMapping",new(r().SFString)),new(a())(l().inputOutput,"clearcoatRoughnessTexture",new(r().SFNode)),new(a())(l().inputOutput,"clearcoatNormalTextureMapping",new(r().SFString)),new(a())(l().inputOutput,"clearcoatNormalTexture",new(r().SFNode))]),enumerable:!0}});const P=U,V=x().add("ClearcoatMaterialExtension",P);function v(e){M().call(this,e),this.addType(l().DepthMode),this.addAlias("depthFunc",this._depthFunction)}Object.assign(Object.setPrototypeOf(v.prototype,M().prototype),{initialize(){M().prototype.initialize.call(this),this._depthFunction.addInterest("set_depthFunction__",this),this.set_depthFunction__()},set_depthFunction__:function(){const e=new Map([["NEVER","NEVER"],["LESS","LESS"],["EQUAL","EQUAL"],["LESS_EQUAL","LEQUAL"],["GREATER","GREATER"],["NOT_EQUAL","NOTEQUAL"],["GREATER_EQUAL","GEQUAL"],["ALWAYS","ALWAYS"]]);return function(){const t=this.getBrowser().getContext();this.depthFunction=t[e.get(this._depthFunction.getValue())??"LEQUAL"]}}(),enable(e){this.depthTest=e.isEnabled(e.DEPTH_TEST),this.depthWriteMask=e.getParameter(e.DEPTH_WRITEMASK),e.enable(e.POLYGON_OFFSET_FILL),e.polygonOffset(...this._polygonOffset),this._depthTest.getValue()?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST),e.depthFunc(this.depthFunction),e.depthRange(...this._depthRange.getValue()),e.depthMask(this._depthMask.getValue())},disable(e){e.disable(e.POLYGON_OFFSET_FILL),this.depthTest?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST),e.depthFunc(e.LEQUAL),e.depthRange(0,1),e.depthMask(this.depthWriteMask)}}),Object.defineProperties(v,{...c().getStaticProperties("DepthMode","X_ITE",1,"depthMode","4.0"),fieldDefinitions:{value:new(_())([new(a())(l().inputOutput,"metadata",new(r().SFNode)),new(a())(l().inputOutput,"polygonOffset",new(r().SFVec2f)),new(a())(l().inputOutput,"depthRange",new(r().SFVec2f)(0,1)),new(a())(l().inputOutput,"depthTest",new(r().SFBool)(!0)),new(a())(l().inputOutput,"depthFunction",new(r().SFString)("LESS_EQUAL")),new(a())(l().inputOutput,"depthMask",new(r().SFBool)(!0))]),enumerable:!0}});const B=v,k=x().add("DepthMode",B);function j(e){g.call(this,e),this.addType(l().DiffuseTransmissionMaterialExtension),this.diffuseTransmissionColorArray=new Float32Array(3)}Object.assign(Object.setPrototypeOf(j.prototype,g.prototype),{initialize(){g.prototype.initialize.call(this),this._diffuseTransmission.addInterest("set_diffuseTransmission__",this),this._diffuseTransmissionTexture.addInterest("set_diffuseTransmissionTexture__",this),this._diffuseTransmissionColor.addInterest("set_diffuseTransmissionColor__",this),this._diffuseTransmissionColorTexture.addInterest("set_diffuseTransmissionColorTexture__",this),this.set_diffuseTransmission__(),this.set_diffuseTransmissionTexture__(),this.set_diffuseTransmissionColor__(),this.set_diffuseTransmissionColorTexture__()},set_diffuseTransmission__(){this.diffuseTransmission=Math.max(this._diffuseTransmission.getValue(),0)},set_diffuseTransmissionTexture__(){this.diffuseTransmissionTextureNode=N()(l().X3DSingleTextureNode,this._diffuseTransmissionTexture),this.setTexture(0,this.diffuseTransmissionTextureNode)},set_diffuseTransmissionColor__(){const e=this.diffuseTransmissionColorArray,t=this._diffuseTransmissionColor.getValue();e[0]=t.r,e[1]=t.g,e[2]=t.b},set_diffuseTransmissionColorTexture__(){this.diffuseTransmissionColorTextureNode=N()(l().X3DSingleTextureNode,this._diffuseTransmissionColorTexture),this.setTexture(1,this.diffuseTransmissionColorTextureNode)},getExtensionKey:()=>A.DIFFUSE_TRANSMISSION_EXTENSION,getShaderOptions(e){e.push("X3D_DIFFUSE_TRANSMISSION_MATERIAL_EXT"),+this.getTextureBits()&&(e.push("X3D_MATERIAL_TEXTURES"),this.diffuseTransmissionTextureNode?.getShaderOptions(e,"DIFFUSE_TRANSMISSION",!0),this.diffuseTransmissionColorTextureNode?.getShaderOptions(e,"DIFFUSE_TRANSMISSION_COLOR",!0))},setShaderUniforms(e,t,s,i,n){e.uniform1f(t.x3d_DiffuseTransmissionEXT,this.diffuseTransmission),e.uniform3fv(t.x3d_DiffuseTransmissionColorEXT,this.diffuseTransmissionColorArray),+this.getTextureBits()&&(this.diffuseTransmissionTextureNode?.setNamedShaderUniforms(e,t,s,t.x3d_DiffuseTransmissionTextureEXT,this._diffuseTransmissionTextureMapping.getValue(),i,n),this.diffuseTransmissionColorTextureNode?.setNamedShaderUniforms(e,t,s,t.x3d_DiffuseTransmissionColorTextureEXT,this._diffuseTransmissionColorTextureMapping.getValue(),i,n))}}),Object.defineProperties(j,{...c().getStaticProperties("DiffuseTransmissionMaterialExtension","X_ITE",1,"extensions","4.0"),fieldDefinitions:{value:new(_())([new(a())(l().inputOutput,"metadata",new(r().SFNode)),new(a())(l().inputOutput,"diffuseTransmission",new(r().SFFloat)),new(a())(l().inputOutput,"diffuseTransmissionTextureMapping",new(r().SFString)),new(a())(l().inputOutput,"diffuseTransmissionTexture",new(r().SFNode)),new(a())(l().inputOutput,"diffuseTransmissionColor",new(r().SFColor)(1,1,1)),new(a())(l().inputOutput,"diffuseTransmissionColorTextureMapping",new(r().SFString)),new(a())(l().inputOutput,"diffuseTransmissionColorTexture",new(r().SFNode))]),enumerable:!0}});const G=j,H=x().add("DiffuseTransmissionMaterialExtension",G);function z(e){g.call(this,e),this.addType(l().DispersionMaterialExtension)}Object.assign(Object.setPrototypeOf(z.prototype,g.prototype),{initialize(){g.prototype.initialize.call(this),this._dispersion.addInterest("set_dispersion__",this),this.set_dispersion__()},set_dispersion__(){this.dispersion=Math.max(this._dispersion.getValue(),0)},getExtensionKey:()=>A.DISPERSION_MATERIAL_EXTENSION,getShaderOptions(e){e.push("X3D_DISPERSION_MATERIAL_EXT")},setShaderUniforms(e,t,s,i,n){e.uniform1f(t.x3d_DispersionEXT,this.dispersion)}}),Object.defineProperties(z,{...c().getStaticProperties("DispersionMaterialExtension","X_ITE",1,"extensions","4.0"),fieldDefinitions:{value:new(_())([new(a())(l().inputOutput,"metadata",new(r().SFNode)),new(a())(l().inputOutput,"dispersion",new(r().SFFloat))]),enumerable:!0}});const q=z,K=x().add("DispersionMaterialExtension",q);function Y(e){g.call(this,e),this.addType(l().EmissiveStrengthMaterialExtension)}Object.assign(Object.setPrototypeOf(Y.prototype,g.prototype),{initialize(){g.prototype.initialize.call(this),this._emissiveStrength.addInterest("set_emissiveStrength__",this),this.set_emissiveStrength__()},set_emissiveStrength__(){this.emissiveStrength=Math.max(this._emissiveStrength.getValue(),0)},getExtensionKey:()=>A.EMISSIVE_STRENGTH_MATERIAL_EXTENSION,getShaderOptions(e){e.push("X3D_EMISSIVE_STRENGTH_MATERIAL_EXT")},setShaderUniforms(e,t,s,i,n){e.uniform1f(t.x3d_EmissiveStrengthEXT,this.emissiveStrength)}}),Object.defineProperties(Y,{...c().getStaticProperties("EmissiveStrengthMaterialExtension","X_ITE",1,"extensions","4.0"),fieldDefinitions:{value:new(_())([new(a())(l().inputOutput,"metadata",new(r().SFNode)),new(a())(l().inputOutput,"emissiveStrength",new(r().SFFloat)(1))]),enumerable:!0}});const Q=Y,W=x().add("EmissiveStrengthMaterialExtension",Q),$=e.X3DShapeNode;var Z=t.n($);const J=e.TraverseType;var ee=t.n(J);const te=e.VertexArray;var se=t.n(te);const ie=e.Vector3;var ne=t.n(ie);const re=e.Matrix4;var oe=t.n(re);const ae=e.Box3;var ue=t.n(ae);function _e(e){Z().call(this,e),this.addType(l().InstancedShape),this.addChildObjects(l().outputOnly,"matrices",new(r().SFTime)),this.min=new(ne()),this.max=new(ne()),this.scale=new(ne())(1,1,1),this.numInstances=0,this.instancesStride=25*Float32Array.BYTES_PER_ELEMENT,this.matrixOffset=0,this.normalMatrixOffset=16*Float32Array.BYTES_PER_ELEMENT}Object.assign(Object.setPrototypeOf(_e.prototype,Z().prototype),{initialize(){Z().prototype.initialize.call(this);const e=this.getBrowser(),t=e.getContext();e.getContext().getVersion()<2||(this.instances=Object.assign(t.createBuffer(),{vertexArrayObject:new(se())(t),thickLinesVertexArrayObject:new(se())(t),lineTrianglesBuffer:t.createBuffer(),numLines:0}),this._translations.addInterest("set_transform__",this),this._rotations.addInterest("set_transform__",this),this._scales.addInterest("set_transform__",this),this._scaleOrientations.addInterest("set_transform__",this),this._centers.addInterest("set_transform__",this),this._matrices.addInterest("set_matrices__",this),this.set_transform__())},getShapeKey:()=>3,getNumInstances(){return this.numInstances},getInstances(){return this.instances},set_bbox__:function(){const e=new(ne()),t=new(ne()),s=new(ue());return function(){if(this.numInstances)if(this._bboxSize.getValue().equals(this.getDefaultBBoxSize())){this.getGeometry()?s.assign(this.getGeometry().getBBox()):s.set();const i=s.size.multiply(this.scale.magnitude()/2),n=s.center;e.assign(this.min).add(n).subtract(i),t.assign(this.max).add(n).add(i),this.bbox.setExtents(e,t)}else this.bbox.set(this._bboxSize.getValue(),this._bboxCenter.getValue());else this.bbox.set();this.getBBoxSize().assign(this.bbox.size),this.getBBoxCenter().assign(this.bbox.center)}}(),set_transform__(){this._matrices=this.getBrowser().getCurrentTime()},set_matrices__(){const e=this.getBrowser().getContext(),t=this._translations,s=this._rotations,i=this._scales,n=this._scaleOrientations,r=this._centers,o=t.length,a=s.length,u=i.length,_=n.length,h=r.length,c=Math.max(o,a,u,_,h),d=this.instancesStride/Float32Array.BYTES_PER_ELEMENT,l=this.instancesStride*c,p=new Float32Array(l),T=new(oe());this.numInstances=c;const S=this.min.set(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),x=this.max.set(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY),f=this.scale.assign(u?x:ne().One);for(let e=0,l=0;e<c;++e,l+=d)T.set(o?t[Math.min(e,o-1)].getValue():null,a?s[Math.min(e,a-1)].getValue():null,u?i[Math.min(e,u-1)].getValue():null,_?n[Math.min(e,_-1)].getValue():null,h?r[Math.min(e,h-1)].getValue():null),u&&f.max(i[Math.min(e,u-1)].getValue()),p.set(T,l),p.set(T.submatrix.transpose().inverse(),l+16),S.min(T.origin),x.max(T.origin);e.bindBuffer(e.ARRAY_BUFFER,this.instances),e.bufferData(e.ARRAY_BUFFER,p,e.DYNAMIC_DRAW),this.set_bbox__()},set_geometry__(){Z().prototype.set_geometry__.call(this),this.getGeometry()?delete this.traverse:this.traverse=Function.prototype,this.set_transform__()},intersectsBox(e,t,s){},traverse(e,t){if(this.numInstances){switch(e){case ee().POINTER:this._pointerEvents.getValue()&&t.addPointingShape(this);break;case ee().PICKING:break;case ee().COLLISION:t.addCollisionShape(this);break;case ee().SHADOW:this._castShadow.getValue()&&t.addShadowShape(this);break;case ee().DISPLAY:t.addDisplayShape(this)&&this.getAppearance().traverse(e,t)}this.getGeometry().traverse(e,t)}},displaySimple(e,t,s){this.getGeometry().displaySimpleInstanced(e,s,this)},display(e,t){this.getGeometry().displayInstanced(e,t,this)}}),Object.defineProperties(_e,{...c().getStaticProperties("InstancedShape","X_ITE",1,"children","2.0"),fieldDefinitions:{value:new(_())([new(a())(l().inputOutput,"metadata",new(r().SFNode)),new(a())(l().inputOutput,"translations",new(r().MFVec3f)),new(a())(l().inputOutput,"rotations",new(r().MFRotation)),new(a())(l().inputOutput,"scales",new(r().MFVec3f)),new(a())(l().inputOutput,"scaleOrientations",new(r().MFRotation)),new(a())(l().inputOutput,"centers",new(r().MFVec3f)),new(a())(l().inputOutput,"pointerEvents",new(r().SFBool)(!0)),new(a())(l().inputOutput,"castShadow",new(r().SFBool)(!0)),new(a())(l().inputOutput,"visible",new(r().SFBool)(!0)),new(a())(l().inputOutput,"bboxDisplay",new(r().SFBool)),new(a())(l().initializeOnly,"bboxSize",new(r().SFVec3f)(-1,-1,-1)),new(a())(l().initializeOnly,"bboxCenter",new(r().SFVec3f)),new(a())(l().inputOutput,"appearance",new(r().SFNode)),new(a())(l().inputOutput,"geometry",new(r().SFNode))]),enumerable:!0}});const he=_e,ce=x().add("InstancedShape",he);function de(e){g.call(this,e),this.addType(l().IORMaterialExtension)}Object.assign(Object.setPrototypeOf(de.prototype,g.prototype),{initialize(){g.prototype.initialize.call(this),this._indexOfRefraction.addInterest("set_indexOfRefraction__",this),this.set_indexOfRefraction__()},set_indexOfRefraction__(){this.indexOfRefraction=Math.max(this._indexOfRefraction.getValue(),1)},getExtensionKey:()=>A.IOR_MATERIAL_EXTENSION,getShaderOptions(e){e.push("X3D_IOR_MATERIAL_EXT")},setShaderUniforms(e,t,s,i,n){e.uniform1f(t.x3d_IorEXT,this.indexOfRefraction)}}),Object.defineProperties(de,{...c().getStaticProperties("IORMaterialExtension","X_ITE",1,"extensions","4.0"),fieldDefinitions:{value:new(_())([new(a())(l().inputOutput,"metadata",new(r().SFNode)),new(a())(l().inputOutput,"indexOfRefraction",new(r().SFFloat)(1.5))]),enumerable:!0}});const le=de,pe=x().add("IORMaterialExtension",le);function Te(e){g.call(this,e),this.addType(l().IridescenceMaterialExtension)}Object.assign(Object.setPrototypeOf(Te.prototype,g.prototype),{initialize(){g.prototype.initialize.call(this),this._iridescence.addInterest("set_iridescence__",this),this._iridescenceTexture.addInterest("set_iridescenceTexture__",this),this._iridescenceIndexOfRefraction.addInterest("set_iridescenceIndexOfRefraction__",this),this._iridescenceThicknessMinimum.addInterest("set_iridescenceThicknessMinimum__",this),this._iridescenceThicknessMaximum.addInterest("set_iridescenceThicknessMaximum__",this),this._iridescenceThicknessTexture.addInterest("set_iridescenceThicknessTexture__",this),this.set_iridescence__(),this.set_iridescenceTexture__(),this.set_iridescenceIndexOfRefraction__(),this.set_iridescenceThicknessMinimum__(),this.set_iridescenceThicknessMaximum__(),this.set_iridescenceThicknessTexture__()},set_iridescence__(){this.iridescence=Math.max(this._iridescence.getValue(),0)},set_iridescenceTexture__(){this.iridescenceTextureNode=N()(l().X3DSingleTextureNode,this._iridescenceTexture),this.setTexture(0,this.iridescenceTextureNode)},set_iridescenceIndexOfRefraction__(){this.iridescenceIndexOfRefraction=Math.max(this._iridescenceIndexOfRefraction.getValue(),1)},set_iridescenceThicknessMinimum__(){this.iridescenceThicknessMinimum=Math.max(this._iridescenceThicknessMinimum.getValue(),0)},set_iridescenceThicknessMaximum__(){this.iridescenceThicknessMaximum=Math.max(this._iridescenceThicknessMaximum.getValue(),0)},set_iridescenceThicknessTexture__(){this.iridescenceThicknessTextureNode=N()(l().X3DSingleTextureNode,this._iridescenceThicknessTexture),this.setTexture(1,this.iridescenceThicknessTextureNode)},getExtensionKey:()=>A.IRIDESCENCE_MATERIAL_EXTENSION,getShaderOptions(e){e.push("X3D_IRIDESCENCE_MATERIAL_EXT"),+this.getTextureBits()&&(e.push("X3D_MATERIAL_TEXTURES"),this.iridescenceTextureNode?.getShaderOptions(e,"IRIDESCENCE",!0),this.iridescenceThicknessTextureNode?.getShaderOptions(e,"IRIDESCENCE_THICKNESS",!0))},setShaderUniforms(e,t,s,i,n){e.uniform1f(t.x3d_IridescenceEXT,this.iridescence),e.uniform1f(t.x3d_IridescenceIndexOfRefractionEXT,this.iridescenceIndexOfRefraction),e.uniform1f(t.x3d_IridescenceThicknessMinimumEXT,this.iridescenceThicknessMinimum),e.uniform1f(t.x3d_IridescenceThicknessMaximumEXT,this.iridescenceThicknessMaximum),+this.getTextureBits()&&(this.iridescenceTextureNode?.setNamedShaderUniforms(e,t,s,t.x3d_IridescenceTextureEXT,this._iridescenceTextureMapping.getValue(),i,n),this.iridescenceThicknessTextureNode?.setNamedShaderUniforms(e,t,s,t.x3d_IridescenceThicknessTextureEXT,this._iridescenceThicknessTextureMapping.getValue(),i,n))}}),Object.defineProperties(Te,{...c().getStaticProperties("IridescenceMaterialExtension","X_ITE",1,"extensions","4.0"),fieldDefinitions:{value:new(_())([new(a())(l().inputOutput,"metadata",new(r().SFNode)),new(a())(l().inputOutput,"iridescence",new(r().SFFloat)),new(a())(l().inputOutput,"iridescenceTextureMapping",new(r().SFString)),new(a())(l().inputOutput,"iridescenceTexture",new(r().SFNode)),new(a())(l().inputOutput,"iridescenceIndexOfRefraction",new(r().SFFloat)(1.3)),new(a())(l().inputOutput,"iridescenceThicknessMinimum",new(r().SFFloat)(100)),new(a())(l().inputOutput,"iridescenceThicknessMaximum",new(r().SFFloat)(400)),new(a())(l().inputOutput,"iridescenceThicknessTextureMapping",new(r().SFString)),new(a())(l().inputOutput,"iridescenceThicknessTexture",new(r().SFNode))]),enumerable:!0}});const Se=Te,xe=x().add("IridescenceMaterialExtension",Se);function fe(e){g.call(this,e),this.addType(l().SheenMaterialExtension),this.sheenColorArray=new Float32Array(3)}Object.assign(Object.setPrototypeOf(fe.prototype,g.prototype),{initialize(){g.prototype.initialize.call(this),this._sheenColor.addInterest("set_sheenColor__",this),this._sheenColorTexture.addInterest("set_sheenColorTexture__",this),this._sheenRoughness.addInterest("set_sheenRoughness__",this),this._sheenRoughnessTexture.addInterest("set_sheenRoughnessTexture__",this),this.set_sheenColor__(),this.set_sheenColorTexture__(),this.set_sheenRoughness__(),this.set_sheenRoughnessTexture__()},set_sheenColor__(){const e=this.sheenColorArray,t=this._sheenColor.getValue();e[0]=t.r,e[1]=t.g,e[2]=t.b},set_sheenColorTexture__(){this.sheenColorTextureNode=N()(l().X3DSingleTextureNode,this._sheenColorTexture),this.setTexture(0,this.sheenColorTextureNode)},set_sheenRoughness__(){this.sheenRoughness=L().clamp(this._sheenRoughness.getValue(),0,1)},set_sheenRoughnessTexture__(){this.sheenRoughnessTextureNode=N()(l().X3DSingleTextureNode,this._sheenRoughnessTexture),this.setTexture(1,this.sheenRoughnessTextureNode)},getExtensionKey:()=>A.SHEEN_MATERIAL_EXTENSION,getShaderOptions(e){e.push("X3D_SHEEN_MATERIAL_EXT"),+this.getTextureBits()&&(e.push("X3D_MATERIAL_TEXTURES"),this.sheenColorTextureNode?.getShaderOptions(e,"SHEEN_COLOR",!0),this.sheenRoughnessTextureNode?.getShaderOptions(e,"SHEEN_ROUGHNESS",!0))},setShaderUniforms(e,t,s,i,n){e.uniform3fv(t.x3d_SheenColorEXT,this.sheenColorArray),e.uniform1f(t.x3d_SheenRoughnessEXT,this.sheenRoughness);const r=this.getBrowser(),o=r.getLibraryTexture("lut_sheen_E.png"),a=r.getTexture2DUnit();e.activeTexture(e.TEXTURE0+a),e.bindTexture(e.TEXTURE_2D,o.getTexture()),e.uniform1i(t.x3d_SheenELUTTextureEXT,a),+this.getTextureBits()&&(this.sheenColorTextureNode?.setNamedShaderUniforms(e,t,s,t.x3d_SheenColorTextureEXT,this._sheenColorTextureMapping.getValue(),i,n),this.sheenRoughnessTextureNode?.setNamedShaderUniforms(e,t,s,t.x3d_SheenRoughnessTextureEXT,this._sheenRoughnessTextureMapping.getValue(),i,n))}}),Object.defineProperties(fe,{...c().getStaticProperties("SheenMaterialExtension","X_ITE",1,"extensions","4.0"),fieldDefinitions:{value:new(_())([new(a())(l().inputOutput,"metadata",new(r().SFNode)),new(a())(l().inputOutput,"sheenColor",new(r().SFColor)),new(a())(l().inputOutput,"sheenColorTextureMapping",new(r().SFString)),new(a())(l().inputOutput,"sheenColorTexture",new(r().SFNode)),new(a())(l().inputOutput,"sheenRoughness",new(r().SFFloat)),new(a())(l().inputOutput,"sheenRoughnessTextureMapping",new(r().SFString)),new(a())(l().inputOutput,"sheenRoughnessTexture",new(r().SFNode))]),enumerable:!0}});const Ee=fe,ge=x().add("SheenMaterialExtension",Ee),Oe=e.X3DOneSidedMaterialNode;var Ne=t.n(Oe);function me(e){console.warn("SpecularGlossinessMaterial is depreciated, please use PhysicalMaterial instead."),Ne().call(this,e),this.addType(l().SpecularGlossinessMaterial),this.materialKey="4/",this.diffuseColorArray=new Float32Array(3),this.specularColorArray=new Float32Array(3),this.extensionNodes=[]}Object.assign(Object.setPrototypeOf(me.prototype,Ne().prototype),{initialize(){Ne().prototype.initialize.call(this),this._diffuseColor.addInterest("set_diffuseColor__",this),this._diffuseTexture.addInterest("set_diffuseTexture__",this),this._diffuseTexture.addInterest("set_transparent__",this),this._specularColor.addInterest("set_specularColor__",this),this._glossiness.addInterest("set_glossiness__",this),this._specularGlossinessTexture.addInterest("set_specularGlossinessTexture__",this),this._occlusionStrength.addInterest("set_occlusionStrength__",this),this._occlusionTexture.addInterest("set_occlusionTexture__",this),this._extensions.addInterest("set_extensions__",this),this.set_diffuseColor__(),this.set_diffuseTexture__(),this.set_specularColor__(),this.set_glossiness__(),this.set_specularGlossinessTexture__(),this.set_occlusionStrength__(),this.set_occlusionTexture__(),this.set_extensions__(),this.set_transparent__()},getMaterialKey(){return this.materialKey},getTextureIndices:(()=>{let e=0;const t={DIFFUSE_TEXTURE:e++,SPECULAR_GLOSSINESS_TEXTURE:e++,EMISSIVE_TEXTURE:e++,OCCLUSION_TEXTURE:e++,NORMAL_TEXTURE:e++};return function(){return t}})(),getBaseTexture(){return this.diffuseTextureNode},set_diffuseColor__(){const e=this.diffuseColorArray,t=this._diffuseColor.getValue();e[0]=t.r,e[1]=t.g,e[2]=t.b},set_diffuseTexture__(){const e=this.getTextureIndices().DIFFUSE_TEXTURE;this.diffuseTextureNode&&(this.diffuseTextureNode._transparent.removeInterest("set_transparent__",this),this.diffuseTextureNode._linear.removeInterest(`setTexture${e}`,this)),this.diffuseTextureNode=N()(l().X3DSingleTextureNode,this._diffuseTexture),this.diffuseTextureNode&&(this.diffuseTextureNode._transparent.addInterest("set_transparent__",this),this.diffuseTextureNode._linear.addInterest(`setTexture${e}`,this,e,this.diffuseTextureNode)),this.setTexture(e,this.diffuseTextureNode)},set_specularColor__(){const e=this.specularColorArray,t=this._specularColor.getValue();e[0]=t.r,e[1]=t.g,e[2]=t.b},set_glossiness__(){this.glossiness=L().clamp(this._glossiness.getValue(),0,1)},set_specularGlossinessTexture__(){this.specularGlossinessTextureNode=N()(l().X3DSingleTextureNode,this._specularGlossinessTexture),this.setTexture(this.getTextureIndices().SPECULAR_GLOSSINESS_TEXTURE,this.specularGlossinessTextureNode)},set_occlusionStrength__(){this.occlusionStrength=L().clamp(this._occlusionStrength.getValue(),0,1)},set_occlusionTexture__(){this.occlusionTextureNode=N()(l().X3DSingleTextureNode,this._occlusionTexture),this.setTexture(this.getTextureIndices().OCCLUSION_TEXTURE,this.occlusionTextureNode)},set_transparent__(){this.setTransparent(this.getTransparency()||this.diffuseTextureNode?.isTransparent())},set_extensions__(){const e=this.extensionNodes;for(const t of e)t.removeInterest("set_extensionsKey__",this);e.length=0;for(const t of this._extensions){const s=N()(l().X3DMaterialExtensionNode,t);s&&e.push(s)}e.sort(((e,t)=>e.getExtensionKey()-t.getExtensionKey()));for(const t of e)t.addInterest("set_extensionsKey__",this);this.setTransmission(e.some((e=>e.getType().includes(l().TransmissionMaterialExtension)))),this.set_extensionsKey__()},set_extensionsKey__(){const e=this.extensionNodes.map((e=>`${e.getExtensionKey().toString(16)}${e.getTextureBits().toString(16)}`)).join("");this.materialKey=`[4.${e}]`},createShader(e,t,s){const i=this.getBrowser(),n=this.getShaderOptions(t,s);for(const e of this.extensionNodes)e.getShaderOptions(n);n.push("X3D_PHYSICAL_MATERIAL","X3D_MATERIAL_SPECULAR_GLOSSINESS"),+this.getTextureBits()&&(this.diffuseTextureNode?.getShaderOptions(n,"DIFFUSE"),this.specularGlossinessTextureNode?.getShaderOptions(n,"SPECULAR_GLOSSINESS"),this.occlusionTextureNode?.getShaderOptions(n,"OCCLUSION"));const r=i.createShader("SpecularGlossiness","Default","Physical",n);return i.getShaders().set(e,r),r},setShaderUniforms(e,t,s,i,n){Ne().prototype.setShaderUniforms.call(this,e,t,s,i,n);for(const r of this.extensionNodes)r.setShaderUniforms(e,t,s,i,n);e.uniform3fv(t.x3d_DiffuseColor,this.diffuseColorArray),e.uniform3fv(t.x3d_SpecularColor,this.specularColorArray),e.uniform1f(t.x3d_Glossiness,this.glossiness),+this.getTextureBits()&&(this.diffuseTextureNode?.setNamedShaderUniforms(e,t,s,t.x3d_DiffuseTexture,this._diffuseTextureMapping.getValue(),i,n),this.specularGlossinessTextureNode?.setNamedShaderUniforms(e,t,s,t.x3d_SpecularGlossinessTexture,this._specularGlossinessTextureMapping.getValue(),i,n),this.occlusionTextureNode&&e.uniform1f(t.x3d_OcclusionStrength,this.occlusionStrength),this.occlusionTextureNode?.setNamedShaderUniforms(e,t,s,t.x3d_OcclusionTexture,this._occlusionTextureMapping.getValue(),i,n))}}),Object.defineProperties(me,{...c().getStaticProperties("SpecularGlossinessMaterial","X_ITE",1,"material","4.0"),fieldDefinitions:{value:new(_())([new(a())(l().inputOutput,"metadata",new(r().SFNode)),new(a())(l().inputOutput,"diffuseColor",new(r().SFColor)(1,1,1)),new(a())(l().inputOutput,"diffuseTextureMapping",new(r().SFString)),new(a())(l().inputOutput,"diffuseTexture",new(r().SFNode)),new(a())(l().inputOutput,"specularColor",new(r().SFColor)(1,1,1)),new(a())(l().inputOutput,"glossiness",new(r().SFFloat)(1)),new(a())(l().inputOutput,"specularGlossinessTextureMapping",new(r().SFString)),new(a())(l().inputOutput,"specularGlossinessTexture",new(r().SFNode)),new(a())(l().inputOutput,"emissiveColor",new(r().SFColor)),new(a())(l().inputOutput,"emissiveTextureMapping",new(r().SFString)),new(a())(l().inputOutput,"emissiveTexture",new(r().SFNode)),new(a())(l().inputOutput,"occlusionStrength",new(r().SFFloat)(1)),new(a())(l().inputOutput,"occlusionTextureMapping",new(r().SFString)),new(a())(l().inputOutput,"occlusionTexture",new(r().SFNode)),new(a())(l().inputOutput,"normalScale",new(r().SFFloat)(1)),new(a())(l().inputOutput,"normalTextureMapping",new(r().SFString)),new(a())(l().inputOutput,"normalTexture",new(r().SFNode)),new(a())(l().inputOutput,"transparency",new(r().SFFloat)),new(a())(l().inputOutput,"extensions",new(r().MFNode))]),enumerable:!0}});for(const e of Object.values(me.prototype.getTextureIndices()))me.prototype[`setTexture${e}`]=function(e,t){this.setTexture(e,t)};const Ie=me,Ae=x().add("SpecularGlossinessMaterial",Ie);function we(e){g.call(this,e),this.addType(l().SpecularMaterialExtension),this.specularColorArray=new Float32Array(3)}Object.assign(Object.setPrototypeOf(we.prototype,g.prototype),{initialize(){g.prototype.initialize.call(this),this._specular.addInterest("set_specular__",this),this._specularTexture.addInterest("set_specularTexture__",this),this._specularColor.addInterest("set_specularColor__",this),this._specularColorTexture.addInterest("set_specularColorTexture__",this),this.set_specular__(),this.set_specularTexture__(),this.set_specularColor__(),this.set_specularColorTexture__()},set_specular__(){this.specular=Math.max(this._specular.getValue(),0)},set_specularTexture__(){this.specularTextureNode=N()(l().X3DSingleTextureNode,this._specularTexture),this.setTexture(0,this.specularTextureNode)},set_specularColor__(){const e=this.specularColorArray,t=this._specularColor.getValue();e[0]=t.r,e[1]=t.g,e[2]=t.b},set_specularColorTexture__(){this.specularColorTextureNode=N()(l().X3DSingleTextureNode,this._specularColorTexture),this.setTexture(1,this.specularColorTextureNode)},getExtensionKey:()=>A.SPECULAR_MATERIAL_EXTENSION,getShaderOptions(e){e.push("X3D_SPECULAR_MATERIAL_EXT"),+this.getTextureBits()&&(e.push("X3D_MATERIAL_TEXTURES"),this.specularTextureNode?.getShaderOptions(e,"SPECULAR",!0),this.specularColorTextureNode?.getShaderOptions(e,"SPECULAR_COLOR",!0))},setShaderUniforms(e,t,s,i,n){e.uniform1f(t.x3d_SpecularEXT,this.specular),e.uniform3fv(t.x3d_SpecularColorEXT,this.specularColorArray),+this.getTextureBits()&&(this.specularTextureNode?.setNamedShaderUniforms(e,t,s,t.x3d_SpecularTextureEXT,this._specularTextureMapping.getValue(),i,n),this.specularColorTextureNode?.setNamedShaderUniforms(e,t,s,t.x3d_SpecularColorTextureEXT,this._specularColorTextureMapping.getValue(),i,n))}}),Object.defineProperties(we,{...c().getStaticProperties("SpecularMaterialExtension","X_ITE",1,"extensions","4.0"),fieldDefinitions:{value:new(_())([new(a())(l().inputOutput,"metadata",new(r().SFNode)),new(a())(l().inputOutput,"specular",new(r().SFFloat)(1)),new(a())(l().inputOutput,"specularTextureMapping",new(r().SFString)),new(a())(l().inputOutput,"specularTexture",new(r().SFNode)),new(a())(l().inputOutput,"specularColor",new(r().SFColor)(1,1,1)),new(a())(l().inputOutput,"specularColorTextureMapping",new(r().SFString)),new(a())(l().inputOutput,"specularColorTexture",new(r().SFNode))]),enumerable:!0}});const ye=we,Ce=x().add("SpecularMaterialExtension",ye);function Re(e){g.call(this,e),this.addType(l().TransmissionMaterialExtension)}Object.assign(Object.setPrototypeOf(Re.prototype,g.prototype),{initialize(){g.prototype.initialize.call(this),this._transmission.addInterest("set_transmission__",this),this._transmissionTexture.addInterest("set_transmissionTexture__",this),this.set_transmission__(),this.set_transmissionTexture__()},set_transmission__(){this.transmission=Math.max(this._transmission.getValue(),0)},set_transmissionTexture__(){this.transmissionTextureNode=N()(l().X3DSingleTextureNode,this._transmissionTexture),this.setTexture(0,this.transmissionTextureNode)},getExtensionKey:()=>A.TRANSMISSION_MATERIAL_EXTENSION,getShaderOptions(e){e.push("X3D_TRANSMISSION_MATERIAL_EXT"),+this.getTextureBits()&&(e.push("X3D_MATERIAL_TEXTURES"),this.transmissionTextureNode?.getShaderOptions(e,"TRANSMISSION",!0))},setShaderUniforms:function(){const e=new Float32Array(16);return function(t,s,i,n,r){const o=this.getBrowser();if(t.uniform1f(s.x3d_TransmissionEXT,this.transmission),i.isTransmission()){var a=o.getDefaultTexture2D(),u=o.getDefaultTexture2DUnit();t.uniformMatrix4fv(s.x3d_ModelViewMatrix,!1,e),t.uniform2i(s.x3d_TransmissionFramebufferSizeEXT,1,1)}else{var _=o.getTransmissionBuffer();a=_.getColorTexture(),u=o.getTexture2DUnit();t.uniform2i(s.x3d_TransmissionFramebufferSizeEXT,_.getWidth(),_.getHeight())}t.activeTexture(t.TEXTURE0+u),t.bindTexture(t.TEXTURE_2D,a),t.uniform1i(s.x3d_TransmissionFramebufferSamplerEXT,u),+this.getTextureBits()&&this.transmissionTextureNode?.setNamedShaderUniforms(t,s,i,s.x3d_TransmissionTextureEXT,this._transmissionTextureMapping.getValue(),n,r)}}()}),Object.defineProperties(Re,{...c().getStaticProperties("TransmissionMaterialExtension","X_ITE",1,"extensions","4.0"),fieldDefinitions:{value:new(_())([new(a())(l().inputOutput,"metadata",new(r().SFNode)),new(a())(l().inputOutput,"transmission",new(r().SFFloat)),new(a())(l().inputOutput,"transmissionTextureMapping",new(r().SFString)),new(a())(l().inputOutput,"transmissionTexture",new(r().SFNode))]),enumerable:!0}});const Me=Re,Fe=x().add("TransmissionMaterialExtension",Me);function Xe(e){g.call(this,e),this.addType(l().VolumeMaterialExtension),this.attenuationColorArray=new Float32Array(3)}Object.assign(Object.setPrototypeOf(Xe.prototype,g.prototype),{initialize(){g.prototype.initialize.call(this),this._thickness.addInterest("set_thickness__",this),this._thicknessTexture.addInterest("set_thicknessTexture__",this),this._attenuationDistance.addInterest("set_attenuationDistance__",this),this._attenuationColor.addInterest("set_attenuationColor__",this),this.set_thickness__(),this.set_thicknessTexture__(),this.set_attenuationDistance__(),this.set_attenuationColor__()},set_thickness__(){this.thickness=Math.max(this._thickness.getValue(),0)},set_thicknessTexture__(){this.thicknessTextureNode=N()(l().X3DSingleTextureNode,this._thicknessTexture),this.setTexture(0,this.thicknessTextureNode)},set_attenuationDistance__(){this.attenuationDistance=Math.max(this._attenuationDistance.getValue(),0)},set_attenuationColor__(){const e=this.attenuationColorArray,t=this._attenuationColor.getValue();e[0]=t.r,e[1]=t.g,e[2]=t.b},getExtensionKey:()=>A.VOLUME_MATERIAL_EXTENSION,getShaderOptions(e){e.push("X3D_VOLUME_MATERIAL_EXT"),+this.getTextureBits()&&(e.push("X3D_MATERIAL_TEXTURES"),this.thicknessTextureNode?.getShaderOptions(e,"THICKNESS",!0))},setShaderUniforms(e,t,s,i,n){e.uniform1f(t.x3d_ThicknessEXT,this.thickness),e.uniform1f(t.x3d_AttenuationDistanceEXT,this.attenuationDistance),e.uniform3fv(t.x3d_AttenuationColorEXT,this.attenuationColorArray),+this.getTextureBits()&&this.thicknessTextureNode?.setNamedShaderUniforms(e,t,s,t.x3d_ThicknessTextureEXT,this._thicknessTextureMapping.getValue(),i,n)}}),Object.defineProperties(Xe,{...c().getStaticProperties("VolumeMaterialExtension","X_ITE",1,"extensions","4.0"),fieldDefinitions:{value:new(_())([new(a())(l().inputOutput,"metadata",new(r().SFNode)),new(a())(l().inputOutput,"thickness",new(r().SFFloat)),new(a())(l().inputOutput,"thicknessTextureMapping",new(r().SFString)),new(a())(l().inputOutput,"thicknessTexture",new(r().SFNode)),new(a())(l().inputOutput,"attenuationDistance",new(r().SFFloat)(1e6)),new(a())(l().inputOutput,"attenuationColor",new(r().SFColor)(1,1,1))]),enumerable:!0}});const De=Xe,be=x().add("VolumeMaterialExtension",De);i().add({name:"X_ITE",concreteNodes:[C,D,V,k,H,K,W,ce,pe,xe,ge,Ae,Ce,Fe,be],abstractNodes:[g]});x().add("X_ITEComponent",undefined)})();
|
|
1
|
+
/* X_ITE v10.5.0 */
|
|
2
|
+
const e=window[Symbol.for("X_ITE.X3D-10.5.0")];(()=>{var t={n:e=>{var s=e&&e.__esModule?()=>e.default:()=>e;return t.d(s,{a:s}),s},d:(e,s)=>{for(var i in s)t.o(s,i)&&!t.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:s[i]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const s=e.Components;var i=t.n(s);const n=e.Fields;var r=t.n(n);const o=e.X3DFieldDefinition;var a=t.n(o);const u=e.FieldDefinitionArray;var _=t.n(u);const h=e.X3DNode;var c=t.n(h);const d=e.X3DConstants;var l=t.n(d);const p=e.BitSet;var T=t.n(p);const S=e.Namespace;var x=t.n(S);function f(e){c().call(this,e),this.addType(l().X3DMaterialExtensionNode),this.textureBits=new(T())}Object.assign(Object.setPrototypeOf(f.prototype,c().prototype),{setTexture(e,t){e*=4,this.textureBits.remove(e,15),this.textureBits.add(e,t?.getTextureBits()??0)},getTextureBits(){return this.textureBits}}),Object.defineProperties(f,c().getStaticProperties("X3DMaterialExtensionNode","X_ITE",1));const E=f,g=x().add("X3DMaterialExtensionNode",E),O=e.X3DCast;var N=t.n(O);let m=0;const I={ANISOTROPY_MATERIAL_EXTENSION:m++,CLEARCOAT_MATERIAL_EXTENSION:m++,DIFFUSE_TRANSMISSION_EXTENSION:m++,DISPERSION_MATERIAL_EXTENSION:m++,EMISSIVE_STRENGTH_MATERIAL_EXTENSION:m++,IOR_MATERIAL_EXTENSION:m++,IRIDESCENCE_MATERIAL_EXTENSION:m++,SHEEN_MATERIAL_EXTENSION:m++,SPECULAR_MATERIAL_EXTENSION:m++,TRANSMISSION_MATERIAL_EXTENSION:m++,UNLIT_MATERIAL_EXTENSION:m++,VOLUME_MATERIAL_EXTENSION:m++},A=x().add("ExtensionKeys",I);function w(e){g.call(this,e),this.addType(l().AnisotropyMaterialExtension),this.anisotropyArray=new Float32Array(3)}Object.assign(Object.setPrototypeOf(w.prototype,g.prototype),{initialize(){g.prototype.initialize.call(this),this._anisotropyStrength.addInterest("set_anisotropyStrength__",this),this._anisotropyRotation.addInterest("set_anisotropyRotation__",this),this._anisotropyTexture.addInterest("set_anisotropyTexture__",this),this.set_anisotropyStrength__(),this.set_anisotropyRotation__(),this.set_anisotropyTexture__()},set_anisotropyStrength__(){this.anisotropyArray[2]=Math.max(this._anisotropyStrength.getValue(),0)},set_anisotropyRotation__(){const e=this._anisotropyRotation.getValue();this.anisotropyArray[0]=Math.cos(e),this.anisotropyArray[1]=Math.sin(e)},set_anisotropyTexture__(){this.anisotropyTextureNode=N()(l().X3DSingleTextureNode,this._anisotropyTexture),this.setTexture(0,this.anisotropyTextureNode)},getExtensionKey:()=>A.ANISOTROPY_MATERIAL_EXTENSION,getShaderOptions(e){e.push("X3D_ANISOTROPY_MATERIAL_EXT"),+this.getTextureBits()&&(e.push("X3D_MATERIAL_TEXTURES"),this.anisotropyTextureNode?.getShaderOptions(e,"ANISOTROPY",!0))},setShaderUniforms(e,t,s,i,n){e.uniform3fv(t.x3d_AnisotropyEXT,this.anisotropyArray),this.anisotropyTextureNode?.setNamedShaderUniforms(e,t,s,t.x3d_AnisotropyTextureEXT,this._anisotropyTextureMapping.getValue(),i,n)}}),Object.defineProperties(w,{...c().getStaticProperties("AnisotropyMaterialExtension","X_ITE",1,"extensions","4.0"),fieldDefinitions:{value:new(_())([new(a())(l().inputOutput,"metadata",new(r().SFNode)),new(a())(l().inputOutput,"anisotropyStrength",new(r().SFFloat)),new(a())(l().inputOutput,"anisotropyRotation",new(r().SFFloat)),new(a())(l().inputOutput,"anisotropyTextureMapping",new(r().SFString)),new(a())(l().inputOutput,"anisotropyTexture",new(r().SFNode))]),enumerable:!0}});const y=w,C=x().add("AnisotropyMaterialExtension",y),R=e.X3DAppearanceChildNode;var M=t.n(R);function F(e){M().call(this,e),this.addType(l().BlendMode),this.factorTypes=new Map,this.equationTypes=new Map}Object.assign(Object.setPrototypeOf(F.prototype,M().prototype),{initialize(){M().prototype.initialize.call(this);const e=this.getBrowser().getContext(),t=e.getExtension("EXT_blend_minmax");this.factorTypes.set("ZERO",e.ZERO),this.factorTypes.set("ONE",e.ONE),this.factorTypes.set("SRC_COLOR",e.SRC_COLOR),this.factorTypes.set("ONE_MINUS_SRC_COLOR",e.ONE_MINUS_SRC_COLOR),this.factorTypes.set("DST_COLOR",e.DST_COLOR),this.factorTypes.set("ONE_MINUS_DST_COLOR",e.ONE_MINUS_DST_COLOR),this.factorTypes.set("SRC_ALPHA",e.SRC_ALPHA),this.factorTypes.set("ONE_MINUS_SRC_ALPHA",e.ONE_MINUS_SRC_ALPHA),this.factorTypes.set("DST_ALPHA",e.DST_ALPHA),this.factorTypes.set("ONE_MINUS_DST_ALPHA",e.ONE_MINUS_DST_ALPHA),this.factorTypes.set("SRC_ALPHA_SATURATE",e.SRC_ALPHA_SATURATE),this.factorTypes.set("CONSTANT_COLOR",e.CONSTANT_COLOR),this.factorTypes.set("ONE_MINUS_CONSTANT_COLOR",e.ONE_MINUS_CONSTANT_COLOR),this.factorTypes.set("CONSTANT_ALPHA",e.CONSTANT_ALPHA),this.factorTypes.set("ONE_MINUS_CONSTANT_ALPHA",e.ONE_MINUS_CONSTANT_ALPHA),this.equationTypes.set("FUNC_ADD",e.FUNC_ADD),this.equationTypes.set("FUNC_SUBTRACT",e.FUNC_SUBTRACT),this.equationTypes.set("FUNC_REVERSE_SUBTRACT",e.FUNC_REVERSE_SUBTRACT),this.equationTypes.set("MIN",e.MIN||t&&t.MIN_EXT),this.equationTypes.set("MAX",e.MAX||t&&t.MAX_EXT),this._sourceColorFactor.addInterest("set_sourceColorFactor__",this),this._sourceAlphaFactor.addInterest("set_sourceAlphaFactor__",this),this._destinationColorFactor.addInterest("set_destinationColorFactor__",this),this._destinationAlphaFactor.addInterest("set_destinationAlphaFactor__",this),this._colorEquation.addInterest("set_colorEquation__",this),this._alphaEquation.addInterest("set_alphaEquation__",this),this.set_sourceColorFactor__(),this.set_sourceAlphaFactor__(),this.set_destinationColorFactor__(),this.set_destinationAlphaFactor__(),this.set_colorEquation__(),this.set_alphaEquation__()},set_sourceColorFactor__(){this.sourceColorFactorType=this.factorTypes.get(this._sourceColorFactor.getValue())??this.factorTypes.get("SRC_ALPHA")},set_sourceAlphaFactor__(){this.sourceAlphaFactorType=this.factorTypes.get(this._sourceAlphaFactor.getValue())??this.factorTypes.get("ONE")},set_destinationColorFactor__(){this.destinationColorFactorType=this.factorTypes.get(this._destinationColorFactor.getValue())??this.factorTypes.get("ONE_MINUS_SRC_ALPHA")},set_destinationAlphaFactor__(){this.destinationAlphaFactorType=this.factorTypes.get(this._destinationAlphaFactor.getValue())??this.factorTypes.get("ONE_MINUS_SRC_ALPHA")},set_colorEquation__(){this.colorEquationType=this.equationTypes.get(this._colorEquation.getValue())??this.equationTypes.get("FUNC_ADD")},set_alphaEquation__(){this.alphaEquationType=this.equationTypes.get(this._alphaEquation.getValue())??this.equationTypes.get("FUNC_ADD")},enable(e){const t=this._blendColor.getValue();e.blendColor(t.r,t.g,t.b,t.a),e.blendFuncSeparate(this.sourceColorFactorType,this.destinationColorFactorType,this.sourceAlphaFactorType,this.destinationAlphaFactorType),e.blendEquationSeparate(this.colorEquationType,this.alphaEquationType)},disable(e){e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA),e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD)}}),Object.defineProperties(F,{...c().getStaticProperties("BlendMode","X_ITE",1,"blendMode","3.3"),fieldDefinitions:{value:new(_())([new(a())(l().inputOutput,"metadata",new(r().SFNode)),new(a())(l().inputOutput,"blendColor",new(r().SFColorRGBA)),new(a())(l().inputOutput,"sourceColorFactor",new(r().SFString)("SRC_ALPHA")),new(a())(l().inputOutput,"sourceAlphaFactor",new(r().SFString)("ONE")),new(a())(l().inputOutput,"destinationColorFactor",new(r().SFString)("ONE_MINUS_SRC_ALPHA")),new(a())(l().inputOutput,"destinationAlphaFactor",new(r().SFString)("ONE_MINUS_SRC_ALPHA")),new(a())(l().inputOutput,"colorEquation",new(r().SFString)("FUNC_ADD")),new(a())(l().inputOutput,"alphaEquation",new(r().SFString)("FUNC_ADD"))]),enumerable:!0}});const X=F,D=x().add("BlendMode",X),b=e.Algorithm;var L=t.n(b);function U(e){g.call(this,e),this.addType(l().ClearcoatMaterialExtension)}Object.assign(Object.setPrototypeOf(U.prototype,g.prototype),{initialize(){g.prototype.initialize.call(this),this._clearcoat.addInterest("set_clearcoat__",this),this._clearcoatTexture.addInterest("set_clearcoatTexture__",this),this._clearcoatRoughness.addInterest("set_clearcoatRoughness__",this),this._clearcoatRoughnessTexture.addInterest("set_clearcoatRoughnessTexture__",this),this._clearcoatNormalTexture.addInterest("set_clearcoatNormalTexture__",this),this.set_clearcoat__(),this.set_clearcoatTexture__(),this.set_clearcoatRoughness__(),this.set_clearcoatRoughnessTexture__(),this.set_clearcoatNormalTexture__()},set_clearcoat__(){this.clearcoat=Math.max(this._clearcoat.getValue(),0)},set_clearcoatTexture__(){this.clearcoatTextureNode=N()(l().X3DSingleTextureNode,this._clearcoatTexture),this.setTexture(0,this.clearcoatTextureNode)},set_clearcoatRoughness__(){this.clearcoatRoughness=L().clamp(this._clearcoatRoughness.getValue(),0,1)},set_clearcoatRoughnessTexture__(){this.clearcoatRoughnessTextureNode=N()(l().X3DSingleTextureNode,this._clearcoatRoughnessTexture),this.setTexture(1,this.clearcoatRoughnessTextureNode)},set_clearcoatNormalTexture__(){this.clearcoatNormalTextureNode=N()(l().X3DSingleTextureNode,this._clearcoatNormalTexture),this.setTexture(2,this.clearcoatNormalTextureNode)},getExtensionKey:()=>A.CLEARCOAT_MATERIAL_EXTENSION,getShaderOptions(e){e.push("X3D_CLEARCOAT_MATERIAL_EXT"),+this.getTextureBits()&&(e.push("X3D_MATERIAL_TEXTURES"),this.clearcoatTextureNode?.getShaderOptions(e,"CLEARCOAT",!0),this.clearcoatRoughnessTextureNode?.getShaderOptions(e,"CLEARCOAT_ROUGHNESS",!0),this.clearcoatNormalTextureNode?.getShaderOptions(e,"CLEARCOAT_NORMAL",!0))},setShaderUniforms(e,t,s,i,n){e.uniform1f(t.x3d_ClearcoatEXT,this.clearcoat),e.uniform1f(t.x3d_ClearcoatRoughnessEXT,this.clearcoatRoughness),+this.getTextureBits()&&(this.clearcoatTextureNode?.setNamedShaderUniforms(e,t,s,t.x3d_ClearcoatTextureEXT,this._clearcoatTextureMapping.getValue(),i,n),this.clearcoatRoughnessTextureNode?.setNamedShaderUniforms(e,t,s,t.x3d_ClearcoatRoughnessTextureEXT,this._clearcoatRoughnessTextureMapping.getValue(),i,n),this.clearcoatNormalTextureNode?.setNamedShaderUniforms(e,t,s,t.x3d_ClearcoatNormalTextureEXT,this._clearcoatNormalTextureMapping.getValue(),i,n))}}),Object.defineProperties(U,{...c().getStaticProperties("ClearcoatMaterialExtension","X_ITE",1,"extensions","4.0"),fieldDefinitions:{value:new(_())([new(a())(l().inputOutput,"metadata",new(r().SFNode)),new(a())(l().inputOutput,"clearcoat",new(r().SFFloat)),new(a())(l().inputOutput,"clearcoatTextureMapping",new(r().SFString)),new(a())(l().inputOutput,"clearcoatTexture",new(r().SFNode)),new(a())(l().inputOutput,"clearcoatRoughness",new(r().SFFloat)),new(a())(l().inputOutput,"clearcoatRoughnessTextureMapping",new(r().SFString)),new(a())(l().inputOutput,"clearcoatRoughnessTexture",new(r().SFNode)),new(a())(l().inputOutput,"clearcoatNormalTextureMapping",new(r().SFString)),new(a())(l().inputOutput,"clearcoatNormalTexture",new(r().SFNode))]),enumerable:!0}});const P=U,V=x().add("ClearcoatMaterialExtension",P);function v(e){M().call(this,e),this.addType(l().DepthMode),this.addAlias("depthFunc",this._depthFunction)}Object.assign(Object.setPrototypeOf(v.prototype,M().prototype),{initialize(){M().prototype.initialize.call(this),this._depthFunction.addInterest("set_depthFunction__",this),this.set_depthFunction__()},set_depthFunction__:function(){const e=new Map([["NEVER","NEVER"],["LESS","LESS"],["EQUAL","EQUAL"],["LESS_EQUAL","LEQUAL"],["GREATER","GREATER"],["NOT_EQUAL","NOTEQUAL"],["GREATER_EQUAL","GEQUAL"],["ALWAYS","ALWAYS"]]);return function(){const t=this.getBrowser().getContext();this.depthFunction=t[e.get(this._depthFunction.getValue())??"LEQUAL"]}}(),enable(e){this.depthTest=e.isEnabled(e.DEPTH_TEST),this.depthWriteMask=e.getParameter(e.DEPTH_WRITEMASK),e.enable(e.POLYGON_OFFSET_FILL),e.polygonOffset(...this._polygonOffset),this._depthTest.getValue()?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST),e.depthFunc(this.depthFunction),e.depthRange(...this._depthRange.getValue()),e.depthMask(this._depthMask.getValue())},disable(e){e.disable(e.POLYGON_OFFSET_FILL),this.depthTest?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST),e.depthFunc(e.LEQUAL),e.depthRange(0,1),e.depthMask(this.depthWriteMask)}}),Object.defineProperties(v,{...c().getStaticProperties("DepthMode","X_ITE",1,"depthMode","4.0"),fieldDefinitions:{value:new(_())([new(a())(l().inputOutput,"metadata",new(r().SFNode)),new(a())(l().inputOutput,"polygonOffset",new(r().SFVec2f)),new(a())(l().inputOutput,"depthRange",new(r().SFVec2f)(0,1)),new(a())(l().inputOutput,"depthTest",new(r().SFBool)(!0)),new(a())(l().inputOutput,"depthFunction",new(r().SFString)("LESS_EQUAL")),new(a())(l().inputOutput,"depthMask",new(r().SFBool)(!0))]),enumerable:!0}});const B=v,k=x().add("DepthMode",B);function j(e){g.call(this,e),this.addType(l().DiffuseTransmissionMaterialExtension),this.diffuseTransmissionColorArray=new Float32Array(3)}Object.assign(Object.setPrototypeOf(j.prototype,g.prototype),{initialize(){g.prototype.initialize.call(this),this._diffuseTransmission.addInterest("set_diffuseTransmission__",this),this._diffuseTransmissionTexture.addInterest("set_diffuseTransmissionTexture__",this),this._diffuseTransmissionColor.addInterest("set_diffuseTransmissionColor__",this),this._diffuseTransmissionColorTexture.addInterest("set_diffuseTransmissionColorTexture__",this),this.set_diffuseTransmission__(),this.set_diffuseTransmissionTexture__(),this.set_diffuseTransmissionColor__(),this.set_diffuseTransmissionColorTexture__()},set_diffuseTransmission__(){this.diffuseTransmission=Math.max(this._diffuseTransmission.getValue(),0)},set_diffuseTransmissionTexture__(){this.diffuseTransmissionTextureNode=N()(l().X3DSingleTextureNode,this._diffuseTransmissionTexture),this.setTexture(0,this.diffuseTransmissionTextureNode)},set_diffuseTransmissionColor__(){const e=this.diffuseTransmissionColorArray,t=this._diffuseTransmissionColor.getValue();e[0]=t.r,e[1]=t.g,e[2]=t.b},set_diffuseTransmissionColorTexture__(){this.diffuseTransmissionColorTextureNode=N()(l().X3DSingleTextureNode,this._diffuseTransmissionColorTexture),this.setTexture(1,this.diffuseTransmissionColorTextureNode)},getExtensionKey:()=>A.DIFFUSE_TRANSMISSION_EXTENSION,getShaderOptions(e){e.push("X3D_DIFFUSE_TRANSMISSION_MATERIAL_EXT"),+this.getTextureBits()&&(e.push("X3D_MATERIAL_TEXTURES"),this.diffuseTransmissionTextureNode?.getShaderOptions(e,"DIFFUSE_TRANSMISSION",!0),this.diffuseTransmissionColorTextureNode?.getShaderOptions(e,"DIFFUSE_TRANSMISSION_COLOR",!0))},setShaderUniforms(e,t,s,i,n){e.uniform1f(t.x3d_DiffuseTransmissionEXT,this.diffuseTransmission),e.uniform3fv(t.x3d_DiffuseTransmissionColorEXT,this.diffuseTransmissionColorArray),+this.getTextureBits()&&(this.diffuseTransmissionTextureNode?.setNamedShaderUniforms(e,t,s,t.x3d_DiffuseTransmissionTextureEXT,this._diffuseTransmissionTextureMapping.getValue(),i,n),this.diffuseTransmissionColorTextureNode?.setNamedShaderUniforms(e,t,s,t.x3d_DiffuseTransmissionColorTextureEXT,this._diffuseTransmissionColorTextureMapping.getValue(),i,n))}}),Object.defineProperties(j,{...c().getStaticProperties("DiffuseTransmissionMaterialExtension","X_ITE",1,"extensions","4.0"),fieldDefinitions:{value:new(_())([new(a())(l().inputOutput,"metadata",new(r().SFNode)),new(a())(l().inputOutput,"diffuseTransmission",new(r().SFFloat)),new(a())(l().inputOutput,"diffuseTransmissionTextureMapping",new(r().SFString)),new(a())(l().inputOutput,"diffuseTransmissionTexture",new(r().SFNode)),new(a())(l().inputOutput,"diffuseTransmissionColor",new(r().SFColor)(1,1,1)),new(a())(l().inputOutput,"diffuseTransmissionColorTextureMapping",new(r().SFString)),new(a())(l().inputOutput,"diffuseTransmissionColorTexture",new(r().SFNode))]),enumerable:!0}});const G=j,H=x().add("DiffuseTransmissionMaterialExtension",G);function z(e){g.call(this,e),this.addType(l().DispersionMaterialExtension)}Object.assign(Object.setPrototypeOf(z.prototype,g.prototype),{initialize(){g.prototype.initialize.call(this),this._dispersion.addInterest("set_dispersion__",this),this.set_dispersion__()},set_dispersion__(){this.dispersion=Math.max(this._dispersion.getValue(),0)},getExtensionKey:()=>A.DISPERSION_MATERIAL_EXTENSION,getShaderOptions(e){e.push("X3D_DISPERSION_MATERIAL_EXT")},setShaderUniforms(e,t,s,i,n){e.uniform1f(t.x3d_DispersionEXT,this.dispersion)}}),Object.defineProperties(z,{...c().getStaticProperties("DispersionMaterialExtension","X_ITE",1,"extensions","4.0"),fieldDefinitions:{value:new(_())([new(a())(l().inputOutput,"metadata",new(r().SFNode)),new(a())(l().inputOutput,"dispersion",new(r().SFFloat))]),enumerable:!0}});const q=z,K=x().add("DispersionMaterialExtension",q);function Y(e){g.call(this,e),this.addType(l().EmissiveStrengthMaterialExtension)}Object.assign(Object.setPrototypeOf(Y.prototype,g.prototype),{initialize(){g.prototype.initialize.call(this),this._emissiveStrength.addInterest("set_emissiveStrength__",this),this.set_emissiveStrength__()},set_emissiveStrength__(){this.emissiveStrength=Math.max(this._emissiveStrength.getValue(),0)},getExtensionKey:()=>A.EMISSIVE_STRENGTH_MATERIAL_EXTENSION,getShaderOptions(e){e.push("X3D_EMISSIVE_STRENGTH_MATERIAL_EXT")},setShaderUniforms(e,t,s,i,n){e.uniform1f(t.x3d_EmissiveStrengthEXT,this.emissiveStrength)}}),Object.defineProperties(Y,{...c().getStaticProperties("EmissiveStrengthMaterialExtension","X_ITE",1,"extensions","4.0"),fieldDefinitions:{value:new(_())([new(a())(l().inputOutput,"metadata",new(r().SFNode)),new(a())(l().inputOutput,"emissiveStrength",new(r().SFFloat)(1))]),enumerable:!0}});const Q=Y,W=x().add("EmissiveStrengthMaterialExtension",Q),$=e.X3DShapeNode;var Z=t.n($);const J=e.TraverseType;var ee=t.n(J);const te=e.VertexArray;var se=t.n(te);const ie=e.Vector3;var ne=t.n(ie);const re=e.Matrix4;var oe=t.n(re);const ae=e.Box3;var ue=t.n(ae);function _e(e){Z().call(this,e),this.addType(l().InstancedShape),this.addChildObjects(l().outputOnly,"matrices",new(r().SFTime)),this.min=new(ne()),this.max=new(ne()),this.scale=new(ne())(1,1,1),this.numInstances=0,this.instancesStride=25*Float32Array.BYTES_PER_ELEMENT,this.matrixOffset=0,this.normalMatrixOffset=16*Float32Array.BYTES_PER_ELEMENT}Object.assign(Object.setPrototypeOf(_e.prototype,Z().prototype),{initialize(){Z().prototype.initialize.call(this);const e=this.getBrowser(),t=e.getContext();e.getContext().getVersion()<2||(this.instances=Object.assign(t.createBuffer(),{vertexArrayObject:new(se())(t),thickLinesVertexArrayObject:new(se())(t),lineTrianglesBuffer:t.createBuffer(),numLines:0}),this._translations.addInterest("set_transform__",this),this._rotations.addInterest("set_transform__",this),this._scales.addInterest("set_transform__",this),this._scaleOrientations.addInterest("set_transform__",this),this._centers.addInterest("set_transform__",this),this._matrices.addInterest("set_matrices__",this),this.set_transform__())},getShapeKey:()=>3,getNumInstances(){return this.numInstances},getInstances(){return this.instances},set_bbox__:function(){const e=new(ne()),t=new(ne()),s=new(ue());return function(){if(this.numInstances)if(this._bboxSize.getValue().equals(this.getDefaultBBoxSize())){this.getGeometry()?s.assign(this.getGeometry().getBBox()):s.set();const i=s.size.multiply(this.scale.magnitude()/2),n=s.center;e.assign(this.min).add(n).subtract(i),t.assign(this.max).add(n).add(i),this.bbox.setExtents(e,t)}else this.bbox.set(this._bboxSize.getValue(),this._bboxCenter.getValue());else this.bbox.set();this.getBBoxSize().assign(this.bbox.size),this.getBBoxCenter().assign(this.bbox.center)}}(),set_transform__(){this._matrices=this.getBrowser().getCurrentTime()},set_matrices__(){const e=this.getBrowser().getContext(),t=this._translations,s=this._rotations,i=this._scales,n=this._scaleOrientations,r=this._centers,o=t.length,a=s.length,u=i.length,_=n.length,h=r.length,c=Math.max(o,a,u,_,h),d=this.instancesStride/Float32Array.BYTES_PER_ELEMENT,l=this.instancesStride*c,p=new Float32Array(l),T=new(oe());this.numInstances=c;const S=this.min.set(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),x=this.max.set(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY),f=this.scale.assign(u?x:ne().One);for(let e=0,l=0;e<c;++e,l+=d)T.set(o?t[Math.min(e,o-1)].getValue():null,a?s[Math.min(e,a-1)].getValue():null,u?i[Math.min(e,u-1)].getValue():null,_?n[Math.min(e,_-1)].getValue():null,h?r[Math.min(e,h-1)].getValue():null),u&&f.max(i[Math.min(e,u-1)].getValue()),p.set(T,l),p.set(T.submatrix.transpose().inverse(),l+16),S.min(T.origin),x.max(T.origin);e.bindBuffer(e.ARRAY_BUFFER,this.instances),e.bufferData(e.ARRAY_BUFFER,p,e.DYNAMIC_DRAW),this.set_bbox__()},set_geometry__(){Z().prototype.set_geometry__.call(this),this.getGeometry()?delete this.traverse:this.traverse=Function.prototype,this.set_transform__()},intersectsBox(e,t,s){},traverse(e,t){if(this.numInstances){switch(e){case ee().POINTER:this._pointerEvents.getValue()&&t.addPointingShape(this);break;case ee().PICKING:break;case ee().COLLISION:t.addCollisionShape(this);break;case ee().SHADOW:this._castShadow.getValue()&&t.addShadowShape(this);break;case ee().DISPLAY:t.addDisplayShape(this)&&this.getAppearance().traverse(e,t)}this.getGeometry().traverse(e,t)}},displaySimple(e,t,s){this.getGeometry().displaySimpleInstanced(e,s,this)},display(e,t){this.getGeometry().displayInstanced(e,t,this)}}),Object.defineProperties(_e,{...c().getStaticProperties("InstancedShape","X_ITE",1,"children","2.0"),fieldDefinitions:{value:new(_())([new(a())(l().inputOutput,"metadata",new(r().SFNode)),new(a())(l().inputOutput,"translations",new(r().MFVec3f)),new(a())(l().inputOutput,"rotations",new(r().MFRotation)),new(a())(l().inputOutput,"scales",new(r().MFVec3f)),new(a())(l().inputOutput,"scaleOrientations",new(r().MFRotation)),new(a())(l().inputOutput,"centers",new(r().MFVec3f)),new(a())(l().inputOutput,"pointerEvents",new(r().SFBool)(!0)),new(a())(l().inputOutput,"castShadow",new(r().SFBool)(!0)),new(a())(l().inputOutput,"visible",new(r().SFBool)(!0)),new(a())(l().inputOutput,"bboxDisplay",new(r().SFBool)),new(a())(l().initializeOnly,"bboxSize",new(r().SFVec3f)(-1,-1,-1)),new(a())(l().initializeOnly,"bboxCenter",new(r().SFVec3f)),new(a())(l().inputOutput,"appearance",new(r().SFNode)),new(a())(l().inputOutput,"geometry",new(r().SFNode))]),enumerable:!0}});const he=_e,ce=x().add("InstancedShape",he);function de(e){g.call(this,e),this.addType(l().IORMaterialExtension)}Object.assign(Object.setPrototypeOf(de.prototype,g.prototype),{initialize(){g.prototype.initialize.call(this),this._indexOfRefraction.addInterest("set_indexOfRefraction__",this),this.set_indexOfRefraction__()},set_indexOfRefraction__(){this.indexOfRefraction=Math.max(this._indexOfRefraction.getValue(),1)},getExtensionKey:()=>A.IOR_MATERIAL_EXTENSION,getShaderOptions(e){e.push("X3D_IOR_MATERIAL_EXT")},setShaderUniforms(e,t,s,i,n){e.uniform1f(t.x3d_IorEXT,this.indexOfRefraction)}}),Object.defineProperties(de,{...c().getStaticProperties("IORMaterialExtension","X_ITE",1,"extensions","4.0"),fieldDefinitions:{value:new(_())([new(a())(l().inputOutput,"metadata",new(r().SFNode)),new(a())(l().inputOutput,"indexOfRefraction",new(r().SFFloat)(1.5))]),enumerable:!0}});const le=de,pe=x().add("IORMaterialExtension",le);function Te(e){g.call(this,e),this.addType(l().IridescenceMaterialExtension)}Object.assign(Object.setPrototypeOf(Te.prototype,g.prototype),{initialize(){g.prototype.initialize.call(this),this._iridescence.addInterest("set_iridescence__",this),this._iridescenceTexture.addInterest("set_iridescenceTexture__",this),this._iridescenceIndexOfRefraction.addInterest("set_iridescenceIndexOfRefraction__",this),this._iridescenceThicknessMinimum.addInterest("set_iridescenceThicknessMinimum__",this),this._iridescenceThicknessMaximum.addInterest("set_iridescenceThicknessMaximum__",this),this._iridescenceThicknessTexture.addInterest("set_iridescenceThicknessTexture__",this),this.set_iridescence__(),this.set_iridescenceTexture__(),this.set_iridescenceIndexOfRefraction__(),this.set_iridescenceThicknessMinimum__(),this.set_iridescenceThicknessMaximum__(),this.set_iridescenceThicknessTexture__()},set_iridescence__(){this.iridescence=Math.max(this._iridescence.getValue(),0)},set_iridescenceTexture__(){this.iridescenceTextureNode=N()(l().X3DSingleTextureNode,this._iridescenceTexture),this.setTexture(0,this.iridescenceTextureNode)},set_iridescenceIndexOfRefraction__(){this.iridescenceIndexOfRefraction=Math.max(this._iridescenceIndexOfRefraction.getValue(),1)},set_iridescenceThicknessMinimum__(){this.iridescenceThicknessMinimum=Math.max(this._iridescenceThicknessMinimum.getValue(),0)},set_iridescenceThicknessMaximum__(){this.iridescenceThicknessMaximum=Math.max(this._iridescenceThicknessMaximum.getValue(),0)},set_iridescenceThicknessTexture__(){this.iridescenceThicknessTextureNode=N()(l().X3DSingleTextureNode,this._iridescenceThicknessTexture),this.setTexture(1,this.iridescenceThicknessTextureNode)},getExtensionKey:()=>A.IRIDESCENCE_MATERIAL_EXTENSION,getShaderOptions(e){e.push("X3D_IRIDESCENCE_MATERIAL_EXT"),+this.getTextureBits()&&(e.push("X3D_MATERIAL_TEXTURES"),this.iridescenceTextureNode?.getShaderOptions(e,"IRIDESCENCE",!0),this.iridescenceThicknessTextureNode?.getShaderOptions(e,"IRIDESCENCE_THICKNESS",!0))},setShaderUniforms(e,t,s,i,n){e.uniform1f(t.x3d_IridescenceEXT,this.iridescence),e.uniform1f(t.x3d_IridescenceIndexOfRefractionEXT,this.iridescenceIndexOfRefraction),e.uniform1f(t.x3d_IridescenceThicknessMinimumEXT,this.iridescenceThicknessMinimum),e.uniform1f(t.x3d_IridescenceThicknessMaximumEXT,this.iridescenceThicknessMaximum),+this.getTextureBits()&&(this.iridescenceTextureNode?.setNamedShaderUniforms(e,t,s,t.x3d_IridescenceTextureEXT,this._iridescenceTextureMapping.getValue(),i,n),this.iridescenceThicknessTextureNode?.setNamedShaderUniforms(e,t,s,t.x3d_IridescenceThicknessTextureEXT,this._iridescenceThicknessTextureMapping.getValue(),i,n))}}),Object.defineProperties(Te,{...c().getStaticProperties("IridescenceMaterialExtension","X_ITE",1,"extensions","4.0"),fieldDefinitions:{value:new(_())([new(a())(l().inputOutput,"metadata",new(r().SFNode)),new(a())(l().inputOutput,"iridescence",new(r().SFFloat)),new(a())(l().inputOutput,"iridescenceTextureMapping",new(r().SFString)),new(a())(l().inputOutput,"iridescenceTexture",new(r().SFNode)),new(a())(l().inputOutput,"iridescenceIndexOfRefraction",new(r().SFFloat)(1.3)),new(a())(l().inputOutput,"iridescenceThicknessMinimum",new(r().SFFloat)(100)),new(a())(l().inputOutput,"iridescenceThicknessMaximum",new(r().SFFloat)(400)),new(a())(l().inputOutput,"iridescenceThicknessTextureMapping",new(r().SFString)),new(a())(l().inputOutput,"iridescenceThicknessTexture",new(r().SFNode))]),enumerable:!0}});const Se=Te,xe=x().add("IridescenceMaterialExtension",Se);function fe(e){g.call(this,e),this.addType(l().SheenMaterialExtension),this.sheenColorArray=new Float32Array(3)}Object.assign(Object.setPrototypeOf(fe.prototype,g.prototype),{initialize(){g.prototype.initialize.call(this),this._sheenColor.addInterest("set_sheenColor__",this),this._sheenColorTexture.addInterest("set_sheenColorTexture__",this),this._sheenRoughness.addInterest("set_sheenRoughness__",this),this._sheenRoughnessTexture.addInterest("set_sheenRoughnessTexture__",this),this.set_sheenColor__(),this.set_sheenColorTexture__(),this.set_sheenRoughness__(),this.set_sheenRoughnessTexture__()},set_sheenColor__(){const e=this.sheenColorArray,t=this._sheenColor.getValue();e[0]=t.r,e[1]=t.g,e[2]=t.b},set_sheenColorTexture__(){this.sheenColorTextureNode=N()(l().X3DSingleTextureNode,this._sheenColorTexture),this.setTexture(0,this.sheenColorTextureNode)},set_sheenRoughness__(){this.sheenRoughness=L().clamp(this._sheenRoughness.getValue(),0,1)},set_sheenRoughnessTexture__(){this.sheenRoughnessTextureNode=N()(l().X3DSingleTextureNode,this._sheenRoughnessTexture),this.setTexture(1,this.sheenRoughnessTextureNode)},getExtensionKey:()=>A.SHEEN_MATERIAL_EXTENSION,getShaderOptions(e){e.push("X3D_SHEEN_MATERIAL_EXT"),+this.getTextureBits()&&(e.push("X3D_MATERIAL_TEXTURES"),this.sheenColorTextureNode?.getShaderOptions(e,"SHEEN_COLOR",!0),this.sheenRoughnessTextureNode?.getShaderOptions(e,"SHEEN_ROUGHNESS",!0))},setShaderUniforms(e,t,s,i,n){e.uniform3fv(t.x3d_SheenColorEXT,this.sheenColorArray),e.uniform1f(t.x3d_SheenRoughnessEXT,this.sheenRoughness);const r=this.getBrowser(),o=r.getLibraryTexture("lut_sheen_E.png"),a=r.getTexture2DUnit();e.activeTexture(e.TEXTURE0+a),e.bindTexture(e.TEXTURE_2D,o.getTexture()),e.uniform1i(t.x3d_SheenELUTTextureEXT,a),+this.getTextureBits()&&(this.sheenColorTextureNode?.setNamedShaderUniforms(e,t,s,t.x3d_SheenColorTextureEXT,this._sheenColorTextureMapping.getValue(),i,n),this.sheenRoughnessTextureNode?.setNamedShaderUniforms(e,t,s,t.x3d_SheenRoughnessTextureEXT,this._sheenRoughnessTextureMapping.getValue(),i,n))}}),Object.defineProperties(fe,{...c().getStaticProperties("SheenMaterialExtension","X_ITE",1,"extensions","4.0"),fieldDefinitions:{value:new(_())([new(a())(l().inputOutput,"metadata",new(r().SFNode)),new(a())(l().inputOutput,"sheenColor",new(r().SFColor)),new(a())(l().inputOutput,"sheenColorTextureMapping",new(r().SFString)),new(a())(l().inputOutput,"sheenColorTexture",new(r().SFNode)),new(a())(l().inputOutput,"sheenRoughness",new(r().SFFloat)),new(a())(l().inputOutput,"sheenRoughnessTextureMapping",new(r().SFString)),new(a())(l().inputOutput,"sheenRoughnessTexture",new(r().SFNode))]),enumerable:!0}});const Ee=fe,ge=x().add("SheenMaterialExtension",Ee),Oe=e.X3DOneSidedMaterialNode;var Ne=t.n(Oe);function me(e){console.warn("SpecularGlossinessMaterial is depreciated, please use PhysicalMaterial instead."),Ne().call(this,e),this.addType(l().SpecularGlossinessMaterial),this.materialKey="4/",this.diffuseColorArray=new Float32Array(3),this.specularColorArray=new Float32Array(3),this.extensionNodes=[]}Object.assign(Object.setPrototypeOf(me.prototype,Ne().prototype),{initialize(){Ne().prototype.initialize.call(this),this._diffuseColor.addInterest("set_diffuseColor__",this),this._diffuseTexture.addInterest("set_diffuseTexture__",this),this._diffuseTexture.addInterest("set_transparent__",this),this._specularColor.addInterest("set_specularColor__",this),this._glossiness.addInterest("set_glossiness__",this),this._specularGlossinessTexture.addInterest("set_specularGlossinessTexture__",this),this._occlusionStrength.addInterest("set_occlusionStrength__",this),this._occlusionTexture.addInterest("set_occlusionTexture__",this),this._extensions.addInterest("set_extensions__",this),this.set_diffuseColor__(),this.set_diffuseTexture__(),this.set_specularColor__(),this.set_glossiness__(),this.set_specularGlossinessTexture__(),this.set_occlusionStrength__(),this.set_occlusionTexture__(),this.set_extensions__(),this.set_transparent__()},getMaterialKey(){return this.materialKey},getTextureIndices:(()=>{let e=0;const t={DIFFUSE_TEXTURE:e++,SPECULAR_GLOSSINESS_TEXTURE:e++,EMISSIVE_TEXTURE:e++,OCCLUSION_TEXTURE:e++,NORMAL_TEXTURE:e++};return function(){return t}})(),getBaseTexture(){return this.diffuseTextureNode},set_diffuseColor__(){const e=this.diffuseColorArray,t=this._diffuseColor.getValue();e[0]=t.r,e[1]=t.g,e[2]=t.b},set_diffuseTexture__(){const e=this.getTextureIndices().DIFFUSE_TEXTURE;this.diffuseTextureNode&&(this.diffuseTextureNode._transparent.removeInterest("set_transparent__",this),this.diffuseTextureNode._linear.removeInterest(`setTexture${e}`,this)),this.diffuseTextureNode=N()(l().X3DSingleTextureNode,this._diffuseTexture),this.diffuseTextureNode&&(this.diffuseTextureNode._transparent.addInterest("set_transparent__",this),this.diffuseTextureNode._linear.addInterest(`setTexture${e}`,this,e,this.diffuseTextureNode)),this.setTexture(e,this.diffuseTextureNode)},set_specularColor__(){const e=this.specularColorArray,t=this._specularColor.getValue();e[0]=t.r,e[1]=t.g,e[2]=t.b},set_glossiness__(){this.glossiness=L().clamp(this._glossiness.getValue(),0,1)},set_specularGlossinessTexture__(){this.specularGlossinessTextureNode=N()(l().X3DSingleTextureNode,this._specularGlossinessTexture),this.setTexture(this.getTextureIndices().SPECULAR_GLOSSINESS_TEXTURE,this.specularGlossinessTextureNode)},set_occlusionStrength__(){this.occlusionStrength=L().clamp(this._occlusionStrength.getValue(),0,1)},set_occlusionTexture__(){this.occlusionTextureNode=N()(l().X3DSingleTextureNode,this._occlusionTexture),this.setTexture(this.getTextureIndices().OCCLUSION_TEXTURE,this.occlusionTextureNode)},set_transparent__(){this.setTransparent(this.getTransparency()||this.diffuseTextureNode?.isTransparent())},set_extensions__(){const e=this.extensionNodes;for(const t of e)t.removeInterest("set_extensionsKey__",this);e.length=0;for(const t of this._extensions){const s=N()(l().X3DMaterialExtensionNode,t);s&&e.push(s)}e.sort(((e,t)=>e.getExtensionKey()-t.getExtensionKey()));for(const t of e)t.addInterest("set_extensionsKey__",this);this.setTransmission(e.some((e=>e.getType().includes(l().TransmissionMaterialExtension)))),this.set_extensionsKey__()},set_extensionsKey__(){const e=this.extensionNodes.map((e=>`${e.getExtensionKey().toString(16)}${e.getTextureBits().toString(16)}`)).join("");this.materialKey=`[4.${e}]`},createShader(e,t,s){const i=this.getBrowser(),n=this.getShaderOptions(t,s);for(const e of this.extensionNodes)e.getShaderOptions(n);n.push("X3D_PHYSICAL_MATERIAL","X3D_MATERIAL_SPECULAR_GLOSSINESS"),+this.getTextureBits()&&(this.diffuseTextureNode?.getShaderOptions(n,"DIFFUSE"),this.specularGlossinessTextureNode?.getShaderOptions(n,"SPECULAR_GLOSSINESS"),this.occlusionTextureNode?.getShaderOptions(n,"OCCLUSION"));const r=i.createShader("SpecularGlossiness","Default","Physical",n);return i.getShaders().set(e,r),r},setShaderUniforms(e,t,s,i,n){Ne().prototype.setShaderUniforms.call(this,e,t,s,i,n);for(const r of this.extensionNodes)r.setShaderUniforms(e,t,s,i,n);e.uniform3fv(t.x3d_DiffuseColor,this.diffuseColorArray),e.uniform3fv(t.x3d_SpecularColor,this.specularColorArray),e.uniform1f(t.x3d_Glossiness,this.glossiness),+this.getTextureBits()&&(this.diffuseTextureNode?.setNamedShaderUniforms(e,t,s,t.x3d_DiffuseTexture,this._diffuseTextureMapping.getValue(),i,n),this.specularGlossinessTextureNode?.setNamedShaderUniforms(e,t,s,t.x3d_SpecularGlossinessTexture,this._specularGlossinessTextureMapping.getValue(),i,n),this.occlusionTextureNode&&e.uniform1f(t.x3d_OcclusionStrength,this.occlusionStrength),this.occlusionTextureNode?.setNamedShaderUniforms(e,t,s,t.x3d_OcclusionTexture,this._occlusionTextureMapping.getValue(),i,n))}}),Object.defineProperties(me,{...c().getStaticProperties("SpecularGlossinessMaterial","X_ITE",1,"material","4.0"),fieldDefinitions:{value:new(_())([new(a())(l().inputOutput,"metadata",new(r().SFNode)),new(a())(l().inputOutput,"diffuseColor",new(r().SFColor)(1,1,1)),new(a())(l().inputOutput,"diffuseTextureMapping",new(r().SFString)),new(a())(l().inputOutput,"diffuseTexture",new(r().SFNode)),new(a())(l().inputOutput,"specularColor",new(r().SFColor)(1,1,1)),new(a())(l().inputOutput,"glossiness",new(r().SFFloat)(1)),new(a())(l().inputOutput,"specularGlossinessTextureMapping",new(r().SFString)),new(a())(l().inputOutput,"specularGlossinessTexture",new(r().SFNode)),new(a())(l().inputOutput,"emissiveColor",new(r().SFColor)),new(a())(l().inputOutput,"emissiveTextureMapping",new(r().SFString)),new(a())(l().inputOutput,"emissiveTexture",new(r().SFNode)),new(a())(l().inputOutput,"occlusionStrength",new(r().SFFloat)(1)),new(a())(l().inputOutput,"occlusionTextureMapping",new(r().SFString)),new(a())(l().inputOutput,"occlusionTexture",new(r().SFNode)),new(a())(l().inputOutput,"normalScale",new(r().SFFloat)(1)),new(a())(l().inputOutput,"normalTextureMapping",new(r().SFString)),new(a())(l().inputOutput,"normalTexture",new(r().SFNode)),new(a())(l().inputOutput,"transparency",new(r().SFFloat)),new(a())(l().inputOutput,"extensions",new(r().MFNode))]),enumerable:!0}});for(const e of Object.values(me.prototype.getTextureIndices()))me.prototype[`setTexture${e}`]=function(e,t){this.setTexture(e,t)};const Ie=me,Ae=x().add("SpecularGlossinessMaterial",Ie);function we(e){g.call(this,e),this.addType(l().SpecularMaterialExtension),this.specularColorArray=new Float32Array(3)}Object.assign(Object.setPrototypeOf(we.prototype,g.prototype),{initialize(){g.prototype.initialize.call(this),this._specular.addInterest("set_specular__",this),this._specularTexture.addInterest("set_specularTexture__",this),this._specularColor.addInterest("set_specularColor__",this),this._specularColorTexture.addInterest("set_specularColorTexture__",this),this.set_specular__(),this.set_specularTexture__(),this.set_specularColor__(),this.set_specularColorTexture__()},set_specular__(){this.specular=Math.max(this._specular.getValue(),0)},set_specularTexture__(){this.specularTextureNode=N()(l().X3DSingleTextureNode,this._specularTexture),this.setTexture(0,this.specularTextureNode)},set_specularColor__(){const e=this.specularColorArray,t=this._specularColor.getValue();e[0]=t.r,e[1]=t.g,e[2]=t.b},set_specularColorTexture__(){this.specularColorTextureNode=N()(l().X3DSingleTextureNode,this._specularColorTexture),this.setTexture(1,this.specularColorTextureNode)},getExtensionKey:()=>A.SPECULAR_MATERIAL_EXTENSION,getShaderOptions(e){e.push("X3D_SPECULAR_MATERIAL_EXT"),+this.getTextureBits()&&(e.push("X3D_MATERIAL_TEXTURES"),this.specularTextureNode?.getShaderOptions(e,"SPECULAR",!0),this.specularColorTextureNode?.getShaderOptions(e,"SPECULAR_COLOR",!0))},setShaderUniforms(e,t,s,i,n){e.uniform1f(t.x3d_SpecularEXT,this.specular),e.uniform3fv(t.x3d_SpecularColorEXT,this.specularColorArray),+this.getTextureBits()&&(this.specularTextureNode?.setNamedShaderUniforms(e,t,s,t.x3d_SpecularTextureEXT,this._specularTextureMapping.getValue(),i,n),this.specularColorTextureNode?.setNamedShaderUniforms(e,t,s,t.x3d_SpecularColorTextureEXT,this._specularColorTextureMapping.getValue(),i,n))}}),Object.defineProperties(we,{...c().getStaticProperties("SpecularMaterialExtension","X_ITE",1,"extensions","4.0"),fieldDefinitions:{value:new(_())([new(a())(l().inputOutput,"metadata",new(r().SFNode)),new(a())(l().inputOutput,"specular",new(r().SFFloat)(1)),new(a())(l().inputOutput,"specularTextureMapping",new(r().SFString)),new(a())(l().inputOutput,"specularTexture",new(r().SFNode)),new(a())(l().inputOutput,"specularColor",new(r().SFColor)(1,1,1)),new(a())(l().inputOutput,"specularColorTextureMapping",new(r().SFString)),new(a())(l().inputOutput,"specularColorTexture",new(r().SFNode))]),enumerable:!0}});const ye=we,Ce=x().add("SpecularMaterialExtension",ye);function Re(e){g.call(this,e),this.addType(l().TransmissionMaterialExtension)}Object.assign(Object.setPrototypeOf(Re.prototype,g.prototype),{initialize(){g.prototype.initialize.call(this),this._transmission.addInterest("set_transmission__",this),this._transmissionTexture.addInterest("set_transmissionTexture__",this),this.set_transmission__(),this.set_transmissionTexture__()},set_transmission__(){this.transmission=Math.max(this._transmission.getValue(),0)},set_transmissionTexture__(){this.transmissionTextureNode=N()(l().X3DSingleTextureNode,this._transmissionTexture),this.setTexture(0,this.transmissionTextureNode)},getExtensionKey:()=>A.TRANSMISSION_MATERIAL_EXTENSION,getShaderOptions(e){e.push("X3D_TRANSMISSION_MATERIAL_EXT"),+this.getTextureBits()&&(e.push("X3D_MATERIAL_TEXTURES"),this.transmissionTextureNode?.getShaderOptions(e,"TRANSMISSION",!0))},setShaderUniforms:function(){const e=new Float32Array(16);return function(t,s,i,n,r){const o=this.getBrowser();if(t.uniform1f(s.x3d_TransmissionEXT,this.transmission),i.isTransmission()){var a=o.getDefaultTexture2D(),u=o.getDefaultTexture2DUnit();t.uniformMatrix4fv(s.x3d_ModelViewMatrix,!1,e),t.uniform2i(s.x3d_TransmissionFramebufferSizeEXT,1,1)}else{var _=o.getTransmissionBuffer();a=_.getColorTexture(),u=o.getTexture2DUnit();t.uniform2i(s.x3d_TransmissionFramebufferSizeEXT,_.getWidth(),_.getHeight())}t.activeTexture(t.TEXTURE0+u),t.bindTexture(t.TEXTURE_2D,a),t.uniform1i(s.x3d_TransmissionFramebufferSamplerEXT,u),+this.getTextureBits()&&this.transmissionTextureNode?.setNamedShaderUniforms(t,s,i,s.x3d_TransmissionTextureEXT,this._transmissionTextureMapping.getValue(),n,r)}}()}),Object.defineProperties(Re,{...c().getStaticProperties("TransmissionMaterialExtension","X_ITE",1,"extensions","4.0"),fieldDefinitions:{value:new(_())([new(a())(l().inputOutput,"metadata",new(r().SFNode)),new(a())(l().inputOutput,"transmission",new(r().SFFloat)),new(a())(l().inputOutput,"transmissionTextureMapping",new(r().SFString)),new(a())(l().inputOutput,"transmissionTexture",new(r().SFNode))]),enumerable:!0}});const Me=Re,Fe=x().add("TransmissionMaterialExtension",Me);function Xe(e){g.call(this,e),this.addType(l().VolumeMaterialExtension),this.attenuationColorArray=new Float32Array(3)}Object.assign(Object.setPrototypeOf(Xe.prototype,g.prototype),{initialize(){g.prototype.initialize.call(this),this._thickness.addInterest("set_thickness__",this),this._thicknessTexture.addInterest("set_thicknessTexture__",this),this._attenuationDistance.addInterest("set_attenuationDistance__",this),this._attenuationColor.addInterest("set_attenuationColor__",this),this.set_thickness__(),this.set_thicknessTexture__(),this.set_attenuationDistance__(),this.set_attenuationColor__()},set_thickness__(){this.thickness=Math.max(this._thickness.getValue(),0)},set_thicknessTexture__(){this.thicknessTextureNode=N()(l().X3DSingleTextureNode,this._thicknessTexture),this.setTexture(0,this.thicknessTextureNode)},set_attenuationDistance__(){this.attenuationDistance=Math.max(this._attenuationDistance.getValue(),0)},set_attenuationColor__(){const e=this.attenuationColorArray,t=this._attenuationColor.getValue();e[0]=t.r,e[1]=t.g,e[2]=t.b},getExtensionKey:()=>A.VOLUME_MATERIAL_EXTENSION,getShaderOptions(e){e.push("X3D_VOLUME_MATERIAL_EXT"),+this.getTextureBits()&&(e.push("X3D_MATERIAL_TEXTURES"),this.thicknessTextureNode?.getShaderOptions(e,"THICKNESS",!0))},setShaderUniforms(e,t,s,i,n){e.uniform1f(t.x3d_ThicknessEXT,this.thickness),e.uniform1f(t.x3d_AttenuationDistanceEXT,this.attenuationDistance),e.uniform3fv(t.x3d_AttenuationColorEXT,this.attenuationColorArray),+this.getTextureBits()&&this.thicknessTextureNode?.setNamedShaderUniforms(e,t,s,t.x3d_ThicknessTextureEXT,this._thicknessTextureMapping.getValue(),i,n)}}),Object.defineProperties(Xe,{...c().getStaticProperties("VolumeMaterialExtension","X_ITE",1,"extensions","4.0"),fieldDefinitions:{value:new(_())([new(a())(l().inputOutput,"metadata",new(r().SFNode)),new(a())(l().inputOutput,"thickness",new(r().SFFloat)),new(a())(l().inputOutput,"thicknessTextureMapping",new(r().SFString)),new(a())(l().inputOutput,"thicknessTexture",new(r().SFNode)),new(a())(l().inputOutput,"attenuationDistance",new(r().SFFloat)(1e6)),new(a())(l().inputOutput,"attenuationColor",new(r().SFColor)(1,1,1))]),enumerable:!0}});const De=Xe,be=x().add("VolumeMaterialExtension",De);i().add({name:"X_ITE",concreteNodes:[C,D,V,k,H,K,W,ce,pe,xe,ge,Ae,Ce,Fe,be],abstractNodes:[g]});x().add("X_ITEComponent",undefined)})();
|
package/dist/example.html
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<meta charset="utf-8"/>
|
|
5
5
|
<script src="x_ite.min.js"></script>
|
|
6
6
|
<!-- or use: -->
|
|
7
|
-
<!-- <script src="https://cdn.jsdelivr.net/npm/x_ite@10.
|
|
7
|
+
<!-- <script src="https://cdn.jsdelivr.net/npm/x_ite@10.5.0/dist/x_ite.min.js"></script> -->
|
|
8
8
|
<style>
|
|
9
9
|
x3d-canvas {
|
|
10
10
|
width: 1000px;
|