@needle-tools/engine 3.0.0-alpha.1 → 3.0.1-alpha

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.
Files changed (68) hide show
  1. package/CHANGELOG.md +3 -0
  2. package/dist/needle-engine.js +9914 -9823
  3. package/dist/needle-engine.min.js +4812 -0
  4. package/dist/needle-engine.umd.cjs +283 -283
  5. package/lib/engine/engine_addressables.js +1 -1
  6. package/lib/engine/engine_addressables.js.map +1 -1
  7. package/lib/engine/engine_context.d.ts +0 -1
  8. package/lib/engine/engine_context.js +15 -17
  9. package/lib/engine/engine_context.js.map +1 -1
  10. package/lib/engine/engine_context_registry.d.ts +2 -1
  11. package/lib/engine/engine_context_registry.js +6 -1
  12. package/lib/engine/engine_context_registry.js.map +1 -1
  13. package/lib/engine/engine_element.js +1 -1
  14. package/lib/engine/engine_element.js.map +1 -1
  15. package/lib/engine/engine_gltf.d.ts +2 -2
  16. package/lib/engine/engine_mainloop_utils.js +13 -11
  17. package/lib/engine/engine_mainloop_utils.js.map +1 -1
  18. package/lib/engine/engine_networking_files.js +4 -3
  19. package/lib/engine/engine_networking_files.js.map +1 -1
  20. package/lib/engine/engine_scenetools.d.ts +4 -4
  21. package/lib/engine/engine_scenetools.js +5 -5
  22. package/lib/engine/engine_scenetools.js.map +1 -1
  23. package/lib/engine/engine_time.d.ts +2 -1
  24. package/lib/engine/engine_time.js.map +1 -1
  25. package/lib/engine/engine_types.d.ts +5 -0
  26. package/lib/engine/engine_types.js.map +1 -1
  27. package/lib/engine-components/Animation.d.ts +1 -1
  28. package/lib/engine-components/Animation.js +3 -3
  29. package/lib/engine-components/Animation.js.map +1 -1
  30. package/lib/engine-components/Renderer.d.ts +1 -1
  31. package/lib/engine-components/Renderer.js +15 -4
  32. package/lib/engine-components/Renderer.js.map +1 -1
  33. package/lib/engine-components/api.d.ts +1 -0
  34. package/lib/engine-components/api.js +2 -0
  35. package/lib/engine-components/api.js.map +1 -0
  36. package/lib/engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusion.d.ts +2 -0
  37. package/lib/engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusion.js +18 -1
  38. package/lib/engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusion.js.map +1 -1
  39. package/lib/engine-components/postprocessing/PostProcessingHandler.d.ts +3 -0
  40. package/lib/engine-components/postprocessing/PostProcessingHandler.js +1 -1
  41. package/lib/engine-components/postprocessing/PostProcessingHandler.js.map +1 -1
  42. package/lib/engine-components/ui/Text.d.ts +1 -1
  43. package/lib/engine-components/ui/Text.js +42 -17
  44. package/lib/engine-components/ui/Text.js.map +1 -1
  45. package/lib/needle-engine.d.ts +1 -0
  46. package/lib/needle-engine.js +1 -0
  47. package/lib/needle-engine.js.map +1 -1
  48. package/lib/tsconfig.tsbuildinfo +1 -1
  49. package/package.json +3 -4
  50. package/plugins/vite/copyfiles.js +37 -10
  51. package/plugins/vite/reload.js +2 -1
  52. package/src/engine/engine_addressables.ts +1 -1
  53. package/src/engine/engine_context.ts +15 -18
  54. package/src/engine/engine_context_registry.ts +7 -1
  55. package/src/engine/engine_element.ts +1 -1
  56. package/src/engine/engine_gltf.ts +2 -2
  57. package/src/engine/engine_mainloop_utils.ts +12 -10
  58. package/src/engine/engine_networking_files.ts +5 -4
  59. package/src/engine/engine_scenetools.ts +7 -7
  60. package/src/engine/engine_time.ts +2 -1
  61. package/src/engine/engine_types.ts +6 -0
  62. package/src/engine-components/Animation.ts +3 -3
  63. package/src/engine-components/Renderer.ts +19 -5
  64. package/src/engine-components/api.ts +1 -0
  65. package/src/engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusion.ts +15 -1
  66. package/src/engine-components/postprocessing/PostProcessingHandler.ts +1 -1
  67. package/src/engine-components/ui/Text.ts +41 -17
  68. package/src/needle-engine.ts +1 -0
@@ -466,7 +466,7 @@ export class Text extends Graphic {
466
466
  }
467
467
 
468
468
  private setFont(opts: any, fontStyle: FontStyle) {
469
- const name = this.getFontName(fontStyle);
469
+ const name = this.getFontStyleName(fontStyle);
470
470
  let family = name;
471
471
  if (!family?.endsWith("-msdf.json")) family += "-msdf.json";
472
472
  opts.fontFamily = family;
@@ -476,23 +476,47 @@ export class Text extends Graphic {
476
476
  opts.fontTexture = texture;
477
477
  }
478
478
 
479
- private getFontName(_fontStyle: FontStyle): string | null {
479
+ private getFontStyleName(style: FontStyle): string | null {
480
480
  if (!this.font) return null;
481
- // switch (fontStyle) {
482
- // case FontStyle.Normal:
483
- // return this.font;
484
- // case FontStyle.Bold:
485
- // if (!this.font.includes("-bold"))
486
- // return this.font + "-bold";
487
- // case FontStyle.Italic:
488
- // if (!this.font.includes("-italic"))
489
- // return this.font + "-italic";
490
- // case FontStyle.BoldAndItalic:
491
- // if (!this.font.includes("-bold-italic"))
492
- // return this.font + "-bold-italic";
493
- // }
494
- this.font = getPath(this.sourceId, this.font);
495
- return this.font;
481
+ let fontName = this.font;
482
+
483
+ // if a font path has a known suffix we remove it
484
+ if (fontName.endsWith("-regular")) {
485
+ if (style === FontStyle.Normal) return getPath(this.sourceId, fontName);
486
+ fontName = fontName.substring(0, fontName.length - "-regular".length);
487
+ }
488
+ else if (fontName.endsWith("-bold")) {
489
+ if (style === FontStyle.Bold)return getPath(this.sourceId, fontName);
490
+ fontName = fontName.substring(0, fontName.length - "-bold".length);
491
+ }
492
+ else if (fontName.endsWith("-italic")) {
493
+ if (style === FontStyle.Italic)return getPath(this.sourceId, fontName);
494
+ fontName = fontName.substring(0, fontName.length - "-italic".length);
495
+ }
496
+ else if (fontName.endsWith("-bolditalic")) {
497
+ if (style === FontStyle.BoldAndItalic)return getPath(this.sourceId, fontName);
498
+ fontName = fontName.substring(0, fontName.length - "-bolditalic".length);
499
+ }
500
+ else
501
+ // If a font does not have a specific style suffic we dont support getting the correct font style
502
+ return getPath(this.sourceId, fontName);
503
+
504
+ switch (style) {
505
+ case FontStyle.Normal:
506
+ fontName += "-regular";
507
+ break;
508
+ case FontStyle.Bold:
509
+ fontName += "-bold";
510
+ break;
511
+ case FontStyle.Italic:
512
+ fontName += "-italic";
513
+ break;
514
+ case FontStyle.BoldAndItalic:
515
+ fontName += "-bolditalic";
516
+ break;
517
+ }
518
+
519
+ return getPath(this.sourceId, fontName);
496
520
  }
497
521
  }
498
522
 
@@ -11,6 +11,7 @@ export { GameObject, Behaviour } from "./engine-components/Component";
11
11
  export { serializable, serializeable } from "./engine/engine_serialization_decorator";
12
12
  export { Collision } from "./engine/engine_types";
13
13
  export * from "./engine/api";
14
+ export * from "./engine-components/api";
14
15
  export * from "./engine-components/codegen/components";
15
16
  export * from "./engine-components/js-extensions/Object3D";
16
17