Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKester Maddock <Christopher.Maddock.1@uni.massey.ac.nz>2004-05-04 17:17:46 +0400
committerKester Maddock <Christopher.Maddock.1@uni.massey.ac.nz>2004-05-04 17:17:46 +0400
commit648c21947c6c115209e5529de6e747e474fd64e2 (patch)
tree8549b49fef1e0df36552321ba7f280b71a952e40 /source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp
parentf03fa79d28a112c39fcbab5d71b952333dc66fac (diff)
Use a better compare function for RAS_IPolygonMaterial
Fix sharing verticies - must test pos, normal, uv & colour before sharing (not just index)
Diffstat (limited to 'source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp')
-rw-r--r--source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp49
1 files changed, 38 insertions, 11 deletions
diff --git a/source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp b/source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp
index 33cdc43afd8..6a202780652 100644
--- a/source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp
+++ b/source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp
@@ -81,17 +81,44 @@ bool RAS_IPolyMaterial::Equals(const RAS_IPolyMaterial& lhs) const
bool RAS_IPolyMaterial::Less(const RAS_IPolyMaterial& rhs) const
{
- return (
- this->m_materialname < rhs.m_materialname ||
- this->m_texturename < rhs.m_texturename ||
- this->m_lightlayer < rhs.m_lightlayer ||
- this->m_tile < rhs.m_tile ||
- this->m_tilexrep < rhs.m_tilexrep ||
- this->m_tileyrep < rhs.m_tileyrep ||
- this->m_transparant < rhs.m_transparant ||
- this->m_drawingmode < rhs.m_drawingmode ||
- this->m_bIsTriangle < rhs.m_bIsTriangle
- );
+ /**
+ * @warning STL requires lhs.Less(rhs) == rhs.Less(lhs) implies lhs.Equals(rhs).
+ * This function *must* return different values for lhs.Less(rhs) and rhs.Less(lhs) if
+ * !lhs.Equals(rhs) !!
+ */
+ if (m_materialname.hash() < rhs.m_materialname.hash())
+ return true;
+
+ if (m_materialname.hash() > rhs.m_materialname.hash() ||
+ m_texturename.hash() > rhs.m_texturename.hash())
+ return false;
+
+ if (m_texturename.hash() < rhs.m_texturename.hash() ||
+ m_lightlayer < rhs.m_lightlayer)
+ return true;
+
+ if (m_lightlayer > rhs.m_lightlayer ||
+ m_bIsTriangle > rhs.m_bIsTriangle)
+ return false;
+
+ if (m_bIsTriangle < rhs.m_bIsTriangle ||
+ m_drawingmode < rhs.m_drawingmode)
+ return true;
+
+ if (m_drawingmode > rhs.m_drawingmode ||
+ m_transparant > !rhs.m_transparant)
+ return false;
+
+ if (m_transparant < rhs.m_transparant ||
+ m_tileyrep < rhs.m_tileyrep)
+ return true;
+
+ if (m_tileyrep > rhs.m_tileyrep ||
+ m_tilexrep > rhs.m_tilexrep)
+ return false;
+
+ return (m_tilexrep < rhs.m_tilexrep ||
+ m_tile < rhs.m_tile);
}
int RAS_IPolyMaterial::GetLightLayer()