Spaces:
Running
Running
v1.32.48 renderer diagnostic + terrain fallback
Browse files- src/engine/terrain.js +17 -0
src/engine/terrain.js
CHANGED
|
@@ -398,6 +398,23 @@ function terrainSelfHeal(){
|
|
| 398 |
}catch(e){ console.warn('terrain: self-heal failed',e); }
|
| 399 |
return false;
|
| 400 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 401 |
function drawTerrain(){
|
| 402 |
if(terrainStale()&&!terrainSelfHeal()) return;
|
| 403 |
if(!terrVAO) return;
|
|
|
|
| 398 |
}catch(e){ console.warn('terrain: self-heal failed',e); }
|
| 399 |
return false;
|
| 400 |
}
|
| 401 |
+
/* Draw the terrain with the MODEL program. Only used when the terrain's own
|
| 402 |
+
program failed to build on this GPU — see the call site in render3d.js. The
|
| 403 |
+
VAO is already in the model layout, so this is a bind and a draw; what is
|
| 404 |
+
lost is the painted map texture, not the geometry. */
|
| 405 |
+
function drawTerrainFallback(){
|
| 406 |
+
if(terrainStale()&&!terrainSelfHeal()) return;
|
| 407 |
+
if(!terrVAO||typeof prog3D==='undefined'||!prog3D) return;
|
| 408 |
+
gl.bindVertexArray(terrVAO);
|
| 409 |
+
gl.drawElements(gl.TRIANGLES,terrIdxCount,gl.UNSIGNED_INT,0);
|
| 410 |
+
drawCalls++; triCount+=terrIdxCount/3;
|
| 411 |
+
if(terrEdgeVAO&&terrEdgeIdxCount){
|
| 412 |
+
gl.bindVertexArray(terrEdgeVAO);
|
| 413 |
+
gl.drawElements(gl.TRIANGLES,terrEdgeIdxCount,gl.UNSIGNED_INT,0);
|
| 414 |
+
drawCalls++;
|
| 415 |
+
}
|
| 416 |
+
gl.bindVertexArray(null);
|
| 417 |
+
}
|
| 418 |
function drawTerrain(){
|
| 419 |
if(terrainStale()&&!terrainSelfHeal()) return;
|
| 420 |
if(!terrVAO) return;
|