From f9a44ec74e4e98c3529d685bb9fb2cae9d69bf20 Mon Sep 17 00:00:00 2001 From: Nagi-ovo <101612750+Nagi-ovo@users.noreply.github.com> Date: Sun, 14 Jun 2026 23:48:10 +0100 Subject: [PATCH] Fix GLM-5 Turbo mythos startup Co-authored-by: Codex --- models/glm-5-turbo.json | 8 ++++---- .../glm-5-turbo/zcode-thinking/mythos-craft-2.html | 10 ++++++---- .../glm-5-turbo/zcode-thinking/mythos-craft.html | 14 ++++++++++---- 3 files changed, 20 insertions(+), 12 deletions(-) diff --git a/models/glm-5-turbo.json b/models/glm-5-turbo.json index a13212d..47c988c 100644 --- a/models/glm-5-turbo.json +++ b/models/glm-5-turbo.json @@ -10,16 +10,16 @@ { "file": "mythos-craft.html", "note": { - "zh": "在 ZCode 中以 GLM-5 Turbo(Thinking 思考配额)一次生成;本页为未经修改的原始 HTML 产出。", - "en": "Generated in one shot by GLM-5 Turbo (Thinking effort) inside ZCode; unmodified original HTML output." + "zh": "在 ZCode 中以 GLM-5 Turbo(Thinking 思考配额)一次生成。原始 HTML 因脚本括号错误、缺少 Game 初始化和缺少收尾标签而无法进入;Codex 仅修复这些启动接线问题,未改动玩法或视觉设计。", + "en": "Generated in one shot by GLM-5 Turbo (Thinking effort) inside ZCode. The original HTML could not enter the game because of script-brace errors, missing Game initialization, and missing closing tags; Codex only fixed those startup wiring issues, without changing gameplay or visual design." }, "contributor": "Nagi-ovo" }, { "file": "mythos-craft-2.html", "note": { - "zh": "在 ZCode 中以 GLM-5 Turbo(Thinking 思考配额)一次生成的第二个 HTML 版本;本页为未经修改的原始 HTML 产出。", - "en": "Second HTML variant generated in one shot by GLM-5 Turbo (Thinking effort) inside ZCode; unmodified original HTML output." + "zh": "在 ZCode 中以 GLM-5 Turbo(Thinking 思考配额)一次生成的第二个 HTML 版本。原始 HTML 因雾效参数在 shader 编译后才初始化、且点击事件被 loading 覆盖层挡住而无法进入;Codex 仅修复这些启动/加载问题,未改动玩法或视觉设计。", + "en": "Second HTML variant generated in one shot by GLM-5 Turbo (Thinking effort) inside ZCode. The original HTML could not enter because fog parameters were initialized after shader compilation and the loading overlay blocked the click handler; Codex only fixed those startup/loading issues, without changing gameplay or visual design." }, "contributor": "Nagi-ovo" } diff --git a/outputs/glm-5-turbo/zcode-thinking/mythos-craft-2.html b/outputs/glm-5-turbo/zcode-thinking/mythos-craft-2.html index 4d21d9d..abe2e9e 100644 --- a/outputs/glm-5-turbo/zcode-thinking/mythos-craft-2.html +++ b/outputs/glm-5-turbo/zcode-thinking/mythos-craft-2.html @@ -669,8 +669,8 @@ class GL{ this.cv=cv;this.gl=cv.getContext('webgl',{alpha:false,antialias:false,alphaPremultiplied:false}); if(!this.gl){alert('WebGL不可用');return} const g=this.gl;g.getExtension('OES_element_index_uint'); - this.resize();this.initShaders();this.initState(); this.fogN=(RD-1)*CS;this.fogF=RD*CS; + this.resize();this.initShaders();this.initState(); } resize(){ const dpr=Math.min(devicePixelRatio,1.5); @@ -762,7 +762,7 @@ class Game{ } setupInput(){ const cv=this.cv; - cv.addEventListener('click',()=>{ + const enter=()=>{ if(!document.pointerLockElement){ cv.requestPointerLock(); document.getElementById('loading').classList.add('hiding'); @@ -772,7 +772,9 @@ class Game{ document.getElementById('info').classList.remove('hidden'); if(!this.running)this.start(); }else{this.breakBlock()} - }); + }; + cv.addEventListener('click',enter); + document.getElementById('loading').addEventListener('click',enter); document.addEventListener('mousemove',e=>{ if(!document.pointerLockElement)return; this.cam.yaw+=e.movementX*.002;this.cam.pitch-=e.movementY*.002; @@ -948,4 +950,4 @@ window.addEventListener('load',()=>{ }); - \ No newline at end of file + diff --git a/outputs/glm-5-turbo/zcode-thinking/mythos-craft.html b/outputs/glm-5-turbo/zcode-thinking/mythos-craft.html index d7bee7f..da99c5b 100644 --- a/outputs/glm-5-turbo/zcode-thinking/mythos-craft.html +++ b/outputs/glm-5-turbo/zcode-thinking/mythos-craft.html @@ -51,7 +51,7 @@ canvas{display:block} // ============ PERLIN NOISE ============ const PerlinNoise=(()=>{const p=[];for(let i=0;i<256;i++)p[i]=i;for(let i=255;i>0;i--){const j=Math.floor(Math.random()*(i+1));[p[i],p[j]]=[p[j],p[i]]}const perm=new Array(512);for(let i=0;i<512;i++)perm[i]=p[i&255];const fade=t=>t*t*t*(t*(t*6-15)+10);const lerp=(a,b,t)=>a+t*(b-a);const grad=(hash,x,y,z)=>{const h=hash&15;const u=h<8?x:y;const v=h<4?y:(h===12||h===14?x:z);return((h&1)===0?u:-u)+((h&2)===0?v:-v)}; -return{noise(x,y,z){z=z||0;const X=Math.floor(x)&255,Y=Math.floor(y)&255,Z=Math.floor(z)&255;x-=Math.floor(x);y-=Math.floor(y);z-=Math.floor(z);const u=fade(x),v=fade(y),w=fade(z);const A=perm[X]+Y,AA=perm[A]+Z,AB=perm[A+1]+Z,B=perm[X+1]+Y,BA=perm[B]+Z,BB=perm[B+1]+Z;return lerp(lerp(lerp(grad(perm[AA],x,y,z),grad(perm[BA],x-1,y,z),u),lerp(grad(perm[AB],x,y-1,z),grad(perm[BB],x-1,y-1,z),u),v),lerp(lerp(grad(perm[AA+1],x,y,z-1),grad(perm[BA+1],x-1,y,z-1),u),lerp(grad(perm[AB+1],x,y-1,z-1),grad(perm[BB+1],x-1,y-1,z-1),u),v),w)},fbm(x,y,z,octaves,lacunarity,gain){let sum=0,amp=1,freq=1,max=0;for(let i=0;ih)block=B.WATER; if(y>=3&&y=ATLAS_SIZE?1:0); const faceColor=BLOCK_COLORS[block]?BLOCK_COLORS[block][face.face]:[128,128,128];const brightness=face.face==='top'?1.0:face.face==='side'?(face.dir[0]>0?0.8:face.dir[0]<0?0.7:face.dir[2]>0?0.9:0.75):0.6; face.corners.forEach((corner,i)=>{positions.push(wx+corner[0],ly+corner[1],wz+corner[2]);normals.push(face.dir[0],face.dir[1],face.dir[2]);const u=(atlasX+(face.uv[i][0]))/ATLAS_SIZE;const v=(atlasY+(face.uv[i][1]))/ATLAS_SIZE;uvs.push(u,v);colors.push(faceColor[0]/255*brightness,faceColor[1]/255*brightness,faceColor[2]/255*brightness)}); -indices.push(vtxCount,vtxCount+1,vtxCount+2,vtxCount,vtxCount+2,vtxCount+3);vtxCount+=4})}) +indices.push(vtxCount,vtxCount+1,vtxCount+2,vtxCount,vtxCount+2,vtxCount+3);vtxCount+=4})} if(positions.length===0)return null; const geo=new THREE.BufferGeometry();geo.setAttribute('position',new THREE.Float32BufferAttribute(positions,3));geo.setAttribute('normal',new THREE.Float32BufferAttribute(normals,3));geo.setAttribute('uv',new THREE.Float32BufferAttribute(uvs,2));geo.setAttribute('color',new THREE.Float32BufferAttribute(colors,3));geo.setIndex(indices);return geo} @@ -287,4 +287,10 @@ this.updateChunks();this.updateHUD();this.renderer.render(this.scene,this.camera start(){const pcx=Math.floor(this.player.position.x/CHUNK_SIZE);const pcz=Math.floor(this.player.position.z/CHUNK_SIZE); for(let dx=-RENDER_DISTANCE;dx<=RENDER_DISTANCE;dx++)for(let dz=-RENDER_DISTANCE;dz<=RENDER_DISTANCE;dz++){this.world.generateChunk(pcx+dx,pcz+dz)} const h=this.world.getHeight(8,8);this.player.position.set(8,h+3,8); -this.animate()}} \ No newline at end of file +this.animate()}} + +let game; +window.addEventListener('load',()=>{game=new Game();game.start()}); + + +