Example #1
0
        public void Link(idClip clip, idEntity entity, int newID, Vector3 newOrigin, Matrix newAxis, int renderModelHandle)
        {
            if (this.Disposed == true)
            {
                throw new ObjectDisposedException("idClipModel");
            }

            _entity = entity;
            _id     = newID;
            _origin = newOrigin;
            _axis   = newAxis;

            if (_renderModelHandle != -1)
            {
                _renderModelHandle = renderModelHandle;

                RenderEntityComponent renderEntity = idR.Game.RenderWorld.GetRenderEntity(renderModelHandle);

                if (renderEntity != null)
                {
                    _bounds = renderEntity.Bounds;
                }
            }

            Link(clip);
        }
Example #2
0
        /// <summary>
        ///
        /// </summary>
        /// <remarks>Must have been linked with an entity and ID before.</remarks>
        /// <param name="clip"></param>
        public void Link(idClip clip)
        {
            if (this.Disposed == true)
            {
                throw new ObjectDisposedException("idClipModel");
            }

            if (_entity == null)
            {
                return;
            }

            if (_clipLinks != null)
            {
                Unlink();                 // unlink from old position.
            }

            if (_bounds.IsCleared == true)
            {
                return;
            }

            // set the abs box
            if (_axis != Matrix.Identity)
            {
                // expand for rotation
                _absBounds = idBounds.FromTransformedBounds(_bounds, _origin, _axis);
            }
            else
            {
                // normal
                _absBounds.Min = _bounds.Min + _origin;
                _absBounds.Max = _bounds.Max + _origin;
            }

            // because movement is clipped an epsilon away from an actual edge,
            // we must fully check even when bounding boxes don't quite touch
            _absBounds.Min -= new Vector3(BoxEpsilon, BoxEpsilon, BoxEpsilon);
            _absBounds.Max += new Vector3(BoxEpsilon, BoxEpsilon, BoxEpsilon);

            // TODO: this may not be correct! from what I can gleam it just starts at the start of the array
            LinkSectors(clip.Sectors[0]);
        }
Example #3
0
		public void Link(idClip clip, idEntity entity, int newID, Vector3 newOrigin, Matrix newAxis, int renderModelHandle)
		{
			if(this.Disposed == true)
			{
				throw new ObjectDisposedException("idClipModel");
			}

			_entity = entity;
			_id = newID;
			_origin = newOrigin;
			_axis = newAxis;

			if(_renderModelHandle != -1)
			{
				_renderModelHandle = renderModelHandle;

				RenderEntityComponent renderEntity = idR.Game.RenderWorld.GetRenderEntity(renderModelHandle);

				if(renderEntity != null)
				{
					_bounds = renderEntity.Bounds;
				}
			}

			Link(clip);
		}
Example #4
0
		public void Link(idClip clip, idEntity entity, int newID, Vector3 newOrigin, Matrix newAxis)
		{
			Link(clip, entity, newID, newOrigin, newAxis, -1);
		}
Example #5
0
		/// <summary>
		/// 
		/// </summary>
		/// <remarks>Must have been linked with an entity and ID before.</remarks>
		/// <param name="clip"></param>
		public void Link(idClip clip)
		{
			if(this.Disposed == true)
			{
				throw new ObjectDisposedException("idClipModel");
			}

			if(_entity == null)
			{
				return;
			}

			if(_clipLinks != null)
			{
				Unlink(); // unlink from old position.
			}

			if(_bounds.IsCleared == true)
			{
				return;
			}
			
			// set the abs box
			if(_axis != Matrix.Identity)
			{
				// expand for rotation
				_absBounds = idBounds.FromTransformedBounds(_bounds, _origin, _axis);
			}
			else
			{
				// normal
				_absBounds.Min = _bounds.Min + _origin;
				_absBounds.Max = _bounds.Max + _origin;
			}

			// because movement is clipped an epsilon away from an actual edge,
			// we must fully check even when bounding boxes don't quite touch
			_absBounds.Min -= new Vector3(BoxEpsilon, BoxEpsilon, BoxEpsilon);
			_absBounds.Max += new Vector3(BoxEpsilon, BoxEpsilon, BoxEpsilon);

			// TODO: this may not be correct! from what I can gleam it just starts at the start of the array
			LinkSectors(clip.Sectors[0]);
		}
Example #6
0
 public void Link(idClip clip, idEntity entity, int newID, Vector3 newOrigin, Matrix newAxis)
 {
     Link(clip, entity, newID, newOrigin, newAxis, -1);
 }