From bed723abdc6f92104c2ab7d0449878394843a0f4 Mon Sep 17 00:00:00 2001 From: Porteries Tristan Date: Sat, 6 Feb 2016 14:50:26 +0100 Subject: [PATCH] UPBGE: Remove RAS_BLENDERMAT. --- .../gameengine/Ketsji/KX_BlenderMaterial.cpp | 1 - source/gameengine/Ketsji/KX_GameObject.cpp | 33 +++++++++---------- .../Rasterizer/RAS_IPolygonMaterial.h | 1 - 3 files changed, 15 insertions(+), 20 deletions(-) diff --git a/source/gameengine/Ketsji/KX_BlenderMaterial.cpp b/source/gameengine/Ketsji/KX_BlenderMaterial.cpp index 2359d431ee04..141f3011dd34 100644 --- a/source/gameengine/Ketsji/KX_BlenderMaterial.cpp +++ b/source/gameengine/Ketsji/KX_BlenderMaterial.cpp @@ -115,7 +115,6 @@ void KX_BlenderMaterial::Initialize( m_lightLayer = lightlayer; // -------------------------------- // RAS_IPolyMaterial variables... - m_flag |= RAS_BLENDERMAT; m_flag |= (m_material->IdMode >= ONETEX) ? RAS_MULTITEX : 0; m_flag |= ((m_material->ras_mode & USE_LIGHT) != 0) ? RAS_MULTILIGHT : 0; m_flag |= RAS_BLENDERGLSL; diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp index 25958701e355..fe6e6e2cd741 100644 --- a/source/gameengine/Ketsji/KX_GameObject.cpp +++ b/source/gameengine/Ketsji/KX_GameObject.cpp @@ -930,27 +930,24 @@ KX_GameObject::UpdateMaterialData( { RAS_IPolyMaterial* poly = mit->m_bucket->GetPolyMaterial(); - if (poly->GetFlag() & RAS_BLENDERMAT ) + KX_BlenderMaterial *m = static_cast(poly); + + if (matname_hash == 0) { - KX_BlenderMaterial *m = static_cast(poly); - - if (matname_hash == 0) + m->UpdateIPO(rgba, specrgb,hard,spec,ref,emit, alpha); + // if mesh has only one material attached to it then use original hack with no need to edit vertices (better performance) + SetObjectColor(rgba); + } + else + { + if (matname_hash == poly->GetMaterialNameHash()) { m->UpdateIPO(rgba, specrgb,hard,spec,ref,emit, alpha); - // if mesh has only one material attached to it then use original hack with no need to edit vertices (better performance) - SetObjectColor(rgba); - } - else - { - if (matname_hash == poly->GetMaterialNameHash()) - { - m->UpdateIPO(rgba, specrgb,hard,spec,ref,emit, alpha); - m_meshes[mesh]->SetVertexColor(poly,rgba); - - // no break here, because one blender material can be split into several game engine materials - // (e.g. one uvsphere material is split into one material at poles with ras_mode TRIANGLE and one material for the body - // if here was a break then would miss some vertices if material was split - } + m_meshes[mesh]->SetVertexColor(poly,rgba); + + // no break here, because one blender material can be split into several game engine materials + // (e.g. one uvsphere material is split into one material at poles with ras_mode TRIANGLE and one material for the body + // if here was a break then would miss some vertices if material was split } } } diff --git a/source/gameengine/Rasterizer/RAS_IPolygonMaterial.h b/source/gameengine/Rasterizer/RAS_IPolygonMaterial.h index b9454ac85539..7c61130e6184 100644 --- a/source/gameengine/Rasterizer/RAS_IPolygonMaterial.h +++ b/source/gameengine/Rasterizer/RAS_IPolygonMaterial.h @@ -51,7 +51,6 @@ enum MaterialProps { RAS_MULTITEX = (1 << 0), RAS_MULTILIGHT = (1 << 1), - RAS_BLENDERMAT = (1 << 2), RAS_BLENDERGLSL = (1 << 3), RAS_CASTSHADOW = (1 << 4), RAS_ONLYSHADOW = (1 << 5),