Ejemplo n.º 1
0
        public BroadPhase(AABB worldAABB, PairCallback callback)
        {
            _pairManager = new PairManager();
            _pairManager.Initialize(this, callback);

            Box2DXDebug.Assert(worldAABB.IsValid);
            _worldAABB  = worldAABB;
            _proxyCount = 0;

            Vec2 d = worldAABB.UpperBound - worldAABB.LowerBound;

            _quantizationFactor.X = (float)BROADPHASE_MAX / d.X;
            _quantizationFactor.Y = (float)BROADPHASE_MAX / d.Y;

            for (ushort i = 0; i < Settings.MaxProxies - 1; ++i)
            {
                _proxyPool[i]              = new Proxy();
                _proxyPool[i].Next         = (ushort)(i + 1);
                _proxyPool[i].TimeStamp    = 0;
                _proxyPool[i].OverlapCount = BroadPhase.Invalid;
                _proxyPool[i].UserData     = null;
            }
            _proxyPool[Settings.MaxProxies - 1]              = new Proxy();
            _proxyPool[Settings.MaxProxies - 1].Next         = PairManager.NullProxy;
            _proxyPool[Settings.MaxProxies - 1].TimeStamp    = 0;
            _proxyPool[Settings.MaxProxies - 1].OverlapCount = BroadPhase.Invalid;
            _proxyPool[Settings.MaxProxies - 1].UserData     = null;
            _freeProxy = 0;

            _timeStamp        = 1;
            _queryResultCount = 0;

            for (int i = 0; i < 2; i++)
            {
                _bounds[i] = new Bound[(2 * Settings.MaxProxies)];
            }

            int bCount = 2 * Settings.MaxProxies;

            for (int j = 0; j < 2; j++)
            {
                for (int k = 0; k < bCount; k++)
                {
                    _bounds[j][k] = new Bound();
                }
            }
        }
Ejemplo n.º 2
0
        public BroadPhase(AABB worldAABB, PairCallback callback)
        {
            this._pairManager = new PairManager();
            this._pairManager.Initialize(this, callback);
            Box2DXDebug.Assert(worldAABB.IsValid);
            this._worldAABB  = worldAABB;
            this._proxyCount = 0;
            Vec2 vec = worldAABB.UpperBound - worldAABB.LowerBound;

            this._quantizationFactor.X = (float)BroadPhase.BROADPHASE_MAX / vec.X;
            this._quantizationFactor.Y = (float)BroadPhase.BROADPHASE_MAX / vec.Y;
            ushort num = 0;

            while ((int)num < Settings.MaxProxies - 1)
            {
                this._proxyPool[(int)num]              = new Proxy();
                this._proxyPool[(int)num].Next         = (ushort)(num + 1);
                this._proxyPool[(int)num].TimeStamp    = 0;
                this._proxyPool[(int)num].OverlapCount = BroadPhase.Invalid;
                this._proxyPool[(int)num].UserData     = null;
                num += 1;
            }
            this._proxyPool[Settings.MaxProxies - 1]              = new Proxy();
            this._proxyPool[Settings.MaxProxies - 1].Next         = PairManager.NullProxy;
            this._proxyPool[Settings.MaxProxies - 1].TimeStamp    = 0;
            this._proxyPool[Settings.MaxProxies - 1].OverlapCount = BroadPhase.Invalid;
            this._proxyPool[Settings.MaxProxies - 1].UserData     = null;
            this._freeProxy        = 0;
            this._timeStamp        = 1;
            this._queryResultCount = 0;
            for (int i = 0; i < 2; i++)
            {
                this._bounds[i] = new Bound[2 * Settings.MaxProxies];
            }
            int num2 = 2 * Settings.MaxProxies;

            for (int j = 0; j < 2; j++)
            {
                for (int k = 0; k < num2; k++)
                {
                    this._bounds[j][k] = new Bound();
                }
            }
        }
Ejemplo n.º 3
0
 public BroadPhase(AABB worldAABB, PairCallback callback)
 {
     this._pairManager = new PairManager();
     this._pairManager.Initialize(this, callback);
     Box2DXDebug.Assert(worldAABB.IsValid);
     this._worldAABB = worldAABB;
     this._proxyCount = 0;
     Vec2 vec = worldAABB.UpperBound - worldAABB.LowerBound;
     this._quantizationFactor.X = (float)BroadPhase.BROADPHASE_MAX / vec.X;
     this._quantizationFactor.Y = (float)BroadPhase.BROADPHASE_MAX / vec.Y;
     ushort num = 0;
     while ((int)num < Settings.MaxProxies - 1)
     {
         this._proxyPool[(int)num] = new Proxy();
         this._proxyPool[(int)num].Next = (ushort)(num + 1);
         this._proxyPool[(int)num].TimeStamp = 0;
         this._proxyPool[(int)num].OverlapCount = BroadPhase.Invalid;
         this._proxyPool[(int)num].UserData = null;
         num += 1;
     }
     this._proxyPool[Settings.MaxProxies - 1] = new Proxy();
     this._proxyPool[Settings.MaxProxies - 1].Next = PairManager.NullProxy;
     this._proxyPool[Settings.MaxProxies - 1].TimeStamp = 0;
     this._proxyPool[Settings.MaxProxies - 1].OverlapCount = BroadPhase.Invalid;
     this._proxyPool[Settings.MaxProxies - 1].UserData = null;
     this._freeProxy = 0;
     this._timeStamp = 1;
     this._queryResultCount = 0;
     for (int i = 0; i < 2; i++)
     {
         this._bounds[i] = new Bound[2 * Settings.MaxProxies];
     }
     int num2 = 2 * Settings.MaxProxies;
     for (int j = 0; j < 2; j++)
     {
         for (int k = 0; k < num2; k++)
         {
             this._bounds[j][k] = new Bound();
         }
     }
 }
Ejemplo n.º 4
0
 public void Initialize(BroadPhase broadPhase, PairCallback callback)
 {
     this._broadPhase = broadPhase;
     this._callback   = callback;
 }
Ejemplo n.º 5
0
		public BroadPhase(AABB worldAABB, PairCallback callback)
		{
			_pairManager = new PairManager();
			_pairManager.Initialize(this, callback);

			Box2DXDebug.Assert(worldAABB.IsValid);
			_worldAABB = worldAABB;
			_proxyCount = 0;

			Vec2 d = worldAABB.UpperBound - worldAABB.LowerBound;
			_quantizationFactor.X = (float)BROADPHASE_MAX / d.X;
			_quantizationFactor.Y = (float)BROADPHASE_MAX / d.Y;

			for (ushort i = 0; i < Settings.MaxProxies - 1; ++i)
			{
				_proxyPool[i] = new Proxy();
				_proxyPool[i].Next = (ushort)(i + 1);
				_proxyPool[i].TimeStamp = 0;
				_proxyPool[i].OverlapCount = BroadPhase.Invalid;
				_proxyPool[i].UserData = null;
			}
			_proxyPool[Settings.MaxProxies - 1] = new Proxy();
			_proxyPool[Settings.MaxProxies - 1].Next = PairManager.NullProxy;
			_proxyPool[Settings.MaxProxies - 1].TimeStamp = 0;
			_proxyPool[Settings.MaxProxies - 1].OverlapCount = BroadPhase.Invalid;
			_proxyPool[Settings.MaxProxies - 1].UserData = null;
			_freeProxy = 0;

			_timeStamp = 1;
			_queryResultCount = 0;

			for (int i = 0; i < 2; i++)
			{
				_bounds[i] = new Bound[(2 * Settings.MaxProxies)];
			}

			int bCount = 2 * Settings.MaxProxies;
			for (int j = 0; j < 2; j++)
				for (int k = 0; k < bCount; k++)
					_bounds[j][k] = new Bound();
		}
		public void Initialize(BroadPhase broadPhase, PairCallback callback)
		{
			_broadPhase = broadPhase;
			_callback = callback;
		}