OgreImporter: Proper rewrite of the XML parser to OgreXmlSerializer. Now more robust for XML sources, previously had hardcoded expectations on the child node ordering. Implement common Skeleton class for both binary and xml serialization. Implement shared IVertexData with proper bone assignment to Assimp bone weights functionality.

This commit is contained in:
Jonne Nauha
2014-05-20 04:52:53 +03:00
parent 75598f69b7
commit 0b937c5a4b
13 changed files with 1961 additions and 1618 deletions

View File

@@ -42,12 +42,14 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef ASSIMP_BUILD_NO_OGRE_IMPORTER
#include <vector>
#include <sstream>
#include "OgreImporter.h"
#include "TinyFormatter.h"
#include "fast_atof.h"
#include <vector>
#include <sstream>
using namespace std;
namespace Assimp
@@ -66,7 +68,7 @@ void OgreImporter::ReadMaterials(const std::string &pFile, Assimp::IOSystem *pIO
// Create materials that can be found and parsed via the IOSystem.
for (size_t i=0, len=mesh->NumSubMeshes(); i<len; ++i)
{
SubMesh2 *submesh = mesh->SubMesh(i);
SubMesh *submesh = mesh->GetSubMesh(i);
if (submesh && !submesh->materialRef.empty())
{
aiMaterial *material = ReadMaterial(pFile, pIOHandler, submesh->materialRef);
@@ -78,7 +80,33 @@ void OgreImporter::ReadMaterials(const std::string &pFile, Assimp::IOSystem *pIO
}
}
// Assign material to scene
AssignMaterials(pScene, materials);
}
void OgreImporter::ReadMaterials(const std::string &pFile, Assimp::IOSystem *pIOHandler, aiScene *pScene, MeshXml *mesh)
{
std::vector<aiMaterial*> materials;
// Create materials that can be found and parsed via the IOSystem.
for (size_t i=0, len=mesh->NumSubMeshes(); i<len; ++i)
{
SubMeshXml *submesh = mesh->GetSubMesh(i);
if (submesh && !submesh->materialRef.empty())
{
aiMaterial *material = ReadMaterial(pFile, pIOHandler, submesh->materialRef);
if (material)
{
submesh->materialIndex = materials.size();
materials.push_back(material);
}
}
}
AssignMaterials(pScene, materials);
}
void OgreImporter::AssignMaterials(aiScene *pScene, std::vector<aiMaterial*> &materials)
{
pScene->mNumMaterials = materials.size();
if (pScene->mNumMaterials > 0)
{