- no longer distinguish between textured and non-textured default materials. Also, do not spit out dummy texture names. This was once a workaround to get some viewers to display a dummy texture rather than a plain shaded asset, but this is no longer appropriate. This involves removal of the public #define AI_DEFAULT_TEXTURED_MATERIAL_NAME.

git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@1083 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
pull/2/head
aramis_acg 2011-10-15 10:28:36 +00:00
parent e8d8b23d52
commit c807fd65f3
3 changed files with 14 additions and 37 deletions

View File

@ -320,7 +320,7 @@ void MD2Importer::InternReadFile( const std::string& pFile,
pcHelper->AddProperty<aiColor3D>(&clr, 1,AI_MATKEY_COLOR_AMBIENT); pcHelper->AddProperty<aiColor3D>(&clr, 1,AI_MATKEY_COLOR_AMBIENT);
aiString szName; aiString szName;
szName.Set(AI_DEFAULT_TEXTURED_MATERIAL_NAME); szName.Set(AI_DEFAULT_MATERIAL_NAME);
pcHelper->AddProperty(&szName,AI_MATKEY_NAME); pcHelper->AddProperty(&szName,AI_MATKEY_NAME);
aiString sz; aiString sz;

View File

@ -68,43 +68,21 @@ void ScenePreprocessor::ProcessScene ()
aiString name; aiString name;
// Check whether there are meshes with at least one set of uv coordinates ... add a dummy texture for them
// meshes without texture coordinates receive a boring gray default material.
unsigned int mat0 = UINT_MAX, mat1 = UINT_MAX;
for (unsigned int i = 0; i < scene->mNumMeshes;++i) {
if (scene->mMeshes[i]->mTextureCoords[0]) {
if (mat0 == UINT_MAX) {
scene->mMaterials[scene->mNumMaterials] = helper = new aiMaterial();
name.Set("$texture.png");
helper->AddProperty(&name,AI_MATKEY_TEXTURE_DIFFUSE(0));
name.Set(AI_DEFAULT_TEXTURED_MATERIAL_NAME);
helper->AddProperty(&name,AI_MATKEY_NAME);
mat0 = scene->mNumMaterials++;
DefaultLogger::get()->debug("ScenePreprocessor: Adding textured material \'" AI_DEFAULT_TEXTURED_MATERIAL_NAME "\'");
}
scene->mMeshes[i]->mMaterialIndex = mat0;
}
else {
if (mat1 == UINT_MAX) {
scene->mMaterials[scene->mNumMaterials] = helper = new aiMaterial(); scene->mMaterials[scene->mNumMaterials] = helper = new aiMaterial();
aiColor3D clr(0.6f,0.6f,0.6f); aiColor3D clr(0.6f,0.6f,0.6f);
helper->AddProperty(&clr,1,AI_MATKEY_COLOR_DIFFUSE); helper->AddProperty(&clr,1,AI_MATKEY_COLOR_DIFFUSE);
// setup the default name // setup the default name to make this material identifyable
name.Set(AI_DEFAULT_MATERIAL_NAME); name.Set(AI_DEFAULT_MATERIAL_NAME);
helper->AddProperty(&name,AI_MATKEY_NAME); helper->AddProperty(&name,AI_MATKEY_NAME);
mat1 = scene->mNumMaterials++; DefaultLogger::get()->debug("ScenePreprocessor: Adding default material \'" AI_DEFAULT_MATERIAL_NAME "\'");
DefaultLogger::get()->debug("ScenePreprocessor: Adding grey material \'" AI_DEFAULT_MATERIAL_NAME "\'");
} for (unsigned int i = 0; i < scene->mNumMeshes;++i) {
scene->mMeshes[i]->mMaterialIndex = mat1; scene->mMeshes[i]->mMaterialIndex = scene->mNumMaterials;
}
} }
scene->mNumMaterials++;
} }
} }

View File

@ -54,7 +54,6 @@ extern "C" {
// Name for default materials (2nd is used if meshes have UV coords) // Name for default materials (2nd is used if meshes have UV coords)
#define AI_DEFAULT_MATERIAL_NAME "DefaultMaterial" #define AI_DEFAULT_MATERIAL_NAME "DefaultMaterial"
#define AI_DEFAULT_TEXTURED_MATERIAL_NAME "TexturedDefaultMaterial"
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
/** @brief Defines how the Nth texture of a specific type is combined with /** @brief Defines how the Nth texture of a specific type is combined with