Assimp 是否能够加载 3mf 文件的嵌入纹理?
Is Assimp able to load embedded texture of a 3mf file?
今天我发现了一个带有嵌入纹理的 3mf 文件(我所说的嵌入是指 .png 纹理存在于 3mf zip 中)。
因为我目前正在学习 Assimp 库,我尝试加载它并且它工作正常,网格被正确加载但是,根本没有加载 png 纹理。
Assimp 可以加载 3mf 文件的嵌入纹理吗?
为了在这里问我的问题之前做一些研究,我做了这种事情来记录 assimp 加载了什么样的 Material 属性(加载我的 3mf 文件时):
/** Loading material **/
aiString Path;
for (unsigned int i = 0 ; i < pScene->mNumMaterials ; i++) {
const aiMaterial* pMaterial = pScene->mMaterials[i];
if (pMaterial->GetTextureCount(aiTextureType_DIFFUSE) > 0){
if (pMaterial->GetTexture(aiTextureType_DIFFUSE, 0, &Path, NULL, NULL, NULL, NULL, NULL) == AI_SUCCESS) {
String FullPath =AppendFileName(GetFileFolder(Filename), String(Path.data));
InsertTexture(FullPath,i);
}
} /*
multiple else if to handle all different texture type
*/
}else{
//If no texture type have match the current aiMaterial object then I log it to find what goes wrong
for(int e = 0; e < pMaterial->mNumProperties; e++){
aiMaterialProperty* aiMp = pMaterial->mProperties[e];
LOG("Property number " + AsString(e) +" :");
LOG("mKey : " + String((*aiMp).mKey.data));
LOG("mSemantic : " + AsString((*aiMp).mSemantic));
LOG("mIndex : " + AsString((*aiMp).mIndex));
LOG("mDataLength : " + AsString((*aiMp).mDataLength));
LOG("aiPropertyTypeInfo : " + AsString((int) (*aiMp).mType));
String str = String((*aiMp).mData);
LOG("mData count : " + AsString(str.GetCount()));
LOG("---------------------------------");
}
}
}
/*************************/
如您所见,我正在打印 Material 以更深入地观察它,但是由于我对 assimp 的了解真的很低,所以它对我帮助不大!
在这里您可以找到 3mf 文件 aiMaterial 属性的 LOG :
在翻译 mKey / aiPropertyTypeInfo 之后,这两个属性似乎与纹理无关,它的目的只是描述应该计算我的对象的 material/ 光的方式。有人可以确认我吗?
目前 Assimp 不支持嵌入的纹理。您的文件中有 link 吗?我们可以尝试添加这个功能。只需添加一个新问题 here
今天我发现了一个带有嵌入纹理的 3mf 文件(我所说的嵌入是指 .png 纹理存在于 3mf zip 中)。
因为我目前正在学习 Assimp 库,我尝试加载它并且它工作正常,网格被正确加载但是,根本没有加载 png 纹理。
Assimp 可以加载 3mf 文件的嵌入纹理吗?
为了在这里问我的问题之前做一些研究,我做了这种事情来记录 assimp 加载了什么样的 Material 属性(加载我的 3mf 文件时):
/** Loading material **/
aiString Path;
for (unsigned int i = 0 ; i < pScene->mNumMaterials ; i++) {
const aiMaterial* pMaterial = pScene->mMaterials[i];
if (pMaterial->GetTextureCount(aiTextureType_DIFFUSE) > 0){
if (pMaterial->GetTexture(aiTextureType_DIFFUSE, 0, &Path, NULL, NULL, NULL, NULL, NULL) == AI_SUCCESS) {
String FullPath =AppendFileName(GetFileFolder(Filename), String(Path.data));
InsertTexture(FullPath,i);
}
} /*
multiple else if to handle all different texture type
*/
}else{
//If no texture type have match the current aiMaterial object then I log it to find what goes wrong
for(int e = 0; e < pMaterial->mNumProperties; e++){
aiMaterialProperty* aiMp = pMaterial->mProperties[e];
LOG("Property number " + AsString(e) +" :");
LOG("mKey : " + String((*aiMp).mKey.data));
LOG("mSemantic : " + AsString((*aiMp).mSemantic));
LOG("mIndex : " + AsString((*aiMp).mIndex));
LOG("mDataLength : " + AsString((*aiMp).mDataLength));
LOG("aiPropertyTypeInfo : " + AsString((int) (*aiMp).mType));
String str = String((*aiMp).mData);
LOG("mData count : " + AsString(str.GetCount()));
LOG("---------------------------------");
}
}
}
/*************************/
如您所见,我正在打印 Material 以更深入地观察它,但是由于我对 assimp 的了解真的很低,所以它对我帮助不大!
在这里您可以找到 3mf 文件 aiMaterial 属性的 LOG :
在翻译 mKey / aiPropertyTypeInfo 之后,这两个属性似乎与纹理无关,它的目的只是描述应该计算我的对象的 material/ 光的方式。有人可以确认我吗?
目前 Assimp 不支持嵌入的纹理。您的文件中有 link 吗?我们可以尝试添加这个功能。只需添加一个新问题 here