auto-git:
[change] src/runtime-three/runtime-host.ts
This commit is contained in:
@@ -80,6 +80,7 @@ import {
|
|||||||
resolveWorldEnvironmentState,
|
resolveWorldEnvironmentState,
|
||||||
WorldBackgroundRenderer
|
WorldBackgroundRenderer
|
||||||
} from "../rendering/world-background-renderer";
|
} from "../rendering/world-background-renderer";
|
||||||
|
import { createRendererQuantizedEnvironmentBlendCache } from "../rendering/quantized-environment-blend-cache";
|
||||||
import {
|
import {
|
||||||
collectWaterContactPatches,
|
collectWaterContactPatches,
|
||||||
createWaterContactPatchAxisUniformValue,
|
createWaterContactPatchAxisUniformValue,
|
||||||
@@ -354,6 +355,7 @@ export class RuntimeHost {
|
|||||||
private readonly instanceAnimationClips = new Map<string, AnimationClip[]>();
|
private readonly instanceAnimationClips = new Map<string, AnimationClip[]>();
|
||||||
private readonly controllerContext: RuntimeControllerContext;
|
private readonly controllerContext: RuntimeControllerContext;
|
||||||
private readonly renderer: WebGLRenderer | null;
|
private readonly renderer: WebGLRenderer | null;
|
||||||
|
private readonly environmentBlendCache;
|
||||||
private runtimeScene: RuntimeSceneDefinition | null = null;
|
private runtimeScene: RuntimeSceneDefinition | null = null;
|
||||||
private collisionWorld: RapierCollisionWorld | null = null;
|
private collisionWorld: RapierCollisionWorld | null = null;
|
||||||
private collisionWorldRequestId = 0;
|
private collisionWorldRequestId = 0;
|
||||||
@@ -448,6 +450,14 @@ export class RuntimeHost {
|
|||||||
|
|
||||||
this.moonLight.intensity = 0;
|
this.moonLight.intensity = 0;
|
||||||
this.moonLight.visible = false;
|
this.moonLight.visible = false;
|
||||||
|
this.environmentBlendCache =
|
||||||
|
this.renderer === null
|
||||||
|
? null
|
||||||
|
: createRendererQuantizedEnvironmentBlendCache(this.renderer, {
|
||||||
|
onTextureReady: () => {
|
||||||
|
this.applyDayNightLighting();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
this.controllerContext = {
|
this.controllerContext = {
|
||||||
camera: this.camera,
|
camera: this.camera,
|
||||||
@@ -660,6 +670,7 @@ export class RuntimeHost {
|
|||||||
this.projectAssets = projectAssets;
|
this.projectAssets = projectAssets;
|
||||||
this.loadedModelAssets = loadedModelAssets;
|
this.loadedModelAssets = loadedModelAssets;
|
||||||
this.loadedImageAssets = loadedImageAssets;
|
this.loadedImageAssets = loadedImageAssets;
|
||||||
|
this.environmentBlendCache?.clear();
|
||||||
|
|
||||||
if (this.currentWorld !== null) {
|
if (this.currentWorld !== null) {
|
||||||
this.applyWorld();
|
this.applyWorld();
|
||||||
@@ -843,6 +854,7 @@ export class RuntimeHost {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.materialTextureCache.clear();
|
this.materialTextureCache.clear();
|
||||||
|
this.environmentBlendCache?.dispose();
|
||||||
this.worldBackgroundRenderer.dispose();
|
this.worldBackgroundRenderer.dispose();
|
||||||
this.renderer?.forceContextLoss();
|
this.renderer?.forceContextLoss();
|
||||||
this.renderer?.dispose();
|
this.renderer?.dispose();
|
||||||
@@ -1083,7 +1095,8 @@ export class RuntimeHost {
|
|||||||
const environmentState = resolveWorldEnvironmentState(
|
const environmentState = resolveWorldEnvironmentState(
|
||||||
resolvedWorld.background,
|
resolvedWorld.background,
|
||||||
backgroundTexture,
|
backgroundTexture,
|
||||||
backgroundOverlayState
|
backgroundOverlayState,
|
||||||
|
this.environmentBlendCache
|
||||||
);
|
);
|
||||||
|
|
||||||
this.worldBackgroundRenderer.update(
|
this.worldBackgroundRenderer.update(
|
||||||
|
|||||||
Reference in New Issue
Block a user