@woosh/meep-engine 2.33.25 → 2.33.29
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/core/binary/BitSet.js +151 -167
- package/core/binary/BitSet.spec.js +99 -1
- package/core/binary/ValidatingBitSetWrapper.js +81 -0
- package/core/bvh2/aabb3/AABB3.js +3 -10
- package/core/cache/Cache.d.ts +4 -2
- package/core/cache/Cache.js +5 -2
- package/core/collection/HashMap.d.ts +9 -2
- package/core/collection/HashSet.d.ts +7 -2
- package/core/collection/HashSet.js +7 -2
- package/core/collection/array/typed/typed_array_copy.js +1 -1
- package/core/geom/3d/frustum/array_setFromProjectionMatrix.js +3 -3
- package/core/geom/3d/shape/AbstractShape3D.js +28 -1
- package/core/geom/3d/shape/TransformedShape3D.js +65 -10
- package/core/geom/3d/shape/TransformedShape3D.spec.js +33 -0
- package/core/geom/3d/shape/{CompositeShape.js → UnionShape3D.js} +27 -12
- package/core/geom/3d/shape/UnitCubeShape3D.js +77 -0
- package/core/geom/3d/shape/UnitCubeShape3D.spec.js +42 -0
- package/core/geom/3d/shape/UnitSphereShape3D.js +32 -1
- package/core/geom/3d/shape/util/compute_signed_distance_gradient_by_sampling.js +48 -0
- package/core/geom/3d/shape/util/shape_to_visual_entity.js +3 -3
- package/core/model/ObservedBoolean.d.ts +2 -0
- package/core/parser/simple/Token.d.ts +13 -0
- package/core/parser/simple/Token.js +61 -27
- package/editor/tools/FoliagePaintTool.js +4 -4
- package/engine/asset/loaders/GLTFAssetLoader.js +52 -1
- package/engine/asset/loaders/image/ImageDecoderWorker.js +4 -3
- package/engine/asset/loaders/image/ImageRGBADataAsset.js +3 -2
- package/engine/asset/loaders/image/ImageRGBADataLoader.js +3 -3
- package/engine/asset/loaders/image/codec/NativeImageDecoder.js +2 -1
- package/engine/asset/loaders/image/png/PNG.js +113 -6
- package/engine/asset/loaders/image/png/PNGReader.js +5 -0
- package/engine/asset/loaders/material/bitmap2sampler_gl.js +1 -1
- package/engine/asset/loaders/material/computeImageBitmapEquality.js +6 -1
- package/engine/asset/loaders/material/computeTextureEquality.js +40 -49
- package/engine/ecs/EntityComponentDataset.js +1 -1
- package/engine/ecs/foliage/InstancedFoliage.js +277 -266
- package/engine/ecs/foliage/ecs/Foliage2System.js +7 -7
- package/engine/ecs/foliage/ecs/InstancedMeshComponent.js +37 -0
- package/engine/ecs/foliage/ecs/{Foliage2.js → InstancedMeshLayer.js} +3 -45
- package/engine/ecs/foliage/ecs/InstancedMeshSerializationAdapter.js +6 -5
- package/engine/ecs/foliage/ecs/InstancedMeshUtils.js +7 -6
- package/engine/ecs/storage/binary/BinarySerializationRegistry.js +1 -1
- package/engine/ecs/terrain/ecs/layers/TerrainLayer.js +12 -16
- package/engine/graphics/ecs/highlight/plugin/OutlineRenderPlugin.js +2 -2
- package/engine/graphics/geometry/instancing/InstancedMeshGroup.js +14 -72
- package/engine/graphics/geometry/instancing/rewriteMaterial.js +70 -0
- package/engine/graphics/material/manager/MaterialManager.js +2 -1
- package/engine/graphics/micron/render/instanced/AttributeDataTexture.js +6 -4
- package/engine/graphics/micron/render/instanced/ThreeInstancedAdapter.js +0 -2
- package/engine/graphics/particles/particular/engine/shader/ShaderManager.js +1 -2
- package/engine/graphics/particles/particular/engine/shader/debugAtlas.js +1 -1
- package/engine/graphics/particles/particular/engine/utils/volume/prototypeParticleVolume.js +12 -9
- package/engine/graphics/render/buffer/simple-fx/ao/AmbientOcclusionPostProcessEffect.js +3 -4
- package/engine/graphics/render/forward_plus/materials/FPlusDebugMaterial.js +3 -3
- package/engine/graphics/render/forward_plus/materials/ForwardPlusThreeMaterial.js +1 -1
- package/engine/graphics/render/forward_plus/prototypeLightManager.js +4 -4
- package/engine/graphics/render/forward_plus/query/point_light_inside_volume.js +10 -9
- package/engine/graphics/shadows/ShadowMapRenderer.js +8 -2
- package/engine/graphics/texture/atlas/ManagedTextureAtlas.js +12 -1
- package/engine/graphics/texture/sampler/Sampler2D.js +3 -1
- package/engine/graphics/texture/sampler/convertTexture2Sampler2D.js +1 -1
- package/engine/graphics/texture/sampler/copy_Sampler2D_channel_data.js +66 -0
- package/engine/input/devices/KeyCodes.d.ts +1 -0
- package/package.json +1 -1
- package/view/minimap/gl/MinimapWorldGL.js +12 -5
|
@@ -63,7 +63,7 @@ import {
|
|
|
63
63
|
import { seededRandom } from "../../../../../../../core/math/random/seededRandom.js";
|
|
64
64
|
import { TransformedShape3D } from "../../../../../../../core/geom/3d/shape/TransformedShape3D.js";
|
|
65
65
|
import { mat4 } from "gl-matrix";
|
|
66
|
-
import {
|
|
66
|
+
import { UnionShape3D } from "../../../../../../../core/geom/3d/shape/UnionShape3D.js";
|
|
67
67
|
import { ShadedGeometry } from "../../../../../ecs/mesh-v2/ShadedGeometry.js";
|
|
68
68
|
import { DrawMode } from "../../../../../ecs/mesh-v2/DrawMode.js";
|
|
69
69
|
import { makeHelperBoxGeometry } from "../../../../../../../editor/process/symbolic/makeHelperBoxGeometry.js";
|
|
@@ -77,6 +77,7 @@ import ButtonView from "../../../../../../../view/elements/button/ButtonView.js"
|
|
|
77
77
|
import { UnitSphereShape3D } from "../../../../../../../core/geom/3d/shape/UnitSphereShape3D.js";
|
|
78
78
|
import TopDownCameraController from "../../../../../ecs/camera/topdown/TopDownCameraController.js";
|
|
79
79
|
import { randomFloatBetween } from "../../../../../../../core/math/random/randomFloatBetween.js";
|
|
80
|
+
import { MicronRenderPlugin } from "../../../../../micron/plugin/MicronRenderPlugin.js";
|
|
80
81
|
|
|
81
82
|
const engineHarness = new EngineHarness();
|
|
82
83
|
|
|
@@ -130,7 +131,7 @@ function makeConfig(engine) {
|
|
|
130
131
|
|
|
131
132
|
|
|
132
133
|
// Plugins
|
|
133
|
-
|
|
134
|
+
config.addPlugin(MicronRenderPlugin);
|
|
134
135
|
|
|
135
136
|
|
|
136
137
|
// Knowledge
|
|
@@ -306,6 +307,7 @@ async function sample_scene_0(engine) {
|
|
|
306
307
|
|
|
307
308
|
// load_model('moicon/06_04_hapro/00-environment/model.gltf', -0.1);
|
|
308
309
|
load_model_s('moicon/06_04_hapro/05-ground-floor/model.gltf');
|
|
310
|
+
load_model_s('C:/git/moh/app/moicon/06_04_hapro/08-clickable-assets-new/model.gltf');
|
|
309
311
|
// load_model('moicon/06_04_hapro/02-bearers/model.gltf');
|
|
310
312
|
// load_model('moicon/06_04_hapro/04-1st-floor/model.gltf');
|
|
311
313
|
|
|
@@ -313,7 +315,7 @@ async function sample_scene_0(engine) {
|
|
|
313
315
|
await make_demo_volume({
|
|
314
316
|
ecd: ecd,
|
|
315
317
|
lut: heatmap_lut_0,
|
|
316
|
-
shape:
|
|
318
|
+
shape: UnionShape3D.from([
|
|
317
319
|
TransformedShape3D.from_m4(new UnitCubeShape3D(), mat_from_aabb3(new AABB3(67.73, 0, 89, 115.84, 3, 118.34))),
|
|
318
320
|
TransformedShape3D.from_m4(new UnitCubeShape3D(), mat_from_aabb3(new AABB3(98, 0, 76.5, 109.5, 3, 89)))
|
|
319
321
|
]),
|
|
@@ -325,7 +327,7 @@ async function sample_scene_0(engine) {
|
|
|
325
327
|
await make_demo_volume({
|
|
326
328
|
ecd: ecd,
|
|
327
329
|
lut: heatmap_lut_0,
|
|
328
|
-
shape:
|
|
330
|
+
shape: UnionShape3D.from([
|
|
329
331
|
TransformedShape3D.from_m4(new UnitCubeShape3D(), [14.980091485108495, 0, 0, 0, 0, 2.812495250139616, 0, 0, 0, 0, 7.469446746375293, 0, 54.83080514238756, 1.568241402881399, 92.51937192481576, 1]),
|
|
330
332
|
TransformedShape3D.from_m4(new UnitCubeShape3D(), [6.644515553810907, 0, 0, 0, 0, 2.812495250139616, 0, 0, 0, 0, 5.507507223409315, 0, 46.95032009188344, 1.568241402881399, 95.54148649329517, 1]),
|
|
331
333
|
TransformedShape3D.from_m4(new UnitCubeShape3D(), [23.762890107594952, 0, 0, 0, 0, 2.812495250139616, 0, 0, 0, 0, 34.57956316503163, 0, 55.436098243647756, 1.568241402881399, 113.46988143189215, 1])
|
|
@@ -349,7 +351,7 @@ async function sample_scene_0(engine) {
|
|
|
349
351
|
await make_demo_volume({
|
|
350
352
|
ecd: ecd,
|
|
351
353
|
lut: heatmap_lut_pink_to_blue,
|
|
352
|
-
shape:
|
|
354
|
+
shape: UnionShape3D.from([
|
|
353
355
|
TransformedShape3D.from_m4(new UnitCubeShape3D(), [15.218520811592711, 0, 0, 0, 0, 3.058639690434693, 0, 0, 0, 0, 5.828701399328644, 0, 89.53848861962253, 2.0721850959505907, 73.05504876489894, 1]),
|
|
354
356
|
TransformedShape3D.from_m4(new UnitCubeShape3D(), [18.10977091153633, 0, 0, 0, 0, 3.058639690434693, 0, 0, 0, 0, 2.5862076050328002, 0, 88.03260126722904, 2.0721850959505907, 69.0797462656922, 1])
|
|
355
357
|
]),
|
|
@@ -363,7 +365,7 @@ async function sample_scene_0(engine) {
|
|
|
363
365
|
await make_demo_volume({
|
|
364
366
|
ecd: ecd,
|
|
365
367
|
lut: heatmap_lut_3,
|
|
366
|
-
shape:
|
|
368
|
+
shape: UnionShape3D.from([
|
|
367
369
|
TransformedShape3D.from_m4(new UnitCubeShape3D(), [20.977896627021547, 0, 0, 0, 0, 2.956899734575006, 0, 0, 0, 0, 36.201589869571954, 0, 99.2120028317975, 1.5919924971428276, 49.21655402009093, 1]),
|
|
368
370
|
TransformedShape3D.from_m4(new UnitCubeShape3D(), [24.455615450514458, 0, 0, 0, 0, 2.956899734575006, 0, 0, 0, 0, 28.081536987027807, 0, 80.11618755300161, 1.5919924971428276, 45.13808745329574, 1]),
|
|
369
371
|
TransformedShape3D.from_m4(new UnitCubeShape3D(), [5.562874425497998, 0, 0, 0, 0, 2.956899734575006, 0, 0, 0, 0, 2.654155224548708, 0, 70.80986716000054, 1.5919924971428276, 59.679876796143446, 1])
|
|
@@ -378,7 +380,7 @@ async function sample_scene_0(engine) {
|
|
|
378
380
|
await make_demo_volume({
|
|
379
381
|
ecd: ecd,
|
|
380
382
|
lut: heatmap_lut_orange_to_red,
|
|
381
|
-
shape:
|
|
383
|
+
shape: UnionShape3D.from([
|
|
382
384
|
TransformedShape3D.from_m4(new UnitCubeShape3D(), [-3.8971594611231577, -1.9562533614625899, -0.5725042419276598, 0, -8.346390838999248, 16.986127440019352, -1.226109479938015, 0, 0.12112312197093604, 0, -0.8245111322851176, 0, 55.83305788880312, 9.579537179233043, 83.59013920067233, 1]),
|
|
383
385
|
TransformedShape3D.from_m4(new UnitSphereShape3D(), [10.237283879346698, 0, 0, 0, 0, 10.237283879346698, 0, 0, 0, 0, 10.237283879346698, 0, 51.783732965076716, 18.028888481196716, 82.91084586075068, 1])
|
|
384
386
|
]),
|
|
@@ -555,7 +557,7 @@ async function sample_scene_nam(engine) {
|
|
|
555
557
|
await make_demo_volume({
|
|
556
558
|
ecd: ecd,
|
|
557
559
|
lut: heatmap_lut_pink_to_blue,
|
|
558
|
-
shape:
|
|
560
|
+
shape: UnionShape3D.from([
|
|
559
561
|
TransformedShape3D.from_m4(new UnitCubeShape3D(), [5.985827128973811, 0, 0, 0, 0, 2.435269776236539, 0, 0, 0, 0, 4.669621139110231, 0, 11.08356834576874, 1.2643565739307023, 2.4360416869081885, 1]),
|
|
560
562
|
TransformedShape3D.from_m4(new UnitCubeShape3D(), [8.413758403821523, 0, 0, 0, 0, 2.3166487265965343, 0, 0, 0, 0, 7.775469675813772, 0, 4.313201108449287, 1.4169994923726943, 4.011630095541064, 1]),
|
|
561
563
|
TransformedShape3D.from_m4(new UnitCubeShape3D(), [8.413758403821523, 0, 0, 0, 0, 2.3166487265965343, 0, 0, 0, 0, 2.925065210015915, 0, 12.417224289491141, 1.4169994923726943, 6.432483110925785, 1])
|
|
@@ -607,7 +609,8 @@ async function main(engine) {
|
|
|
607
609
|
|
|
608
610
|
engine.graphics.renderer.setClearColor('rgba(99,99,99,1)');
|
|
609
611
|
|
|
610
|
-
await sample_scene_nam(engine);
|
|
612
|
+
// await sample_scene_nam(engine);
|
|
613
|
+
await sample_scene_0(engine);
|
|
611
614
|
}
|
|
612
615
|
|
|
613
616
|
/**
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { max2 } from "../../../../../../core/math/max2.js";
|
|
2
1
|
import { EnginePlugin } from "../../../../../plugin/EnginePlugin.js";
|
|
3
2
|
import {
|
|
4
3
|
LinearFilter,
|
|
@@ -161,9 +160,9 @@ export class AmbientOcclusionPostProcessEffect extends EnginePlugin {
|
|
|
161
160
|
uniforms.bias.value = 0.5;
|
|
162
161
|
uniforms.intensity.value = 0.18;
|
|
163
162
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
uniforms.scale.value =
|
|
163
|
+
// scale is divided by camera far in the shader, we unbias it here
|
|
164
|
+
// TODO remove this term from the shader
|
|
165
|
+
uniforms.scale.value = far * 0.25;
|
|
167
166
|
|
|
168
167
|
uniforms.kernelRadius.value = 30;
|
|
169
168
|
uniforms.minResolution.value = 0;
|
|
@@ -36,7 +36,7 @@ const f_shader = `
|
|
|
36
36
|
|
|
37
37
|
uniform sampler2D t_heatmap_lookup;
|
|
38
38
|
|
|
39
|
-
uniform vec2
|
|
39
|
+
uniform vec2 fp_resolution;
|
|
40
40
|
|
|
41
41
|
uniform mat4 projectionMatrix;
|
|
42
42
|
|
|
@@ -79,7 +79,7 @@ const f_shader = `
|
|
|
79
79
|
|
|
80
80
|
void main(){
|
|
81
81
|
|
|
82
|
-
vec3 clip_v = vec3(gl_FragCoord.xy /
|
|
82
|
+
vec3 clip_v = vec3(gl_FragCoord.xy / fp_resolution, convert_depth_to_linear( gl_FragCoord.z));
|
|
83
83
|
|
|
84
84
|
ivec3 v3_cluster_resolution = textureSize(fp_t_light_tiles, 0);
|
|
85
85
|
ivec3 v3_cluster_position = ivec3( ( 1.0 - clip_v.x) * float(v3_cluster_resolution.x), clip_v.y*float(v3_cluster_resolution.y), (clip_v.z)*float(v3_cluster_resolution.z) );
|
|
@@ -119,7 +119,7 @@ export class FPlusDebugMaterial extends ShaderMaterial {
|
|
|
119
119
|
type: 'f',
|
|
120
120
|
value: 0
|
|
121
121
|
},
|
|
122
|
-
|
|
122
|
+
fp_resolution: {
|
|
123
123
|
type: 'v2',
|
|
124
124
|
value: new Vector2()
|
|
125
125
|
},
|
|
@@ -317,7 +317,7 @@ function prepare_scene_0() {
|
|
|
317
317
|
|
|
318
318
|
const bounds_size = 15;
|
|
319
319
|
|
|
320
|
-
const light_radius =
|
|
320
|
+
const light_radius = 5;
|
|
321
321
|
|
|
322
322
|
for (let i = 0; i < 5000; i++) {
|
|
323
323
|
const radius = randomFloatBetween(random, light_radius, light_radius);
|
|
@@ -624,7 +624,7 @@ fp_materials.forEach(m => {
|
|
|
624
624
|
|
|
625
625
|
renderer.getSize(v2);
|
|
626
626
|
|
|
627
|
-
m.uniforms.
|
|
627
|
+
m.uniforms.fp_resolution.value.set(
|
|
628
628
|
v2.x * window.devicePixelRatio, v2.y * window.devicePixelRatio
|
|
629
629
|
);
|
|
630
630
|
|
|
@@ -693,7 +693,7 @@ function animate() {
|
|
|
693
693
|
m.uniforms.fp_f_camera_far.value = camera.far;
|
|
694
694
|
|
|
695
695
|
|
|
696
|
-
m.uniforms.
|
|
696
|
+
m.uniforms.fp_resolution.value.set(scratch_v2.x, scratch_v2.y);
|
|
697
697
|
});
|
|
698
698
|
|
|
699
699
|
lightClusterWidget.update();
|
|
@@ -760,7 +760,7 @@ function draw_camera_view_planes() {
|
|
|
760
760
|
});
|
|
761
761
|
}
|
|
762
762
|
|
|
763
|
-
|
|
763
|
+
prepare_scene_0();
|
|
764
764
|
animate();
|
|
765
765
|
|
|
766
766
|
// draw_camera_view_planes();
|
|
@@ -42,21 +42,22 @@ export function point_light_inside_volume(
|
|
|
42
42
|
if (distance < 0) {
|
|
43
43
|
// center of the sphere is below the plane
|
|
44
44
|
|
|
45
|
-
if (distance
|
|
46
|
-
// sphere is entirely below the plane
|
|
45
|
+
if (distance >= -radius) {
|
|
47
46
|
|
|
48
|
-
//
|
|
47
|
+
// sphere intersects the plane
|
|
49
48
|
|
|
50
|
-
|
|
51
|
-
}
|
|
49
|
+
outside_plane_count++;
|
|
52
50
|
|
|
53
|
-
|
|
51
|
+
const plane_bit_mask = 1 << j;
|
|
54
52
|
|
|
55
|
-
|
|
53
|
+
outside_plane_bitfield |= plane_bit_mask;
|
|
54
|
+
} else {
|
|
55
|
+
// sphere is entirely below the plane
|
|
56
56
|
|
|
57
|
-
|
|
57
|
+
// query_bvh_frustum_from_objects.rejection_sphere_count++;
|
|
58
58
|
|
|
59
|
-
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
60
61
|
}
|
|
61
62
|
|
|
62
63
|
}
|
|
@@ -173,13 +173,19 @@ export class ShadowMapRenderer {
|
|
|
173
173
|
|
|
174
174
|
if (shadow.map === null) {
|
|
175
175
|
|
|
176
|
-
const pars = {
|
|
176
|
+
const pars = {
|
|
177
|
+
format: RGBAFormat,
|
|
178
|
+
scissorTest: false,
|
|
179
|
+
stencilBuffer: false
|
|
180
|
+
};
|
|
177
181
|
|
|
178
182
|
if (!shadow.isPointLightShadow && renderer.shadowMap.type === VSMShadowMap) {
|
|
179
183
|
pars.minFilter = LinearFilter;
|
|
180
184
|
pars.magFilter = LinearFilter;
|
|
181
185
|
|
|
182
|
-
shadow.mapPass = new WebGLRenderTarget(_shadowMapSize.x, _shadowMapSize.y,
|
|
186
|
+
shadow.mapPass = new WebGLRenderTarget(_shadowMapSize.x, _shadowMapSize.y, Object.assign({
|
|
187
|
+
depthBuffer: false
|
|
188
|
+
}, pars));
|
|
183
189
|
|
|
184
190
|
} else {
|
|
185
191
|
pars.minFilter = NearestFilter;
|
|
@@ -6,6 +6,7 @@ import { GameAssetType } from "../../../asset/GameAssetType.js";
|
|
|
6
6
|
import { HashMap } from "../../../../core/collection/HashMap.js";
|
|
7
7
|
import { strictEquals } from "../../../../core/function/Functions.js";
|
|
8
8
|
import { computeStringHash } from "../../../../core/primitives/strings/computeStringHash.js";
|
|
9
|
+
import { copy_Sampler2D_channel_data } from "../sampler/copy_Sampler2D_channel_data.js";
|
|
9
10
|
|
|
10
11
|
const CACHE_SIZE = 4194304;
|
|
11
12
|
|
|
@@ -139,10 +140,20 @@ export class ManagedAtlas {
|
|
|
139
140
|
|
|
140
141
|
const image = asset.create();
|
|
141
142
|
|
|
143
|
+
const source = new Sampler2D(image.data, image.itemSize, image.width, image.height);
|
|
142
144
|
//assert.equal(atlas.patches.filter(p => p.sampler.data === image.data).length, 0, "Atlas already contains this asset data");
|
|
143
145
|
|
|
144
146
|
//build sampler
|
|
145
|
-
|
|
147
|
+
let sampler;
|
|
148
|
+
|
|
149
|
+
if (source.itemSize !== 4) {
|
|
150
|
+
// source image is not in RGBA layout, resample
|
|
151
|
+
sampler = Sampler2D.uint8(4, image.width, image.height);
|
|
152
|
+
copy_Sampler2D_channel_data(source, sampler)
|
|
153
|
+
} else {
|
|
154
|
+
sampler = source;
|
|
155
|
+
}
|
|
156
|
+
|
|
146
157
|
const patch = atlas.add(sampler);
|
|
147
158
|
|
|
148
159
|
//record active patch
|
|
@@ -164,11 +164,13 @@ export function Sampler2D(data = [], itemSize = 1, width = 0, height = 0) {
|
|
|
164
164
|
* @type {Number}
|
|
165
165
|
*/
|
|
166
166
|
this.height = height;
|
|
167
|
+
|
|
167
168
|
/**
|
|
168
|
-
*
|
|
169
|
+
* Number of channels
|
|
169
170
|
* @type {Number}
|
|
170
171
|
*/
|
|
171
172
|
this.itemSize = itemSize;
|
|
173
|
+
|
|
172
174
|
/**
|
|
173
175
|
*
|
|
174
176
|
* @type {Array<number>|Uint8Array|Uint16Array|Int8Array|Float32Array|Float64Array}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Allows copying data from one sampler to another with unequal number of channels (a.itemSize !== b.itemSize)
|
|
3
|
+
* @example convert RGBA to RGB or R to RGB
|
|
4
|
+
* @param {Sampler2D} source
|
|
5
|
+
* @param {Sampler2D} destination
|
|
6
|
+
*/
|
|
7
|
+
export function copy_Sampler2D_channel_data(source, destination) {
|
|
8
|
+
if (source.width !== destination.width || source.height !== destination.height) {
|
|
9
|
+
throw new Error('Source and destination dimensions do not match');
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const source_item_size = source.itemSize;
|
|
13
|
+
const destination_item_size = destination.itemSize;
|
|
14
|
+
|
|
15
|
+
const pixel_count = source.width * source.height;
|
|
16
|
+
|
|
17
|
+
const destination_data = destination.data;
|
|
18
|
+
const source_data = source.data;
|
|
19
|
+
|
|
20
|
+
let i, j;
|
|
21
|
+
|
|
22
|
+
if (source_item_size === destination_item_size) {
|
|
23
|
+
// just copy data chunk
|
|
24
|
+
destination_data.set(source_data);
|
|
25
|
+
|
|
26
|
+
} else if (source_item_size > destination_item_size) {
|
|
27
|
+
|
|
28
|
+
for (i = 0; i < pixel_count; i++) {
|
|
29
|
+
const source_sample_offset = i * source_item_size;
|
|
30
|
+
const destination_sample_offset = i * destination_item_size;
|
|
31
|
+
|
|
32
|
+
for (j = 0; j < destination_item_size; j++) {
|
|
33
|
+
destination_data[destination_sample_offset + j] = source_data[source_sample_offset + j];
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
} else if (source_item_size === 3 && destination_item_size === 4) {
|
|
38
|
+
// RGB -> RGBA
|
|
39
|
+
for (i = 0; i < pixel_count; i++) {
|
|
40
|
+
const i3 = i * 3;
|
|
41
|
+
const i4 = i * 4;
|
|
42
|
+
|
|
43
|
+
destination_data[i4] = source_data[i3];
|
|
44
|
+
destination_data[i4 + 1] = source_data[i3 + 1];
|
|
45
|
+
destination_data[i4 + 2] = source_data[i3 + 2];
|
|
46
|
+
|
|
47
|
+
destination_data[i4] = 255; // fill alpha
|
|
48
|
+
}
|
|
49
|
+
} else if (source_item_size === 2 && destination_item_size === 4) {
|
|
50
|
+
//RA -> RGBA
|
|
51
|
+
for (i = 0; i < pixel_count; i++) {
|
|
52
|
+
const i2 = i * 2;
|
|
53
|
+
const i4 = i * 4;
|
|
54
|
+
|
|
55
|
+
const r = source_data[i2];
|
|
56
|
+
|
|
57
|
+
destination_data[i4] = r;
|
|
58
|
+
destination_data[i4 + 1] = r;
|
|
59
|
+
destination_data[i4 + 2] = r;
|
|
60
|
+
|
|
61
|
+
destination_data[i4 + 3] = source_data[i2 + 1]; // fill alpha
|
|
62
|
+
}
|
|
63
|
+
} else {
|
|
64
|
+
throw new Error('Unsupported channel layout combination');
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const KeyCodes: Object;
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"productName": "Meep",
|
|
5
5
|
"description": "production-ready JavaScript game engine based on Entity Component System Architecture",
|
|
6
6
|
"author": "Alexander Goldring",
|
|
7
|
-
"version": "2.33.
|
|
7
|
+
"version": "2.33.29",
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"fast-levenshtein": "2.0.6",
|
|
10
10
|
"opentype.js": "1.3.3",
|
|
@@ -171,13 +171,20 @@ export class MinimapWorldGL {
|
|
|
171
171
|
}
|
|
172
172
|
|
|
173
173
|
update() {
|
|
174
|
-
this.layers
|
|
175
|
-
|
|
176
|
-
|
|
174
|
+
const layers = this.layers;
|
|
175
|
+
const layer_count = layers.length;
|
|
176
|
+
|
|
177
|
+
for (let i = 0; i < layer_count; i++) {
|
|
178
|
+
const layer = layers[i];
|
|
179
|
+
|
|
180
|
+
layer.update(this.camera);
|
|
181
|
+
|
|
182
|
+
if (layer.needsRender) {
|
|
177
183
|
this.renderNeedsUpdate = true;
|
|
178
|
-
|
|
184
|
+
layer.needsRender = false;
|
|
179
185
|
}
|
|
180
|
-
|
|
186
|
+
|
|
187
|
+
}
|
|
181
188
|
|
|
182
189
|
if (this.renderNeedsUpdate) {
|
|
183
190
|
this.render();
|