define(["./Color-82ef4a75","./ComponentDatatype-aaeec80f","./defaultValue-81eec7ed","./Check-741c5f3c","./GeometryInstance-1b39c9e8","./PolygonGeometry-95e6b579","./PolygonOutlineGeometry-29f6cf19","./VertexFormat-d50a69ba","./Resource-8ae1a924","./combine-3c023bda","./WebGLConstants-508b9636","./Cartesian2-bd414876","./when-422ea0ae","./Transforms-5b829630","./RuntimeError-26acdd3b","./Matrix2-dc0c61cc","./Matrix4-4c545f70","./Math-e73894ab","./PixelFormat-bd725b72","./GeometryAttribute-2b42a913","./GeometryAttributes-32b29525","./PrimitivePipeline-d5bc2e2a","./GeographicProjection-c931c7fb","./BoundingSphere-9a3b5656","./Cartesian3-e0307675","./GetRidingLanternGeometry","./ArcType-fc72c06c","./GeometryOffsetAttribute-ed56ff58","./BoundingRectangle-0e36efc3","./Rectangle-cf3e0e3e","./EllipsoidGeodesic-e7a5ca44","./EllipsoidTangentPlane-4d138901","./AxisAlignedBoundingBox-8774439c","./IntersectionTests-80510c7b","./Plane-bc8b6777","./GeometryPipeline-e7083fea","./AttributeCompression-8f752c03","./EncodedCartesian3-aafcc30f","./IndexDatatype-3f3c99e8","./PolygonGeometryLibrary-231711c2","./arrayRemoveDuplicates-cea3b206","./EllipsoidRhumbLine-592e8885","./PolygonPipeline-04baeb41","./WebMercatorProjection-44373a3d"],(function(e,t,a,r,n,i,o,l,s,u,m,c,f,p,d,_,h,g,x,T,y,C,v,E,b,A,P,I,S,M,L,D,R,w,N,O,z,F,B,V,U,G,W,k){"use strict";function Y(t,r,n,i){t=a.defaultValue(t,1),r=a.defaultValue(r,1),n=a.defaultValue(n,1),i=a.defaultValue(i,1),this.value=new Uint8Array([e.Color.floatToByte(t),e.Color.floatToByte(r),e.Color.floatToByte(n),e.Color.floatToByte(i)])}Object.defineProperties(Y.prototype,{componentDatatype:{get:function(){return t.ComponentDatatype.UNSIGNED_BYTE}},componentsPerAttribute:{get:function(){return 4}},normalize:{get:function(){return!0}}}),Y.fromColor=function(e){return new Y(e.red,e.green,e.blue,e.alpha)},Y.toValue=function(e,t){return a.defined(t)?e.toBytes(t):new Uint8Array(e.toBytes())},Y.equals=function(e,t){return e===t||a.defined(e)&&a.defined(t)&&e.value[0]===t.value[0]&&e.value[1]===t.value[1]&&e.value[2]===t.value[2]&&e.value[3]===t.value[3]};const H={ADD:m.WebGLConstants.FUNC_ADD,SUBTRACT:m.WebGLConstants.FUNC_SUBTRACT,REVERSE_SUBTRACT:m.WebGLConstants.FUNC_REVERSE_SUBTRACT,MIN:m.WebGLConstants.MIN,MAX:m.WebGLConstants.MAX};var X=Object.freeze(H);const K={ZERO:m.WebGLConstants.ZERO,ONE:m.WebGLConstants.ONE,SOURCE_COLOR:m.WebGLConstants.SRC_COLOR,ONE_MINUS_SOURCE_COLOR:m.WebGLConstants.ONE_MINUS_SRC_COLOR,DESTINATION_COLOR:m.WebGLConstants.DST_COLOR,ONE_MINUS_DESTINATION_COLOR:m.WebGLConstants.ONE_MINUS_DST_COLOR,SOURCE_ALPHA:m.WebGLConstants.SRC_ALPHA,ONE_MINUS_SOURCE_ALPHA:m.WebGLConstants.ONE_MINUS_SRC_ALPHA,DESTINATION_ALPHA:m.WebGLConstants.DST_ALPHA,ONE_MINUS_DESTINATION_ALPHA:m.WebGLConstants.ONE_MINUS_DST_ALPHA,CONSTANT_COLOR:m.WebGLConstants.CONSTANT_COLOR,ONE_MINUS_CONSTANT_COLOR:m.WebGLConstants.ONE_MINUS_CONSTANT_COLOR,CONSTANT_ALPHA:m.WebGLConstants.CONSTANT_ALPHA,ONE_MINUS_CONSTANT_ALPHA:m.WebGLConstants.ONE_MINUS_CONSTANT_ALPHA,SOURCE_ALPHA_SATURATE:m.WebGLConstants.SRC_ALPHA_SATURATE};var j=Object.freeze(K);const Z={DISABLED:Object.freeze({enabled:!1}),ALPHA_BLEND:Object.freeze({enabled:!0,equationRgb:X.ADD,equationAlpha:X.ADD,functionSourceRgb:j.SOURCE_ALPHA,functionSourceAlpha:j.ONE,functionDestinationRgb:j.ONE_MINUS_SOURCE_ALPHA,functionDestinationAlpha:j.ONE_MINUS_SOURCE_ALPHA}),PRE_MULTIPLIED_ALPHA_BLEND:Object.freeze({enabled:!0,equationRgb:X.ADD,equationAlpha:X.ADD,functionSourceRgb:j.ONE,functionSourceAlpha:j.ONE,functionDestinationRgb:j.ONE_MINUS_SOURCE_ALPHA,functionDestinationAlpha:j.ONE_MINUS_SOURCE_ALPHA}),ADDITIVE_BLEND:Object.freeze({enabled:!0,equationRgb:X.ADD,equationAlpha:X.ADD,functionSourceRgb:j.SOURCE_ALPHA,functionSourceAlpha:j.ONE,functionDestinationRgb:j.ONE,functionDestinationAlpha:j.ONE})};var q=Object.freeze(Z);const J={FRONT:m.WebGLConstants.FRONT,BACK:m.WebGLConstants.BACK,FRONT_AND_BACK:m.WebGLConstants.FRONT_AND_BACK};var $=Object.freeze(J);function Q(e){e=a.defaultValue(e,a.defaultValue.EMPTY_OBJECT),this.material=e.material,this.translucent=a.defaultValue(e.translucent,!0),this._vertexShaderSource=e.vertexShaderSource,this._fragmentShaderSource=e.fragmentShaderSource,this._renderState=e.renderState,this._closed=a.defaultValue(e.closed,!1)}function ee(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))}function te(){return!0}function ae(e,t){function a(){}for(const t in e)"function"==typeof e[t]&&(e[t]=a);e.isDestroyed=te}function re(e,t,a,r,n){this._format=e,this._datatype=t,this._width=a,this._height=r,this._buffer=n}function ne(){if(!a.defined(me._canTransferArrayBuffer)){const e=new Worker(le("Workers/transferTypedArrayTest.js"));e.postMessage=a.defaultValue(e.webkitPostMessage,e.postMessage);const t=99,r=new Int8Array([t]);try{e.postMessage({array:r},[r.buffer])}catch(e){return me._canTransferArrayBuffer=!1,me._canTransferArrayBuffer}const n=f.when.defer();e.onmessage=function(r){const i=r.data.array,o=a.defined(i)&&i[0]===t;n.resolve(o),e.terminate(),me._canTransferArrayBuffer=o},me._canTransferArrayBuffer=n.promise}return me._canTransferArrayBuffer}Object.defineProperties(Q.prototype,{vertexShaderSource:{get:function(){return this._vertexShaderSource}},fragmentShaderSource:{get:function(){return this._fragmentShaderSource}},renderState:{get:function(){return this._renderState}},closed:{get:function(){return this._closed}}}),Q.prototype.getFragmentShaderSource=function(){var e=[];return e.push("varying vec4 v_endPlaneNormalEcAndBatchId;"),this.flat&&e.push("#define FLAT"),this.faceForward&&e.push("#define FACE_FORWARD"),a.defined(this.material)&&e.push(this.material.shaderSource),e.push(this.fragmentShaderSource),e.join("\n")},Q.prototype.isTranslucent=function(){return a.defined(this.material)&&this.material.isTranslucent()||!a.defined(this.material)&&this.translucent},Q.prototype.getRenderState=function(){var e=this.isTranslucent(),t=s.clone(this.renderState,!1);return e?(t.depthMask=!1,t.blending=q.ALPHA_BLEND):t.depthMask=!0,t},Q.getDefaultRenderState=function(e,t,r){var n={depthTest:{enabled:!0}};return e&&(n.depthMask=!1,n.blending=q.ALPHA_BLEND),t&&(n.cull={enabled:!0,face:$.BACK}),a.defined(r)&&(n=u.combine(r,n,!0)),n},Object.defineProperties(re.prototype,{internalFormat:{get:function(){return this._format}},pixelDatatype:{get:function(){return this._datatype}},width:{get:function(){return this._width}},height:{get:function(){return this._height}},bufferView:{get:function(){return this._buffer}}}),re.clone=function(e){if(a.defined(e))return new re(e._format,e._datatype,e._width,e._height,e._buffer)},re.prototype.clone=function(){return re.clone(this)};const ie=new s.Event;function oe(e,t){--e._activeTasks;const n=t.id;if(!a.defined(n))return;const i=e._deferreds,o=i[n];if(a.defined(t.error)){let e=t.error;"RuntimeError"===e.name?(e=new d.RuntimeError(t.error.message),e.stack=t.error.stack):"DeveloperError"===e.name&&(e=new r.DeveloperError(t.error.message),e.stack=t.error.stack),ie.raiseEvent(e),o.reject(e)}else ie.raiseEvent(),o.resolve(t.result);delete i[n]}function le(e){let t=p.buildModuleUrl(e);if(s.isCrossOriginUrl(t)){const e=`importScripts("${t}");`;let a;try{a=new Blob([e],{type:"application/javascript"})}catch(t){const r=new(window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder);r.append(e),a=r.getBlob("application/javascript")}t=(window.URL||window.webkitURL).createObjectURL(a)}return t}let se;function ue(e){const t=new Worker((a.defined(se)||(se=le("Workers/cesiumWorkerBootstrapper.js")),se));t.postMessage=a.defaultValue(t.webkitPostMessage,t.postMessage);const r={loaderConfig:{paths:{Workers:p.buildModuleUrl("Workers")},baseUrl:p.buildModuleUrl.getCesiumBaseUrl().url},workerModule:e._workerPath};return t.postMessage(r),t.onmessage=function(t){oe(e,t.data)},t}function me(e,t){const r=new s.URI(e);this._workerPath=0!==r.scheme().length&&0===r.fragment().length?e:me._workerModulePrefix+e,this._maximumActiveTasks=a.defaultValue(t,Number.POSITIVE_INFINITY),this._activeTasks=0,this._deferreds={},this._nextID=0}const ce=[];function fe(){}let pe;function de(e){let t;if(e instanceof ArrayBuffer||ArrayBuffer.isView(e))t=f.when.resolve(e);else{t=s.Resource.createIfNeeded(e).fetchArrayBuffer()}return t.then((function(e){return fe.transcode(e,pe)}))}me.prototype.scheduleTask=function(e,t){if(a.defined(this._worker)||(this._worker=ue(this)),this._activeTasks>=this._maximumActiveTasks)return;++this._activeTasks;const r=this;return f.when(ne(),(function(n){a.defined(t)?n||(t.length=0):t=ce;const i=r._nextID++,o=f.when.defer();return r._deferreds[i]=o,r._worker.postMessage({id:i,parameters:e,canTransferArrayBuffer:n},t),o.promise}))},me.prototype.initWebAssemblyModule=function(e){a.defined(this._worker)||(this._worker=ue(this));const t=f.when.defer(),r=this,n=this._worker;return function(e,t){const r={modulePath:void 0,wasmBinaryFile:void 0,wasmBinary:void 0};if(!p.FeatureDetection.supportsWebAssembly()){if(!a.defined(t.fallbackModulePath))throw new d.RuntimeError(`This browser does not support Web Assembly, and no backup module was provided for ${e._workerPath}`);return r.modulePath=p.buildModuleUrl(t.fallbackModulePath),f.when.resolve(r)}return r.modulePath=p.buildModuleUrl(t.modulePath),r.wasmBinaryFile=p.buildModuleUrl(t.wasmBinaryFile),s.Resource.fetchArrayBuffer({url:r.wasmBinaryFile}).then((function(e){return r.wasmBinary=e,r}))}(this,e).then((function(e){return f.when(ne(),(function(i){let o;const l=e.wasmBinary;a.defined(l)&&i&&(o=[l]),n.onmessage=function(e){n.onmessage=function(e){oe(r,e.data)},t.resolve(e.data)},n.postMessage({webAssemblyConfig:e},o)}))})),t},me.prototype.isDestroyed=function(){return!1},me.prototype.destroy=function(){return a.defined(this._worker)&&this._worker.terminate(),ae(this)},me.taskCompletedEvent=ie,me._defaultWorkerModulePrefix="Workers/",me._workerModulePrefix=me._defaultWorkerModulePrefix,me._canTransferArrayBuffer=void 0,fe._transcodeTaskProcessor=new me("transcodeKTX2",Number.POSITIVE_INFINITY),fe._readyPromise=void 0,fe.transcode=function(e,t){return a.defined(fe._readyPromise)||function(){const e=fe._transcodeTaskProcessor.initWebAssemblyModule({modulePath:"ThirdParty/Workers/basis_transcoder.js",wasmBinaryFile:"ThirdParty/basis_transcoder.wasm"}).then((function(){return fe._transcodeTaskProcessor}));fe._readyPromise=e}(),fe._readyPromise.then((function(a){let r;if(e instanceof ArrayBuffer){const n=new Uint8Array(e);return r={supportedTargetFormats:t,ktx2Buffer:n},a.scheduleTask(r,[e])}return r={supportedTargetFormats:t,ktx2Buffer:e},a.scheduleTask(r,[e.buffer])})).then((function(e){const t=e.length,a=Object.keys(e[0]),r=a.length;let n;for(n=0;n0;for(var i in t)if(t.hasOwnProperty(i))if("diffuse"===i||"emission"===i){var o=n&&Ne(t[i],e)?t[i]:"czm_gammaCorrect("+t[i]+")";e.shaderSource+="material."+i+" = "+o+"; \n"}else e.shaderSource+="alpha"===i?"material.alpha = "+t.alpha+"; \n":"material."+i+" = "+t[i]+";\n"}e.shaderSource+="return material;\n}\n"}})(t),function(e){var t=e._template.uniforms;for(var a in t)t.hasOwnProperty(a)&&Fe(e,a)}(t),function(e){var t=e._strict,a=e._template.materials;for(var r in a)if(a.hasOwnProperty(r)){var n=new Se({strict:t,fabric:a[r],count:e._count});e._count=n._count,e._uniforms=u.combine(e._uniforms,n._uniforms,!0),e.materials[r]=n,e._translucentFunctions=e._translucentFunctions.concat(n._translucentFunctions);var i="czm_getMaterial",o=i+"_"+e._count++;Be(n,i,o),e.shaderSource=n.shaderSource+e.shaderSource,Be(e,r,o+"(materialInput)")}}(t);var o=0===t._translucentFunctions.length||void 0;if(r=a.defaultValue(r,o),r=a.defaultValue(e.translucent,r),a.defined(r))if("function"==typeof r){var l=function(){return r(t)};t._translucentFunctions.push(l)}else t._translucentFunctions.push(r)}(e,this),Object.defineProperties(this,{type:{value:this.type,writable:!1}}),a.defined(Se._uniformList[this.type])||(Se._uniformList[this.type]=Object.keys(this._uniforms))}function Me(e,t,r,n){if(a.defined(e))for(var i in e)if(e.hasOwnProperty(i)){var o=-1!==t.indexOf(i);(n&&!o||!n&&o)&&r(i,t)}}function Le(e,t){}function De(e,t){}Se._uniformList={},Se.fromType=function(e,t){var r=new Se({fabric:{type:e}});if(a.defined(t))for(var n in t)t.hasOwnProperty(n)&&(r.uniforms[n]=t[n]);return r},Se.prototype.isTranslucent=function(){if(a.defined(this.translucent))return"function"==typeof this.translucent?this.translucent():this.translucent;for(var e=!0,t=this._translucentFunctions,r=t.length,n=0;n-1)return!0;return!1}var Oe={mat2:_.Matrix2,mat3:h.Matrix3,mat4:h.Matrix4},ze=/\.ktx2$/i;function Fe(e,t){e._strict;var r=e._template.uniforms,n=r[t],i=function(e){var t=e.type;if(!a.defined(t)){var r=typeof e;if("number"===r)t="float";else if("boolean"===r)t="bool";else if("string"===r||e instanceof s.Resource||e instanceof HTMLCanvasElement||e instanceof HTMLImageElement)t=/^([rgba]){1,4}$/i.test(e)?"channels":e===Se.DefaultCubeMapId?"samplerCube":"sampler2D";else if("object"===r)if(Array.isArray(e))4!==e.length&&9!==e.length&&16!==e.length||(t="mat"+Math.sqrt(e.length));else{var n=0;for(var i in e)e.hasOwnProperty(i)&&(n+=1);n>=2&&n<=4?t="vec"+n:6===n&&(t="samplerCube")}}return t}(n);if("channels"===i)Be(e,t,n,!1);else{if("sampler2D"===i){var o=t+"Dimensions";(function(e,t,a){return Be(e,t,t,a)})(e,o)>0&&(r[o]={type:"ivec3",x:1,y:1},Fe(e,o))}if(!new RegExp("uniform\\s+"+i+"\\s+"+t+"\\s*;").test(e.shaderSource)){var l="uniform "+i+" "+t+";";e.shaderSource=l+e.shaderSource}var u=t+"_"+e._count++;if(Be(e,t,u),e.uniforms[t]=n,"sampler2D"===i)e._uniforms[u]=function(){return e._textures[t]},e._updateFunctions.push(function(e){var t;return function(r,n){var i=r.uniforms,o=i[e],l=t!==o,u=!a.defined(o)||o===Se.DefaultImageId;t=o;var m,c,f=r._textures[e];if(o instanceof HTMLVideoElement)if(o.readyState>=2){if(l&&a.defined(f)&&(f!==n.defaultTexture&&f.destroy(),f=void 0),!a.defined(f)||f===n.defaultTexture){var p=new Ae({minificationFilter:r._minificationFilter,magnificationFilter:r._magnificationFilter});return f=new Ie({context:n,source:o,sampler:p}),void(r._textures[e]=f)}f.copyFrom({source:o})}else a.defined(f)||(r._textures[e]=n.defaultTexture);else{if(o instanceof Ie&&o!==f){r._texturePaths[e]=void 0;var d=r._textures[e];return a.defined(d)&&d!==r._defaultTexture&&d.destroy(),r._textures[e]=o,m=e+"Dimensions",void(i.hasOwnProperty(m)&&((c=i[m]).x=o._width,c.y=o._height))}if(l&&a.defined(f)&&u&&(f!==r._defaultTexture&&f.destroy(),f=void 0),a.defined(f)||(r._texturePaths[e]=void 0,f=r._textures[e]=r._defaultTexture,m=e+"Dimensions",i.hasOwnProperty(m)&&((c=i[m]).x=f._width,c.y=f._height)),!u){var _=o instanceof s.Resource;if(!a.defined(r._texturePaths[e])||_&&o.url!==r._texturePaths[e].url||!_&&o!==r._texturePaths[e]){if("string"==typeof o||_){var h=_?o:s.Resource.createIfNeeded(o);(ze.test(h.url)?de(h.url):h.fetchImage()).then((function(t){r._loadedImages.push({id:e,image:t})})).otherwise((function(){a.defined(f)&&f!==r._defaultTexture&&f.destroy(),r._textures[e]=r._defaultTexture}))}else(o instanceof HTMLCanvasElement||o instanceof HTMLImageElement)&&r._loadedImages.push({id:e,image:o});r._texturePaths[e]=o}}}}}(t));else if("samplerCube"===i)e._uniforms[u]=function(){return e._textures[t]},e._updateFunctions.push(function(e){return function(t,r){var n=t.uniforms[e];if(n instanceof Pe){var i=t._textures[e];return i!==t._defaultTexture&&i.destroy(),t._texturePaths[e]=void 0,void(t._textures[e]=n)}if(a.defined(t._textures[e])||(t._texturePaths[e]=void 0,t._textures[e]=r.defaultCubeMap),n!==Se.DefaultCubeMapId){var o=n.positiveX+n.negativeX+n.positiveY+n.negativeY+n.positiveZ+n.negativeZ;if(o!==t._texturePaths[e]){var l=[s.Resource.createIfNeeded(n.positiveX).fetchImage(),s.Resource.createIfNeeded(n.negativeX).fetchImage(),s.Resource.createIfNeeded(n.positiveY).fetchImage(),s.Resource.createIfNeeded(n.negativeY).fetchImage(),s.Resource.createIfNeeded(n.positiveZ).fetchImage(),s.Resource.createIfNeeded(n.negativeZ).fetchImage()];f.when.all(l).then((function(a){t._loadedCubeMaps.push({id:e,images:a})})),t._texturePaths[e]=o}}}}(t));else if(-1!==i.indexOf("mat")){var m=new Oe[i];e._uniforms[u]=function(){return Oe[i].fromColumnMajorArray(e.uniforms[t],m)}}else e._uniforms[u]=function(){return e.uniforms[t]}}}function Be(e,t,r,n){n=a.defaultValue(n,!0);var i=0,o=new RegExp("([\\w"+(n?".":"")+"])?"+t+"([\\w])?","g");return e.shaderSource=e.shaderSource.replace(o,(function(e,t,a){return t||a?e:(i+=1,r)})),i}function Ve(e){e=a.defaultValue(e,a.defaultValue.EMPTY_OBJECT);const t=a.defaultValue(e.translucent,!0),r=a.defaultValue(e.aboveGround,!1);this.material=a.defined(e.material)?e.material:Se.fromType(Se.ColorType),this.translucent=a.defaultValue(e.translucent,!0),this._vertexShaderSource=a.defaultValue(e.vertexShaderSource,"attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute vec2 st;\nattribute float batchId;\nvarying vec3 v_positionMC;\nvarying vec3 v_positionEC;\nvarying vec2 v_st;\nvoid main()\n{\nvec4 p = czm_computePosition();\nv_positionMC = position3DHigh + position3DLow;\nv_positionEC = (czm_modelViewRelativeToEye * p).xyz;\nv_st = st;\ngl_Position = czm_modelViewProjectionRelativeToEye * p;\n}\n"),this._fragmentShaderSource=a.defaultValue(e.fragmentShaderSource,"varying vec3 v_positionMC;\nvarying vec3 v_positionEC;\nvarying vec2 v_st;\nvoid main()\n{\nczm_materialInput materialInput;\nvec3 normalEC = normalize(czm_normal3D * czm_geodeticSurfaceNormal(v_positionMC, vec3(0.0), vec3(1.0)));\n#ifdef FACE_FORWARD\nnormalEC = faceforward(normalEC, vec3(0.0, 0.0, 1.0), -normalEC);\n#endif\nmaterialInput.s = v_st.s;\nmaterialInput.st = v_st;\nmaterialInput.str = vec3(v_st, 0.0);\nmaterialInput.normalEC = normalEC;\nmaterialInput.tangentToEyeMatrix = czm_eastNorthUpToEyeCoordinates(v_positionMC, materialInput.normalEC);\nvec3 positionToEyeEC = -v_positionEC;\nmaterialInput.positionToEyeEC = positionToEyeEC;\nczm_material material = czm_getMaterial(materialInput);\n#ifdef FLAT\ngl_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n#else\ngl_FragColor = czm_phong(normalize(positionToEyeEC), material, czm_lightDirectionEC);\n#endif\n}\n"),this._renderState=Q.getDefaultRenderState(t,!r,e.renderState),this._closed=!1,this._flat=a.defaultValue(e.flat,!1),this._faceForward=a.defaultValue(e.faceForward,r),this._aboveGround=r}Se._materialCache={_materials:{},addMaterial:function(e,t){this._materials[e]=t},getMaterial:function(e){return this._materials[e]}},Se.DefaultImageId="czm_defaultImage",Se.DefaultCubeMapId="czm_defaultCubeMap",Se.ColorType="Color",Se._materialCache.addMaterial(Se.ColorType,{fabric:{type:Se.ColorType,uniforms:{color:new e.Color(1,0,0,.5)},components:{diffuse:"color.rgb",alpha:"color.a"}},translucent:function(e){return e.uniforms.color.alpha<1}}),Se.ImageType="Image",Se._materialCache.addMaterial(Se.ImageType,{fabric:{type:Se.ImageType,uniforms:{image:Se.DefaultImageId,repeat:new c.Cartesian2(1,1),color:new e.Color(1,1,1,1)},components:{diffuse:"texture2D(image, fract(repeat * materialInput.st)).rgb * color.rgb",alpha:"texture2D(image, fract(repeat * materialInput.st)).a * color.a"}},translucent:function(e){return e.uniforms.color.alpha<1}}),Se.DiffuseMapType="DiffuseMap",Se._materialCache.addMaterial(Se.DiffuseMapType,{fabric:{type:Se.DiffuseMapType,uniforms:{image:Se.DefaultImageId,channels:"rgb",repeat:new c.Cartesian2(1,1)},components:{diffuse:"texture2D(image, fract(repeat * materialInput.st)).channels"}},translucent:!1}),Se.AlphaMapType="AlphaMap",Se._materialCache.addMaterial(Se.AlphaMapType,{fabric:{type:Se.AlphaMapType,uniforms:{image:Se.DefaultImageId,channel:"a",repeat:new c.Cartesian2(1,1)},components:{alpha:"texture2D(image, fract(repeat * materialInput.st)).channel"}},translucent:!0}),Se.SpecularMapType="SpecularMap",Se._materialCache.addMaterial(Se.SpecularMapType,{fabric:{type:Se.SpecularMapType,uniforms:{image:Se.DefaultImageId,channel:"r",repeat:new c.Cartesian2(1,1)},components:{specular:"texture2D(image, fract(repeat * materialInput.st)).channel"}},translucent:!1}),Se.EmissionMapType="EmissionMap",Se._materialCache.addMaterial(Se.EmissionMapType,{fabric:{type:Se.EmissionMapType,uniforms:{image:Se.DefaultImageId,channels:"rgb",repeat:new c.Cartesian2(1,1)},components:{emission:"texture2D(image, fract(repeat * materialInput.st)).channels"}},translucent:!1}),Se.BumpMapType="BumpMap",Se._materialCache.addMaterial(Se.BumpMapType,{fabric:{type:Se.BumpMapType,uniforms:{image:Se.DefaultImageId,channel:"r",strength:.8,repeat:new c.Cartesian2(1,1)},source:"uniform sampler2D image;\nuniform float strength;\nuniform vec2 repeat;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nvec2 st = materialInput.st;\nvec2 centerPixel = fract(repeat * st);\nfloat centerBump = texture2D(image, centerPixel).channel;\nfloat imageWidth = float(imageDimensions.x);\nvec2 rightPixel = fract(repeat * (st + vec2(1.0 / imageWidth, 0.0)));\nfloat rightBump = texture2D(image, rightPixel).channel;\nfloat imageHeight = float(imageDimensions.y);\nvec2 leftPixel = fract(repeat * (st + vec2(0.0, 1.0 / imageHeight)));\nfloat topBump = texture2D(image, leftPixel).channel;\nvec3 normalTangentSpace = normalize(vec3(centerBump - rightBump, centerBump - topBump, clamp(1.0 - strength, 0.1, 1.0)));\nvec3 normalEC = materialInput.tangentToEyeMatrix * normalTangentSpace;\nmaterial.normal = normalEC;\nmaterial.diffuse = vec3(0.01);\nreturn material;\n}\n"},translucent:!1}),Se.NormalMapType="NormalMap",Se._materialCache.addMaterial(Se.NormalMapType,{fabric:{type:Se.NormalMapType,uniforms:{image:Se.DefaultImageId,channels:"rgb",strength:.8,repeat:new c.Cartesian2(1,1)},source:"uniform sampler2D image;\nuniform float strength;\nuniform vec2 repeat;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nvec4 textureValue = texture2D(image, fract(repeat * materialInput.st));\nvec3 normalTangentSpace = textureValue.channels;\nnormalTangentSpace.xy = normalTangentSpace.xy * 2.0 - 1.0;\nnormalTangentSpace.z = clamp(1.0 - strength, 0.1, 1.0);\nnormalTangentSpace = normalize(normalTangentSpace);\nvec3 normalEC = materialInput.tangentToEyeMatrix * normalTangentSpace;\nmaterial.normal = normalEC;\nreturn material;\n}\n"},translucent:!1}),Se.GridType="Grid",Se._materialCache.addMaterial(Se.GridType,{fabric:{type:Se.GridType,uniforms:{color:new e.Color(0,1,0,1),cellAlpha:.1,lineCount:new c.Cartesian2(8,8),lineThickness:new c.Cartesian2(1,1),lineOffset:new c.Cartesian2(0,0)},source:"#ifdef GL_OES_standard_derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\nuniform vec4 color;\nuniform float cellAlpha;\nuniform vec2 lineCount;\nuniform vec2 lineThickness;\nuniform vec2 lineOffset;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nvec2 st = materialInput.st;\nfloat scaledWidth = fract(lineCount.s * st.s - lineOffset.s);\nscaledWidth = abs(scaledWidth - floor(scaledWidth + 0.5));\nfloat scaledHeight = fract(lineCount.t * st.t - lineOffset.t);\nscaledHeight = abs(scaledHeight - floor(scaledHeight + 0.5));\nfloat value;\n#ifdef GL_OES_standard_derivatives\nconst float fuzz = 1.2;\nvec2 thickness = (lineThickness * czm_pixelRatio) - 1.0;\nvec2 dx = abs(dFdx(st));\nvec2 dy = abs(dFdy(st));\nvec2 dF = vec2(max(dx.s, dy.s), max(dx.t, dy.t)) * lineCount;\nvalue = min(\nsmoothstep(dF.s * thickness.s, dF.s * (fuzz + thickness.s), scaledWidth),\nsmoothstep(dF.t * thickness.t, dF.t * (fuzz + thickness.t), scaledHeight));\n#else\nconst float fuzz = 0.05;\nvec2 range = 0.5 - (lineThickness * 0.05);\nvalue = min(\n1.0 - smoothstep(range.s, range.s + fuzz, scaledWidth),\n1.0 - smoothstep(range.t, range.t + fuzz, scaledHeight));\n#endif\nfloat dRim = 1.0 - abs(dot(materialInput.normalEC, normalize(materialInput.positionToEyeEC)));\nfloat sRim = smoothstep(0.8, 1.0, dRim);\nvalue *= (1.0 - sRim);\nvec4 halfColor;\nhalfColor.rgb = color.rgb * 0.5;\nhalfColor.a = color.a * (1.0 - ((1.0 - cellAlpha) * value));\nhalfColor = czm_gammaCorrect(halfColor);\nmaterial.diffuse = halfColor.rgb;\nmaterial.emission = halfColor.rgb;\nmaterial.alpha = halfColor.a;\nreturn material;\n}\n"},translucent:function(e){var t=e.uniforms;return t.color.alpha<1||t.cellAlpha<1}}),Se.StripeType="Stripe",Se._materialCache.addMaterial(Se.StripeType,{fabric:{type:Se.StripeType,uniforms:{horizontal:!0,evenColor:new e.Color(1,1,1,.5),oddColor:new e.Color(0,0,1,.5),offset:0,repeat:5},source:"uniform vec4 evenColor;\nuniform vec4 oddColor;\nuniform float offset;\nuniform float repeat;\nuniform bool horizontal;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nfloat coord = mix(materialInput.st.s, materialInput.st.t, float(horizontal));\nfloat value = fract((coord - offset) * (repeat * 0.5));\nfloat dist = min(value, min(abs(value - 0.5), 1.0 - value));\nvec4 currentColor = mix(evenColor, oddColor, step(0.5, value));\nvec4 color = czm_antialias(evenColor, oddColor, currentColor, dist);\ncolor = czm_gammaCorrect(color);\nmaterial.diffuse = color.rgb;\nmaterial.alpha = color.a;\nreturn material;\n}\n"},translucent:function(e){var t=e.uniforms;return t.evenColor.alpha<1||t.oddColor.alpha<1}}),Se.CheckerboardType="Checkerboard",Se._materialCache.addMaterial(Se.CheckerboardType,{fabric:{type:Se.CheckerboardType,uniforms:{lightColor:new e.Color(1,1,1,.5),darkColor:new e.Color(0,0,0,.5),repeat:new c.Cartesian2(5,5)},source:"uniform vec4 lightColor;\nuniform vec4 darkColor;\nuniform vec2 repeat;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nvec2 st = materialInput.st;\nfloat b = mod(floor(repeat.s * st.s) + floor(repeat.t * st.t), 2.0);\nfloat scaledWidth = fract(repeat.s * st.s);\nscaledWidth = abs(scaledWidth - floor(scaledWidth + 0.5));\nfloat scaledHeight = fract(repeat.t * st.t);\nscaledHeight = abs(scaledHeight - floor(scaledHeight + 0.5));\nfloat value = min(scaledWidth, scaledHeight);\nvec4 currentColor = mix(lightColor, darkColor, b);\nvec4 color = czm_antialias(lightColor, darkColor, currentColor, value, 0.03);\ncolor = czm_gammaCorrect(color);\nmaterial.diffuse = color.rgb;\nmaterial.alpha = color.a;\nreturn material;\n}\n"},translucent:function(e){var t=e.uniforms;return t.lightColor.alpha<1||t.darkColor.alpha<1}}),Se.DotType="Dot",Se._materialCache.addMaterial(Se.DotType,{fabric:{type:Se.DotType,uniforms:{lightColor:new e.Color(1,1,0,.75),darkColor:new e.Color(0,1,1,.75),repeat:new c.Cartesian2(5,5)},source:"uniform vec4 lightColor;\nuniform vec4 darkColor;\nuniform vec2 repeat;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nfloat b = smoothstep(0.3, 0.32, length(fract(repeat * materialInput.st) - 0.5));\nvec4 color = mix(lightColor, darkColor, b);\ncolor = czm_gammaCorrect(color);\nmaterial.diffuse = color.rgb;\nmaterial.alpha = color.a;\nreturn material;\n}\n"},translucent:function(e){var t=e.uniforms;return t.lightColor.alpha<1||t.darkColor.alpha<1}}),Se.WaterType="Water",Se._materialCache.addMaterial(Se.WaterType,{fabric:{type:Se.WaterType,uniforms:{baseWaterColor:new e.Color(.2,.3,.6,1),blendColor:new e.Color(0,1,.699,1),specularMap:Se.DefaultImageId,normalMap:Se.DefaultImageId,frequency:10,animationSpeed:.01,amplitude:1,specularIntensity:.5,fadeFactor:1},source:"uniform sampler2D specularMap;\nuniform sampler2D normalMap;\nuniform vec4 baseWaterColor;\nuniform vec4 blendColor;\nuniform float frequency;\nuniform float animationSpeed;\nuniform float amplitude;\nuniform float specularIntensity;\nuniform float fadeFactor;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nfloat time = czm_frameNumber * animationSpeed;\nfloat fade = max(1.0, (length(materialInput.positionToEyeEC) / 10000000000.0) * frequency * fadeFactor);\nfloat specularMapValue = texture2D(specularMap, materialInput.st).r;\nvec4 noise = czm_getWaterNoise(normalMap, materialInput.st * frequency, time, 0.0);\nvec3 normalTangentSpace = noise.xyz * vec3(1.0, 1.0, (1.0 / amplitude));\nnormalTangentSpace.xy /= fade;\nnormalTangentSpace = mix(vec3(0.0, 0.0, 50.0), normalTangentSpace, specularMapValue);\nnormalTangentSpace = normalize(normalTangentSpace);\nfloat tsPerturbationRatio = clamp(dot(normalTangentSpace, vec3(0.0, 0.0, 1.0)), 0.0, 1.0);\nmaterial.alpha = mix(blendColor.a, baseWaterColor.a, specularMapValue) * specularMapValue;\nmaterial.diffuse = mix(blendColor.rgb, baseWaterColor.rgb, specularMapValue);\nmaterial.diffuse += (0.1 * tsPerturbationRatio);\nmaterial.diffuse = material.diffuse;\nmaterial.normal = normalize(materialInput.tangentToEyeMatrix * normalTangentSpace);\nmaterial.specular = specularIntensity;\nmaterial.shininess = 10.0;\nreturn material;\n}\n"},translucent:function(e){var t=e.uniforms;return t.baseWaterColor.alpha<1||t.blendColor.alpha<1}}),Se.YanMoType="YanMo",Se._materialCache.addMaterial(Se.YanMoType,{fabric:{type:Se.YanMoType,source:"uniform vec4 floodVar;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nmaterial.alpha = (materialInput.height < floodVar.y) ? 0.3 : 0.0;\nfloat rr = (materialInput.height < floodVar.y)?(materialInput.height-floodVar.x)/floodVar.w/2.0:0.0;\nmaterial.diffuse = vec3(1.0-rr,rr,0.0);\nreturn material;\n}\n"},translucent:!1}),Se.WaJueType="WaJue",Se._materialCache.addMaterial(Se.WaJueType,{fabric:{type:Se.WaJueType,source:"czm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nreturn material;\n}\n"},translucent:!1}),Se.RimLightingType="RimLighting",Se._materialCache.addMaterial(Se.RimLightingType,{fabric:{type:Se.RimLightingType,uniforms:{color:new e.Color(1,0,0,.7),rimColor:new e.Color(1,1,1,.4),width:.3},source:"uniform vec4 color;\nuniform vec4 rimColor;\nuniform float width;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nfloat d = 1.0 - dot(materialInput.normalEC, normalize(materialInput.positionToEyeEC));\nfloat s = smoothstep(1.0 - width, 1.0, d);\nvec4 outColor = czm_gammaCorrect(color);\nvec4 outRimColor = czm_gammaCorrect(rimColor);\nmaterial.diffuse = outColor.rgb;\nmaterial.emission = outRimColor.rgb * s;\nmaterial.alpha = mix(outColor.a, outRimColor.a, s);\nreturn material;\n}\n"},translucent:function(e){var t=e.uniforms;return t.color.alpha<1||t.rimColor.alpha<1}}),Se.FadeType="Fade",Se._materialCache.addMaterial(Se.FadeType,{fabric:{type:Se.FadeType,uniforms:{fadeInColor:new e.Color(1,0,0,1),fadeOutColor:new e.Color(0,0,0,0),maximumDistance:.5,repeat:!0,fadeDirection:{x:!0,y:!0},time:new c.Cartesian2(.5,.5)},source:"uniform vec4 fadeInColor;\nuniform vec4 fadeOutColor;\nuniform float maximumDistance;\nuniform bool repeat;\nuniform vec2 fadeDirection;\nuniform vec2 time;\nfloat getTime(float t, float coord)\n{\nfloat scalar = 1.0 / maximumDistance;\nfloat q = distance(t, coord) * scalar;\nif (repeat)\n{\nfloat r = distance(t, coord + 1.0) * scalar;\nfloat s = distance(t, coord - 1.0) * scalar;\nq = min(min(r, s), q);\n}\nreturn clamp(q, 0.0, 1.0);\n}\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nvec2 st = materialInput.st;\nfloat s = getTime(time.x, st.s) * fadeDirection.s;\nfloat t = getTime(time.y, st.t) * fadeDirection.t;\nfloat u = length(vec2(s, t));\nvec4 color = mix(fadeInColor, fadeOutColor, u);\ncolor = czm_gammaCorrect(color);\nmaterial.emission = color.rgb;\nmaterial.alpha = color.a;\nreturn material;\n}\n"},translucent:function(e){var t=e.uniforms;return t.fadeInColor.alpha<1||t.fadeOutColor.alpha<1}}),Se.PolylineArrowType="PolylineArrow",Se._materialCache.addMaterial(Se.PolylineArrowType,{fabric:{type:Se.PolylineArrowType,uniforms:{color:new e.Color(1,1,1,1)},source:"#ifdef GL_OES_standard_derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\nuniform vec4 color;\nfloat getPointOnLine(vec2 p0, vec2 p1, float x)\n{\nfloat slope = (p0.y - p1.y) / (p0.x - p1.x);\nreturn slope * (x - p0.x) + p0.y;\n}\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nvec2 st = materialInput.st;\n#ifdef GL_OES_standard_derivatives\nfloat base = 1.0 - abs(fwidth(st.s)) * 10.0 * czm_pixelRatio;\n#else\nfloat base = 0.975;\n#endif\nvec2 center = vec2(1.0, 0.5);\nfloat ptOnUpperLine = getPointOnLine(vec2(base, 1.0), center, st.s);\nfloat ptOnLowerLine = getPointOnLine(vec2(base, 0.0), center, st.s);\nfloat halfWidth = 0.15;\nfloat s = step(0.5 - halfWidth, st.t);\ns *= 1.0 - step(0.5 + halfWidth, st.t);\ns *= 1.0 - step(base, st.s);\nfloat t = step(base, materialInput.st.s);\nt *= 1.0 - step(ptOnUpperLine, st.t);\nt *= step(ptOnLowerLine, st.t);\nfloat dist;\nif (st.s < base)\n{\nfloat d1 = abs(st.t - (0.5 - halfWidth));\nfloat d2 = abs(st.t - (0.5 + halfWidth));\ndist = min(d1, d2);\n}\nelse\n{\nfloat d1 = czm_infinity;\nif (st.t < 0.5 - halfWidth && st.t > 0.5 + halfWidth)\n{\nd1 = abs(st.s - base);\n}\nfloat d2 = abs(st.t - ptOnUpperLine);\nfloat d3 = abs(st.t - ptOnLowerLine);\ndist = min(min(d1, d2), d3);\n}\nvec4 outsideColor = vec4(0.0);\nvec4 currentColor = mix(outsideColor, color, clamp(s + t, 0.0, 1.0));\nvec4 outColor = czm_antialias(outsideColor, color, currentColor, dist);\noutColor = czm_gammaCorrect(outColor);\nmaterial.diffuse = outColor.rgb;\nmaterial.alpha = outColor.a;\nreturn material;\n}\n"},translucent:!0}),Se.PolylineDashType="PolylineDash",Se._materialCache.addMaterial(Se.PolylineDashType,{fabric:{type:Se.PolylineDashType,uniforms:{color:new e.Color(1,0,1,1),gapColor:new e.Color(0,0,0,0),dashLength:16,dashPattern:255},source:"uniform vec4 color;\nuniform vec4 gapColor;\nuniform float dashLength;\nuniform float dashPattern;\nvarying float v_polylineAngle;\nconst float maskLength = 16.0;\nmat2 rotate(float rad) {\nfloat c = cos(rad);\nfloat s = sin(rad);\nreturn mat2(\nc, s,\n-s, c\n);\n}\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nvec2 pos = rotate(v_polylineAngle) * gl_FragCoord.xy;\nfloat dashPosition = fract(pos.x / (dashLength * czm_pixelRatio));\nfloat maskIndex = floor(dashPosition * maskLength);\nfloat maskTest = floor(dashPattern / pow(2.0, maskIndex));\nvec4 fragColor = (mod(maskTest, 2.0) < 1.0) ? gapColor : color;\nif (fragColor.a < 0.005) {\ndiscard;\n}\nfragColor = czm_gammaCorrect(fragColor);\nmaterial.emission = fragColor.rgb;\nmaterial.alpha = fragColor.a;\nreturn material;\n}\n"},translucent:!0}),Se.PolylineGlowType="PolylineGlow",Se._materialCache.addMaterial(Se.PolylineGlowType,{fabric:{type:Se.PolylineGlowType,uniforms:{color:new e.Color(0,.5,1,1),glowPower:.25,taperPower:1},source:"uniform vec4 color;\nuniform float glowPower;\nuniform float taperPower;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nvec2 st = materialInput.st;\nfloat glow = glowPower / abs(st.t - 0.5) - (glowPower / 0.5);\nif (taperPower <= 0.99999) {\nglow *= min(1.0, taperPower / (0.5 - st.s * 0.5) - (taperPower / 0.5));\n}\nvec4 fragColor;\nfragColor.rgb = max(vec3(glow - 1.0 + color.rgb), color.rgb);\nfragColor.a = clamp(0.0, 1.0, glow) * color.a;\nfragColor = czm_gammaCorrect(fragColor);\nmaterial.emission = fragColor.rgb;\nmaterial.alpha = fragColor.a;\nreturn material;\n}\n"},translucent:!0}),Se.PolylineOutlineType="PolylineOutline",Se._materialCache.addMaterial(Se.PolylineOutlineType,{fabric:{type:Se.PolylineOutlineType,uniforms:{color:new e.Color(1,1,1,1),outlineColor:new e.Color(1,0,0,1),outlineWidth:1},source:"uniform vec4 color;\nuniform vec4 outlineColor;\nuniform float outlineWidth;\nvarying float v_width;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nvec2 st = materialInput.st;\nfloat halfInteriorWidth = 0.5 * (v_width - outlineWidth) / v_width;\nfloat b = step(0.5 - halfInteriorWidth, st.t);\nb *= 1.0 - step(0.5 + halfInteriorWidth, st.t);\nfloat d1 = abs(st.t - (0.5 - halfInteriorWidth));\nfloat d2 = abs(st.t - (0.5 + halfInteriorWidth));\nfloat dist = min(d1, d2);\nvec4 currentColor = mix(outlineColor, color, b);\nvec4 outColor = czm_antialias(outlineColor, color, currentColor, dist);\noutColor = czm_gammaCorrect(outColor);\nmaterial.diffuse = outColor.rgb;\nmaterial.alpha = outColor.a;\nreturn material;\n}\n"},translucent:function(e){var t=e.uniforms;return t.color.alpha<1||t.outlineColor.alpha<1}}),Se.ElevationContourType="ElevationContour",Se._materialCache.addMaterial(Se.ElevationContourType,{fabric:{type:Se.ElevationContourType,uniforms:{spacing:100,color:new e.Color(1,0,0,1),width:1},source:"#ifdef GL_OES_standard_derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\nuniform vec4 color;\nuniform float spacing;\nuniform float width;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nfloat distanceToContour = mod(materialInput.height, spacing);\n#ifdef GL_OES_standard_derivatives\nfloat dxc = abs(dFdx(materialInput.height));\nfloat dyc = abs(dFdy(materialInput.height));\nfloat dF = max(dxc, dyc) * czm_pixelRatio * width;\nfloat alpha = (distanceToContour < dF) ? 1.0 : 0.0;\n#else\nfloat alpha = (distanceToContour < (czm_pixelRatio * width)) ? 1.0 : 0.0;\n#endif\nvec4 outColor = czm_gammaCorrect(vec4(color.rgb, alpha * color.a));\nmaterial.diffuse = outColor.rgb;\nmaterial.alpha = outColor.a;\nreturn material;\n}\n"},translucent:!1}),Se.ElevationRampType="ElevationRamp",Se._materialCache.addMaterial(Se.ElevationRampType,{fabric:{type:Se.ElevationRampType,uniforms:{image:Se.DefaultImageId,minimumHeight:0,maximumHeight:1e4},source:"uniform sampler2D image;\nuniform float minimumHeight;\nuniform float maximumHeight;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nfloat scaledHeight = clamp((materialInput.height - minimumHeight) / (maximumHeight - minimumHeight), 0.0, 1.0);\nvec4 rampColor = texture2D(image, vec2(scaledHeight, 0.5));\nrampColor = czm_gammaCorrect(rampColor);\nmaterial.diffuse = rampColor.rgb;\nmaterial.alpha = rampColor.a;\nreturn material;\n}\n"},translucent:!1}),Se.SlopeRampMaterialType="SlopeRamp",Se._materialCache.addMaterial(Se.SlopeRampMaterialType,{fabric:{type:Se.SlopeRampMaterialType,uniforms:{image:Se.DefaultImageId},source:"uniform sampler2D image;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nvec4 rampColor = texture2D(image, vec2(materialInput.slope / (czm_pi / 2.0), 0.5));\nrampColor = czm_gammaCorrect(rampColor);\nmaterial.diffuse = rampColor.rgb;\nmaterial.alpha = rampColor.a;\nreturn material;\n}\n"},translucent:!1}),Se.AspectRampMaterialType="AspectRamp",Se._materialCache.addMaterial(Se.AspectRampMaterialType,{fabric:{type:Se.AspectRampMaterialType,uniforms:{image:Se.DefaultImageId},source:"uniform sampler2D image;\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nvec4 rampColor = texture2D(image, vec2(materialInput.aspect / (2.0 * czm_pi), 0.5));\nrampColor = czm_gammaCorrect(rampColor);\nmaterial.diffuse = rampColor.rgb;\nmaterial.alpha = rampColor.a;\nreturn material;\n}\n"},translucent:!1}),Se.ElevationBandType="ElevationBand",Se._materialCache.addMaterial(Se.ElevationBandType,{fabric:{type:Se.ElevationBandType,uniforms:{heights:Se.DefaultImageId,colors:Se.DefaultImageId},source:"uniform sampler2D heights;\nuniform sampler2D colors;\nfloat getHeight(int idx, float invTexSize)\n{\nvec2 uv = vec2((float(idx) + 0.5) * invTexSize, 0.5);\n#ifdef OES_texture_float\nreturn texture2D(heights, uv).x;\n#else\nreturn czm_unpackFloat(texture2D(heights, uv));\n#endif\n}\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\nczm_material material = czm_getDefaultMaterial(materialInput);\nfloat height = materialInput.height;\nfloat invTexSize = 1.0 / float(heightsDimensions.x);\nfloat minHeight = getHeight(0, invTexSize);\nfloat maxHeight = getHeight(heightsDimensions.x - 1, invTexSize);\nif (height < minHeight || height > maxHeight) {\nmaterial.diffuse = vec3(0.0);\nmaterial.alpha = 0.0;\nreturn material;\n}\nint idxBelow = 0;\nint idxAbove = heightsDimensions.x;\nfloat heightBelow = minHeight;\nfloat heightAbove = maxHeight;\nconst int maxIterations = 16;\nfor (int i = 0; i < maxIterations; i++) {\nif (idxBelow >= idxAbove - 1) {\nbreak;\n}\nint idxMid = (idxBelow + idxAbove) / 2;\nfloat heightTex = getHeight(idxMid, invTexSize);\nif (height > heightTex) {\nidxBelow = idxMid;\nheightBelow = heightTex;\n} else {\nidxAbove = idxMid;\nheightAbove = heightTex;\n}\n}\nfloat lerper = heightBelow == heightAbove ? 1.0 : (height - heightBelow) / (heightAbove - heightBelow);\nvec2 colorUv = vec2(invTexSize * (float(idxBelow) + 0.5 + lerper), 0.5);\nvec4 color = texture2D(colors, colorUv);\nif (color.a > 0.0)\n{\ncolor.rgb /= color.a;\n}\ncolor.rgb = czm_gammaCorrect(color.rgb);\nmaterial.diffuse = color.rgb;\nmaterial.alpha = color.a;\nreturn material;\n}\n"},translucent:!0}),Object.defineProperties(Ve.prototype,{vertexShaderSource:{get:function(){return this._vertexShaderSource}},fragmentShaderSource:{get:function(){return this._fragmentShaderSource}},renderState:{get:function(){return this._renderState}},closed:{get:function(){return this._closed}},vertexFormat:{get:function(){return Ve.VERTEX_FORMAT}},flat:{get:function(){return this._flat}},faceForward:{get:function(){return this._faceForward}},aboveGround:{get:function(){return this._aboveGround}}}),Ve.VERTEX_FORMAT=l.VertexFormat.POSITION_AND_ST,Ve.prototype.getFragmentShaderSource=Q.prototype.getFragmentShaderSource,Ve.prototype.isTranslucent=Q.prototype.isTranslucent,Ve.prototype.getRenderState=Q.prototype.getRenderState;function Ue(e){e=a.defaultValue(e,a.defaultValue.EMPTY_OBJECT);const t=a.defaultValue(e.translucent,!0),r=a.defaultValue(e.closed,!1),n=a.defaultValue(e.flat,!1),i=n?"attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute vec4 color;\nattribute float batchId;\nvarying vec4 v_color;\nvoid main()\n{\nvec4 p = czm_computePosition();\nv_color = color;\ngl_Position = czm_modelViewProjectionRelativeToEye * p;\n}\n":"attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute vec3 normal;\nattribute vec4 color;\nattribute float batchId;\nvarying vec3 v_positionEC;\nvarying vec3 v_normalEC;\nvarying vec4 v_color;\nvoid main()\n{\nvec4 p = czm_computePosition();\nv_positionEC = (czm_modelViewRelativeToEye * p).xyz;\nv_normalEC = czm_normal * normal;\nv_color = color;\ngl_Position = czm_modelViewProjectionRelativeToEye * p;\n}\n",o=n?"varying vec4 v_color;\nvoid main()\n{\ngl_FragColor = czm_gammaCorrect(v_color);\n}\n":"varying vec3 v_positionEC;\nvarying vec3 v_normalEC;\nvarying vec4 v_color;\nvoid main()\n{\nvec3 positionToEyeEC = -v_positionEC;\nvec3 normalEC = normalize(v_normalEC);\n#ifdef FACE_FORWARD\nnormalEC = faceforward(normalEC, vec3(0.0, 0.0, 1.0), -normalEC);\n#endif\nvec4 color = czm_gammaCorrect(v_color);\nczm_materialInput materialInput;\nmaterialInput.normalEC = normalEC;\nmaterialInput.positionToEyeEC = positionToEyeEC;\nczm_material material = czm_getDefaultMaterial(materialInput);\nmaterial.diffuse = color.rgb;\nmaterial.alpha = color.a;\ngl_FragColor = czm_phong(normalize(positionToEyeEC), material, czm_lightDirectionEC);\n}\n",l=n?Ue.FLAT_VERTEX_FORMAT:Ue.VERTEX_FORMAT;this.material=void 0,this.translucent=t,this._vertexShaderSource=a.defaultValue(e.vertexShaderSource,i),this._fragmentShaderSource=a.defaultValue(e.fragmentShaderSource,o),this._renderState=Q.getDefaultRenderState(t,r,e.renderState),this._closed=r,this._vertexFormat=l,this._flat=n,this._faceForward=a.defaultValue(e.faceForward,!r)}function Ge(e,a,r){if(this._attributes=a,this._numberOfInstances=r,0!==a.length){var n=function(e){for(var a=!1,r=e.length,n=0;n0){let t=e[0];(0,qe[t.type])(e)}}function lt(e){for(let t=0;t-1){it(e[t])}else if(rt.waterLayerId&&rt.waterLayerId.indexOf(t)>-1){lt(e[t])}else{ot(e[t])}}(e),function(e){var t=pt($e,e),a=pt(Qe,e),r=pt(et,e),n=pt(tt,e);let i={};if(t){_t(xt($e,e),t),i.polygon=t}if(a){_t(xt(Qe,e),a),i.water=a}if(r){_t(xt(et,e),r),i.outline=r}if(n){_t(xt(tt,e),n),i.ridingLantern=n}return i}(r)}}));