@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.
- package/CHANGELOG.md +3 -0
- package/dist/needle-engine.js +9914 -9823
- package/dist/needle-engine.min.js +4812 -0
- package/dist/needle-engine.umd.cjs +283 -283
- package/lib/engine/engine_addressables.js +1 -1
- package/lib/engine/engine_addressables.js.map +1 -1
- package/lib/engine/engine_context.d.ts +0 -1
- package/lib/engine/engine_context.js +15 -17
- package/lib/engine/engine_context.js.map +1 -1
- package/lib/engine/engine_context_registry.d.ts +2 -1
- package/lib/engine/engine_context_registry.js +6 -1
- package/lib/engine/engine_context_registry.js.map +1 -1
- package/lib/engine/engine_element.js +1 -1
- package/lib/engine/engine_element.js.map +1 -1
- package/lib/engine/engine_gltf.d.ts +2 -2
- package/lib/engine/engine_mainloop_utils.js +13 -11
- package/lib/engine/engine_mainloop_utils.js.map +1 -1
- package/lib/engine/engine_networking_files.js +4 -3
- package/lib/engine/engine_networking_files.js.map +1 -1
- package/lib/engine/engine_scenetools.d.ts +4 -4
- package/lib/engine/engine_scenetools.js +5 -5
- package/lib/engine/engine_scenetools.js.map +1 -1
- package/lib/engine/engine_time.d.ts +2 -1
- package/lib/engine/engine_time.js.map +1 -1
- package/lib/engine/engine_types.d.ts +5 -0
- package/lib/engine/engine_types.js.map +1 -1
- package/lib/engine-components/Animation.d.ts +1 -1
- package/lib/engine-components/Animation.js +3 -3
- package/lib/engine-components/Animation.js.map +1 -1
- package/lib/engine-components/Renderer.d.ts +1 -1
- package/lib/engine-components/Renderer.js +15 -4
- package/lib/engine-components/Renderer.js.map +1 -1
- package/lib/engine-components/api.d.ts +1 -0
- package/lib/engine-components/api.js +2 -0
- package/lib/engine-components/api.js.map +1 -0
- package/lib/engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusion.d.ts +2 -0
- package/lib/engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusion.js +18 -1
- package/lib/engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusion.js.map +1 -1
- package/lib/engine-components/postprocessing/PostProcessingHandler.d.ts +3 -0
- package/lib/engine-components/postprocessing/PostProcessingHandler.js +1 -1
- package/lib/engine-components/postprocessing/PostProcessingHandler.js.map +1 -1
- package/lib/engine-components/ui/Text.d.ts +1 -1
- package/lib/engine-components/ui/Text.js +42 -17
- package/lib/engine-components/ui/Text.js.map +1 -1
- package/lib/needle-engine.d.ts +1 -0
- package/lib/needle-engine.js +1 -0
- package/lib/needle-engine.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -4
- package/plugins/vite/copyfiles.js +37 -10
- package/plugins/vite/reload.js +2 -1
- package/src/engine/engine_addressables.ts +1 -1
- package/src/engine/engine_context.ts +15 -18
- package/src/engine/engine_context_registry.ts +7 -1
- package/src/engine/engine_element.ts +1 -1
- package/src/engine/engine_gltf.ts +2 -2
- package/src/engine/engine_mainloop_utils.ts +12 -10
- package/src/engine/engine_networking_files.ts +5 -4
- package/src/engine/engine_scenetools.ts +7 -7
- package/src/engine/engine_time.ts +2 -1
- package/src/engine/engine_types.ts +6 -0
- package/src/engine-components/Animation.ts +3 -3
- package/src/engine-components/Renderer.ts +19 -5
- package/src/engine-components/api.ts +1 -0
- package/src/engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusion.ts +15 -1
- package/src/engine-components/postprocessing/PostProcessingHandler.ts +1 -1
- package/src/engine-components/ui/Text.ts +41 -17
- 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.
|
|
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
|
|
479
|
+
private getFontStyleName(style: FontStyle): string | null {
|
|
480
480
|
if (!this.font) return null;
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
//
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
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
|
|
package/src/needle-engine.ts
CHANGED
|
@@ -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
|
|