var webview,dom={},rotInfo={idleTime:3e3,speed:.15,pivot:[],stopWhenZoom:!1};function getQueryVariable(e){for(var t=window.location.search.substring(1).split("&"),i=0;i=this.numKeyframes&&(t-=Math.floor(e/this.numKeyframes)*this.numKeyframes),t>=this.numKeyframes?this.lastValue=i.keyframesSharedBufferFloats[s+(this.numKeyframes-1)]:t<0?this.lastValue=i.keyframesSharedBufferFloats[s]:0==r?this.lastValue=i.keyframesSharedBufferFloats[s+t]:(e=n=i.keyframesSharedBufferFloats[s+t],++t>=this.numKeyframes&&(t-=this.numKeyframes),0<=t&&tbad lerp frame "+t+" of "+this.numKeyframes,this.lastValue=e)}var a=this.numKeyframes;r=i.keyframesSharedBufferUShorts[n+this.frameIndexOffsetUShort];if(e>=i.keyframesSharedBufferUShorts[n+(a-1)*this.indexUShortSkip+this.frameIndexOffsetUShort])return this.lastValue=i.keyframesSharedBufferFloats[s+(a-1)*this.indexFloatSkip+this.valueOffsetFloat];if(ei.keyframesSharedBufferUShorts[n+this.lastSearchIndex*this.indexUShortSkip+this.frameIndexOffsetUShort]&&(this.lastSearchIndex=1);for(var o=this.lastSearchIndex;o=i.keyframesSharedBufferUShorts[d+this.frameIndexOffsetUShort]&&e<=i.keyframesSharedBufferUShorts[l+this.frameIndexOffsetUShort]){this.lastSearchIndex=o;var c=i.keyframesSharedBufferUShorts[d+this.interpolationOffsetUShort];if(2==c){this.lastValue=e=e>=i.keyframesSharedBufferUShorts[l+this.frameIndexOffsetUShort]?i.keyframesSharedBufferFloats[r+this.valueOffsetFloat]:i.keyframesSharedBufferFloats[h+this.valueOffsetFloat];break}if(0==c){s=i.keyframesSharedBufferUShorts[d+this.frameIndexOffsetUShort],t=i.keyframesSharedBufferFloats[h+this.valueOffsetFloat],n=i.keyframesSharedBufferFloats[r+this.valueOffsetFloat],r=(e-s)/(i.keyframesSharedBufferUShorts[l+this.frameIndexOffsetUShort]-s),this.lastValue=e=t*(1-r)+n*r;break}if(1==c||3==c){var u=c=!1,f=0,m=i.keyframesSharedBufferFloats[h+this.valueOffsetFloat],p=i.keyframesSharedBufferFloats[r+this.valueOffsetFloat],g=0,v=0,x=(d=i.keyframesSharedBufferUShorts[d+this.frameIndexOffsetUShort],l=i.keyframesSharedBufferUShorts[l+this.frameIndexOffsetUShort],0),y=1,b=1,S=1,T=1,w=1,C=1,R=1,A=1;0!=this.weighInOffsetFloat&&(b=i.keyframesSharedBufferFloats[h+this.weighInOffsetFloat],S=i.keyframesSharedBufferFloats[r+this.weighInOffsetFloat],C=i.keyframesSharedBufferFloats[h+this.weighOutOffsetFloat],R=i.keyframesSharedBufferFloats[r+this.weighOutOffsetFloat]),1=e.totalFrames+1&&(i=e.totalFrames),i},h.prototype.get=function(e){return this.files[e]},h.prototype.extract=function(e){var t=this.files[e];return delete this.files[e],t},h.prototype.checkSignature=function(e){if(!e)return!1;var t=this.get(e.name+".sig");if(!t)return!1;if(!(t=JSON.parse(String.fromCharCode.apply(null,t.data))))return!1;for(var i=5381,s=0;s>1))+1);u++){d=e[c+1],c=e[c];if((f=1&u?d<<4|c>>4:(15&d)<<8|c)>1|e<<15,e=s}this.trim()},l.prototype.shiftLeft=function(e){if(0=this.digits.length+t?0:this.digits[r-t])<>>i);return n.trim(),n}return new l(this)},l.prototype.bitCount=function(){var e=0;if(0>>=1,++e}return e},l.prototype.sub=function(e){var t=this.digits,i=e.digits,s=this.digits.length;e=e.digits.length;for(var n=0,r=0;r>>=16,a+=h>>>16,++o}return t.trim(),t},l.prototype.mod=function(e){if(this.digits.length<=0||e.digits.length<=0)return new l(0);var t=new l(this.digits);if(!this.lessThan(e)){for(var i=(i=new l(e.digits)).shiftLeft(t.bitCount()-i.bitCount());!t.lessThan(e);)i.lessThan(t)&&t.sub(i),i.shiftRight();t.trim()}return t},l.prototype.powmod=function(e,t){for(var i=new l([1]),s=this.mod(t);e;)1&e&&(i=i.mul(s).mod(t)),e>>>=1,s=s.mul(s).mod(t);return i},l.prototype.trim=function(){for(var e=this.digits.length;0this.touchCountFloor&&(this.touchCountFloor=t),i&&m(e)}.bind(this),this.element.addEventListener("touchstart",e),e=function(e){for(var t=!1,i=0;ie.width&&(this.idealSliderWidth=e.width-(118+(this.totalListBoxPixelsX+14))-this.centerOffset,e=0,this.cameraList&&e++,this.animationList&&e++,1==e&&(this.idealSliderWidth+=56,this.centerOffset-=14),2==e&&(this.idealSliderWidth+=63,this.centerOffset-=63)),this.setupCallbacks()}}function A(e,t,i){if(this.gl=e,this.desc=t,t=[],0!=this.desc.sharpen&&t.push("#define SHARPEN"),(this.useBloom=0=e.limits.fragmentUniforms;)this.bloomSamples/=2;this.bloomShader=e.shaderCache.fromURLs("postvert.glsl","bloom.glsl",["#define BLOOM_SAMPLES "+this.bloomSamples]),this.shrinkShader=e.shaderCache.fromURLs("postvert.glsl","bloomshrink.glsl")}for(e=new Uint8Array(16384),i=0;i<16384;i++){t=255*Math.random();var s=255*Math.random();e[i]=.5*(t+s)}this.noiseTexture=new U(this.gl,{width:128,height:128}),this.noiseTexture.loadArray(e,this.gl.LUMINANCE),this.desc.colorLUT&&(e=this.desc.colorLUT,this.colorLUT=new U(this.gl,{width:e.length/3|0,height:1,clamp:!0}),this.colorLUT.loadArray(new Uint8Array(e),this.gl.RGB)),this.blackTexture=new U(this.gl,{width:1,height:1}),this.blackTexture.loadArray(new Uint8Array([0,0,0,0])),this.bloomResult=this.blackTexture}function k(e){this.gl=e,this.name="untitled",this.meshes=[],this.meshRenderables=[],this.materials={},this.sky=this.view=null,this.selectedPartIndex=0,this.soloPart=!1,this.miscnotes="",this.nextView=null,this.viewFade=0,this.refractionSurface=this.shadow=this.stripData=this.lights=null,this.sceneAnimator=this.frameCounter=0,this.sceneLoaded=!1,this.debugString=""}function P(e,t,i){if(this.scene=e,this.animations=[],this.skinningRigs=[],this.meshIDs=[],this.lightIDs=[],this.materialIDs=[],this.views=[],this.viewYawOffsets=[],this.viewPitchOffsets=[],this.cameraObjectIndices=[],this.cameraChildrenIndices=[],this.subMeshObjectIndices=[],this.subMeshLiveIndices=[],this.scene=e,this.selectedCameraIndex=-1,this.selectedAnimationIndex=0,this.debugString="",this.scenePlaybackSpeed=this.playbackSpeed=1,this.animationProgress=this.totalSeconds=0,this.paused=this.autoAdvanceNextAnimation=!1,this.animateVisibility=this.drawAnimated=this.linkSceneObjects=this.loadSkinningRigs=this.animateMaterials=this.animateTurntables=this.enableSkinning=this.animateMeshes=this.animateLights=this.playAnimations=this.loadAnimations=!0,this.showDebugInfo=!1,this.loopCount=0,this.loopTurntables=this.lockPlayback=!1,this.fogObjectIndex=-1,this.unitScaleSkinnedMeshes=!0,this.sceneScale=i.sceneScale,this.defaultCameraGlobalIndex=i.selectedCamera,this.selectedAnimationIndex=i.selectedAnimation,this.autoPlayAnims=i.autoPlayAnims,this.showPlayControls=i.showPlayControls,i.scenePlaybackSpeed&&(this.scenePlaybackSpeed=i.scenePlaybackSpeed,0==this.scenePlaybackSpeed&&(this.scenePlaybackSpeed=1)),this.autoPlayAnims||(this.paused=!0),this.loadAnimations){if(i.meshIDs)for(var s=i.meshIDs.length,n=0;nNo mattable?"),i.skinningRigs&&this.loadSkinningRigs)for(s=i.skinningRigs.length,n=0;n got light not in scene "+a.name),"FogSO"==a.sceneObjectType&&(this.fogObjectIndex=i),"SubMeshSO"==a.sceneObjectType&&0==n&&(this.subMeshObjectIndices.push(i),this.subMeshLiveIndices.push(-1)),"Material"==a.sceneObjectType&&(a.materialIndex=this.findMaterialIndexByPartIndex(i),-1==a.materialIndex?this.debugString+="
can't find material index for object "+i:t.materialObjects.push(a)),"TurnTableSO"==a.sceneObjectType&&t.turnTableObjects.push(a),"MeshSO"==a.sceneObjectType&&(a.meshIndex=this.findMeshIndexByPartIndex(this.scene.meshes,i),-1==a.meshIndex?(this.debugString+="
can't find mesh index for object "+i,this.logObjectInfo(i,0)):(t.meshObjects.push(a),a.mesh=this.scene.meshes[a.meshIndex],-1!=a.skinningRigIndex&&a.mesh&&a.skinningRigIndexsubmesh parent object has no mesh?",this.debugString+="
obj.name "+l.name,this.debugString+="
parent.name "+d.name,this.debugString+="
submesh index "+i,this.debugString+="
obj.index "+h),d.mesh==a){for(o=0;oMissing submesh? - no matches for mesh "+n+" of "+e)}for(n=0;nMissing mesh? Unused submesh "+n+" of "+r);this.showDebugInfo=this.stopEverything=this.runDebugMode=!1,this.selectDefaultCamera(),this.findCameraChildren(),this.findFixedTransforms(),this.runDebugMode&&(this.setAnimationProgress(0,!0),""!=this.debugString?this.stopEverything=!0:this.checkDebug())}}else this.debugString+="
Skip loading animation data"}function F(e){this.gl=e,this.program=null,this.params={},this.samplers={},this.attribs={}}function O(e){this.gl=e,this.cache=[]}function E(e,t){if(this.gl=e,this.shadowCount=t,this.nativeDepth=!!e.ext.textureDepth,this.desc=i,i=this.nativeDepth?["#define SHADOW_NATIVE_DEPTH"]:[],this.shaderSolid=e.shaderCache.fromURLs("shadowvert.glsl","shadowfrag.glsl",i),i.push("#define ALPHA_TEST 1"),this.shaderAlphaTest=e.shaderCache.fromURLs("shadowvert.glsl","shadowfrag.glsl",i),this.depthTextures=[],this.depthTargets=[],0--------------------------------------Debug Info:",this.debugString+="
this.selectedAnimationIndex :"+this.selectedAnimationIndex;var e=this.animations[this.selectedAnimationIndex],t=e.animatedObjects.length;this.debugString+="
numAnimatedObjects :"+t,""!=e.debugString&&(this.debugString+="
--------------------------------------------------Got animation bug info:",this.debugString+=e.debugString,this.showDebugInfo=this.stopEverything=!0,e.debugString="");for(var i=0;i--------------------------------------------------Got object bug info:",this.debugString+=s.debugString,this.debugString+=s.animatedLocalTransform.debugString,this.showDebugInfo=this.stopEverything=!0,s.debugString="",s.animatedLocalTransform.debugString=""),s.skinningRig&&""!=s.skinningRig.debugString&&(this.debugString+="
--------------------------------------------------Got skin rig info:",this.debugString+=s.skinningRig.debugString,s.skinningRig.debugString="",this.showDebugInfo=this.stopEverything=!0)}this.debugString+="
--------------------------------------Done Debug Info:"},P.prototype.logObjectInfo=function(e,t){var i=t*(o=this.animations[this.selectedAnimationIndex]).originalFPS;if(e>=o.animatedObjects.length)this.debugString+="object index "+e+" exceeds "+o.animatedObjects.length;else{var s=o.animatedObjects[e],n=o.animatedObjects[s.modelPartIndex],r=o.getObjectAnimationFramePercent(s,t),a=o.getObjectAnimationFramePercent(n,t);this.debugString="",this.debugString+="
Object Name: "+s.name,this.debugString+="
Object Type: "+s.sceneObjectType,this.debugString+="
Object Index: "+s.id,this.debugString+="
Part Index: "+s.modelPartIndex,this.debugString+="
Part Scale: "+s.modelPartScale,this.debugString+="
Mesh Index: "+s.meshIndex,this.debugString+="
Light Index: "+s.lightIndex,this.debugString+="
Deformer Index: "+s.skinningRigIndex,this.debugString+="
Parent Index: "+s.parentIndex,this.debugString+="
Scene time "+t,this.debugString+="
Scene framepercent "+i,this.debugString+="
Object looped framepercent "+r,this.debugString+="
Model looped framepercent "+a,this.debugString+="
Object Anim length "+s.animationLength,this.debugString+="
Object Total frames "+s.totalFrames,this.debugString+="
Object FPS "+s.modelPartFPS,this.debugString+="
Model Part Anim length "+n.animationLength,this.debugString+="
Model total frames "+n.totalFrames,this.debugString+="
Model Part FPS "+n.modelPartFPS,i=S.identity(),o.getWorldTransform(s.id,t,i,this.sceneScale,!0),this.debugString+=s.debugString;var o=i[0],h=(s=i[1],n=i[2],r=i[4],a=i[5],i[6]),l=i[8],d=i[9];i=i[10];Math.sqrt(o*o+s*s+n*n),Math.sqrt(r*r+a*a+h*h),Math.sqrt(l*l+d*d+i*i)}},P.prototype.resetPlayback=function(){this.startMS=Date.now(),this.animationProgress=this.totalSeconds=0,this.setAnimationProgress(0,!0)},P.prototype.pause=function(e){this.paused=e,this.startMS=Date.now()-1e3*this.totalSeconds/(this.playbackSpeed*this.scenePlaybackSpeed)},P.prototype.setAnimationProgress=function(e,t){var i=this.animations[this.selectedAnimationIndex];this.animationProgress=e,this.totalSeconds=i.totalSeconds*this.animationProgress,this.totalSeconds-=1/i.originalFPS,this.totalSeconds<0&&(this.totalSeconds=0),this.startMS=Date.now()-1e3*this.totalSeconds/(this.playbackSpeed*this.scenePlaybackSpeed),t&&this.updateScene()},P.prototype.setPlaybackSpeed=function(e){this.playbackSpeed=e,this.startMS=Date.now()-1e3*this.totalSeconds/(this.playbackSpeed*this.scenePlaybackSpeed)},P.prototype.resetCustomView=function(){0<=this.selectedCameraIndex&&this.selectedCameraIndex=this.animations.length&&(this.selectedAnimationIndex=0)},P.prototype.selectAnimation=function(e){0<=e&&e]+>)|("[^"]+"))/,e);if(0t&&this.depthTextures[t].bind(e)},E.prototype.collect=function(e,t){for(var i=this.gl,s=e.lights,n=s.shadowCount,r=s.modelViewBuffer,a=s.projectionBuffer,o=s.matrix,h=0!=e.sceneAnimator,l=S.empty(),d=!1,c=0;cuseOriginalMeshVertices for rigid skin?":this.copyOriginalVertices(e)},M.prototype.deformMeshVertices=function(e,t){if(0!=this.skinningClusters.length&&this.unTransformedVertices){var i,s=e.stride/4,n=new Float32Array(e.dynamicVertexData.buffer),r=new Uint16Array(e.dynamicVertexData.buffer);new Uint8Array(e.dynamicVertexData.buffer),i=20,e.secondaryTexCoord&&(i+=8);var a=i,o=i+=4;i+=4;for(var h=this.unTransformedVertices.length/3,l=0,d=0;d=this.STRIP_MENU},D.prototype.activeFade=function(){var e;return(e=1<(e=(this.strips[this.stripCount-1]- -2)/(.3*this.stripCount-.9- -2))?1:e)<0?0:e},D.prototype.activeWireframe=function(){return this.active()&&.01h.width*h.height?(e=l.width,l.height):(e=h.width,h.height),o.desc.width=e,o.desc.height=t,e<=r.limits.viewportSizes[0]&&t<=r.limits.viewportSizes[1]){var i={clamp:!0};h.width==e&&h.height==t?(o.loadImage(h,r.RGBA),e=new m(r,{color0:o,ignoreStatus:!0}),N.closeImage(h)):((t=new U(r,i)).loadImage(h,r.RGB),N.closeImage(h),o.loadArray(null),(e=new m(r,{color0:o,ignoreStatus:!0})).bind(),a(t),t.destroy()),(t=new U(r,i)).loadImage(l,r.RGB),N.closeImage(l),e.bind(),r.colorMask(!1,!1,!1,!0),a(t),r.colorMask(!0,!0,!0,!0),t.destroy(),m.bindNone(r),o.rebuildMips()}else{(i=document.createElement("canvas")).width=e,i.height=t;var s=i.getContext("2d");for(s.drawImage(h,0,0),N.closeImage(h),i=s.getImageData(0,0,e,t),i=new Uint8Array(i.data.buffer,i.data.byteOffset,i.data.length),s.drawImage(l,0,0),N.closeImage(l),s=s.getImageData(0,0,e,t).data,e=e*t*4,t=0;t|\(|\)|$|%|=/g,""):e},j.sanitizeURL=function(e){return e?0==e.indexOf("http://")||0==e.indexOf("https://")||0==e.indexOf("ftp://")?encodeURI(e):"http://"+encodeURI(e):e},j.prototype.showFailure=function(e,t){this.container.innerHTML="";var i=document.createElement("canvas"),s=this.container.width/this.container.height;i.width=100,i.height=i.height*s|0,i.style.position="absolute",i.style["z-index"]="0",i.style.width=i.style.height="100%";var n=i.getContext("2d"),r=n.fillStyle=n.createRadialGradient(i.width/2,i.height/2,(i.width+i.height)/2,i.width/2,i.height/2,0);r.addColorStop(0,"rgb(0,0,0)"),r.addColorStop(1,"rgb(35,60,80)"),n.fillStyle=r,n.fillRect(0,0,i.width,i.height),this.container.appendChild(i);var a=document.createElement("div");dom.addClass(a,"error"),a.style["background-image"]="url(images/errorBG.png)";var o='

转换模型时出错

错误信息: '+(e||"文件无效(ERROR)请检查您所上传的文件以确定其稳定性")+'

您可以联系我们的客服、或点击视频教程获取更详细的上传解说
4Dweb将全程为您提供最优质的模型展示

';a.innerHTML=o,this.container.appendChild(a)},j.prototype.showPreview=function(e){this.clearView(),this.thumbnail=document.createElement("canvas");var t=this.container.width/this.container.height;this.thumbnail.height=this.viewer.mobile?200:300,this.thumbnail.width=this.thumbnail.height*t|0,this.thumbnail.style.width=this.thumbnail.style.height="100%";var i=(t=this.thumbnail.getContext("2d")).fillStyle=t.createRadialGradient(this.thumbnail.width/2,this.thumbnail.height/2,(this.thumbnail.width+this.thumbnail.height)/2,this.thumbnail.width/2,0,0);i.addColorStop(0,"rgb(0,0,0)"),i.addColorStop(1,"rgb(150,150,150)"),t.fillStyle=i,t.fillRect(0,0,this.thumbnail.width,this.thumbnail.height),this.container.appendChild(this.thumbnail),this.playButton=document.createElement("input"),this.playButton.type="image",this.playButton.src=I.dataLocale+"play.png",this.playButton.style.position="absolute",this.playButton.style.left="50%",this.playButton.style.top="50%",this.playButton.style["-webkit-transform"]=this.playButton.style.transform="translate(-50%,-50%) scale(0.4,0.4)",this.playButton.style.opacity=.5,this.playButton.style.outline="0px",this.playButton.onclick=function(){this.viewer.loadScene(this.viewer.sceneURL),this.container.removeChild(this.playButton),delete this.playButton}.bind(this),this.container.appendChild(this.playButton),e||n(this.viewer.sceneURL,function(e){this.loadingImageURL||this.setThumbnail(e)}.bind(this))},j.prototype.setThumbnailURL=function(e){(this.loadingImageURL=e)&&C.fetchImage(this.loadingImageURL,this.setThumbnail.bind(this))},j.prototype.setThumbnail=function(e){if(this.thumbnail)if(e.height>=this.container.height){var t=this.container.height/e.height;e.style.position="absolute",e.style.outline="0px",e.style.left="50%",e.style.top="50%",e.style["-webkit-transform"]=e.style.transform="translate(-50%,-50%) scale("+t+","+t+")",this.container.replaceChild(e,this.thumbnail),this.thumbnail=e}else{var i,s=this.thumbnail.getContext("2d"),n=this.thumbnail.width,r=this.thumbnail.height;t=r/e.height;s.drawImage(e,(n-e.width*t)/2,0,e.width*t,r);try{i=s.getImageData(0,0,n,r)}catch(e){return}e=s.createImageData(n,r);for(var a=0;a<2;++a){t=i.data;for(var o=e.data,h=0,l=0;lVertices: "+(0|a).toLocaleString(),I.showFrameTime&&(this.frameTimer=document.createElement("text"),this.frameTimer.style.position="absolute",this.frameTimer.style.left=this.frameTimer.style.top="5px",this.frameTimer.style.color="gray",this.frameTimer.style.fontSize="75%",this.container.appendChild(this.frameTimer),this.frameTimer.innerHTML="--",this.frameCount=1e20)},j.prototype.refreshUI=function(){if(this.sigCluster){var e=!1,t=this.stripData.selectedStrip==this.stripData.STRIP_MENU;this.hideSigOnStrips&&(e=e||t),this.hideSigOnHelp&&(e=e||this.helpOverlay.active),this.sigCluster.active==e&&this.sigCluster.toggle()}},j.prototype.signalLoadProgress=function(e,t){if(this.thumbnail){if(!this.progressBar){var i=document.createElement("div");i.style.backgroundColor="rgb(240,240,240)",i.style.opacity=.9,i.style.position="absolute",i.style.left="20%",i.style.width="60%",i.style.bottom="30%",i.style.height="4px",i.style["border-radius"]="2px",this.progressBar=document.createElement("div"),this.progressBar.style.backgroundColor="#00ccff",this.progressBar.style.position="absolute",this.progressBar.style.left=this.progressBar.style.bottom="0px",this.progressBar.style.height="100%",this.progressBar.style.width="0px",this.progressBar.style["border-radius"]="2px",i.appendChild(this.progressBar),this.container.appendChild(i),this.playButton&&(this.container.removeChild(this.playButton),delete this.playButton)}this.progressBar.style.width=t<=0?(100*e/(2097152+e)|0)+"%":(100*e/t|0)+"%"}},j.prototype.animating=function(){return!!this.fadeThumbnail||!!this.frameTimer},j.prototype.animate=function(){if(this.fadeThumbnail&&(this.fadeThumbnailTimer=this.fadeThumbnailTimer||Date.now(),this.fadeThumbnail.style.opacity=1-.0015*(Date.now()-this.fadeThumbnailTimer),this.fadeThumbnail.style.opacity<.01&&(this.container.removeChild(this.fadeThumbnail),delete this.fadeThumbnail,delete this.fadeThumbnailTimer)),this.frameTimer&&(this.frameCount++,60<=this.frameCount)){var e=(new Date).getTime();if(void 0!==this.frameTime){var t=(e-this.frameTime)/this.frameCount;t=Math.floor(100*t)/100;this.frameTimer.innerHTML=t+" ms",this.frameTimer.style.color=t<32?"green":"red"}this.frameCount=0,this.frameTime=e}if(this.guiScreen&&this.guiScreen.playbackControls&&((e=this.guiScreen.playbackControls.timelineSlider).draggingSlider?this.viewer.scene.sceneAnimator.setAnimationProgress(e.sliderPercent,!0):e.setSliderPercent(this.viewer.scene.sceneAnimator.animationProgress)),this.sceneStats){for(var i=t=e=0;iVertices: "+(0|t).toLocaleString(),this.viewer.scene.sceneAnimator&&this.viewer.scene.sceneAnimator.showPlayControls&&(this.sceneStats.innerHTML+="



"),e=!!this.sceneStats.parentElement,t=this.stripData.active()||!1,e&&!t?(this.container.removeChild(this.sceneStats),this.hostLogo&&this.container.appendChild(this.hostLogo)):!e&&t&&(this.container.appendChild(this.sceneStats),this.hostLogo&&this.container.removeChild(this.hostLogo))}this.refreshUI(),(this.stripData.animationActive||this.stripData.active())&&(this.animateStrips(),this.stripData.animationActive&&this.viewer.wake())},j.prototype.animateStrips=function(){if(this.stripText)for(var e=Math.atan(this.viewer.canvas.height/this.viewer.canvas.width/this.stripData.stripSlant),t=0;ti?i:this.pixelRatio}else this.desktopSlow&&(this.pixelRatio=1);this.canvas.width=e*this.pixelRatio,this.canvas.height=t*this.pixelRatio,this.canvas.style.width=e+"px",this.canvas.style.height=t+"px",this.canvas.style.position="absolute",this.domRoot.appendChild(this.canvas)},W.prototype.initGL=function(){var e={alpha:!!I.transparentBackground,depth:!1,stencil:!1,antialias:!1,premultipliedAlpha:!!I.transparentBackground,preserveDrawingBuffer:!1};e=this.gl=this.canvas.getContext("webgl",e)||this.canvas.getContext("experimental-webgl",e);return this.gl?(this.canvas.addEventListener("webglcontextlost",function(e){e.preventDefault()}.bind(this),!1),this.canvas.addEventListener("webglcontextrestored",function(e){this.loadScene(this.sceneURL)}.bind(this),!1),e.ext={textureAniso:e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic"),textureFloat:e.getExtension("OES_texture_float"),textureFloatLinear:e.getExtension("OES_texture_float_linear"),textureHalf:e.getExtension("OES_texture_half_float"),textureHalfLinear:e.getExtension("OES_texture_half_float_linear"),textureDepth:e.getExtension("WEBGL_depth_texture"),colorBufferFloat:e.getExtension("WEBGL_color_buffer_float"),colorBufferHalf:e.getExtension("EXT_color_buffer_half_float"),index32bit:e.getExtension("OES_element_index_uint"),loseContext:e.getExtension("WEBGL_lose_context"),derivatives:e.getExtension("OES_standard_derivatives"),renderInfo:e.getExtension("WEBGL_debug_renderer_info")},e.limits={textureSize:e.getParameter(e.MAX_TEXTURE_SIZE),textureCount:e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),varyings:e.getParameter(e.MAX_VARYING_VECTORS),vertexAttribs:e.getParameter(e.MAX_VERTEX_ATTRIBS),vertexUniforms:e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),fragmentUniforms:e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),viewportSizes:e.getParameter(e.MAX_VIEWPORT_DIMS),vendor:e.getParameter(e.VENDOR),version:e.getParameter(e.VERSION)},e.hints={mobile:this.mobile,pixelRatio:this.pixelRatio},e.enable(e.DEPTH_TEST),e.shaderCache=new O(e),e.textureCache=new N(e),this.allocBacking(),!0):(this.ui.showFailure('webgl出错。
建议您将浏览器升级至最新版本,以获最好的体验。
获知更多webgl浏览器信息请点击此处',this),!1)},W.prototype.allocBacking=function(){var e=this.gl,t=!1,i={width:this.canvas.width,height:this.canvas.height};for(this.mainColor=new U(e,i),this.mainDepth=null,e.ext.textureDepth&&(this.mainDepth=new U(e,{width:this.canvas.width,height:this.canvas.height,nofilter:!0}),this.mainDepth.loadArray(null,e.DEPTH_COMPONENT,e.UNSIGNED_INT)),e.ext.textureHalf&&e.ext.textureHalfLinear&&(this.mainColor.loadArray(null,e.RGBA,e.ext.textureHalf.HALF_FLOAT_OES),this.mainBuffer=new m(e,{color0:this.mainColor,depth:this.mainDepth,createDepth:!this.mainDepth}),t=this.mainBuffer.valid),!t&&e.ext.textureFloat&&e.ext.textureFloatLinear&&!e.hints.mobile&&(this.mainColor.loadArray(null,e.RGBA,e.FLOAT),this.mainBuffer=new m(e,{color0:this.mainColor,depth:this.mainDepth,createDepth:!this.mainDepth}),t=this.mainBuffer.valid);!t;)this.mainColor=new U(e,i),this.mainColor.loadArray(null,e.RGBA,e.UNSIGNED_BYTE),this.mainBuffer=new m(e,{color0:this.mainColor,depth:this.mainDepth,createDepth:!this.mainDepth}),t=this.mainBuffer.valid,i.width/=2,i.height/=2,this.mainDepth&&(this.mainDepth.destroy(),this.mainDepth=null);this.mainBufferNoDepth=new m(e,{color0:this.mainColor})},W.prototype.loadScene=function(e){if(this.sceneURL=e||this.sceneURL,this.scene=this.input=null,this.initGL()&&this.sceneURL){var t=this.ui.signalLoadProgress.bind(this.ui);e=function(e){t(1,1),this.scene=new k(this.gl),this.scene.stripData=this.stripData,this.scene.load(new h(e))?this.scene.metaData.tbVersion<=2070?this.ui.showFailure("模型文件版本过低",this):(this.bindInput(),this.requestFrame(this.updateLoad.bind(this)),this.onLoad&&this.onLoad()):this.ui.showFailure("模型文件无法读取或无效",this)}.bind(this);var i=function(){this.ui.showFailure("模型文件 ("+this.sceneURL+") 无法获取.",this)}.bind(this);C.fetchBinary(this.sceneURL,e,i,t)}},W.prototype.unload=function(){delete this.scene,delete this.input,delete this.ui,delete this.mainColor,delete this.mainBuffer,delete this.gl;var e=this.domRoot.clientWidth,t=this.domRoot.clientHeight;this.initCanvas(e,t),this.ui=new j(this),this.ui.setSize(e,t),this.ui.showPreview(),this.cancelFrame()},W.prototype.bindInput=function(){this.input=new e(this.ui.container),this.input.onDrag.push(function(e,t,i,s){e=1-2.2/(Math.sqrt(i*i+s*s)+2.2),(t=this.scene.view).rotation[1]-=.4*i*e,t.rotation[0]-=.4*s*e,t.rotation[0]=90\nuniform sampler2D tAlbedo;varying mediump vec2 d;void main(){float e=texture2D(tAlbedo,d).a;if(e<=f(d.x)){discard;}gl_FragColor=vec4(0.0);}","alphaprepassvert.glsl":"precision highp float;uniform mat4 uModelViewProjectionMatrix;uniform vec2 uUVOffset;attribute vec3 vPosition;attribute vec2 vTexCoord;varying mediump vec2 d;vec4 h(mat4 i,vec3 p){return i[0]*p.x+(i[1]*p.y+(i[2]*p.z+i[3]));}void main(void){gl_Position=h(uModelViewProjectionMatrix,vPosition.xyz);d=vTexCoord+uUVOffset;}","bloom.glsl":"precision mediump float;uniform sampler2D tInput;uniform vec4 uKernel[BLOOM_SAMPLES];varying highp vec2 j;void main(void){vec3 c=vec3(0.0,0.0,0.0);for(int k=0;k=1.0?1.0:0.0;}float f(vec2 I){return fract(sin(dot(I,vec2(12.9898,78.233)))*43758.5453+uDitherOffset);}void J(vec3 K,vec3 L,out float M,out float N){vec3 v=uSpotParams.xyz,p=uCylinder.xyz;vec3 O=L-dot(L,v)*v;vec3 P=(K-p)-dot(K-p,v)*v;float a=dot(O,O);float b=2.0*dot(O,P);float c=dot(P,P)-uCylinder.w;float Q=b*b-4.0*a*c;if(Q>=0.0){Q=sqrt(Q);M=(-b-Q)/(2.0*a);N=(-b+Q)/(2.0*a);}else {M=N=0.0;}}\n#endif\nvarying vec2 j;void main(void){vec3 R=uInvViewMatrix[3].xyz;float H=texture2D(tDepth,j).x;H=min(H,0.9999);vec3 S;S.z=uDepthToZ.y/(uDepthToZ.z*H+uDepthToZ.x);S.xy=S.z*(j*uUnproject.xy+uUnproject.zw);S=h(uInvViewMatrix,S).xyz;vec3 T;T.xy=(j*uUnproject.xy+uUnproject.zw);T.z=1.0;T=normalize(u(uInvViewMatrix,-T).xyz);vec3 U=uFogColor;\n#if defined(FOG_IBL)\nvec3 G=u(uLightMatrix,T);vec3 V=uFogLightSphere[0].xyz;V+=uFogLightSphere[1].xyz*G.y;V+=uFogLightSphere[2].xyz*G.z;V+=uFogLightSphere[3].xyz*G.x;vec3 swz=G.yyz*G.xzx;V+=uFogLightSphere[4].xyz*swz.x;V+=uFogLightSphere[5].xyz*swz.y;V+=uFogLightSphere[7].xyz*swz.z;vec3 sqr=G*G;V+=uFogLightSphere[6].xyz*(3.0*sqr.z-1.0);V+=uFogLightSphere[8].xyz*(sqr.x-sqr.y);U=mix(U,U*V,uFogIllum);float C=A(length(S-R));gl_FragColor.xyz=U*C;gl_FragColor.w=C;return;\n#else\n#if defined(FOG_SPOT) || defined(FOG_OMNI)\nfloat W=0.0,X=0.0;{float r=1.0/(uLightAttenuation.z);float a=1.0;float b=2.0*dot(T,R-uLightPosition.xyz);float c=dot(uLightPosition.xyz,uLightPosition.xyz)+dot(R,R)+-2.0*dot(uLightPosition.xyz,R)+-r*r;float Q=b*b-4.0*a*c;if(Q>=0.0){Q=sqrt(Q);W=(-b-Q)/(2.0*a);X=(-b+Q)/(2.0*a);}}\n#if defined(FOG_SPOT)\n{float Y=uSpotParams.w,Z=1.0-Y;vec3 v=T;vec3 dc=uSpotParams.xyz;vec3 dd=R-uLightPosition.xyz;vec3 de=v-dot(v,dc)*dc,df=dd-dot(dd,dc)*dc;float a=Y*dot(de,de)-Z*dot(v,dc)*dot(v,dc);float b=2.0*Y*dot(de,df)-2.0*Z*dot(v,dc)*dot(dd,dc);float c=Y*dot(df,df)-Z*dot(dd,dc)*dot(dd,dc);float Q=b*b-4.0*a*c;if(Q>=0.0){float dh=(-b-sqrt(Q))/(2.0*a);float di=(-b+sqrt(Q))/(2.0*a);if(diW){\n#ifdef FOG_SHADOWS\n#ifdef MOBILE\n#define SAMPLES 16\n#else\n#define SAMPLES 32\n#endif\nfloat dm=f(j)*(X-W)/float(SAMPLES-2);\n#else\n#define SAMPLES 8\nfloat dm=0.0;\n#endif\nfor(int k=0;kW){\n#ifdef MOBILE\n#define SAMPLES 16\n#else\n#define SAMPLES 32\n#endif\nfloat dl=0.0;float dm=f(j)*(X-W)/float(SAMPLES-2);float dn=(X-W)*(1.0/float(SAMPLES));for(int k=0;k\n#include \n#include \n#include \n#include \n#include \n#ifdef TRANSPARENCY_DITHER\n#include \n#endif\nvoid main(void){vec4 m=texture2D(tAlbedo,d);vec3 dF=dG(m.xyz);float e=m.w;\n#ifdef VERTEX_COLOR\n{vec3 dH=dD.xyz;\n#ifdef VERTEX_COLOR_SRGB\ndH=dH*(dH*(dH*0.305306011+vec3(0.682171111))+vec3(0.012522878));\n#endif\ndF*=dH;\n#ifdef VERTEX_COLOR_ALPHA\ne*=dD.w;\n#endif\n}\n#endif\n#ifdef ALPHA_TEST\nif(ef(d.x))?1.0:e;\n#endif\nvec3 dI=dJ(texture2D(tNormal,d).xyz);\n#ifdef ANISO\n#ifdef ANISO_NO_DIR_TEX\nvec3 dK=dL(uAnisoTangent);\n#else\nm=dM(d,uTexRangeAniso);vec3 dK=2.0*m.xyz-vec3(1.0);dK=dL(dK);\n#endif\ndK=dK-dI*dot(dK,dI);dK=normalize(dK);vec3 dN=dK*uAnisoStrength;\n#endif\nvec3 dO=normalize(uCameraPosition-dv);m=texture2D(tReflectivity,d);vec3 dP=dG(m.xyz);float dQ=m.w;float dR=dQ;\n#ifdef HORIZON_SMOOTHING\nfloat dS=dot(dO,dI);dS=uHorizonSmoothing-dS*uHorizonSmoothing;dQ=mix(dQ,1.0,dS*dS);\n#endif\n#ifdef STRIPVIEW\ndT dU;dV(dU,dQ,dP);\n#endif\nfloat dW=1.0;\n#ifdef AMBIENT_OCCLUSION\n#ifdef AMBIENT_OCCLUSION_SECONDARY_UV\ndW=dM(dE,uTexRangeAO).x;\n#else\ndW=dM(d,uTexRangeAO).x;\n#endif\ndW*=dW;\n#endif\n#if defined(SKIN)\ndX dY;dZ(dY);dY.ec*=dW;\n#elif defined(MICROFIBER)\ned ee;ef(ee,dI);ee.eh*=dW;\n#else\nvec3 ei=ej(dI);ei*=dW;\n#endif\nvec3 ek=reflect(-dO,dI);\n#ifdef ANISO\nvec3 rt=ek-(0.5*dN*dot(ek,dK));vec3 el=em(rt,mix(dQ,0.5*dQ,uAnisoStrength));\n#else\nvec3 el=em(ek,dQ);\n#endif\nel*=en(ek,dC);\n#ifdef LIGHT_COUNT\nhighp float eo=10.0/log2(dQ*0.968+0.03);eo*=eo;float eu=eo*(1.0/(8.0*3.1415926))+(4.0/(8.0*3.1415926));eu=min(eu,1.0e3);\n#ifdef SHADOW_COUNT\nev eA;\n#ifdef SKIN\n#ifdef SKIN_VERSION_1\neB(eA,SHADOW_KERNEL+SHADOW_KERNEL*dY.eC);\n#else\neD eE;float eF=SHADOW_KERNEL+SHADOW_KERNEL*dY.eC;eG(eE,eF);eB(eA,eF);\n#endif\n#else\neB(eA,SHADOW_KERNEL);\n#endif\n#endif\n#ifdef ANISO\neu*=uAnisoIntegral;\n#endif\nfor(int k=0;k0.0?1.0-c.x:c.x;c.y=i.y>0.0?1.0-c.y:c.y;eU.rgb=texture2D(tRefraction,c).xyz;eU.rgb=mix(eU.rgb,eU.rgb*dF,uRefractionAlbedoTint);eU.rgb=eU.rgb-eU.rgb*eS;eU.rgb*=uRefractionTint;\n#ifdef REFRACTION_NO_MASK_TEX\neU.a=1.0;\n#else\neU.a=dM(d,uTexRangeRefraction).x;\n#endif\n}\n#endif\n#ifdef DIFFUSE_UNLIT\ngl_FragColor.xyz=dF;\n#else\ngl_FragColor.xyz=ei*dF;\n#endif\n#ifdef REFRACTION\ngl_FragColor.xyz=mix(gl_FragColor.xyz,eU.rgb,eU.a);\n#endif\ngl_FragColor.xyz+=el;\n#if defined(SKIN) || defined(MICROFIBER)\ngl_FragColor.xyz+=diff_extra;\n#endif\n#ifdef EMISSIVE\n#ifdef EMISSIVE_SECONDARY_UV\nvec2 eW=dE;\n#else\nvec2 eW=d;\n#endif\ngl_FragColor.xyz+=uEmissiveScale*dG(dM(eW,uTexRangeEmissive).xyz);\n#endif\n#ifdef STRIPVIEW\ngl_FragColor.xyz=eX(dU,dI,dF,dP,dR,ei,el,gl_FragColor.xyz);\n#endif\n#ifdef NOBLEND\ngl_FragColor.w=1.0;\n#else\ngl_FragColor.w=e;\n#endif\n}","matlighting.glsl":"vec3 eY(vec3 eZ,float fc){return exp(-0.5*fc/(eZ*eZ))/(eZ*2.5066283);}vec3 fd(vec3 eZ){return vec3(1.0,1.0,1.0)/(eZ*2.5066283);}vec3 fe(vec3 ff){return vec3(-0.5,-0.5,-0.5)/(ff);}vec3 fh(vec3 fi,float fc){return exp(fi*fc);}\n#define SAMPLE_COUNT 21.0\n#define SAMPLE_HALF 10.0\n#define GAUSS_SPREAD 0.05\nvec3 fj(float fk,float fl,vec3 fm){vec3 fn=vec3(fl,fl,fl);fn=0.8*fn+vec3(0.2);vec3 fo=cos(fn*3.14159);vec3 fu=cos(fn*3.14159*0.5);fu*=fu;fu*=fu;fu*=fu;fn=fn+0.05*fo*fu*fm;fu*=fu;fu*=fu;fu*=fu;fn=fn+0.1*fo*fu*fm;fn=saturate(fn);fn*=fn*1.2;return fn;}vec3 fv(vec3 fm){return vec3(1.0,1.0,1.0)/3.1415926;}float fA(float fk,float fm){return saturate(-fk*fm+fk+fm);}vec3 fB(float fk,vec3 fm){return saturate(-fk*fm+vec3(fk)+fm);}float fC(float fm){return-0.31830988618379*fm+0.31830988618379;}vec3 fD(vec3 fm){return-0.31830988618379*fm+vec3(0.31830988618379);}vec3 eT(vec3 dO,vec3 dI,vec3 dP,float fE){float C=1.0-saturate(dot(dO,dI));float fF=C*C;C*=fF*fF;C*=fE;return(dP-C*dP)+C*uFresnel;}vec2 fG(vec2 fH,vec2 fm){fH=1.0-fH;vec2 fI=fH*fH;fI*=fI;fH=mix(fI,fH*0.4,fm);return fH;}vec3 ej(vec3 fJ){\n#define c(n) uDiffuseCoefficients[n].xyz\nvec3 G=(c(0)+fJ.y*((c(1)+c(4)*fJ.x)+c(5)*fJ.z))+fJ.x*(c(3)+c(7)*fJ.z)+c(2)*fJ.z;\n#undef c\nvec3 sqr=fJ*fJ;G+=uDiffuseCoefficients[6].xyz*(3.0*sqr.z-1.0);G+=uDiffuseCoefficients[8].xyz*(sqr.x-sqr.y);return G;}void fK(inout vec3 fL,inout vec3 fM,inout vec3 fN,vec3 fJ){fL=uDiffuseCoefficients[0].xyz;fM=uDiffuseCoefficients[1].xyz*fJ.y;fM+=uDiffuseCoefficients[2].xyz*fJ.z;fM+=uDiffuseCoefficients[3].xyz*fJ.x;vec3 swz=fJ.yyz*fJ.xzx;fN=uDiffuseCoefficients[4].xyz*swz.x;fN+=uDiffuseCoefficients[5].xyz*swz.y;fN+=uDiffuseCoefficients[7].xyz*swz.z;vec3 sqr=fJ*fJ;fN+=uDiffuseCoefficients[6].xyz*(3.0*sqr.z-1.0);fN+=uDiffuseCoefficients[8].xyz*(sqr.x-sqr.y);}vec3 fO(vec3 fL,vec3 fM,vec3 fN,vec3 fP,float fm){fP=mix(vec3(1.0),fP,fm);return(fL+fM*fP.x)+fN*fP.z;}vec3 fQ(vec3 fL,vec3 fM,vec3 fN,vec3 fP,vec3 fR){vec3 fS=mix(vec3(1.0),fP.yyy,fR);vec3 fT=mix(vec3(1.0),fP.zzz,fR);return(fL+fM*fS)+fN*fT;}vec3 em(vec3 fJ,float dQ){fJ/=dot(vec3(1.0),abs(fJ));vec2 fU=abs(fJ.zx)-vec2(1.0,1.0);vec2 fV=vec2(fJ.x<0.0?fU.x:-fU.x,fJ.z<0.0?fU.y:-fU.y);vec2 fW=(fJ.y<0.0)?fV:fJ.xz;fW=vec2(0.5*(254.0/256.0),0.125*0.5*(254.0/256.0))*fW+vec2(0.5,0.125*0.5);float fX=fract(7.0*dQ);fW.y+=0.125*(7.0*dQ-fX);vec2 fY=fW+vec2(0.0,0.125);vec4 fZ=mix(texture2D(tSkySpecular,fW),texture2D(tSkySpecular,fY),fX);vec3 r=fZ.xyz*(7.0*fZ.w);return r*r;}float en(vec3 fJ,vec3 hc){float hd=dot(fJ,hc);hd=saturate(1.0+uHorizonOcclude*hd);return hd*hd;}","matmicrofiber.glsl":"\n#ifdef MICROFIBER\nuniform vec4 uTexRangeFuzz;uniform vec4 uFresnelColor;uniform float uFresnelIntegral;uniform float uFresnelOcc;uniform float uFresnelGlossMask;struct ed{vec3 eh;vec3 eN;vec3 he;vec3 hf;vec3 hh;};void ef(out ed s,vec3 dI){s.eh=s.eN=ej(dI);s.he=vec3(0.0);s.hf=uFresnelColor.rgb;s.hh=uFresnelColor.aaa*vec3(1.0,0.5,0.25);\n#ifndef MICROFIBER_NO_FUZZ_TEX\nvec4 m=dM(d,uTexRangeFuzz);s.hf*=dG(m.rgb);\n#endif\n}void eM(inout ed s,float hi,vec3 eH,vec3 dI,vec3 eJ){float fk=dot(eH,dI);float eN=saturate((1.0/3.1415926)*fk);float hj=fA(fk,s.hh.z);\n#ifdef SHADOW_COUNT\neN*=hi;float hk=mix(1.0,hi,uFresnelOcc);float he=hj*hk;\n#else \nfloat he=hj;\n#endif\ns.he=he*eJ+s.he;s.eN=eN*eJ+s.eN;}void eR(out vec3 ei,out vec3 diff_extra,inout ed s,vec3 dO,vec3 dI,float dQ){s.he*=uFresnelIntegral;float fH=dot(dO,dI);vec2 hl=fG(vec2(fH,fH),s.hh.xy);s.he=s.eh*hl.x+(s.he*hl.y);s.he*=s.hf;float hm=saturate(1.0+-uFresnelGlossMask*dQ);s.he*=hm*hm;ei=s.eN;diff_extra=s.he;}\n#endif\n","matsampling.glsl":"vec3 dG(vec3 c){return c*c;}vec3 dJ(vec3 n){vec3 hn=dA;vec3 ho=dB;vec3 hu=gl_FrontFacing?dC:-dC;\n#ifdef TSPACE_RENORMALIZE\nhu=normalize(hu);\n#endif\n#ifdef TSPACE_ORTHOGONALIZE\nhn-=dot(hn,hu)*hu;\n#endif\n#ifdef TSPACE_RENORMALIZE\nhn=normalize(hn);\n#endif\n#ifdef TSPACE_ORTHOGONALIZE\nho=(ho-dot(ho,hu)*hu)-dot(ho,hn)*hn;\n#endif\n#ifdef TSPACE_RENORMALIZE\nho=normalize(ho);\n#endif\n#ifdef TSPACE_COMPUTE_BITANGENT\nvec3 hv=cross(hu,hn);ho=dot(hv,ho)<0.0?-hv:hv;\n#endif\nn=2.0*n-vec3(1.0);return normalize(hn*n.x+ho*n.y+hu*n.z);}vec3 dL(vec3 t){vec3 hu=gl_FrontFacing?dC:-dC;return normalize(dA*t.x+dB*t.y+hu*t.z);}vec4 dM(vec2 hA,vec4 hB){\n#if GL_OES_standard_derivatives\nvec2 hC=fract(hA);vec2 hD=fwidth(hC);float hE=(hD.x+hD.y)>0.5?-6.0:0.0;return texture2D(tExtras,hC*hB.xy+hB.zw,hE);\n#else\nreturn texture2D(tExtras,fract(hA)*hB.xy+hB.zw);\n#endif\n}vec3 hF(sampler2D hG,vec2 hH,float hI){vec3 n=texture2D(hG,hH,hI*2.5).xyz;return dJ(n);}","matshadows.glsl":"\n#ifdef SHADOW_COUNT\n#ifdef MOBILE\n#define SHADOW_KERNEL (4.0/1536.0)\n#else\n#define SHADOW_KERNEL (4.0/2048.0)\n#endif\nhighp vec4 h(highp mat4 i,highp vec3 p){return i[0]*p.x+(i[1]*p.y+(i[2]*p.z+i[3]));}uniform sampler2D tDepth0;\n#if SHADOW_COUNT > 1\nuniform sampler2D tDepth1;\n#if SHADOW_COUNT > 2\nuniform sampler2D tDepth2;\n#endif\n#endif\nuniform highp vec2 uShadowKernelRotation;uniform highp vec2 uShadowMapSize;uniform highp mat4 uShadowMatrices[SHADOW_COUNT];uniform highp vec4 uShadowTexelPadProjections[SHADOW_COUNT];\n#ifndef MOBILE\nuniform highp mat4 uInvShadowMatrices[SHADOW_COUNT];\n#endif\nhighp float hJ(highp vec3 G){\n#ifdef SHADOW_NATIVE_DEPTH\nreturn G.x;\n#else\nreturn(G.x+G.y*(1.0/255.0))+G.z*(1.0/65025.0);\n#endif\n}\n#ifndef SHADOW_COMPARE\n#define SHADOW_COMPARE(a,b) ((a) < (b) ? 1.0 : 0.0)\n#endif\n#ifndef SHADOW_CLIP\n#define SHADOW_CLIP(c,v) v\n#endif\nfloat hK(sampler2D hL,highp vec2 hA,highp float H){\n#ifndef MOBILE\nhighp vec2 c=hA*uShadowMapSize.x;highp vec2 a=floor(c)*uShadowMapSize.y,b=ceil(c)*uShadowMapSize.y;highp vec4 eE;eE.x=hJ(texture2D(hL,a).xyz);eE.y=hJ(texture2D(hL,vec2(b.x,a.y)).xyz);eE.z=hJ(texture2D(hL,vec2(a.x,b.y)).xyz);eE.w=hJ(texture2D(hL,b).xyz);highp vec4 hM;hM.x=SHADOW_COMPARE(H,eE.x);hM.y=SHADOW_COMPARE(H,eE.y);hM.z=SHADOW_COMPARE(H,eE.z);hM.w=SHADOW_COMPARE(H,eE.w);highp vec2 w=c-a*uShadowMapSize.x;vec2 s=(w.y*hM.zw+hM.xy)-w.y*hM.xy;return(w.x*s.y+s.x)-w.x*s.x;\n#else\nhighp float G=hJ(texture2D(hL,hA.xy).xyz);return SHADOW_COMPARE(H,G);\n#endif\n}highp float hN(sampler2D hL,highp vec3 hA,float hO){highp vec2 l=uShadowKernelRotation*hO;float s;s=hK(hL,hA.xy+l,hA.z);s+=hK(hL,hA.xy-l,hA.z);s+=hK(hL,hA.xy+vec2(-l.y,l.x),hA.z);s+=hK(hL,hA.xy+vec2(l.y,-l.x),hA.z);s*=0.25;return s*s;}struct ev{float eL[LIGHT_COUNT];};void eB(out ev ss,float hO){highp vec3 hP[SHADOW_COUNT];vec3 hu=gl_FrontFacing?dC:-dC;for(int k=0;k 0\nm=hN(tDepth0,hP[0],hO);ss.eL[0]=SHADOW_CLIP(hP[0].xy,m);\n#endif\n#if SHADOW_COUNT > 1\nm=hN(tDepth1,hP[1],hO);ss.eL[1]=SHADOW_CLIP(hP[1].xy,m);\n#endif\n#if SHADOW_COUNT > 2\nm=hN(tDepth2,hP[2],hO);ss.eL[2]=SHADOW_CLIP(hP[2].xy,m);\n#endif\nfor(int k=SHADOW_COUNT;k 0\nhW=hT(tDepth0,hV[0].xy,uInvShadowMatrices[0]);ss.eE[0]=length(dv.xyz-hW.xyz);\n#endif\n#if SHADOW_COUNT > 1\nhW=hT(tDepth1,hV[1].xy,uInvShadowMatrices[1]);ss.eE[1]=length(dv.xyz-hW.xyz);\n#endif\n#if SHADOW_COUNT > 2\nhW=hT(tDepth2,hV[2].xy,uInvShadowMatrices[2]);ss.eE[2]=length(dv.xyz-hW.xyz);\n#endif\nfor(int k=SHADOW_COUNT;k0.0;dQ=iU?0.5:dQ;dP=iU?vec3(0.1):dP;}vec3 eX(dT iT,vec3 dI,vec3 dF,vec3 dP,float dQ,vec3 ei,vec3 el,vec3 iV){return iT.io[0]*(dI*0.5+vec3(0.5))+iT.io[1]*dF+iT.io[2]*dP+vec3(iT.io[3]*dQ)+iT.io[4]*(vec3(0.12)+0.3*ei+el)+iT.bg*iV;}\n#endif\n","matvert.glsl":"precision highp float;uniform mat4 uModelViewProjectionMatrix;uniform mat4 uSkyMatrix;uniform vec2 uUVOffset;attribute vec3 vPosition;attribute vec2 vTexCoord;attribute vec2 vTangent;attribute vec2 vBitangent;attribute vec2 vNormal;\n#ifdef VERTEX_COLOR\nattribute vec4 vColor;\n#endif\n#ifdef TEXCOORD_SECONDARY\nattribute vec2 vTexCoord2;\n#endif\nvarying highp vec3 dv;varying mediump vec2 d;varying mediump vec3 dA;varying mediump vec3 dB;varying mediump vec3 dC;\n#ifdef VERTEX_COLOR\nvarying lowp vec4 dD;\n#endif\n#ifdef TEXCOORD_SECONDARY\nvarying mediump vec2 dE;\n#endif\nvec3 iW(vec2 v){bool iX=(v.y>(32767.1/65535.0));v.y=iX?(v.y-(32768.0/65535.0)):v.y;vec3 r;r.xy=(2.0*65535.0/32767.0)*v-vec2(1.0);r.z=sqrt(clamp(1.0-dot(r.xy,r.xy),0.0,1.0));r.z=iX?-r.z:r.z;return r;}vec4 h(mat4 i,vec3 p){return i[0]*p.x+(i[1]*p.y+(i[2]*p.z+i[3]));}vec3 u(mat4 i,vec3 v){return i[0].xyz*v.x+i[1].xyz*v.y+i[2].xyz*v.z;}void main(void){gl_Position=h(uModelViewProjectionMatrix,vPosition.xyz);d=vTexCoord+uUVOffset;dA=u(uSkyMatrix,iW(vTangent));dB=u(uSkyMatrix,iW(vBitangent));dC=u(uSkyMatrix,iW(vNormal));dv=h(uSkyMatrix,vPosition.xyz).xyz;\n#ifdef VERTEX_COLOR\ndD=vColor;\n#endif\n#ifdef TEXCOORD_SECONDARY\ndE=vTexCoord2;\n#endif\n}","postaa.glsl":"precision mediump float;uniform sampler2D tInput;varying vec2 j;void main(void){gl_FragColor=texture2D(tInput,j);}","postfrag.glsl":"precision mediump float;uniform sampler2D tInput;\n#ifdef BLOOM\nuniform sampler2D tBloom;\n#endif\n#ifdef GRAIN\nuniform sampler2D tGrain;\n#endif\n#ifdef COLOR_LUT\nuniform sampler2D tLUT;\n#endif\nuniform vec3 uScale;uniform vec3 uBias;uniform vec3 uSaturation;uniform vec4 uSharpenKernel;uniform vec3 uSharpness;uniform vec3 uBloomColor;uniform vec4 uVignetteAspect;uniform vec4 uVignette;uniform vec4 uGrainCoord;uniform vec2 uGrainScaleBias;varying vec2 j;vec3 iY(vec3 c){vec3 iZ=sqrt(c);return(iZ-iZ*c)+c*(0.4672*c+vec3(0.5328));}void main(void){vec4 jc=texture2D(tInput,j);vec3 c=jc.xyz;\n#ifdef SHARPEN\nvec3 hM=texture2D(tInput,j+uSharpenKernel.xy).xyz;hM+=texture2D(tInput,j-uSharpenKernel.xy).xyz;hM+=texture2D(tInput,j+uSharpenKernel.zw).xyz;hM+=texture2D(tInput,j-uSharpenKernel.zw).xyz;vec3 jd=uSharpness.x*c-uSharpness.y*hM;c+=clamp(jd,-uSharpness.z,uSharpness.z);\n#endif\n#ifdef BLOOM\nc+=uBloomColor*texture2D(tBloom,j).xyz;\n#endif\n#ifdef VIGNETTE\nvec2 je=j*uVignetteAspect.xy-uVignetteAspect.zw;vec3 v=clamp(vec3(1.0,1.0,1.0)-uVignette.xyz*dot(je,je),0.0,1.0);vec3 jf=v*v;jf*=v;c*=mix(v,jf,uVignette.w);\n#endif\n#ifdef SATURATION\nfloat gray=dot(c,vec3(0.3,0.59,0.11));c=mix(vec3(gray,gray,gray),c,uSaturation);\n#endif\n#ifdef CONTRAST\nc=c*uScale+uBias;\n#endif\n#ifdef GRAIN\nfloat jh=uGrainScaleBias.x*texture2D(tGrain,j*uGrainCoord.xy+uGrainCoord.zw).x+uGrainScaleBias.y;c+=c*jh;\n#endif\n#ifdef REINHARD\n{c*=1.8;float ji=dot(c,vec3(0.3333));c=clamp(c/(1.0+ji),0.0,1.0);}\n#elif defined(HEJL)\n{const highp float jj=0.22,jk=0.3,jl=.1,jm=0.2,jn=.01,jo=0.3;const highp float ju=1.25;highp vec3 eO=max(vec3(0.0),c-vec3(.004));c=(eO*((ju*jj)*eO+ju*vec3(jl*jk,jl*jk,jl*jk))+ju*vec3(jm*jn,jm*jn,jm*jn))/(eO*(jj*eO+vec3(jk,jk,jk))+vec3(jm*jo,jm*jo,jm*jo))-ju*vec3(jn/jo,jn/jo,jn/jo);}\n#endif\n#ifdef COLOR_LUT\nc=clamp(c,0.0,1.0);c=(255.0/256.0)*c+vec3(0.5/256.0);c.x=texture2D(tLUT,c.xx).x;c.y=texture2D(tLUT,c.yy).y;c.z=texture2D(tLUT,c.zz).z;c*=c;\n#endif\ngl_FragColor.xyz=iY(c);gl_FragColor.w=jc.w;}","postvert.glsl":"precision highp float;attribute vec2 vCoord;varying vec2 j;void main(void){j=vCoord;gl_Position.xy=2.0*vCoord-vec2(1.0,1.0);gl_Position.zw=vec2(0.0,1.0);}","shadowfloorfrag.glsl":"precision mediump float;varying highp vec3 dv;varying mediump vec2 jv;varying mediump vec3 dC;uniform vec3 uShadowCatcherParams;\n#ifdef LIGHT_COUNT\nuniform vec4 uLightPositions[LIGHT_COUNT];uniform vec3 uLightDirections[LIGHT_COUNT];uniform vec3 uLightColors[LIGHT_COUNT];uniform vec3 uLightParams[LIGHT_COUNT];uniform vec3 uLightSpot[LIGHT_COUNT];\n#endif\n#define saturate(x) clamp( x, 0.0, 1.0 )\n#define SHADOW_COMPARE(a,b) ((a) < (b) || (b) >= 1.0 ? 1.0 : 0.0)\n#define SHADOW_CLIP(c,v) ((c.x<0.0 || c.x>1.0 || c.y<0.0 || c.y>1.0) ? 1.0 : v)\n#include \nvoid main(void){ev eA;eB(eA,SHADOW_KERNEL);vec3 jA=vec3(0.0,0.0,0.0);vec3 jB=vec3(0.0,0.0,0.0);for(int k=0;k