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.

fix(camera): one-to-one means the render target IS the destination, not merely its size

yhh0e8cf138b5e3
diff --git a/sdk/src/camera/presentPlan.ts b/sdk/src/camera/presentPlan.ts
index e543ad91d..912dfaf0f 100644
--- a/sdk/src/camera/presentPlan.ts
+++ b/sdk/src/camera/presentPlan.ts
@@ -50,7 +50,12 @@ export interface PresentPlan {
y: number;
width: number;
height: number;
- /** True when render size equals the destination rect — the present is a no-op copy. */
+ /**
+ * True when the render target IS the destination: same size AND covering the
+ * whole surface. Not merely "the same size" — a whole-multiple of 1 that sits
+ * letterboxed inside a larger surface still has to be placed and the rest
+ * cleared, so calling that a no-op drops the bars.
+ */
oneToOne: boolean;
}
@@ -128,7 +133,7 @@ export function planPresent(
renderWidth, renderHeight,
x: Math.floor((sw - w) / 2), y: Math.floor((sh - h) / 2),
width: w, height: h,
- oneToOne: k === 1,
+ oneToOne: k === 1 && w === sw && h === sh,
};
}
}
diff --git a/sdk/tests/present-plan.test.ts b/sdk/tests/present-plan.test.ts
index dc8cbf584..ddf5d56ba 100644
--- a/sdk/tests/present-plan.test.ts
+++ b/sdk/tests/present-plan.test.ts
@@ -110,9 +110,9 @@ describe('planPresent — IntegerMultiple', () => {
expect(plan.height).toBe(540);
expect(plan.y).toBe(180);
expect(plan.x).toBe((1600 - plan.width) / 2);
- // At 1x the present does not scale at all, so no filter question arises —
- // a 1:1 blit lands on texel centres whatever the sampler says.
- expect(plan.oneToOne).toBe(true);
+ // NOT one-to-one: the sizes match but the rect does not cover the surface,
+ // and a plan that called this a no-op would drop the bars it just asked for.
+ expect(plan.oneToOne).toBe(false);
});
it('the whole-multiple rect is exactly k times the render size, both axes', () => {
diff --git a/src/esengine/renderer/frame/PostProcessPipeline.hpp b/src/esengine/renderer/frame/PostProcessPipeline.hpp
index f1fbf8e9a..12ca16652 100644
--- a/src/esengine/renderer/frame/PostProcessPipeline.hpp
+++ b/src/esengine/renderer/frame/PostProcessPipeline.hpp
@@ -217,6 +217,10 @@ public:
&& (output_vp_w_ != width_ || output_vp_h_ != height_);
}
+ // KNOWN GAP: a 1x letterbox is same-size-but-OFFSET, indistinguishable here
+ // from a split-screen viewport — engaging on offset alone would put a blit
+ // under every split-screen camera. Closing it needs the surface size.
+
/**
* @brief Whether the present is a whole-multiple upscale of the chain.
*