@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/CHANGELOG.md +7 -0
- package/dist/needle-engine.js +3579 -3563
- package/dist/needle-engine.umd.cjs +78 -78
- package/lib/engine/engine_context.js +1 -1
- package/lib/engine/engine_context.js.map +1 -1
- package/lib/engine/engine_mainloop_utils.js +13 -11
- package/lib/engine/engine_mainloop_utils.js.map +1 -1
- 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/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/engine/engine_context.ts +1 -1
- package/src/engine/engine_mainloop_utils.ts +12 -10
- package/src/engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusion.ts +15 -1
- package/src/engine-components/postprocessing/PostProcessingHandler.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@needle-tools/engine",
|
|
3
|
-
"version": "2.67.
|
|
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 &&
|
|
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
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
obj
|
|
380
|
-
|
|
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);
|