add support for the metadata ExtraGroupInfo data in ConvertToMeshFile
This commit is contained in:
parent
92aef2251e
commit
6a3f3af34f
|
@ -13,6 +13,7 @@
|
||||||
#include "chunks/texcoords.h"
|
#include "chunks/texcoords.h"
|
||||||
#include "chunks/triangles.h"
|
#include "chunks/triangles.h"
|
||||||
#include "chunks/vertices.h"
|
#include "chunks/vertices.h"
|
||||||
|
#include "geometry/extragroupinfo.h"
|
||||||
#include "geometry/group.h"
|
#include "geometry/group.h"
|
||||||
#include "geometry/joint.h"
|
#include "geometry/joint.h"
|
||||||
#include "geometry/jointvertexinfo.h"
|
#include "geometry/jointvertexinfo.h"
|
||||||
|
@ -149,10 +150,36 @@ BOOL ConvertToMeshFile(const std::string &meshFilename, const Ms3d *source, cons
|
||||||
|
|
||||||
Group g;
|
Group g;
|
||||||
g.name = mesh->name;
|
g.name = mesh->name;
|
||||||
|
g.texture.clear(); // TODO: grab this from the Ms3d material info
|
||||||
|
g.alpha = 0;
|
||||||
g.numTriangles = mesh->numTriangles;
|
g.numTriangles = mesh->numTriangles;
|
||||||
|
|
||||||
groups->groups.push_back(g);
|
groups->groups.push_back(g);
|
||||||
}
|
}
|
||||||
|
if (metadata->IsLoaded() && metadata->GetNumGroupInfo() > 0)
|
||||||
|
{
|
||||||
|
for (uint32_t i = 0; i < metadata->GetNumGroupInfo(); ++i)
|
||||||
|
{
|
||||||
|
const ExtraGroupInfo *extraGroupInfo = &metadata->GetGroupInfo()[i];
|
||||||
|
|
||||||
|
// find matching Group from the chunk data we just populated
|
||||||
|
int32_t index;
|
||||||
|
if (extraGroupInfo->specifiedByName)
|
||||||
|
index = source->FindIndexOfMesh(extraGroupInfo->name);
|
||||||
|
else
|
||||||
|
index = (int32_t)extraGroupInfo->index;
|
||||||
|
|
||||||
|
if (index == -1)
|
||||||
|
{
|
||||||
|
printf("Mesh conversion error: metadata group info references invalid MS3D group\n");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
Group *group = &groups->groups[index];
|
||||||
|
group->alpha = extraGroupInfo->alphaBlend ? 1 : 0;
|
||||||
|
group->texture = extraGroupInfo->textureFile;
|
||||||
|
}
|
||||||
|
}
|
||||||
WriteChunk(groups, fp);
|
WriteChunk(groups, fp);
|
||||||
|
|
||||||
JointsChunk *joints = new JointsChunk();
|
JointsChunk *joints = new JointsChunk();
|
||||||
|
|
Reference in a new issue