Browse Source

avoid all zero

Yingying Wang 5 years ago
parent
commit
8fed101432
1 changed files with 7 additions and 0 deletions
  1. 7 0
      code/AssetLib/glTF2/glTF2Exporter.cpp

+ 7 - 0
code/AssetLib/glTF2/glTF2Exporter.cpp

@@ -251,6 +251,13 @@ size_t NZDiff(void *data, void *dataBase, size_t count, unsigned int numCompsIn,
         vNZIdx.push_back(idx);
     }
 
+    //avoid all-0, put 1 item
+    if (vNZDiff.size() == 0) {
+        for (unsigned int j = 0; j < numCompsOut; j++)
+            vNZDiff.push_back(0);
+        vNZIdx.push_back(0);
+    }
+
     //process data
     outputNZDiff = new T[vNZDiff.size()];
     memcpy(outputNZDiff, vNZDiff.data(), vNZDiff.size() * sizeof(T));