fix next unittests.
parent
31f3812241
commit
c1f50e116a
|
@ -53,12 +53,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <assimp/commonMetaData.h>
|
||||
#include <assimp/fast_atof.h>
|
||||
#include <assimp/light.h>
|
||||
#include <stdarg.h>
|
||||
#include <assimp/DefaultLogger.hpp>
|
||||
#include <assimp/IOSystem.hpp>
|
||||
#include <sstream>
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <memory>
|
||||
#include <sstream>
|
||||
|
||||
using namespace Assimp;
|
||||
using namespace Assimp::Collada;
|
||||
|
@ -306,9 +306,9 @@ void ColladaParser::ReadAssetInfo(XmlNode &node) {
|
|||
} else if (name == "up_axis") {
|
||||
std::string v;
|
||||
XmlParser::getValueAsString(currentNode, v);
|
||||
if (v == "X_UP" ) {
|
||||
if (v == "X_UP") {
|
||||
mUpDirection = UP_X;
|
||||
} else if (v == "Z_UP" ) {
|
||||
} else if (v == "Z_UP") {
|
||||
mUpDirection = UP_Z;
|
||||
} else {
|
||||
mUpDirection = UP_Y;
|
||||
|
@ -567,13 +567,13 @@ void ColladaParser::ReadAnimationSampler(XmlNode &node, Collada::AnimationChanne
|
|||
|
||||
if (semantic == "INPUT")
|
||||
pChannel.mSourceTimes = source;
|
||||
else if (semantic == "OUTPUT" )
|
||||
else if (semantic == "OUTPUT")
|
||||
pChannel.mSourceValues = source;
|
||||
else if (semantic == "IN_TANGENT" )
|
||||
else if (semantic == "IN_TANGENT")
|
||||
pChannel.mInTanValues = source;
|
||||
else if ( semantic == "OUT_TANGENT" )
|
||||
else if (semantic == "OUT_TANGENT")
|
||||
pChannel.mOutTanValues = source;
|
||||
else if ( semantic == "INTERPOLATION" )
|
||||
else if (semantic == "INTERPOLATION")
|
||||
pChannel.mInterpolationValues = source;
|
||||
}
|
||||
}
|
||||
|
@ -588,14 +588,16 @@ void ColladaParser::ReadControllerLibrary(XmlNode &node) {
|
|||
return;
|
||||
}
|
||||
|
||||
const std::string name = node.name();
|
||||
if (name != "controller") {
|
||||
return;
|
||||
}
|
||||
|
||||
for (XmlNode ¤tNode : node.children()) {
|
||||
const std::string ¤tName = currentNode.name();
|
||||
if (currentName != "controller") {
|
||||
continue;;
|
||||
}
|
||||
std::string id = node.attribute("id").as_string();
|
||||
mControllerLibrary[id] = Controller();
|
||||
ReadController(node, mControllerLibrary[id]);
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
|
@ -614,7 +616,7 @@ void ColladaParser::ReadController(XmlNode &node, Collada::Controller &pControll
|
|||
std::string method;
|
||||
XmlParser::getValueAsString(currentNode, method);
|
||||
|
||||
if (method == "RELATIVE" ) {
|
||||
if (method == "RELATIVE") {
|
||||
pController.mMethod = Relative;
|
||||
}
|
||||
}
|
||||
|
@ -992,7 +994,6 @@ void ColladaParser::ReadCamera(XmlNode &node, Collada::Camera &camera) {
|
|||
xmlIt.collectChildrenPreOrder(node);
|
||||
XmlNode currentNode;
|
||||
|
||||
std::string out;
|
||||
while (xmlIt.getNext(currentNode)) {
|
||||
const std::string ¤tName = currentNode.name();
|
||||
if (currentName == "orthographic") {
|
||||
|
@ -1001,10 +1002,8 @@ void ColladaParser::ReadCamera(XmlNode &node, Collada::Camera &camera) {
|
|||
XmlParser::getValueAsFloat(currentNode, camera.mHorFov);
|
||||
} else if (currentName == "yfov" || currentName == "ymag") {
|
||||
XmlParser::getValueAsFloat(currentNode, camera.mVerFov);
|
||||
camera.mVerFov = (ai_real)std::atof(out.c_str());
|
||||
} else if (currentName == "aspect_ratio") {
|
||||
XmlParser::getValueAsFloat(currentNode, camera.mAspect);
|
||||
camera.mAspect = (ai_real)std::atof(out.c_str());
|
||||
} else if (currentName == "znear") {
|
||||
XmlParser::getValueAsFloat(currentNode, camera.mZNear);
|
||||
} else if (currentName == "zfar") {
|
||||
|
@ -1281,7 +1280,6 @@ void ColladaParser::ReadEffectParam(XmlNode &node, Collada::EffectParam &pParam)
|
|||
xmlIt.collectChildrenPreOrder(node);
|
||||
XmlNode currentNode;
|
||||
|
||||
|
||||
while (xmlIt.getNext(currentNode)) {
|
||||
const std::string ¤tName = currentNode.name();
|
||||
if (currentName == "surface") {
|
||||
|
|
|
@ -44,8 +44,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "OgreImporter.h"
|
||||
#include "OgreBinarySerializer.h"
|
||||
#include "OgreXmlSerializer.h"
|
||||
#include <assimp/Importer.hpp>
|
||||
#include <assimp/importerdesc.h>
|
||||
#include <assimp/Importer.hpp>
|
||||
#include <memory>
|
||||
|
||||
static const aiImporterDesc desc = {
|
||||
|
@ -61,42 +61,33 @@ static const aiImporterDesc desc = {
|
|||
"mesh mesh.xml"
|
||||
};
|
||||
|
||||
namespace Assimp
|
||||
{
|
||||
namespace Ogre
|
||||
{
|
||||
namespace Assimp {
|
||||
namespace Ogre {
|
||||
|
||||
const aiImporterDesc* OgreImporter::GetInfo() const
|
||||
{
|
||||
const aiImporterDesc *OgreImporter::GetInfo() const {
|
||||
return &desc;
|
||||
}
|
||||
|
||||
void OgreImporter::SetupProperties(const Importer* pImp)
|
||||
{
|
||||
void OgreImporter::SetupProperties(const Importer *pImp) {
|
||||
m_userDefinedMaterialLibFile = pImp->GetPropertyString(AI_CONFIG_IMPORT_OGRE_MATERIAL_FILE, "Scene.material");
|
||||
m_detectTextureTypeFromFilename = pImp->GetPropertyBool(AI_CONFIG_IMPORT_OGRE_TEXTURETYPE_FROM_FILENAME, false);
|
||||
}
|
||||
|
||||
bool OgreImporter::CanRead(const std::string &pFile, Assimp::IOSystem *pIOHandler, bool checkSig) const
|
||||
{
|
||||
bool OgreImporter::CanRead(const std::string &pFile, Assimp::IOSystem *pIOHandler, bool checkSig) const {
|
||||
if (!checkSig) {
|
||||
return EndsWith(pFile, ".mesh.xml", false) || EndsWith(pFile, ".mesh", false);
|
||||
}
|
||||
|
||||
if (EndsWith(pFile, ".mesh.xml", false))
|
||||
{
|
||||
const char* tokens[] = { "<mesh>" };
|
||||
if (EndsWith(pFile, ".mesh.xml", false)) {
|
||||
const char *tokens[] = { "<mesh>" };
|
||||
return SearchFileHeaderForToken(pIOHandler, pFile, tokens, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
/// @todo Read and validate first header chunk?
|
||||
return EndsWith(pFile, ".mesh", false);
|
||||
}
|
||||
}
|
||||
|
||||
void OgreImporter::InternReadFile(const std::string &pFile, aiScene *pScene, Assimp::IOSystem *pIOHandler)
|
||||
{
|
||||
void OgreImporter::InternReadFile(const std::string &pFile, aiScene *pScene, Assimp::IOSystem *pIOHandler) {
|
||||
// Open source file
|
||||
IOStream *f = pIOHandler->Open(pFile, "rb");
|
||||
if (!f) {
|
||||
|
@ -104,8 +95,7 @@ void OgreImporter::InternReadFile(const std::string &pFile, aiScene *pScene, Ass
|
|||
}
|
||||
|
||||
// Binary .mesh import
|
||||
if (EndsWith(pFile, ".mesh", false))
|
||||
{
|
||||
if (EndsWith(pFile, ".mesh", false)) {
|
||||
/// @note MemoryStreamReader takes ownership of f.
|
||||
MemoryStreamReader reader(f);
|
||||
|
||||
|
@ -122,8 +112,7 @@ void OgreImporter::InternReadFile(const std::string &pFile, aiScene *pScene, Ass
|
|||
mesh->ConvertToAssimpScene(pScene);
|
||||
}
|
||||
// XML .mesh.xml import
|
||||
else
|
||||
{
|
||||
else {
|
||||
/// @note XmlReader does not take ownership of f, hence the scoped ptr.
|
||||
std::unique_ptr<IOStream> scopedFile(f);
|
||||
XmlParser xmlParser;
|
||||
|
@ -145,7 +134,7 @@ void OgreImporter::InternReadFile(const std::string &pFile, aiScene *pScene, Ass
|
|||
}
|
||||
}
|
||||
|
||||
} // Ogre
|
||||
} // Assimp
|
||||
} // namespace Ogre
|
||||
} // namespace Assimp
|
||||
|
||||
#endif // ASSIMP_BUILD_NO_OGRE_IMPORTER
|
||||
|
|
|
@ -127,7 +127,8 @@ const char *WordIterator::whitespace = ", \t\r\n";
|
|||
|
||||
X3DImporter::X3DImporter() :
|
||||
mNodeElementCur(nullptr),
|
||||
mXmlParser(nullptr) {
|
||||
mXmlParser(nullptr),
|
||||
mpIOHandler(nullptr) {
|
||||
// empty
|
||||
}
|
||||
|
||||
|
|
|
@ -321,21 +321,7 @@ public:
|
|||
void Clear();
|
||||
|
||||
private:
|
||||
/***********************************************/
|
||||
/******************** Types ********************/
|
||||
/***********************************************/
|
||||
|
||||
/***********************************************/
|
||||
/****************** Constants ******************/
|
||||
/***********************************************/
|
||||
static const aiImporterDesc Description;
|
||||
//static const std::regex pattern_nws;
|
||||
//static const std::regex pattern_true;
|
||||
|
||||
|
||||
/***********************************************/
|
||||
/****************** Variables ******************/
|
||||
/***********************************************/
|
||||
X3DNodeElementBase* mNodeElementCur;///< Current element.
|
||||
XmlParser *mXmlParser;
|
||||
IOSystem *mpIOHandler;
|
||||
|
|
|
@ -52,7 +52,7 @@ public:
|
|||
virtual bool importerTest() {
|
||||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/X3D/ComputerKeyboard.x3d", aiProcess_ValidateDataStructure);
|
||||
return nullptr != scene;
|
||||
return nullptr == scene;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue