Browse Source

Fixed the 2D rendering order makes the layer priority higher than the Z

Zhang Kaikai 7 years ago
parent
commit
db1e4fea66
1 changed files with 3 additions and 3 deletions
  1. 3 3
      Source/Urho3D/Urho2D/Renderer2D.cpp

+ 3 - 3
Source/Urho3D/Urho2D/Renderer2D.cpp

@@ -404,12 +404,12 @@ void Renderer2D::GetDrawables(PODVector<Drawable2D*>& drawables, Node* node)
 
 static inline bool CompareSourceBatch2Ds(const SourceBatch2D* lhs, const SourceBatch2D* rhs)
 {
-    if (lhs->distance_ != rhs->distance_)
-        return lhs->distance_ > rhs->distance_;
-
     if (lhs->drawOrder_ != rhs->drawOrder_)
         return lhs->drawOrder_ < rhs->drawOrder_;
 
+    if (lhs->distance_ != rhs->distance_)
+        return lhs->distance_ > rhs->distance_;
+
     if (lhs->material_ != rhs->material_)
         return lhs->material_->GetNameHash() < rhs->material_->GetNameHash();