diff options
author | Kester Maddock <Christopher.Maddock.1@uni.massey.ac.nz> | 2004-05-04 13:34:02 +0400 |
---|---|---|
committer | Kester Maddock <Christopher.Maddock.1@uni.massey.ac.nz> | 2004-05-04 13:34:02 +0400 |
commit | f03fa79d28a112c39fcbab5d71b952333dc66fac (patch) | |
tree | 349af2572f240d3b78312cf7f28d0d949e10f8a5 /source/gameengine/Rasterizer/RAS_MaterialBucket.h | |
parent | 79f3e880217215d5af09a9083f868ce7b80baaa5 (diff) |
Fix for bug #945 getVertexArrayLength(x) returns different values on different runs of the game engine.
http://projects.blender.org/tracker/index.php?func=detail&aid=945&group_id=9&atid=125
The material buckets were being sorted by pointer (ie their location in memory.)
Also fixed find shared verticies.
Diffstat (limited to 'source/gameengine/Rasterizer/RAS_MaterialBucket.h')
-rw-r--r-- | source/gameengine/Rasterizer/RAS_MaterialBucket.h | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/source/gameengine/Rasterizer/RAS_MaterialBucket.h b/source/gameengine/Rasterizer/RAS_MaterialBucket.h index e43273e9dcc..51174c12335 100644 --- a/source/gameengine/Rasterizer/RAS_MaterialBucket.h +++ b/source/gameengine/Rasterizer/RAS_MaterialBucket.h @@ -51,7 +51,9 @@ typedef vector< KX_IndexArray* > vecIndexArrays; typedef vector<RAS_TexVert> KX_VertexArray; - +/** + * KX_VertexIndex + */ struct KX_VertexIndex { public: KX_VertexIndex(int size); @@ -62,7 +64,9 @@ public: }; - +/** + * KX_MeshSlot. + */ class KX_MeshSlot { public: @@ -86,7 +90,9 @@ inline bool operator <( const KX_MeshSlot& rhs,const KX_MeshSlot& lhs) return ( rhs.Less(lhs)); } - +/** + * Contains a list of meshs with the same material properties. + */ class RAS_MaterialBucket { typedef std::set<KX_MeshSlot> T_MeshSlotList; @@ -108,8 +114,8 @@ public: void SchedulePolygons(int drawingmode); void ClearScheduledPolygons(); - RAS_IPolyMaterial* GetPolyMaterial(); - bool IsTransparant(); + RAS_IPolyMaterial* GetPolyMaterial() const; + bool IsTransparant() const; static void StartFrame(); static void EndFrame(); @@ -120,6 +126,16 @@ public: bool visible, bool color, const MT_Vector4& rgbavec); + + struct less + { + bool operator()(const RAS_MaterialBucket* x, const RAS_MaterialBucket* y) const + { + return *x->GetPolyMaterial() < *y->GetPolyMaterial(); + } + }; + + typedef set<RAS_MaterialBucket*, less> Set; }; #endif //__KX_BUCKET |