@woosh/meep-engine 2.35.3 → 2.35.4

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.
@@ -1,6 +1,11 @@
1
1
  import {EntityComponentDataset} from "./EntityComponentDataset";
2
2
  import {System} from "./System";
3
3
 
4
+ interface Type<T> extends Function {
5
+ new(...args: any[]): T;
6
+ }
7
+
8
+
4
9
  export class EntityManager {
5
10
  dataset: EntityComponentDataset
6
11
 
@@ -10,6 +15,8 @@ export class EntityManager {
10
15
 
11
16
  removeSystem<T>(system: System<T>): Promise<void>
12
17
 
18
+ getSystem<T>(systemClass: Type<T>): T | null
19
+
13
20
  attachDataSet(dataset: EntityComponentDataset): void
14
21
 
15
22
  detachDataSet(): void
@@ -1,6 +1,16 @@
1
1
  import {System} from "../../../ecs/System";
2
2
  import Engine from "../../../Engine";
3
+ import {ShadedGeometry} from "./ShadedGeometry";
4
+ import {SurfacePoint3} from "../../../../core/geom/3d/SurfacePoint3";
3
5
 
4
- export class ShadedGeometrySystem extends System {
6
+ export class ShadedGeometrySystem extends System<ShadedGeometry> {
5
7
  constructor(engine: Engine)
8
+
9
+ raycastNearest(
10
+ contact: SurfacePoint3,
11
+ origin_x: number, origin_y: number, origin_z: number,
12
+ direction_x: number, direction_y: number, direction_z: number,
13
+ filter_function?: (entity: number, mesh: ShadedGeometry) => boolean,
14
+ filter_function_context?: any
15
+ ): { entity: number, mesh: ShadedGeometry } | undefined
6
16
  }
@@ -235,7 +235,7 @@ export class ShadedGeometrySystem extends System {
235
235
  * @param {number} direction_x
236
236
  * @param {number} direction_y
237
237
  * @param {number} direction_z
238
- * @param {function(entity:number, mesh:ShadedGeometry)} [filter_function]
238
+ * @param {function(entity:number, mesh:ShadedGeometry):boolean} [filter_function]
239
239
  * @param {*} [filter_function_context]
240
240
  * @returns {{entity:number, mesh:ShadedGeometry}|undefined}
241
241
  */
@@ -245,7 +245,7 @@ export class ShadedGeometrySystem extends System {
245
245
  direction_x, direction_y, direction_z,
246
246
  filter_function = returnTrue, filter_function_context
247
247
  ) {
248
- const root_bvh = this.__render_layer.bvh;
248
+ const root_bvh = this.__bvh;
249
249
  const stack_frame_address = traversal_cursor;
250
250
 
251
251
  traversal_stack[traversal_cursor++] = root_bvh;
@@ -304,9 +304,11 @@ export class ShadedGeometrySystem extends System {
304
304
  mat4.invert(scratch_m4, m4);
305
305
 
306
306
  // transform ray to local space
307
- const local_origin_x = scratch_m4[0] * origin_x + scratch_m4[4] * origin_y + scratch_m4[8] * origin_z + scratch_m4[12];
308
- const local_origin_y = scratch_m4[1] * origin_x + scratch_m4[5] * origin_y + scratch_m4[9] * origin_z + scratch_m4[13];
309
- const local_origin_z = scratch_m4[2] * origin_x + scratch_m4[6] * origin_y + scratch_m4[10] * origin_z + scratch_m4[14];
307
+ const inv_w = 1 / (scratch_m4[3] * origin_x + scratch_m4[7] * origin_y + scratch_m4[11] * origin_z + scratch_m4[15]);
308
+
309
+ const local_origin_x = (scratch_m4[0] * origin_x + scratch_m4[4] * origin_y + scratch_m4[8] * origin_z + scratch_m4[12]) * inv_w;
310
+ const local_origin_y = (scratch_m4[1] * origin_x + scratch_m4[5] * origin_y + scratch_m4[9] * origin_z + scratch_m4[13]) * inv_w;
311
+ const local_origin_z = (scratch_m4[2] * origin_x + scratch_m4[6] * origin_y + scratch_m4[10] * origin_z + scratch_m4[14]) * inv_w;
310
312
 
311
313
  const local_direction_x = scratch_m4[0] * direction_x + scratch_m4[4] * direction_y + scratch_m4[8] * direction_z;
312
314
  const local_direction_y = scratch_m4[1] * direction_x + scratch_m4[5] * direction_y + scratch_m4[9] * direction_z;
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.35.3",
8
+ "version": "2.35.4",
9
9
  "dependencies": {
10
10
  "gl-matrix": "3.4.3",
11
11
  "fast-levenshtein": "2.0.6",