コード例 #1
0
ファイル: BroadPhase.cs プロジェクト: CloneDeath/Box2DX
        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();
                }
            }
        }
コード例 #2
0
ファイル: BroadPhase.cs プロジェクト: levi1994/LitDev
        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();
                }
            }
        }
コード例 #3
0
ファイル: BroadPhase.cs プロジェクト: litdev1/LitDev
 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();
         }
     }
 }
コード例 #4
0
ファイル: BroadPhase.cs プロジェクト: colgreen/box2dx
		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();
		}