@needle-tools/engine 2.67.10-pre → 2.67.12-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.10-pre",
3
+ "version": "2.67.12-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",
@@ -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;
@@ -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
 
@@ -1,5 +1,5 @@
1
1
  import { BlendFunction, DepthDownsamplingPass, Effect, NormalPass, SSAOEffect } from "postprocessing";
2
- import { NeverDepth, PerspectiveCamera } from "three";
2
+ import { Color, NeverDepth, PerspectiveCamera } from "three";
3
3
  import { serializable } from "../../../engine/engine_serialization";
4
4
  import { EffectProviderResult, PostProcessingEffect } from "../PostProcessingEffect";
5
5
  import { VolumeParameter } from "../VolumeParameter";
@@ -21,6 +21,12 @@ export class ScreenSpaceAmbientOcclusion extends PostProcessingEffect {
21
21
  @serializable(VolumeParameter)
22
22
  samples!: VolumeParameter;
23
23
 
24
+ @serializable(VolumeParameter)
25
+ color!: VolumeParameter;
26
+
27
+ @serializable(VolumeParameter)
28
+ luminanceInfluence!: VolumeParameter;
29
+
24
30
  onBeforeRender() {
25
31
  if (this._ssao && this.context.mainCamera instanceof PerspectiveCamera) {
26
32
  const fadeDistance = this.context.mainCamera.far - this.context.mainCamera.near;
@@ -48,6 +54,7 @@ export class ScreenSpaceAmbientOcclusion extends PostProcessingEffect {
48
54
  worldProximityFalloff: 2,
49
55
  intensity: 1,
50
56
  blendFunction: BlendFunction.MULTIPLY,
57
+ luminanceInfluence: .5,
51
58
  });
52
59
 
53
60
  this.intensity.onValueChanged = newValue => {
@@ -59,6 +66,13 @@ export class ScreenSpaceAmbientOcclusion extends PostProcessingEffect {
59
66
  this.samples.onValueChanged = newValue => {
60
67
  ssao.samples = newValue;
61
68
  }
69
+ this.color.onValueChanged = newValue => {
70
+ if (!ssao.color) ssao.color = new Color();
71
+ ssao.color.copy(newValue);
72
+ }
73
+ this.luminanceInfluence.onValueChanged = newValue => {
74
+ ssao.luminanceInfluence = newValue;
75
+ }
62
76
 
63
77
  const arr = new Array();
64
78
  arr.push(normalPass);
@@ -193,7 +193,7 @@ export class PostProcessingHandler {
193
193
  }
194
194
 
195
195
 
196
- const effectsOrder: Array<Constructor<Effect | Pass>> = [
196
+ export const effectsOrder: Array<Constructor<Effect | Pass>> = [
197
197
  NormalPass,
198
198
  DepthDownsamplingPass,
199
199
  SSAOEffect,