@flighthq/render 0.5.1-next.920.da8f530 → 0.5.1-next.973.788d3d7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -13,5 +13,5 @@ Import the supported application-facing API from `@flighthq/render`. The `@fligh
13
13
  This package is part of the locked-version Flight SDK graph. Applications may instead install and import `@flighthq/sdk` when package-level tree shaking is sufficient.
14
14
 
15
15
  - [Flight project](https://github.com/flighthq/flight)
16
- - [Source for @flighthq/render@0.5.1-next.920.da8f530](https://github.com/flighthq/flight/tree/da8f530894916f9baa6a9f6822b4f393b9e70a85/packages/render)
17
- - [License](https://github.com/flighthq/flight/blob/da8f530894916f9baa6a9f6822b4f393b9e70a85/LICENSE.md)
16
+ - [Source for @flighthq/render@0.5.1-next.973.788d3d7](https://github.com/flighthq/flight/tree/788d3d7375cca3a0233cecedda1a4e031bd26dec/packages/render)
17
+ - [License](https://github.com/flighthq/flight/blob/788d3d7375cca3a0233cecedda1a4e031bd26dec/LICENSE.md)
@@ -20,7 +20,6 @@ export * from './renderTransform2d';
20
20
  export * from './renderViewport';
21
21
  export * from './sceneRender';
22
22
  export { SCENE2D_WORKING_COLOR_SPACE } from './scene2dWorkingColorSpace';
23
- export { initializeRenderViewport2D } from './renderViewport';
24
23
  export { initializeRenderProxy } from './renderProxy';
25
24
  export { initializeRenderCache, initializeRenderCacheAdapter } from './renderCache';
26
25
  export { initializeRenderQueue } from './renderQueue';
@@ -1 +1 @@
1
- {"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB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B,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,4BAA4B,EAAE,MAAM,eAAe,CAAC;AACpF,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC"}
package/dist/contract.js CHANGED
@@ -20,7 +20,6 @@ export * from './renderTransform2d';
20
20
  export * from './renderViewport';
21
21
  export * from './sceneRender';
22
22
  export { SCENE2D_WORKING_COLOR_SPACE } from './scene2dWorkingColorSpace';
23
- export { initializeRenderViewport2D } from './renderViewport';
24
23
  export { initializeRenderProxy } from './renderProxy';
25
24
  export { initializeRenderCache, initializeRenderCacheAdapter } from './renderCache';
26
25
  export { initializeRenderQueue } from './renderQueue';
@@ -1 +1 @@
1
- {"version":3,"file":"contract.js","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,OAAO,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struction, Matrix, Rectangle, RenderProxy2D, RenderViewport2D } from '@flighthq/types/contract';
1
+ import type { Matrix, Rectangle, RenderProxy2D, Viewport } from '@flighthq/types/contract';
2
2
  export declare function computeRenderProxyWorldBounds(out: Pick<Rectangle, 'x' | 'y' | 'width' | 'height'>, source: unknown): boolean;
3
- export declare function createRenderViewport2D(x: number, y: number, width: number, height: number): RenderViewport2D;
4
- export declare function initializeRenderViewport2D(out: EntityConstruction<RenderViewport2D>, x: number, y: number, width: number, height: number): void;
5
- export declare function isRenderableInViewport(source: unknown, viewport: Readonly<RenderViewport2D>, renderTransform2D?: Readonly<Matrix> | null): boolean;
6
- export declare function isRenderProxyInViewport(proxy: Readonly<RenderProxy2D>, viewport: Readonly<RenderViewport2D>, renderTransform2D?: Readonly<Matrix> | null): boolean;
3
+ export declare function isRenderableInViewport(source: unknown, viewport: Readonly<Viewport>, renderTransform2D?: Readonly<Matrix> | null): boolean;
4
+ export declare function isRenderProxyInViewport(proxy: Readonly<RenderProxy2D>, viewport: Readonly<Viewport>, renderTransform2D?: Readonly<Matrix> | null): boolean;
7
5
  //# sourceMappingURL=renderViewport.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"renderViewport.d.ts","sourceRoot":"","sources":["../src/renderViewport.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,kBAAkB,EAClB,MAAM,EACN,SAAS,EACT,aAAa,EACb,gBAAgB,EAEjB,MAAM,0BAA0B,CAAC;AAKlC,wBAAgB,6BAA6B,CAC3C,GAAG,EAAE,IAAI,CAAC,SAAS,EAAE,GAAG,GAAG,GAAG,GAAG,OAAO,GAAG,QAAQ,CAAC,EACpD,MAAM,EAAE,OAAO,GACd,OAAO,CAQT;AAED,wBAAgB,sBAAsB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,gBAAgB,CAI5G;AAGD,wBAAgB,0BAA0B,CACxC,G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4 @@
1
- import { allocateEntity, finishEntity } from '@flighthq/entity/contract';
1
+ import { getEntityRuntime, hasEntityRuntime } from '@flighthq/entity/contract';
2
2
  import { createRectangle, matrixTransformRectangle } from '@flighthq/geometry/contract';
3
3
  import { getNodeWorldBoundsRectangle } from '@flighthq/node/contract';
4
4
  // Writes the world-space axis-aligned bounding box of `source` into `out`. Returns true when
@@ -14,18 +14,6 @@ export function computeRenderProxyWorldBounds(out, source) {
14
14
  out.height = worldBounds.height;
15
15
  return true;
16
16
  }
17
- export function createRenderViewport2D(x, y, width, height) {
18
- const out = allocateEntity();
19
- initializeRenderViewport2D(out, x, y, width, height);
20
- return finishEntity(out);
21
- }
22
- // Allocates and returns a new RenderViewport2D with the given screen-space region.
23
- export function initializeRenderViewport2D(out, x, y, width, height) {
24
- out.height = height;
25
- out.width = width;
26
- out.x = x;
27
- out.y = y;
28
- }
29
17
  // Returns true when `source` may be visible within `viewport`. Conservative: returns true when
30
18
  // the source carries no spatial traits (bounds unknown). When spatial bounds are available, uses
31
19
  // an inclusive overlap test on all four edges so that a zero-size object touching any viewport
@@ -58,7 +46,12 @@ export function isRenderProxyInViewport(proxy, viewport, renderTransform2D) {
58
46
  // Nodes that pass through createRenderProxy2D carry both HasTransform2D and HasBoundsRectangle,
59
47
  // making them Spatial2DNode — the bounds runtime is guaranteed present.
60
48
  function isSpatial2DNode(source) {
61
- return source !== null && typeof source === 'object' && 'pivotX' in source && 'skewX' in source;
49
+ if (source === null || typeof source !== 'object')
50
+ return false;
51
+ if (!hasEntityRuntime(source))
52
+ return false;
53
+ const runtime = getEntityRuntime(source);
54
+ return typeof runtime.computeLocalBoundsRectangle === 'function' && 'worldMatrix' in runtime;
62
55
  }
63
56
  // Module-level scratch rectangles used by isRenderableInViewport to avoid allocation on every call.
64
57
  const _scratchBounds = createRectangle();
@@ -1 +1 @@
1
- {"version":3,"file":"renderViewport.js","sourceRoot":"","sources":["../src/renderViewport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,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AAC;IACtF,MAAM,OAAO,GAAG,gBAAgB,CAAC,MAAgD,CAEhF,CAAC;IACF,OAAO,OAAO,OAAO,CAAC,2BAA2B,KAAK,UAAU,IAAI,aAAa,IAAI,OAAO,CAAC;AAC/F,CAAC;AAED,oGAAoG;AACpG,MAAM,cAAc,GAAG,eAAe,EAAE,CAAC;AACzC,MAAM,mBAAmB,GAAG,eAAe,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flighthq/render",
3
- "version": "0.5.1-next.920.da8f530",
3
+ "version": "0.5.1-next.973.788d3d7",
4
4
  "author": "Joshua Granick and other contributors",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -38,17 +38,17 @@
38
38
  "clean:dist": "tsx ../../scripts/clean-package-dist.ts"
39
39
  },
40
40
  "dependencies": {
41
- "@flighthq/adjustments": "0.5.1-next.920.da8f530",
42
- "@flighthq/color": "0.5.1-next.920.da8f530",
43
- "@flighthq/entity": "0.5.1-next.920.da8f530",
44
- "@flighthq/geometry": "0.5.1-next.920.da8f530",
45
- "@flighthq/log": "0.5.1-next.920.da8f530",
46
- "@flighthq/materials": "0.5.1-next.920.da8f530",
47
- "@flighthq/mesh": "0.5.1-next.920.da8f530",
48
- "@flighthq/node": "0.5.1-next.920.da8f530",
49
- "@flighthq/registry": "0.5.1-next.920.da8f530",
50
- "@flighthq/signals": "0.5.1-next.920.da8f530",
51
- "@flighthq/types": "0.5.1-next.920.da8f530"
41
+ "@flighthq/adjustments": "0.5.1-next.973.788d3d7",
42
+ "@flighthq/color": "0.5.1-next.973.788d3d7",
43
+ "@flighthq/entity": "0.5.1-next.973.788d3d7",
44
+ "@flighthq/geometry": "0.5.1-next.973.788d3d7",
45
+ "@flighthq/log": "0.5.1-next.973.788d3d7",
46
+ "@flighthq/materials": "0.5.1-next.973.788d3d7",
47
+ "@flighthq/mesh": "0.5.1-next.973.788d3d7",
48
+ "@flighthq/node": "0.5.1-next.973.788d3d7",
49
+ "@flighthq/registry": "0.5.1-next.973.788d3d7",
50
+ "@flighthq/signals": "0.5.1-next.973.788d3d7",
51
+ "@flighthq/types": "0.5.1-next.973.788d3d7"
52
52
  },
53
53
  "devDependencies": {
54
54
  "@flighthq/camera": "*",
@@ -1,22 +1,17 @@
1
1
  import { createMatrix, createRectangle } from '@flighthq/geometry/contract';
2
2
  import {
3
3
  addNodeChild,
4
+ createViewport,
4
5
  getNodeRuntime,
5
6
  invalidateNodeLocalBounds,
6
7
  invalidateNodeLocalTransform,
7
8
  } from '@flighthq/node/contract';
8
- import { createSprite, createDisplayObject } from '@flighthq/scene2d/contract';
9
- import type { HasBoundsRectangleRuntime, RenderProxy2D, RenderViewport2D } from '@flighthq/types/contract';
9
+ import { createDisplayObject } from '@flighthq/scene2d/contract';
10
+ import type { HasBoundsRectangleRuntime, RenderProxy2D } from '@flighthq/types/contract';
10
11
 
11
12
  import { createRenderProxy2D, prepareScene2DRender } from './renderProxy';
12
13
  import { createRenderState } from './renderState';
13
- import {
14
- computeRenderProxyWorldBounds,
15
- createRenderViewport2D,
16
- initializeRenderViewport2D,
17
- isRenderProxyInViewport,
18
- isRenderableInViewport,
19
- } from './renderViewport';
14
+ import { computeRenderProxyWorldBounds, isRenderProxyInViewport, isRenderableInViewport } from './renderViewport';
20
15
 
21
16
  function makeMinimalProxy(): RenderProxy2D {
22
17
  const state = createRenderState();
@@ -83,38 +78,22 @@ describe('computeRenderProxyWorldBounds', () => {
83
78
  });
84
79
  });
85
80
 
86
- describe('createRenderViewport2D', () => {
87
- it('creates a viewport with the given dimensions', () => {
88
- const vp = createRenderViewport2D(10, 20, 800, 600);
89
- expect(vp.x).toBe(10);
90
- expect(vp.y).toBe(20);
91
- expect(vp.width).toBe(800);
92
- expect(vp.height).toBe(600);
93
- });
94
- });
95
-
96
- describe('initializeRenderViewport2D', () => {
97
- it('is the construction initializer of createRenderViewport2D', () => {
98
- expect(typeof initializeRenderViewport2D).toBe('function');
99
- });
100
- });
101
-
102
81
  describe('isRenderableInViewport', () => {
103
82
  it('returns true for a source without spatial traits (conservative)', () => {
104
83
  const source = { kind: 'Fake' } as any;
105
- const vp = createRenderViewport2D(0, 0, 100, 100);
84
+ const vp = createViewport({ x: 0, y: 0, width: 100, height: 100 });
106
85
  expect(isRenderableInViewport(source, vp)).toBe(true);
107
86
  });
108
87
 
109
88
  it('returns true for a display object within the viewport', () => {
110
89
  const obj = makeObjectWithBounds(10, 10, 50, 30);
111
- const vp = createRenderViewport2D(0, 0, 800, 600);
90
+ const vp = createViewport({ x: 0, y: 0, width: 800, height: 600 });
112
91
  expect(isRenderableInViewport(obj, vp)).toBe(true);
113
92
  });
114
93
 
115
94
  it('returns false for a display object whose world bounds are outside the viewport', () => {
116
95
  const obj = makeObjectWithBounds(100, 100, 50, 50);
117
- const vp = createRenderViewport2D(2000, 2000, 100, 100);
96
+ const vp = createViewport({ x: 2000, y: 2000, width: 100, height: 100 });
118
97
  expect(isRenderableInViewport(obj, vp)).toBe(false);
119
98
  });
120
99
 
@@ -126,42 +105,42 @@ describe('isRenderableInViewport', () => {
126
105
  const child = makeObjectWithBounds(0, 0, 20, 20);
127
106
  addNodeChild(parent, child);
128
107
 
129
- const vp = createRenderViewport2D(0, 0, 100, 100);
108
+ const vp = createViewport({ x: 0, y: 0, width: 100, height: 100 });
130
109
  expect(isRenderableInViewport(child, vp)).toBe(false);
131
110
 
132
- const largeVp = createRenderViewport2D(0, 0, 600, 600);
111
+ const largeVp = createViewport({ x: 0, y: 0, width: 600, height: 600 });
133
112
  expect(isRenderableInViewport(child, largeVp)).toBe(true);
134
113
  });
135
114
 
136
115
  it('culls an object at origin when the viewport is far away', () => {
137
116
  const obj = makeObjectWithBounds(0, 0, 30, 30);
138
- const vp = createRenderViewport2D(5000, 5000, 100, 100);
117
+ const vp = createViewport({ x: 5000, y: 5000, width: 100, height: 100 });
139
118
  expect(isRenderableInViewport(obj, vp)).toBe(false);
140
119
  });
141
120
 
142
121
  it('includes an object exactly at the viewport edge (inclusive)', () => {
143
122
  const obj = makeObjectWithBounds(0, 0, 100, 100);
144
- const vp = createRenderViewport2D(100, 100, 100, 100);
123
+ const vp = createViewport({ x: 100, y: 100, width: 100, height: 100 });
145
124
  expect(isRenderableInViewport(obj, vp)).toBe(true);
146
125
  });
147
126
 
148
127
  it('applies render transform when provided', () => {
149
128
  const obj = makeObjectWithBounds(0, 0, 50, 50);
150
- const vp = createRenderViewport2D(0, 0, 60, 60);
129
+ const vp = createViewport({ x: 0, y: 0, width: 60, height: 60 });
151
130
 
152
131
  expect(isRenderableInViewport(obj, vp)).toBe(true);
153
132
 
154
133
  const scale2x = createMatrix(2, 0, 0, 2, 0, 0);
155
134
  expect(isRenderableInViewport(obj, vp, scale2x)).toBe(true);
156
135
 
157
- const farVp = createRenderViewport2D(0, 0, 60, 60);
136
+ const farVp = createViewport({ x: 0, y: 0, width: 60, height: 60 });
158
137
  const offsetTransform = createMatrix(1, 0, 0, 1, 200, 200);
159
138
  expect(isRenderableInViewport(obj, farVp, offsetTransform)).toBe(false);
160
139
  });
161
140
 
162
141
  it('works correctly with null render transform', () => {
163
142
  const obj = makeObjectWithBounds(10, 10, 50, 50);
164
- const vp = createRenderViewport2D(0, 0, 800, 600);
143
+ const vp = createViewport({ x: 0, y: 0, width: 800, height: 600 });
165
144
  expect(isRenderableInViewport(obj, vp, null)).toBe(true);
166
145
  });
167
146
 
@@ -173,17 +152,18 @@ describe('isRenderableInViewport', () => {
173
152
  const child = makeObjectWithBounds(0, 0, 50, 50);
174
153
  addNodeChild(parent, child);
175
154
 
176
- const vp = createRenderViewport2D(80, 80, 50, 50);
155
+ const vp = createViewport({ x: 80, y: 80, width: 50, height: 50 });
177
156
  expect(isRenderableInViewport(child, vp)).toBe(true);
178
157
 
179
- const smallVp = createRenderViewport2D(200, 200, 50, 50);
158
+ const smallVp = createViewport({ x: 200, y: 200, width: 50, height: 50 });
180
159
  expect(isRenderableInViewport(child, smallVp)).toBe(false);
181
160
  });
182
161
  });
162
+
183
163
  describe('isRenderProxyInViewport', () => {
184
164
  it('returns true when the proxy source has no spatial traits', () => {
185
165
  const proxy = makeMinimalProxy();
186
- const vp = createRenderViewport2D(0, 0, 100, 100);
166
+ const vp = createViewport({ x: 0, y: 0, width: 100, height: 100 });
187
167
  expect(isRenderProxyInViewport(proxy, vp)).toBe(true);
188
168
  });
189
169
 
@@ -192,7 +172,7 @@ describe('isRenderProxyInViewport', () => {
192
172
  const obj = makeObjectWithBounds(10, 10, 50, 50);
193
173
  prepareScene2DRender(state, obj);
194
174
  const proxy = createRenderProxy2D(state, obj);
195
- const vp = createRenderViewport2D(0, 0, 800, 600);
175
+ const vp = createViewport({ x: 0, y: 0, width: 800, height: 600 });
196
176
  expect(isRenderProxyInViewport(proxy, vp)).toBe(true);
197
177
  });
198
178
  });