IrrXml: replaced irrXml by pugixml.
This commit is contained in:
+43
-38
@@ -58,8 +58,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// Header files, stdlib.
|
||||
#include <memory>
|
||||
|
||||
namespace Assimp
|
||||
{
|
||||
namespace Assimp {
|
||||
|
||||
/// \var aiImporterDesc AMFImporter::Description
|
||||
/// Conastant which hold importer description
|
||||
@@ -76,24 +75,26 @@ const aiImporterDesc AMFImporter::Description = {
|
||||
"amf"
|
||||
};
|
||||
|
||||
void AMFImporter::Clear()
|
||||
{
|
||||
void AMFImporter::Clear() {
|
||||
mNodeElement_Cur = nullptr;
|
||||
mUnit.clear();
|
||||
mMaterial_Converted.clear();
|
||||
mTexture_Converted.clear();
|
||||
// Delete all elements
|
||||
if(!mNodeElement_List.empty())
|
||||
{
|
||||
for(CAMFImporter_NodeElement* ne: mNodeElement_List) { delete ne; }
|
||||
if(!mNodeElement_List.empty()) {
|
||||
for(CAMFImporter_NodeElement* ne: mNodeElement_List) {
|
||||
delete ne;
|
||||
}
|
||||
|
||||
mNodeElement_List.clear();
|
||||
}
|
||||
}
|
||||
|
||||
AMFImporter::~AMFImporter()
|
||||
{
|
||||
if(mReader != nullptr) delete mReader;
|
||||
AMFImporter::~AMFImporter() {
|
||||
if (mReader != nullptr) {
|
||||
delete mReader;
|
||||
}
|
||||
|
||||
// Clear() is accounting if data already is deleted. So, just check again if all data is deleted.
|
||||
Clear();
|
||||
}
|
||||
@@ -117,15 +118,14 @@ bool AMFImporter::Find_NodeElement(const std::string& pID, const CAMFImporter_No
|
||||
return false;
|
||||
}
|
||||
|
||||
bool AMFImporter::Find_ConvertedNode(const std::string& pID, std::list<aiNode*>& pNodeList, aiNode** pNode) const
|
||||
{
|
||||
aiString node_name(pID.c_str());
|
||||
bool AMFImporter::Find_ConvertedNode(const std::string& id, std::list<aiNode*>& nodeList, aiNode** pNode) const {
|
||||
aiString node_name(id.c_str());
|
||||
|
||||
for(aiNode* node: pNodeList)
|
||||
{
|
||||
if(node->mName == node_name)
|
||||
{
|
||||
if(pNode != nullptr) *pNode = node;
|
||||
for(aiNode* node: nodeList) {
|
||||
if(node->mName == node_name) {
|
||||
if (pNode != nullptr) {
|
||||
*pNode = node;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -134,13 +134,12 @@ aiString node_name(pID.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
bool AMFImporter::Find_ConvertedMaterial(const std::string& pID, const SPP_Material** pConvertedMaterial) const
|
||||
{
|
||||
for(const SPP_Material& mat: mMaterial_Converted)
|
||||
{
|
||||
if(mat.ID == pID)
|
||||
{
|
||||
if(pConvertedMaterial != nullptr) *pConvertedMaterial = &mat;
|
||||
bool AMFImporter::Find_ConvertedMaterial(const std::string& id, const SPP_Material** pConvertedMaterial) const {
|
||||
for(const SPP_Material& mat: mMaterial_Converted) {
|
||||
if(mat.ID == id) {
|
||||
if (pConvertedMaterial != nullptr) {
|
||||
*pConvertedMaterial = &mat;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -153,13 +152,11 @@ bool AMFImporter::Find_ConvertedMaterial(const std::string& pID, const SPP_Mater
|
||||
/************************************************************ Functions: throw set ***********************************************************/
|
||||
/*********************************************************************************************************************************************/
|
||||
|
||||
void AMFImporter::Throw_CloseNotFound(const std::string& pNode)
|
||||
{
|
||||
void AMFImporter::Throw_CloseNotFound(const std::string& pNode) {
|
||||
throw DeadlyImportError("Close tag for node <" + pNode + "> not found. Seems file is corrupt.");
|
||||
}
|
||||
|
||||
void AMFImporter::Throw_IncorrectAttr(const std::string& pAttrName)
|
||||
{
|
||||
void AMFImporter::Throw_IncorrectAttr(const std::string& pAttrName) {
|
||||
throw DeadlyImportError("Node <" + std::string(mReader->getNodeName()) + "> has incorrect attribute \"" + pAttrName + "\".");
|
||||
}
|
||||
|
||||
@@ -234,11 +231,13 @@ casu_cres:
|
||||
}
|
||||
}
|
||||
|
||||
bool AMFImporter::XML_SearchNode(const std::string& pNodeName)
|
||||
{
|
||||
while(mReader->read())
|
||||
{
|
||||
if((mReader->getNodeType() == irr::io::EXN_ELEMENT) && XML_CheckNode_NameEqual(pNodeName)) return true;
|
||||
bool AMFImporter::XML_SearchNode(const std::string& pNodeName) {
|
||||
mReader->
|
||||
while(mReader->read()) {
|
||||
//if((mReader->getNodeType() == irr::io::EXN_ELEMENT) && XML_CheckNode_NameEqual(pNodeName)) return true;
|
||||
if ((mReader->getNodeType() == pugi::node_element) && XML_CheckNode_NameEqual(pNodeName)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -403,16 +402,22 @@ void AMFImporter::ParseHelper_Decode_Base64(const std::string& pInputBase64, std
|
||||
|
||||
void AMFImporter::ParseFile(const std::string& pFile, IOSystem* pIOHandler)
|
||||
{
|
||||
irr::io::IrrXMLReader* OldReader = mReader;// store current XMLreader.
|
||||
// irr::io::IrrXMLReader* OldReader = mReader;// store current XMLreader.
|
||||
std::unique_ptr<IOStream> file(pIOHandler->Open(pFile, "rb"));
|
||||
|
||||
// Check whether we can read from the file
|
||||
if(file.get() == NULL) throw DeadlyImportError("Failed to open AMF file " + pFile + ".");
|
||||
|
||||
mReader = new XmlParser;
|
||||
if (!mReader->parse(file.get())) {
|
||||
throw DeadlyImportError("Failed to create XML reader for file" + pFile + ".");
|
||||
}
|
||||
|
||||
// generate a XML reader for it
|
||||
std::unique_ptr<CIrrXML_IOStreamReader> mIOWrapper(new CIrrXML_IOStreamReader(file.get()));
|
||||
mReader = irr::io::createIrrXMLReader(mIOWrapper.get());
|
||||
if(!mReader) throw DeadlyImportError("Failed to create XML reader for file" + pFile + ".");
|
||||
//std::unique_ptr<CIrrXML_IOStreamReader> mIOWrapper(new CIrrXML_IOStreamReader(file.get()));
|
||||
//mReader = irr::io::createIrrXMLReader(mIOWrapper.get());
|
||||
//if(!mReader) throw DeadlyImportError("Failed to create XML reader for file" + pFile + ".");
|
||||
|
||||
//
|
||||
// start reading
|
||||
// search for root tag <amf>
|
||||
|
||||
@@ -58,7 +58,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include <assimp/importerdesc.h>
|
||||
#include "assimp/types.h"
|
||||
#include <assimp/BaseImporter.h>
|
||||
#include <assimp/irrXMLWrapper.h>
|
||||
#include <assimp/XmlParser.h>
|
||||
|
||||
// Header files, stdlib.
|
||||
#include <set>
|
||||
@@ -285,7 +285,10 @@ private:
|
||||
/// Check if current node name is equal to pNodeName.
|
||||
/// \param [in] pNodeName - name for checking.
|
||||
/// return true if current node name is equal to pNodeName, else - false.
|
||||
bool XML_CheckNode_NameEqual(const std::string& pNodeName) { return mReader->getNodeName() == pNodeName; }
|
||||
bool XML_CheckNode_NameEqual(const std::string& pNodeName){
|
||||
// return mReader->getNodeName() == pNodeName;
|
||||
mReader->mDoc.
|
||||
}
|
||||
|
||||
/// Skip unsupported node and report about that. Depend on node name can be skipped begin tag of node all whole node.
|
||||
/// \param [in] pParentNodeName - parent node name. Used for reporting.
|
||||
@@ -420,7 +423,8 @@ private:
|
||||
|
||||
CAMFImporter_NodeElement* mNodeElement_Cur;///< Current element.
|
||||
std::list<CAMFImporter_NodeElement*> mNodeElement_List;///< All elements of scene graph.
|
||||
irr::io::IrrXMLReader* mReader;///< Pointer to XML-reader object
|
||||
XmlParser *mReader;
|
||||
//irr::io::IrrXMLReader* mReader;///< Pointer to XML-reader object
|
||||
std::string mUnit;
|
||||
std::list<SPP_Material> mMaterial_Converted;///< List of converted materials for postprocessing step.
|
||||
std::list<SPP_Texture> mTexture_Converted;///< List of converted textures for postprocessing step.
|
||||
|
||||
@@ -61,7 +61,7 @@ namespace Assimp
|
||||
// Parent element - <object>.
|
||||
void AMFImporter::ParseNode_Mesh()
|
||||
{
|
||||
CAMFImporter_NodeElement* ne;
|
||||
CAMFImporter_NodeElement* ne;
|
||||
|
||||
// create new mesh object.
|
||||
ne = new CAMFImporter_NodeElement_Mesh(mNodeElement_Cur);
|
||||
|
||||
+4
-4
@@ -135,7 +135,7 @@ SET( PUBLIC_HEADERS
|
||||
${HEADER_PATH}/XMLTools.h
|
||||
${HEADER_PATH}/IOStreamBuffer.h
|
||||
${HEADER_PATH}/CreateAnimMesh.h
|
||||
${HEADER_PATH}/irrXMLWrapper.h
|
||||
${HEADER_PATH}/XmlParser.h
|
||||
${HEADER_PATH}/BlobIOSystem.h
|
||||
${HEADER_PATH}/MathFunctions.h
|
||||
${HEADER_PATH}/Exceptional.h
|
||||
@@ -703,8 +703,8 @@ SET( PostProcessing_SRCS
|
||||
)
|
||||
SOURCE_GROUP( PostProcessing FILES ${PostProcessing_SRCS})
|
||||
|
||||
SET( IrrXML_SRCS ${HEADER_PATH}/irrXMLWrapper.h )
|
||||
SOURCE_GROUP( IrrXML FILES ${IrrXML_SRCS})
|
||||
#SET( IrrXML_SRCS ${HEADER_PATH}/irrXMLWrapper.h )
|
||||
#SOURCE_GROUP( IrrXML FILES ${IrrXML_SRCS})
|
||||
|
||||
ADD_ASSIMP_IMPORTER( Q3D
|
||||
Q3D/Q3DLoader.cpp
|
||||
@@ -1105,7 +1105,7 @@ SET( assimp_src
|
||||
${ASSIMP_EXPORTER_SRCS}
|
||||
|
||||
# Third-party libraries
|
||||
${IrrXML_SRCS}
|
||||
#${IrrXML_SRCS}
|
||||
${unzip_compile_SRCS}
|
||||
${Poly2Tri_SRCS}
|
||||
${Clipper_SRCS}
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
#ifndef AI_COLLADAPARSER_H_INC
|
||||
#define AI_COLLADAPARSER_H_INC
|
||||
|
||||
#include <assimp/irrXMLWrapper.h>
|
||||
#include <assimp/XmlParser.h>
|
||||
#include "ColladaHelper.h"
|
||||
#include <assimp/ai_assert.h>
|
||||
#include <assimp/TinyFormatter.h>
|
||||
|
||||
+1050
-1157
File diff suppressed because it is too large
Load Diff
@@ -7,7 +7,7 @@
|
||||
#ifndef INCLUDED_AI_IRRSHARED_H
|
||||
#define INCLUDED_AI_IRRSHARED_H
|
||||
|
||||
#include <assimp/irrXMLWrapper.h>
|
||||
#include <assimp/XmlParser.h>
|
||||
#include <assimp/BaseImporter.h>
|
||||
#include <stdint.h>
|
||||
|
||||
@@ -78,9 +78,8 @@ protected:
|
||||
typedef Property<aiVector3D> VectorProperty;
|
||||
typedef Property<int> IntProperty;
|
||||
|
||||
/** XML reader instance
|
||||
*/
|
||||
irr::io::IrrXMLReader* reader;
|
||||
/// XML reader instance
|
||||
XmlParser mParser;
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
/** Parse a material description from the XML
|
||||
|
||||
@@ -46,7 +46,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#ifndef ASSIMP_BUILD_NO_OGRE_IMPORTER
|
||||
|
||||
#include "OgreStructs.h"
|
||||
#include <assimp/irrXMLWrapper.h>
|
||||
#include <assimp/XmlParser.h>
|
||||
|
||||
namespace Assimp
|
||||
{
|
||||
|
||||
@@ -60,7 +60,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#ifdef ASSIMP_USE_HUNTER
|
||||
# include <irrXML/irrXML.h>
|
||||
#else
|
||||
# include <irrXML.h>
|
||||
# include <assimp/XmlParser.h>
|
||||
#endif
|
||||
|
||||
namespace Assimp {
|
||||
|
||||
@@ -56,7 +56,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include <assimp/ProgressHandler.hpp>
|
||||
#include <assimp/types.h>
|
||||
#include <assimp/BaseImporter.h>
|
||||
#include <assimp/irrXMLWrapper.h>
|
||||
#include <assimp/XmlParser.h>
|
||||
#include "FIReader.hpp"
|
||||
//#include <regex>
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#define AI_XGLLOADER_H_INCLUDED
|
||||
|
||||
#include <assimp/BaseImporter.h>
|
||||
#include <assimp/irrXMLWrapper.h>
|
||||
#include <assimp/XmlParser.h>
|
||||
#include <assimp/LogAux.h>
|
||||
#include <assimp/material.h>
|
||||
#include <assimp/Importer.hpp>
|
||||
|
||||
Reference in New Issue
Block a user