Gary Hsu пре 4 година
родитељ
комит
58189c60b0
2 измењених фајлова са 3 додато и 5 уклоњено
  1. 2 4
      sandbox/src/components/renderingZone.tsx
  2. 1 1
      src/Loading/sceneLoader.ts

+ 2 - 4
sandbox/src/components/renderingZone.tsx

@@ -142,13 +142,11 @@ export class RenderingZone extends React.Component<IRenderingZoneProps> {
     }
 
     prepareCamera() {
-        let camera: ArcRotateCamera;
-
         // Attach camera to canvas inputs
-        if (!this._scene.activeCamera || this._scene.lights.length === 0) {
+        if (!this._scene.activeCamera) {
             this._scene.createDefaultCamera(true);
 
-            camera = this._scene.activeCamera! as ArcRotateCamera;
+            const camera = this._scene.activeCamera! as ArcRotateCamera;
 
             if (this._currentPluginName === "gltf") {
                 // glTF assets use a +Z forward convention while the default camera faces +Z. Rotate the camera to look at the front of the asset.

+ 1 - 1
src/Loading/sceneLoader.ts

@@ -1056,7 +1056,7 @@ export class SceneLoader {
      * @param pluginExtension the extension used to determine the plugin
      * @returns The loaded asset container
      */
-    public static LoadAssetContainerAsync(rootUrl: string, sceneFilename: string = "", scene: Nullable<Scene> = EngineStore.LastCreatedScene, onProgress: Nullable<(event: ISceneLoaderProgressEvent) => void> = null, pluginExtension: Nullable<string> = null): Promise<AssetContainer> {
+    public static LoadAssetContainerAsync(rootUrl: string, sceneFilename: string | File = "", scene: Nullable<Scene> = EngineStore.LastCreatedScene, onProgress: Nullable<(event: ISceneLoaderProgressEvent) => void> = null, pluginExtension: Nullable<string> = null): Promise<AssetContainer> {
         return new Promise((resolve, reject) => {
             SceneLoader.LoadAssetContainer(rootUrl, sceneFilename, scene, (assetContainer) => {
                 resolve(assetContainer);