FIX: Nasty debug-only bug in FindInstancesProcess.
FIX: Crash at ReplaceCurrentTexture(). FIX: Crash at 'compute smooth normals' in AssimpView. FIX: Obj shininess is now scaled by 4.0. git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@421 67173fc5-114c-0410-ac8e-9d2fd5bffc1fpull/1/head
parent
13804abf2e
commit
de14e06805
|
@ -134,7 +134,7 @@ void FindInstancesProcess::Execute( aiScene* pScene)
|
||||||
aiMesh* inst = pScene->mMeshes[i];
|
aiMesh* inst = pScene->mMeshes[i];
|
||||||
hashes[i] = GetMeshHash(inst);
|
hashes[i] = GetMeshHash(inst);
|
||||||
|
|
||||||
for (int a = i-1; a > 0; --a) {
|
for (int a = i-1; a >= 0; --a) {
|
||||||
if (hashes[i] == hashes[a])
|
if (hashes[i] == hashes[a])
|
||||||
{
|
{
|
||||||
aiMesh* orig = pScene->mMeshes[a];
|
aiMesh* orig = pScene->mMeshes[a];
|
||||||
|
@ -253,6 +253,7 @@ void FindInstancesProcess::Execute( aiScene* pScene)
|
||||||
// Delete the instanced mesh, we don't need it anymore
|
// Delete the instanced mesh, we don't need it anymore
|
||||||
delete inst;
|
delete inst;
|
||||||
pScene->mMeshes[i] = NULL;
|
pScene->mMeshes[i] = NULL;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -443,6 +443,9 @@ void ObjFileImporter::createMaterial(const ObjFile::Model* pModel, const ObjFile
|
||||||
}
|
}
|
||||||
mat->AddProperty<int>( &sm, 1, AI_MATKEY_SHADING_MODEL);
|
mat->AddProperty<int>( &sm, 1, AI_MATKEY_SHADING_MODEL);
|
||||||
|
|
||||||
|
// multiplying the specular exponent with 2 seems to yield better results
|
||||||
|
pCurrentMaterial->shineness *= 4.f;
|
||||||
|
|
||||||
// Adding material colors
|
// Adding material colors
|
||||||
mat->AddProperty( &pCurrentMaterial->ambient, 1, AI_MATKEY_COLOR_AMBIENT );
|
mat->AddProperty( &pCurrentMaterial->ambient, 1, AI_MATKEY_COLOR_AMBIENT );
|
||||||
mat->AddProperty( &pCurrentMaterial->diffuse, 1, AI_MATKEY_COLOR_DIFFUSE );
|
mat->AddProperty( &pCurrentMaterial->diffuse, 1, AI_MATKEY_COLOR_DIFFUSE );
|
||||||
|
|
|
@ -280,6 +280,7 @@ int CDisplay::ReplaceCurrentTexture(const char* szPath)
|
||||||
|
|
||||||
// special handling here
|
// special handling here
|
||||||
if (pcMesh->piNormalTexture && pcMesh->piNormalTexture != piTexture) {
|
if (pcMesh->piNormalTexture && pcMesh->piNormalTexture != piTexture) {
|
||||||
|
piTexture->AddRef();
|
||||||
pcMesh->piNormalTexture->Release();
|
pcMesh->piNormalTexture->Release();
|
||||||
pcMesh->piNormalTexture = piTexture;
|
pcMesh->piNormalTexture = piTexture;
|
||||||
CMaterialManager::Instance().HMtoNMIfNecessary(pcMesh->piNormalTexture,&pcMesh->piNormalTexture,true);
|
CMaterialManager::Instance().HMtoNMIfNecessary(pcMesh->piNormalTexture,&pcMesh->piNormalTexture,true);
|
||||||
|
@ -302,9 +303,9 @@ int CDisplay::ReplaceCurrentTexture(const char* szPath)
|
||||||
*tex = piTexture;
|
*tex = piTexture;
|
||||||
m_pcCurrentTexture->piTexture = tex;
|
m_pcCurrentTexture->piTexture = tex;
|
||||||
|
|
||||||
if (!pcMesh->bSharedFX){
|
//if (!pcMesh->bSharedFX){
|
||||||
pcMesh->piEffect->SetTexture(tex_string,piTexture);
|
pcMesh->piEffect->SetTexture(tex_string,piTexture);
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// now update the material itself
|
// now update the material itself
|
||||||
|
|
|
@ -456,6 +456,7 @@ void CMaterialManager::DeleteMaterial(AssetHelper::MeshHelper* pcIn)
|
||||||
pcIn->piLightmapTexture->Release();
|
pcIn->piLightmapTexture->Release();
|
||||||
pcIn->piLightmapTexture = NULL;
|
pcIn->piLightmapTexture = NULL;
|
||||||
}
|
}
|
||||||
|
pcIn->piEffect = NULL;
|
||||||
}
|
}
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
void CMaterialManager::HMtoNMIfNecessary(
|
void CMaterialManager::HMtoNMIfNecessary(
|
||||||
|
|
|
@ -103,6 +103,10 @@ void AssetHelper::FlipNormalsInt()
|
||||||
for (unsigned int i = 0; i < this->pcScene->mNumMeshes;++i)
|
for (unsigned int i = 0; i < this->pcScene->mNumMeshes;++i)
|
||||||
{
|
{
|
||||||
aiMesh* pcMesh = this->pcScene->mMeshes[i];
|
aiMesh* pcMesh = this->pcScene->mMeshes[i];
|
||||||
|
|
||||||
|
if (!pcMesh->mNormals)
|
||||||
|
continue;
|
||||||
|
|
||||||
for (unsigned int a = 0; a < pcMesh->mNumVertices;++a){
|
for (unsigned int a = 0; a < pcMesh->mNumVertices;++a){
|
||||||
pcMesh->mNormals[a] *= -1.0f;
|
pcMesh->mNormals[a] *= -1.0f;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue