x_ite 12.1.9 → 12.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/dist/assets/components/AnnotationComponent.js +2 -2
- package/dist/assets/components/AnnotationComponent.min.js +2 -2
- package/dist/assets/components/CADGeometryComponent.js +2 -2
- package/dist/assets/components/CADGeometryComponent.min.js +2 -2
- package/dist/assets/components/CubeMapTexturingComponent.js +2 -2
- package/dist/assets/components/CubeMapTexturingComponent.min.js +2 -2
- package/dist/assets/components/DISComponent.js +2 -2
- package/dist/assets/components/DISComponent.min.js +2 -2
- package/dist/assets/components/EventUtilitiesComponent.js +2 -2
- package/dist/assets/components/EventUtilitiesComponent.min.js +2 -2
- package/dist/assets/components/Geometry2DComponent.js +2 -7
- 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 +23 -30
- package/dist/assets/components/HAnimComponent.min.js +2 -2
- package/dist/assets/components/KeyDeviceSensorComponent.js +2 -2
- package/dist/assets/components/KeyDeviceSensorComponent.min.js +2 -2
- package/dist/assets/components/LayoutComponent.js +2 -2
- package/dist/assets/components/LayoutComponent.min.js +2 -2
- package/dist/assets/components/NURBSComponent.js +2 -2
- package/dist/assets/components/NURBSComponent.min.js +2 -2
- package/dist/assets/components/ParticleSystemsComponent.js +2 -2
- 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 +2 -2
- package/dist/assets/components/TextComponent.min.js +2 -2
- package/dist/assets/components/TextureProjectionComponent.js +26 -16
- package/dist/assets/components/TextureProjectionComponent.min.js +2 -2
- package/dist/assets/components/Texturing3DComponent.js +53 -53
- 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/WebXRComponent.js +2 -2
- package/dist/assets/components/WebXRComponent.min.js +2 -2
- package/dist/assets/components/X_ITEComponent.js +6 -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 +51731 -51696
- package/dist/x_ite.min.js +2 -2
- package/dist/x_ite.min.mjs +2 -2
- package/dist/x_ite.mjs +51875 -51840
- package/dist/x_ite.zip +0 -0
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/* X_ITE v12.1.
|
|
2
|
-
const __X_ITE_X3D__ = window [Symbol .for ("X_ITE.X3D-12.1.
|
|
1
|
+
/* X_ITE v12.1.10 */
|
|
2
|
+
const __X_ITE_X3D__ = window [Symbol .for ("X_ITE.X3D-12.1.10")];
|
|
3
3
|
/******/ (() => { // webpackBootstrap
|
|
4
4
|
/******/ "use strict";
|
|
5
5
|
/******/ // The require scope
|
|
@@ -304,7 +304,12 @@ Object .assign (TextureProjectorContainer .prototype,
|
|
|
304
304
|
},
|
|
305
305
|
setShaderUniforms (gl, shaderObject, renderObject)
|
|
306
306
|
{
|
|
307
|
-
const
|
|
307
|
+
const
|
|
308
|
+
i = shaderObject .numTextureProjectors ++,
|
|
309
|
+
uniforms = shaderObject .x3d_TextureProjector [i];
|
|
310
|
+
|
|
311
|
+
if (!uniforms)
|
|
312
|
+
return;
|
|
308
313
|
|
|
309
314
|
const
|
|
310
315
|
lightNode = this .lightNode,
|
|
@@ -315,7 +320,7 @@ Object .assign (TextureProjectorContainer .prototype,
|
|
|
315
320
|
|
|
316
321
|
gl .activeTexture (gl .TEXTURE0 + textureUnit);
|
|
317
322
|
gl .bindTexture (gl .TEXTURE_2D, texture .getTexture ());
|
|
318
|
-
gl .uniform1i (
|
|
323
|
+
gl .uniform1i (uniforms .texture, textureUnit);
|
|
319
324
|
|
|
320
325
|
if (shaderObject .hasTextureProjector (i, this))
|
|
321
326
|
return;
|
|
@@ -324,11 +329,11 @@ Object .assign (TextureProjectorContainer .prototype,
|
|
|
324
329
|
nearParameter = lightNode .getNearParameter (),
|
|
325
330
|
farParameter = lightNode .getFarParameter ();
|
|
326
331
|
|
|
327
|
-
gl .uniform3f (
|
|
328
|
-
gl .uniform1f (
|
|
329
|
-
gl .uniform3fv (
|
|
330
|
-
gl .uniform3f (
|
|
331
|
-
gl .uniformMatrix4fv (
|
|
332
|
+
gl .uniform3f (uniforms .color, ... lightNode .getColor ());
|
|
333
|
+
gl .uniform1f (uniforms .intensity, lightNode .getIntensity ());
|
|
334
|
+
gl .uniform3fv (uniforms .location, this .locationArray);
|
|
335
|
+
gl .uniform3f (uniforms .params, nearParameter, farParameter, texture .isLinear ());
|
|
336
|
+
gl .uniformMatrix4fv (uniforms .matrix, false, this .matrixArray);
|
|
332
337
|
},
|
|
333
338
|
dispose ()
|
|
334
339
|
{
|
|
@@ -519,7 +524,12 @@ Object .assign (TextureProjectorParallelContainer .prototype,
|
|
|
519
524
|
},
|
|
520
525
|
setShaderUniforms (gl, shaderObject, renderObject)
|
|
521
526
|
{
|
|
522
|
-
const
|
|
527
|
+
const
|
|
528
|
+
i = shaderObject .numTextureProjectors ++,
|
|
529
|
+
uniforms = shaderObject .x3d_TextureProjector [i];
|
|
530
|
+
|
|
531
|
+
if (!uniforms)
|
|
532
|
+
return;
|
|
523
533
|
|
|
524
534
|
const
|
|
525
535
|
lightNode = this .lightNode,
|
|
@@ -530,7 +540,7 @@ Object .assign (TextureProjectorParallelContainer .prototype,
|
|
|
530
540
|
|
|
531
541
|
gl .activeTexture (gl .TEXTURE0 + textureUnit);
|
|
532
542
|
gl .bindTexture (gl .TEXTURE_2D, texture .getTexture ());
|
|
533
|
-
gl .uniform1i (
|
|
543
|
+
gl .uniform1i (uniforms .texture, textureUnit);
|
|
534
544
|
|
|
535
545
|
if (shaderObject .hasTextureProjector (i, this))
|
|
536
546
|
return;
|
|
@@ -539,11 +549,11 @@ Object .assign (TextureProjectorParallelContainer .prototype,
|
|
|
539
549
|
nearParameter = lightNode .getNearParameter (),
|
|
540
550
|
farParameter = lightNode .getFarParameter ();
|
|
541
551
|
|
|
542
|
-
gl .uniform3f (
|
|
543
|
-
gl .uniform1f (
|
|
544
|
-
gl .uniform3fv (
|
|
545
|
-
gl .uniform3f (
|
|
546
|
-
gl .uniformMatrix4fv (
|
|
552
|
+
gl .uniform3f (uniforms .color, ... lightNode .getColor ());
|
|
553
|
+
gl .uniform1f (uniforms .intensity, lightNode .getIntensity ());
|
|
554
|
+
gl .uniform3fv (uniforms .location, this .locationArray);
|
|
555
|
+
gl .uniform3f (uniforms .params, nearParameter, farParameter, texture .isLinear ());
|
|
556
|
+
gl .uniformMatrix4fv (uniforms .matrix, false, this .matrixArray);
|
|
547
557
|
},
|
|
548
558
|
dispose ()
|
|
549
559
|
{
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* X_ITE v12.1.
|
|
2
|
-
const t=window[Symbol.for("X_ITE.X3D-12.1.9")];(()=>{var e={n:t=>{var i=t&&t.__esModule?()=>t.default:()=>t;return e.d(i,{a:i}),i},d:(t,i)=>{for(var r in i)e.o(i,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:i[r]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)};const i=t.Components;var r=e.n(i);const n=t.Fields;var a=e.n(n);const o=t.X3DFieldDefinition;var s=e.n(o);const u=t.FieldDefinitionArray;var h=e.n(u);const c=t.X3DNode;var l=e.n(c);const x=t.X3DLightNode;var p=e.n(x);const g=t.X3DConstants;var w=e.n(g);const d=t.X3DCast;var m=e.n(d);const f=t.Matrix4;var _=e.n(f);const T=t.Namespace;var O=e.n(T);function S(t){p().call(this,t),this.addType(w().X3DTextureProjectorNode),this._location.setUnit("length"),this._nearDistance.setUnit("length"),this._farDistance.setUnit("length"),this._location.setUnit("length")}Object.assign(Object.setPrototypeOf(S.prototype,p().prototype),{initialize(){p().prototype.initialize.call(this),this._nearDistance.addInterest("set_nearDistance__",this),this._farDistance.addInterest("set_farDistance__",this),this._texture.addInterest("set_texture__",this),this.set_nearDistance__(),this.set_farDistance__(),this.set_texture__()},getLightKey:()=>3,getGlobal(){return this._global.getValue()},getLocation(){return this._location.getValue()},getDirection(){return this._direction.getValue()},getNearDistance(){return this.nearDistance},getNearParameter(){return this.nearParameter},getFarDistance(){return this.farDistance},getFarParameter(){return this.farParameter},getTexture(){return this.textureNode},getBiasMatrix:(()=>{const t=new(_())(.5,0,0,0,0,.5,0,0,0,0,.5,0,.5,.5,.5,1);return function(){return t}})(),straightenHorizon(t){return t.straighten(this._upVector.getValue())},set_nearDistance__(){const t=this._nearDistance.getValue();this.nearDistance=t<0?.125:t,this.nearParameter=t<0?0:-1},set_farDistance__(){const t=this._farDistance.getValue();this.farDistance=t<0?1e5:t,this.farParameter=t<0?1:2},set_texture__(){this.textureNode?.removeInterest("set_aspectRatio__",this),this.textureNode=m()(w().X3DTexture2DNode,this._texture),this.textureNode?.addInterest("set_aspectRatio__",this),this.setEnabled(!!this.textureNode),this.set_aspectRatio__(),this.set_on__()},set_aspectRatio__(){this.textureNode?this._aspectRatio=this.textureNode.getWidth()/this.textureNode.getHeight():this._aspectRatio=1}}),Object.defineProperties(S,l().getStaticProperties("X3DTextureProjectorNode","TextureProjection",4));const F=S,M=O().add("X3DTextureProjectorNode",F),P=t.Camera;var j=e.n(P);const y=t.Vector3;var V=e.n(y);const b=t.Rotation4;var D=e.n(b);const v=t.MatrixStack;var N=e.n(v);const X=t.ObjectCache;var I=e.n(X);const U=I()(R);function R(){this.projectionMatrix=new(_()),this.modelViewMatrix=new(N())(_()),this.modelMatrix=new(_()),this.invTextureSpaceMatrix=new(_()),this.invTextureSpaceProjectionMatrix=new(_()),this.location=new(V()),this.locationArray=new Float32Array(3),this.direction=new(V()),this.rotation=new(D()),this.matrix=new(_()),this.matrixArray=new Float32Array(16),this.textureMatrix=new(_())}function A(t){M.call(this,t),this.addType(w().TextureProjector),this._fieldOfView.setUnit("angle")}Object.assign(R.prototype,{set(t,e,i){this.browser=t.getBrowser(),this.lightNode=t,this.global=t.getGlobal(),this.modelViewMatrix.push(i),this.textureMatrix.assign(t.getTexture().getMatrix())},renderShadowMap(t){const e=this.lightNode,i=t.getCameraSpaceMatrixArray(),r=this.modelMatrix.assign(this.modelViewMatrix.get()).multRight(i),n=this.invTextureSpaceMatrix.assign(this.global?r:_().IDENTITY);this.rotation.setFromToVec(V().Z_AXIS,this.direction.assign(e.getDirection()).negate()),e.straightenHorizon(this.rotation),n.translate(e.getLocation()),n.rotate(this.rotation),n.inverse();const a=e.getTexture().getWidth(),o=e.getTexture().getHeight(),s=e.getNearDistance(),u=e.getFarDistance(),h=e.getFieldOfView();j().perspective(h,s,u,a,o,this.projectionMatrix),this.global||n.multLeft(r.inverse()),this.invTextureSpaceProjectionMatrix.assign(n).multRight(this.projectionMatrix).multRight(e.getBiasMatrix()).multRight(this.textureMatrix),this.modelViewMatrix.get().multVecMatrix(this.location.assign(e._location.getValue())),this.locationArray.set(this.location)},setGlobalVariables(t){this.matrix.assign(t.getView()?.inverse??_().IDENTITY).multRight(t.getCameraSpaceMatrixArray()).multRight(this.invTextureSpaceProjectionMatrix),this.matrixArray.set(this.matrix)},setShaderUniforms(t,e,i){const r=e.numTextureProjectors++,n=this.lightNode,a=n.getTexture(),o=this.global?this.textureUnit=this.textureUnit??this.browser.popTextureUnit():this.browser.getTextureUnit();if(t.activeTexture(t.TEXTURE0+o),t.bindTexture(t.TEXTURE_2D,a.getTexture()),t.uniform1i(e.x3d_TextureProjectorTexture[r],o),e.hasTextureProjector(r,this))return;const s=n.getNearParameter(),u=n.getFarParameter();t.uniform3f(e.x3d_TextureProjectorColor[r],...n.getColor()),t.uniform1f(e.x3d_TextureProjectorIntensity[r],n.getIntensity()),t.uniform3fv(e.x3d_TextureProjectorLocation[r],this.locationArray),t.uniform3f(e.x3d_TextureProjectorParams[r],s,u,a.isLinear()),t.uniformMatrix4fv(e.x3d_TextureProjectorMatrix[r],!1,this.matrixArray)},dispose(){this.browser.pushTextureUnit(this.textureUnit),this.modelViewMatrix.clear(),this.textureUnit=void 0,U.push(this)}}),Object.assign(Object.setPrototypeOf(A.prototype,M.prototype),{initialize(){M.prototype.initialize.call(this)},getFieldOfView(){const t=this._fieldOfView.getValue();return t>0&&t<Math.PI?t:Math.PI/4},getLights:()=>U}),Object.defineProperties(A,{...l().getStaticProperties("TextureProjector","TextureProjection",2,"children","4.0"),fieldDefinitions:{value:new(h())([new(s())(w().inputOutput,"metadata",new(a().SFNode)),new(s())(w().inputOutput,"description",new(a().SFString)),new(s())(w().inputOutput,"global",new(a().SFBool)(!0)),new(s())(w().inputOutput,"on",new(a().SFBool)(!0)),new(s())(w().inputOutput,"color",new(a().SFColor)(1,1,1)),new(s())(w().inputOutput,"intensity",new(a().SFFloat)(1)),new(s())(w().inputOutput,"ambientIntensity",new(a().SFFloat)),new(s())(w().inputOutput,"location",new(a().SFVec3f)),new(s())(w().inputOutput,"direction",new(a().SFVec3f)(0,0,1)),new(s())(w().inputOutput,"upVector",new(a().SFVec3f)(0,0,1)),new(s())(w().inputOutput,"fieldOfView",new(a().SFFloat)(.785398)),new(s())(w().inputOutput,"nearDistance",new(a().SFFloat)(-1)),new(s())(w().inputOutput,"farDistance",new(a().SFFloat)(-1)),new(s())(w().outputOnly,"aspectRatio",new(a().SFFloat)),new(s())(w().inputOutput,"texture",new(a().SFNode)),new(s())(w().inputOutput,"shadows",new(a().SFBool)),new(s())(w().inputOutput,"shadowColor",new(a().SFColor)),new(s())(w().inputOutput,"shadowIntensity",new(a().SFFloat)(1)),new(s())(w().inputOutput,"shadowBias",new(a().SFFloat)(.005)),new(s())(w().initializeOnly,"shadowMapSize",new(a().SFInt32)(1024))]),enumerable:!0}});const z=A,C=O().add("TextureProjector",z),Y=I()(E);function E(){this.projectionMatrix=new(_()),this.modelViewMatrix=new(N())(_()),this.modelMatrix=new(_()),this.invTextureSpaceMatrix=new(_()),this.location=new(V()),this.locationArray=new Float32Array(3),this.invTextureSpaceProjectionMatrix=new(_()),this.direction=new(V()),this.rotation=new(D()),this.matrix=new(_()),this.matrixArray=new Float32Array(16),this.textureMatrix=new(_())}function B(t){M.call(this,t),this.addType(w().TextureProjectorParallel),this._fieldOfView.setUnit("length")}Object.assign(E.prototype,{set(t,e,i){this.browser=t.getBrowser(),this.lightNode=t,this.global=t.getGlobal(),this.modelViewMatrix.push(i),this.textureMatrix.assign(t.getTexture().getMatrix())},renderShadowMap(t){const e=this.lightNode,i=t.getCameraSpaceMatrixArray(),r=this.modelMatrix.assign(this.modelViewMatrix.get()).multRight(i),n=this.invTextureSpaceMatrix.assign(this.global?r:_().IDENTITY);this.rotation.setFromToVec(V().Z_AXIS,this.direction.assign(e.getDirection()).negate()),e.straightenHorizon(this.rotation),n.translate(e.getLocation()),n.rotate(this.rotation),n.inverse();const a=e.getTexture().getWidth()/e.getTexture().getHeight(),o=e.getMinimumX(),s=e.getMaximumX(),u=e.getMinimumY(),h=e.getMaximumY(),c=e.getSizeX(),l=e.getSizeY(),x=e.getNearDistance(),p=e.getFarDistance();if(a>c/l){const t=(o+s)/2,e=l*a/2;j().ortho(t-e,t+e,u,h,x,p,this.projectionMatrix)}else{const t=(u+h)/2,e=c/a/2;j().ortho(o,s,t-e,t+e,x,p,this.projectionMatrix)}this.global||n.multLeft(r.inverse()),this.invTextureSpaceProjectionMatrix.assign(n).multRight(this.projectionMatrix).multRight(e.getBiasMatrix()).multRight(this.textureMatrix),this.modelViewMatrix.get().multVecMatrix(this.location.assign(e._location.getValue())),this.locationArray.set(this.location)},setGlobalVariables(t){this.matrix.assign(t.getView()?.inverse??_().IDENTITY).multRight(t.getCameraSpaceMatrixArray()).multRight(this.invTextureSpaceProjectionMatrix),this.matrixArray.set(this.matrix)},setShaderUniforms(t,e,i){const r=e.numTextureProjectors++,n=this.lightNode,a=n.getTexture(),o=this.global?this.textureUnit=this.textureUnit??this.browser.popTextureUnit():this.browser.getTextureUnit();if(t.activeTexture(t.TEXTURE0+o),t.bindTexture(t.TEXTURE_2D,a.getTexture()),t.uniform1i(e.x3d_TextureProjectorTexture[r],o),e.hasTextureProjector(r,this))return;const s=n.getNearParameter(),u=n.getFarParameter();t.uniform3f(e.x3d_TextureProjectorColor[r],...n.getColor()),t.uniform1f(e.x3d_TextureProjectorIntensity[r],n.getIntensity()),t.uniform3fv(e.x3d_TextureProjectorLocation[r],this.locationArray),t.uniform3f(e.x3d_TextureProjectorParams[r],s,u,a.isLinear()),t.uniformMatrix4fv(e.x3d_TextureProjectorMatrix[r],!1,this.matrixArray)},dispose(){this.browser.pushTextureUnit(this.textureUnit),this.modelViewMatrix.clear(),this.textureUnit=void 0,Y.push(this)}}),Object.assign(Object.setPrototypeOf(B.prototype,M.prototype),{initialize(){M.prototype.initialize.call(this),this._fieldOfView.addInterest("set_fieldOfView___",this),this.set_fieldOfView___()},set_fieldOfView___(){this.minimumX=this._fieldOfView[0],this.minimumY=this._fieldOfView[1],this.maximumX=this._fieldOfView[2],this.maximumY=this._fieldOfView[3],this.sizeX=this.maximumX-this.minimumX,this.sizeY=this.maximumY-this.minimumY},getMinimumX(){return this.minimumX},getMinimumY(){return this.minimumY},getMaximumX(){return this.maximumX},getMaximumY(){return this.maximumY},getSizeX(){return this.sizeX},getSizeY(){return this.sizeY},getLights:()=>Y}),Object.defineProperties(B,{...l().getStaticProperties("TextureProjectorParallel","TextureProjection",2,"children","4.0"),fieldDefinitions:{value:new(h())([new(s())(w().inputOutput,"metadata",new(a().SFNode)),new(s())(w().inputOutput,"description",new(a().SFString)),new(s())(w().inputOutput,"global",new(a().SFBool)(!0)),new(s())(w().inputOutput,"on",new(a().SFBool)(!0)),new(s())(w().inputOutput,"color",new(a().SFColor)(1,1,1)),new(s())(w().inputOutput,"intensity",new(a().SFFloat)(1)),new(s())(w().inputOutput,"ambientIntensity",new(a().SFFloat)),new(s())(w().inputOutput,"location",new(a().SFVec3f)),new(s())(w().inputOutput,"direction",new(a().SFVec3f)(0,0,1)),new(s())(w().inputOutput,"upVector",new(a().SFVec3f)(0,0,1)),new(s())(w().inputOutput,"fieldOfView",new(a().SFVec4f)(-1,-1,1,1)),new(s())(w().inputOutput,"nearDistance",new(a().SFFloat)(-1)),new(s())(w().inputOutput,"farDistance",new(a().SFFloat)(-1)),new(s())(w().outputOnly,"aspectRatio",new(a().SFFloat)),new(s())(w().inputOutput,"texture",new(a().SFNode)),new(s())(w().inputOutput,"shadows",new(a().SFBool)),new(s())(w().inputOutput,"shadowColor",new(a().SFColor)),new(s())(w().inputOutput,"shadowIntensity",new(a().SFFloat)(1)),new(s())(w().inputOutput,"shadowBias",new(a().SFFloat)(.005)),new(s())(w().initializeOnly,"shadowMapSize",new(a().SFInt32)(1024))]),enumerable:!0}});const L=B,H=O().add("TextureProjectorParallel",L);r().add({name:"TextureProjection",concreteNodes:[C,H],abstractNodes:[M]});O().add("TextureProjectionComponent",undefined)})();
|
|
1
|
+
/* X_ITE v12.1.10 */
|
|
2
|
+
const t=window[Symbol.for("X_ITE.X3D-12.1.10")];(()=>{var e={n:t=>{var i=t&&t.__esModule?()=>t.default:()=>t;return e.d(i,{a:i}),i},d:(t,i)=>{for(var r in i)e.o(i,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:i[r]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)};const i=t.Components;var r=e.n(i);const n=t.Fields;var a=e.n(n);const s=t.X3DFieldDefinition;var o=e.n(s);const u=t.FieldDefinitionArray;var h=e.n(u);const c=t.X3DNode;var l=e.n(c);const p=t.X3DLightNode;var x=e.n(p);const g=t.X3DConstants;var w=e.n(g);const m=t.X3DCast;var d=e.n(m);const f=t.Matrix4;var _=e.n(f);const T=t.Namespace;var O=e.n(T);function S(t){x().call(this,t),this.addType(w().X3DTextureProjectorNode),this._location.setUnit("length"),this._nearDistance.setUnit("length"),this._farDistance.setUnit("length"),this._location.setUnit("length")}Object.assign(Object.setPrototypeOf(S.prototype,x().prototype),{initialize(){x().prototype.initialize.call(this),this._nearDistance.addInterest("set_nearDistance__",this),this._farDistance.addInterest("set_farDistance__",this),this._texture.addInterest("set_texture__",this),this.set_nearDistance__(),this.set_farDistance__(),this.set_texture__()},getLightKey:()=>3,getGlobal(){return this._global.getValue()},getLocation(){return this._location.getValue()},getDirection(){return this._direction.getValue()},getNearDistance(){return this.nearDistance},getNearParameter(){return this.nearParameter},getFarDistance(){return this.farDistance},getFarParameter(){return this.farParameter},getTexture(){return this.textureNode},getBiasMatrix:(()=>{const t=new(_())(.5,0,0,0,0,.5,0,0,0,0,.5,0,.5,.5,.5,1);return function(){return t}})(),straightenHorizon(t){return t.straighten(this._upVector.getValue())},set_nearDistance__(){const t=this._nearDistance.getValue();this.nearDistance=t<0?.125:t,this.nearParameter=t<0?0:-1},set_farDistance__(){const t=this._farDistance.getValue();this.farDistance=t<0?1e5:t,this.farParameter=t<0?1:2},set_texture__(){this.textureNode?.removeInterest("set_aspectRatio__",this),this.textureNode=d()(w().X3DTexture2DNode,this._texture),this.textureNode?.addInterest("set_aspectRatio__",this),this.setEnabled(!!this.textureNode),this.set_aspectRatio__(),this.set_on__()},set_aspectRatio__(){this.textureNode?this._aspectRatio=this.textureNode.getWidth()/this.textureNode.getHeight():this._aspectRatio=1}}),Object.defineProperties(S,l().getStaticProperties("X3DTextureProjectorNode","TextureProjection",4));const F=S,M=O().add("X3DTextureProjectorNode",F),y=t.Camera;var V=e.n(y);const P=t.Vector3;var b=e.n(P);const D=t.Rotation4;var j=e.n(D);const v=t.MatrixStack;var N=e.n(v);const X=t.ObjectCache;var I=e.n(X);const U=I()(R);function R(){this.projectionMatrix=new(_()),this.modelViewMatrix=new(N())(_()),this.modelMatrix=new(_()),this.invTextureSpaceMatrix=new(_()),this.invTextureSpaceProjectionMatrix=new(_()),this.location=new(b()),this.locationArray=new Float32Array(3),this.direction=new(b()),this.rotation=new(j()),this.matrix=new(_()),this.matrixArray=new Float32Array(16),this.textureMatrix=new(_())}function A(t){M.call(this,t),this.addType(w().TextureProjector),this._fieldOfView.setUnit("angle")}Object.assign(R.prototype,{set(t,e,i){this.browser=t.getBrowser(),this.lightNode=t,this.global=t.getGlobal(),this.modelViewMatrix.push(i),this.textureMatrix.assign(t.getTexture().getMatrix())},renderShadowMap(t){const e=this.lightNode,i=t.getCameraSpaceMatrixArray(),r=this.modelMatrix.assign(this.modelViewMatrix.get()).multRight(i),n=this.invTextureSpaceMatrix.assign(this.global?r:_().IDENTITY);this.rotation.setFromToVec(b().Z_AXIS,this.direction.assign(e.getDirection()).negate()),e.straightenHorizon(this.rotation),n.translate(e.getLocation()),n.rotate(this.rotation),n.inverse();const a=e.getTexture().getWidth(),s=e.getTexture().getHeight(),o=e.getNearDistance(),u=e.getFarDistance(),h=e.getFieldOfView();V().perspective(h,o,u,a,s,this.projectionMatrix),this.global||n.multLeft(r.inverse()),this.invTextureSpaceProjectionMatrix.assign(n).multRight(this.projectionMatrix).multRight(e.getBiasMatrix()).multRight(this.textureMatrix),this.modelViewMatrix.get().multVecMatrix(this.location.assign(e._location.getValue())),this.locationArray.set(this.location)},setGlobalVariables(t){this.matrix.assign(t.getView()?.inverse??_().IDENTITY).multRight(t.getCameraSpaceMatrixArray()).multRight(this.invTextureSpaceProjectionMatrix),this.matrixArray.set(this.matrix)},setShaderUniforms(t,e,i){const r=e.numTextureProjectors++,n=e.x3d_TextureProjector[r];if(!n)return;const a=this.lightNode,s=a.getTexture(),o=this.global?this.textureUnit=this.textureUnit??this.browser.popTextureUnit():this.browser.getTextureUnit();if(t.activeTexture(t.TEXTURE0+o),t.bindTexture(t.TEXTURE_2D,s.getTexture()),t.uniform1i(n.texture,o),e.hasTextureProjector(r,this))return;const u=a.getNearParameter(),h=a.getFarParameter();t.uniform3f(n.color,...a.getColor()),t.uniform1f(n.intensity,a.getIntensity()),t.uniform3fv(n.location,this.locationArray),t.uniform3f(n.params,u,h,s.isLinear()),t.uniformMatrix4fv(n.matrix,!1,this.matrixArray)},dispose(){this.browser.pushTextureUnit(this.textureUnit),this.modelViewMatrix.clear(),this.textureUnit=void 0,U.push(this)}}),Object.assign(Object.setPrototypeOf(A.prototype,M.prototype),{initialize(){M.prototype.initialize.call(this)},getFieldOfView(){const t=this._fieldOfView.getValue();return t>0&&t<Math.PI?t:Math.PI/4},getLights:()=>U}),Object.defineProperties(A,{...l().getStaticProperties("TextureProjector","TextureProjection",2,"children","4.0"),fieldDefinitions:{value:new(h())([new(o())(w().inputOutput,"metadata",new(a().SFNode)),new(o())(w().inputOutput,"description",new(a().SFString)),new(o())(w().inputOutput,"global",new(a().SFBool)(!0)),new(o())(w().inputOutput,"on",new(a().SFBool)(!0)),new(o())(w().inputOutput,"color",new(a().SFColor)(1,1,1)),new(o())(w().inputOutput,"intensity",new(a().SFFloat)(1)),new(o())(w().inputOutput,"ambientIntensity",new(a().SFFloat)),new(o())(w().inputOutput,"location",new(a().SFVec3f)),new(o())(w().inputOutput,"direction",new(a().SFVec3f)(0,0,1)),new(o())(w().inputOutput,"upVector",new(a().SFVec3f)(0,0,1)),new(o())(w().inputOutput,"fieldOfView",new(a().SFFloat)(.785398)),new(o())(w().inputOutput,"nearDistance",new(a().SFFloat)(-1)),new(o())(w().inputOutput,"farDistance",new(a().SFFloat)(-1)),new(o())(w().outputOnly,"aspectRatio",new(a().SFFloat)),new(o())(w().inputOutput,"texture",new(a().SFNode)),new(o())(w().inputOutput,"shadows",new(a().SFBool)),new(o())(w().inputOutput,"shadowColor",new(a().SFColor)),new(o())(w().inputOutput,"shadowIntensity",new(a().SFFloat)(1)),new(o())(w().inputOutput,"shadowBias",new(a().SFFloat)(.005)),new(o())(w().initializeOnly,"shadowMapSize",new(a().SFInt32)(1024))]),enumerable:!0}});const z=A,C=O().add("TextureProjector",z),Y=I()(E);function E(){this.projectionMatrix=new(_()),this.modelViewMatrix=new(N())(_()),this.modelMatrix=new(_()),this.invTextureSpaceMatrix=new(_()),this.location=new(b()),this.locationArray=new Float32Array(3),this.invTextureSpaceProjectionMatrix=new(_()),this.direction=new(b()),this.rotation=new(j()),this.matrix=new(_()),this.matrixArray=new Float32Array(16),this.textureMatrix=new(_())}function B(t){M.call(this,t),this.addType(w().TextureProjectorParallel),this._fieldOfView.setUnit("length")}Object.assign(E.prototype,{set(t,e,i){this.browser=t.getBrowser(),this.lightNode=t,this.global=t.getGlobal(),this.modelViewMatrix.push(i),this.textureMatrix.assign(t.getTexture().getMatrix())},renderShadowMap(t){const e=this.lightNode,i=t.getCameraSpaceMatrixArray(),r=this.modelMatrix.assign(this.modelViewMatrix.get()).multRight(i),n=this.invTextureSpaceMatrix.assign(this.global?r:_().IDENTITY);this.rotation.setFromToVec(b().Z_AXIS,this.direction.assign(e.getDirection()).negate()),e.straightenHorizon(this.rotation),n.translate(e.getLocation()),n.rotate(this.rotation),n.inverse();const a=e.getTexture().getWidth()/e.getTexture().getHeight(),s=e.getMinimumX(),o=e.getMaximumX(),u=e.getMinimumY(),h=e.getMaximumY(),c=e.getSizeX(),l=e.getSizeY(),p=e.getNearDistance(),x=e.getFarDistance();if(a>c/l){const t=(s+o)/2,e=l*a/2;V().ortho(t-e,t+e,u,h,p,x,this.projectionMatrix)}else{const t=(u+h)/2,e=c/a/2;V().ortho(s,o,t-e,t+e,p,x,this.projectionMatrix)}this.global||n.multLeft(r.inverse()),this.invTextureSpaceProjectionMatrix.assign(n).multRight(this.projectionMatrix).multRight(e.getBiasMatrix()).multRight(this.textureMatrix),this.modelViewMatrix.get().multVecMatrix(this.location.assign(e._location.getValue())),this.locationArray.set(this.location)},setGlobalVariables(t){this.matrix.assign(t.getView()?.inverse??_().IDENTITY).multRight(t.getCameraSpaceMatrixArray()).multRight(this.invTextureSpaceProjectionMatrix),this.matrixArray.set(this.matrix)},setShaderUniforms(t,e,i){const r=e.numTextureProjectors++,n=e.x3d_TextureProjector[r];if(!n)return;const a=this.lightNode,s=a.getTexture(),o=this.global?this.textureUnit=this.textureUnit??this.browser.popTextureUnit():this.browser.getTextureUnit();if(t.activeTexture(t.TEXTURE0+o),t.bindTexture(t.TEXTURE_2D,s.getTexture()),t.uniform1i(n.texture,o),e.hasTextureProjector(r,this))return;const u=a.getNearParameter(),h=a.getFarParameter();t.uniform3f(n.color,...a.getColor()),t.uniform1f(n.intensity,a.getIntensity()),t.uniform3fv(n.location,this.locationArray),t.uniform3f(n.params,u,h,s.isLinear()),t.uniformMatrix4fv(n.matrix,!1,this.matrixArray)},dispose(){this.browser.pushTextureUnit(this.textureUnit),this.modelViewMatrix.clear(),this.textureUnit=void 0,Y.push(this)}}),Object.assign(Object.setPrototypeOf(B.prototype,M.prototype),{initialize(){M.prototype.initialize.call(this),this._fieldOfView.addInterest("set_fieldOfView___",this),this.set_fieldOfView___()},set_fieldOfView___(){this.minimumX=this._fieldOfView[0],this.minimumY=this._fieldOfView[1],this.maximumX=this._fieldOfView[2],this.maximumY=this._fieldOfView[3],this.sizeX=this.maximumX-this.minimumX,this.sizeY=this.maximumY-this.minimumY},getMinimumX(){return this.minimumX},getMinimumY(){return this.minimumY},getMaximumX(){return this.maximumX},getMaximumY(){return this.maximumY},getSizeX(){return this.sizeX},getSizeY(){return this.sizeY},getLights:()=>Y}),Object.defineProperties(B,{...l().getStaticProperties("TextureProjectorParallel","TextureProjection",2,"children","4.0"),fieldDefinitions:{value:new(h())([new(o())(w().inputOutput,"metadata",new(a().SFNode)),new(o())(w().inputOutput,"description",new(a().SFString)),new(o())(w().inputOutput,"global",new(a().SFBool)(!0)),new(o())(w().inputOutput,"on",new(a().SFBool)(!0)),new(o())(w().inputOutput,"color",new(a().SFColor)(1,1,1)),new(o())(w().inputOutput,"intensity",new(a().SFFloat)(1)),new(o())(w().inputOutput,"ambientIntensity",new(a().SFFloat)),new(o())(w().inputOutput,"location",new(a().SFVec3f)),new(o())(w().inputOutput,"direction",new(a().SFVec3f)(0,0,1)),new(o())(w().inputOutput,"upVector",new(a().SFVec3f)(0,0,1)),new(o())(w().inputOutput,"fieldOfView",new(a().SFVec4f)(-1,-1,1,1)),new(o())(w().inputOutput,"nearDistance",new(a().SFFloat)(-1)),new(o())(w().inputOutput,"farDistance",new(a().SFFloat)(-1)),new(o())(w().outputOnly,"aspectRatio",new(a().SFFloat)),new(o())(w().inputOutput,"texture",new(a().SFNode)),new(o())(w().inputOutput,"shadows",new(a().SFBool)),new(o())(w().inputOutput,"shadowColor",new(a().SFColor)),new(o())(w().inputOutput,"shadowIntensity",new(a().SFFloat)(1)),new(o())(w().inputOutput,"shadowBias",new(a().SFFloat)(.005)),new(o())(w().initializeOnly,"shadowMapSize",new(a().SFInt32)(1024))]),enumerable:!0}});const L=B,H=O().add("TextureProjectorParallel",L);r().add({name:"TextureProjection",concreteNodes:[C,H],abstractNodes:[M]});O().add("TextureProjectionComponent",undefined)})();
|