@needle-tools/engine 2.59.0-pre → 2.59.1-pre.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@needle-tools/engine",
3
- "version": "2.59.0-pre",
3
+ "version": "2.59.1-pre.1",
4
4
  "description": "Needle Engine is a web-based runtime for 3D apps. It runs on your machine for development, and can be deployed anywhere. It is flexible, extensible, and collaboration and XR come naturally.",
5
5
  "main": "dist/needle-engine.umd.cjs",
6
6
  "module": "dist/needle-engine.js",
@@ -47,7 +47,7 @@
47
47
  "peerjs": "1.3.2",
48
48
  "simplex-noise": "^4.0.1",
49
49
  "stats.js": "^0.17.0",
50
- "three": "npm:@needle-tools/three@^0.146.4",
50
+ "three": "npm:@needle-tools/three@^0.146.5",
51
51
  "three-mesh-ui": "^6.4.5",
52
52
  "three.quarks": "^0.7.3",
53
53
  "uuid": "^9.0.0",
@@ -56,7 +56,7 @@
56
56
  "devDependencies": {
57
57
  "@babel/runtime": "^7.16.0",
58
58
  "@luncheon/esbuild-plugin-gzip": "^0.1.0",
59
- "@needle-tools/gltf-transform-extensions": "^0.10.8-pre",
59
+ "@needle-tools/gltf-transform-extensions": "^0.10.9-pre",
60
60
  "@needle-tools/needle-component-compiler": "1.9.3",
61
61
  "@needle-tools/helper": "^0.2.1-pre",
62
62
  "@types/three": "0.146.0",
@@ -343,10 +343,10 @@ export class Input extends EventTarget {
343
343
 
344
344
  private canReceiveInput(evt : Event) {
345
345
  // If the user has HTML objects ontop of the canvas
346
- if(evt.target instanceof HTMLCanvasElement) return true;
347
- const css = window.getComputedStyle(evt.target as HTMLElement);
348
- if(css.pointerEvents === "all") return false;
349
- return true;
346
+ // if(evt.target === this.context.renderer.domElement) return true;
347
+ // const css = window.getComputedStyle(evt.target as HTMLElement);
348
+ // if(css.pointerEvents === "all") return false;
349
+ return evt.target === this.context.renderer.domElement;
350
350
  }
351
351
 
352
352
  private keysPressed: { [key: number]: { pressed: boolean, frame: number, startFrame: number, key: string } } = {};
@@ -4,8 +4,12 @@
4
4
  // for (let url of testUrls)
5
5
  // console.log("Testing url: " + url, isLocalNetwork(url));
6
6
 
7
+ const localNetworkResults = new Map<string, boolean>();
8
+
7
9
  export function isLocalNetwork(hostname = window.location.hostname) {
10
+ if(localNetworkResults.has(hostname)) return localNetworkResults.get(hostname);
8
11
  const isLocalNetwork = new RegExp("[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}|localhost", "gm").test(hostname);
12
+ localNetworkResults.set(hostname, isLocalNetwork);
9
13
  if (isLocalNetwork === true) return true;
10
14
  return false;
11
15
  }
@@ -73,11 +73,12 @@ export class NEEDLE_lightmaps implements GLTFLoaderPlugin {
73
73
  else
74
74
  tex.encoding = LinearEncoding;
75
75
 
76
- // not sure why, but seems EXR-loaded float textures need to be flipped
77
- if (entry.type === LightmapType.Skybox) {
78
- if (tex.type == FloatType || tex.type == HalfFloatType)
79
- tex.flipY = true;
80
- }
76
+
77
+ // Dont flip skybox textures anymore - previously we exported them flipped when baking in Unity but now we allow to pass through export without re-baking exisitng skybox textures if they use default values. So we expect textures to be NOT flipped anymore
78
+ // if (entry.type === LightmapType.Skybox) {
79
+ // if (tex.type == FloatType || tex.type == HalfFloatType)
80
+ // tex.flipY = true;
81
+ // }
81
82
 
82
83
  this.registry.registerTexture(this.source, entry.type, tex, entry.index);
83
84
  }
@@ -15,6 +15,7 @@ import { RaycastOptions } from "../engine/engine_physics";
15
15
  import { RoomEvents } from "../engine/engine_networking";
16
16
  import { ICamera } from "../engine/engine_types";
17
17
  import { IModel } from "../engine/engine_networking_types";
18
+ import { serializable } from "../engine/engine_serialization";
18
19
 
19
20
 
20
21
  export enum SpectatorMode {
@@ -28,6 +29,10 @@ export class SpectatorCamera extends Behaviour {
28
29
 
29
30
  cam: Camera | null = null;
30
31
 
32
+ /** when enabled pressing F will send a request to all connected users to follow me, ESC to stop */
33
+ @serializable()
34
+ useKeys: boolean = true;
35
+
31
36
  private _mode: SpectatorMode = SpectatorMode.FirstPerson;
32
37
 
33
38
  get mode() { return this._mode; }
@@ -448,7 +453,8 @@ class SpectatorSelectionController {
448
453
  this.context = context;
449
454
  this.spectator = spectator;
450
455
  console.log("Click other avatars or cameras to follow them. Press ESC to exit spectator mode.");
451
- window.addEventListener("keydown", (evt) => {
456
+ this.context.domElement.addEventListener("keydown", (evt) => {
457
+ if(!this.spectator.useKeys) return;
452
458
  const key = evt.key;
453
459
  if (key === "Escape") {
454
460
  this.spectator.stopSpectating();
@@ -544,7 +550,8 @@ class SpectatorCamNetworking {
544
550
  this.context.connection.beginListen("spectator-follower-changed", this._followerEventMethod);
545
551
  this.context.connection.beginListen("spectator-request-follow", this._requestFollowMethod);
546
552
  this.context.connection.beginListen(RoomEvents.JoinedRoom, this._joinedRoomMethod);
547
- document.addEventListener("keydown", evt => {
553
+ this.context.domElement.addEventListener("keydown", evt => {
554
+ if(!this.spectator.useKeys) return;
548
555
  if (evt.key === "f") {
549
556
  this.onRequestFollowMe();
550
557
  }
@@ -20,8 +20,12 @@ export class SyncedRoom extends Behaviour {
20
20
 
21
21
  private _roomPrefix?: string;
22
22
 
23
+ public get RoomPrefix(): string | undefined {
24
+ return this._roomPrefix;
25
+ }
26
+
23
27
  awake() {
24
- if(debug) console.log("Room", this.roomName, this.urlParameterName, this.joinRandomRoom, this.requireRoomParameter, this.autoRejoin);
28
+ if (debug) console.log("Room", this.roomName, this.urlParameterName, this.joinRandomRoom, this.requireRoomParameter, this.autoRejoin);
25
29
  if (this._roomPrefix === undefined) {
26
30
  this._roomPrefix = this.roomName;
27
31
  this.roomName = "";