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.
TypeScript 2d-game-engine3d3d-game-engineandroidcppecsgame-editorgame-enginegamedeviostypescriptwebassemblywebglwebgpuwechat-minigame
style(camera): the null contract and the mirror note fit the budget too
esengine09603a74f768
diff --git a/sdk/src/camera/Camera.ts b/sdk/src/camera/Camera.tsindex fc7cfd107..5201a476f 100644--- a/sdk/src/camera/Camera.ts+++ b/sdk/src/camera/Camera.ts@@ -62,11 +62,9 @@ export class CameraViewAPI {* drawing an overlay ON an entity (an outline, a gizmo, a screen rect) has to* pass the entity's z or it draws where the entity is not.*- * Null means the point has NO screen position: there is no camera, or it- * stands at or behind the eye, where the perspective divide mirrors it to the- * opposite side of the view. Being outside the viewport is not that — a- * collider or a frustum reaching past the edge still has coordinates there,- * and an overlay clipped to the canvas needs them.+ * Null means the point has NO screen position: no camera, or it stands at or+ * behind the eye, where the divide mirrors it to the far side of the view.+ * Outside the viewport is NOT that, and keeps its coordinates.*/worldToScreen(worldX: number, worldY: number, worldZ = 0): { x: number; y: number } | null {const cam = this.cam();diff --git a/sdk/tests/uiMath.test.ts b/sdk/tests/uiMath.test.tsindex a9139ceea..c250a6d1c 100644--- a/sdk/tests/uiMath.test.ts+++ b/sdk/tests/uiMath.test.ts@@ -617,10 +617,9 @@ describe('projectWorldPoint carries the same third dimension', () => {});describe('projectWorldPoint says whether a point has a screen position at all', () => {- // Behind the eye the divide flips the sign of x, y AND w, so the point comes- // back mirrored through the centre of the view — inside the viewport, on the- // wrong side, and indistinguishable from a real position once w is dropped.- // Every editor overlay that "follows" an entity used to follow that mirror.+ // Behind the eye the divide flips x, y AND w, so the point comes back mirrored+ // through the centre of the view — inside the viewport, on the wrong side, and+ // indistinguishable from a real position once w is dropped.it('rejects a point behind a perspective eye, which the mirror hides', () => {const vp = perspective4(Math.PI / 2, 4 / 3, 0.1, 1000);const centre = 320;