@needle-tools/engine 3.1.0-alpha → 3.1.0-alpha.2

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": "3.1.0-alpha",
3
+ "version": "3.1.0-alpha.2",
4
4
  "description": "Needle Engine is a web-based runtime for 3D apps. It runs on your machine for development with great integrations into editors like Unity or Blender - and can be deployed onto any device! It is flexible, extensible and networking and XR are built-in",
5
5
  "main": "dist/needle-engine.umd.cjs",
6
6
  "type": "module",
@@ -722,9 +722,9 @@ export class ShapeModule implements EmitterShape {
722
722
  const theta = 2 * Math.PI * u * (arc / 360);
723
723
  const phi = Math.acos(2 * v - 1);
724
724
  const r = Mathf.lerp(1, 1 - (Math.pow(1 - Math.random(), Math.PI)), thickness) * (radius);
725
- const x = pos.x + (-r * Math.sin(phi) * Math.cos(theta));
726
- const y = pos.y + (r * Math.sin(phi) * Math.sin(theta));
727
- const z = pos.z + (r * Math.cos(phi));
725
+ const x = pos.x + this.scale.x * (-r * Math.sin(phi) * Math.cos(theta));
726
+ const y = pos.y + this.scale.y * (r * Math.sin(phi) * Math.sin(theta));
727
+ const z = pos.z + this.scale.z * (r * Math.cos(phi));
728
728
  vec.x = x;
729
729
  vec.y = y;
730
730
  vec.z = z;
@@ -734,8 +734,8 @@ export class ShapeModule implements EmitterShape {
734
734
  const u = Math.random();
735
735
  const theta = 2 * Math.PI * u * (arg / 360);
736
736
  const r = Mathf.lerp(1, 1 - (Math.pow(1 - Math.random(), Math.PI)), thickness) * (radius);
737
- const x = pos.x + r * Math.cos(theta);
738
- const y = pos.y + r * Math.sin(theta);
737
+ const x = pos.x + this.scale.x * r * Math.cos(theta);
738
+ const y = pos.y + this.scale.y * r * Math.sin(theta);
739
739
  const z = pos.z;
740
740
  vec.x = x;
741
741
  vec.y = y;
@@ -12,7 +12,7 @@ const debug = getParam("debugskybox");
12
12
  export class RemoteSkybox extends Behaviour {
13
13
 
14
14
  @syncField("setSkybox")
15
- @serializable()
15
+ @serializable(URL)
16
16
  url?: string;
17
17
 
18
18
  @serializable()
@@ -55,11 +55,6 @@ export class RemoteSkybox extends Behaviour {
55
55
 
56
56
  if(debug) console.log("Remote skybox url?: " + url);
57
57
 
58
- if (!url.startsWith("http") && !url.startsWith("www.") && !url.startsWith("data:")) {
59
- url = resolveUrl(this.sourceId, url);
60
- if(debug) console.log("Remote skybox resolved to " + url);
61
- }
62
-
63
58
  if (this._prevUrl === url && this._prevLoadedEnvironment) {
64
59
  this.applySkybox();
65
60
  return;
@@ -84,7 +84,7 @@ declare type WebXRImageTrackingEvent = (images: WebXRImageTrackingEvent[]) => vo
84
84
 
85
85
  export class WebXRImageTrackingModel {
86
86
 
87
- @serializable()
87
+ @serializable(URL)
88
88
  image?: string;
89
89
 
90
90
  @serializable()
@@ -480,19 +480,20 @@ export class Text extends Graphic {
480
480
  let fontName = this.font;
481
481
 
482
482
  // if a font path has a known suffix we remove it
483
- if (fontName.endsWith("-regular")) {
483
+ const fontNameLower = fontName.toLowerCase();
484
+ if (fontNameLower.endsWith("-regular")) {
484
485
  if (style === FontStyle.Normal) return resolveUrl(this.sourceId, fontName);
485
486
  fontName = fontName.substring(0, fontName.length - "-regular".length);
486
487
  }
487
- else if (fontName.endsWith("-bold")) {
488
+ else if (fontNameLower.endsWith("-bold")) {
488
489
  if (style === FontStyle.Bold)return resolveUrl(this.sourceId, fontName);
489
490
  fontName = fontName.substring(0, fontName.length - "-bold".length);
490
491
  }
491
- else if (fontName.endsWith("-italic")) {
492
+ else if (fontNameLower.endsWith("-italic")) {
492
493
  if (style === FontStyle.Italic)return resolveUrl(this.sourceId, fontName);
493
494
  fontName = fontName.substring(0, fontName.length - "-italic".length);
494
495
  }
495
- else if (fontName.endsWith("-bolditalic")) {
496
+ else if (fontNameLower.endsWith("-bolditalic")) {
496
497
  if (style === FontStyle.BoldAndItalic)return resolveUrl(this.sourceId, fontName);
497
498
  fontName = fontName.substring(0, fontName.length - "-bolditalic".length);
498
499
  }