preserve UV Stream names in FBX files

pull/3859/head
Tom spot Callaway 2021-05-03 13:40:31 -04:00
parent 71c48581f3
commit f91b439f79
3 changed files with 11 additions and 2 deletions

View File

@ -598,8 +598,11 @@ static void WriteDump(const char *pFile, const char *cmd, const aiScene *scene,
if (!mesh->mTextureCoords[a]) if (!mesh->mTextureCoords[a])
break; break;
ioprintf(io, "\t\t<TextureCoords num=\"%u\" set=\"%u\" num_components=\"%u\"> \n", mesh->mNumVertices, ioprintf(io, "\t\t<TextureCoords num=\"%u\" set=\"%u\" name=\"%s\" num_components=\"%u\"> \n",
a, mesh->mNumUVComponents[a]); mesh->mNumVertices,
a,
mesh->mTextureCoordsNames[a].C_Str(),
mesh->mNumUVComponents[a]);
if (!shortened) { if (!shortened) {
if (mesh->mNumUVComponents[a] == 3) { if (mesh->mNumUVComponents[a] == 3) {

View File

@ -1126,6 +1126,8 @@ unsigned int FBXConverter::ConvertMeshSingleMaterial(const MeshGeometry &mesh, c
*out_uv++ = aiVector3D(v.x, v.y, 0.0f); *out_uv++ = aiVector3D(v.x, v.y, 0.0f);
} }
out_mesh->mTextureCoordsNames[i] = mesh.GetTextureCoordChannelName(i);
out_mesh->mNumUVComponents[i] = 2; out_mesh->mNumUVComponents[i] = 2;
} }

View File

@ -674,6 +674,10 @@ struct aiMesh {
*/ */
C_STRUCT aiVector3D *mTextureCoords[AI_MAX_NUMBER_OF_TEXTURECOORDS]; C_STRUCT aiVector3D *mTextureCoords[AI_MAX_NUMBER_OF_TEXTURECOORDS];
/** Vertex stream names.
*/
C_STRUCT aiString mTextureCoordsNames[AI_MAX_NUMBER_OF_TEXTURECOORDS];
/** Specifies the number of components for a given UV channel. /** Specifies the number of components for a given UV channel.
* Up to three channels are supported (UVW, for accessing volume * Up to three channels are supported (UVW, for accessing volume
* or cube maps). If the value is 2 for a given channel n, the * or cube maps). If the value is 2 for a given channel n, the