// All material copyright Esri, All Rights Reserved, unless otherwise specified. // See https://js.arcgis.com/4.30/esri/copyright.txt for details. //>>built define("../../../chunks/tslib.es6 ../../../core/Accessor ../../../core/Logger ../../../core/mathUtils ../../../core/screenUtils ../../../core/accessorSupport/decorators/property ../../../core/has ../../../core/RandomLCG ../../../core/accessorSupport/decorators/subclass ../../../core/libs/gl-matrix-2/math/mat4 ../../../core/libs/gl-matrix-2/factories/mat4f64 ../../../core/libs/gl-matrix-2/math/vec2 ../../../core/libs/gl-matrix-2/factories/vec2f64 ../../../chunks/vec32 ../../../core/libs/gl-matrix-2/factories/vec3f64 ../../../chunks/vec42 ../../../core/libs/gl-matrix-2/factories/vec4f64 ../../../geometry/support/frustum ../../../geometry/support/ray ../../../geometry/support/vector ../../ViewingMode ../webgl-engine/lib/fov ../webgl-engine/lib/rendererUtils".split(" "), function(e,d,F,u,D,f,L,M,G,p,q,E,H,h,r,l,t,z,I,J,K,v,k){var A;d=A=class extends d{constructor(a){super(a);this._ray=I.create();this._viewport=t.fromValues(0,0,1,1);this._padding=t.fromValues(0,0,0,0);this._fov=55/180*Math.PI;this._nearFar=H.fromValues(1,1E3);this._viewDirty=!0;this._viewMatrix=q.create();this._viewProjectionDirty=!0;this._viewProjectionMatrix=q.create();this._viewInverseTransposeMatrixDirty=!0;this._viewInverseTransposeMatrix=q.create();this._frustumDirty=!0;this._frustum=z.create(); this._fullViewport=t.create();this._pixelRatio=1;this.column=this.row=0;this._columns=this._rows=1;this._center=r.create();this._up=r.create();this.relativeElevation=0}get pixelRatio(){return this._pixelRatio}set pixelRatio(a){this._pixelRatio=0=b||l.squaredDistance(this.screenViewport,a.screenViewport)>=b||this.row!==a.row||this.column!==a.column||this.rows!==a.rows||this.columns!==a.columns)return!1;h.sub(m,a.eye,a.center);h.sub(B,this.eye,this.center);b=h.dot(m,B);const c=h.sqrLen(m),n=h.sqrLen(B);return b*b>=(1-1E-10)*c*n&&h.sqrDist(a.eye,this.eye)<2.5E-7*Math.max(c,n)}computeRenderPixelSizeAt(a){return this.computeRenderPixelSizeAtDist(this._viewDirectionDistance(a))}computeRenderPixelSizeAtDist(a){return a* this.perRenderPixelRatio}computeScreenPixelSizeAt(a){return this.computeScreenPixelSizeAtDist(this._viewDirectionDistance(a))}_viewDirectionDistance(a){return Math.abs(J.projectPointSignedLength(this.viewForward,h.subtract(m,a,this.eye)))}computeScreenPixelSizeAtDist(a){return a*this.perScreenPixelRatio}computeDistanceFromRadius(a,b){return a/Math.tan(Math.min(this.fovX,this.fovY)/(2*(b||1)))}getScreenCenter(a=D.createScreenPointArray()){a[0]=(this.padding[k.PaddingSide.LEFT]+this.width/2)/this.pixelRatio; a[1]=(this.padding[k.PaddingSide.TOP]+this.height/2)/this.pixelRatio;return a}getRenderCenter(a,b=.5,c=.5){a[0]=this.padding[k.PaddingSide.LEFT]+this.width*b;a[1]=this.padding[k.PaddingSide.BOTTOM]+this.height*c;a[2]=.5;return a}setGLViewport(a){const b=this.viewport,c=this.padding;a.setViewport(b[0]-c[3],b[1]-c[2],b[2]+c[1]+c[3],b[3]+c[0]+c[2])}applyProjection(a,b){a!==g&&h.copy(g,a);g[3]=1;l.transformMat4(g,g,this.projectionMatrix);a=Math.abs(g[3]);h.scale(g,g,1/a);const c=this.fullViewport;b[0]= u.lerp(0,c[0]+c[2],.5+.5*g[0]);b[1]=u.lerp(0,c[1]+c[3],.5+.5*g[1]);b[2]=.5*(g[2]+1);b[3]=a}unapplyProjection(a,b){const c=this.fullViewport;g[0]=(a[0]/(c[0]+c[2])*2-1)*a[3];g[1]=(a[1]/(c[1]+c[3])*2-1)*a[3];g[2]=(2*a[2]-1)*a[3];g[3]=a[3];null!=this.inverseProjectionMatrix&&(l.transformMat4(g,g,this.inverseProjectionMatrix),b[0]=g[0],b[1]=g[1],b[2]=g[2])}projectToScreen(a,b){this.projectToRenderScreen(a,C);this.renderToScreen(C,b);return b}projectToRenderScreen(a,b){g[0]=a[0];g[1]=a[1];g[2]=a[2];g[3]= 1;l.transformMat4(g,g,this.viewProjectionMatrix);if(0===g[3])return null;a=g;h.scale(a,a,1/Math.abs(g[3]));var c=this.fullViewport;const n=u.lerp(0,c[0]+c[2],.5+.5*a[0]);c=u.lerp(0,c[1]+c[3],.5+.5*a[1]);"x"in b?(b.x=n,b.y=c):(b[0]=n,b[1]=c,2a?(h.set(this._up,0,0,1),this._markViewDirty(),this.notifyChange("_up")):Math.abs(h.dot(m,this.center))>.9999*h.length(m)*a||(h.cross(this._up,m,this.center),h.cross(this._up, this._up,m),h.normalize(this._up,this._up),this.notifyChange("_up"),this._markViewDirty())}_computeUpLocal(){h.direction(m,this.eye,this.center);.9999>=Math.abs(m[2])&&(h.scale(m,m,m[2]),h.set(this._up,-m[0],-m[1],1-m[2]),h.normalize(this._up,this._up),this.notifyChange("_up"),this._markViewDirty())}_compareAndSetView(a,b,c=""){"number"===typeof a[0]&&isFinite(a[0])&&"number"===typeof a[1]&&isFinite(a[1])&&"number"===typeof a[2]&&isFinite(a[2])?h.exactEquals(a,b)||(h.copy(b,a),this._markViewDirty(), c.length&&this.notifyChange(c)):F.getLogger("esri.views.3d.webgl-engine.lib.RenderCamera").warn("RenderCamera vector contains invalid number, ignoring value")}_markViewDirty(){this._viewProjectionDirty=this._frustumDirty=this._viewDirty=!0}_recomputeFrustum(){this._frustumDirty&&(z.fromMatrix(this.viewMatrix,this.projectionMatrix,this._frustum),this._frustumDirty=!1)}_ensureViewClean(){this._viewDirty&&(p.lookAt(this._viewMatrix,this.eye,this.center,this.up),this.notifyChange("_viewMatrix"),this._viewDirty= !1,this._viewInverseTransposeMatrixDirty=!0)}};e.__decorate([f.property()],d.prototype,"_viewport",void 0);e.__decorate([f.property()],d.prototype,"_padding",void 0);e.__decorate([f.property()],d.prototype,"_fov",void 0);e.__decorate([f.property()],d.prototype,"_nearFar",void 0);e.__decorate([f.property()],d.prototype,"_viewDirty",void 0);e.__decorate([f.property()],d.prototype,"_viewMatrix",void 0);e.__decorate([f.property()],d.prototype,"_pixelRatio",void 0);e.__decorate([f.property()],d.prototype, "pixelRatio",null);e.__decorate([f.property()],d.prototype,"row",void 0);e.__decorate([f.property()],d.prototype,"column",void 0);e.__decorate([f.property()],d.prototype,"_rows",void 0);e.__decorate([f.property()],d.prototype,"rows",null);e.__decorate([f.property()],d.prototype,"_columns",void 0);e.__decorate([f.property()],d.prototype,"columns",null);e.__decorate([f.property()],d.prototype,"eye",null);e.__decorate([f.property()],d.prototype,"center",null);e.__decorate([f.property()],d.prototype, "_center",void 0);e.__decorate([f.property()],d.prototype,"up",null);e.__decorate([f.property()],d.prototype,"_up",void 0);e.__decorate([f.property()],d.prototype,"viewMatrix",null);e.__decorate([f.property({readOnly:!0})],d.prototype,"viewForward",null);e.__decorate([f.property({readOnly:!0})],d.prototype,"viewUp",null);e.__decorate([f.property({readOnly:!0})],d.prototype,"viewRight",null);e.__decorate([f.property({readOnly:!0})],d.prototype,"nearFar",null);e.__decorate([f.property()],d.prototype, "near",null);e.__decorate([f.property()],d.prototype,"far",null);e.__decorate([f.property()],d.prototype,"viewport",null);e.__decorate([f.property({readOnly:!0})],d.prototype,"screenViewport",null);e.__decorate([f.property({readOnly:!0})],d.prototype,"screenPadding",null);e.__decorate([f.property()],d.prototype,"x",null);e.__decorate([f.property()],d.prototype,"y",null);e.__decorate([f.property()],d.prototype,"width",null);e.__decorate([f.property()],d.prototype,"height",null);e.__decorate([f.property()], d.prototype,"fullWidth",null);e.__decorate([f.property()],d.prototype,"fullHeight",null);e.__decorate([f.property({readOnly:!0})],d.prototype,"_aspect",null);e.__decorate([f.property()],d.prototype,"padding",null);e.__decorate([f.property({readOnly:!0})],d.prototype,"projectionMatrix",null);e.__decorate([f.property({readOnly:!0})],d.prototype,"inverseProjectionMatrix",null);e.__decorate([f.property()],d.prototype,"fov",null);e.__decorate([f.property()],d.prototype,"fovX",null);e.__decorate([f.property()], d.prototype,"fovY",null);e.__decorate([f.property()],d.prototype,"viewInverseTransposeMatrix",null);e.__decorate([f.property({readOnly:!0})],d.prototype,"_projectionMatrixInternal",null);e.__decorate([f.property()],d.prototype,"relativeElevation",void 0);e=d=A=e.__decorate([G.subclass("esri.views.3d.webgl.RenderCamera")],d);const g=t.create(),y=q.create(),m=r.create(),B=r.create(),C=D.createRenderScreenPointArray3();return e});