Exemplo n.º 1
0
		public bool GetBounds(int currentTime, out idBounds bounds)
		{
			bounds = idBounds.Zero;

			if((_modelDef == null) || (_modelDef.Model == null))
			{
				return false;
			}

			int count = 0;

			if(_afPoseJoints.Count > 0)
			{
				bounds = _afPoseBounds;
				count = 1;
			}

			for(int i = (int) AnimationChannel.All; i < (int) AnimationChannel.Count; i++)
			{
				for(int j = 0; j < idR.AnimationCountPerChannel; j++)
				{
					idAnimBlend blend = _channels[i, j];
				
					if(blend.AddBounds(currentTime, ref bounds, _removeOriginOffset) == true)
					{
						count++;
					}
				}
			}

			if(count == 0)
			{
				if(_frameBounds.IsCleared == false)
				{
					bounds = _frameBounds;
					return true;
				}
				else
				{
					return false;
				}
			}

			bounds.Translate(_modelDef.VisualOffset);

			if(idR.CvarSystem.GetBool("g_debugBounds") == true)
			{
				idConsole.Warning("TODO: g_debugBounds");

				/*if ( bounds[1][0] - bounds[0][0] > 2048 || bounds[1][1] - bounds[0][1] > 2048 ) {
					if ( entity ) {
						gameLocal.Warning( "big frameBounds on entity '%s' with model '%s': %f,%f", entity->name.c_str(), modelDef->ModelHandle()->Name(), bounds[1][0] - bounds[0][0], bounds[1][1] - bounds[0][1] );
					} else {
						gameLocal.Warning( "big frameBounds on model '%s': %f,%f", modelDef->ModelHandle()->Name(), bounds[1][0] - bounds[0][0], bounds[1][1] - bounds[0][1] );
					}
				}*/
			}

			_frameBounds = bounds;

			return true;
		}
Exemplo n.º 2
0
        public bool GetBounds(int currentTime, out idBounds bounds)
        {
            bounds = idBounds.Zero;

            if ((_modelDef == null) || (_modelDef.Model == null))
            {
                return(false);
            }

            int count = 0;

            if (_afPoseJoints.Count > 0)
            {
                bounds = _afPoseBounds;
                count  = 1;
            }

            for (int i = (int)AnimationChannel.All; i < (int)AnimationChannel.Count; i++)
            {
                for (int j = 0; j < idR.AnimationCountPerChannel; j++)
                {
                    idAnimBlend blend = _channels[i, j];

                    if (blend.AddBounds(currentTime, ref bounds, _removeOriginOffset) == true)
                    {
                        count++;
                    }
                }
            }

            if (count == 0)
            {
                if (_frameBounds.IsCleared == false)
                {
                    bounds = _frameBounds;
                    return(true);
                }
                else
                {
                    return(false);
                }
            }

            bounds.Translate(_modelDef.VisualOffset);

            if (idR.CvarSystem.GetBool("g_debugBounds") == true)
            {
                idConsole.Warning("TODO: g_debugBounds");

                /*if ( bounds[1][0] - bounds[0][0] > 2048 || bounds[1][1] - bounds[0][1] > 2048 ) {
                 *      if ( entity ) {
                 *              gameLocal.Warning( "big frameBounds on entity '%s' with model '%s': %f,%f", entity->name.c_str(), modelDef->ModelHandle()->Name(), bounds[1][0] - bounds[0][0], bounds[1][1] - bounds[0][1] );
                 *      } else {
                 *              gameLocal.Warning( "big frameBounds on model '%s': %f,%f", modelDef->ModelHandle()->Name(), bounds[1][0] - bounds[0][0], bounds[1][1] - bounds[0][1] );
                 *      }
                 * }*/
            }

            _frameBounds = bounds;

            return(true);
        }