x_ite
Version:
X_ITE X3D Browser, view and manipulate X3D, VRML, glTF and other 3D sources in HTML.
2 lines • 16.5 kB
JavaScript
/* X_ITE v11.6.6 */
const e=window[Symbol.for("X_ITE.X3D-11.6.6")];(()=>{var t={n:e=>{var i=e&&e.__esModule?()=>e.default:()=>e;return t.d(i,{a:i}),i},d:(e,i)=>{for(var s in i)t.o(i,s)&&!t.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:i[s]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const i=e.Components;var s=t.n(i);const n=e.X3DBaseNode;var o=t.n(n);const r=e.X3DConstants;var a=t.n(r);const l=e.Fields;var h=t.n(l);const g=e.Namespace;var d=t.n(g);function c(e){o().call(this,e),this.addChildObjects(a().inputOutput,"dimension",new(h().SFInt32)(40))}Object.setPrototypeOf(c.prototype,o().prototype),Object.defineProperties(c,{typeName:{value:"Arc2DOptions",enumerable:!0}});const p=c,u=d().add("Arc2DOptions",p);function y(e){o().call(this,e),this.addChildObjects(a().inputOutput,"dimension",new(h().SFInt32)(40))}Object.setPrototypeOf(y.prototype,o().prototype),Object.defineProperties(y,{typeName:{value:"ArcClose2DOptions",enumerable:!0}});const m=y,O=d().add("ArcClose2DOptions",m),D=e.IndexedLineSet;var f=t.n(D);const w=e.Coordinate;var b=t.n(w);const _=e.Complex;var P=t.n(_);function S(e){o().call(this,e),this.addChildObjects(a().inputOutput,"dimension",new(h().SFInt32)(40))}Object.assign(Object.setPrototypeOf(S.prototype,o().prototype),{initialize(){o().prototype.initialize.call(this),this.addInterest("eventsProcessed",this)},getGeometry(){return this.geometry||this.build(),this.geometry},createCoordIndex(){const e=this._dimension.getValue(),t=this.geometry._coordIndex;for(let i=0;i<e;++i)t.push(i);t.push(0,-1)},createPoints(){const e=this._dimension.getValue(),t=2*Math.PI/e,i=this.geometry._coord.getValue()._point;for(let s=0;s<e;++s){const e=P().Polar(1,t*s);i.push(new(h().SFVec3f)(e.real,e.imag,0))}},build(){this.geometry=new(f())(this.getExecutionContext()),this.geometry._coord=new(b())(this.getExecutionContext()),this.createCoordIndex(),this.createPoints();const e=this.geometry;this.geometry._coord.getValue().setup(),e.setup()},eventsProcessed(){this.geometry=null}}),Object.defineProperties(S,{typeName:{value:"Circle2DOptions",enumerable:!0}});const V=S,M=d().add("Circle2DOptions",V),v=e.X3DGeometryNode;var C=t.n(v);function x(e){o().call(this,e),this.addChildObjects(a().inputOutput,"dimension",new(h().SFInt32)(40)),this.diskTexCoords=C().createArray(),this.diskNormals=C().createArray(),this.diskVertices=C().createArray()}Object.assign(Object.setPrototypeOf(x.prototype,o().prototype),{initialize(){o().prototype.initialize.call(this),this.addInterest("eventsProcessed",this)},getDiskTexCoords(){return this.diskTexCoords.length||this.build(),this.diskTexCoords},getDiskNormals(){return this.diskNormals.length||this.build(),this.diskNormals},getDiskVertices(){return this.diskVertices.length||this.build(),this.diskVertices},build:(()=>{const e=new(P())(.5,.5),t=new(P()),i=new(P()),s=new(P()),n=new(P());return function(){const o=this._dimension.getValue(),r=2*Math.PI/o,a=this.diskTexCoords,l=this.diskNormals,h=this.diskVertices;for(let g=0;g<o;++g){const o=r*g,d=r*(g+1);t.setPolar(.5,o).add(e),i.setPolar(.5,d).add(e),s.setPolar(1,o),n.setPolar(1,d),a.push(.5,.5,0,1,t.real,t.imag,0,1,i.real,i.imag,0,1),l.push(0,0,1,0,0,1,0,0,1),h.push(0,0,0,1,s.real,s.imag,0,1,n.real,n.imag,0,1)}a.shrinkToFit(),l.shrinkToFit(),h.shrinkToFit()}})(),eventsProcessed(){this.diskTexCoords.length=0,this.diskNormals.length=0,this.diskVertices.length=0}}),Object.defineProperties(x,{typeName:{value:"Disk2DOptions",enumerable:!0}});const T=x,F=d().add("Disk2DOptions",T),j=e.IndexedFaceSet;var A=t.n(j);const N=e.TextureCoordinate;var k=t.n(N);function I(e){o().call(this,e)}Object.assign(Object.setPrototypeOf(I.prototype,o().prototype),{getGeometry(){if(this.geometry)return this.geometry;this.geometry=new(A())(this.getExecutionContext()),this.geometry._texCoord=new(k())(this.getExecutionContext()),this.geometry._coord=new(b())(this.getExecutionContext());const e=this.geometry,t=this.geometry._texCoord.getValue(),i=this.geometry._coord.getValue();return t._point=[1,1,0,1,0,0,1,0],i._point=[1,1,0,-1,1,0,-1,-1,0,1,-1,0],e._coordIndex=[0,1,2,3,-1],t.setup(),i.setup(),e.setup(),this.geometry}}),Object.defineProperties(I,{typeName:{value:"Rectangle2DOptions",enumerable:!0}});const G=I,z=d().add("Rectangle2DOptions",G),B=e.PrimitiveQuality;var R=t.n(B);const U=Symbol(),E=Symbol(),X=Symbol(),L=Symbol(),Q=Symbol();function H(){}function q(e,t){return this[e]??=(()=>{const e=new t(this.getPrivateScene());return e.setup(),e})()}Object.assign(H.prototype,{initialize(){this.setPrimitiveQuality2D(this.getBrowserOptions().getPrimitiveQuality())},getArc2DOptions(){return q.call(this,U,u)},getArcClose2DOptions(){return q.call(this,E,O)},getCircle2DOptions(){return q.call(this,X,M)},getDisk2DOptions(){return q.call(this,L,F)},getRectangle2DOptions(){return q.call(this,Q,z)},setPrimitiveQuality2D(e){const t=this.getArc2DOptions(),i=this.getArcClose2DOptions(),s=this.getCircle2DOptions(),n=this.getDisk2DOptions();switch(e){case R().LOW:t._dimension=20,i._dimension=20,s._dimension=20,n._dimension=20;break;case R().MEDIUM:t._dimension=40,i._dimension=40,s._dimension=40,n._dimension=40;break;case R().HIGH:t._dimension=80,i._dimension=80,s._dimension=80,n._dimension=80}}});const W=H,J=d().add("X3DGeometry2DContext",W),K=e.X3DFieldDefinition;var Y=t.n(K);const Z=e.FieldDefinitionArray;var $=t.n(Z);const ee=e.X3DNode;var te=t.n(ee);const ie=e.X3DLineGeometryNode;var se=t.n(ie);const ne=e.Algorithm;var oe=t.n(ne);function re(e){se().call(this,e),this.addType(a().Arc2D),this._startAngle.setUnit("angle"),this._endAngle.setUnit("angle"),this._radius.setUnit("length")}Object.assign(Object.setPrototypeOf(re.prototype,se().prototype),{set_live__(){this.connectOptions(this.getBrowser().getArc2DOptions())},getSweepAngle(){const e=oe().interval(this._startAngle.getValue(),0,2*Math.PI),t=oe().interval(this._endAngle.getValue(),0,2*Math.PI);if(e===t)return 2*Math.PI;const i=Math.abs(t-e);return e>t?2*Math.PI-i:isNaN(i)?0:i},build(){const e=this.getBrowser().getArc2DOptions()._dimension.getValue(),t=this._startAngle.getValue(),i=Math.abs(this._radius.getValue()),s=this.getSweepAngle(),n=Math.max(3,Math.floor(s*e/(2*Math.PI))),o=this.getVertices();for(let e=0;e<n;++e){const r=t+s*(e/n),a=P().Polar(i,r),l=t+s*((e+1)/n),h=P().Polar(i,l);o.push(a.real,a.imag,0,1),o.push(h.real,h.imag,0,1)}this.getMin().set(-i,-i,0),this.getMax().set(i,i,0)}}),Object.defineProperties(re,{...te().getStaticProperties("Arc2D","Geometry2D",2,"geometry","3.0"),fieldDefinitions:{value:new($())([new(Y())(a().inputOutput,"metadata",new(h().SFNode)),new(Y())(a().initializeOnly,"startAngle",new(h().SFFloat)),new(Y())(a().initializeOnly,"endAngle",new(h().SFFloat)(1.570796)),new(Y())(a().initializeOnly,"radius",new(h().SFFloat)(1))]),enumerable:!0}});const ae=re,le=d().add("Arc2D",ae);function he(e){C().call(this,e),this.addType(a().ArcClose2D),this.setGeometryType(2),this._startAngle.setUnit("angle"),this._endAngle.setUnit("angle"),this._radius.setUnit("length")}Object.assign(Object.setPrototypeOf(he.prototype,C().prototype),{set_live__(){this.connectOptions(this.getBrowser().getArcClose2DOptions())},getSweepAngle(){const e=oe().interval(this._startAngle.getValue(),0,2*Math.PI),t=oe().interval(this._endAngle.getValue(),0,2*Math.PI);if(e===t)return 2*Math.PI;const i=Math.abs(t-e);return e>t?2*Math.PI-i:isNaN(i)?0:i},build:(()=>{const e=new(P())(.5,.5);return function(){const t=this.getBrowser().getArcClose2DOptions(),i="CHORD"===this._closureType.getValue(),s=t._dimension.getValue(),n=this._startAngle.getValue(),o=Math.abs(this._radius.getValue()),r=this.getSweepAngle(),a=Math.max(4,Math.floor(r*s/(2*Math.PI))),l=this.getTexCoords(),h=this.getNormals(),g=this.getVertices(),d=[],c=[];this.getMultiTexCoords().push(l);const p=a-1;for(let t=0;t<a;++t){const i=n+r*(t/p);d.push(P().Polar(.5,i).add(e)),c.push(P().Polar(o,i))}if(i){const e=d[0],t=c[0];for(let i=1;i<p;++i){const s=d[i],n=d[i+1],o=c[i],r=c[i+1];l.push(e.real,e.imag,0,1,s.real,s.imag,0,1,n.real,n.imag,0,1),h.push(0,0,1,0,0,1,0,0,1),g.push(t.real,t.imag,0,1,o.real,o.imag,0,1,r.real,r.imag,0,1)}}else for(let e=0;e<p;++e){const t=d[e],i=d[e+1],s=c[e],n=c[e+1];l.push(.5,.5,0,1,t.real,t.imag,0,1,i.real,i.imag,0,1),h.push(0,0,1,0,0,1,0,0,1),g.push(0,0,0,1,s.real,s.imag,0,1,n.real,n.imag,0,1)}this.getMin().set(-o,-o,0),this.getMax().set(o,o,0),this.setSolid(this._solid.getValue())}})()}),Object.defineProperties(he,{...te().getStaticProperties("ArcClose2D","Geometry2D",2,"geometry","3.0"),fieldDefinitions:{value:new($())([new(Y())(a().inputOutput,"metadata",new(h().SFNode)),new(Y())(a().initializeOnly,"closureType",new(h().SFString)("PIE")),new(Y())(a().initializeOnly,"startAngle",new(h().SFFloat)),new(Y())(a().initializeOnly,"endAngle",new(h().SFFloat)(1.570796)),new(Y())(a().initializeOnly,"radius",new(h().SFFloat)(1)),new(Y())(a().initializeOnly,"solid",new(h().SFBool))]),enumerable:!0}});const ge=he,de=d().add("ArcClose2D",ge);function ce(e){se().call(this,e),this.addType(a().Circle2D),this._radius.setUnit("length")}Object.assign(Object.setPrototypeOf(ce.prototype,se().prototype),{set_live__(){this.connectOptions(this.getBrowser().getCircle2DOptions())},build(){const e=this.getBrowser().getCircle2DOptions().getGeometry(),t=this.getVertices(),i=this._radius.getValue();if(1===i)t.assign(e.getVertices());else{const s=e.getVertices();for(let e=0,n=s.length;e<n;e+=4)t.push(s[e]*i,s[e+1]*i,0,1)}this.getMin().set(-i,-i,0),this.getMax().set(i,i,0)}}),Object.defineProperties(ce,{...te().getStaticProperties("Circle2D","Geometry2D",2,"geometry","3.0"),fieldDefinitions:{value:new($())([new(Y())(a().inputOutput,"metadata",new(h().SFNode)),new(Y())(a().initializeOnly,"radius",new(h().SFFloat)(1))]),enumerable:!0}});const pe=ce,ue=d().add("Circle2D",pe),ye=e.X3DPointGeometryNode;var me=t.n(ye);function Oe(e){se().call(this,e),this.addType(a().Disk2D),this._innerRadius.setUnit("length"),this._outerRadius.setUnit("length")}Object.assign(Object.setPrototypeOf(Oe.prototype,C().prototype),se().prototype,{set_live__(){this.connectOptions(this.getBrowser().getDisk2DOptions())},build(){const e=this.getBrowser(),t=e.getContext(),i=e.getDisk2DOptions(),s=Math.min(Math.abs(this._innerRadius.getValue()),Math.abs(this._outerRadius.getValue())),n=Math.max(Math.abs(this._innerRadius.getValue()),Math.abs(this._outerRadius.getValue())),o=this.getVertices();if(s===n){if(0===n)return o.push(0,0,0,1),this.getMin().set(0),this.getMax().set(0),this.setGeometryType(0),this.setPrimitiveMode(t.POINTS),this.setTransparent(!0),this.setSolid(!1),void this.setBase(me());const e=this.getBrowser().getCircle2DOptions().getGeometry();if(1===n)o.assign(e.getVertices());else{const t=e.getVertices();for(let e=0,i=t.length;e<i;e+=4)o.push(t[e]*n,t[e+1]*n,0,1)}return this.getMin().set(-n,-n,0),this.getMax().set(n,n,0),this.setGeometryType(1),this.setPrimitiveMode(t.LINES),this.setTransparent(!1),this.setSolid(!1),void this.setBase(se())}if(0===s){if(this.getMultiTexCoords().push(i.getDiskTexCoords()),this.getNormals().assign(i.getDiskNormals()),1===n)o.assign(i.getDiskVertices());else{const e=i.getDiskVertices().getValue();for(let t=0,i=e.length;t<i;t+=4)o.push(e[t]*n,e[t+1]*n,0,1)}return this.getMin().set(-n,-n,0),this.getMax().set(n,n,0),this.setGeometryType(2),this.setPrimitiveMode(t.TRIANGLES),this.setTransparent(!1),this.setSolid(this._solid.getValue()),void this.setBase(C())}const r=s/n,a=(1-r)/2,l=i.getDiskTexCoords().getValue(),h=i.getDiskVertices().getValue(),g=this.getTexCoords(),d=this.getNormals();this.getMultiTexCoords().push(g);for(let e=0,t=h.length;e<t;e+=12)g.push(l[e+4]*r+a,l[e+5]*r+a,0,1,l[e+4],l[e+5],0,1,l[e+8],l[e+9],0,1,l[e+4]*r+a,l[e+5]*r+a,0,1,l[e+8],l[e+9],0,1,l[e+8]*r+a,l[e+9]*r+a,0,1),d.push(0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1),o.push(h[e+4]*s,h[e+5]*s,0,1,h[e+4]*n,h[e+5]*n,0,1,h[e+8]*n,h[e+9]*n,0,1,h[e+4]*s,h[e+5]*s,0,1,h[e+8]*n,h[e+9]*n,0,1,h[e+8]*s,h[e+9]*s,0,1);this.getMin().set(-n,-n,0),this.getMax().set(n,n,0),this.setGeometryType(2),this.setPrimitiveMode(t.TRIANGLES),this.setTransparent(!1),this.setSolid(this._solid.getValue()),this.setBase(C())},setBase(e){this.intersectsLine=e.prototype.intersectsLine,this.intersectsBox=e.prototype.intersectsBox,this.generateTexCoords=e.prototype.generateTexCoords,this.displaySimple=e.prototype.displaySimple,this.display=e.prototype.display,this.displaySimpleInstanced=e.prototype.displaySimpleInstanced,this.displayInstanced=e.prototype.displayInstanced},updateRenderFunctions(){}}),Object.defineProperties(Oe,{...te().getStaticProperties("Disk2D","Geometry2D",2,"geometry","3.0"),fieldDefinitions:{value:new($())([new(Y())(a().inputOutput,"metadata",new(h().SFNode)),new(Y())(a().initializeOnly,"innerRadius",new(h().SFFloat)),new(Y())(a().initializeOnly,"outerRadius",new(h().SFFloat)(1)),new(Y())(a().initializeOnly,"solid",new(h().SFBool))]),enumerable:!0}});const De=Oe,fe=d().add("Disk2D",De);function we(e){se().call(this,e),this.addType(a().Polyline2D),this._lineSegments.setUnit("length")}Object.assign(Object.setPrototypeOf(we.prototype,se().prototype),{build(){const e=this._lineSegments.getValue(),t=this.getVertices();for(let i=0,s=2*(this._lineSegments.length-1);i<s;i+=2)t.push(e[i+0],e[i+1],0,1),t.push(e[i+2],e[i+3],0,1)}}),Object.defineProperties(we,{...te().getStaticProperties("Polyline2D","Geometry2D",1,"geometry","3.0"),fieldDefinitions:{value:new($())([new(Y())(a().inputOutput,"metadata",new(h().SFNode)),new(Y())(a().initializeOnly,"lineSegments",new(h().MFVec2f))]),enumerable:!0}});const be=we,_e=d().add("Polyline2D",be);function Pe(e){me().call(this,e),this.addType(a().Polypoint2D),this._point.setUnit("length")}Object.assign(Object.setPrototypeOf(Pe.prototype,me().prototype),{build(){const e=this._point.getValue(),t=this.getVertices();for(let i=0,s=2*this._point.length;i<s;i+=2)t.push(e[i],e[i+1],0,1)}}),Object.defineProperties(Pe,{...te().getStaticProperties("Polypoint2D","Geometry2D",1,"geometry","3.0"),fieldDefinitions:{value:new($())([new(Y())(a().inputOutput,"metadata",new(h().SFNode)),new(Y())(a().inputOutput,"point",new(h().MFVec2f))]),enumerable:!0}});const Se=Pe,Ve=d().add("Polypoint2D",Se),Me=e.Vector2;var ve=t.n(Me);function Ce(e){C().call(this,e),this.addType(a().Rectangle2D),this.setGeometryType(2),this._size.setUnit("length")}Object.assign(Object.setPrototypeOf(Ce.prototype,C().prototype),{build:(()=>{const e=new(ve())(2);return function(){const t=this.getBrowser().getRectangle2DOptions().getGeometry(),i=this._size.getValue(),s=this.getVertices();if(this.getMultiTexCoords().push(...t.getMultiTexCoords()),this.getTangents().assign(t.getTangents()),this.getNormals().assign(t.getNormals()),i.equals(e))s.assign(t.getVertices()),this.getMin().assign(t.getMin()),this.getMax().assign(t.getMax());else{const e=Math.abs(i.x/2),n=Math.abs(i.y/2),o=t.getVertices();for(let t=0;t<o.length;t+=4)s.push(e*o[t],n*o[t+1],0,1);this.getMin().set(-e,-n,0),this.getMax().set(e,n,0)}this.setSolid(this._solid.getValue())}})()}),Object.defineProperties(Ce,{...te().getStaticProperties("Rectangle2D","Geometry2D",1,"geometry","3.0"),fieldDefinitions:{value:new($())([new(Y())(a().inputOutput,"metadata",new(h().SFNode)),new(Y())(a().initializeOnly,"size",new(h().SFVec2f)(2,2)),new(Y())(a().initializeOnly,"solid",new(h().SFBool))]),enumerable:!0}});const xe=Ce,Te=d().add("Rectangle2D",xe);function Fe(e){C().call(this,e),this.addType(a().TriangleSet2D),this.setGeometryType(2),this._vertices.setUnit("length")}Object.assign(Object.setPrototypeOf(Fe.prototype,C().prototype),{build(){const e=this._vertices.getValue(),t=this.getNormals(),i=this.getVertices();for(let s=0,n=2*this._vertices.length;s<n;s+=2)t.push(0,0,1),i.push(e[s],e[s+1],0,1);this.setSolid(this._solid.getValue())},generateTexCoords(){const e=this.getTexCoords();if(0===e.length){const t=this.getTexCoordParams(),i=t.min,s=t.Ssize,n=this.getVertices().getValue();for(let t=0,o=n.length;t<o;t+=4)e.push((n[t]-i[0])/s,(n[t+1]-i[1])/s,0,1);e.shrinkToFit()}this.getMultiTexCoords().push(e)}}),Object.defineProperties(Fe,{...te().getStaticProperties("TriangleSet2D","Geometry2D",1,"geometry","3.0"),fieldDefinitions:{value:new($())([new(Y())(a().inputOutput,"metadata",new(h().SFNode)),new(Y())(a().inputOutput,"vertices",new(h().MFVec2f)),new(Y())(a().initializeOnly,"solid",new(h().SFBool))]),enumerable:!0}});const je=Fe,Ae=d().add("TriangleSet2D",je);s().add({name:"Geometry2D",concreteNodes:[le,de,ue,fe,_e,Ve,Te,Ae],abstractNodes:[],browserContext:J});d().add("Geometry2DComponent",undefined)})();