Skip to content

Official Codebase of 3DCodeVerse

Python

runtime_js: backdrop's one-drawable box is drawableBox — it shared the name worldBox with census.mjs's subtree box, with the arguments the other way round

gaoypeng1f6935480c32
diff --git a/harness/runtime_js/lib/backdrop.mjs b/harness/runtime_js/lib/backdrop.mjs
index 86d15314..ab0b91b3 100644
--- a/harness/runtime_js/lib/backdrop.mjs
+++ b/harness/runtime_js/lib/backdrop.mjs
@@ -40,7 +40,7 @@ export function nonSolid(mesh) {
}
/** World-space AABB of a drawable (a fresh THREE.Box3), or null when it has none. */
-export function worldBox(o, THREE) {
+export function drawableBox(o, THREE) {
if (!o.geometry) return null;
if (!o.geometry.boundingBox) o.geometry.computeBoundingBox();
const gb = o.geometry.boundingBox;
diff --git a/harness/runtime_js/lib/host_census.mjs b/harness/runtime_js/lib/host_census.mjs
index 6617ea6d..dc026957 100644
--- a/harness/runtime_js/lib/host_census.mjs
+++ b/harness/runtime_js/lib/host_census.mjs
@@ -6,7 +6,7 @@
* overlap statistics. Returns plain JSON.
*/
-import { classifyBackdrop, worldBox } from './backdrop.mjs';
+import { classifyBackdrop, drawableBox } from './backdrop.mjs';
import { geometryTriangles as triCount } from './census.mjs';
import { placementTable } from './host_placement.mjs';
@@ -79,7 +79,7 @@ function walkGroup(root, THREE) {
tris += triCount(o.geometry) * count;
const mats = Array.isArray(o.material) ? o.material : [o.material];
if (mats.some((m) => isCustomShader(m, THREE))) custom += 1;
- let mb = worldBox(o, THREE);
+ let mb = drawableBox(o, THREE);
if (!mb) return;
if (o.isInstancedMesh) {
const gb = o.geometry.boundingBox;
diff --git a/harness/runtime_js/lib/host_coverage.mjs b/harness/runtime_js/lib/host_coverage.mjs
index 289abcdb..20157b5a 100644
--- a/harness/runtime_js/lib/host_coverage.mjs
+++ b/harness/runtime_js/lib/host_coverage.mjs
@@ -11,7 +11,7 @@
* the content bbox (scatter across the whole ground) as backdrop.
*/
-import { classifyBackdrop, nonSolid, worldBox } from './backdrop.mjs';
+import { classifyBackdrop, nonSolid, drawableBox } from './backdrop.mjs';
import { sampleFrame } from './host_metrics.mjs';
@@ -20,7 +20,7 @@ function collectDrawables(scene, THREE, contentSpan) {
scene.traverse((o) => {
if (!o.visible) return;
if (!(o.isMesh || o.isPoints || o.isLine || o.isSprite)) return;
- const box = worldBox(o, THREE);
+ const box = drawableBox(o, THREE);
if (box) out.push({ obj: o, kind: classifyBackdrop(o, box, contentSpan) });
});
return out;
diff --git a/harness/runtime_js/lib/host_metrics.mjs b/harness/runtime_js/lib/host_metrics.mjs
index cfde63a2..784529c4 100644
--- a/harness/runtime_js/lib/host_metrics.mjs
+++ b/harness/runtime_js/lib/host_metrics.mjs
@@ -3,7 +3,7 @@
* readback of the render canvas and near-geometry tests for a camera.
*/
-import { GROUND_NAME_RE, classifyBackdrop, nonSolid, worldBox } from './backdrop.mjs';
+import { GROUND_NAME_RE, classifyBackdrop, nonSolid, drawableBox } from './backdrop.mjs';
export const SAMPLE_W = 96;
export const SAMPLE_H = 54;
@@ -143,7 +143,7 @@ export function nearGeometry(scene, camera, THREE, limitM = 0.3, lookAt = null)
const groundMeshes = [];
for (const o of targets) {
if (o.isInstancedMesh) continue;
- const box = worldBox(o, THREE);
+ const box = drawableBox(o, THREE);
if (!box) continue;
const s = box.getSize(new THREE.Vector3());
// terrain overhead must also be NAMED as ground: a 40 m 'Ceiling' is ground-shaped to the
diff --git a/harness/runtime_js/lib/scene_host.mjs b/harness/runtime_js/lib/scene_host.mjs
index 790d440e..782c575b 100644
--- a/harness/runtime_js/lib/scene_host.mjs
+++ b/harness/runtime_js/lib/scene_host.mjs
@@ -20,7 +20,7 @@ import { sceneCensus } from './host_census.mjs';
import { settleScene } from './host_placement.mjs';
import { frameStats, nearGeometry, repairCameraSpec } from './host_metrics.mjs';
import { frameCoverage, glbCoverage } from './host_coverage.mjs';
-import { classifyBackdrop, nonSolid, worldBox } from './backdrop.mjs';
+import { classifyBackdrop, nonSolid, drawableBox } from './backdrop.mjs';
import { installShaderErrorHook } from './host_shader_errors.mjs';
import { attributeErrors, captured, captureMaterialSources, materialAudit } from './host_compile.mjs';
import { makeRenderer, rendererString } from './browser/renderer.js';
@@ -150,7 +150,7 @@ function geometryBoxes(scene) {
scene.traverse((o) => {
if (!o.geometry || !o.geometry.uuid || !(o.isMesh || o.isInstancedMesh)) return;
if (!used.has(o.geometry.uuid)) used.set(o.geometry.uuid, new THREE.Box3());
- const box = worldBox(o, THREE);
+ const box = drawableBox(o, THREE);
if (box) used.get(o.geometry.uuid).union(box);
});
return used;
@@ -511,12 +511,12 @@ function skyLayersBelow(eye) {
state.scene.traverse((o) => {
if (!(o.isMesh || o.isInstancedMesh) || !o.visible || !o.geometry) return;
if (o.parent && o.parent.name === 'RoomShell' && /^Ceiling/.test(o.name || '')) {
- const box = worldBox(o, THREE);
+ const box = drawableBox(o, THREE);
if (box && box.max.y < eye.y) out.push(o);
return;
}
if (!nonSolid(o)) return;
- const box = worldBox(o, THREE);
+ const box = drawableBox(o, THREE);
if (!box) return;
if (o.frustumCulled === false && o.geometry.isInstancedBufferGeometry) {
// an instanced billboard deck keeps its quad at the origin and offsets it in the shader: