Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

test(render): the render host can turn the policy on, and the frame changes

yhh513efa2ffb15
diff --git a/tools/render-host/host.ts b/tools/render-host/host.ts
index 641ef7e9d..65bea96be 100644
--- a/tools/render-host/host.ts
+++ b/tools/render-host/host.ts
@@ -42,6 +42,14 @@ const outputTransform = params.get('outputTransform') === 'aces' ? 'aces' : unde
const seedParam = params.get('seed');
const randomSeed = seedParam !== null && Number.isFinite(Number(seedParam)) ? Number(seedParam) : undefined;
const depthLayers = Number(params.get('depthLayers')) || undefined;
+// The project's render-resolution policy (RenderResolution). Passed with the fit
+// OFF, so the camera keeps its authored orthoSize and the frame differs by the
+// policy alone — which is what a gate about the policy has to isolate.
+const renderPolicy = Number(params.get('renderResolution')) || undefined;
+const screenFit = renderPolicy === undefined ? undefined : {
+ designWidth: width, designHeight: height,
+ scaleMode: -1, matchWidthOrHeight: 0.5, renderPolicy,
+};
let app: App | null = null;
let profiler: ProfileRecorder | null = null;
@@ -129,6 +137,7 @@ async function boot(): Promise<void> {
outputTransform,
randomSeed,
depthLayers,
+ screenFit,
getViewportSize: () => ({ width: canvas!.width, height: canvas!.height }),
wasmBaseUrl: '/wasm',
});
diff --git a/tools/render-host/run.mjs b/tools/render-host/run.mjs
index 17d7e0a0e..286eafe22 100644
--- a/tools/render-host/run.mjs
+++ b/tools/render-host/run.mjs
@@ -20,6 +20,8 @@
* ESTELLA_VERIFY_GRID editor-grid on/off pixel-diff assertion (value = spacing)
* ESTELLA_VERIFY_GRID_EXPECT what that diff must be: "frame" (default) or "nothing"
* ESTELLA_VERIFY_DEPTH_LAYERS bitmask of layers resolved by depth (2.5D)
+ * ESTELLA_VERIFY_RENDER_RESOLUTION render at the scene's own resolution and
+ * scale the finished image (1 = design, 2 = integer)
* ESTELLA_VERIFY_PREFAB .esprefab instantiated into the scene after load
* ESTELLA_VERIFY_SET_FIELD one inspector field written after load (JSON)
* ESTELLA_VERIFY_PICK hit-test a viewport point, asserting the entity (JSON)
@@ -85,6 +87,9 @@ const SEED = process.env.ESTELLA_VERIFY_SEED ?? '';
const SCALE = process.env.ESTELLA_VERIFY_SCALE ?? '';
// ESTELLA_VERIFY_DEPTH_LAYERS=<mask> turns layers into depth-resolved ones (2.5D).
const DEPTH_LAYERS = process.env.ESTELLA_VERIFY_DEPTH_LAYERS ?? '';
+// ESTELLA_VERIFY_RENDER_RESOLUTION=<RenderResolution> renders the scene at its own
+// resolution and scales the finished image to the surface (1 = design, 2 = integer).
+const RENDER_RESOLUTION = process.env.ESTELLA_VERIFY_RENDER_RESOLUTION ?? '';
// Headless / GPU-less (CI) WebGL2 falls back to SwiftShader; harmless with a GPU.
app.commandLine.appendSwitch('enable-unsafe-swiftshader');
@@ -179,7 +184,7 @@ app.whenReady().then(async () => {
let server;
try {
server = await serveHost(DIST);
- const url = `http://127.0.0.1:${server.address().port}/${PAGE}?w=${W}&h=${H}&backend=${BACKEND}${COLORSPACE ? `&colorSpace=${COLORSPACE}` : ''}${OUTPUT_TRANSFORM ? `&outputTransform=${OUTPUT_TRANSFORM}` : ''}${DEPTH_LAYERS ? `&depthLayers=${DEPTH_LAYERS}` : ''}${SEED ? `&seed=${SEED}` : ''}`;
+ const url = `http://127.0.0.1:${server.address().port}/${PAGE}?w=${W}&h=${H}&backend=${BACKEND}${COLORSPACE ? `&colorSpace=${COLORSPACE}` : ''}${OUTPUT_TRANSFORM ? `&outputTransform=${OUTPUT_TRANSFORM}` : ''}${DEPTH_LAYERS ? `&depthLayers=${DEPTH_LAYERS}` : ''}${RENDER_RESOLUTION ? `&renderResolution=${RENDER_RESOLUTION}` : ''}${SEED ? `&seed=${SEED}` : ''}`;
// useContentSize: the capture rectangle must be the page area, not the
// outer frame (the same trap the parity runner documents).