Przeglądaj źródła

Properly handle evaluating a curve with a single keyframe at non-zero time

BearishSun 9 lat temu
rodzic
commit
33e1a48673
1 zmienionych plików z 3 dodań i 8 usunięć
  1. 3 8
      Source/BansheeCore/Source/BsAnimationCurve.cpp

+ 3 - 8
Source/BansheeCore/Source/BsAnimationCurve.cpp

@@ -179,17 +179,12 @@ namespace BansheeEngine
 #endif
 #endif
 
 
 		if (keyframes.size() > 0)
 		if (keyframes.size() > 0)
-		{
-			mStart = keyframes[0].time;
 			mEnd = keyframes.back().time;
 			mEnd = keyframes.back().time;
-		}
 		else
 		else
-		{
-			mStart = 0.0f;
 			mEnd = 0.0f;
 			mEnd = 0.0f;
-		}
 
 
-		mLength = mEnd - mStart;
+		mStart = 0.0f;
+		mLength = mEnd;
 	}
 	}
 
 
 	template <class T>
 	template <class T>
@@ -202,7 +197,7 @@ namespace BansheeEngine
 			time = 0.0f;
 			time = 0.0f;
 
 
 		// Wrap time if looping
 		// Wrap time if looping
-		if(loop)
+		if(loop && mLength > 0.0f)
 		{
 		{
 			if (time < mStart)
 			if (time < mStart)
 				time = time + (std::floor(mEnd - time) / mLength) * mLength;
 				time = time + (std::floor(mEnd - time) / mLength) * mLength;