@woosh/meep-engine 2.43.21 → 2.43.23

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.
Files changed (50) hide show
  1. package/core/collection/HashMap.d.ts +2 -2
  2. package/core/collection/HashMap.js +22 -2
  3. package/core/geom/3d/morton/mortonEncode_magicbits.js +18 -0
  4. package/core/geom/3d/tetrahedra/delaunay/compute_delaunay_tetrahedral_mesh.js +2 -2
  5. package/core/geom/3d/topology/struct/TopoEdge.js +4 -0
  6. package/core/geom/3d/topology/struct/TopoMesh.js +25 -0
  7. package/core/geom/3d/topology/struct/TopoTriangle.js +4 -0
  8. package/core/geom/3d/topology/struct/TopoVertex.js +8 -0
  9. package/core/geom/3d/topology/struct/binary/BinaryElementPool.js +288 -0
  10. package/core/geom/3d/topology/struct/binary/BinaryElementPool.spec.js +36 -0
  11. package/core/geom/3d/topology/struct/binary/BinaryTopology.js +617 -0
  12. package/core/geom/3d/topology/struct/binary/BinaryTopology.spec.js +16 -0
  13. package/core/geom/3d/topology/struct/binary/io/OrderedEdge.js +66 -0
  14. package/core/geom/3d/topology/struct/binary/io/bt_index_geometry_to_topology.js +188 -0
  15. package/core/geom/3d/topology/struct/binary/io/bt_index_geometry_to_topology.spec.js +84 -0
  16. package/core/geom/3d/topology/struct/binary/io/bt_mesh_calc_edges.js +51 -0
  17. package/core/geom/3d/topology/struct/binary/io/create_edge.js +106 -0
  18. package/core/geom/3d/topology/struct/binary/io/get_or_create_edge_map.js +26 -0
  19. package/core/geom/3d/topology/struct/binary/query/bt_mesh_edge_has_vertex.js +16 -0
  20. package/core/geom/3d/topology/struct/binary/query/bt_mesh_edge_has_vertex.spec.js +15 -0
  21. package/core/geom/3d/topology/struct/binary/query/bt_mesh_edge_other_vertex.js +21 -0
  22. package/core/geom/3d/topology/struct/binary/query/bt_mesh_edge_other_vertex.spec.js +16 -0
  23. package/core/geom/3d/topology/struct/prototypeBinaryTopology.js +55 -0
  24. package/core/path/PATH_SEPARATOR.js +1 -0
  25. package/core/path/computeFileExtension.js +24 -0
  26. package/core/path/computeFileExtension.spec.js +13 -0
  27. package/core/path/computePathBase.js +21 -0
  28. package/core/path/computePathBase.spec.js +13 -0
  29. package/core/path/computePathDirectory.js +25 -0
  30. package/editor/view/library/MeshLibraryView.js +1 -1
  31. package/engine/asset/guessAssetType.js +1 -1
  32. package/engine/asset/loaders/image/ImageRGBADataLoader.js +1 -1
  33. package/engine/asset/loaders/texture/TextureAssetLoader.js +1 -1
  34. package/engine/ecs/storage/BinaryBufferSerializer.js +7 -0
  35. package/engine/graphics/material/composeCompile.js +3 -5
  36. package/engine/graphics/micron/plugin/GLTFAssetTransformer.js +90 -65
  37. package/engine/graphics/sh3/README.md +2 -0
  38. package/engine/graphics/sh3/path_tracer/PathTracer.js +2 -15
  39. package/engine/graphics/sh3/path_tracer/getBiasedNormalSample.js +1 -1
  40. package/engine/graphics/sh3/path_tracer/prototypePathTracer.js +14 -9
  41. package/engine/graphics/texture/cubemap/load_environment_map.js +1 -1
  42. package/engine/graphics/util/makeMeshPreviewScene.js +38 -26
  43. package/engine/network/RemoteController.js +98 -0
  44. package/engine/network/remoteEditor.js +33 -0
  45. package/engine/save/storage/IndexedDBStorage.js +1 -0
  46. package/package.json +1 -1
  47. package/view/elements/MeshPreview.js +5 -1
  48. package/core/FilePath.js +0 -73
  49. package/core/FilePath.spec.js +0 -25
  50. package/core/geom/3d/topology/struct/BinaryTopology.js +0 -112
@@ -0,0 +1,33 @@
1
+ import { EngineHarness } from "../EngineHarness.js";
2
+ import { RemoteController } from "./RemoteController.js";
3
+ import { ShadedGeometrySystem } from "../graphics/ecs/mesh-v2/ShadedGeometrySystem.js";
4
+
5
+ const harness = new EngineHarness();
6
+
7
+ /**
8
+ *
9
+ * @param {Engine} engine
10
+ * @return {Promise<void>}
11
+ */
12
+ async function main(engine) {
13
+
14
+ await EngineHarness.buildBasics({
15
+ engine
16
+ });
17
+
18
+ const remote = new RemoteController();
19
+
20
+ remote.attach(engine);
21
+ remote.startup();
22
+
23
+ }
24
+
25
+ harness.initialize({
26
+ configuration(config, engine) {
27
+
28
+ config.addSystem(new ShadedGeometrySystem(engine));
29
+
30
+ }
31
+ }).then(main);
32
+
33
+
@@ -29,6 +29,7 @@ export class IndexedDBStorage extends Storage {
29
29
  const request = indexedDB.open(name, 1);
30
30
 
31
31
  request.addEventListener('success', function (event) {
32
+ // TODO check if the storage with the given name "MAIN_STORE_NAME" exists, deal with with the case if it's missing
32
33
  resolve(request.result);
33
34
  });
34
35
 
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "productName": "Meep",
6
6
  "description": "production-ready JavaScript game engine based on Entity Component System Architecture",
7
7
  "author": "Alexander Goldring",
8
- "version": "2.43.21",
8
+ "version": "2.43.23",
9
9
  "dependencies": {
10
10
  "gl-matrix": "3.4.3",
11
11
  "fast-levenshtein": "2.0.6",
@@ -11,10 +11,14 @@ import { PointerDevice } from '../../engine/input/devices/PointerDevice.js';
11
11
  import dom from "../DOM.js";
12
12
  import { WebGLRendererPool } from "../../engine/graphics/render/RendererPool.js";
13
13
  import { advanceAnimation } from "../../engine/ecs/systems/AnimationSystem.js";
14
+ import { computeFileExtension } from "../../core/path/computeFileExtension.js";
14
15
 
15
16
  const mapExtension2Mime = {
16
17
  gltf: "model/gltf+json",
17
18
  glb: "model/gltf",
19
+ /**
20
+ * @deprecated no longer supported, please don't use
21
+ */
18
22
  json: "three.js"
19
23
  };
20
24
 
@@ -56,7 +60,7 @@ class MeshPreview extends View {
56
60
  throw new Error(`Mesh URL was expected to be a string, instead was ${typeof url}: ${s}`);
57
61
  }
58
62
 
59
- const extension = url.substring(url.lastIndexOf(".") + 1);
63
+ const extension = computeFileExtension(url);
60
64
 
61
65
  if (extension.length === 0) {
62
66
  throw new Error(`No file extension on url '${url}'`);
package/core/FilePath.js DELETED
@@ -1,73 +0,0 @@
1
- const PATH_SEPARATOR = '/';
2
-
3
- /**
4
- * Strips all directories from the path.
5
- * @example 'a/b/c' -> 'c'
6
- * @param {string} path
7
- * @returns {string}
8
- */
9
- function computePathBase(path) {
10
- if (typeof path !== "string") {
11
- throw new Error('path is not a string');
12
- }
13
-
14
- const lastSlashIndex = path.lastIndexOf(PATH_SEPARATOR);
15
-
16
- if (lastSlashIndex !== -1) {
17
- return path.substring(lastSlashIndex + 1);
18
- } else {
19
- return path;
20
- }
21
- }
22
-
23
- /**
24
- * Returns the directory name of a path, similar to the Unix dirname command.
25
- * @param {string} path
26
- * @return {string}
27
- */
28
- export function computePathDirectory(path) {
29
- if (typeof path !== "string") {
30
- throw new Error('path is not a string');
31
- }
32
-
33
- let lastSlashIndex = path.lastIndexOf(PATH_SEPARATOR);
34
-
35
- //rewind in case of trailing slashes
36
- while (lastSlashIndex > 0 && path.charAt(lastSlashIndex - 1) === PATH_SEPARATOR) {
37
- lastSlashIndex--;
38
- }
39
-
40
- if (lastSlashIndex !== -1) {
41
- return path.substring(0, lastSlashIndex);
42
- } else {
43
- return path;
44
- }
45
- }
46
-
47
- /**
48
- *
49
- * @param {string} path
50
- * @returns {String|null}
51
- */
52
- function computeFileExtension(path) {
53
- if (typeof path !== "string") {
54
- throw new Error('path is not a string');
55
- }
56
-
57
- //get base
58
- const pathBase = computePathBase(path);
59
-
60
- const lastDotIndex = pathBase.lastIndexOf('.');
61
-
62
- if (lastDotIndex !== -1) {
63
- return pathBase.substring(lastDotIndex + 1);
64
- } else {
65
- //no extension
66
- return null;
67
- }
68
- }
69
-
70
- export {
71
- computePathBase,
72
- computeFileExtension
73
- };
@@ -1,25 +0,0 @@
1
- import { computeFileExtension, computePathBase } from "./FilePath.js";
2
-
3
- test('extract extension of cat.txt', () => {
4
- expect(computeFileExtension('cat.txt')).toEqual('txt');
5
- });
6
-
7
- test('extract extension of ../hmm/cat.txt', () => {
8
- expect(computeFileExtension('../hmm/cat.txt')).toEqual('txt');
9
- });
10
-
11
- test('extract extension of empty string', () => {
12
- expect(computeFileExtension('')).toBeNull();
13
- });
14
-
15
- test('extract base path of empty string', () => {
16
- expect(computePathBase('')).toBe('');
17
- });
18
-
19
- test('extract base path of hello', () => {
20
- expect(computePathBase('hello')).toBe('hello');
21
- });
22
-
23
- test('extract base path of hello/there/world', () => {
24
- expect(computePathBase('hello/there/world')).toBe('world');
25
- });
@@ -1,112 +0,0 @@
1
- import { max2 } from "../../../../math/max2.js";
2
-
3
- const INITIAL_CAPACITY = 128;
4
-
5
- /**
6
- * @readonly
7
- * @type {number}
8
- */
9
- const CAPACITY_GROW_MULTIPLIER = 1.2;
10
-
11
- /**
12
- * @readonly
13
- * @type {number}
14
- */
15
- const CAPACITY_GROW_MIN_STEP = 32;
16
-
17
- class BinaryPool {
18
-
19
- constructor(item_size, initial_capacity = INITIAL_CAPACITY) {
20
- /**
21
- * Size of a single pool item in bytes
22
- * @type {number}
23
- * @private
24
- */
25
- this.__item_size = item_size;
26
- /**
27
- * Unused slots
28
- * @type {number[]}
29
- * @private
30
- */
31
- this.__free = [];
32
-
33
- /**
34
- *
35
- * @type {number}
36
- * @private
37
- */
38
- this.__free_pointer = 0;
39
-
40
- this.__data_buffer = new ArrayBuffer(initial_capacity * item_size);
41
- this.__data_uint8 = new Uint8Array(this.__data_buffer);
42
-
43
- this.__capacity = initial_capacity;
44
-
45
- this.__used_end = 0;
46
- }
47
-
48
- __grow_capacity() {
49
- const new_capacity = Math.ceil(max2(
50
- this.__capacity * CAPACITY_GROW_MULTIPLIER,
51
- this.__capacity + CAPACITY_GROW_MIN_STEP
52
- ));
53
-
54
- const old_data_uint8 = this.__data_uint8;
55
-
56
- const new_data_buffer = new ArrayBuffer(new_capacity * this.__item_size);
57
-
58
- this.__data_buffer = new_data_buffer;
59
- this.__data_uint8 = new Uint8Array(new_data_buffer);
60
-
61
- // copy old data
62
- this.__data_uint8.set(old_data_uint8);
63
-
64
- this.__capacity = new_capacity;
65
- }
66
-
67
-
68
- /**
69
- *
70
- * @return {number}
71
- */
72
- allocate() {
73
- if (this.__free_pointer > 0) {
74
- // get unused slot
75
- this.__free_pointer--;
76
- return this.__free[this.__free_pointer];
77
- }
78
-
79
- // allocate new
80
-
81
- let result = this.__used_end;
82
-
83
- if (result >= this.__capacity) {
84
- this.__grow_capacity();
85
- }
86
-
87
- this.__used_end++;
88
-
89
- return result;
90
- }
91
-
92
- /**
93
- *
94
- * @param {number} id
95
- */
96
- release(id) {
97
- this.__free[this.__free_pointer++] = id;
98
- }
99
- }
100
-
101
- /**
102
- * Heavily influenced by blender's internal mesh structure
103
- * @see https://github.com/blender/blender/blob/master/source/blender/bmesh/bmesh_class.h
104
- */
105
- export class BinaryTopology {
106
- __vertex_pool = new BinaryPool();
107
- __edge_pool = new BinaryPool();
108
- __loop_pool = new BinaryPool();
109
- __face_pool = new BinaryPool();
110
-
111
-
112
- }