Collada: correct parsing of float data in xml nodes.
parent
075540e15a
commit
be5089ae40
|
@ -990,20 +990,23 @@ void ColladaParser::ReadCamera(XmlNode &node, Collada::Camera &camera) {
|
||||||
xmlIt.collectChildrenPreOrder(node);
|
xmlIt.collectChildrenPreOrder(node);
|
||||||
XmlNode currentNode;
|
XmlNode currentNode;
|
||||||
|
|
||||||
|
std::string out;
|
||||||
while (xmlIt.getNext(currentNode)) {
|
while (xmlIt.getNext(currentNode)) {
|
||||||
const std::string ¤tName = currentNode.name();
|
const std::string ¤tName = currentNode.name();
|
||||||
if (currentName == "orthographic") {
|
if (currentName == "orthographic") {
|
||||||
camera.mOrtho = true;
|
camera.mOrtho = true;
|
||||||
} else if (currentName == "xfov" || currentName == "xmag") {
|
} else if (currentName == "xfov" || currentName == "xmag") {
|
||||||
XmlParser::getFloatAttribute(currentNode, currentName.c_str(), (ai_real &)camera.mHorFov);
|
XmlParser::getValueAsFloat(currentNode, camera.mHorFov);
|
||||||
} else if (currentName == "yfov" || currentName == "ymag") {
|
} else if (currentName == "yfov" || currentName == "ymag") {
|
||||||
XmlParser::getFloatAttribute(currentNode, currentName.c_str(), (ai_real &)camera.mVerFov);
|
XmlParser::getValueAsFloat(currentNode, camera.mVerFov);
|
||||||
|
camera.mVerFov = (ai_real)std::atof(out.c_str());
|
||||||
} else if (currentName == "aspect_ratio") {
|
} else if (currentName == "aspect_ratio") {
|
||||||
XmlParser::getFloatAttribute(currentNode, currentName.c_str(), (ai_real &)camera.mAspect);
|
XmlParser::getValueAsFloat(currentNode, camera.mAspect);
|
||||||
|
camera.mAspect = (ai_real)std::atof(out.c_str());
|
||||||
} else if (currentName == "znear") {
|
} else if (currentName == "znear") {
|
||||||
XmlParser::getFloatAttribute(currentNode, currentName.c_str(), (ai_real &)camera.mZNear);
|
XmlParser::getValueAsFloat(currentNode, camera.mZNear);
|
||||||
} else if (currentName == "zfar") {
|
} else if (currentName == "zfar") {
|
||||||
XmlParser::getFloatAttribute(currentNode, currentName.c_str(), (ai_real &)camera.mZFar);
|
XmlParser::getValueAsFloat(currentNode, camera.mZFar);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -217,6 +217,17 @@ public:
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline bool getValueAsFloat( XmlNode &node, ai_real &v ) {
|
||||||
|
if (node.empty()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
v = node.text().as_float();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
pugi::xml_document *mDoc;
|
pugi::xml_document *mDoc;
|
||||||
TNodeType mCurrent;
|
TNodeType mCurrent;
|
||||||
|
|
|
@ -49,7 +49,7 @@ using namespace Assimp;
|
||||||
|
|
||||||
class utAMFImportExport : public AbstractImportExportBase {
|
class utAMFImportExport : public AbstractImportExportBase {
|
||||||
public:
|
public:
|
||||||
virtual bool importerTest() {
|
bool importerTest() override {
|
||||||
Assimp::Importer importer;
|
Assimp::Importer importer;
|
||||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/AMF/test1.amf", aiProcess_ValidateDataStructure);
|
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/AMF/test1.amf", aiProcess_ValidateDataStructure);
|
||||||
return nullptr != scene;
|
return nullptr != scene;
|
||||||
|
|
Loading…
Reference in New Issue