fix collada unittests.
parent
14d6141f69
commit
8c88526da8
|
@ -404,6 +404,10 @@ void ColladaParser::PostProcessControllers() {
|
|||
std::string meshId;
|
||||
for (ControllerLibrary::iterator it = mControllerLibrary.begin(); it != mControllerLibrary.end(); ++it) {
|
||||
meshId = it->second.mMeshId;
|
||||
if (meshId.empty()) {
|
||||
break;
|
||||
}
|
||||
|
||||
ControllerLibrary::iterator findItr = mControllerLibrary.find(meshId);
|
||||
while (findItr != mControllerLibrary.end()) {
|
||||
meshId = findItr->second.mMeshId;
|
||||
|
@ -1404,6 +1408,7 @@ void ColladaParser::ReadDataArray(XmlNode &node) {
|
|||
XmlParser::getUIntAttribute(node, "count", count);
|
||||
std::string v;
|
||||
XmlParser::getValueAsString(node, v);
|
||||
trim(v);
|
||||
const char *content = v.c_str();
|
||||
|
||||
// read values and store inside an array in the data library
|
||||
|
@ -1437,6 +1442,7 @@ void ColladaParser::ReadDataArray(XmlNode &node) {
|
|||
|
||||
ai_real value;
|
||||
// read a number
|
||||
//SkipSpacesAndLineEnd(&content);
|
||||
content = fast_atoreal_move<ai_real>(content, value);
|
||||
data.mValues.push_back(value);
|
||||
// skip whitespace after it
|
||||
|
|
|
@ -52,6 +52,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <sstream>
|
||||
#include <stdarg.h>
|
||||
#include <cstdlib>
|
||||
#include <algorithm>
|
||||
#include <cctype>
|
||||
#include <locale>
|
||||
|
||||
/// @fn ai_snprintf
|
||||
/// @brief The portable version of the function snprintf ( C99 standard ), which works on visual studio compilers 2013 and earlier.
|
||||
|
@ -162,4 +165,22 @@ AI_FORCE_INLINE std::string Rgba2Hex(int r, int g, int b, int a, bool with_head)
|
|||
return ss.str();
|
||||
}
|
||||
|
||||
inline void ltrim(std::string &s) {
|
||||
s.erase(s.begin(), std::find_if(s.begin(), s.end(), [](unsigned char ch) {
|
||||
return !std::isspace(ch);
|
||||
}));
|
||||
}
|
||||
|
||||
// trim from end (in place)
|
||||
inline void rtrim(std::string &s) {
|
||||
s.erase(std::find_if(s.rbegin(), s.rend(), [](unsigned char ch) {
|
||||
return !std::isspace(ch);
|
||||
}).base(), s.end());
|
||||
}
|
||||
|
||||
// trim from both ends (in place)
|
||||
inline void trim(std::string &s) {
|
||||
ltrim(s);
|
||||
rtrim(s);
|
||||
}
|
||||
#endif // INCLUDED_AI_STRINGUTILS_H
|
||||
|
|
|
@ -47,6 +47,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <assimp/Exporter.hpp>
|
||||
#include <assimp/Importer.hpp>
|
||||
|
||||
#include <array>
|
||||
|
||||
#ifndef ASSIMP_BUILD_NO_EXPORT
|
||||
|
||||
class utColladaExport : public ::testing::Test {
|
||||
|
@ -77,6 +79,7 @@ TEST_F(utColladaExport, testExportCamera) {
|
|||
|
||||
EXPECT_EQ(AI_SUCCESS, ex->Export(pTest, "collada", file));
|
||||
const unsigned int origNumCams(pTest->mNumCameras);
|
||||
//std::vector<float> origFOV;
|
||||
std::unique_ptr<float[]> origFOV(new float[origNumCams]);
|
||||
std::unique_ptr<float[]> orifClipPlaneNear(new float[origNumCams]);
|
||||
std::unique_ptr<float[]> orifClipPlaneFar(new float[origNumCams]);
|
||||
|
|
Loading…
Reference in New Issue