简体   繁体   中英

Getting the texture scale with assimp

I'm trying the texture scale from the.mtl file. Opening the file in notepad I can see that it has map_Kd -s 4.000000 4.000000 1.000000 crate_diffuse.dds

I am trying thte code below but it returns 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. Without any uvTransform your scaling will be 1.0.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM