<!-- SAGA-STAGING · part 180 -->
Material||n.isShaderMaterial||n.isShadowMaterial||n.skinning)&&y.setValue(pt,"viewMatrix",t.matrixWorldInverse)}if(n.skinning){y.setOptional(pt,i,"bindMatrix"),y.setOptional(pt,i,"bindMatrixInverse");const t=i.skeleton;if(t){const e=t.bones;if(j.floatVertexTextures){if(null===t.boneTexture){let n=Math.sqrt(4*e.length);n=mt(n),n=Math.max(n,4);const i=new Float32Array(n*n*4);i.set(t.boneMatrices);const r=new ii(i,n,n,E,b);t.boneMatrices=i,t.boneTexture=r,t.boneTextureSize=n}y.setValue(pt,"boneTexture",t.boneTexture,J),y.setValue(pt,"boneTextureSize",t.boneTextureSize)}else y.setOptional(pt,t,"boneMatrices")}}var M,T;return(g||c.receiveShadow!==i.receiveShadow)&&(c.receiveShadow=i.receiveShadow,y.setValue(pt,"receiveShadow",i.receiveShadow)),g&&(y.setValue(pt,"toneMappingExposure",f.toneMappingExposure),c.needsLights&&(T=v,(M=x).ambientLightColor.needsUpdate=T,M.lightProbe.needsUpdate=T,M.directionalLights.needsUpdate=T,M.directionalLightShadows.needsUpdate=T,M.pointLights.needsUpdate=T,M.pointLightShadows.needsUpdate=T,M.spotLights.needsUpdate=T,M.spotLightShadows.needsUpdate=T,M.rectAreaLights.needsUpdate=T,M.hemisphereLights.needsUpdate=T),r&&n.fog&&nt.refreshFogUniforms(x,r),nt.refreshMaterialUniforms(x,n,P,C),Cr.upload(pt,c.uniformsList,x,J)),n.isShaderMaterial&&!0===n.uniformsNeedUpdate&&(Cr.upload(pt,c.uniformsList,x,J),n.uniformsNeedUpdate=!1),n.isSpriteMaterial&&y.setValue(pt,"center",i.center),y.setValue(pt,"modelViewMatrix",i.modelViewMatrix),y.setValue(pt,"normalMatrix",i.normalMatrix),y.setValue(pt,"modelMatrix",i.matrixWorld),p}Et.setAnimationLoop((function(t){bt&&bt(t)})),"undefined"!=typeof window&&Et.setContext(window),this.setAnimationLoop=function(t){bt=t,yt.setAnimationLoop(t),null===t?Et.stop():Et.start()},yt.addEventListener("sessionstart",Mt),yt.addEventListener("sessionend",Tt),this.render=function(t,e){let n,i;if(void 0!==arguments[2]&&(console.warn("THREE.WebGLRenderer.render(): the renderTarget argument has been removed. Use .setRenderTarget() instead."),n=arguments[2]),void 0!==arguments[3]&&(console.warn("THREE.WebGLRenderer.render(): the forceClear argument has been removed. Use .clear() instead."),i=arguments[3]),void 0!==e&&!0!==e.isCamera)return void console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");if(!0===g)return;!0===t.autoUpdate&&t.updateMatrixWorld(),null===e.parent&&e.updateMatrixWorld(),!0===yt.enabled&&!0===yt.isPresenting&&(e=yt.getCamera(e)),!0===t.isScene&&t.onBeforeRender(f,t,e,n||_),d=rt.get(t,m.length),d.init(),m.push(d),G.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),F.setFromProjectionMatrix(G),H=this.localClippingEnabled,O=st.init(this.clippingPlanes,H,e),u=it.get(t,p.length),u.init(),p.push(u),At(t,e,0,f.sortObjects),u.finish(),!0===f.sortObjects&&u.sort(D,I),!0===O&&st.beginShadows();const r=d.state.shadowsArray;at.render(r,t,e),d.setupLights(),d.setupLightsView(e),!0===O&&st.endShadows(),!0===this.info.autoReset&&this.info.reset(),void 0!==n&&this.setRenderTarget(n),ot.render(u,t,e,i);const s=u.opaque,a=u.transparent;s.length>0&&Rt(s,t,e),a.length>0&&Rt(a,t,e),null!==_&&(J.updateRenderTargetMipmap(_),J.updateMultisampleRenderTarget(_)),!0===t.isScene&&t.onAfterRender(f,t,e),q.buffers.depth.setTest(!0),q.buffers.depth.setMask(!0),q.buffers.color.setMask(!0),q.setPolygonOffset(!1),dt.resetDefaultState(),w=-1,S=null,m.pop(),d=m.length>0?m[m.length-1]:null,p.pop(),u=p.length>0?p[p.length-1]:null},this.getActiveCubeFace=function(){return v},this.getActiveMipmapLevel=function(){return y},this.getRenderTarget=function(){return _},this.setRenderTarget=function(t,e=0,n=0){_=t,v=e,y=n,t&&void 0===Z.get(t).__webglFramebuffer&&J.setupRenderTarget(t);let i=null,r=!1,s=!1;if(t){const n=t.texture;(n.isDataTexture3D||n.isDataTexture2DArray)&&(s=!0);const a=Z.get(t).__webglFramebuffer;t.isWebGLCubeRenderTarget?(i=a[e],r=!0):i=t.isWebGLMultisampleRenderTarget?Z.get(t).__webglMultisampledFramebuffer:a,T.copy(t.viewport),A.copy(t.scissor),L=t.scissorTest}else T.copy(N).multiplyScalar(P).floor(),A.copy(B).multiplyScalar(P).floor(),L=z;if(q.bindFramebuffer(36160,i),q.viewport(T),q.scissor(A),q.setScissorTest(L),r){const i=Z.get(t.texture);pt.framebufferTexture2D(36160,36064,34069+e,i.__webglTexture,n)}else if(s){const i=Z.get(t.texture),r=e||0;pt.framebufferTextureLayer(36160,36064,i.__webglTexture,n||0,r)}},this.readRenderTargetPixels=function(t,e,n,i,r,s,a){if(!t||!t.isWebGLRenderTarget)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let o=Z.get(t).__webglFramebuffer;if(t.isWebGLCubeRenderTarget&&void 0!==a&&(o=o[a]),o){q.bindFramebuffer(36160,o);try{const a=t.texture,o=a.format,l=a.type;if(o!==E&&ut.convert(o)!==pt.getParameter(35739))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");const c=l===M&&(W.has("EXT_color_buffer_half_float")||j.i