x_ite 10.2.0 → 10.3.1
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/LICENSE.md +4 -0
- package/dist/assets/components/{Annotation.js → AnnotationComponent.js} +138 -260
- package/dist/assets/components/AnnotationComponent.min.js +2 -0
- package/dist/assets/components/{CADGeometry.js → CADGeometryComponent.js} +177 -299
- package/dist/assets/components/CADGeometryComponent.min.js +2 -0
- package/dist/assets/components/{CubeMapTexturing.js → CubeMapTexturingComponent.js} +204 -255
- package/dist/assets/components/CubeMapTexturingComponent.min.js +2 -0
- package/dist/assets/components/DISComponent.js +994 -0
- package/dist/assets/components/DISComponent.min.js +2 -0
- package/dist/assets/components/{EventUtilities.js → EventUtilitiesComponent.js} +121 -274
- package/dist/assets/components/EventUtilitiesComponent.min.js +2 -0
- package/dist/assets/components/{Geometry2D.js → Geometry2DComponent.js} +202 -356
- package/dist/assets/components/Geometry2DComponent.min.js +2 -0
- package/dist/assets/components/{Geospatial.js → GeospatialComponent.js} +449 -676
- package/dist/assets/components/GeospatialComponent.min.js +2 -0
- package/dist/assets/components/{HAnim.js → HAnimComponent.js} +277 -387
- package/dist/assets/components/HAnimComponent.min.js +2 -0
- package/dist/assets/components/{KeyDeviceSensor.js → KeyDeviceSensorComponent.js} +71 -114
- package/dist/assets/components/KeyDeviceSensorComponent.min.js +2 -0
- package/dist/assets/components/{Layout.js → LayoutComponent.js} +234 -339
- package/dist/assets/components/LayoutComponent.min.js +2 -0
- package/dist/assets/components/{NURBS.js → NURBSComponent.js} +349 -652
- package/dist/assets/components/NURBSComponent.min.js +2 -0
- package/dist/assets/components/{ParticleSystems.js → ParticleSystemsComponent.js} +345 -674
- package/dist/assets/components/ParticleSystemsComponent.min.js +2 -0
- package/dist/assets/components/{Picking.js → PickingComponent.js} +245 -472
- package/dist/assets/components/PickingComponent.min.js +2 -0
- package/dist/assets/components/{RigidBodyPhysics.js → RigidBodyPhysicsComponent.js} +496 -804
- package/dist/assets/components/RigidBodyPhysicsComponent.min.js +2 -0
- package/dist/assets/components/ScriptingComponent.js +899 -0
- package/dist/assets/components/ScriptingComponent.min.js +2 -0
- package/dist/assets/components/{Text.js → TextComponent.js} +200 -250
- package/dist/assets/components/TextComponent.min.js +2 -0
- package/dist/assets/components/{TextureProjection.js → TextureProjectionComponent.js} +144 -190
- package/dist/assets/components/TextureProjectionComponent.min.js +2 -0
- package/dist/assets/components/{Texturing3D.js → Texturing3DComponent.js} +225 -387
- package/dist/assets/components/Texturing3DComponent.min.js +2 -0
- package/dist/assets/components/{VolumeRendering.js → VolumeRenderingComponent.js} +316 -603
- package/dist/assets/components/VolumeRenderingComponent.min.js +2 -0
- package/dist/assets/components/{X_ITE.js → X_ITEComponent.js} +301 -599
- package/dist/assets/components/X_ITEComponent.min.js +2 -0
- package/dist/assets/images/XR.svg +74 -0
- package/dist/example.html +1 -1
- package/dist/x_ite.css +1 -1
- package/dist/x_ite.d.ts +68 -11
- package/dist/x_ite.js +2905 -5804
- package/dist/x_ite.min.js +2 -1
- package/dist/x_ite.min.mjs +2 -1
- package/dist/x_ite.mjs +2905 -5804
- package/dist/x_ite.zip +0 -0
- package/package.json +8 -6
- package/dist/assets/components/Annotation.min.js +0 -1
- package/dist/assets/components/CADGeometry.min.js +0 -1
- package/dist/assets/components/CubeMapTexturing.min.js +0 -1
- package/dist/assets/components/DIS.js +0 -1104
- package/dist/assets/components/DIS.min.js +0 -1
- package/dist/assets/components/EventUtilities.min.js +0 -1
- package/dist/assets/components/Geometry2D.min.js +0 -1
- package/dist/assets/components/Geospatial.min.js +0 -1
- package/dist/assets/components/HAnim.min.js +0 -1
- package/dist/assets/components/KeyDeviceSensor.min.js +0 -1
- package/dist/assets/components/Layout.min.js +0 -1
- package/dist/assets/components/NURBS.min.js +0 -1
- package/dist/assets/components/ParticleSystems.min.js +0 -1
- package/dist/assets/components/Picking.min.js +0 -1
- package/dist/assets/components/RigidBodyPhysics.min.js +0 -1
- package/dist/assets/components/Scripting.js +0 -927
- package/dist/assets/components/Scripting.min.js +0 -1
- package/dist/assets/components/Text.min.js +0 -1
- package/dist/assets/components/TextureProjection.min.js +0 -1
- package/dist/assets/components/Texturing3D.min.js +0 -1
- package/dist/assets/components/VolumeRendering.min.js +0 -1
- package/dist/assets/components/X_ITE.min.js +0 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* X_ITE v10.3.1 */
|
|
2
|
+
const e=window[Symbol.for("X_ITE.X3D-10.3.1")];(()=>{var t={254:t=>{t.exports=e.jquery}},r={};function i(e){var s=r[e];if(void 0!==s)return s.exports;var a=r[e]={exports:{}};return t[e](a,a.exports,i),a.exports}i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},i.d=(e,t)=>{for(var r in t)i.o(t,r)&&!i.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);const s=e.Components;var a=i.n(s);const n=e.Namespace;var o=i.n(n);const u=o().add("Panorama1.fs","\nprecision highp float;precision highp int;precision highp sampler2D;const float M_PI=3.1415926535897932384626433832795;varying vec2 texCoord;uniform sampler2D x3d_PanoramaTexture;uniform int x3d_CurrentFace;vec3 uvToXYZ(const in int face,const in vec2 uv){vec3 xyz;if(face==0)xyz=vec3(1.0,uv.y,uv.x);else if(face==1)xyz=vec3(-1.0,uv.y,-uv.x);else if(face==2)xyz=vec3(uv.x,uv.y,-1.0);else if(face==3)xyz=vec3(-uv.x,uv.y,1.0);else if(face==4)xyz=vec3(uv.y,-1.0,uv.x);else xyz=vec3(-uv.y,1.0,uv.x);return xyz;}vec2 dirToUV(const in vec3 dir){return vec2(0.5+0.5*atan(dir.z,dir.x)/M_PI,1.0-acos(dir.y)/M_PI);}vec3 panoramaToCubeMap(const in int face,const in vec2 texCoord){vec3 scan=uvToXYZ(face,texCoord);vec3 direction=normalize(scan);vec2 src=dirToUV(direction);return texture2D(x3d_PanoramaTexture,src).rgb;}void main(){gl_FragColor=vec4(panoramaToCubeMap(x3d_CurrentFace,texCoord),1.0);}"),h=o().add("Panorama2.fs","#version 300 es\nprecision highp float;precision highp int;precision highp sampler2D;const float M_PI=3.1415926535897932384626433832795;in vec2 texCoord;out vec4 x3d_FragColor;uniform sampler2D x3d_PanoramaTexture;uniform int x3d_CurrentFace;vec3 uvToXYZ(const in int face,const in vec2 uv){switch(face){case 0:return vec3(1.0,uv.y,uv.x);case 1:return vec3(-1.0,uv.y,-uv.x);case 2:return vec3(uv.x,uv.y,-1.0);case 3:return vec3(-uv.x,uv.y,1.0);case 4:return vec3(uv.y,-1.0,uv.x);default:return vec3(-uv.y,1.0,uv.x);}}vec2 dirToUV(const in vec3 dir){return vec2(0.5+0.5*atan(dir.z,dir.x)/M_PI,1.0-acos(dir.y)/M_PI);}vec3 panoramaToCubeMap(const in int face,const in vec2 texCoord){vec3 scan=uvToXYZ(face,texCoord);vec3 direction=normalize(scan);vec2 src=dirToUV(direction);return texture(x3d_PanoramaTexture,src).rgb;}void main(){x3d_FragColor=vec4(panoramaToCubeMap(x3d_CurrentFace,texCoord),1.0);}"),d=Symbol();function c(){}Object.assign(c.prototype,{getPanoramaShader(){return this[d]?this[d]:this[d]=this.createShader("Panorama","FullScreen","data:x-shader/x-fragment,"+["",u,h][this.getContext().getVersion()],[],["x3d_PanoramaTexture","x3d_CurrentFace"])}});const T=c,p=o().add("X3DCubeMapTexturingContext",T),x=e.Fields;var g=i.n(x);const l=e.X3DFieldDefinition;var _=i.n(l);const f=e.FieldDefinitionArray;var m=i.n(f);const E=e.X3DNode;var w=i.n(E);const v=e.X3DSingleTextureNode;var b=i.n(v);const M=e.X3DConstants;var R=i.n(M);function C(e){b().call(this,e),this.addType(R().X3DEnvironmentTextureNode);const t=this.getBrowser().getContext();this.target=t.TEXTURE_CUBE_MAP,this.targets=[t.TEXTURE_CUBE_MAP_POSITIVE_Z,t.TEXTURE_CUBE_MAP_NEGATIVE_Z,t.TEXTURE_CUBE_MAP_NEGATIVE_X,t.TEXTURE_CUBE_MAP_POSITIVE_X,t.TEXTURE_CUBE_MAP_POSITIVE_Y,t.TEXTURE_CUBE_MAP_NEGATIVE_Y],this.size=1,this.levels=0}Object.assign(Object.setPrototypeOf(C.prototype,b().prototype),{getTarget(){return this.target},getTextureType:()=>4,getTargets(){return this.targets},getSize(){return this.size},setSize(e){this.size=e,this.levels=Math.floor(Math.log2(Math.max(e,1)))},getLevels(){return this.levels},clearTexture:(()=>{const e=new Uint8Array([255,255,255,255]);return function(){const t=this.getBrowser().getContext();t.bindTexture(this.getTarget(),this.getTexture());for(const r of this.getTargets())t.texImage2D(r,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,e);this.setSize(1),this.setTransparent(!1),this.updateTextureParameters()}})(),updateTextureParameters(){b().prototype.updateTextureParameters.call(this,this.target,this._textureProperties.getValue(),this.texturePropertiesNode,this.size,this.size,!1,!1,!1)},setShaderUniforms(e,t,r,i=t.x3d_Texture[0]){const s=this.getBrowser().getTextureCubeUnit();e.activeTexture(e.TEXTURE0+s),e.bindTexture(e.TEXTURE_CUBE_MAP,this.getTexture()),e.uniform1i(i.textureCube,s)}}),Object.defineProperties(C,w().getStaticProperties("X3DEnvironmentTextureNode","CubeMapTexturing",1));const y=C,S=o().add("X3DEnvironmentTextureNode",y),U=e.X3DCast;var P=i.n(U);const A=e.BitSet;var O=i.n(A);function B(e){S.call(this,e),this.addType(R().ComposedCubeMapTexture),this.addChildObjects(R().inputOutput,"update",new(g().SFTime)),e.getSpecificationVersion()<=3.3&&(this.addAlias("front",this._frontTexture),this.addAlias("back",this._backTexture),this.addAlias("left",this._leftTexture),this.addAlias("right",this._rightTexture),this.addAlias("top",this._topTexture),this.addAlias("bottom",this._bottomTexture)),this.textureNodes=[null,null,null,null,null,null],this.textureBits=new(O())}Object.assign(Object.setPrototypeOf(B.prototype,S.prototype),{initialize(){S.prototype.initialize.call(this);const e=this.getBrowser().getContext();this.frameBuffer=e.createFramebuffer(),this.clearTexture(),this._frontTexture.addInterest("set_texture__",this,0),this._backTexture.addInterest("set_texture__",this,1),this._leftTexture.addInterest("set_texture__",this,2),this._rightTexture.addInterest("set_texture__",this,3),this._topTexture.addInterest("set_texture__",this,5),this._bottomTexture.addInterest("set_texture__",this,4),this._update.addInterest("update",this),this.set_texture__(0,this._frontTexture),this.set_texture__(1,this._backTexture),this.set_texture__(2,this._leftTexture),this.set_texture__(3,this._rightTexture),this.set_texture__(4,this._topTexture),this.set_texture__(5,this._bottomTexture)},set_texture__(e,t){let r=this.textureNodes[e];r?.removeInterest(`set_loadState${e}__`,this),r=this.textureNodes[e]=P()(R().X3DTexture2DNode,t),r?.addInterest(`set_loadState${e}__`,this,e,r),this.set_loadState__(e,r)},set_loadState__(e,t){this.setTextureBit(e,t?.checkLoadState()),this._update.addEvent()},setTextureBit(e,t){this.textureBits.set(e,t===R().COMPLETE_STATE)},isComplete(){if(63!=+this.textureBits)return!1;const e=this.textureNodes,t=e[0].getWidth();for(const r of e){if(r.getWidth()!==t)return!1;if(r.getHeight()!==t)return!1}return!0},update(){if(this.isComplete()){const e=this.getBrowser().getContext(),t=this.textureNodes,r=t[0].getWidth();if(r!==this.getSize()){const t=new Uint8Array(r*r*4);e.bindTexture(this.getTarget(),this.getTexture());for(let i=0;i<6;++i)e.texImage2D(this.getTargets()[i],0,e.RGBA,r,r,0,e.RGBA,e.UNSIGNED_BYTE,t);this.setSize(r),this.updateTextureParameters()}e.bindFramebuffer(e.FRAMEBUFFER,this.frameBuffer);for(let i=0;i<6;++i){const s=t[i];if(e.bindTexture(e.TEXTURE_2D,s.getTexture()),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,s.getTexture(),0),e.bindTexture(this.getTarget(),this.getTexture()),1===s.getTextureType())e.copyTexSubImage2D(this.getTargets()[i],0,0,0,0,0,r,r);else for(let t=0;t<r;++t)e.copyTexSubImage2D(this.getTargets()[i],0,0,r-t-1,0,t,r,1)}this.setTransparent(t.some((e=>e.isTransparent()))),this.setLinear(t.some((e=>e.isLinear()))),this.setMipMaps(t.every((e=>e.canMipMaps()))),this.updateTextureParameters()}else this.clearTexture()}}),Object.defineProperties(B,{...w().getStaticProperties("ComposedCubeMapTexture","CubeMapTexturing",1,"texture","3.1"),fieldDefinitions:{value:new(m())([new(_())(R().inputOutput,"metadata",new(g().SFNode)),new(_())(R().inputOutput,"description",new(g().SFString)),new(_())(R().inputOutput,"frontTexture",new(g().SFNode)),new(_())(R().inputOutput,"backTexture",new(g().SFNode)),new(_())(R().inputOutput,"leftTexture",new(g().SFNode)),new(_())(R().inputOutput,"rightTexture",new(g().SFNode)),new(_())(R().inputOutput,"topTexture",new(g().SFNode)),new(_())(R().inputOutput,"bottomTexture",new(g().SFNode)),new(_())(R().initializeOnly,"textureProperties",new(g().SFNode))]),enumerable:!0}});for(let e=0;e<6;++e)B.prototype[`set_loadState${e}__`]=function(e,t){this.set_loadState__(e,t)};const I=B,F=o().add("ComposedCubeMapTexture",I),D=e.X3DBaseNode;var N=i.n(D);const L=e.X3DRenderObject;var X=i.n(L);const z=e.TraverseType;var V=i.n(z);const j=e.Camera;var G=i.n(j);const k=e.Algorithm;var Y=i.n(k);const W=e.Matrix4;var H=i.n(W);function $(e,t,r){N().call(this,e),X().call(this,e),this.renderObject=t,this.node=r,this.projectionMatrixWithLimits=new(H()),this.frameBuffers=[]}Object.assign(Object.setPrototypeOf($.prototype,N().prototype),X().prototype,{initialize(){N().prototype.initialize.call(this),X().prototype.initialize.call(this)},isIndependent:()=>!1,isActive:()=>!1,getNode(){return this.node},getLayer(){return this.renderObject.getLayer()},getBackground(){return this.renderObject.getBackground()},getFog(){return this.renderObject.getFog()},getNavigationInfo(){return this.renderObject.getNavigationInfo()},getViewpoint(){return this.renderObject.getViewpoint()},getViewpointStack(){return this.renderObject.getViewpointStack()},getLightContainer(){return this.renderObject.getLights()[this.lightIndex++]},getFrameBuffers(){return this.frameBuffers},setFrameBuffer(e){this.frameBuffers[0]=e},getProjectionMatrixWithLimits(e,t,r){return G().perspective(Y().radians(90),e,t,r[2],r[3],this.projectionMatrixWithLimits)},render(e,t,r){switch(e){case V().COLLISION:case V().SHADOW:X().prototype.render.call(this,e,t,r);break;case V().DISPLAY:this.lightIndex=0,X().prototype.render.call(this,e,t,r);for(const e of this.renderObject.getLights())e.modelViewMatrix.pop()}}});for(const e of Object.keys($.prototype))Object.defineProperty($.prototype,e,{enumerable:!1});const Z=$,K=o().add("DependentRenderer",Z),q=e.TextureBuffer;var J=i.n(q);const Q=e.ViewVolume;var ee=i.n(Q);const te=e.Rotation4;var re=i.n(te);const ie=e.Vector3;var se=i.n(ie);const ae=e.Vector4;var ne=i.n(ae);function oe(e){S.call(this,e),this.addType(R().GeneratedCubeMapTexture),this.dependentRenderers=new WeakMap,this.modelMatrix=new(H()),this.viewVolume=new(ee())}Object.assign(Object.setPrototypeOf(oe.prototype,S.prototype),{initialize(){S.prototype.initialize.call(this),this._size.addInterest("set_size__",this),this.set_size__()},set_size__(){const e=this.getBrowser().getContext(),t=e.getVersion()>=2?this._size.getValue():Y().nextPowerOfTwo(this._size.getValue());if(t>0){const r=new Uint8Array(t*t*4);e.bindTexture(this.getTarget(),this.getTexture());for(const i of this.getTargets())e.texImage2D(i,0,e.RGBA,t,t,0,e.RGBA,e.UNSIGNED_BYTE,r);this.updateTextureParameters(),this.viewport=new(ne())(0,0,t,t),this.frameBuffer=new(J())(this.getBrowser(),t,t),this.setSize(t)}else this.frameBuffer=null,this.setSize(0)},traverse(e,t){"NONE"!==this._update.getValue()&&t.isIndependent()&&this.frameBuffer&&(t.getGeneratedCubeMapTextures().push(this),this.modelMatrix.assign(t.getModelViewMatrix().get()).multRight(t.getCameraSpaceMatrix().get()))},renderTexture:(()=>{const e=[new(re())(se().zAxis,new(se())(0,0,-1)),new(re())(se().zAxis,new(se())(0,0,1)),new(re())(se().zAxis,new(se())(1,0,0)),new(re())(se().zAxis,new(se())(-1,0,0)),new(re())(se().zAxis,new(se())(0,-1,0)),new(re())(se().zAxis,new(se())(0,1,0))],t=[new(se())(-1,-1,1),new(se())(-1,-1,1),new(se())(-1,-1,1),new(se())(-1,-1,1),new(se())(1,1,1),new(se())(1,1,1)],r=new(H());return function(i){if(!this.dependentRenderers.has(i)){const e=new K(this.getExecutionContext(),i,this);e.setup(),this.dependentRenderers.set(i,e)}const s=this.dependentRenderers.get(i),a=this.getBrowser(),n=i.getLayer(),o=a.getContext(),u=s.getBackground(),h=s.getNavigationInfo(),d=s.getViewpoint(),c=a.getHeadlight(),T=h._headlight.getValue(),p=h.getNearValue(),x=h.getFarValue(d),g=s.getProjectionMatrixWithLimits(p,x,this.viewport),l=this.frameBuffer.getWidth(),_=this.frameBuffer.getHeight();this.setTransparent(u.isTransparent()),s.setFrameBuffer(this.frameBuffer),s.getViewVolumes().push(this.viewVolume.set(g,this.viewport,this.viewport)),s.getProjectionMatrix().pushMatrix(g),o.bindTexture(this.getTarget(),this.getTexture());for(let i=0;i<6;++i)o.clear(o.COLOR_BUFFER_BIT),s.getCameraSpaceMatrix().pushMatrix(this.modelMatrix),s.getCameraSpaceMatrix().rotate(e[i]),s.getCameraSpaceMatrix().scale(t[i]),s.getViewMatrix().pushMatrix(r.assign(s.getCameraSpaceMatrix().get()).inverse()),s.getModelViewMatrix().pushMatrix(r),T&&(c.modelViewMatrix.pushMatrix(r),c.modelViewMatrix.multLeft(d.getCameraSpaceMatrix())),n.traverse(V().DISPLAY,s),T&&c.modelViewMatrix.pop(),s.getModelViewMatrix().pop(),s.getCameraSpaceMatrix().pop(),s.getViewMatrix().pop(),o.bindTexture(this.getTarget(),this.getTexture()),o.copyTexSubImage2D(this.getTargets()[i],0,0,0,0,0,l,_);this.updateTextureParameters(),s.getProjectionMatrix().pop(),s.getViewVolumes().pop(),"NEXT_FRAME_ONLY"===this._update.getValue()&&(this._update="NONE")}})(),setShaderUniforms:(()=>{const e=new Float32Array(16);return function(t,r,i,s){S.prototype.setShaderUniforms.call(this,t,r,i,s),i.getNode()===this&&t.uniformMatrix4fv(r.x3d_ModelViewMatrix,!1,e)}})()}),Object.defineProperties(oe,{...w().getStaticProperties("GeneratedCubeMapTexture","CubeMapTexturing",3,"texture","3.0"),fieldDefinitions:{value:new(m())([new(_())(R().inputOutput,"metadata",new(g().SFNode)),new(_())(R().inputOutput,"description",new(g().SFString)),new(_())(R().inputOutput,"update",new(g().SFString)("NONE")),new(_())(R().initializeOnly,"size",new(g().SFInt32)(128)),new(_())(R().initializeOnly,"textureProperties",new(g().SFNode))]),enumerable:!0}});const ue=oe,he=o().add("GeneratedCubeMapTexture",ue),de=e.X3DUrlObject;var ce=i.n(de);const Te=e.Vector2;var pe=i.n(Te);const xe=e.DEVELOPMENT;var ge=i.n(xe),le=i(254);const _e=new Uint8Array([255,255,255,255]);function fe(e){S.call(this,e),ce().call(this,e),this.addType(R().ImageCubeMapTexture),this.image=le("<img></img>"),this.urlStack=new(g().MFString)}Object.assign(Object.setPrototypeOf(fe.prototype,S.prototype),ce().prototype,{initialize(){S.prototype.initialize.call(this),ce().prototype.initialize.call(this);const e=this.getBrowser().getContext();e.bindTexture(this.getTarget(),this.getTexture());for(let t=0;t<6;++t)e.texImage2D(this.getTargets()[t],0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,_e);this.image.on("load",this.setImage.bind(this)),this.image.on("abort error",this.setError.bind(this)),this.image.prop("crossOrigin","Anonymous"),this.requestImmediateLoad().catch(Function.prototype)},unloadData(){this.clearTexture()},loadData(){this.urlStack.setValue(this._url),this.loadNext()},loadNext(){if(0===this.urlStack.length)return this.clearTexture(),void this.setLoadState(R().FAILED_STATE);this.URL=new URL(this.urlStack.shift(),this.getExecutionContext().getBaseURL()),this.URL.pathname.match(/\.ktx2?(?:\.gz)?$/)||this.URL.href.match(/^data:image\/ktx2[;,]/)?(this.setLinear(!0),this.setMipMaps(!1),this.getBrowser().getKTXDecoder().then((e=>e.loadKTXFromURL(this.URL,this.getCache()))).then((e=>this.setKTXTexture(e))).catch((e=>this.setError({type:e.message})))):(this.setLinear(!1),this.setMipMaps(!0),"data:"!==this.URL.protocol&&(this.getCache()||this.URL.searchParams.set("_",Date.now())),this.image.attr("src",this.URL.href))},setError(e){"data:"!==this.URL.protocol&&console.warn(`Error loading image '${decodeURI(this.URL.href)}'`,e.type),this.loadNext()},setKTXTexture(e){if(e.target!==this.getTarget())return this.setError({type:"Invalid KTX texture target, must be 'TEXTURE_CUBE_MAP'."});ge()&&"data:"!==this.URL.protocol&&console.info(`Done loading image cube map texture '${decodeURI(this.URL.href)}'.`);try{this.setTexture(e),this.setTransparent(!1),this.setSize(e.baseWidth),this.updateTextureParameters(),this.setLoadState(R().COMPLETE_STATE)}catch(e){this.setError({type:e.message})}},setImage(){ge()&&"data:"!==this.URL.protocol&&console.info(`Done loading image cube map texture '${decodeURI(this.URL.href)}'.`);try{const e=this.getBrowser().getContext(),t=e.createTexture();e.bindTexture(e.TEXTURE_2D,t),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,this.image[0]),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),this.imageToCubeMap(t,this.image.prop("width"),this.image.prop("height"),!1),this.setLoadState(R().COMPLETE_STATE)}catch(e){this.setError({type:e.message})}},imageToCubeMap(e,t,r){const i=t/r;Math.abs(i-4/3)<.01&&this.skyBoxToCubeMap(e,t,r),Math.abs(i-2)<.01&&this.panoramaToCubeMap(e,t,r),this.updateTextureParameters()},skyBoxToCubeMap:function(){const e=[new(pe())(1,1),new(pe())(3,1),new(pe())(0,1),new(pe())(2,1),new(pe())(1,0),new(pe())(1,2)];return function(t,r,i){const s=this.getBrowser().getContext(),a=s.createFramebuffer(),n=Math.floor(r/4),o=Math.floor(i/3),u=new Uint8Array(n*o*4);s.bindTexture(this.getTarget(),this.getTexture());for(let e=0;e<6;++e)s.texImage2D(this.getTargets()[e],0,s.RGBA,n,o,0,s.RGBA,s.UNSIGNED_BYTE,null);s.bindFramebuffer(s.FRAMEBUFFER,a),s.framebufferTexture2D(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0,s.TEXTURE_2D,t,0);let h=!1;s.bindTexture(this.getTarget(),this.getTexture());for(let t=0;t<6;++t)s.copyTexSubImage2D(this.getTargets()[t],0,0,0,e[t].x*n,e[t].y*o,n,o),h||(s.readPixels(e[t].x*n,e[t].y*o,n,o,s.RGBA,s.UNSIGNED_BYTE,u),h=this.isImageTransparent(u));s.deleteFramebuffer(a),s.deleteTexture(t),this.setTransparent(h),this.setSize(n)}}(),panoramaToCubeMap(e,t,r){const i=this.getBrowser(),s=i.getContext(),a=i.getPanoramaShader(),n=s.createFramebuffer(),o=i.getTextureCubeUnit(),u=Math.floor(r/2),h=new Uint8Array(u*u*4);s.bindTexture(s.TEXTURE_2D,e),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,s.MIRRORED_REPEAT),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,s.MIRRORED_REPEAT),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,s.LINEAR),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,s.LINEAR),s.bindTexture(this.getTarget(),this.getTexture());for(let e=0;e<6;++e)s.texImage2D(this.getTargets()[e],0,s.RGBA,u,u,0,s.RGBA,s.UNSIGNED_BYTE,null);s.useProgram(a.getProgram()),s.activeTexture(s.TEXTURE0+o),s.bindTexture(s.TEXTURE_2D,e),s.uniform1i(a.x3d_PanoramaTexture,o),s.bindFramebuffer(s.FRAMEBUFFER,n),s.viewport(0,0,u,u),s.scissor(0,0,u,u),s.disable(s.DEPTH_TEST),s.enable(s.CULL_FACE),s.frontFace(s.CCW),s.clearColor(0,0,0,0),s.bindVertexArray(i.getFullscreenVertexArrayObject());let d=!1;for(let e=0;e<6;++e)s.framebufferTexture2D(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0,this.getTargets()[e],this.getTexture(),0),s.clear(s.COLOR_BUFFER_BIT),s.uniform1i(a.x3d_CurrentFace,e),s.drawArrays(s.TRIANGLES,0,6),d||(s.readPixels(0,0,u,u,s.RGBA,s.UNSIGNED_BYTE,h),d=this.isImageTransparent(h));s.enable(s.DEPTH_TEST),s.deleteFramebuffer(n),s.deleteTexture(e),i.resetTextureUnits(),this.setTransparent(d),this.setSize(u)},dispose(){ce().prototype.dispose.call(this),S.prototype.dispose.call(this)}}),Object.defineProperties(fe,{...w().getStaticProperties("ImageCubeMapTexture","CubeMapTexturing",2,"texture","3.0"),fieldDefinitions:{value:new(m())([new(_())(R().inputOutput,"metadata",new(g().SFNode)),new(_())(R().inputOutput,"description",new(g().SFString)),new(_())(R().inputOutput,"load",new(g().SFBool)(!0)),new(_())(R().inputOutput,"url",new(g().MFString)),new(_())(R().inputOutput,"autoRefresh",new(g().SFTime)),new(_())(R().inputOutput,"autoRefreshTimeLimit",new(g().SFTime)(3600)),new(_())(R().initializeOnly,"textureProperties",new(g().SFNode))]),enumerable:!0}});const me=fe,Ee=o().add("ImageCubeMapTexture",me);a().add({name:"CubeMapTexturing",concreteNodes:[F,he,Ee],abstractNodes:[S],browserContext:p});o().add("CubeMapTexturingComponent",undefined)})();
|