From 8fed101432ae4f24b69db105971089791a98fee7 Mon Sep 17 00:00:00 2001 From: Yingying Wang Date: Mon, 8 Jun 2020 16:18:11 -0700 Subject: [PATCH] avoid all zero --- code/AssetLib/glTF2/glTF2Exporter.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/code/AssetLib/glTF2/glTF2Exporter.cpp b/code/AssetLib/glTF2/glTF2Exporter.cpp index eb642ca08..31cd1f1c6 100644 --- a/code/AssetLib/glTF2/glTF2Exporter.cpp +++ b/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));