Needle Engine

Changes between version 3.37.10-alpha.1 and 3.37.10-alpha.2
Files changed (7) hide show
  1. src/engine-components/export/usdz/extensions/behavior/BehaviourComponents.ts +1 -0
  2. src/engine-components/ContactShadows.ts +1 -1
  3. src/engine/debug/debug_overlay.ts +12 -0
  4. src/engine/debug/debug.ts +4 -2
  5. src/engine/engine_element.ts +10 -4
  6. src/engine/extensions/NEEDLE_techniques_webgl.ts +8 -0
  7. src/engine-components/SyncedTransform.ts +1 -1
src/engine-components/export/usdz/extensions/behavior/BehaviourComponents.ts CHANGED
@@ -645,6 +645,7 @@
645
645
  newAudioSource.spatialBlend = 1;
646
646
  newAudioSource.volume = 1;
647
647
  newAudioSource.loop = false;
648
+ newAudioSource.preload = true;
648
649
  }
649
650
  }
650
651
  }
src/engine-components/ContactShadows.ts CHANGED
@@ -2,6 +2,7 @@
2
2
  import { HorizontalBlurShader } from 'three/examples/jsm/shaders/HorizontalBlurShader.js';
3
3
  import { VerticalBlurShader } from 'three/examples/jsm/shaders/VerticalBlurShader.js';
4
4
 
5
+ import { setAutoFitEnabled } from "../engine/engine_camera.js";
5
6
  import { addComponent } from "../engine/engine_components.js";
6
7
  import { Context } from "../engine/engine_context.js";
7
8
  import { Gizmos } from "../engine/engine_gizmos.js";
@@ -10,7 +11,6 @@
10
11
  import { getParam } from "../engine/engine_utils.js"
11
12
  import { setCustomVisibility } from "../engine/js-extensions/Layers.js";
12
13
  import { Behaviour } from "./Component.js";
13
- import { setAutoFitEnabled } from "../engine/engine_camera.js";
14
14
 
15
15
  const debug = getParam("debugcontactshadows");
16
16
 
src/engine/debug/debug_overlay.ts CHANGED
@@ -238,6 +238,18 @@
238
238
  const typeSymbol = Symbol("logtype");
239
239
  const containerCache = new Map<LogType, HTMLElement[]>();
240
240
 
241
+ /**
242
+ * Clear all messages from the overlay
243
+ */
244
+ export function clearMessages() {
245
+ const array = Array.from(containerCache.values());
246
+ for (const cache of array) {
247
+ for (const container of cache) {
248
+ returnMessageContainer(container);
249
+ }
250
+ }
251
+ }
252
+
241
253
  function returnMessageContainer(container: HTMLElement) {
242
254
  container.remove();
243
255
  const type = container[typeSymbol];
src/engine/debug/debug.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  import { isLocalNetwork } from "../engine_networking_utils.js";
2
2
  import { getParam } from "../engine_utils.js";
3
3
  import { showDebugConsole } from "./debug_console.js";
4
- import { addLog, LogType, setAllowOverlayMessages } from "./debug_overlay.js";
4
+ import { addLog, clearMessages,LogType, setAllowOverlayMessages } from "./debug_overlay.js";
5
5
 
6
6
  export { showDebugConsole }
7
- export { LogType, setAllowOverlayMessages };
7
+ export { clearMessages as clearOverlayMessages,LogType, setAllowOverlayMessages };
8
8
  export { enableSpatialConsole } from "./debug_spatial_console.js";
9
9
 
10
10
  const noDevLogs = getParam("nodevlogs");
@@ -18,6 +18,7 @@
18
18
  export function showBalloonWarning(text: string): void {
19
19
  showBalloonMessage(text, LogType.Warn);
20
20
  }
21
+ /** Displays an error message on screen for a certain amount of time */
21
22
  export function showBalloonError(text: string): void {
22
23
  showBalloonMessage(text, LogType.Error);
23
24
  }
@@ -30,6 +31,7 @@
30
31
  if (_manuallySetDevEnvironment !== undefined) return _manuallySetDevEnvironment;
31
32
  return isLocalNetwork();
32
33
  }
34
+ /** Enforce the dev environment flag to be true or false */
33
35
  export function setDevEnvironment(val: boolean): void {
34
36
  _manuallySetDevEnvironment = val;
35
37
  }
src/engine/engine_element.ts CHANGED
@@ -693,9 +693,14 @@
693
693
  const parts = str.split("/");
694
694
  let name = parts[parts.length - 1];
695
695
  // Remove params
696
- const index = name.indexOf("?")
697
- if (index > 0)
698
- name = name.substring(0, index);
696
+ const paramsIndex = name.indexOf("?")
697
+ if (paramsIndex > 0)
698
+ name = name.substring(0, paramsIndex);
699
+
700
+ const equalSign = name.indexOf("=");
701
+ if (equalSign > 0)
702
+ name = name.substring(equalSign);
703
+
699
704
  const extension = name.split(".").pop();
700
705
  if (extension === "glb" || extension === "gltf")
701
706
  name = name.substring(0, name.length - 4);
@@ -706,7 +711,8 @@
706
711
  let c = name[i];
707
712
  if (c === ' ' && displayName.length <= 0) continue;
708
713
  const isFirstCharacter = displayName.length === 0;
709
- if (isFirstCharacter == false && c === c.toUpperCase()) {
714
+ const isNumber = c >= '0' && c <= '9';
715
+ if (isFirstCharacter == false && c === c.toUpperCase() && !isNumber) {
710
716
  displayName += " " + c;
711
717
  }
712
718
  else {
src/engine/extensions/NEEDLE_techniques_webgl.ts CHANGED
@@ -299,6 +299,14 @@
299
299
  params.w = 1.0 + 1.0 / params.y;
300
300
  this.uniforms["_ScreenParams"].value = params;
301
301
  }
302
+ if (this.uniforms["_ScaledScreenParams"]) {
303
+ const params = this.uniforms["_ScaledScreenParams"].value;
304
+ params.x = context.domWidth;
305
+ params.y = context.domHeight;
306
+ params.z = 1.0 + 1.0 / params.x;
307
+ params.w = 1.0 + 1.0 / params.y;
308
+ this.uniforms["_ScaledScreenParams"].value = params;
309
+ }
302
310
  }
303
311
  }
304
312
 
src/engine-components/SyncedTransform.ts CHANGED
@@ -290,7 +290,7 @@
290
290
  }
291
291
 
292
292
  // local user is owner:
293
- if (this.rb) {
293
+ if (this.rb && this.overridePhysics) {
294
294
  if (this._wasKinematic !== undefined) {
295
295
  if (debug)
296
296
  console.log("reset kinematic", this.rb.name, this._wasKinematic);