Add mName member to aiMesh.
JoinVerticesProcess and SortByPType copy the mesh name to all clone or sub meshes they create. JoinVerticesProcess' verbose output now prints mesh name, no longer using sprintf (TinyFormatter's age has come). WARN: This is a public API change (not a breaking one, however). git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@719 67173fc5-114c-0410-ac8e-9d2fd5bffc1fpull/1/head
parent
35f6851dba
commit
261f49c468
|
@ -49,6 +49,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "JoinVerticesProcess.h"
|
#include "JoinVerticesProcess.h"
|
||||||
#include "ProcessHelper.h"
|
#include "ProcessHelper.h"
|
||||||
#include "Vertex.h"
|
#include "Vertex.h"
|
||||||
|
#include "TinyFormatter.h"
|
||||||
|
|
||||||
using namespace Assimp;
|
using namespace Assimp;
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
@ -251,13 +252,17 @@ int JoinVerticesProcess::ProcessMesh( aiMesh* pMesh, unsigned int meshIndex)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!DefaultLogger::isNullLogger() && DefaultLogger::get()->getLogSeverity() == Logger::VERBOSE) {
|
if (!DefaultLogger::isNullLogger() && DefaultLogger::get()->getLogSeverity() == Logger::VERBOSE) {
|
||||||
char szBuff[128]; // should be sufficiently large in every case
|
DefaultLogger::get()->debug((Formatter::format(),
|
||||||
::sprintf(szBuff,"Mesh %i | Verts in: %i out: %i | ~%.1f%%",
|
"Mesh ",meshIndex,
|
||||||
meshIndex,
|
" (",
|
||||||
pMesh->mNumVertices,
|
(pMesh->mName.length ? pMesh->mName.data : "unnamed"),
|
||||||
(int)uniqueVertices.size(),
|
") | Verts in: ",pMesh->mNumVertices,
|
||||||
((pMesh->mNumVertices - uniqueVertices.size()) / (float)pMesh->mNumVertices) * 100.f);
|
" out: ",
|
||||||
DefaultLogger::get()->debug(szBuff);
|
uniqueVertices.size(),
|
||||||
|
" | ~",
|
||||||
|
((pMesh->mNumVertices - uniqueVertices.size()) / (float)pMesh->mNumVertices) * 100.f,
|
||||||
|
"%"
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
// replace vertex data with the unique data sets
|
// replace vertex data with the unique data sets
|
||||||
|
|
|
@ -221,6 +221,9 @@ void SortByPTypeProcess::Execute( aiScene* pScene)
|
||||||
outMeshes.push_back(new aiMesh());
|
outMeshes.push_back(new aiMesh());
|
||||||
aiMesh* out = outMeshes.back();
|
aiMesh* out = outMeshes.back();
|
||||||
|
|
||||||
|
// the name carries the adjacency information between the meshes
|
||||||
|
out->mName = mesh->mName;
|
||||||
|
|
||||||
// copy data members
|
// copy data members
|
||||||
out->mPrimitiveTypes = 1u << real;
|
out->mPrimitiveTypes = 1u << real;
|
||||||
out->mMaterialIndex = mesh->mMaterialIndex;
|
out->mMaterialIndex = mesh->mMaterialIndex;
|
||||||
|
|
|
@ -168,6 +168,9 @@ void SplitLargeMeshesProcess_Triangle::SplitMesh(
|
||||||
pcMesh->mNumFaces = iOutFaceNum;
|
pcMesh->mNumFaces = iOutFaceNum;
|
||||||
pcMesh->mMaterialIndex = pMesh->mMaterialIndex;
|
pcMesh->mMaterialIndex = pMesh->mMaterialIndex;
|
||||||
|
|
||||||
|
// the name carries the adjacency information between the meshes
|
||||||
|
pcMesh->mName = pMesh->mName;
|
||||||
|
|
||||||
if (i == iSubMeshes-1)
|
if (i == iSubMeshes-1)
|
||||||
{
|
{
|
||||||
pcMesh->mNumFaces = iOutFaceNum + (
|
pcMesh->mNumFaces = iOutFaceNum + (
|
||||||
|
@ -442,6 +445,9 @@ void SplitLargeMeshesProcess_Vertex::SplitMesh(
|
||||||
pcMesh->mNumVertices = 0;
|
pcMesh->mNumVertices = 0;
|
||||||
pcMesh->mMaterialIndex = pMesh->mMaterialIndex;
|
pcMesh->mMaterialIndex = pMesh->mMaterialIndex;
|
||||||
|
|
||||||
|
// the name carries the adjacency information between the meshes
|
||||||
|
pcMesh->mName = pMesh->mName;
|
||||||
|
|
||||||
typedef std::vector<aiVertexWeight> BoneWeightList;
|
typedef std::vector<aiVertexWeight> BoneWeightList;
|
||||||
if (pMesh->HasBones())
|
if (pMesh->HasBones())
|
||||||
{
|
{
|
||||||
|
|
|
@ -318,6 +318,8 @@ void ValidateDSProcess::Validate( const aiMesh* pMesh)
|
||||||
pMesh->mMaterialIndex,mScene->mNumMaterials-1);
|
pMesh->mMaterialIndex,mScene->mNumMaterials-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Validate(&pMesh->mName);
|
||||||
|
|
||||||
for (unsigned int i = 0; i < pMesh->mNumFaces; ++i)
|
for (unsigned int i = 0; i < pMesh->mNumFaces; ++i)
|
||||||
{
|
{
|
||||||
aiFace& face = pMesh->mFaces[i];
|
aiFace& face = pMesh->mFaces[i];
|
||||||
|
|
Binary file not shown.
|
@ -440,6 +440,19 @@ struct aiMesh
|
||||||
*/
|
*/
|
||||||
unsigned int mMaterialIndex;
|
unsigned int mMaterialIndex;
|
||||||
|
|
||||||
|
/** Name of the mesh. Meshes can be named, but this is not a
|
||||||
|
* requirement and leaving this field empty is totally fine.
|
||||||
|
* There are mainly three uses for mesh names:
|
||||||
|
* - some formats name nodes and meshes independently.
|
||||||
|
* - importers tend to split meshes up to meet the
|
||||||
|
* one-material-per-mesh requirement. Assigning
|
||||||
|
* the same (dummy) name to each of the result meshes
|
||||||
|
* aids the caller at recovering the original mesh
|
||||||
|
* partitioning.
|
||||||
|
* - Vertex animations refer to meshes by their names.
|
||||||
|
**/
|
||||||
|
aiString mName;
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
||||||
//! Default constructor. Initializes all members to 0
|
//! Default constructor. Initializes all members to 0
|
||||||
|
|
Loading…
Reference in New Issue