@woosh/meep-engine 2.39.41 → 2.39.44

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.
@@ -553,12 +553,12 @@ export class AABB3 {
553
553
 
554
554
  /**
555
555
  * @source http://stackoverflow.com/questions/3106666/intersection-of-line-segment-with-axis-aligned-box-in-c-sharp
556
- * @param startX
557
- * @param startY
558
- * @param startZ
559
- * @param endX
560
- * @param endY
561
- * @param endZ
556
+ * @param {number} startX
557
+ * @param {number} startY
558
+ * @param {number} startZ
559
+ * @param {number} endX
560
+ * @param {number} endY
561
+ * @param {number} endZ
562
562
  * @returns {boolean}
563
563
  */
564
564
  intersectSegment2(startX, startY, startZ, endX, endY, endZ) {
@@ -264,6 +264,12 @@ export class Cache {
264
264
  */
265
265
  const weightTarget = this.maxWeight - elementWeight;
266
266
 
267
+ if (weightTarget < 0) {
268
+ // Special case
269
+ // element does not fit into cache, attempting to insert it forcibly would result in a full flush and overflow
270
+ return;
271
+ }
272
+
267
273
  //evict elements until there is enough space for the element
268
274
  this.evictUntilWeight(weightTarget);
269
275
 
@@ -234,6 +234,13 @@ export class BlenderCameraOrientationGizmo extends CanvasView {
234
234
  * @type {Signal<string,Vector3>}
235
235
  */
236
236
  this.on.axisSelected = new Signal();
237
+
238
+ /**
239
+ *
240
+ * @type {boolean}
241
+ * @private
242
+ */
243
+ this.__needs_update = true;
237
244
  }
238
245
 
239
246
  link() {
@@ -262,6 +269,7 @@ export class BlenderCameraOrientationGizmo extends CanvasView {
262
269
  */
263
270
  onMouseMove(evt) {
264
271
  this._setPointerPositionFromEvent(evt);
272
+ this.__try_update();
265
273
  }
266
274
 
267
275
  /**
@@ -271,9 +279,19 @@ export class BlenderCameraOrientationGizmo extends CanvasView {
271
279
  */
272
280
  _setPointerPositionFromEvent(evt) {
273
281
  const v2 = new Vector2();
282
+
274
283
  readPositionFromMouseEvent(v2, evt);
275
284
 
285
+ const position_changed = (this.input_pointer_position === null || this.input_pointer_position.x !== v2.x || this.input_pointer_position.y !== v2.y);
286
+
276
287
  this.input_pointer_position = new Vector3(v2.x, v2.y, 0);
288
+
289
+
290
+ if (position_changed) {
291
+ this.__needs_update = true;
292
+ }
293
+
294
+ return position_changed;
277
295
  }
278
296
 
279
297
  /**
@@ -282,6 +300,8 @@ export class BlenderCameraOrientationGizmo extends CanvasView {
282
300
  */
283
301
  onMouseOut(evt) {
284
302
  this.input_pointer_position = null;
303
+ this.__needs_update = true;
304
+ this.__try_update();
285
305
  }
286
306
 
287
307
  /**
@@ -289,6 +309,11 @@ export class BlenderCameraOrientationGizmo extends CanvasView {
289
309
  * @param {MouseEvent} evt
290
310
  */
291
311
  onMouseClick(evt) {
312
+
313
+ this._setPointerPositionFromEvent(evt);
314
+
315
+ this.__try_update();
316
+
292
317
  if (this.selectedAxis !== null) {
293
318
  this.on.axisSelected.send2(
294
319
  this.selectedAxis.axis,
@@ -326,7 +351,17 @@ export class BlenderCameraOrientationGizmo extends CanvasView {
326
351
  ctx.closePath();
327
352
  }
328
353
 
354
+ __try_update() {
355
+ if (!this.__needs_update) {
356
+ return;
357
+ }
358
+ this.update();
359
+ }
360
+
329
361
  update() {
362
+ // reset flag
363
+ this.__needs_update = false;
364
+
330
365
  this.clear();
331
366
 
332
367
  // Calculate the rotation matrix from the camera
@@ -15,4 +15,11 @@ export class GeometrySpatialQueryAccelerator {
15
15
  origin_x: number, origin_y: number, origin_z: number,
16
16
  direction_x: number, direction_y: number, direction_z: number
17
17
  ): boolean
18
+
19
+ /**
20
+ * In bytes
21
+ */
22
+ cache_size: number
23
+
24
+ static INSTANCE: GeometrySpatialQueryAccelerator;
18
25
  }
@@ -33,6 +33,22 @@ export class GeometrySpatialQueryAccelerator {
33
33
  this.__visitor_raycast = new RaycastNearestHitComputingVisitor();
34
34
  }
35
35
 
36
+ /**
37
+ *
38
+ * @param {number} value in bytes
39
+ */
40
+ set cache_size(value) {
41
+ this.cache.setMaxWeight(value);
42
+ }
43
+
44
+ /**
45
+ *
46
+ * @return {number} in bytes
47
+ */
48
+ get cache_size() {
49
+ return this.cache.maxWeight;
50
+ }
51
+
36
52
  /**
37
53
  *
38
54
  * @param {THREE.BufferGeometry} geometry
@@ -184,7 +200,7 @@ export class GeometrySpatialQueryAccelerator {
184
200
  const de_interleaved_position_attribute = deinterleaveBufferAttribute(position_attribute);
185
201
  const vertices = de_interleaved_position_attribute.array;
186
202
 
187
- if(index_attribute === undefined || index_attribute === null){
203
+ if (index_attribute === undefined || index_attribute === null) {
188
204
  return buildUnsortedUnindexed(vertices);
189
205
  }
190
206
 
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.39.41",
8
+ "version": "2.39.44",
9
9
  "dependencies": {
10
10
  "gl-matrix": "3.4.3",
11
11
  "fast-levenshtein": "2.0.6",
@@ -9,12 +9,18 @@ import { ImageRGBADataLoader } from "../../engine/asset/loaders/image/ImageRGBAD
9
9
  import TerrainSystem from "../../engine/ecs/terrain/ecs/TerrainSystem.js";
10
10
  import WaterSystem from "../../engine/graphics/ecs/water/WaterSystem.js";
11
11
  import Water from "../../engine/graphics/ecs/water/Water.js";
12
- import { AmbientOcclusionPostProcessEffect } from "../../engine/graphics/render/buffer/simple-fx/ao/AmbientOcclusionPostProcessEffect.js";
12
+ import {
13
+ AmbientOcclusionPostProcessEffect
14
+ } from "../../engine/graphics/render/buffer/simple-fx/ao/AmbientOcclusionPostProcessEffect.js";
13
15
  import { TerrainLayer } from "../../engine/ecs/terrain/ecs/layers/TerrainLayer.js";
14
16
  import Mesh from "../../engine/graphics/ecs/mesh/Mesh.js";
15
17
  import { Transform } from "../../engine/ecs/transform/Transform.js";
16
18
  import { MeshSystem } from "../../engine/graphics/ecs/mesh/MeshSystem.js";
17
19
  import { enableEditor } from "../../editor/enableEditor.js";
20
+ import "../../../../../css/main.scss";
21
+ import '../../../../../css/editor/EntityEditorView.scss';
22
+ import '../../../../../css/editor/EditorView.scss';
23
+ import { initializeEditor } from "../../../model/game/initializeEditor.js";
18
24
 
19
25
  const HEIGHT_RANGE = 64;
20
26
 
@@ -209,7 +215,7 @@ async function init(harness) {
209
215
 
210
216
  await makeConfig(engine).apply(engine);
211
217
 
212
- enableEditor(engine);
218
+ enableEditor(engine,initializeEditor);
213
219
 
214
220
  await eh.initialize();
215
221