瀏覽代碼

Merge pull request #1557 from Azaezel/alpha41/firmerFilter

reinforce dsq or dts filter
Brian Roberts 4 周之前
父節點
當前提交
e3e5fc3d0f
共有 2 個文件被更改,包括 24 次插入20 次删除
  1. 10 8
      Engine/source/ts/assimp/assimpShapeLoader.cpp
  2. 14 12
      Engine/source/ts/collada/colladaShapeLoader.cpp

+ 10 - 8
Engine/source/ts/assimp/assimpShapeLoader.cpp

@@ -985,14 +985,6 @@ TSShape* assimpLoadShape(const Torque::Path &path)
       TSShapeLoader::updateProgress(TSShapeLoader::Load_Complete, "Import complete");
       TSShapeLoader::updateProgress(TSShapeLoader::Load_Complete, "Import complete");
       Con::printf("[ASSIMP] Shape created successfully.");
       Con::printf("[ASSIMP] Shape created successfully.");
 
 
-      // Cache the model to a DTS file for faster loading next time.
-      FileStream dtsStream;
-      if (dtsStream.open(cachedPath.getFullPath(), Torque::FS::File::Write))
-      {
-         Con::printf("Writing cached shape to %s", cachedPath.getFullPath().c_str());
-         tss->write(&dtsStream);
-      }
-
       if (tss->meshes.empty())
       if (tss->meshes.empty())
       {
       {
          Torque::Path dsqPath(cachedPath);
          Torque::Path dsqPath(cachedPath);
@@ -1012,6 +1004,16 @@ TSShape* assimpLoadShape(const Torque::Path &path)
 
 
          }
          }
       }
       }
+      else
+      {
+         // Cache the model to a DTS file for faster loading next time.
+         FileStream dtsStream;
+         if (dtsStream.open(cachedPath.getFullPath(), Torque::FS::File::Write))
+         {
+            Con::printf("Writing cached shape to %s", cachedPath.getFullPath().c_str());
+            tss->write(&dtsStream);
+         }
+      }
 
 
       loader.updateMaterialsScript(path);
       loader.updateMaterialsScript(path);
    }
    }

+ 14 - 12
Engine/source/ts/collada/colladaShapeLoader.cpp

@@ -724,18 +724,6 @@ TSShape* loadColladaShape(const Torque::Path &path)
       if (tss)
       if (tss)
       {
       {
 #ifndef DAE2DTS_TOOL
 #ifndef DAE2DTS_TOOL
-         // Cache the Collada model to a DTS file for faster loading next time.
-         FileStream dtsStream;
-         
-         if (dtsStream.open(cachedPath.getFullPath(), Torque::FS::File::Write))
-         {
-            Torque::FS::FileSystemRef ref = Torque::FS::GetFileSystem(daePath);
-            if (ref && !String::compare("Zip", ref->getTypeStr().c_str()))
-               Con::errorf("No cached dts file found in archive for %s. Forcing cache to disk.", daePath.getFullFileName().c_str());
-
-            Con::printf("Writing cached COLLADA shape to %s", cachedPath.getFullPath().c_str());
-            tss->write(&dtsStream);
-         }
 
 
          if (tss->meshes.empty())
          if (tss->meshes.empty())
          {
          {
@@ -756,6 +744,20 @@ TSShape* loadColladaShape(const Torque::Path &path)
 
 
             }
             }
          }
          }
+         else
+         {
+            // Cache the Collada model to a DTS file for faster loading next time.
+            FileStream dtsStream;
+            if (dtsStream.open(cachedPath.getFullPath(), Torque::FS::File::Write))
+            {
+               Torque::FS::FileSystemRef ref = Torque::FS::GetFileSystem(daePath);
+               if (ref && !String::compare("Zip", ref->getTypeStr().c_str()))
+                  Con::errorf("No cached dts file found in archive for %s. Forcing cache to disk.", daePath.getFullFileName().c_str());
+
+               Con::printf("Writing cached COLLADA shape to %s", cachedPath.getFullPath().c_str());
+               tss->write(&dtsStream);
+            }
+         }
 #endif // DAE2DTS_TOOL
 #endif // DAE2DTS_TOOL
 
 
          // Add collada materials to materials.tscript
          // Add collada materials to materials.tscript