Explorar o código

Fix Spine animation update threadsafety. Fix typos & whitespace. Closes #1005.

Lasse Öörni %!s(int64=10) %!d(string=hai) anos
pai
achega
4c65b77999

+ 6 - 6
Source/Urho3D/Urho2D/AnimatedSprite2D.cpp

@@ -107,7 +107,7 @@ void AnimatedSprite2D::SetAnimationSet(AnimationSet2D* animationSet)
 
     Dispose();
 
-    animationSet_ = animationSet;    
+    animationSet_ = animationSet;
     if (!animationSet_)
         return;
 
@@ -177,7 +177,7 @@ void AnimatedSprite2D::SetAnimation(const String& name, LoopMode2D loopMode)
 
 #ifdef URHO3D_SPINE
     if (skeleton_)
-        SetSpineAnimation();    
+        SetSpineAnimation();
 #endif
     if (spriterInstance_)
         SetSpriterAnimation();
@@ -240,7 +240,7 @@ void AnimatedSprite2D::UpdateSourceBatches()
     if (spriterInstance_ && spriterInstance_->GetAnimation())
         UpdateSourceBatchesSpriter();
 
-    sourceBatchesDirty_ = false;   
+    sourceBatchesDirty_ = false;
 }
 
 void AnimatedSprite2D::HandleScenePostUpdate(StringHash eventType, VariantMap& eventData)
@@ -314,8 +314,8 @@ void AnimatedSprite2D::UpdateSourceBatchesSpine()
     SourceBatch2D& sourceBatch = sourceBatches_[0];
     sourceBatches_[0].vertices_.Clear();
 
-    static const int SLOT_VERTEX_COUNT_MAX = 1024;
-    static float slotVertices[SLOT_VERTEX_COUNT_MAX];
+    const int SLOT_VERTEX_COUNT_MAX = 1024;
+    float slotVertices[SLOT_VERTEX_COUNT_MAX];
 
     for (int i = 0; i < skeleton_->slotsCount; ++i)
     {
@@ -459,7 +459,7 @@ void AnimatedSprite2D::UpdateSourceBatchesSpriter()
 
         Spriter::SpriteTimelineKey* timelineKey = (Spriter::SpriteTimelineKey*)timelineKeys[i];
 
-        Spriter::SpatialInfo& info = timelineKey->info_;        
+        Spriter::SpatialInfo& info = timelineKey->info_;
         Vector3 position(info.x_, info.y_, 0.0f);
         if (flipX_)
             position.x_ = -position.x_;

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

@@ -430,8 +430,8 @@ void Renderer2D::UpdateViewBatchInfo(ViewBatchInfo2D& viewBatchInfo, Camera* cam
     if (viewBatchInfo.batchUpdatedFrameNumber_ == frame_.frameNumber_)
         return;
 
-    PODVector<const SourceBatch2D*>& soruceBatches = viewBatchInfo.sourceBatches_;
-    soruceBatches.Clear();
+    PODVector<const SourceBatch2D*>& sourceBatches = viewBatchInfo.sourceBatches_;
+    sourceBatches.Clear();
     for (unsigned d = 0; d < drawables_.Size(); ++d)
     {
         if (!drawables_[d]->IsInView(camera))
@@ -441,11 +441,11 @@ void Renderer2D::UpdateViewBatchInfo(ViewBatchInfo2D& viewBatchInfo, Camera* cam
         for (unsigned b = 0; b < batches.Size(); ++b)
         {
             if (batches[b].material_ && !batches[b].vertices_.Empty())
-                soruceBatches.Push(&batches[b]);
+                sourceBatches.Push(&batches[b]);
         }
     }
 
-    Sort(soruceBatches.Begin(), soruceBatches.End(), CompareSourceBatch2Ds);
+    Sort(sourceBatches.Begin(), sourceBatches.End(), CompareSourceBatch2Ds);
 
     viewBatchInfo.batchCount_ = 0;
     Material* currMaterial = 0;
@@ -454,10 +454,10 @@ void Renderer2D::UpdateViewBatchInfo(ViewBatchInfo2D& viewBatchInfo, Camera* cam
     unsigned vStart = 0;
     unsigned vCount = 0;
 
-    for (unsigned b = 0; b < soruceBatches.Size(); ++b)
+    for (unsigned b = 0; b < sourceBatches.Size(); ++b)
     {
-        Material* material = soruceBatches[b]->material_;
-        const Vector<Vertex2D>& vertices = soruceBatches[b]->vertices_;
+        Material* material = sourceBatches[b]->material_;
+        const Vector<Vertex2D>& vertices = sourceBatches[b]->vertices_;
 
         // When new material encountered, finish the current batch and start new
         if (currMaterial != material)