Skip to content

Official Codebase of 3DCodeVerse

Python

runtime_js: the probe's placement() asks sceneCensus for the table — the {placement: true} option was test-only while the host recomputed the same call by hand

gaoypeng34da7eafe4cb
diff --git a/harness/runtime_js/lib/host_census.mjs b/harness/runtime_js/lib/host_census.mjs
index 41cfca70..6617ea6d 100644
--- a/harness/runtime_js/lib/host_census.mjs
+++ b/harness/runtime_js/lib/host_census.mjs
@@ -132,7 +132,7 @@ function overlapStats(groups) {
/** Walk `scene` and return the census JSON. `opts.placement` (default off — the
* render driver calls this per frame set) adds the per-asset placement table of
- * `host_placement.mjs` under `placement`; the probe driver asks for it separately. */
+ * `host_placement.mjs` under `placement`: the probe's `placement()` asks for it. */
export function sceneCensus(scene, THREE, opts = {}) {
scene.updateMatrixWorld(true);
const groups = [];
diff --git a/harness/runtime_js/lib/scene_host.mjs b/harness/runtime_js/lib/scene_host.mjs
index 6a0cf20d..790d440e 100644
--- a/harness/runtime_js/lib/scene_host.mjs
+++ b/harness/runtime_js/lib/scene_host.mjs
@@ -17,7 +17,7 @@
import * as THREE from 'three';
import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js';
import { sceneCensus } from './host_census.mjs';
-import { placementTable, settleScene } from './host_placement.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';
@@ -638,8 +638,7 @@ function fps(seconds, spec) {
/** Per-asset placement table (host_placement.mjs) — never throws: a failure is `{error}`. */
function placement() {
try {
- const c = sceneCensus(state.scene, THREE);
- return placementTable(state.scene, THREE, { groundY: c.ground_y, contentBox: c.content_bbox });
+ return sceneCensus(state.scene, THREE, { placement: true }).placement;
} catch (e) {
return { error: String((e && e.message) || e).slice(0, 400) };
}