[英]Getting the texture scale with assimp
I'm trying the texture scale from the.mtl file.我正在尝试 .mtl 文件中的纹理比例。 Opening the file in notepad I can see that it has map_Kd -s 4.000000 4.000000 1.000000 crate_diffuse.dds在记事本中打开文件我可以看到它有map_Kd -s 4.000000 4.000000 1.000000 crate_diffuse.dds
I am trying thte code below but it returns aiReturnFAILURE.我正在尝试下面的代码,但它返回 aiReturnFAILURE。
for (UINT j = 0; j < material->GetTextureCount(type); j++)
{
aiString str;
material->GetTexture(type, j, &str);
aiUVTransform uvTransform;
if (material->Get(AI_MATKEY_UVTRANSFORM(aiTextureType_DIFFUSE, j), uvTransform) == aiReturn_FAILURE)
{
std::cout << "Failed\n";
}
texture_diffuse = std::string(str.C_Str());
std::cout << texture_diffuse << '\n';
}
This will happen when not uvTransform was stored for your material.当没有为您的材料存储 uvTransform 时,就会发生这种情况。 Without any uvTransform your scaling will be 1.0.如果没有任何 uvTransform,您的缩放比例将为 1.0。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.