# Atlas：给其他 Agent 的复现提示词

独立实现可旋转、缩放、悬停和搜索国家的3D地球。可复用本目录index.html静态样式/结构与countries.json，Three.js/GSAP及素材在../../atlas-globe/。素材earth-hires.jpg、earth_lights_2048.png、earth_specular_2048.jpg、earth_clouds_1024.png、countries.geojson均在该原目录assets。不要读旧JS，保持本地当前视觉，不能替换地球贴图。

## 场景
WebGLRenderer alpha/antialias、DPR<=2、outputEncoding sRGBEncoding。PerspectiveCamera(30,W/H,.01,100)，初始z=max(6,1/(.82*tan(π/12)*(W/H)))。3000星点：每点随机顺序u=random*2−1、theta=random*2π、r=30+random*20、s=sqrt(1−u²)，position=(cos(theta)*s*r,u*r,sin(theta)*s*r)，aSize=1+random*2.2，aPhase=random*2π，写Float32Array。Points关闭frustumCulled，材质transparent/depthWritefalse。星点vertex闪烁vTw=.72+.28sin(time*1.5+phase)，PointSize=size*DPR*(.92+.25vTw)。fragment core=smoothstep(.5,0,length(gl_PointCoord−.5))，白蓝RGB(.9,.94,1)，alpha=min(1,core²*vTw*1.15)。

地球SphereGeometry(1,128,96)自定义Shader，day/night纹理sRGB，spec/cloud保持原encoding，全部anisotropy=min(8,硬件上限)。sunDir=normalize(.32,.18,.95)。vertex vUv=uv，normalW=normalize(mat3(modelMatrix)*normal)，worldPos=modelMatrix*position，viewDir=normalize(cameraPosition−worldPos)。片元n=normalize(normalW)，sun=normalize(sunDir)，day=smoothstep(−.32,.18,dot(n,sun))，ocean=specTex.r，half=normalize(sun+viewDir)，spec=max(dot(n,half),0)^42*ocean*day。col=dayTex*(.48+1.05day)+nightTex*(1−day)*.5+spec*(.7,.82,1)*.28；col=mix(col,max(col,(.025,.015,.2)),ocean*.65)，pow(max(col,0),.72)；facing=max(dot(n,viewDir),0)，col*=mix(.86,1,smoothstep(0,.5,facing))。

国家纹理sid=红通道*255。match(id)=step(.5,id)*(1−step(.5,abs(sid−id)))；hover=max(match(current)*hoverMix,match(previous)*(1−hoverMix))，select=match(selected)。col=mix(col,(.86,.09,.10),max(hover*.5,select*.62))；col+=select*(1−facing)^3*(.9,.2,.2)*.4，alpha1。

云Sphere(1.006,96,64)，MeshBasicMaterial map=cloud、transparent、opacity.28、depthWritefalse。大气Sphere(1.045,64,48)，BackSide/transparent/depthWritefalse；world normal与viewDir同理，rim=(1−max(dot(normalizeN,normalizeV),0))^2.4，lit=smoothstep(−.5,.35,dot(normalizeN,normalizeSun))，RGB(.36,.58,1)、alpha=rim*(.04+.12lit)。

## 国家ID图
Canvas4096×2048初始化纯黑，CanvasTexture NearestFilter/noMipmaps。GeoJSON按原features顺序，id=i+1，name=NAME||ADMIN||SOVEREIGNT||'—'，iso3=ADM0_A3||ISO_A3||''。每Polygon每环按x=(lon+180)/360*4096、y=(90−lat)/180*2048绘路径并close，用rgb(id,0,0)、fill('evenodd')；MultiPolygon逐Polygon画。imageSmoothingEnabled=false，保存getImageData用于拾取、texture.needsUpdate=true。countryOptions从countries.json所有name生成。

拾取先Raycaster从pointer归一化屏幕坐标打globe；hit.point转globe局部并normalize，lon=atan2(z,−x)、lat=asin(y)，u=lon/2π+.5、v=.5−lat/π；px=clamp(round(u*4096),0,4095)、py=clamp(round(v*2048),0,2047)，返回ID图像素R。

## 输入和状态
lon4.25/lat0/vLon0/vLat0，zoom同初始相机，pointer初始−1/insidefalse。非card/search区域按下开始拖，记lastXY、moved0、capture。move同时更新pointer；拖动时vx=−dx*.005、vy=−dy*.005，lon/lat+=速度，moved+=abs(dx)+abs(dy)。释放/取消结束，moved<6选当前hover国家；leave只insidefalse。wheel preventDefault，zoom=clamp(zoom+deltaY*.0016,2.8,9)。

每帧dt首帧.016、其后min(.05,秒差)，未拖时lon+=vLon、lat+=vLat，再速度*=.92，再lon+=.02dt；lat夹±1.25。globe rotation(lat,lon,−.409)，cloud rotation(lat,lon+now*.000004,−.409)。camera.setLength(zoom+(当前长度−zoom)*.85)，lookAt0；星空time=now/1000。拾取发生在renderer.render之前，保持更新顺序。hover变化时previous=current,current=id，GSAP hoverMix0→1/.28秒power2.out；tip有有效name则on并跟随pointer，否则关闭。

select设置uSelectId；若没有countries[iso3]则关闭card，否则展示name/tagline/前6个places，图片URL=https://motionin.design+place.image、loadinglazy/referrerpolicy no-referrer，配label/blurb。card从opacity0/x18到1/0，.4秒power3.out。✕关闭且selectId0。搜索trim/lowercase、精确匹配国家显示名，change/Enter触发，不转动球定位。resize更新renderer、相机aspect，并重新计算初始zoom。数据与ID图就绪后loading gone、开始帧循环。清理GPU资源、事件、tweens。

验收1440×1000/390×844、16ms固定帧，seed123456 LCG固定星空：640ms初始、(.52W,.49H)悬停640ms、拖(+80,+40)64ms、惯性1000ms、wheel−900后800ms、搜索Japan后600ms、关闭400ms。运行 ../scripts/check-atlas.mjs；地球姿态、星空、ID图、国家状态一致，配对截图逐像素一致。远程景点图片URL与内容被核对，网络可用性不由重写保证。

## 本地图片与中英文（2026-09-21 更新）

本轮已接入本地公开图片和中英双语。复现时同时遵循 [共享规范](../../shared/README.md)：沿用当前本地图片路径，使用共享词典与语言偏好（`zh` / `en`），覆盖动态内容、辅助标签和 Canvas 文字；不要恢复旧的远程图片链接。中文拆字标题应先翻译再拆分，并保持原有动画机制。图片来源与替换映射在共享规范中列出。
