|
@@ -58,6 +58,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
#include "time.h"
|
|
#include "time.h"
|
|
#include <assimp/DefaultLogger.hpp>
|
|
#include <assimp/DefaultLogger.hpp>
|
|
#include <assimp/scene.h>
|
|
#include <assimp/scene.h>
|
|
|
|
+#include <assimp/mesh.h>
|
|
#include <stdio.h>
|
|
#include <stdio.h>
|
|
#include "ScenePrivate.h"
|
|
#include "ScenePrivate.h"
|
|
|
|
|
|
@@ -757,7 +758,7 @@ void SceneCombiner::MergeBones(aiMesh* out,std::vector<aiMesh*>::const_iterator
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
// ------------------------------------------------------------------------------------------------
|
|
// Merge a list of meshes
|
|
// Merge a list of meshes
|
|
-void SceneCombiner::MergeMeshes(aiMesh** _out,unsigned int /*flags*/,
|
|
|
|
|
|
+void SceneCombiner::MergeMeshes(aiMesh** _out, unsigned int /*flags*/,
|
|
std::vector<aiMesh*>::const_iterator begin,
|
|
std::vector<aiMesh*>::const_iterator begin,
|
|
std::vector<aiMesh*>::const_iterator end)
|
|
std::vector<aiMesh*>::const_iterator end)
|
|
{
|
|
{
|
|
@@ -772,8 +773,14 @@ void SceneCombiner::MergeMeshes(aiMesh** _out,unsigned int /*flags*/,
|
|
aiMesh* out = *_out = new aiMesh();
|
|
aiMesh* out = *_out = new aiMesh();
|
|
out->mMaterialIndex = (*begin)->mMaterialIndex;
|
|
out->mMaterialIndex = (*begin)->mMaterialIndex;
|
|
|
|
|
|
|
|
+ std::string name;
|
|
// Find out how much output storage we'll need
|
|
// Find out how much output storage we'll need
|
|
- for (std::vector<aiMesh*>::const_iterator it = begin; it != end;++it) {
|
|
|
|
|
|
+ for (std::vector<aiMesh*>::const_iterator it = begin; it != end; ++it) {
|
|
|
|
+ const char *meshName( (*it)->mName.C_Str() );
|
|
|
|
+ name += std::string( meshName );
|
|
|
|
+ if ( it != end - 1 ) {
|
|
|
|
+ name += ".";
|
|
|
|
+ }
|
|
out->mNumVertices += (*it)->mNumVertices;
|
|
out->mNumVertices += (*it)->mNumVertices;
|
|
out->mNumFaces += (*it)->mNumFaces;
|
|
out->mNumFaces += (*it)->mNumFaces;
|
|
out->mNumBones += (*it)->mNumBones;
|
|
out->mNumBones += (*it)->mNumBones;
|
|
@@ -781,6 +788,7 @@ void SceneCombiner::MergeMeshes(aiMesh** _out,unsigned int /*flags*/,
|
|
// combine primitive type flags
|
|
// combine primitive type flags
|
|
out->mPrimitiveTypes |= (*it)->mPrimitiveTypes;
|
|
out->mPrimitiveTypes |= (*it)->mPrimitiveTypes;
|
|
}
|
|
}
|
|
|
|
+ out->mName.Set( name.c_str() );
|
|
|
|
|
|
if (out->mNumVertices) {
|
|
if (out->mNumVertices) {
|
|
aiVector3D* pv2;
|
|
aiVector3D* pv2;
|
|
@@ -789,7 +797,7 @@ void SceneCombiner::MergeMeshes(aiMesh** _out,unsigned int /*flags*/,
|
|
if ((**begin).HasPositions()) {
|
|
if ((**begin).HasPositions()) {
|
|
|
|
|
|
pv2 = out->mVertices = new aiVector3D[out->mNumVertices];
|
|
pv2 = out->mVertices = new aiVector3D[out->mNumVertices];
|
|
- for (std::vector<aiMesh*>::const_iterator it = begin; it != end;++it) {
|
|
|
|
|
|
+ for (std::vector<aiMesh*>::const_iterator it = begin; it != end; ++it) {
|
|
if ((*it)->mVertices) {
|
|
if ((*it)->mVertices) {
|
|
::memcpy(pv2,(*it)->mVertices,(*it)->mNumVertices*sizeof(aiVector3D));
|
|
::memcpy(pv2,(*it)->mVertices,(*it)->mNumVertices*sizeof(aiVector3D));
|
|
}
|
|
}
|
|
@@ -809,7 +817,7 @@ void SceneCombiner::MergeMeshes(aiMesh** _out,unsigned int /*flags*/,
|
|
pv2 += (*it)->mNumVertices;
|
|
pv2 += (*it)->mNumVertices;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- // copy tangents and bitangents
|
|
|
|
|
|
+ // copy tangents and bi-tangents
|
|
if ((**begin).HasTangentsAndBitangents()) {
|
|
if ((**begin).HasTangentsAndBitangents()) {
|
|
|
|
|
|
pv2 = out->mTangents = new aiVector3D[out->mNumVertices];
|
|
pv2 = out->mTangents = new aiVector3D[out->mNumVertices];
|