Browse Source

Fixed typo in comment. Added profiling blocks for finding the scene resources to preload.

Lasse Öörni 11 years ago
parent
commit
cbe440db52
2 changed files with 12 additions and 2 deletions
  1. 11 1
      Source/Engine/Scene/Scene.cpp
  2. 1 1
      Source/Engine/Scene/Scene.h

+ 11 - 1
Source/Engine/Scene/Scene.cpp

@@ -280,6 +280,8 @@ bool Scene::LoadAsync(File* file, LoadMode mode)
         // Preload resources if appropriate, then return to the original position for loading the scene content
         if (mode != LOAD_SCENE)
         {
+            PROFILE(FindResourcesToPreload);
+            
             unsigned currentPos = file->GetPosition();
             PreloadResources(file, isSceneFile);
             file->Seek(currentPos);
@@ -301,6 +303,8 @@ bool Scene::LoadAsync(File* file, LoadMode mode)
     }
     else
     {
+        PROFILE(FindResourcesToPreload);
+        
         LOGINFO("Preloading resources from " + file->GetName());
         PreloadResources(file, isSceneFile);
     }
@@ -341,8 +345,12 @@ bool Scene::LoadAsyncXML(File* file, LoadMode mode)
         
         // Preload resources if appropriate
         if (mode != LOAD_SCENE)
+        {
+            PROFILE(FindResourcesToPreload);
+            
             PreloadResourcesXML(rootElement);
-
+        }
+        
         // Store own old ID for resolving possible root node references
         unsigned nodeID = rootElement.GetInt("id");
         resolver_.AddNode(nodeID, this);
@@ -364,6 +372,8 @@ bool Scene::LoadAsyncXML(File* file, LoadMode mode)
     }
     else
     {
+        PROFILE(FindResourcesToPreload);
+        
         LOGINFO("Preloading resources from " + file->GetName());
         PreloadResourcesXML(xml->GetRoot());
     }

+ 1 - 1
Source/Engine/Scene/Scene.h

@@ -46,7 +46,7 @@ enum LoadMode
     LOAD_RESOURCES_ONLY = 0,
     /// Load scene content without preloading. Resources will be requested synchronously when encountered.
     LOAD_SCENE,
-    /// Default mode: reload resources used by the scene on the background first, then load the scene content.
+    /// Default mode: preload resources used by the scene first, then load the scene content.
     LOAD_SCENE_AND_RESOURCES
 };