@needle-tools/engine 4.7.0-next.968391f → 4.7.0-next.b344106

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 (31) hide show
  1. package/dist/{needle-engine.bundle-DtrPbYYj.min.js → needle-engine.bundle-BJvGtkRN.min.js} +5 -5
  2. package/dist/{needle-engine.bundle-4ZErY29T.umd.cjs → needle-engine.bundle-BPvX8tv9.umd.cjs} +5 -5
  3. package/dist/{needle-engine.bundle-W3V0IktP.js → needle-engine.bundle-CJYsymRO.js} +15 -15
  4. package/dist/needle-engine.js +2 -2
  5. package/dist/needle-engine.min.js +1 -1
  6. package/dist/needle-engine.umd.cjs +1 -1
  7. package/lib/engine/engine_context.js +1 -1
  8. package/lib/engine/engine_context.js.map +1 -1
  9. package/lib/engine/engine_three_utils.js +4 -0
  10. package/lib/engine/engine_three_utils.js.map +1 -1
  11. package/lib/engine/webcomponents/needle-engine.attributes.d.ts +1 -1
  12. package/lib/engine-components/Camera.js +1 -1
  13. package/lib/engine-components/Camera.js.map +1 -1
  14. package/lib/engine-components/CameraUtils.js +5 -3
  15. package/lib/engine-components/CameraUtils.js.map +1 -1
  16. package/lib/engine-components/Skybox.js +4 -4
  17. package/lib/engine-components/Skybox.js.map +1 -1
  18. package/package.json +1 -1
  19. package/plugins/common/logger.js +232 -0
  20. package/plugins/types/userconfig.d.ts +1 -1
  21. package/plugins/vite/imports-logger.js +1 -1
  22. package/plugins/vite/index.js +2 -0
  23. package/plugins/vite/logger.client.js +218 -0
  24. package/plugins/vite/logger.js +85 -0
  25. package/plugins/vite/materialx.js +6 -4
  26. package/src/engine/engine_context.ts +1 -1
  27. package/src/engine/engine_three_utils.ts +3 -0
  28. package/src/engine/webcomponents/needle-engine.attributes.ts +1 -1
  29. package/src/engine-components/Camera.ts +1 -1
  30. package/src/engine-components/CameraUtils.ts +5 -3
  31. package/src/engine-components/Skybox.ts +5 -5
@@ -734,6 +734,9 @@ export function getBoundingBox(objects: Object3D | Object3D[], ignore: ((obj: Ob
734
734
  console.warn(`Object \"${obj.name}\" has NaN values in position or scale.... will ignore it`, pos, scale);
735
735
  return;
736
736
  }
737
+ // Sanitize for the three.js method that only checks for undefined here
738
+ // @ts-ignore
739
+ if (obj.geometry === null) obj.geometry = undefined;
737
740
  box.expandByObject(obj, true);
738
741
  obj.children = children;
739
742
  }
@@ -44,7 +44,7 @@ type LoadingAttributes = {
44
44
  }
45
45
 
46
46
  type SkyboxAttributes = {
47
- /** use background-image instead - URL to .exr, .hdr, .png, .jpg to be used as skybox */
47
+ /** @deprecated. Use background-image instead - URL to .exr, .hdr, .png, .jpg to be used as skybox */
48
48
  "skybox-image"?: string,
49
49
  /** URL to .exr, .hdr, .png, .jpg to be used as skybox */
50
50
  "background-image"?: string,
@@ -560,7 +560,7 @@ export class Camera extends Behaviour implements ICamera {
560
560
  console.debug(msg);
561
561
  }
562
562
 
563
- const hasBackgroundImageOrColorAttribute = this.context.domElement.getAttribute("background-image") || this.context.domElement.getAttribute("background-color") || this.context.domElement.getAttribute("skybox-image");
563
+ const hasBackgroundImageOrColorAttribute = this.context.domElement.getAttribute("background-image") || this.context.domElement.getAttribute("background-color");
564
564
 
565
565
  switch (this._clearFlags) {
566
566
  case ClearFlags.None:
@@ -36,12 +36,14 @@ ContextRegistry.registerCallback(ContextEvent.MissingCamera, (evt) => {
36
36
  if (transparentAttribute != undefined) {
37
37
  camInstance.clearFlags = ClearFlags.Uninitialized;
38
38
  }
39
- // Set the clearFlags to a skybox if we have one OR if the user set a skybox image attribute
40
- else if (evt.context.domElement.getAttribute("skybox-image")?.length || evt.context.domElement.getAttribute("background-image")?.length || (evt.context as Context).lightmaps.tryGetSkybox(camInstance.sourceId)) {
39
+ // Set the clearFlags to a skybox if we have one OR if the user set a background-image attribute
40
+ else if (evt.context.domElement.getAttribute("background-image")?.length || (evt.context as Context).lightmaps.tryGetSkybox(camInstance.sourceId)) {
41
41
  camInstance.clearFlags = ClearFlags.Skybox;
42
42
  // TODO: can we store the backgroundBlurriness in the gltf file somewhere except inside the camera?
43
43
  // e.g. when we export a scene from blender without a camera in the scene
44
- camInstance.backgroundBlurriness = .2; // same as in blender 0.5
44
+ if (evt.context.domElement.getAttribute("background-blurriness") === null) {
45
+ evt.context.scene.backgroundBlurriness = 0.2; // default value, same as in Blender
46
+ }
45
47
  }
46
48
  else {
47
49
  camInstance.clearFlags = ClearFlags.SolidColor;
@@ -16,10 +16,10 @@ import { Behaviour, GameObject } from "./Component.js";
16
16
 
17
17
  const debug = getParam("debugskybox");
18
18
 
19
- registerObservableAttribute("skybox-image");
19
+ registerObservableAttribute("background-image");
20
20
  registerObservableAttribute("environment-image");
21
21
 
22
- function createRemoteSkyboxComponent(context: IContext, url: string, skybox: boolean, environment: boolean, attribute: "skybox-image" | "environment-image") {
22
+ function createRemoteSkyboxComponent(context: IContext, url: string, skybox: boolean, environment: boolean, attribute: "background-image" | "environment-image") {
23
23
  const remote = new RemoteSkybox();
24
24
  remote.allowDrop = false;
25
25
  remote.allowNetworking = false;
@@ -42,7 +42,7 @@ function createRemoteSkyboxComponent(context: IContext, url: string, skybox: boo
42
42
  const promises = new Array<Promise<any>>();
43
43
  ContextRegistry.registerCallback(ContextEvent.ContextCreationStart, (args) => {
44
44
  const context = args.context;
45
- const skyboxImage = context.domElement.getAttribute("skybox-image") || context.domElement.getAttribute("background-image");
45
+ const skyboxImage = context.domElement.getAttribute("background-image");
46
46
  const environmentImage = context.domElement.getAttribute("environment-image");
47
47
  if (skyboxImage) {
48
48
  if (debug)
@@ -50,8 +50,8 @@ ContextRegistry.registerCallback(ContextEvent.ContextCreationStart, (args) => {
50
50
  // if the user is loading a GLB without a camera then the CameraUtils (which creates the default camera)
51
51
  // checks if we have this attribute set and then sets the skybox clearflags accordingly
52
52
  // if the user has a GLB with a camera but set to solid color then the skybox image is not visible -> we will just warn then and not override the camera settings
53
- if (context.mainCameraComponent?.clearFlags !== ClearFlags.Skybox) console.warn("\"skybox-image\"/\"background-image\" attribute has no effect: camera clearflags are not set to \"Skybox\"");
54
- const promise = createRemoteSkyboxComponent(context, skyboxImage, true, false, "skybox-image");
53
+ if (context.mainCameraComponent?.clearFlags !== ClearFlags.Skybox) console.warn("\"background-image\" attribute has no effect: camera clear flags are not set to \"Skybox\"");
54
+ const promise = createRemoteSkyboxComponent(context, skyboxImage, true, false, "background-image");
55
55
  promises.push(promise);
56
56
  }
57
57
  if (environmentImage) {