Skip to content

Commit

Permalink
Improve CheckIsReady in scene (BabylonJS#12625)
Browse files Browse the repository at this point in the history
* Fix prepass view uniform

* Format

* PBR refractionIntensityTexture in the inspector

* Fix registerInstancedBuffer after Mesh creation

* Fix Shadows after unparenting

* PR feedback

* Fix JPEG environment texture

* fix format

* No Delay to check readyness first
  • Loading branch information
sebavan authored and alvov-evo committed Jun 16, 2022
1 parent ce0d0be commit 5e609c2
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
5 changes: 4 additions & 1 deletion packages/dev/core/src/Loading/Plugins/babylonFileLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,10 @@ const loadAssetContainer = (scene: Scene, data: string, rootUrl: string, onError
}
scene.environmentTexture = hdrTexture;
} else {
if ((parsedData.environmentTexture as string).endsWith(".env")) {
if (typeof parsedData.environmentTexture === "object") {
const environmentTexture = CubeTexture.Parse(parsedData.environmentTexture, scene, rootUrl);
scene.environmentTexture = environmentTexture;
} else if ((parsedData.environmentTexture as string).endsWith(".env")) {
const compressedTexture = new CubeTexture(
(parsedData.environmentTexture.match(/https?:\/\//g) ? "" : rootUrl) + parsedData.environmentTexture,
scene,
Expand Down
3 changes: 2 additions & 1 deletion packages/dev/core/src/Materials/Textures/cubeTexture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,9 @@ export class CubeTexture extends BaseTexture {

private _noMipmap: boolean;

/** @hidden */
@serialize("files")
private _files: Nullable<string[]> = null;
public _files: Nullable<string[]> = null;

@serialize("forcedExtension")
protected _forcedExtension: Nullable<string> = null;
Expand Down
8 changes: 6 additions & 2 deletions packages/dev/core/src/Misc/sceneSerializer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,12 @@ export class SceneSerializer {

// Environment texture
if (scene.environmentTexture) {
serializationObject.environmentTexture = scene.environmentTexture.name;
serializationObject.environmentTextureRotationY = (scene.environmentTexture as CubeTexture).rotationY;
if ((scene.environmentTexture as CubeTexture)._files) {
serializationObject.environmentTexture = scene.environmentTexture.serialize();
} else {
serializationObject.environmentTexture = scene.environmentTexture.name;
serializationObject.environmentTextureRotationY = (scene.environmentTexture as CubeTexture).rotationY;
}
}

// Environment Intensity
Expand Down
4 changes: 1 addition & 3 deletions packages/dev/core/src/scene.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2080,9 +2080,7 @@ export class Scene extends AbstractScene implements IAnimatable, IClipPlanesHold
return;
}

this._executeWhenReadyTimeoutId = setTimeout(() => {
this._checkIsReady(checkRenderTargets);
}, 150);
this._checkIsReady(checkRenderTargets);
}

/**
Expand Down

0 comments on commit 5e609c2

Please sign in to comment.