@woosh/meep-engine 2.72.0 → 2.74.0
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/build/bundle-worker-image-decoder.js +1 -1
- package/build/meep.cjs +38 -189
- package/build/meep.min.js +1 -1
- package/build/meep.module.js +38 -189
- package/package.json +3 -2
- package/src/engine/asset/loaders/image/codec/NativeImageDecoder.js +2 -1
- package/src/engine/asset/loaders/image/codec/ThreadedImageDecoder.js +4 -5
- package/src/engine/asset/loaders/image/png/PNGReader.js +23 -19
- package/src/engine/graphics/ecs/camera/FrustumProjector.js +31 -182
- package/src/engine/graphics/generate_halton_jitter.js +21 -0
- package/src/engine/graphics/render/buffer/simple-fx/taa/TemporalSupersamplingRenderPlugin.js +3 -20
- package/src/engine/graphics/texture/virtual/v2/NOTES.md +11 -1
- package/src/engine/graphics/texture/virtual/v2/ShaderUsage.js +7 -5
- package/src/engine/graphics/texture/virtual/v2/SparseTexture.js +291 -0
- package/src/engine/graphics/texture/virtual/v2/TileLoader.js +232 -0
- package/src/engine/graphics/texture/virtual/v2/UsageMetadata.js +118 -134
- package/src/engine/graphics/texture/virtual/v2/VirtualTextureManager.js +73 -9
- package/src/engine/graphics/texture/virtual/v2/debug/ResidencyDebugView.js +58 -0
- package/src/engine/graphics/texture/virtual/v2/debug/UsageDebugView.js +63 -0
- package/src/engine/graphics/texture/virtual/v2/{UsagePyramidDebugView.js → debug/UsagePyramidDebugView.js} +27 -23
- package/src/engine/graphics/texture/virtual/v2/prototype.js +62 -19
- package/src/engine/graphics/texture/virtual/v2/tile/TextureTile.js +31 -0
- package/src/engine/graphics/texture/virtual/v2/tile/compose_finger_print.js +23 -0
- package/src/engine/graphics/texture/virtual/v2/tile/compose_tile_address.js +22 -0
- package/src/engine/graphics/texture/virtual/v2/tile/decompose_finger_print.js +12 -0
- package/src/engine/graphics/texture/virtual/v2/tile/finger_print_to_tile_address.js +16 -0
- package/src/engine/graphics/texture/virtual/v2/tile/tile_address_to_finger_print.js +35 -0
- package/src/view/CSS_ABSOLUTE_POSITIONING.js +5 -0
- package/src/engine/graphics/clouds/MaterialTransformer.js +0 -0
- package/src/engine/graphics/clouds/TerrainCloudsPlugin.js +0 -0
- package/src/engine/graphics/clouds/cs_build_fragment_shader.js +0 -0
- package/src/engine/graphics/clouds/cs_build_vertex_shader.js +0 -0
- package/src/engine/graphics/ecs/camera/TiltCameraController.js +0 -69
- package/src/engine/graphics/ecs/camera/is_valid_distance_value.js +0 -11
- package/src/engine/graphics/texture/virtual/v2/UsageDebugView.js +0 -51
package/build/meep.module.js
CHANGED
|
@@ -69586,9 +69586,8 @@ class ThreadedImageDecoder extends Codec {
|
|
|
69586
69586
|
return true;
|
|
69587
69587
|
}
|
|
69588
69588
|
|
|
69589
|
-
|
|
69590
|
-
|
|
69591
|
-
return result;
|
|
69589
|
+
decode(data) {
|
|
69590
|
+
return this.worker.request('decode', [data.buffer]);
|
|
69592
69591
|
}
|
|
69593
69592
|
}
|
|
69594
69593
|
|
|
@@ -69621,7 +69620,8 @@ class NativeImageDecoder extends Codec {
|
|
|
69621
69620
|
const image = new Image();
|
|
69622
69621
|
|
|
69623
69622
|
// convert binary data to image URL that we can load
|
|
69624
|
-
const
|
|
69623
|
+
const blob = new Blob([data]);
|
|
69624
|
+
const url = URL.createObjectURL(blob);
|
|
69625
69625
|
|
|
69626
69626
|
image.src = url;
|
|
69627
69627
|
|
|
@@ -111512,7 +111512,7 @@ function aabb3_matrix4_project_by_corners(
|
|
|
111512
111512
|
result[5] = z1;
|
|
111513
111513
|
}
|
|
111514
111514
|
|
|
111515
|
-
const corners = [];
|
|
111515
|
+
const corners$1 = [];
|
|
111516
111516
|
|
|
111517
111517
|
class Decal extends AbstractLight {
|
|
111518
111518
|
constructor() {
|
|
@@ -111598,9 +111598,9 @@ class Decal extends AbstractLight {
|
|
|
111598
111598
|
}
|
|
111599
111599
|
|
|
111600
111600
|
getAABB(result) {
|
|
111601
|
-
aabb3_build_corners(corners, 0, -0.5, -0.5, -0.5, 0.5, 0.5, 0.5);
|
|
111601
|
+
aabb3_build_corners(corners$1, 0, -0.5, -0.5, -0.5, 0.5, 0.5, 0.5);
|
|
111602
111602
|
|
|
111603
|
-
aabb3_matrix4_project_by_corners(result, corners, this.transform);
|
|
111603
|
+
aabb3_matrix4_project_by_corners(result, corners$1, this.transform);
|
|
111604
111604
|
}
|
|
111605
111605
|
|
|
111606
111606
|
toArray(destination, address) {
|
|
@@ -113432,190 +113432,41 @@ class ForwardPlusRenderingPlugin extends EnginePlugin {
|
|
|
113432
113432
|
*/
|
|
113433
113433
|
|
|
113434
113434
|
|
|
113435
|
-
const
|
|
113436
|
-
|
|
113437
|
-
|
|
113438
|
-
new Vector3(-1, -1, 0),
|
|
113439
|
-
|
|
113440
|
-
new Vector3(-1, 1, 0),
|
|
113441
|
-
new Vector3(-1, 1, 0),
|
|
113442
|
-
|
|
113443
|
-
new Vector3(1, -1, 0),
|
|
113444
|
-
new Vector3(1, -1, 0),
|
|
113445
|
-
|
|
113446
|
-
new Vector3(1, 1, 0),
|
|
113447
|
-
new Vector3(1, 1, 0)
|
|
113448
|
-
];
|
|
113449
|
-
|
|
113450
|
-
|
|
113451
|
-
/**
|
|
113452
|
-
*
|
|
113453
|
-
* @param {Number} nearZ
|
|
113454
|
-
* @param {Number} farZ
|
|
113455
|
-
* @param {THREE.Camera} camera
|
|
113456
|
-
* @param {THREE.Matrix4} matrixWorldInverse
|
|
113457
|
-
* @param {function} callback
|
|
113458
|
-
*/
|
|
113459
|
-
function projectInWorldSpace(nearZ, farZ, camera, callback) {
|
|
113460
|
-
corners[0].set(-1, -1, nearZ);
|
|
113461
|
-
corners[1].set(-1, -1, farZ);
|
|
113462
|
-
|
|
113463
|
-
corners[2].set(-1, 1, nearZ);
|
|
113464
|
-
corners[3].set(-1, 1, farZ);
|
|
113465
|
-
|
|
113466
|
-
corners[4].set(1, -1, nearZ);
|
|
113467
|
-
corners[5].set(1, -1, farZ);
|
|
113468
|
-
|
|
113469
|
-
corners[6].set(1, 1, nearZ);
|
|
113470
|
-
corners[7].set(1, 1, farZ);
|
|
113471
|
-
|
|
113472
|
-
//compute corners of view frustum in light space
|
|
113473
|
-
let x0 = Number.POSITIVE_INFINITY;
|
|
113474
|
-
let y0 = Number.POSITIVE_INFINITY;
|
|
113475
|
-
let z0 = Number.POSITIVE_INFINITY;
|
|
113476
|
-
|
|
113477
|
-
let x1 = Number.NEGATIVE_INFINITY;
|
|
113478
|
-
let y1 = Number.NEGATIVE_INFINITY;
|
|
113479
|
-
let z1 = Number.NEGATIVE_INFINITY;
|
|
113435
|
+
const corners = [
|
|
113436
|
+
new Vector3(-1, -1, 0),
|
|
113437
|
+
new Vector3(-1, -1, 0),
|
|
113480
113438
|
|
|
113439
|
+
new Vector3(-1, 1, 0),
|
|
113440
|
+
new Vector3(-1, 1, 0),
|
|
113481
113441
|
|
|
113482
|
-
|
|
113483
|
-
|
|
113484
|
-
corner.unproject(camera);
|
|
113442
|
+
new Vector3(1, -1, 0),
|
|
113443
|
+
new Vector3(1, -1, 0),
|
|
113485
113444
|
|
|
113486
|
-
|
|
113487
|
-
|
|
113488
|
-
|
|
113489
|
-
if (corner.x > x1) {
|
|
113490
|
-
x1 = corner.x;
|
|
113491
|
-
}
|
|
113492
|
-
|
|
113493
|
-
if (corner.y < y0) {
|
|
113494
|
-
y0 = corner.y;
|
|
113495
|
-
}
|
|
113496
|
-
if (corner.y > y1) {
|
|
113497
|
-
y1 = corner.y;
|
|
113498
|
-
}
|
|
113499
|
-
|
|
113500
|
-
if (corner.z < z0) {
|
|
113501
|
-
z0 = corner.z;
|
|
113502
|
-
}
|
|
113503
|
-
if (corner.z > z1) {
|
|
113504
|
-
z1 = corner.z;
|
|
113505
|
-
}
|
|
113506
|
-
}
|
|
113507
|
-
|
|
113508
|
-
callback(x0, y0, z0, x1, y1, z1);
|
|
113509
|
-
}
|
|
113510
|
-
|
|
113511
|
-
return projectInWorldSpace;
|
|
113512
|
-
})();
|
|
113513
|
-
|
|
113514
|
-
const project = (function () {
|
|
113515
|
-
const corners = [
|
|
113516
|
-
new Vector3(-1, -1, 0),
|
|
113517
|
-
new Vector3(-1, -1, 0),
|
|
113518
|
-
|
|
113519
|
-
new Vector3(-1, 1, 0),
|
|
113520
|
-
new Vector3(-1, 1, 0),
|
|
113521
|
-
|
|
113522
|
-
new Vector3(1, -1, 0),
|
|
113523
|
-
new Vector3(1, -1, 0),
|
|
113524
|
-
|
|
113525
|
-
new Vector3(1, 1, 0),
|
|
113526
|
-
new Vector3(1, 1, 0)
|
|
113527
|
-
];
|
|
113528
|
-
|
|
113529
|
-
|
|
113530
|
-
/**
|
|
113531
|
-
*
|
|
113532
|
-
* @param {Number} nearZ
|
|
113533
|
-
* @param {Number} farZ
|
|
113534
|
-
* @param {THREE.Camera} camera
|
|
113535
|
-
* @param {THREE.Matrix4} matrixWorldInverse
|
|
113536
|
-
* @param {AABB3} result
|
|
113537
|
-
*/
|
|
113538
|
-
function project(nearZ, farZ, camera, matrixWorldInverse, result) {
|
|
113539
|
-
corners[0].set(-1, -1, nearZ);
|
|
113540
|
-
corners[1].set(-1, -1, farZ);
|
|
113541
|
-
|
|
113542
|
-
corners[2].set(-1, 1, nearZ);
|
|
113543
|
-
corners[3].set(-1, 1, farZ);
|
|
113544
|
-
|
|
113545
|
-
corners[4].set(1, -1, nearZ);
|
|
113546
|
-
corners[5].set(1, -1, farZ);
|
|
113547
|
-
|
|
113548
|
-
corners[6].set(1, 1, nearZ);
|
|
113549
|
-
corners[7].set(1, 1, farZ);
|
|
113550
|
-
|
|
113551
|
-
//compute corners of view frustum in light space
|
|
113552
|
-
let x0 = Number.POSITIVE_INFINITY;
|
|
113553
|
-
let y0 = Number.POSITIVE_INFINITY;
|
|
113554
|
-
let z0 = Number.POSITIVE_INFINITY;
|
|
113555
|
-
|
|
113556
|
-
let x1 = Number.NEGATIVE_INFINITY;
|
|
113557
|
-
let y1 = Number.NEGATIVE_INFINITY;
|
|
113558
|
-
let z1 = Number.NEGATIVE_INFINITY;
|
|
113559
|
-
|
|
113560
|
-
|
|
113561
|
-
for (let i = 0; i < 8; i++) {
|
|
113562
|
-
const corner = corners[i];
|
|
113563
|
-
corner.unproject(camera);
|
|
113564
|
-
corner.applyMatrix4(matrixWorldInverse);
|
|
113565
|
-
|
|
113566
|
-
if (corner.x < x0) {
|
|
113567
|
-
x0 = corner.x;
|
|
113568
|
-
}
|
|
113569
|
-
if (corner.x > x1) {
|
|
113570
|
-
x1 = corner.x;
|
|
113571
|
-
}
|
|
113572
|
-
|
|
113573
|
-
if (corner.y < y0) {
|
|
113574
|
-
y0 = corner.y;
|
|
113575
|
-
}
|
|
113576
|
-
if (corner.y > y1) {
|
|
113577
|
-
y1 = corner.y;
|
|
113578
|
-
}
|
|
113579
|
-
|
|
113580
|
-
if (corner.z < z0) {
|
|
113581
|
-
z0 = corner.z;
|
|
113582
|
-
}
|
|
113583
|
-
if (corner.z > z1) {
|
|
113584
|
-
z1 = corner.z;
|
|
113585
|
-
}
|
|
113586
|
-
}
|
|
113587
|
-
|
|
113588
|
-
result.setBounds(x0, y0, z0, x1, y1, z1);
|
|
113589
|
-
}
|
|
113445
|
+
new Vector3(1, 1, 0),
|
|
113446
|
+
new Vector3(1, 1, 0)
|
|
113447
|
+
];
|
|
113590
113448
|
|
|
113591
|
-
return project;
|
|
113592
|
-
})();
|
|
113593
113449
|
|
|
113594
113450
|
/**
|
|
113595
113451
|
*
|
|
113596
|
-
* @param
|
|
113597
|
-
* @param
|
|
113598
|
-
* @param
|
|
113599
|
-
* @param
|
|
113600
|
-
* @param
|
|
113601
|
-
* @param _z1
|
|
113602
|
-
* @param {Camera} camera
|
|
113603
|
-
* @param callback
|
|
113452
|
+
* @param {Number} nearZ
|
|
113453
|
+
* @param {Number} farZ
|
|
113454
|
+
* @param {THREE.Camera} camera
|
|
113455
|
+
* @param {THREE.Matrix4} matrixWorldInverse
|
|
113456
|
+
* @param {AABB3} result
|
|
113604
113457
|
*/
|
|
113605
|
-
function
|
|
113606
|
-
|
|
113607
|
-
|
|
113608
|
-
new Vector3(_x0, _y0, _z1),
|
|
113458
|
+
function project(nearZ, farZ, camera, matrixWorldInverse, result) {
|
|
113459
|
+
corners[0].set(-1, -1, nearZ);
|
|
113460
|
+
corners[1].set(-1, -1, farZ);
|
|
113609
113461
|
|
|
113610
|
-
|
|
113611
|
-
|
|
113462
|
+
corners[2].set(-1, 1, nearZ);
|
|
113463
|
+
corners[3].set(-1, 1, farZ);
|
|
113612
113464
|
|
|
113613
|
-
|
|
113614
|
-
|
|
113465
|
+
corners[4].set(1, -1, nearZ);
|
|
113466
|
+
corners[5].set(1, -1, farZ);
|
|
113615
113467
|
|
|
113616
|
-
|
|
113617
|
-
|
|
113618
|
-
];
|
|
113468
|
+
corners[6].set(1, 1, nearZ);
|
|
113469
|
+
corners[7].set(1, 1, farZ);
|
|
113619
113470
|
|
|
113620
113471
|
//compute corners of view frustum in light space
|
|
113621
113472
|
let x0 = Number.POSITIVE_INFINITY;
|
|
@@ -113627,8 +113478,10 @@ function unproject(_x0, _y0, _z0, _x1, _y1, _z1, camera, callback) {
|
|
|
113627
113478
|
let z1 = Number.NEGATIVE_INFINITY;
|
|
113628
113479
|
|
|
113629
113480
|
|
|
113630
|
-
|
|
113631
|
-
corner
|
|
113481
|
+
for (let i = 0; i < 8; i++) {
|
|
113482
|
+
const corner = corners[i];
|
|
113483
|
+
corner.unproject(camera);
|
|
113484
|
+
corner.applyMatrix4(matrixWorldInverse);
|
|
113632
113485
|
|
|
113633
113486
|
if (corner.x < x0) {
|
|
113634
113487
|
x0 = corner.x;
|
|
@@ -113650,21 +113503,17 @@ function unproject(_x0, _y0, _z0, _x1, _y1, _z1, camera, callback) {
|
|
|
113650
113503
|
if (corner.z > z1) {
|
|
113651
113504
|
z1 = corner.z;
|
|
113652
113505
|
}
|
|
113653
|
-
}
|
|
113506
|
+
}
|
|
113654
113507
|
|
|
113655
|
-
|
|
113508
|
+
result.setBounds(x0, y0, z0, x1, y1, z1);
|
|
113656
113509
|
}
|
|
113657
113510
|
|
|
113511
|
+
|
|
113658
113512
|
var FrustumProjector = {
|
|
113659
113513
|
/**
|
|
113660
113514
|
* @deprecated use non-threejs specific code
|
|
113661
113515
|
*/
|
|
113662
113516
|
project,
|
|
113663
|
-
unproject,
|
|
113664
|
-
/**
|
|
113665
|
-
* @deprecated use non-threejs specific code
|
|
113666
|
-
*/
|
|
113667
|
-
projectInWorldSpace
|
|
113668
113517
|
};
|
|
113669
113518
|
|
|
113670
113519
|
class SystemEntityContext {
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"description": "Fully featured ECS game engine written in JavaScript",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"author": "Alexander Goldring",
|
|
8
|
-
"version": "2.
|
|
8
|
+
"version": "2.74.0",
|
|
9
9
|
"main": "build/meep.module.js",
|
|
10
10
|
"module": "build/meep.module.js",
|
|
11
11
|
"exports": {
|
|
@@ -39,7 +39,8 @@
|
|
|
39
39
|
"gl-matrix": "3.4.3",
|
|
40
40
|
"opentype.js": "1.3.3",
|
|
41
41
|
"robust-predicates": "3.0.1",
|
|
42
|
-
"simplex-noise": "2.4.0"
|
|
42
|
+
"simplex-noise": "2.4.0",
|
|
43
|
+
"pako": "2.0.3"
|
|
43
44
|
},
|
|
44
45
|
"peerDependencies": {
|
|
45
46
|
"three": ">=0.135.0 & <0.137.0"
|
|
@@ -29,7 +29,8 @@ export class NativeImageDecoder extends Codec {
|
|
|
29
29
|
const image = new Image();
|
|
30
30
|
|
|
31
31
|
// convert binary data to image URL that we can load
|
|
32
|
-
const
|
|
32
|
+
const blob = new Blob([data]);
|
|
33
|
+
const url = URL.createObjectURL(blob);
|
|
33
34
|
|
|
34
35
|
image.src = url;
|
|
35
36
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Codec } from "./Codec.js";
|
|
2
|
-
import WorkerBuilder from "../../../../../core/process/worker/WorkerBuilder.js";
|
|
3
1
|
import { OnDemandWorkerManager } from "../../../../../core/process/worker/OnDemandWorkerManager.js";
|
|
2
|
+
import WorkerBuilder from "../../../../../core/process/worker/WorkerBuilder.js";
|
|
4
3
|
import { PNG_HEADER_BYTES } from "../png/PNG_HEADER_BYTES.js";
|
|
4
|
+
import { Codec } from "./Codec.js";
|
|
5
5
|
|
|
6
6
|
export class ThreadedImageDecoder extends Codec {
|
|
7
7
|
constructor() {
|
|
@@ -35,8 +35,7 @@ export class ThreadedImageDecoder extends Codec {
|
|
|
35
35
|
return true;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
return result;
|
|
38
|
+
decode(data) {
|
|
39
|
+
return this.worker.request('decode', [data.buffer]);
|
|
41
40
|
}
|
|
42
41
|
}
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
"use strict";
|
|
3
3
|
|
|
4
4
|
import zlib from 'pako';
|
|
5
|
-
|
|
6
|
-
import { PNG } from './PNG.js';
|
|
7
5
|
import { BinaryBuffer } from "../../../../../core/binary/BinaryBuffer.js";
|
|
8
6
|
import { isArrayEqualStrict } from "../../../../../core/collection/array/isArrayEqualStrict.js";
|
|
9
|
-
import { PNG_HEADER_BYTES } from "./PNG_HEADER_BYTES.js";
|
|
10
7
|
import { crc } from "./crc.js";
|
|
11
8
|
|
|
9
|
+
import { PNG } from './PNG.js';
|
|
10
|
+
import { PNG_HEADER_BYTES } from "./PNG_HEADER_BYTES.js";
|
|
11
|
+
|
|
12
12
|
/**
|
|
13
13
|
*
|
|
14
14
|
* @param {Uint8Array} buffer
|
|
@@ -217,7 +217,7 @@ PNGReader.prototype.decodeiEXt = function (chunk) {
|
|
|
217
217
|
* Interlace method 1 byte
|
|
218
218
|
*/
|
|
219
219
|
PNGReader.prototype.decodeIHDR = function (chunk) {
|
|
220
|
-
|
|
220
|
+
const png = this.png;
|
|
221
221
|
|
|
222
222
|
png.setWidth(readUInt32(chunk, 0));
|
|
223
223
|
png.setHeight(readUInt32(chunk, 4));
|
|
@@ -263,7 +263,7 @@ PNGReader.prototype.decodeIEND = function () {
|
|
|
263
263
|
* Uncompress IDAT chunks
|
|
264
264
|
*/
|
|
265
265
|
PNGReader.prototype.decodePixels = function () {
|
|
266
|
-
|
|
266
|
+
const png = this.png;
|
|
267
267
|
|
|
268
268
|
const inflator = new zlib.Inflate();
|
|
269
269
|
|
|
@@ -292,21 +292,25 @@ PNGReader.prototype.decodePixels = function () {
|
|
|
292
292
|
|
|
293
293
|
PNGReader.prototype.interlaceNone = function (data) {
|
|
294
294
|
|
|
295
|
-
|
|
295
|
+
const png = this.png;
|
|
296
296
|
|
|
297
|
-
|
|
298
|
-
|
|
297
|
+
const bits_per_pixel = png.bitDepth;
|
|
298
|
+
const bits_per_line = png.colors * bits_per_pixel;
|
|
299
|
+
const bytes_per_pixel = Math.max(1, bits_per_line / 8);
|
|
300
|
+
|
|
301
|
+
const width = png.width;
|
|
302
|
+
const height = png.height;
|
|
299
303
|
|
|
300
304
|
// color bytes per row
|
|
301
|
-
const color_bytes_per_row = bytes_per_pixel *
|
|
305
|
+
const color_bytes_per_row = bytes_per_pixel * width;
|
|
306
|
+
|
|
307
|
+
const pixels = new Uint8Array(bytes_per_pixel * width * height);
|
|
302
308
|
|
|
303
|
-
|
|
304
|
-
// var scanline;
|
|
305
|
-
var offset = 0;
|
|
309
|
+
let offset = 0;
|
|
306
310
|
|
|
307
311
|
const data_length = data.length;
|
|
308
312
|
|
|
309
|
-
for (
|
|
313
|
+
for (let i = 0; i < data_length; i += color_bytes_per_row + 1) {
|
|
310
314
|
|
|
311
315
|
const scanline_address = i + 1;
|
|
312
316
|
|
|
@@ -367,7 +371,7 @@ PNGReader.prototype.unFilterNone = function (scanline, scanline_offset, pixels,
|
|
|
367
371
|
* Sub(x) = Raw(x) + Raw(x - bpp)
|
|
368
372
|
*/
|
|
369
373
|
PNGReader.prototype.unFilterSub = function (scanline, scanline_offset, pixels, bpp, of, length) {
|
|
370
|
-
|
|
374
|
+
let i = 0;
|
|
371
375
|
|
|
372
376
|
for (; i < bpp; i++) {
|
|
373
377
|
pixels[of + i] = scanline[i + scanline_offset];
|
|
@@ -387,7 +391,7 @@ PNGReader.prototype.unFilterSub = function (scanline, scanline_offset, pixels, b
|
|
|
387
391
|
* Up(x) = Raw(x) + Prior(x)
|
|
388
392
|
*/
|
|
389
393
|
PNGReader.prototype.unFilterUp = function (scanline, scanline_offset, pixels, bpp, of, length) {
|
|
390
|
-
|
|
394
|
+
let i = 0, byte, prev;
|
|
391
395
|
// Prior(x) is 0 for all x on the first scanline
|
|
392
396
|
if ((of - length) < 0) for (; i < length; i++) {
|
|
393
397
|
pixels[of + i] = scanline[i + scanline_offset];
|
|
@@ -406,7 +410,7 @@ PNGReader.prototype.unFilterUp = function (scanline, scanline_offset, pixels, bp
|
|
|
406
410
|
* Average(x) = Raw(x) + floor((Raw(x-bpp)+Prior(x))/2)
|
|
407
411
|
*/
|
|
408
412
|
PNGReader.prototype.unFilterAverage = function (scanline, scanline_offset, pixels, bpp, of, length) {
|
|
409
|
-
|
|
413
|
+
let i = 0, byte, prev, prior;
|
|
410
414
|
if ((of - length) < 0) {
|
|
411
415
|
// Prior(x) == 0 && Raw(x - bpp) == 0
|
|
412
416
|
for (; i < bpp; i++) {
|
|
@@ -460,7 +464,7 @@ PNGReader.prototype.unFilterAverage = function (scanline, scanline_offset, pixel
|
|
|
460
464
|
* end
|
|
461
465
|
*/
|
|
462
466
|
PNGReader.prototype.unFilterPaeth = function (scanline, scanline_offset, pixels, bpp, of, length) {
|
|
463
|
-
|
|
467
|
+
let i = 0, raw, a, b, c, p, pa, pb, pc, pr;
|
|
464
468
|
if ((of - length) < 0) {
|
|
465
469
|
// Prior(x) == 0 && Raw(x - bpp) == 0
|
|
466
470
|
for (; i < bpp; i++) {
|
|
@@ -525,7 +529,7 @@ PNGReader.prototype.parse = function () {
|
|
|
525
529
|
this.decodeHeader();
|
|
526
530
|
|
|
527
531
|
while (this.buffer.position < this.buffer.length) {
|
|
528
|
-
|
|
532
|
+
const type = this.decodeChunk();
|
|
529
533
|
// stop after IHDR chunk, or after IEND
|
|
530
534
|
// if (type === 'IHDR' && options.data === false || type === 'IEND') break;
|
|
531
535
|
if (type === 'IEND') {
|
|
@@ -533,7 +537,7 @@ PNGReader.prototype.parse = function () {
|
|
|
533
537
|
}
|
|
534
538
|
}
|
|
535
539
|
|
|
536
|
-
|
|
540
|
+
const png = this.png;
|
|
537
541
|
|
|
538
542
|
this.decodePixels();
|
|
539
543
|
|