@woosh/meep-engine 2.33.26 → 2.33.30
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/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/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 +5 -2
- 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/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
|
@@ -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
|
}
|
|
@@ -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: { [name: string]: number };
|
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.30",
|
|
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();
|