UNPKG

x_ite

Version:

X_ITE X3D Browser, view and manipulate X3D, VRML, glTF and other 3D sources in HTML.

2 lines 60.9 kB
/* X_ITE v12.2.3 */ const e=window[Symbol.for("X_ITE.X3D-12.2.3")];(()=>{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.TextureBuffer;var r=t.n(n);const o=e.Namespace;var a=t.n(o);const u=Symbol(),l=Symbol();function c(){}Object.assign(c.prototype,{initialize(){this.addTextureBuffer(u),this.addTextureBuffer(l)},getTransmissionBuffer(){return this[u]??=new(r())({browser:this,width:this._viewport[2],height:this._viewport[3],mipMaps:!0})},getVolumeScatterBuffer(){return this[l]??=new(r())({browser:this,width:this._viewport[2],height:this._viewport[3],float:!0})}});const _=c,d=a().add("X3DX_ITEContext",_),h=e.Fields;var p=t.n(h);const T=e.X3DFieldDefinition;var f=t.n(T);const S=e.FieldDefinitionArray;var x=t.n(S);const m=e.X3DNode;var E=t.n(m);const g=e.X3DConstants;var I=t.n(g);const O=e.BitSet;var N=t.n(O);function A(e){E().call(this,e),this.addType(I().X3DMaterialExtensionNode),this.textureBits=new(N())}Object.assign(Object.setPrototypeOf(A.prototype,E().prototype),{setTexture(e,t){e*=4,this.textureBits.remove(e,15),this.textureBits.add(e,t?.getTextureBits()??0)},getTextureBits(){return this.textureBits}}),Object.defineProperties(A,E().getStaticProperties("X3DMaterialExtensionNode","X_ITE",1));const R=A,C=a().add("X3DMaterialExtensionNode",R),M=e.X3DCast;var X=t.n(M);let y=0;const w={add(e){this[e]=y++}},v=a().add("ExtensionKeys",w),F=e.MaterialTextures;var D=t.n(F);function L(e){C.call(this,e),this.addType(I().AnisotropyMaterialExtension),this._anisotropyRotation.setUnit("angle"),this.anisotropyArray=new Float32Array(3)}v.add("ANISOTROPY_MATERIAL_EXTENSION"),D().add("x3d_AnisotropyTextureEXT"),Object.assign(Object.setPrototypeOf(L.prototype,C.prototype),{initialize(){C.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=X()(I().X3DSingleTextureNode,this._anisotropyTexture),this.setTexture(0,this.anisotropyTextureNode)},getExtensionKey:()=>v.ANISOTROPY_MATERIAL_EXTENSION,getShaderOptions(e){e.push("X3D_ANISOTROPY_MATERIAL_EXT"),+this.getTextureBits()&&(e.push("X3D_MATERIAL_TEXTURES"),this.anisotropyTextureNode?.getShaderOptions(e,"ANISOTROPY",!0))},getShaderUniforms(e){e.push("x3d_AnisotropyEXT")},setShaderUniforms(e,t,s,i){e.uniform3fv(t.x3d_AnisotropyEXT,this.anisotropyArray),this.anisotropyTextureNode?.setNamedShaderUniforms(e,t.x3d_AnisotropyTextureEXT,this._anisotropyTextureMapping.getValue(),s,i)}}),Object.defineProperties(L,{...E().getStaticProperties("AnisotropyMaterialExtension","X_ITE",1,"extensions","4.0"),fieldDefinitions:{value:new(x())([new(f())(I().inputOutput,"metadata",new(p().SFNode)),new(f())(I().inputOutput,"anisotropyStrength",new(p().SFFloat)),new(f())(I().inputOutput,"anisotropyRotation",new(p().SFFloat)),new(f())(I().inputOutput,"anisotropyTextureMapping",new(p().SFString)),new(f())(I().inputOutput,"anisotropyTexture",new(p().SFNode))]),enumerable:!0}});const b=L,U=a().add("AnisotropyMaterialExtension",b),P=e.X3DAppearanceChildNode;var V=t.n(P);function B(e){V().call(this,e),this.addType(I().BlendMode),this.factorTypes=new Map,this.equationTypes=new Map}Object.assign(Object.setPrototypeOf(B.prototype,V().prototype),{initialize(){V().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(B,{...E().getStaticProperties("BlendMode","X_ITE",1,"blendMode","3.3"),fieldDefinitions:{value:new(x())([new(f())(I().inputOutput,"metadata",new(p().SFNode)),new(f())(I().inputOutput,"blendColor",new(p().SFColorRGBA)),new(f())(I().inputOutput,"sourceColorFactor",new(p().SFString)("SRC_ALPHA")),new(f())(I().inputOutput,"sourceAlphaFactor",new(p().SFString)("ONE")),new(f())(I().inputOutput,"destinationColorFactor",new(p().SFString)("ONE_MINUS_SRC_ALPHA")),new(f())(I().inputOutput,"destinationAlphaFactor",new(p().SFString)("ONE_MINUS_SRC_ALPHA")),new(f())(I().inputOutput,"colorEquation",new(p().SFString)("FUNC_ADD")),new(f())(I().inputOutput,"alphaEquation",new(p().SFString)("FUNC_ADD"))]),enumerable:!0}});const k=B,G=a().add("BlendMode",k),j=e.Algorithm;var z=t.n(j);function H(e){C.call(this,e),this.addType(I().ClearcoatMaterialExtension)}v.add("CLEARCOAT_MATERIAL_EXTENSION"),D().add("x3d_ClearcoatTextureEXT"),D().add("x3d_ClearcoatRoughnessTextureEXT"),D().add("x3d_ClearcoatNormalTextureEXT"),Object.assign(Object.setPrototypeOf(H.prototype,C.prototype),{initialize(){C.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=X()(I().X3DSingleTextureNode,this._clearcoatTexture),this.setTexture(0,this.clearcoatTextureNode)},set_clearcoatRoughness__(){this.clearcoatRoughness=z().clamp(this._clearcoatRoughness.getValue(),0,1)},set_clearcoatRoughnessTexture__(){this.clearcoatRoughnessTextureNode=X()(I().X3DSingleTextureNode,this._clearcoatRoughnessTexture),this.setTexture(1,this.clearcoatRoughnessTextureNode)},set_clearcoatNormalTexture__(){this.clearcoatNormalTextureNode=X()(I().X3DSingleTextureNode,this._clearcoatNormalTexture),this.setTexture(2,this.clearcoatNormalTextureNode)},getExtensionKey:()=>v.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))},getShaderUniforms(e){e.push("x3d_ClearcoatEXT"),e.push("x3d_ClearcoatRoughnessEXT")},setShaderUniforms(e,t,s,i){e.uniform1f(t.x3d_ClearcoatEXT,this.clearcoat),e.uniform1f(t.x3d_ClearcoatRoughnessEXT,this.clearcoatRoughness),+this.getTextureBits()&&(this.clearcoatTextureNode?.setNamedShaderUniforms(e,t.x3d_ClearcoatTextureEXT,this._clearcoatTextureMapping.getValue(),s,i),this.clearcoatRoughnessTextureNode?.setNamedShaderUniforms(e,t.x3d_ClearcoatRoughnessTextureEXT,this._clearcoatRoughnessTextureMapping.getValue(),s,i),this.clearcoatNormalTextureNode?.setNamedShaderUniforms(e,t.x3d_ClearcoatNormalTextureEXT,this._clearcoatNormalTextureMapping.getValue(),s,i))}}),Object.defineProperties(H,{...E().getStaticProperties("ClearcoatMaterialExtension","X_ITE",1,"extensions","4.0"),fieldDefinitions:{value:new(x())([new(f())(I().inputOutput,"metadata",new(p().SFNode)),new(f())(I().inputOutput,"clearcoat",new(p().SFFloat)),new(f())(I().inputOutput,"clearcoatTextureMapping",new(p().SFString)),new(f())(I().inputOutput,"clearcoatTexture",new(p().SFNode)),new(f())(I().inputOutput,"clearcoatRoughness",new(p().SFFloat)),new(f())(I().inputOutput,"clearcoatRoughnessTextureMapping",new(p().SFString)),new(f())(I().inputOutput,"clearcoatRoughnessTexture",new(p().SFNode)),new(f())(I().inputOutput,"clearcoatNormalTextureMapping",new(p().SFString)),new(f())(I().inputOutput,"clearcoatNormalTexture",new(p().SFNode))]),enumerable:!0}});const q=H,Y=a().add("ClearcoatMaterialExtension",q);function K(e){V().call(this,e),this.addType(I().DepthMode),this.addAlias("depthFunc",this._depthFunction)}Object.assign(Object.setPrototypeOf(K.prototype,V().prototype),{initialize(){V().prototype.initialize.call(this),this._depthFunction.addInterest("set_depthFunction__",this),this.set_depthFunction__()},set_depthFunction__:(()=>{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(K,{...E().getStaticProperties("DepthMode","X_ITE",1,"depthMode","4.0"),fieldDefinitions:{value:new(x())([new(f())(I().inputOutput,"metadata",new(p().SFNode)),new(f())(I().inputOutput,"polygonOffset",new(p().SFVec2f)),new(f())(I().inputOutput,"depthRange",new(p().SFVec2f)(0,1)),new(f())(I().inputOutput,"depthTest",new(p().SFBool)(!0)),new(f())(I().inputOutput,"depthFunction",new(p().SFString)("LESS_EQUAL")),new(f())(I().inputOutput,"depthMask",new(p().SFBool)(!0))]),enumerable:!0}});const W=K,Q=a().add("DepthMode",W);function $(e){C.call(this,e),this.addType(I().DiffuseTransmissionMaterialExtension),this.diffuseTransmissionColorArray=new Float32Array(3)}v.add("DIFFUSE_TRANSMISSION_MATERIAL_EXTENSION"),D().add("x3d_DiffuseTransmissionTextureEXT"),D().add("x3d_DiffuseTransmissionColorTextureEXT"),Object.assign(Object.setPrototypeOf($.prototype,C.prototype),{initialize(){C.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=z().clamp(this._diffuseTransmission.getValue(),0,1)},set_diffuseTransmissionTexture__(){this.diffuseTransmissionTextureNode=X()(I().X3DSingleTextureNode,this._diffuseTransmissionTexture),this.setTexture(0,this.diffuseTransmissionTextureNode)},set_diffuseTransmissionColor__(){this.diffuseTransmissionColorArray.set(this._diffuseTransmissionColor.getValue())},set_diffuseTransmissionColorTexture__(){this.diffuseTransmissionColorTextureNode=X()(I().X3DSingleTextureNode,this._diffuseTransmissionColorTexture),this.setTexture(1,this.diffuseTransmissionColorTextureNode)},getExtensionKey:()=>v.DIFFUSE_TRANSMISSION_MATERIAL_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))},getShaderUniforms(e){e.push("x3d_DiffuseTransmissionEXT"),e.push("x3d_DiffuseTransmissionColorEXT")},setShaderUniforms(e,t,s,i){e.uniform1f(t.x3d_DiffuseTransmissionEXT,this.diffuseTransmission),e.uniform3fv(t.x3d_DiffuseTransmissionColorEXT,this.diffuseTransmissionColorArray),+this.getTextureBits()&&(this.diffuseTransmissionTextureNode?.setNamedShaderUniforms(e,t.x3d_DiffuseTransmissionTextureEXT,this._diffuseTransmissionTextureMapping.getValue(),s,i),this.diffuseTransmissionColorTextureNode?.setNamedShaderUniforms(e,t.x3d_DiffuseTransmissionColorTextureEXT,this._diffuseTransmissionColorTextureMapping.getValue(),s,i))}}),Object.defineProperties($,{...E().getStaticProperties("DiffuseTransmissionMaterialExtension","X_ITE",1,"extensions","4.0"),fieldDefinitions:{value:new(x())([new(f())(I().inputOutput,"metadata",new(p().SFNode)),new(f())(I().inputOutput,"diffuseTransmission",new(p().SFFloat)),new(f())(I().inputOutput,"diffuseTransmissionTextureMapping",new(p().SFString)),new(f())(I().inputOutput,"diffuseTransmissionTexture",new(p().SFNode)),new(f())(I().inputOutput,"diffuseTransmissionColor",new(p().SFColor)(1,1,1)),new(f())(I().inputOutput,"diffuseTransmissionColorTextureMapping",new(p().SFString)),new(f())(I().inputOutput,"diffuseTransmissionColorTexture",new(p().SFNode))]),enumerable:!0}});const Z=$,J=a().add("DiffuseTransmissionMaterialExtension",Z);function ee(e){C.call(this,e),this.addType(I().DispersionMaterialExtension)}v.add("DISPERSION_MATERIAL_EXTENSION"),Object.assign(Object.setPrototypeOf(ee.prototype,C.prototype),{initialize(){C.prototype.initialize.call(this),this._dispersion.addInterest("set_dispersion__",this),this.set_dispersion__()},set_dispersion__(){this.dispersion=Math.max(this._dispersion.getValue(),0)},getExtensionKey:()=>v.DISPERSION_MATERIAL_EXTENSION,getShaderOptions(e){e.push("X3D_DISPERSION_MATERIAL_EXT")},getShaderUniforms(e){e.push("x3d_DispersionEXT")},setShaderUniforms(e,t,s,i){e.uniform1f(t.x3d_DispersionEXT,this.dispersion)}}),Object.defineProperties(ee,{...E().getStaticProperties("DispersionMaterialExtension","X_ITE",1,"extensions","4.0"),fieldDefinitions:{value:new(x())([new(f())(I().inputOutput,"metadata",new(p().SFNode)),new(f())(I().inputOutput,"dispersion",new(p().SFFloat))]),enumerable:!0}});const te=ee,se=a().add("DispersionMaterialExtension",te);function ie(e){C.call(this,e),this.addType(I().EmissiveStrengthMaterialExtension)}v.add("EMISSIVE_STRENGTH_MATERIAL_EXTENSION"),Object.assign(Object.setPrototypeOf(ie.prototype,C.prototype),{initialize(){C.prototype.initialize.call(this),this._emissiveStrength.addInterest("set_emissiveStrength__",this),this.set_emissiveStrength__()},set_emissiveStrength__(){this.emissiveStrength=Math.max(this._emissiveStrength.getValue(),0)},getExtensionKey:()=>v.EMISSIVE_STRENGTH_MATERIAL_EXTENSION,getShaderOptions(e){e.push("X3D_EMISSIVE_STRENGTH_MATERIAL_EXT")},getShaderUniforms(e){e.push("x3d_EmissiveStrengthEXT")},setShaderUniforms(e,t,s,i){e.uniform1f(t.x3d_EmissiveStrengthEXT,this.emissiveStrength)}}),Object.defineProperties(ie,{...E().getStaticProperties("EmissiveStrengthMaterialExtension","X_ITE",1,"extensions","4.0"),fieldDefinitions:{value:new(x())([new(f())(I().inputOutput,"metadata",new(p().SFNode)),new(f())(I().inputOutput,"emissiveStrength",new(p().SFFloat)(1))]),enumerable:!0}});const ne=ie,re=a().add("EmissiveStrengthMaterialExtension",ne),oe=e.X3DShapeNode;var ae=t.n(oe);const ue=e.VertexArray;var le=t.n(ue);const ce=e.Matrix4;var _e=t.n(ce);const de=e.Box3;var he=t.n(de);function pe(e){ae().call(this,e),this.addType(I().InstancedShape),this.addChildObjects(I().outputOnly,"matrices",new(p().SFTime)),this._translations.setUnit("length"),this._centers.setUnit("length"),this.numInstances=0,this.instancesStride=25*Float32Array.BYTES_PER_ELEMENT,this.matrixOffset=0,this.normalMatrixOffset=16*Float32Array.BYTES_PER_ELEMENT,this.matrices=[]}Object.assign(Object.setPrototypeOf(pe.prototype,ae().prototype),{initialize(){ae().prototype.initialize.call(this);const e=this.getBrowser().getContext();this.instances=Object.assign(e.createBuffer(),{vertexArrayObject:new(le())(e),thickLinesVertexArrayObject:new(le())(e)}),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_matrices__()},getShapeKey:()=>3,getNumInstances(){return this.numInstances},getInstances(){return this.instances},set_bbox__:(()=>{const e=new(he());return function(){if(this.isDefaultBBoxSize())if(this.getGeometry()){this.bbox.set();const t=this.getGeometry().getBBox();for(const s of this.matrices)this.bbox.add(e.assign(t).multRight(s))}else this.bbox.set();else this.bbox.set(this._bboxSize.getValue(),this._bboxCenter.getValue());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,l=n.length,c=r.length,_=Math.max(o,a,u,l,c),d=this.instancesStride/Float32Array.BYTES_PER_ELEMENT,h=this.instancesStride*_,p=new Float32Array(h);this.numInstances=_;for(let e=0,h=0;e<_;++e,h+=d){const _=this.matrices[e]??=new(_e());_.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,l?n[Math.min(e,l-1)].getValue():null,c?r[Math.min(e,c-1)].getValue():null),p.set(_,h),p.set(_.submatrix.transpose().inverse(),h+16)}this.matrices.length=_,e.bindBuffer(e.ARRAY_BUFFER,this.instances),e.bufferData(e.ARRAY_BUFFER,p,e.DYNAMIC_DRAW),this.set_bbox__(),this.set_objects__()},displaySimple(e,t,s){this.getGeometry().displaySimpleInstanced(e,s,this)},display(e,t){this.getGeometry().displayInstanced(e,t,this)}}),Object.defineProperties(pe,{...E().getStaticProperties("InstancedShape","X_ITE",1,"children","2.0"),fieldDefinitions:{value:new(x())([new(f())(I().inputOutput,"metadata",new(p().SFNode)),new(f())(I().inputOutput,"translations",new(p().MFVec3f)),new(f())(I().inputOutput,"rotations",new(p().MFRotation)),new(f())(I().inputOutput,"scales",new(p().MFVec3f)),new(f())(I().inputOutput,"scaleOrientations",new(p().MFRotation)),new(f())(I().inputOutput,"centers",new(p().MFVec3f)),new(f())(I().inputOutput,"pointerEvents",new(p().SFBool)(!0)),new(f())(I().inputOutput,"castShadow",new(p().SFBool)(!0)),new(f())(I().inputOutput,"visible",new(p().SFBool)(!0)),new(f())(I().inputOutput,"bboxDisplay",new(p().SFBool)),new(f())(I().initializeOnly,"bboxSize",new(p().SFVec3f)(-1,-1,-1)),new(f())(I().initializeOnly,"bboxCenter",new(p().SFVec3f)),new(f())(I().inputOutput,"appearance",new(p().SFNode)),new(f())(I().inputOutput,"geometry",new(p().SFNode))]),enumerable:!0}});const Te=pe,fe=a().add("InstancedShape",Te);function Se(e){C.call(this,e),this.addType(I().IORMaterialExtension)}v.add("IOR_MATERIAL_EXTENSION"),Object.assign(Object.setPrototypeOf(Se.prototype,C.prototype),{initialize(){C.prototype.initialize.call(this),this._indexOfRefraction.addInterest("set_indexOfRefraction__",this),this.set_indexOfRefraction__()},set_indexOfRefraction__(){this.indexOfRefraction=Math.max(this._indexOfRefraction.getValue(),1)},getExtensionKey:()=>v.IOR_MATERIAL_EXTENSION,getShaderOptions(e){e.push("X3D_IOR_MATERIAL_EXT")},getShaderUniforms(e){e.push("x3d_IorEXT")},setShaderUniforms(e,t,s,i){e.uniform1f(t.x3d_IorEXT,this.indexOfRefraction)}}),Object.defineProperties(Se,{...E().getStaticProperties("IORMaterialExtension","X_ITE",1,"extensions","4.0"),fieldDefinitions:{value:new(x())([new(f())(I().inputOutput,"metadata",new(p().SFNode)),new(f())(I().inputOutput,"indexOfRefraction",new(p().SFFloat)(1.5))]),enumerable:!0}});const xe=Se,me=a().add("IORMaterialExtension",xe),Ee=e.ShaderRegistry;var ge=t.n(Ee);const Ie=a().add("Iridescence2.glsl",()=>"\n#if defined(X3D_IRIDESCENCE_MATERIAL_EXT)\nconst mat3 XYZ_TO_REC709=mat3(3.2404542,-.9692660,.0556434,-1.5371385,1.8760108,-.2040259,-.4985314,.0415560,1.0572252);float sq(const in float v){return v*v;}vec3 sq(const in vec3 v){return v*v;}vec3 Fresnel0ToIor(const in vec3 fresnel0){vec3 sqrtF0=sqrt(fresnel0);return(vec3(1)+sqrtF0)/(vec3(1)-sqrtF0);}vec3 IorToFresnel0(const in vec3 transmittedIor,const in float incidentIor){return sq((transmittedIor-vec3(incidentIor))/(transmittedIor+vec3(incidentIor)));}float IorToFresnel0(const in float transmittedIor,const in float incidentIor){return sq((transmittedIor-incidentIor)/(transmittedIor+incidentIor));}vec3 evalSensitivity(const in float OPD,const in vec3 shift){const vec3 val=vec3(5.4856e-13,4.4201e-13,5.2481e-13);const vec3 pos=vec3(1.6810e+06,1.7953e+06,2.2084e+06);const vec3 var=vec3(4.3278e+09,9.3046e+09,6.6121e+09);float phase=2.*M_PI*OPD*1.0e-9;vec3 xyz=val*sqrt(2.*M_PI*var)*cos(pos*phase+shift)*exp(-sq(phase)*var);xyz.x+=9.7470e-14*sqrt(2.*M_PI*4.5282e+09)*cos(2.2399e+06*phase+shift[0])*exp(-4.5282e+09*sq(phase));xyz/=1.0685e-7;vec3 srgb=XYZ_TO_REC709*xyz;return srgb;}vec3 evalIridescence(const in float outsideIOR,const in float eta2,const in float cosTheta1,const in float thinFilmThickness,const in vec3 baseF0){vec3 I;float iridescenceIor=mix(outsideIOR,eta2,smoothstep(0.,.03,thinFilmThickness));float sinTheta2Sq=sq(outsideIOR/iridescenceIor)*(1.-sq(cosTheta1));float cosTheta2Sq=1.-sinTheta2Sq;if(cosTheta2Sq<0.)return vec3(1);float cosTheta2=sqrt(cosTheta2Sq);float R0=IorToFresnel0(iridescenceIor,outsideIOR);float R12=F_Schlick(R0,cosTheta1);float R21=R12;float T121=1.-R12;float phi12=0.;if(iridescenceIor<outsideIOR)phi12=M_PI;float phi21=M_PI-phi12;vec3 baseIOR=Fresnel0ToIor(clamp(baseF0,0.,.9999));vec3 R1=IorToFresnel0(baseIOR,iridescenceIor);vec3 R23=F_Schlick(R1,cosTheta2);vec3 phi23=vec3(0);if(baseIOR[0]<iridescenceIor)phi23[0]=M_PI;if(baseIOR[1]<iridescenceIor)phi23[1]=M_PI;if(baseIOR[2]<iridescenceIor)phi23[2]=M_PI;float OPD=2.*iridescenceIor*thinFilmThickness*cosTheta2;vec3 phi=vec3(phi21)+phi23;vec3 R123=clamp(R12*R23,1e-5,.9999);vec3 r123=sqrt(R123);vec3 Rs=sq(T121)*R23/(vec3(1)-R123);vec3 C0=R12+Rs;I=C0;vec3 Cm=Rs-T121;for(int m=1;m<=2;++m){Cm*=r123;vec3 Sm=2.*evalSensitivity(float(m)*OPD,float(m)*phi);I+=Cm*Sm;}return max(I,vec3(0));}\n#endif\n");function Oe(e){C.call(this,e),this.addType(I().IridescenceMaterialExtension)}v.add("IRIDESCENCE_MATERIAL_EXTENSION"),ge().addInclude("Iridescence",Ie),D().add("x3d_IridescenceTextureEXT"),D().add("x3d_IridescenceThicknessTextureEXT"),Object.assign(Object.setPrototypeOf(Oe.prototype,C.prototype),{initialize(){C.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=X()(I().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=X()(I().X3DSingleTextureNode,this._iridescenceThicknessTexture),this.setTexture(1,this.iridescenceThicknessTextureNode)},getExtensionKey:()=>v.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))},getShaderUniforms(e){e.push("x3d_IridescenceEXT"),e.push("x3d_IridescenceIndexOfRefractionEXT"),e.push("x3d_IridescenceThicknessMinimumEXT"),e.push("x3d_IridescenceThicknessMaximumEXT")},setShaderUniforms(e,t,s,i){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.x3d_IridescenceTextureEXT,this._iridescenceTextureMapping.getValue(),s,i),this.iridescenceThicknessTextureNode?.setNamedShaderUniforms(e,t.x3d_IridescenceThicknessTextureEXT,this._iridescenceThicknessTextureMapping.getValue(),s,i))}}),Object.defineProperties(Oe,{...E().getStaticProperties("IridescenceMaterialExtension","X_ITE",1,"extensions","4.0"),fieldDefinitions:{value:new(x())([new(f())(I().inputOutput,"metadata",new(p().SFNode)),new(f())(I().inputOutput,"iridescence",new(p().SFFloat)),new(f())(I().inputOutput,"iridescenceTextureMapping",new(p().SFString)),new(f())(I().inputOutput,"iridescenceTexture",new(p().SFNode)),new(f())(I().inputOutput,"iridescenceIndexOfRefraction",new(p().SFFloat)(1.3)),new(f())(I().inputOutput,"iridescenceThicknessMinimum",new(p().SFFloat)(100)),new(f())(I().inputOutput,"iridescenceThicknessMaximum",new(p().SFFloat)(400)),new(f())(I().inputOutput,"iridescenceThicknessTextureMapping",new(p().SFString)),new(f())(I().inputOutput,"iridescenceThicknessTexture",new(p().SFNode))]),enumerable:!0}});const Ne=Oe,Ae=a().add("IridescenceMaterialExtension",Ne);function Re(e){C.call(this,e),this.addType(I().SheenMaterialExtension),this.sheenColorArray=new Float32Array(3)}v.add("SHEEN_MATERIAL_EXTENSION"),D().add("x3d_SheenColorTextureEXT"),D().add("x3d_SheenRoughnessTextureEXT"),Object.assign(Object.setPrototypeOf(Re.prototype,C.prototype),{initialize(){C.prototype.initialize.call(this),this.getBrowser().getLibraryTexture("lut_charlie.png"),this.getBrowser().getLibraryTexture("lut_sheen_E.png"),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__(){this.sheenColorArray.set(this._sheenColor.getValue())},set_sheenColorTexture__(){this.sheenColorTextureNode=X()(I().X3DSingleTextureNode,this._sheenColorTexture),this.setTexture(0,this.sheenColorTextureNode)},set_sheenRoughness__(){this.sheenRoughness=z().clamp(this._sheenRoughness.getValue(),0,1)},set_sheenRoughnessTexture__(){this.sheenRoughnessTextureNode=X()(I().X3DSingleTextureNode,this._sheenRoughnessTexture),this.setTexture(1,this.sheenRoughnessTextureNode)},getExtensionKey:()=>v.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))},getShaderUniforms(e){e.push("x3d_SheenColorEXT"),e.push("x3d_SheenRoughnessEXT"),e.push("x3d_SheenELUTTextureEXT")},setShaderUniforms(e,t,s,i){e.uniform3fv(t.x3d_SheenColorEXT,this.sheenColorArray),e.uniform1f(t.x3d_SheenRoughnessEXT,this.sheenRoughness);const n=this.getBrowser(),r=n.getLibraryTexture("lut_sheen_E.png"),o=n.popTextureUnit();e.activeTexture(e.TEXTURE0+o),e.bindTexture(e.TEXTURE_2D,r.getTexture()),e.uniform1i(t.x3d_SheenELUTTextureEXT,o),+this.getTextureBits()&&(this.sheenColorTextureNode?.setNamedShaderUniforms(e,t.x3d_SheenColorTextureEXT,this._sheenColorTextureMapping.getValue(),s,i),this.sheenRoughnessTextureNode?.setNamedShaderUniforms(e,t.x3d_SheenRoughnessTextureEXT,this._sheenRoughnessTextureMapping.getValue(),s,i))}}),Object.defineProperties(Re,{...E().getStaticProperties("SheenMaterialExtension","X_ITE",1,"extensions","4.0"),fieldDefinitions:{value:new(x())([new(f())(I().inputOutput,"metadata",new(p().SFNode)),new(f())(I().inputOutput,"sheenColor",new(p().SFColor)),new(f())(I().inputOutput,"sheenColorTextureMapping",new(p().SFString)),new(f())(I().inputOutput,"sheenColorTexture",new(p().SFNode)),new(f())(I().inputOutput,"sheenRoughness",new(p().SFFloat)),new(f())(I().inputOutput,"sheenRoughnessTextureMapping",new(p().SFString)),new(f())(I().inputOutput,"sheenRoughnessTexture",new(p().SFNode))]),enumerable:!0}});const Ce=Re,Me=a().add("SheenMaterialExtension",Ce),Xe=e.X3DOneSidedMaterialNode;var ye=t.n(Xe);const we=a().add("SpecularGlossiness2.glsl",()=>`\n#pragma X3D include "../common/Fragment.glsl"\n#pragma X3D include "../common/Shadow.glsl"\n#if defined(X3D_LIGHTING)\nuniform x3d_LightSourceParameters x3d_LightSource[X3D_NUM_LIGHTS];\n#endif\nuniform x3d_PhysicalMaterialParameters x3d_Material;\n#pragma X3D include "pbr/BRDF.glsl"\n#pragma X3D include "pbr/MaterialInfo.glsl"\n#pragma X3D include "pbr/Punctual.glsl"\n#pragma X3D include "pbr/IBL.glsl"\n${D().texture("x3d_DiffuseTexture","rgba","linear")}\nvec4 getBaseColor(){float alpha=1.-x3d_Material.transparency;vec4 baseColor=vec4(x3d_Material.diffuseColor,alpha);\n#if defined(X3D_COLOR_MATERIAL)\nbaseColor*=color;\n#endif\n#if defined(X3D_DIFFUSE_TEXTURE)\nbaseColor*=getDiffuseTexture();\n#elif defined(X3D_TEXTURE)\nbaseColor=getTextureColor(baseColor,vec4(vec3(1),alpha));\n#endif\nreturn baseColor;}\n${D().texture("x3d_SpecularGlossinessTexture","rgba","linear")}\nMaterialInfo getSpecularGlossinessInfo(in MaterialInfo info){vec3 specular=x3d_Material.specularColor;float glossiness=x3d_Material.glossiness;\n#if defined(X3D_SPECULAR_GLOSSINESS_TEXTURE)\nvec4 sgSample=getSpecularGlossinessTexture();glossiness*=sgSample.a;specular*=sgSample.rgb;\n#endif\ninfo.perceptualRoughness=1.-glossiness;info.f0_dielectric=min(specular,vec3(1));return info;}vec4 getMaterialColor(const in vec4 fragCoord){vec4 baseColor=getBaseColor();\n#if defined(X3D_TEXTURE_PROJECTION)\nbaseColor.rgb*=getTextureProjectorColor();\n#endif\nvec3 color=vec3(0);vec3 v=normalize(-vertex);\n#if defined(X3D_USE_IBL)||defined(X3D_LIGHTING)\nNormalInfo normalInfo=getNormalInfo(x3d_Material.normalScale);vec3 n=normalInfo.n;float NdotV=clamp(dot(n,v),0.,1.);\n#endif\nMaterialInfo materialInfo;materialInfo.baseColor=baseColor.rgb;materialInfo.f90_dielectric=vec3(1);materialInfo.metallic=0.;materialInfo=getSpecularGlossinessInfo(materialInfo);materialInfo.perceptualRoughness=clamp(materialInfo.perceptualRoughness,0.,1.);materialInfo.alphaRoughness=materialInfo.perceptualRoughness*materialInfo.perceptualRoughness;vec3 f_emissive=vec3(0);\n#if defined(X3D_USE_IBL)\nvec3 f_diffuse=getDiffuseLight(n)*baseColor.rgb;vec3 f_specular_dielectric=getIBLRadianceGGX(n,v,materialInfo.perceptualRoughness);vec3 f_dielectric_fresnel_ibl=getIBLGGXFresnel(n,v,materialInfo.perceptualRoughness,materialInfo.f0_dielectric,1.);vec3 f_dielectric_brdf_ibl=mix(f_diffuse,f_specular_dielectric,f_dielectric_fresnel_ibl);color=f_dielectric_brdf_ibl;\n#if defined(X3D_OCCLUSION_TEXTURE)\nfloat ao=getOcclusionFactor();color*=1.+x3d_Material.occlusionStrength*(ao-1.);\n#endif\n#endif\n#if defined(X3D_LIGHTING)\nfor(int i=0;i<X3D_NUM_LIGHTS;++i){x3d_LightSourceParameters light=x3d_LightSource[i];vec3 pointToLight;float distanceToLight;if(light.type!=x3d_DirectionalLight){pointToLight=light.location-vertex;distanceToLight=length(light.matrix*pointToLight);}else{pointToLight=-light.direction;distanceToLight=-1.;}if(distanceToLight<=light.radius||light.radius<0.){vec3 l=normalize(pointToLight);vec3 h=normalize(l+v);float NdotL=clamp(dot(n,l),0.,1.);float NdotV=clamp(dot(n,v),0.,1.);float NdotH=clamp(dot(n,h),0.,1.);float VdotH=clamp(dot(v,h),0.,1.);vec3 dielectric_fresnel=F_Schlick(materialInfo.f0_dielectric,materialInfo.f90_dielectric,abs(VdotH));vec3 lightIntensity=getLightIntensity(light,l,distanceToLight);vec3 intensity=lightIntensity;\n#if defined(X3D_SHADOWS)\nlightIntensity=mix(lightIntensity,light.shadowColor,getShadowIntensity(i,light));\n#endif\nvec3 l_diffuse=lightIntensity*NdotL*BRDF_lambertian(baseColor.rgb);vec3 l_specular_dielectric=intensity*NdotL*BRDF_specularGGX(materialInfo.alphaRoughness,NdotL,NdotV,NdotH);vec3 l_dielectric_brdf=mix(l_diffuse,l_specular_dielectric,dielectric_fresnel);color+=l_dielectric_brdf;}}\n#endif\nf_emissive=getEmissiveColor();\n#if defined(X3D_UNLIT_MATERIAL_EXT)\ncolor=baseColor.rgb;\n#elif(defined(X3D_GEOMETRY_0D)||defined(X3D_GEOMETRY_1D))&&!defined(X3D_NORMALS)\ncolor=f_emissive+baseColor.rgb;\n#else\ncolor=f_emissive+color;\n#endif\nreturn vec4(color,baseColor.a);}`),ve=a().add("SpecularGlossiness2.fs",()=>'#version 300 es\nprecision highp float;precision highp int;precision highp sampler2D;precision highp sampler3D;precision highp samplerCube;\n#pragma X3D include "pbr/SpecularGlossiness.glsl"\n');function Fe(e){console.warn("SpecularGlossinessMaterial is depreciated, please use PhysicalMaterial instead."),ye().call(this,e),this.addType(I().SpecularGlossinessMaterial),this.diffuseColorArray=new Float32Array(3),this.specularColorArray=new Float32Array(3)}ge().addInclude("SpecularGlossiness",we),ge().addFragment("SpecularGlossiness",ve),D().add("x3d_SpecularGlossinessTexture"),Object.assign(Object.setPrototypeOf(Fe.prototype,ye().prototype),{initialize(){ye().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.set_diffuseColor__(),this.set_diffuseTexture__(),this.set_specularColor__(),this.set_glossiness__(),this.set_specularGlossinessTexture__(),this.set_occlusionStrength__(),this.set_occlusionTexture__(),this.set_transparent__()},isPhysical:()=>!0,getMaterialKey:()=>4,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__(){this.diffuseColorArray.set(this._diffuseColor.getValue())},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=X()(I().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__(){this.specularColorArray.set(this._specularColor.getValue())},set_glossiness__(){this.glossiness=z().clamp(this._glossiness.getValue(),0,1)},set_specularGlossinessTexture__(){this.specularGlossinessTextureNode=X()(I().X3DSingleTextureNode,this._specularGlossinessTexture),this.setTexture(this.getTextureIndices().SPECULAR_GLOSSINESS_TEXTURE,this.specularGlossinessTextureNode)},set_occlusionStrength__(){this.occlusionStrength=z().clamp(this._occlusionStrength.getValue(),0,1)},set_occlusionTexture__(){this.occlusionTextureNode=X()(I().X3DSingleTextureNode,this._occlusionTexture),this.setTexture(this.getTextureIndices().OCCLUSION_TEXTURE,this.occlusionTextureNode)},createShader(e,t,s){const i=this.getBrowser(),n=this.getShaderOptions(t,s);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","SpecularGlossiness",n);return i.getShaders().set(e,r),r},setShaderUniforms(e,t,s,i){ye().prototype.setShaderUniforms.call(this,e,t,s,i),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.x3d_DiffuseTexture,this._diffuseTextureMapping.getValue(),s,i),this.specularGlossinessTextureNode?.setNamedShaderUniforms(e,t.x3d_SpecularGlossinessTexture,this._specularGlossinessTextureMapping.getValue(),s,i),this.occlusionTextureNode&&(e.uniform1f(t.x3d_OcclusionStrength,this.occlusionStrength),this.occlusionTextureNode.setNamedShaderUniforms(e,t.x3d_OcclusionTexture,this._occlusionTextureMapping.getValue(),s,i)))}}),Object.defineProperties(Fe,{...E().getStaticProperties("SpecularGlossinessMaterial","X_ITE",1,"material","4.0"),fieldDefinitions:{value:new(x())([new(f())(I().inputOutput,"metadata",new(p().SFNode)),new(f())(I().inputOutput,"diffuseColor",new(p().SFColor)(1,1,1)),new(f())(I().inputOutput,"diffuseTextureMapping",new(p().SFString)),new(f())(I().inputOutput,"diffuseTexture",new(p().SFNode)),new(f())(I().inputOutput,"specularColor",new(p().SFColor)(1,1,1)),new(f())(I().inputOutput,"glossiness",new(p().SFFloat)(1)),new(f())(I().inputOutput,"specularGlossinessTextureMapping",new(p().SFString)),new(f())(I().inputOutput,"specularGlossinessTexture",new(p().SFNode)),new(f())(I().inputOutput,"emissiveColor",new(p().SFColor)),new(f())(I().inputOutput,"emissiveTextureMapping",new(p().SFString)),new(f())(I().inputOutput,"emissiveTexture",new(p().SFNode)),new(f())(I().inputOutput,"occlusionStrength",new(p().SFFloat)(1)),new(f())(I().inputOutput,"occlusionTextureMapping",new(p().SFString)),new(f())(I().inputOutput,"occlusionTexture",new(p().SFNode)),new(f())(I().inputOutput,"normalScale",new(p().SFFloat)(1)),new(f())(I().inputOutput,"normalTextureMapping",new(p().SFString)),new(f())(I().inputOutput,"normalTexture",new(p().SFNode)),new(f())(I().inputOutput,"transparency",new(p().SFFloat))]),enumerable:!0}});for(const e of Object.values(Fe.prototype.getTextureIndices()))Fe.prototype[`setTexture${e}`]=function(e,t){this.setTexture(e,t)};const De=Fe,Le=a().add("SpecularGlossinessMaterial",De);function be(e){C.call(this,e),this.addType(I().SpecularMaterialExtension),this.specularColorArray=new Float32Array(3)}v.add("SPECULAR_MATERIAL_EXTENSION"),D().add("x3d_SpecularTextureEXT"),D().add("x3d_SpecularColorTextureEXT"),Object.assign(Object.setPrototypeOf(be.prototype,C.prototype),{initialize(){C.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=X()(I().X3DSingleTextureNode,this._specularTexture),this.setTexture(0,this.specularTextureNode)},set_specularColor__(){this.specularColorArray.set(this._specularColor.getValue())},set_specularColorTexture__(){this.specularColorTextureNode=X()(I().X3DSingleTextureNode,this._specularColorTexture),this.setTexture(1,this.specularColorTextureNode)},getExtensionKey:()=>v.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))},getShaderUniforms(e){e.push("x3d_SpecularEXT"),e.push("x3d_SpecularColorEXT")},setShaderUniforms(e,t,s,i){e.uniform1f(t.x3d_SpecularEXT,this.specular),e.uniform3fv(t.x3d_SpecularColorEXT,this.specularColorArray),+this.getTextureBits()&&(this.specularTextureNode?.setNamedShaderUniforms(e,t.x3d_SpecularTextureEXT,this._specularTextureMapping.getValue(),s,i),this.specularColorTextureNode?.setNamedShaderUniforms(e,t.x3d_SpecularColorTextureEXT,this._specularColorTextureMapping.getValue(),s,i))}}),Object.defineProperties(be,{...E().getStaticProperties("SpecularMaterialExtension","X_ITE",1,"extensions","4.0"),fieldDefinitions:{value:new(x())([new(f())(I().inputOutput,"metadata",new(p().SFNode)),new(f())(I().inputOutput,"specular",new(p().SFFloat)(1)),new(f())(I().inputOutput,"specularTextureMapping",new(p().SFString)),new(f())(I().inputOutput,"specularTexture",new(p().SFNode)),new(f())(I().inputOutput,"specularColor",new(p().SFColor)(1,1,1)),new(f())(I().inputOutput,"specularColorTextureMapping",new(p().SFString)),new(f())(I().inputOutput,"specularColorTexture",new(p().SFNode))]),enumerable:!0}});const Ue=be,Pe=a().add("SpecularMaterialExtension",Ue);function Ve(e){C.call(this,e),this.addType(I().TransmissionMaterialExtension)}v.add("TRANSMISSION_MATERIAL_EXTENSION"),D().add("x3d_TransmissionTextureEXT"),Object.assign(Object.setPrototypeOf(Ve.prototype,C.prototype),{initialize(){C.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=z().clamp(this._transmission.getValue(),0,1)},set_transmissionTexture__(){this.transmissionTextureNode=X()(I().X3DSingleTextureNode,this._transmissionTexture),this.setTexture(0,this.transmissionTextureNode)},getExtensionKey:()=>v.TRANSMISSION_MATERIAL_EXTENSION,getShaderOptions(e){e.push("X3D_TRANSMISSION_MATERIAL_EXT"),+this.getTextureBits()&&(e.push("X3D_MATERIAL_TEXTURES"),this.transmissionTextureNode?.getShaderOptions(e,"TRANSMISSION",!0))},getShaderUniforms(e){e.push("x3d_TransmissionEXT"),e.push("x3d_TransmissionSamplerEXT")},setShaderUniforms(e,t,s,i){const n=this.getBrowser(),r=n.getTransmissionBuffer(),o=n.popTextureUnit(),a=r.getColorTexture();e.uniform1f(t.x3d_TransmissionEXT,this.transmission),e.activeTexture(e.TEXTURE0+o),e.bindTexture(e.TEXTURE_2D,a),e.uniform1i(t.x3d_TransmissionSamplerEXT,o),+this.getTextureBits()&&this.transmissionTextureNode?.setNamedShaderUniforms(e,t.x3d_TransmissionTextureEXT,this._transmissionTextureMapping.getValue(),s,i)}}),Object.defineProperties(Ve,{...E().getStaticProperties("TransmissionMaterialExtension","X_ITE",1,"extensions","4.0"),fieldDefinitions:{value:new(x())([new(f())(I().inputOutput,"metadata",new(p().SFNode)),new(f())(I().inputOutput,"transmission",new(p().SFFloat)),new(f())(I().inputOutput,"transmissionTextureMapping",new(p().SFString)),new(f())(I().inputOutput,"transmissionTexture",new(p().SFNode))]),enumerable:!0}});const Be=Ve,ke=a().add("TransmissionMaterialExtension",Be);function Ge(e){C.call(this,e),this.addType(I().VolumeMaterialExtension),this._thickness.setUnit("length"),this._attenuationDistance.setUnit("length"),this.attenuationColorArray=new Float32Array(3)}v.add("VOLUME_MATERIAL_EXTENSION"),D().add("x3d_ThicknessTextureEXT"),Object.assign(Object.setPrototypeOf(Ge.prototype,C.prototype),{initialize(){C.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=X()(I().X3DSingleTextureNode,this._thicknessTexture),this.setTexture(0,this.thicknessTextureNode)},set_attenuationDistance__(){this.attenuationDistance=Math.max(this._attenuationDistance.getValue(),0)},set_attenuationColor__(){this.attenuationColorArray.set(this._attenuationColor.getValue())},getExtensionKey:()=>v.VOLUME_MATERIAL_EXTENSION,getShaderOptions(e){e.push("X3D_VOLUME_MATERIAL_EXT"),+this.getTextureBits()&&(e.push("X3D_MATERIAL_TEXTURES"),this.thicknessTextureNode?.getShaderOptions(e,"THICKNESS",!0))},getShaderUniforms(e){e.push("x3d_ThicknessEXT"),e.push("x3d_AttenuationDistanceEXT"),e.push("x3d_AttenuationColorEXT")},setShaderUniforms(e,t,s,i){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.x3d_ThicknessTextureEXT,this._thicknessTextureMapping.getValue(),s,i)}}),Object.defineProperties(Ge,{...E().getStaticProperties("VolumeMaterialExtension","X_ITE",1,"extensions","4.0"),fieldDefinitions:{value:new(x())([new(f())(I().inputOutput,"metadata",new(p().SFNode)),new(f())(I().inputOutput,"thickness",new(p().SFFloat)),new(f())(I().inputOutput,"thicknessTextureMapping",new(p().SFString)),new(f())(I().inputOutput,"thicknessTexture",new(p().SFNode)),new(f())(I().inputOutput,"attenuationDistance",new(p().SFFloat)(1e6)),new(f())(I().inputOutput,"attenuationColor",new(p().SFColor)(1,1,1))]),enumerable:!0}});const je=Ge,ze=a().add("VolumeMaterialExtension",je);class He{static SCATTER_SAMPLES_COUNT=55;static{const[e,t]=this.#e();this.SCATTER_SAMPLES=e,this.SCATTER_MIN_RADIUS=t}static#e(){const e=this.#t(1,1);let t=1;const s=Math.PI*(3-Math.sqrt(5)),i=[];for(let n=0;n<this.SCATTER_SAMPLES_COUNT;++n){const r=s*n+2*Math.PI*.5,o=(.5+n)/this.SCATTER_SAMPLES_COUNT,a=this.#s(e,o);t=Math.min(t,a),i.push(r,a,1/this.#i(e,a))}return t=Math.max(t,1e-5),[new Float32Array(i),t]}static#s(e,t){let s;s=(t*=.9963790093708328)<=.9?Math.exp(t*t*2.4)-1:15;for(let e=0;e<10;++e){const e=Math.exp(-s/3),i=e*e*e,n=1-.25*i-.75*e-t,r=.25*i+.25*e;if(Math.abs(n)<1e-6||0===r)break;s-=n/r,s=Math.max(s,0)}return s*e}static#n(e,t){if(t>=16*e)return 0;const s=Math.exp(-t/(3*e));return(s*s*s+s)/(8*Math.PI*e)}static#i(e,t){return this.#n(e,t)/.9963790093708328}static#t(e,t){return.0795774715459