@luma.gl/engine 9.1.9 → 9.2.0-alpha.2
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 +5 -0
- package/dist/animation-loop/animation-loop.d.ts +12 -12
- package/dist/animation-loop/animation-loop.d.ts.map +1 -1
- package/dist/animation-loop/animation-loop.js +26 -62
- package/dist/animation-loop/animation-loop.js.map +1 -1
- package/dist/animation-loop/animation-props.d.ts +3 -4
- package/dist/animation-loop/animation-props.d.ts.map +1 -1
- package/dist/animation-loop/make-animation-loop.d.ts +4 -1
- package/dist/animation-loop/make-animation-loop.d.ts.map +1 -1
- package/dist/animation-loop/make-animation-loop.js +39 -7
- package/dist/animation-loop/make-animation-loop.js.map +1 -1
- package/dist/async-texture/async-texture.d.ts +106 -2
- package/dist/async-texture/async-texture.d.ts.map +1 -1
- package/dist/async-texture/async-texture.js +281 -13
- package/dist/async-texture/async-texture.js.map +1 -1
- package/dist/compute/computation.d.ts +1 -1
- package/dist/compute/computation.d.ts.map +1 -1
- package/dist/compute/computation.js +2 -2
- package/dist/compute/computation.js.map +1 -1
- package/dist/compute/swap.d.ts.map +1 -1
- package/dist/compute/swap.js +6 -2
- package/dist/compute/swap.js.map +1 -1
- package/dist/compute/texture-transform.d.ts.map +1 -1
- package/dist/compute/texture-transform.js +4 -2
- package/dist/compute/texture-transform.js.map +1 -1
- package/dist/debug/copy-texture-to-image.d.ts +23 -1
- package/dist/debug/copy-texture-to-image.d.ts.map +1 -1
- package/dist/debug/copy-texture-to-image.js +37 -1
- package/dist/debug/copy-texture-to-image.js.map +1 -1
- package/dist/dist.dev.js +566 -232
- package/dist/dist.min.js +26 -26
- package/dist/factories/pipeline-factory.d.ts +11 -1
- package/dist/factories/pipeline-factory.d.ts.map +1 -1
- package/dist/factories/pipeline-factory.js +107 -25
- package/dist/factories/pipeline-factory.js.map +1 -1
- package/dist/factories/shader-factory.d.ts +5 -1
- package/dist/factories/shader-factory.d.ts.map +1 -1
- package/dist/factories/shader-factory.js +40 -6
- package/dist/factories/shader-factory.js.map +1 -1
- package/dist/geometries/cube-geometry.d.ts +3 -3
- package/dist/geometries/cube-geometry.d.ts.map +1 -1
- package/dist/geometry/geometry.d.ts.map +1 -1
- package/dist/geometry/geometry.js +3 -2
- package/dist/geometry/geometry.js.map +1 -1
- package/dist/index.cjs +581 -251
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/model/model.d.ts +4 -25
- package/dist/model/model.d.ts.map +1 -1
- package/dist/model/model.js +26 -71
- package/dist/model/model.js.map +1 -1
- package/dist/models/billboard-texture-model.d.ts.map +1 -1
- package/dist/models/billboard-texture-model.js +6 -4
- package/dist/models/billboard-texture-model.js.map +1 -1
- package/dist/modules/picking/legacy-picking-manager.d.ts +1 -1
- package/dist/modules/picking/legacy-picking-manager.d.ts.map +1 -1
- package/dist/modules/picking/legacy-picking-manager.js +1 -1
- package/dist/modules/picking/legacy-picking-manager.js.map +1 -1
- package/dist/modules/picking/picking-manager.d.ts +2 -2
- package/dist/modules/picking/picking-manager.d.ts.map +1 -1
- package/dist/modules/picking/picking-manager.js +2 -2
- package/dist/modules/picking/picking-manager.js.map +1 -1
- package/dist/passes/get-fragment-shader.js +2 -2
- package/dist/passes/shader-pass-renderer.d.ts +4 -4
- package/dist/passes/shader-pass-renderer.d.ts.map +1 -1
- package/dist/passes/shader-pass-renderer.js +15 -5
- package/dist/passes/shader-pass-renderer.js.map +1 -1
- package/dist/shader-inputs.js +1 -1
- package/dist/shader-inputs.js.map +1 -1
- package/dist/utils/buffer-layout-helper.d.ts +12 -0
- package/dist/utils/buffer-layout-helper.d.ts.map +1 -0
- package/dist/utils/buffer-layout-helper.js +41 -0
- package/dist/utils/buffer-layout-helper.js.map +1 -0
- package/dist/utils/buffer-layout-order.d.ts +3 -0
- package/dist/utils/buffer-layout-order.d.ts.map +1 -0
- package/dist/utils/buffer-layout-order.js +16 -0
- package/dist/utils/buffer-layout-order.js.map +1 -0
- package/package.json +4 -4
- package/src/animation-loop/animation-loop.ts +31 -71
- package/src/animation-loop/animation-props.ts +3 -5
- package/src/animation-loop/make-animation-loop.ts +41 -9
- package/src/async-texture/async-texture.ts +386 -23
- package/src/async-texture/texture-setters.ts.disabled +296 -0
- package/src/compute/computation.ts +3 -3
- package/src/compute/swap.ts +7 -2
- package/src/compute/texture-transform.ts +4 -2
- package/src/debug/copy-texture-to-image.ts +52 -2
- package/src/factories/pipeline-factory.ts +122 -26
- package/src/factories/shader-factory.ts +43 -7
- package/src/geometry/geometry.ts +3 -2
- package/src/index.ts +12 -0
- package/src/model/model.ts +31 -86
- package/src/models/billboard-texture-model.ts +6 -4
- package/src/modules/picking/legacy-picking-manager.ts +2 -2
- package/src/modules/picking/picking-manager.ts +3 -3
- package/src/passes/get-fragment-shader.ts +2 -2
- package/src/passes/shader-pass-renderer.ts +18 -8
- package/src/shader-inputs.ts +1 -1
- package/src/utils/buffer-layout-helper.ts +51 -0
- package/src/utils/buffer-layout-order.ts +26 -0
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// luma.gl
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
|
-
import { flipRows, scalePixels } from "./pixel-data-utils.js";
|
|
5
4
|
/**
|
|
6
5
|
* Reads pixels from a Framebuffer or Texture object into an HTML Image
|
|
7
6
|
* @todo - can we move this to @luma.gl/core?
|
|
@@ -44,4 +43,41 @@ export function copyTextureToDataUrl(source, options = {}) {
|
|
|
44
43
|
context.putImageData(imageData, 0, 0);
|
|
45
44
|
return canvas.toDataURL('image/png');
|
|
46
45
|
}
|
|
46
|
+
// HELPERS
|
|
47
|
+
/**
|
|
48
|
+
* Flip rows (can be used on arrays returned from `Framebuffer.readPixels`)
|
|
49
|
+
* https: *stackoverflow.com/questions/41969562/
|
|
50
|
+
* how-can-i-flip-the-result-of-webglrenderingcontext-readpixels
|
|
51
|
+
* @param param0
|
|
52
|
+
*/
|
|
53
|
+
export function flipRows(options) {
|
|
54
|
+
const { data, width, height, bytesPerPixel = 4, temp } = options;
|
|
55
|
+
const bytesPerRow = width * bytesPerPixel;
|
|
56
|
+
// make a temp buffer to hold one row
|
|
57
|
+
const tempBuffer = temp || new Uint8Array(bytesPerRow);
|
|
58
|
+
for (let y = 0; y < height / 2; ++y) {
|
|
59
|
+
const topOffset = y * bytesPerRow;
|
|
60
|
+
const bottomOffset = (height - y - 1) * bytesPerRow;
|
|
61
|
+
// make copy of a row on the top half
|
|
62
|
+
tempBuffer.set(data.subarray(topOffset, topOffset + bytesPerRow));
|
|
63
|
+
// copy a row from the bottom half to the top
|
|
64
|
+
data.copyWithin(topOffset, bottomOffset, bottomOffset + bytesPerRow);
|
|
65
|
+
// copy the copy of the top half row to the bottom half
|
|
66
|
+
data.set(tempBuffer, bottomOffset);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
export function scalePixels(options) {
|
|
70
|
+
const { data, width, height } = options;
|
|
71
|
+
const newWidth = Math.round(width / 2);
|
|
72
|
+
const newHeight = Math.round(height / 2);
|
|
73
|
+
const newData = new Uint8Array(newWidth * newHeight * 4);
|
|
74
|
+
for (let y = 0; y < newHeight; y++) {
|
|
75
|
+
for (let x = 0; x < newWidth; x++) {
|
|
76
|
+
for (let c = 0; c < 4; c++) {
|
|
77
|
+
newData[(y * newWidth + x) * 4 + c] = data[(y * 2 * width + x * 2) * 4 + c];
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return { data: newData, width: newWidth, height: newHeight };
|
|
82
|
+
}
|
|
47
83
|
//# sourceMappingURL=copy-texture-to-image.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"copy-texture-to-image.js","sourceRoot":"","sources":["../../src/debug/copy-texture-to-image.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;
|
|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