<!-- SOLID-PLAYTIME · part 161 -->
Capacity=this.mobile?40:128,this.renderer=new $c({antialias:!this.mobile,powerPreference:"high-performance",alpha:!0}),this.renderer.setClearColor(0,0),this.renderer.setPixelRatio(this.basePixelRatio),this.renderer.shadowMap.enabled=!this.mobile,this.renderer.shadowMap.type=Uf,this.renderer.outputColorSpace=Hs,this.renderer.toneMapping=Vo,this.renderer.toneMappingExposure=0.9,this.renderer.domElement.className="world-canvas",this.renderer.domElement.setAttribute("aria-label","Third-person nightmare highlands"),t.appendChild(this.renderer.domElement),this.resizeObserver=new ResizeObserver(()=>this.resize()),this.resizeObserver.observe(t),this.buildWorld(),this.resize(),this.renderer.render(this.scene,this.camera),this.loop=this.loop.bind(this),document.addEventListener("visibilitychange",this.onVisibilityChange),this.qualityWindowStart=performance.now(),this.raf=requestAnimationFrame(this.loop)}mat(t,e=0,n=0.55){return new Pe({color:t,emissive:e,emissiveIntensity:e?1.1:0,roughness:n,metalness:0.22})}glow(t,e=0.8){return new Pn({color:t,transparent:!0,opacity:e,blending:Ye,depthWrite:!1})}mesh(t,e,n,i,s,a){let r=new At(e,n);return r.position.set(i,s,a),t.add(r),r}ground(t,e){return Math.sin(t*0.026)*5+Math.cos(e*0.022)*4+Math.sin((t+e)*0.014)*2.6+Math.max(0,22-Math.hypot(t,e)*0.09)}buildWorld(){this.scene.background=new Xt(16766720),(function(s){try{var h=new Date().getHours();var isDay=h>=6&&h<17;var g=new me();g.setAttribute('position',new tn(new Float32Array([0,200,-300]),3));var col=isDay?16766720:16772846;var sz=isDay?28:18;var m=new Bs({color:col,size:sz,sizeAttenuation:false,transparent:true,opacity:0.95,map:window._roundStarTex});s.add(new ts(g,m));}catch(e){}})(this.scene),this.scene.add(new jo(5003388,65796,0.95));let t=new tl(16764778,1.85);t.position.set(-100,180,80),t.castShadow=!0,t.shadow.mapSize.set(this.mobile?512:1024,this.mobile?512:1024),t.shadow.camera.left=-150,t.shadow.camera.right=150,t.shadow.camera.top=150,t.shadow.camera.bottom=-150,t.shadow.camera.near=20,t.shadow.camera.far=420,t.shadow.bias=-0.0008,this.scene.add(t);let e=new On(65535,32,150);e.position.set(-72,34,100),this.scene.add(e);let n=new On(16711935,27,135);n.position.set(118,27,-92),this.scene.add(n),this.scene.add(this.world,this.trial,this.visionGroup),this.trial.visible=!1,this.visionGroup.visible=!1,this.buildTerrain(),this.buildSky(),this.buildHero(),this.buildCastle(),this.buildFarShore(),le.forEach((i,s)=>this.buildPalace(s)),this.buildSecrets(),this.buildWorldSkin(),this.buildParticlePool(),this.prepareTrials(),this.y=this.ground(this.x,this.z)+0.15,this.hero.position.set(this.x,this.y,this.z),this.scene.add(this.hero),this.camera.position.set(this.x-Math.sin(this.yaw)*11.5,this.y+6.5,this.z-Math.cos(this.yaw)*11.5),this.camera.lookAt(this.x,this.y+2.4,this.z)}buildTerrain(){let t=this.mobile?30:48,e=new qn(540,540,t,t),n=e.getAttribute("position");if(!n)return;let i=[];for(let h=0;h<n.count;h+=1){let p=n.getX(h),v=-n.getY(h),y=this.ground(p,v);n.setZ(h,y);let U=Math.max(0,Math.min(1,(y+8)/34));i.push(0.008+U*0.014,0.01+U*0.016,0.025+U*0.04)}e.setAttribute("color",new Zt(i,3)),e.computeVertexNormals();let s=new At(e,new Pe({vertexColors:!0,roughness:0.9,metalness:0.18,emissive:131850,emissiveIntensity:0.5}));s.rotation.x=-Math.PI/2,s.receiveShadow=!0,this.world.add(s);let a=[];for(let h=0;h<68;h+=1){let p=h*2.399,v=34+h*37%210,y=Math.sin(p)*v,U=Math.cos(p)*v;if(Math.hypot(y,U)<28)continue;if(U>142&&Math.abs(y)<34)continue;a.push({x:y,y:this.ground(y,U),z:U,angle:p,scale:0.86+h%4*0.12})}let r=new Ki(new fn(0.32,0.7,3,5),this.mat(1052450,1772337),a.length),o=new Ki(new Ln(2,6,6),this.mat(399900,11058),a.length),l=new ie,c=new Qn,u=new C,f=new C;a.forEach((h,p)=>{c.setFromAxisAngle(Ne.DEFAULT_UP,h.angle),f.set(h.x,h.y+1.1,h.z),u.set(h.scale,1,h.scale),l.compose(f,c,u),r.setMatrixAt(p,l),f.set(h.x,h.y+4,h.z),u.set(h.scale,h.scale,h.scale),l.compose(f,c,u),o.setMatrixAt(p,l)}),r.instanceMatrix.needsUpdate=!0,o.instanceMatrix.needsUpdate=!0,r.castShadow=!0,o.castShadow=!0,this.world.add(r,o)}buildSky(){let t=new me,e=[];this.starCount=this.mobile?280:780;for(let i=0;i<this.starCount;i+=1){let s=280+Math.random()*120,a=Math.random()*Math.PI*2,r=Math.random()*2-1,o=Math.sqrt(1-r*r);e.push(Math.cos(a)*o*s,r*s*0.62+95,Math.sin(a)*o*s)}t.setAttribute("position",new Zt(e,3)),this.starField=new ts(t,new Bs({color:12516607,size:0.7,transparent:!0,opacity:0.76,blending:Ye,depthWrite:!1,map:window._roundStarTex})),this.scene.add(this.starField);let n=new cn(220,5,5,this.mobile?56:80);[0,1].forEach((i)=>{let s=[0,1,2,3,4].filter((u)=>u%2===i),a=new Ki(n,this.glow(i?16711935:65535,0.025),s.length),r=new ie,o=new Qn,l=new C,c=new C;s.forEach((u,f)=>{let h=(220+u*9)/220;c.set(0,78+u*8,0),o.setFromEuler(new Dn(Math.PI/2.6,0,u*0.23)),l.set(h,h,1+u*0.08),r.compose(c,o,l),a.setMatrixAt(f,r)}),a.instanceMatrix.needsUpdate=!0,this.scene.add(a),this.fiberLayers.push(a)})}limb(t,e,n,i,s,a,r,o){let l=new