@needle-tools/engine 2.35.1-pre → 2.35.2-pre

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.
@@ -5,7 +5,7 @@ import { RendererLightmap } from "./RendererLightmap";
5
5
  import { Context } from "../engine/engine_setup";
6
6
  import { getParam } from "../engine/engine_utils";
7
7
  import { serializeable } from "../engine/engine_serialization_decorator";
8
- import { Material, Texture, Vector4 } from "three";
8
+ import { Material, Mesh, Texture, Vector4 } from "three";
9
9
  import { NEEDLE_render_objects } from "../engine/extensions/NEEDLE_render_objects";
10
10
  import { NEEDLE_deferred_texture } from "../engine/extensions/NEEDLE_deferred_texture";
11
11
  import { NEED_UPDATE_INSTANCE_KEY } from "../engine/engine_instancing";
@@ -133,12 +133,22 @@ export class Renderer extends Behaviour implements IRenderer {
133
133
  // private _materialProperties: Array<MaterialProperties> | undefined = undefined;
134
134
  private _lightmaps?: RendererLightmap[];
135
135
 
136
+ get mesh(): Mesh | undefined {
137
+ if (this.gameObject.type === "Mesh") {
138
+ return this.gameObject as unknown as Mesh
139
+ }
140
+ else if (this.gameObject.type === "Group") {
141
+ return this.gameObject.children[0] as unknown as Mesh;
142
+ }
143
+ return undefined;
144
+ }
145
+
136
146
  get material(): THREE.Material {
137
- return this.gameObject["material"];
147
+ return this.sharedMaterials[0];
138
148
  }
139
149
 
140
150
  set material(mat: THREE.Material) {
141
- this.gameObject["material"] = mat;
151
+ this.sharedMaterials[0] = mat;
142
152
  }
143
153
 
144
154
  private _sharedMaterials!: SharedMaterialArray;
@@ -484,7 +484,10 @@ export class WebAR {
484
484
 
485
485
  getAROverlayContainer(): HTMLElement | null {
486
486
  this.arDomOverlay = this.webxr.context.domElement as EngineElement;
487
- this.arOverlayElement = this.arDomOverlay.getAROverlayContainer();
487
+ // for react cases we dont have an Engine Element
488
+ if (this.arDomOverlay.getAROverlayContainer)
489
+ this.arOverlayElement = this.arDomOverlay.getAROverlayContainer();
490
+ else this.arOverlayElement = this.arDomOverlay;
488
491
  return this.arOverlayElement;
489
492
  }
490
493
 
@@ -44,7 +44,6 @@ export class UIRaycastUtils {
44
44
  }
45
45
  if (graphic?.raycastTarget === false) return false;
46
46
 
47
- console.log(graphic);
48
47
  return true;
49
48
  }
50
49
 
@@ -1,6 +1,5 @@
1
1
  import "./engine/engine_element";
2
2
  import "./engine/engine_setup";
3
- import "./engine/codegen/register_types";
4
3
  // import "./engine/engine_mainloop";
5
4
  // import "./engine-components/DomOverlay";
6
5