@flighthq/scene2d-gl 0.2.1-next.840.857425c
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/dist/enableGlColorAdjustmentGuards.d.ts +4 -0
- package/dist/enableGlColorAdjustmentGuards.d.ts.map +1 -0
- package/dist/enableGlColorAdjustmentGuards.js +21 -0
- package/dist/enableGlColorAdjustmentGuards.js.map +1 -0
- package/dist/glBitmap.d.ts +4 -0
- package/dist/glBitmap.d.ts.map +1 -0
- package/dist/glBitmap.js +93 -0
- package/dist/glBitmap.js.map +1 -0
- package/dist/glCache.d.ts +30 -0
- package/dist/glCache.d.ts.map +1 -0
- package/dist/glCache.js +196 -0
- package/dist/glCache.js.map +1 -0
- package/dist/glClip.d.ts +3 -0
- package/dist/glClip.d.ts.map +1 -0
- package/dist/glClip.js +46 -0
- package/dist/glClip.js.map +1 -0
- package/dist/glClipContours.d.ts +4 -0
- package/dist/glClipContours.d.ts.map +1 -0
- package/dist/glClipContours.js +148 -0
- package/dist/glClipContours.js.map +1 -0
- package/dist/glClipRectangle.d.ts +4 -0
- package/dist/glClipRectangle.d.ts.map +1 -0
- package/dist/glClipRectangle.js +68 -0
- package/dist/glClipRectangle.js.map +1 -0
- package/dist/glColorAdjustment.d.ts +3 -0
- package/dist/glColorAdjustment.d.ts.map +1 -0
- package/dist/glColorAdjustment.js +361 -0
- package/dist/glColorAdjustment.js.map +1 -0
- package/dist/glDefaultMaterial.d.ts +4 -0
- package/dist/glDefaultMaterial.d.ts.map +1 -0
- package/dist/glDefaultMaterial.js +20 -0
- package/dist/glDefaultMaterial.js.map +1 -0
- package/dist/glNode2D.d.ts +5 -0
- package/dist/glNode2D.d.ts.map +1 -0
- package/dist/glNode2D.js +41 -0
- package/dist/glNode2D.js.map +1 -0
- package/dist/glNode2DRegistration.d.ts +25 -0
- package/dist/glNode2DRegistration.d.ts.map +1 -0
- package/dist/glNode2DRegistration.js +51 -0
- package/dist/glNode2DRegistration.js.map +1 -0
- package/dist/glParticleEmitter2D.d.ts +4 -0
- package/dist/glParticleEmitter2D.d.ts.map +1 -0
- package/dist/glParticleEmitter2D.js +263 -0
- package/dist/glParticleEmitter2D.js.map +1 -0
- package/dist/glQuadBatch.d.ts +3 -0
- package/dist/glQuadBatch.d.ts.map +1 -0
- package/dist/glQuadBatch.js +92 -0
- package/dist/glQuadBatch.js.map +1 -0
- package/dist/glRichText.d.ts +8 -0
- package/dist/glRichText.d.ts.map +1 -0
- package/dist/glRichText.js +161 -0
- package/dist/glRichText.js.map +1 -0
- package/dist/glScale9Mapper.d.ts +3 -0
- package/dist/glScale9Mapper.d.ts.map +1 -0
- package/dist/glScale9Mapper.js +37 -0
- package/dist/glScale9Mapper.js.map +1 -0
- package/dist/glScale9Shape.d.ts +9 -0
- package/dist/glScale9Shape.d.ts.map +1 -0
- package/dist/glScale9Shape.js +118 -0
- package/dist/glScale9Shape.js.map +1 -0
- package/dist/glShape.d.ts +4 -0
- package/dist/glShape.d.ts.map +1 -0
- package/dist/glShape.js +146 -0
- package/dist/glShape.js.map +1 -0
- package/dist/glShapeMesh.d.ts +5 -0
- package/dist/glShapeMesh.d.ts.map +1 -0
- package/dist/glShapeMesh.js +114 -0
- package/dist/glShapeMesh.js.map +1 -0
- package/dist/glSprite.d.ts +3 -0
- package/dist/glSprite.d.ts.map +1 -0
- package/dist/glSprite.js +28 -0
- package/dist/glSprite.js.map +1 -0
- package/dist/glSpriteBatch.d.ts +11 -0
- package/dist/glSpriteBatch.d.ts.map +1 -0
- package/dist/glSpriteBatch.js +277 -0
- package/dist/glSpriteBatch.js.map +1 -0
- package/dist/glSpriteRenderer.d.ts +3 -0
- package/dist/glSpriteRenderer.d.ts.map +1 -0
- package/dist/glSpriteRenderer.js +54 -0
- package/dist/glSpriteRenderer.js.map +1 -0
- package/dist/glTestHelper.d.ts +9 -0
- package/dist/glTestHelper.d.ts.map +1 -0
- package/dist/glTestHelper.js +17 -0
- package/dist/glTestHelper.js.map +1 -0
- package/dist/glTextInput.d.ts +4 -0
- package/dist/glTextInput.d.ts.map +1 -0
- package/dist/glTextInput.js +43 -0
- package/dist/glTextInput.js.map +1 -0
- package/dist/glTextLabel.d.ts +4 -0
- package/dist/glTextLabel.d.ts.map +1 -0
- package/dist/glTextLabel.js +141 -0
- package/dist/glTextLabel.js.map +1 -0
- package/dist/glTilemap.d.ts +3 -0
- package/dist/glTilemap.d.ts.map +1 -0
- package/dist/glTilemap.js +79 -0
- package/dist/glTilemap.js.map +1 -0
- package/dist/glVelocity.d.ts +22 -0
- package/dist/glVelocity.d.ts.map +1 -0
- package/dist/glVelocity.js +319 -0
- package/dist/glVelocity.js.map +1 -0
- package/dist/glVideo.d.ts +6 -0
- package/dist/glVideo.d.ts.map +1 -0
- package/dist/glVideo.js +62 -0
- package/dist/glVideo.js.map +1 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +28 -0
- package/dist/index.js.map +1 -0
- package/dist/moduleMockTestHelper.d.ts +15 -0
- package/dist/moduleMockTestHelper.d.ts.map +1 -0
- package/dist/moduleMockTestHelper.js +25 -0
- package/dist/moduleMockTestHelper.js.map +1 -0
- package/package.json +60 -0
- package/src/enableGlColorAdjustmentGuards.test.ts +76 -0
- package/src/glBitmap.test.ts +136 -0
- package/src/glCache.test.ts +234 -0
- package/src/glClip.test.ts +101 -0
- package/src/glClipContours.test.ts +61 -0
- package/src/glClipRectangle.test.ts +47 -0
- package/src/glColorAdjustment.test.ts +166 -0
- package/src/glDefaultMaterial.test.ts +19 -0
- package/src/glNode2D.test.ts +85 -0
- package/src/glNode2DRegistration.test.ts +132 -0
- package/src/glParticleEmitter2D.test.ts +122 -0
- package/src/glQuadBatch.test.ts +132 -0
- package/src/glRichText.test.ts +140 -0
- package/src/glScale9Mapper.test.ts +20 -0
- package/src/glScale9Shape.test.ts +90 -0
- package/src/glShape.test.ts +116 -0
- package/src/glShapeMesh.test.ts +164 -0
- package/src/glSprite.test.ts +79 -0
- package/src/glSpriteBatch.test.ts +249 -0
- package/src/glSpriteRenderer.test.ts +89 -0
- package/src/glTextInput.test.ts +51 -0
- package/src/glTextLabel.test.ts +156 -0
- package/src/glTilemap.test.ts +127 -0
- package/src/glVelocity.test.ts +156 -0
- package/src/glVideo.test.ts +98 -0
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { hasImageResourcePixels } from '@flighthq/image';
|
|
2
|
+
import { noopRendererData } from '@flighthq/render';
|
|
3
|
+
import { resolveGlMaterialRenderer } from '@flighthq/render-gl';
|
|
4
|
+
import { getGlRenderStateRuntime } from '@flighthq/render-gl';
|
|
5
|
+
import { BatchFormat } from '@flighthq/types';
|
|
6
|
+
import { ensureGlQuadBatchShader, packGlSpriteBatchMaterialInstance, prepareGlSpriteBatchWrite, recordGlSpriteBatchColorTransform, } from './glSpriteBatch';
|
|
7
|
+
const INSTANCE_FLOATS = 13;
|
|
8
|
+
function submitGlTilemap(state, tilemapNode) {
|
|
9
|
+
const runtime = getGlRenderStateRuntime(state);
|
|
10
|
+
const source = tilemapNode.source;
|
|
11
|
+
const { tileset, columns, rows, tiles } = source.data;
|
|
12
|
+
if (tileset === null)
|
|
13
|
+
return;
|
|
14
|
+
const atlas = tileset.atlas;
|
|
15
|
+
if (atlas === null || atlas.image === null || !hasImageResourcePixels(atlas.image))
|
|
16
|
+
return;
|
|
17
|
+
if (columns === 0 || rows === 0)
|
|
18
|
+
return;
|
|
19
|
+
ensureGlQuadBatchShader(state);
|
|
20
|
+
const material = tilemapNode.material;
|
|
21
|
+
const materialRenderer = resolveGlMaterialRenderer(state, material);
|
|
22
|
+
if (materialRenderer === null)
|
|
23
|
+
return;
|
|
24
|
+
const nodeMaterialData = tilemapNode.materialData;
|
|
25
|
+
// Per-tile color transforms, overriding the node-level tint for the tiles that carry one.
|
|
26
|
+
const perTileColorTransform = source.data.materialData;
|
|
27
|
+
const nodeColorTransform = tilemapNode.colorTransform;
|
|
28
|
+
const startCount = runtime.spriteBatchCount;
|
|
29
|
+
const base = prepareGlSpriteBatchWrite(state, atlas.image, tilemapNode.blendMode, material, materialRenderer, columns * rows);
|
|
30
|
+
const regions = atlas.regions;
|
|
31
|
+
const numRegions = regions.length;
|
|
32
|
+
const { tileWidth, tileHeight } = tileset;
|
|
33
|
+
const iw = 1 / (atlas.image.width || 1);
|
|
34
|
+
const ih = 1 / (atlas.image.height || 1);
|
|
35
|
+
const instanceData = runtime.spriteBatchInstanceData;
|
|
36
|
+
const pt = tilemapNode.transform2D;
|
|
37
|
+
const pa = pt.a, pb = pt.b, pc = pt.c, pd = pt.d, ptx = pt.tx, pty = pt.ty;
|
|
38
|
+
const alpha = tilemapNode.alpha;
|
|
39
|
+
let writeBase = base;
|
|
40
|
+
let drawCount = 0;
|
|
41
|
+
for (let row = 0; row < rows; row++) {
|
|
42
|
+
for (let col = 0; col < columns; col++) {
|
|
43
|
+
const id = tiles[row * columns + col];
|
|
44
|
+
if (id < 0 || id >= numRegions)
|
|
45
|
+
continue;
|
|
46
|
+
const region = regions[id];
|
|
47
|
+
if (region.width <= 0 || region.height <= 0)
|
|
48
|
+
continue;
|
|
49
|
+
const dx = col * tileWidth;
|
|
50
|
+
const dy = row * tileHeight;
|
|
51
|
+
instanceData[writeBase] = pa;
|
|
52
|
+
instanceData[writeBase + 1] = pb;
|
|
53
|
+
instanceData[writeBase + 2] = pc;
|
|
54
|
+
instanceData[writeBase + 3] = pd;
|
|
55
|
+
instanceData[writeBase + 4] = pa * dx + pc * dy + ptx;
|
|
56
|
+
instanceData[writeBase + 5] = pb * dx + pd * dy + pty;
|
|
57
|
+
instanceData[writeBase + 6] = tileWidth;
|
|
58
|
+
instanceData[writeBase + 7] = tileHeight;
|
|
59
|
+
instanceData[writeBase + 8] = region.x * iw;
|
|
60
|
+
instanceData[writeBase + 9] = region.y * ih;
|
|
61
|
+
instanceData[writeBase + 10] = (region.x + region.width) * iw;
|
|
62
|
+
instanceData[writeBase + 11] = (region.y + region.height) * ih;
|
|
63
|
+
instanceData[writeBase + 12] = alpha;
|
|
64
|
+
packGlSpriteBatchMaterialInstance(state, nodeMaterialData, startCount + drawCount);
|
|
65
|
+
// Per-tile tint overrides the node-level tint (null → the node's, itself possibly null → untinted).
|
|
66
|
+
const colorTransform = perTileColorTransform?.[row * columns + col] ?? nodeColorTransform;
|
|
67
|
+
recordGlSpriteBatchColorTransform(state, colorTransform, startCount + drawCount);
|
|
68
|
+
writeBase += INSTANCE_FLOATS;
|
|
69
|
+
drawCount++;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
runtime.spriteBatchCount += drawCount;
|
|
73
|
+
}
|
|
74
|
+
export const defaultGlTilemapRenderer = {
|
|
75
|
+
format: BatchFormat.Quad,
|
|
76
|
+
createData: noopRendererData,
|
|
77
|
+
submit: submitGlTilemap,
|
|
78
|
+
};
|
|
79
|
+
//# sourceMappingURL=glTilemap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"glTilemap.js","sourceRoot":"","sources":["../src/glTilemap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAE9D,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,OAAO,EACL,uBAAuB,EACvB,iCAAiC,EACjC,yBAAyB,EACzB,iCAAiC,GAClC,MAAM,iBAAiB,CAAC;AAEzB,MAAM,eAAe,GAAG,EAAE,CAAC;AAE3B,SAAS,eAAe,CAAC,KAAoB,EAAE,WAA0B;IACvE,MAAM,OAAO,GAAG,uBAAuB,CAAC,KAAK,CAAC,CAAC;IAC/C,MAAM,MAAM,GAAG,WAAW,CAAC,MAAiB,CAAC;IAC7C,MAAM,EAAE,OAAO,EAA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AC;IAED,OAAO,CAAC,gBAAgB,IAAI,SAAS,CAAC;AACxC,CAAC;AAED,MAAM,CAAC,MAAM,wBAAwB,GAAmB;IACtD,MAAM,EAAE,WAAW,CAAC,IAAI;IACxB,UAAU,EAAE,gBAAgB;IAC5B,MAAM,EAAE,eAAe;CACxB,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { GlRenderState, GlRenderTarget, GlVelocityContext, GlVelocityWriter, Kind, Transform2DNode, VelocityField } from '@flighthq/types';
|
|
2
|
+
/** Allocates an rgba16f render target sized to hold a signed, sub-pixel screen-space velocity buffer. */
|
|
3
|
+
export declare function createGlVelocityTarget(state: GlRenderState, width: number, height: number): GlRenderTarget;
|
|
4
|
+
export declare const defaultGlNode2DVelocityWriter: GlVelocityWriter;
|
|
5
|
+
export declare const defaultGlParticleEmitter2DVelocityWriter: GlVelocityWriter;
|
|
6
|
+
export declare const defaultGlQuadBatchVelocityWriter: GlVelocityWriter;
|
|
7
|
+
/**
|
|
8
|
+
* Draws one velocity quad: a device-pixel rect (x, y, width, height) filled with (velocityX, velocityY)
|
|
9
|
+
* in node units (scaled by pixelRatio here). The velocity program must be current — the velocity pass
|
|
10
|
+
* sets it up before dispatching writers. Writers call this once per covered region (once for a display
|
|
11
|
+
* object's bounds; once per instance for a batch).
|
|
12
|
+
*/
|
|
13
|
+
export declare function drawGlVelocityQuad(ctx: Readonly<GlVelocityContext>, x: number, y: number, width: number, height: number, velocityX: number, velocityY: number): void;
|
|
14
|
+
export declare function getGlVelocityWriter(state: GlRenderState, kind: Kind): GlVelocityWriter | null;
|
|
15
|
+
export declare function registerGlVelocityWriter(state: GlRenderState, kind: Kind, writer: GlVelocityWriter): void;
|
|
16
|
+
/**
|
|
17
|
+
* Walks `root`'s subtree and writes every moving renderable's velocity into `target`, dispatching the
|
|
18
|
+
* registered GlVelocityWriter for each node's kind. Nodes whose kind has no writer are skipped; the
|
|
19
|
+
* cleared (0,0,0,0) background means zero velocity. Restores the previously bound framebuffer.
|
|
20
|
+
*/
|
|
21
|
+
export declare function renderGlVelocity<Traits extends object>(state: GlRenderState, root: Readonly<Transform2DNode<Traits>>, field: VelocityField, target: Readonly<GlRenderTarget>): void;
|
|
22
|
+
//# sourceMappingURL=glVelocity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"glVelocity.d.ts","sourceRoot":"","sources":["../src/glVelocity.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EACV,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EAChB,IAAI,EAKJ,eAAe,EAEf,aAAa,EACd,MAAM,iBAAiB,CAAC;AAgBzB,yGAAyG;AACzG,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,cAAc,CAE1G;AAID,eAAO,MAAM,6BAA6B,EAAE,gBAO3C,CAAC;AAWF,eAAO,MAAM,wCAAwC,EAAE,gBA6DtD,CAAC;AAeF,eAAO,MAAM,gCAAgC,EAAE,gBAwF9C,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,QAAQ,CAAC,iBAAiB,CAAC,EAChC,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,GAChB,IAAI,CAUN;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,IAAI,GAAG,gBAAgB,GAAG,IAAI,CAE7F;AAED,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,gBAAgB,GAAG,IAAI,CAOzG;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,SAAS,MAAM,EACpD,KAAK,EAAE,aAAa,EACpB,IAAI,EAAE,QAAQ,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,EACvC,KAAK,EAAE,aAAa,EACpB,MAAM,EAAE,QAAQ,CAAC,cAAc,CAAC,GAC/B,IAAI,CA2BN"}
|
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
import { ensureNodeWorldBoundsRectangle, ensureNodeWorldMatrix, getNodeChildAt, getNodeChildCount, getNodeWorldBoundsRectangle, getNodeWorldMatrix, } from '@flighthq/node';
|
|
2
|
+
import { createGlProgram } from '@flighthq/render-gl';
|
|
3
|
+
import { getGlRenderStateRuntime } from '@flighthq/render-gl';
|
|
4
|
+
import { createGlRenderTarget } from '@flighthq/render-gl';
|
|
5
|
+
import { EntityRuntimeKey } from '@flighthq/types';
|
|
6
|
+
import { getVelocity } from '@flighthq/velocity';
|
|
7
|
+
// Gl velocity-buffer production. Velocity is tied to the draw, so production is per-kind: the velocity
|
|
8
|
+
// pass walks the scene and dispatches a registered GlVelocityWriter for each node's kind, which draws
|
|
9
|
+
// that kind's velocity into the bound rgba16f target. The Node2D writer covers a node's world
|
|
10
|
+
// bounds with its (single) velocity; batched kinds register their own writer to emit per-instance
|
|
11
|
+
// velocity. The generic velocity DATA comes from a render-agnostic VelocityField (@flighthq/velocity);
|
|
12
|
+
// this module is only the render-side hook.
|
|
13
|
+
//
|
|
14
|
+
// ENCODING: velocity is written in device pixels per frame (node-unit velocity × pixelRatio), y-down,
|
|
15
|
+
// into R/G of an rgba16f target (signed, sub-pixel). B is reserved; A=1 marks a covered texel so consumers
|
|
16
|
+
// distinguish it from the cleared (0,0,0,0) zero-velocity background. World bounds are device-pixel,
|
|
17
|
+
// top-left origin, y-down; drawGlVelocityQuad maps a rect into clip space, flipping y.
|
|
18
|
+
/** Allocates an rgba16f render target sized to hold a signed, sub-pixel screen-space velocity buffer. */
|
|
19
|
+
export function createGlVelocityTarget(state, width, height) {
|
|
20
|
+
return createGlRenderTarget(state, { width, height, format: 'rgba16f' });
|
|
21
|
+
}
|
|
22
|
+
// The default writer for plain display-object nodes: cover the node's world bounds with its velocity.
|
|
23
|
+
// Batched/instanced kinds (QuadBatch, particles) register a writer that emits per-instance velocity.
|
|
24
|
+
export const defaultGlNode2DVelocityWriter = (ctx, node) => {
|
|
25
|
+
getVelocity(ctx.field, node, _scratchVelocity);
|
|
26
|
+
if (_scratchVelocity.x === 0 && _scratchVelocity.y === 0)
|
|
27
|
+
return;
|
|
28
|
+
const spatial = node;
|
|
29
|
+
ensureNodeWorldBoundsRectangle(spatial);
|
|
30
|
+
const bounds = getNodeWorldBoundsRectangle(spatial);
|
|
31
|
+
drawGlVelocityQuad(ctx, bounds.x, bounds.y, bounds.width, bounds.height, _scratchVelocity.x, _scratchVelocity.y);
|
|
32
|
+
};
|
|
33
|
+
// The ParticleEmitter2D writer emits PER-PARTICLE velocity: each particle moves on its own vector (a
|
|
34
|
+
// fountain fans outward), so one emitter-wide vector would be wrong — a user who wants the whole emitter
|
|
35
|
+
// to share a velocity attaches it to a parent node instead, which the Node2D writer covers. The
|
|
36
|
+
// per-particle world rect is reconstructed exactly as the particle renderer composes its quad: a [0,1]
|
|
37
|
+
// corner scaled by the atlas region, rotated/scaled by the particle's (cos,sin)·scale and offset by its
|
|
38
|
+
// position, then mapped by the emitter world transform (skipped when worldSpace puts particles in world
|
|
39
|
+
// space already). Velocity stays in node units; drawGlVelocityQuad applies pixelRatio (matching the
|
|
40
|
+
// other writers; a non-unit emitter scale or worldSpace under hiDpi is the same approximation as
|
|
41
|
+
// QuadBatch). Skips particles with zero velocity and emitters without a populated velocities array.
|
|
42
|
+
export const defaultGlParticleEmitter2DVelocityWriter = (ctx, node) => {
|
|
43
|
+
const emitter = node;
|
|
44
|
+
const { atlas, ids, particleCount, transforms, velocities, worldSpace } = emitter.data;
|
|
45
|
+
if (atlas === null || particleCount === 0 || velocities.length < particleCount * 2)
|
|
46
|
+
return;
|
|
47
|
+
const regions = atlas.regions;
|
|
48
|
+
const numRegions = regions.length;
|
|
49
|
+
let wa = 1;
|
|
50
|
+
let wb = 0;
|
|
51
|
+
let wc = 0;
|
|
52
|
+
let wd = 1;
|
|
53
|
+
let wtx = 0;
|
|
54
|
+
let wty = 0;
|
|
55
|
+
if (!worldSpace) {
|
|
56
|
+
ensureNodeWorldMatrix(node);
|
|
57
|
+
const transform = getNodeWorldMatrix(node);
|
|
58
|
+
wa = transform.a;
|
|
59
|
+
wb = transform.b;
|
|
60
|
+
wc = transform.c;
|
|
61
|
+
wd = transform.d;
|
|
62
|
+
wtx = transform.tx;
|
|
63
|
+
wty = transform.ty;
|
|
64
|
+
}
|
|
65
|
+
for (let i = 0; i < particleCount; i++) {
|
|
66
|
+
const velocityX = velocities[i * 2];
|
|
67
|
+
const velocityY = velocities[i * 2 + 1];
|
|
68
|
+
if (velocityX === 0 && velocityY === 0)
|
|
69
|
+
continue;
|
|
70
|
+
const id = ids[i];
|
|
71
|
+
if (id < 0 || id >= numRegions)
|
|
72
|
+
continue;
|
|
73
|
+
const region = regions[id];
|
|
74
|
+
const rw = region.width;
|
|
75
|
+
const rh = region.height;
|
|
76
|
+
if (rw <= 0 || rh <= 0)
|
|
77
|
+
continue;
|
|
78
|
+
const tt = i * 4;
|
|
79
|
+
const px = transforms[tt];
|
|
80
|
+
const py = transforms[tt + 1];
|
|
81
|
+
const rotation = transforms[tt + 2];
|
|
82
|
+
const scale = transforms[tt + 3];
|
|
83
|
+
const cosScale = Math.cos(rotation) * scale;
|
|
84
|
+
const sinScale = Math.sin(rotation) * scale;
|
|
85
|
+
let minX = Infinity;
|
|
86
|
+
let minY = Infinity;
|
|
87
|
+
let maxX = -Infinity;
|
|
88
|
+
let maxY = -Infinity;
|
|
89
|
+
for (let c = 0; c < 4; c++) {
|
|
90
|
+
const lx = (c & 1) * rw;
|
|
91
|
+
const ly = (c >> 1) * rh;
|
|
92
|
+
const rx = cosScale * lx - sinScale * ly + px;
|
|
93
|
+
const ry = sinScale * lx + cosScale * ly + py;
|
|
94
|
+
const wx = worldSpace ? rx : wa * rx + wc * ry + wtx;
|
|
95
|
+
const wy = worldSpace ? ry : wb * rx + wd * ry + wty;
|
|
96
|
+
if (wx < minX)
|
|
97
|
+
minX = wx;
|
|
98
|
+
if (wx > maxX)
|
|
99
|
+
maxX = wx;
|
|
100
|
+
if (wy < minY)
|
|
101
|
+
minY = wy;
|
|
102
|
+
if (wy > maxY)
|
|
103
|
+
maxY = wy;
|
|
104
|
+
}
|
|
105
|
+
drawGlVelocityQuad(ctx, minX, minY, maxX - minX, maxY - minY, velocityX, velocityY);
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
// The QuadBatch writer emits PER-INSTANCE velocity: a batch's quads move independently and are not nodes,
|
|
109
|
+
// so a single node-level velocity over the whole batch would smear every quad with the same motion vector.
|
|
110
|
+
// When the batch carries a per-instance velocity array (QuadBatchRuntime.instanceVelocities, filled by
|
|
111
|
+
// whatever drives the quads) we draw one velocity quad per instance, each over that instance's own
|
|
112
|
+
// world-space region. Each instance's world rect is reconstructed exactly as the Gl batch renderer
|
|
113
|
+
// composes it: the batch's world transform (transform2D) applied to the per-instance local transform, then
|
|
114
|
+
// the axis-aligned bounds of the transformed region. This is the same world space the Node2D writer
|
|
115
|
+
// passes (the node's logical world bounds), so drawGlVelocityQuad maps both consistently. Velocity stays
|
|
116
|
+
// in node units; the helper applies pixelRatio.
|
|
117
|
+
//
|
|
118
|
+
// Fallback: when no per-instance velocity array is present, cover the batch's world bounds with one coarse
|
|
119
|
+
// velocity read from the field, exactly like the Node2D writer. The per-instance path above is the
|
|
120
|
+
// precise one; this coarse path exists so a batch without tracked instance velocity still contributes.
|
|
121
|
+
export const defaultGlQuadBatchVelocityWriter = (ctx, node) => {
|
|
122
|
+
const batch = node;
|
|
123
|
+
const data = batch.data;
|
|
124
|
+
const runtime = node[EntityRuntimeKey];
|
|
125
|
+
const instanceVelocities = runtime.instanceVelocities;
|
|
126
|
+
const { atlas, ids, instanceCount, transforms, transformType } = data;
|
|
127
|
+
// Precise per-instance path: requires the velocity array and a resolvable region per instance.
|
|
128
|
+
if (instanceVelocities !== null && atlas !== null && instanceCount > 0) {
|
|
129
|
+
const regions = atlas.regions;
|
|
130
|
+
const numRegions = regions.length;
|
|
131
|
+
ensureNodeWorldMatrix(node);
|
|
132
|
+
const transform = getNodeWorldMatrix(node);
|
|
133
|
+
const pa = transform.a;
|
|
134
|
+
const pb = transform.b;
|
|
135
|
+
const pc = transform.c;
|
|
136
|
+
const pd = transform.d;
|
|
137
|
+
const ptx = transform.tx;
|
|
138
|
+
const pty = transform.ty;
|
|
139
|
+
const isVector2 = transformType === 'vector2';
|
|
140
|
+
for (let i = 0; i < instanceCount; i++) {
|
|
141
|
+
const velocityX = instanceVelocities[i * 2];
|
|
142
|
+
const velocityY = instanceVelocities[i * 2 + 1];
|
|
143
|
+
if (velocityX === 0 && velocityY === 0)
|
|
144
|
+
continue;
|
|
145
|
+
const id = ids[i];
|
|
146
|
+
if (id < 0 || id >= numRegions)
|
|
147
|
+
continue;
|
|
148
|
+
const region = regions[id];
|
|
149
|
+
const w = region.width;
|
|
150
|
+
const h = region.height;
|
|
151
|
+
if (w <= 0 || h <= 0)
|
|
152
|
+
continue;
|
|
153
|
+
// World-space instance transform = batch world transform ∘ per-instance local transform.
|
|
154
|
+
let wa;
|
|
155
|
+
let wb;
|
|
156
|
+
let wc;
|
|
157
|
+
let wd;
|
|
158
|
+
let wtx;
|
|
159
|
+
let wty;
|
|
160
|
+
if (isVector2) {
|
|
161
|
+
const dx = transforms[i * 2];
|
|
162
|
+
const dy = transforms[i * 2 + 1];
|
|
163
|
+
wa = pa;
|
|
164
|
+
wb = pb;
|
|
165
|
+
wc = pc;
|
|
166
|
+
wd = pd;
|
|
167
|
+
wtx = pa * dx + pc * dy + ptx;
|
|
168
|
+
wty = pb * dx + pd * dy + pty;
|
|
169
|
+
}
|
|
170
|
+
else {
|
|
171
|
+
const o = i * 6;
|
|
172
|
+
const la = transforms[o];
|
|
173
|
+
const lb = transforms[o + 1];
|
|
174
|
+
const lc = transforms[o + 2];
|
|
175
|
+
const ld = transforms[o + 3];
|
|
176
|
+
const ltx = transforms[o + 4];
|
|
177
|
+
const lty = transforms[o + 5];
|
|
178
|
+
wa = pa * la + pc * lb;
|
|
179
|
+
wb = pb * la + pd * lb;
|
|
180
|
+
wc = pa * lc + pc * ld;
|
|
181
|
+
wd = pb * lc + pd * ld;
|
|
182
|
+
wtx = pa * ltx + pc * lty + ptx;
|
|
183
|
+
wty = pb * ltx + pd * lty + pty;
|
|
184
|
+
}
|
|
185
|
+
// Axis-aligned world bounds of the transformed region (the four region corners).
|
|
186
|
+
const x0 = wtx;
|
|
187
|
+
const y0 = wty;
|
|
188
|
+
const x1 = wa * w + wtx;
|
|
189
|
+
const y1 = wb * w + wty;
|
|
190
|
+
const x2 = wc * h + wtx;
|
|
191
|
+
const y2 = wd * h + wty;
|
|
192
|
+
const x3 = wa * w + wc * h + wtx;
|
|
193
|
+
const y3 = wb * w + wd * h + wty;
|
|
194
|
+
const minX = Math.min(x0, x1, x2, x3);
|
|
195
|
+
const minY = Math.min(y0, y1, y2, y3);
|
|
196
|
+
const maxX = Math.max(x0, x1, x2, x3);
|
|
197
|
+
const maxY = Math.max(y0, y1, y2, y3);
|
|
198
|
+
drawGlVelocityQuad(ctx, minX, minY, maxX - minX, maxY - minY, velocityX, velocityY);
|
|
199
|
+
}
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
// Coarse fallback: one velocity over the whole batch's world bounds, matching the Node2D writer.
|
|
203
|
+
getVelocity(ctx.field, node, _scratchVelocity);
|
|
204
|
+
if (_scratchVelocity.x === 0 && _scratchVelocity.y === 0)
|
|
205
|
+
return;
|
|
206
|
+
const spatial = node;
|
|
207
|
+
ensureNodeWorldBoundsRectangle(spatial);
|
|
208
|
+
const bounds = getNodeWorldBoundsRectangle(spatial);
|
|
209
|
+
drawGlVelocityQuad(ctx, bounds.x, bounds.y, bounds.width, bounds.height, _scratchVelocity.x, _scratchVelocity.y);
|
|
210
|
+
};
|
|
211
|
+
/**
|
|
212
|
+
* Draws one velocity quad: a device-pixel rect (x, y, width, height) filled with (velocityX, velocityY)
|
|
213
|
+
* in node units (scaled by pixelRatio here). The velocity program must be current — the velocity pass
|
|
214
|
+
* sets it up before dispatching writers. Writers call this once per covered region (once for a display
|
|
215
|
+
* object's bounds; once per instance for a batch).
|
|
216
|
+
*/
|
|
217
|
+
export function drawGlVelocityQuad(ctx, x, y, width, height, velocityX, velocityY) {
|
|
218
|
+
const program = ensureGlVelocityProgram(ctx.state);
|
|
219
|
+
const gl = ctx.state.gl;
|
|
220
|
+
const clipX0 = (x / ctx.width) * 2 - 1;
|
|
221
|
+
const clipY0 = 1 - (y / ctx.height) * 2;
|
|
222
|
+
const clipWidth = (width / ctx.width) * 2;
|
|
223
|
+
const clipHeight = -((height / ctx.height) * 2);
|
|
224
|
+
gl.uniform4f(program.locClipRect, clipX0, clipY0, clipWidth, clipHeight);
|
|
225
|
+
gl.uniform2f(program.locVelocity, velocityX * ctx.pixelRatio, velocityY * ctx.pixelRatio);
|
|
226
|
+
gl.drawArrays(gl.TRIANGLES, 0, 6);
|
|
227
|
+
}
|
|
228
|
+
export function getGlVelocityWriter(state, kind) {
|
|
229
|
+
return _velocityWriters.get(state)?.get(kind) ?? null;
|
|
230
|
+
}
|
|
231
|
+
export function registerGlVelocityWriter(state, kind, writer) {
|
|
232
|
+
let writers = _velocityWriters.get(state);
|
|
233
|
+
if (writers === undefined) {
|
|
234
|
+
writers = new Map();
|
|
235
|
+
_velocityWriters.set(state, writers);
|
|
236
|
+
}
|
|
237
|
+
writers.set(kind, writer);
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Walks `root`'s subtree and writes every moving renderable's velocity into `target`, dispatching the
|
|
241
|
+
* registered GlVelocityWriter for each node's kind. Nodes whose kind has no writer are skipped; the
|
|
242
|
+
* cleared (0,0,0,0) background means zero velocity. Restores the previously bound framebuffer.
|
|
243
|
+
*/
|
|
244
|
+
export function renderGlVelocity(state, root, field, target) {
|
|
245
|
+
const runtime = getGlRenderStateRuntime(state);
|
|
246
|
+
const gl = state.gl;
|
|
247
|
+
const program = ensureGlVelocityProgram(state);
|
|
248
|
+
gl.bindFramebuffer(gl.FRAMEBUFFER, target.framebuffer);
|
|
249
|
+
gl.viewport(0, 0, target.width, target.height);
|
|
250
|
+
gl.disable(gl.BLEND);
|
|
251
|
+
gl.clearColor(0, 0, 0, 0);
|
|
252
|
+
gl.clear(gl.COLOR_BUFFER_BIT);
|
|
253
|
+
gl.useProgram(program.program);
|
|
254
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, program.quadBuffer);
|
|
255
|
+
gl.enableVertexAttribArray(program.locCorner);
|
|
256
|
+
gl.vertexAttribPointer(program.locCorner, 2, gl.FLOAT, false, 0, 0);
|
|
257
|
+
const ctx = {
|
|
258
|
+
state,
|
|
259
|
+
field,
|
|
260
|
+
width: target.width,
|
|
261
|
+
height: target.height,
|
|
262
|
+
pixelRatio: state.pixelRatio,
|
|
263
|
+
};
|
|
264
|
+
visitGlVelocity(ctx, root);
|
|
265
|
+
gl.bindFramebuffer(gl.FRAMEBUFFER, runtime.currentFramebuffer);
|
|
266
|
+
gl.disableVertexAttribArray(program.locCorner);
|
|
267
|
+
}
|
|
268
|
+
function ensureGlVelocityProgram(state) {
|
|
269
|
+
let program = _velocityPrograms.get(state);
|
|
270
|
+
if (program !== undefined)
|
|
271
|
+
return program;
|
|
272
|
+
const gl = state.gl;
|
|
273
|
+
const glProgram = createGlProgram(gl, VELOCITY_VERTEX_SRC, VELOCITY_FRAGMENT_SRC, 'Velocity');
|
|
274
|
+
const quadBuffer = gl.createBuffer();
|
|
275
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, quadBuffer);
|
|
276
|
+
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1]), gl.STATIC_DRAW);
|
|
277
|
+
program = {
|
|
278
|
+
program: glProgram,
|
|
279
|
+
quadBuffer,
|
|
280
|
+
locCorner: gl.getAttribLocation(glProgram, 'a_corner'),
|
|
281
|
+
locClipRect: gl.getUniformLocation(glProgram, 'u_clipRect'),
|
|
282
|
+
locVelocity: gl.getUniformLocation(glProgram, 'u_velocity'),
|
|
283
|
+
};
|
|
284
|
+
_velocityPrograms.set(state, program);
|
|
285
|
+
return program;
|
|
286
|
+
}
|
|
287
|
+
function visitGlVelocity(ctx, node) {
|
|
288
|
+
const writer = getGlVelocityWriter(ctx.state, node.kind);
|
|
289
|
+
if (writer !== null)
|
|
290
|
+
writer(ctx, node);
|
|
291
|
+
const count = getNodeChildCount(node);
|
|
292
|
+
for (let i = 0; i < count; i++) {
|
|
293
|
+
const child = getNodeChildAt(node, i);
|
|
294
|
+
if (child !== null)
|
|
295
|
+
visitGlVelocity(ctx, child);
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
// u_clipRect = (clipX0, clipY0, clipWidth, clipHeight). a_corner is the unit-quad corner [0..1]; the
|
|
299
|
+
// covered rect is reconstructed per vertex so no per-node matrix upload is needed.
|
|
300
|
+
const VELOCITY_VERTEX_SRC = `#version 300 es
|
|
301
|
+
in vec2 a_corner;
|
|
302
|
+
uniform vec4 u_clipRect;
|
|
303
|
+
void main() {
|
|
304
|
+
vec2 clip = u_clipRect.xy + a_corner * u_clipRect.zw;
|
|
305
|
+
gl_Position = vec4(clip, 0.0, 1.0);
|
|
306
|
+
}`;
|
|
307
|
+
const VELOCITY_FRAGMENT_SRC = `#version 300 es
|
|
308
|
+
precision highp float;
|
|
309
|
+
uniform vec2 u_velocity;
|
|
310
|
+
out vec4 fragColor;
|
|
311
|
+
void main() {
|
|
312
|
+
fragColor = vec4(u_velocity, 0.0, 1.0);
|
|
313
|
+
}`;
|
|
314
|
+
const _scratchVelocity = { x: 0, y: 0 };
|
|
315
|
+
// Lazily compiled velocity program per render state, and the per-kind writer registry. WeakMaps so both
|
|
316
|
+
// release when the state is GC'd.
|
|
317
|
+
const _velocityPrograms = new WeakMap();
|
|
318
|
+
const _velocityWriters = new WeakMap();
|
|
319
|
+
//# sourceMappingURL=glVelocity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"glVelocity.js","sourceRoot":"","sources":["../src/glVelocity.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,8BAA8B,EAC9B,qBAAqB,EACrB,cAAc,EACd,iBAAiB,EACjB,2BAA2B,EAC3B,kBAAkB,GACnB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAe3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,uGAAuG;AACvG,sGAAsG;AACtG,8FAA8F;AAC9F,kGAAkG;AAClG,uGAAuG;AACvG,4CAA4C;AAC5C,EAAE;AACF,sGAAsG;AACtG,2GAA2G;AAC3G,qGAAqG;AACrG,uFAAuF;AAEvF,yGAAyG;AACzG,MAAM,UAAU,sBAAsB,CAAC,KAAoB,EAAE,KAAa,EAAE,MAAc;IACxF,OAAO,oBAAoB,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC;AAC3E,CAAC;AAED,sGAAsG;AACtG,qGAAqG;AACrG,MAAM,CAAC,MAAM,6BAA6B,GAAqB,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE;IAC3E,WAAW,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,gBAAgB,CAAC,CAAC;IAC/C,IAAI,gBAAgB,CAAC,CAAC,KAAK,CAAC,IAAI,gBAAgB,CAAC,CAAC,KAAK,CAAC;QAAE,OAAO;IACjE,MAAM,OAAO,GAAG,IA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AkC;AAClC,MAAM,iBAAiB,GAAG,IAAI,OAAO,EAAoC,CAAC;AAC1E,MAAM,gBAAgB,GAAG,IAAI,OAAO,EAA8C,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Scene2DRenderer, GlRenderState, Renderable, RendererData, RenderProxy2D } from '@flighthq/types';
|
|
2
|
+
export declare function createGlVideoData(_state: GlRenderState, _source: Renderable): RendererData;
|
|
3
|
+
export declare function destroyGlVideoData(state: GlRenderState, data: RendererData): void;
|
|
4
|
+
export declare function drawGlVideo(state: GlRenderState, renderProxy: RenderProxy2D): void;
|
|
5
|
+
export declare const defaultGlVideoRenderer: Scene2DRenderer;
|
|
6
|
+
//# sourceMappingURL=glVideo.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"glVideo.d.ts","sourceRoot":"","sources":["../src/glVideo.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EACV,eAAe,EACf,aAAa,EACb,UAAU,EACV,YAAY,EACZ,aAAa,EAId,MAAM,iBAAiB,CAAC;AAazB,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,UAAU,GAAG,YAAY,CAE1F;AAID,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,YAAY,GAAG,IAAI,CAUjF;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,aAAa,GAAG,IAAI,CAqClF;AAED,eAAO,MAAM,sBAAsB,EAAE,eAIpC,CAAC"}
|
package/dist/glVideo.js
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { bindGlVideoTexture, drawGlQuad, getGlRenderStateRuntime, resolveGlShader, useGlProgram, } from '@flighthq/render-gl';
|
|
2
|
+
import { advanceVideoTexture, createVideoTexture } from '@flighthq/texture';
|
|
3
|
+
import { flushGlSpriteBatch } from './glSpriteBatch';
|
|
4
|
+
export function createGlVideoData(_state, _source) {
|
|
5
|
+
return { source: null, videoTexture: null };
|
|
6
|
+
}
|
|
7
|
+
// Frees the GPU texture the VideoTexture uploaded through when the node is torn down via
|
|
8
|
+
// disposeScene2DRender. The VideoTexture-keyed videoTextureCache entry would otherwise leak.
|
|
9
|
+
export function destroyGlVideoData(state, data) {
|
|
10
|
+
const runtime = getGlRenderStateRuntime(state);
|
|
11
|
+
const { videoTexture } = data;
|
|
12
|
+
if (videoTexture === null)
|
|
13
|
+
return;
|
|
14
|
+
const cache = runtime.videoTextureCache;
|
|
15
|
+
const entry = cache?.get(videoTexture);
|
|
16
|
+
if (entry !== undefined) {
|
|
17
|
+
state.gl.deleteTexture(entry.texture);
|
|
18
|
+
cache.delete(videoTexture);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
export function drawGlVideo(state, renderProxy) {
|
|
22
|
+
flushGlSpriteBatch(state);
|
|
23
|
+
const source = renderProxy.source;
|
|
24
|
+
const resource = source.data.source ?? null;
|
|
25
|
+
const element = resource?.element ?? null;
|
|
26
|
+
if (resource === null || element === null || element.readyState < 2)
|
|
27
|
+
return;
|
|
28
|
+
const vw = element.videoWidth;
|
|
29
|
+
const vh = element.videoHeight;
|
|
30
|
+
if (vw === 0 || vh === 0)
|
|
31
|
+
return;
|
|
32
|
+
const data = renderProxy.rendererData;
|
|
33
|
+
// Rebuild the VideoTexture when the node's stream swaps (or on the first draw), so the new stream's
|
|
34
|
+
// frameId gate starts fresh and its first frame uploads.
|
|
35
|
+
let videoTexture;
|
|
36
|
+
if (data !== null && data.videoTexture !== null && data.source === resource) {
|
|
37
|
+
videoTexture = data.videoTexture;
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
videoTexture = createVideoTexture(resource);
|
|
41
|
+
if (data !== null) {
|
|
42
|
+
data.source = resource;
|
|
43
|
+
data.videoTexture = videoTexture;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
// The element decodes a new frame each rendered tick; bump the revision so bindGlVideoTexture's gate
|
|
47
|
+
// re-uploads this frame. A frame that has not advanced (a driver that only bumps on a real decode)
|
|
48
|
+
// would skip the upload — here the display node advances every draw to match the element's live pixels.
|
|
49
|
+
advanceVideoTexture(videoTexture);
|
|
50
|
+
const shader = resolveGlShader(state, renderProxy);
|
|
51
|
+
useGlProgram(state, shader);
|
|
52
|
+
state.applyBlendMode?.(state, renderProxy.blendMode);
|
|
53
|
+
bindGlVideoTexture(state, videoTexture);
|
|
54
|
+
shader.bind(state.gl, state, renderProxy);
|
|
55
|
+
drawGlQuad(state, 0, 0, vw, vh, 0, 0, 1, 1);
|
|
56
|
+
}
|
|
57
|
+
export const defaultGlVideoRenderer = {
|
|
58
|
+
createData: createGlVideoData,
|
|
59
|
+
destroyData: destroyGlVideoData,
|
|
60
|
+
submit: drawGlVideo,
|
|
61
|
+
};
|
|
62
|
+
//# sourceMappingURL=glVideo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"glVideo.js","sourceRoot":"","sources":["../src/glVideo.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,UAAU,EACV,uBAAuB,EACvB,eAAe,EACf,YAAY,GACb,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAY5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAWrD,MAAM,UAAU,iBAAiB,CAAC,MAAqB,EAAE,OAAmB;IAC1E,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAA6B,CAAC;AACzE,CAAC;AAED,yFAAyF;AACzF,6FAA6F;AAC7F,MAAM,UAAU,kBAAkB,CAAC,KAAoB,EAAE,IAAkB;IACzE,MAAM,OAAO,GAAG,uBAAuB,CAAC,KAAK,CAAC,CAAC;IAC/C,MAAM,EAAE,YAAY,EAAE,GAAG,IAA8B,CAAC;IACxD,IAAI,YAAY,KAAK,IAAI;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EAAE,CAAC;YAClB,IAAI,CAAC,MAAM,GAAG,QAAQ,CAAC;YACvB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACnC,CAAC;IACH,CAAC;IACD,qGAAqG;IACrG,mGAAmG;IACnG,wGAAwG;IACxG,mBAAmB,CAAC,YAAY,CAAC,CAAC;IAElC,MAAM,MAAM,GAAG,eAAe,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;IACnD,YAAY,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IAC5B,KAAK,CAAC,cAAc,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC;IAErD,kBAAkB,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;IAExC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC;IAC1C,UAAU,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AAC9C,CAAC;AAED,MAAM,CAAC,MAAM,sBAAsB,GAAoB;IACrD,UAAU,EAAE,iBAAiB;IAC7B,WAAW,EAAE,kBAAkB;IAC/B,MAAM,EAAE,WAAW;CACpB,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export * from './enableGlColorAdjustmentGuards';
|
|
2
|
+
export * from './glBitmap';
|
|
3
|
+
export * from './glCache';
|
|
4
|
+
export * from './glClip';
|
|
5
|
+
export * from './glClipContours';
|
|
6
|
+
export * from './glClipRectangle';
|
|
7
|
+
export * from './glColorAdjustment';
|
|
8
|
+
export * from './glDefaultMaterial';
|
|
9
|
+
export * from './glNode2D';
|
|
10
|
+
export * from './glNode2DRegistration';
|
|
11
|
+
export * from './glParticleEmitter2D';
|
|
12
|
+
export * from './glQuadBatch';
|
|
13
|
+
export * from './glRichText';
|
|
14
|
+
export * from './glScale9Mapper';
|
|
15
|
+
export * from './glScale9Shape';
|
|
16
|
+
export * from './glShape';
|
|
17
|
+
export * from './glShapeMesh';
|
|
18
|
+
export * from './glSprite';
|
|
19
|
+
export * from './glSpriteBatch';
|
|
20
|
+
export * from './glSpriteRenderer';
|
|
21
|
+
export * from './glTextInput';
|
|
22
|
+
export * from './glTextLabel';
|
|
23
|
+
export * from './glTilemap';
|
|
24
|
+
export * from './glVelocity';
|
|
25
|
+
export * from './glVideo';
|
|
26
|
+
export { defaultCanvasBeginBitmapFill as defaultGlBeginBitmapFill, defaultCanvasBeginFill as defaultGlBeginFill, defaultCanvasBeginGradientFill as defaultGlBeginGradientFill, defaultCanvasCubicCurveTo as defaultGlCubicCurveTo, defaultCanvasCurveTo as defaultGlCurveTo, defaultCanvasDrawCircle as defaultGlDrawCircle, defaultCanvasDrawEllipse as defaultGlDrawEllipse, defaultCanvasDrawRectangle as defaultGlDrawRectangle, defaultCanvasDrawRoundRectangle as defaultGlDrawRoundRectangle, defaultCanvasEndFill as defaultGlEndFill, defaultCanvasLineStyle as defaultGlLineStyle, defaultCanvasLineTo as defaultGlLineTo, defaultCanvasMoveTo as defaultGlMoveTo, defaultCanvasShapeCommands as defaultGlShapeCommands, registerCanvasShapeCommands as registerGlShapeCommands, } from '@flighthq/scene2d-canvas';
|
|
27
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAC;AAChD,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,YAAY,CAAC;AAC3B,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAG1B,OAAO,EACL,4BAA4B,IAAI,wBAAwB,EACxD,sBAAsB,IAAI,kBAAkB,EAC5C,8BAA8B,IAAI,0BAA0B,EAC5D,yBAAyB,IAAI,qBAAqB,EAClD,oBAAoB,IAAI,gBAAgB,EACxC,uBAAuB,IAAI,mBAAmB,EAC9C,wBAAwB,IAAI,oBAAoB,EAChD,0BAA0B,IAAI,sBAAsB,EACpD,+BAA+B,IAAI,2BAA2B,EAC9D,oBAAoB,IAAI,gBAAgB,EACxC,sBAAsB,IAAI,kBAAkB,EAC5C,mBAAmB,IAAI,eAAe,EACtC,mBAAmB,IAAI,eAAe,EACtC,0BAA0B,IAAI,sBAAsB,EACpD,2BAA2B,IAAI,uBAAuB,GACvD,MAAM,0BAA0B,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export * from './enableGlColorAdjustmentGuards';
|
|
2
|
+
export * from './glBitmap';
|
|
3
|
+
export * from './glCache';
|
|
4
|
+
export * from './glClip';
|
|
5
|
+
export * from './glClipContours';
|
|
6
|
+
export * from './glClipRectangle';
|
|
7
|
+
export * from './glColorAdjustment';
|
|
8
|
+
export * from './glDefaultMaterial';
|
|
9
|
+
export * from './glNode2D';
|
|
10
|
+
export * from './glNode2DRegistration';
|
|
11
|
+
export * from './glParticleEmitter2D';
|
|
12
|
+
export * from './glQuadBatch';
|
|
13
|
+
export * from './glRichText';
|
|
14
|
+
export * from './glScale9Mapper';
|
|
15
|
+
export * from './glScale9Shape';
|
|
16
|
+
export * from './glShape';
|
|
17
|
+
export * from './glShapeMesh';
|
|
18
|
+
export * from './glSprite';
|
|
19
|
+
export * from './glSpriteBatch';
|
|
20
|
+
export * from './glSpriteRenderer';
|
|
21
|
+
export * from './glTextInput';
|
|
22
|
+
export * from './glTextLabel';
|
|
23
|
+
export * from './glTilemap';
|
|
24
|
+
export * from './glVelocity';
|
|
25
|
+
export * from './glVideo';
|
|
26
|
+
// Re-export shape commands from canvas (shapes deferred to canvas for now)
|
|
27
|
+
export { defaultCanvasBeginBitmapFill as defaultGlBeginBitmapFill, defaultCanvasBeginFill as defaultGlBeginFill, defaultCanvasBeginGradientFill as defaultGlBeginGradientFill, defaultCanvasCubicCurveTo as defaultGlCubicCurveTo, defaultCanvasCurveTo as defaultGlCurveTo, defaultCanvasDrawCircle as defaultGlDrawCircle, defaultCanvasDrawEllipse as defaultGlDrawEllipse, defaultCanvasDrawRectangle as defaultGlDrawRectangle, defaultCanvasDrawRoundRectangle as defaultGlDrawRoundRectangle, defaultCanvasEndFill as defaultGlEndFill, defaultCanvasLineStyle as defaultGlLineStyle, defaultCanvasLineTo as defaultGlLineTo, defaultCanvasMoveTo as defaultGlMoveTo, defaultCanvasShapeCommands as defaultGlShapeCommands, registerCanvasShapeCommands as registerGlShapeCommands, } from '@flighthq/scene2d-canvas';
|
|
28
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAC;AAChD,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,YAAY,CAAC;AAC3B,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAE1B,2EAA2E;AAC3E,OAAO,EACL,4BAA4B,IAAI,wBAAwB,EACxD,sBAAsB,IAAI,kBAAkB,EAC5C,8BAA8B,IAAI,0BAA0B,EAC5D,yBAAyB,IAAI,qBAAqB,EAClD,oBAAoB,IAAI,gBAAgB,EACxC,uBAAuB,IAAI,mBAAmB,EAC9C,wBAAwB,IAAI,oBAAoB,EAChD,0BAA0B,IAAI,sBAAsB,EACpD,+BAA+B,IAAI,2BAA2B,EAC9D,oBAAoB,IAAI,gBAAgB,EACxC,sBAAsB,IAAI,kBAAkB,EAC5C,mBAAmB,IAAI,eAAe,EACtC,mBAAmB,IAAI,eAAe,EACtC,0BAA0B,IAAI,sBAAsB,EACpD,2BAA2B,IAAI,uBAAuB,GACvD,MAAM,0BAA0B,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Makes vi.doMock-based module mocking safe under the shared (isolate:false) worker the root vitest
|
|
3
|
+
* config uses. Call once at the top of a test file with every module id the file mocks, then apply
|
|
4
|
+
* the mocks and dynamically import the subject inside a beforeAll — both must stay in the test file
|
|
5
|
+
* so relative ids resolve against it. (This helper is colocated in the same package src, so the
|
|
6
|
+
* doUnmock ids passed here resolve to the same modules the test's doMock ids do.)
|
|
7
|
+
*
|
|
8
|
+
* It brackets the file with two vi.resetModules() calls. The first is registered here so it runs
|
|
9
|
+
* before the file's own beforeAll applies the mocks: it forces a subject a sibling already evaluated
|
|
10
|
+
* against the real modules to re-evaluate under the mocks (otherwise the dynamic import returns the
|
|
11
|
+
* cached, real-bound copy). The second, after unmocking, drops the mocked instances so a later file
|
|
12
|
+
* re-imports the real modules instead of the mock left in the shared registry.
|
|
13
|
+
*/
|
|
14
|
+
export declare function scopeModuleMocks(mockedIds: readonly string[]): void;
|
|
15
|
+
//# sourceMappingURL=moduleMockTestHelper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"moduleMockTestHelper.d.ts","sourceRoot":"","sources":["../src/moduleMockTestHelper.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI,CAQnE"}
|