idTech4.Game.Animation.idMD5Anim.GetBounds C# (CSharp) Method

GetBounds() public method

public GetBounds ( int time, int cycleCount ) : idBounds
time int
cycleCount int
return idBounds
		public idBounds GetBounds(int time, int cycleCount)
		{
			FrameBlend frame = ConvertTimeToFrame(time, cycleCount);
			
			idBounds bounds = _bounds[frame.Frame1];
			bounds.AddBounds(_bounds[frame.Frame2]);

			// origin position
			Vector3 offset = _baseFrame[0].Translation;

			if((_jointInfo[0].AnimationBits & (AnimationBits.TranslationX | AnimationBits.TranslationY | AnimationBits.TranslationZ)) != 0)
			{
				int componentOffset1 = _animatedComponentCount * frame.Frame1 + _jointInfo[0].FirstComponent;
				int componentOffset2 = _animatedComponentCount * frame.Frame2 + _jointInfo[0].FirstComponent;

				if((_jointInfo[0].AnimationBits & AnimationBits.TranslationX) == AnimationBits.TranslationX)
				{
					offset.X = _componentFrames[componentOffset1] * frame.FrontLerp + _componentFrames[componentOffset2] * frame.BackLerp;
					componentOffset1++;
					componentOffset2++;
				}

				if((_jointInfo[0].AnimationBits & AnimationBits.TranslationY) == AnimationBits.TranslationY)
				{
					offset.Y = _componentFrames[componentOffset1] * frame.FrontLerp + _componentFrames[componentOffset2] * frame.BackLerp;
					componentOffset1++;
					componentOffset2++;
				}

				if((_jointInfo[0].AnimationBits & AnimationBits.TranslationZ) == AnimationBits.TranslationZ)
				{
					offset.Z = _componentFrames[componentOffset1] * frame.FrontLerp + _componentFrames[componentOffset2] * frame.BackLerp;
				}
			}

			bounds.Min -= offset;
			bounds.Max -= offset;

			return bounds;
		}