Browse Source

Use correct XmlParser-methods and add some missing casts

Kim Kulling 4 years ago
parent
commit
cb657e4c13

+ 1 - 1
code/AssetLib/X3D/X3DImporter_Geometry3D.cpp

@@ -879,7 +879,7 @@ void X3DImporter::readSphere(XmlNode &node) {
     X3DNodeElementBase *ne(nullptr);
 
     MACRO_ATTRREAD_CHECKUSEDEF_RET(node, def, use);
-    XmlParser::getFloatAttribute(node, "radius", radius);
+    XmlParser::getRealAttribute(node, "radius", radius);
     XmlParser::getBoolAttribute(node, "solid", solid);
 
     // if "USE" defined then find already defined element.

+ 1 - 1
code/AssetLib/glTF2/glTF2Exporter.cpp

@@ -1410,7 +1410,7 @@ void glTF2Exporter::ExportMetadata() {
     }
 }
 
-inline Ref<Accessor> GetSamplerInputRef(Asset &asset, std::string &animId, Ref<Buffer> &buffer, std::vector<float> &times) {
+inline Ref<Accessor> GetSamplerInputRef(Asset &asset, std::string &animId, Ref<Buffer> &buffer, std::vector<ai_real> &times) {
     return ExportData(asset, animId, buffer, (unsigned int)times.size(), &times[0], AttribType::SCALAR, AttribType::SCALAR, ComponentType_FLOAT);
 }
 

+ 3 - 0
code/AssetLib/glTF2/glTF2Exporter.h

@@ -66,7 +66,9 @@ class Ref;
 }
 
 namespace glTF2 {
+
 class Asset;
+
 struct TexProperty;
 struct TextureInfo;
 struct NormalTextureInfo;
@@ -84,6 +86,7 @@ struct MaterialIOR;
 typedef float(vec2)[2];
 typedef float(vec3)[3];
 typedef float(vec4)[4];
+
 } // namespace glTF2
 
 namespace Assimp {

+ 1 - 1
include/assimp/material.inl

@@ -105,7 +105,7 @@ aiReturn aiMaterial::Get(const char* pKey,unsigned int type,
             return AI_FAILURE;
         }
 
-        iNum = std::min((size_t)iNum,prop->mDataLength / sizeof(Type));
+        iNum = (unsigned int)std::min((size_t)iNum,prop->mDataLength / sizeof(Type));
         ::memcpy(pOut,prop->mData,iNum * sizeof(Type));
         if (pMax) {
             *pMax = iNum;

+ 1 - 1
test/unit/utMaterialSystem.cpp

@@ -73,7 +73,7 @@ TEST_F(MaterialSystemTest, testFloatArrayProperty) {
     pf[0] = pf[1] = pf[2] = pf[3] = 12.0f;
 
     EXPECT_EQ(AI_SUCCESS, pcMat->Get("testKey2", 0, 0, pf, &pMax));
-    EXPECT_EQ(sizeof(pf) / sizeof(float), pMax);
+    EXPECT_EQ(sizeof(pf) / sizeof(float), static_cast<size_t>(pMax));
     EXPECT_TRUE(!pf[0] && 1.0f == pf[1] && 2.0f == pf[2] && 3.0f == pf[3]);
 }