@needle-tools/engine 2.67.9-pre.1 → 2.67.11-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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@needle-tools/engine",
3
- "version": "2.67.9-pre.1",
3
+ "version": "2.67.11-pre",
4
4
  "description": "Needle Engine is a web-based runtime for 3D apps. It runs on your machine for development, and can be deployed anywhere. It is flexible, extensible, and collaboration and XR come naturally.",
5
5
  "main": "dist/needle-engine.umd.cjs",
6
6
  "module": "lib/needle-engine.js",
@@ -25,6 +25,8 @@
25
25
  "build:dist": "vite build",
26
26
  "build:src": "tsc --outDir ./lib --noEmit false --declaration",
27
27
  "build:license": "node plugins/publish/create-license.mjs",
28
+ "pack-gltf": "node --no-experimental-fetch node_modules/@needle-tools/gltf-transform-extensions/pack-gltf.mjs",
29
+ "transform:make-progressive": "node node_modules/@needle-tools/gltf-transform-extensions/make-progressive.mjs",
28
30
  "test:circular-imports": "node plugins/check-circular-imports.js",
29
31
  "test:tsc": "tsc"
30
32
  },
@@ -60,7 +62,7 @@
60
62
  "simplex-noise": "^4.0.1",
61
63
  "postprocessing": "^6.30.1",
62
64
  "stats.js": "^0.17.0",
63
- "three": "npm:@needle-tools/three@^0.146.6",
65
+ "three": "npm:@needle-tools/three@^0.146.7",
64
66
  "three-mesh-ui": "^6.4.5",
65
67
  "three.quarks": "^0.7.3",
66
68
  "uuid": "^9.0.0",
@@ -69,6 +71,7 @@
69
71
  "devDependencies": {
70
72
  "@babel/runtime": "^7.16.0",
71
73
  "@luncheon/esbuild-plugin-gzip": "^0.1.0",
74
+ "@needle-tools/gltf-transform-extensions": "^0.11.2-pre",
72
75
  "@needle-tools/helper": "^0.4.5",
73
76
  "@needle-tools/needle-component-compiler": "1.9.3",
74
77
  "@types/three": "0.146.0",
@@ -1,5 +1,5 @@
1
1
  import { TypeStore } from "./../engine_typestore"
2
-
2
+
3
3
  // Import types
4
4
  import { __Ignore } from "../../engine-components/codegen/components";
5
5
  import { AlignmentConstraint } from "../../engine-components/AlignmentConstraint";
@@ -179,7 +179,7 @@ import { XRGrabModel } from "../../engine-components/WebXRGrabRendering";
179
179
  import { XRGrabRendering } from "../../engine-components/WebXRGrabRendering";
180
180
  import { XRRig } from "../../engine-components/WebXRRig";
181
181
  import { XRState } from "../../engine-components/XRFlag";
182
-
182
+
183
183
  // Register types
184
184
  TypeStore.add("__Ignore", __Ignore);
185
185
  TypeStore.add("AlignmentConstraint", AlignmentConstraint);
@@ -307,7 +307,7 @@ export class Context implements IContext {
307
307
  // private _requestSizeUpdate : boolean = false;
308
308
 
309
309
  updateSize() {
310
- if (!this.isManagedExternally && !this.renderer.xr.isPresenting) {
310
+ if (!this.isManagedExternally && this.renderer.xr?.isPresenting === false) {
311
311
  this._sizeChanged = false;
312
312
  const scaleFactor = this.resolutionScaleFactor;
313
313
  const width = this.domWidth * scaleFactor;
@@ -207,6 +207,7 @@ export class EngineLoadingView implements ILoadingViewHandler {
207
207
  needleLogo.style.transform = `translate(-${logoSize * .5}px, -${logoSize + 32}px)`;
208
208
  needleLogo.addEventListener("click", () => window.open("https://needle.tools", "_blank"));
209
209
  needleLogo.style.cursor = "pointer";
210
+ needleLogo.style.userSelect = "none";
210
211
  needleLogo.style.pointerEvents = "all";
211
212
  needleLogo.src = logoSVG;
212
213
  loadingBarContainer.appendChild(needleLogo);
@@ -370,17 +370,19 @@ export function runPrewarm(context: IContext) {
370
370
  if (cam) {
371
371
  if (debugPrewarm) console.log("prewarm", list.length, "objects", [...list]);
372
372
  const renderer = context.renderer;
373
- const scene = context.scene;
374
- renderer.compile(scene, cam!)
375
- prewarmTarget ??= new WebGLCubeRenderTarget(64)
376
- prewarmCamera ??= new CubeCamera(0.001, 9999999, prewarmTarget);
377
- prewarmCamera.update(renderer, scene);
378
- for (const obj of list) {
379
- obj[$prewarmedFlag] = true;
380
- obj[$waitingForPrewarm] = false;
373
+ if (renderer.compile) {
374
+ const scene = context.scene;
375
+ renderer.compile(scene, cam!)
376
+ prewarmTarget ??= new WebGLCubeRenderTarget(64)
377
+ prewarmCamera ??= new CubeCamera(0.001, 9999999, prewarmTarget);
378
+ prewarmCamera.update(renderer, scene);
379
+ for (const obj of list) {
380
+ obj[$prewarmedFlag] = true;
381
+ obj[$waitingForPrewarm] = false;
382
+ }
383
+ list.length = 0;
384
+ if (debugPrewarm) console.log("prewarm done");
381
385
  }
382
- list.length = 0;
383
- if (debugPrewarm) console.log("prewarm done");
384
386
  }
385
387
  }
386
388
 
@@ -4,6 +4,9 @@ import { VolumeParameter } from "./VolumeParameter";
4
4
  import { Component } from "../Component";
5
5
  import { ISerializable, SerializationContext } from "../../engine/engine_serialization_core";
6
6
  import { EditorModification, IEditorModification } from "../../engine/engine_editor-sync";
7
+ import { getParam } from "../../engine/engine_utils";
8
+
9
+ const debug = getParam("debugpost");
7
10
 
8
11
  export declare type EffectProviderResult = Effect | Pass | Array<Effect | Pass>;
9
12
 
@@ -42,9 +45,9 @@ export abstract class PostProcessingEffect extends Component implements IEffectP
42
45
  apply(): void | undefined | EffectProviderResult {
43
46
  if (!this._result) {
44
47
  this._result = this.onCreateEffect?.call(this);
45
- if (this._result) {
46
- this.initParameters();
47
- }
48
+ }
49
+ if (this._result) {
50
+ this.initParameters();
48
51
  }
49
52
  return this._result;
50
53
  }
@@ -56,6 +59,7 @@ export abstract class PostProcessingEffect extends Component implements IEffectP
56
59
  onCreateEffect?(): EffectProviderResult | undefined
57
60
 
58
61
  dispose() {
62
+ if(debug) console.warn("DISPOSE", this)
59
63
  if (this._result) {
60
64
  if (Array.isArray(this._result)) {
61
65
  this._result.forEach(r => r.dispose());
@@ -51,8 +51,6 @@ export class Volume extends Behaviour implements IEditorModificationReceiver {
51
51
  if (this.context.mainCamera) {
52
52
  if (!this._postprocessing || !this._postprocessing.isActive) {
53
53
  this.apply();
54
- // TODO: remove this workaround for postprocessing rendering not working correctly when applied for the first time
55
- this.apply();
56
54
  }
57
55
  }
58
56